2 Extern implementation of Nit module file
7 #include "core__file._ffi.h"
9 #include <android/log.h>
10 #define PRINT_ERROR(...) (void)__android_log_print(ANDROID_LOG_WARN, "Nit", __VA_ARGS__)
12 #define PRINT_ERROR(...) fprintf(stderr, __VA_ARGS__)
14 #define Array_of_Int_length file___Array_of_Int_length
15 #define Array_of_Int__index file___Array_of_Int__index
16 long file___NativeFile_io_close___impl( FILE* self
)
18 #line 1396 "../lib/core/file.nit"
20 return fclose(self
); }
21 long file___NativeFile_set_buffering_type___impl( FILE* self
, long buf_length
, long mode
)
23 #line 1416 "../lib/core/file.nit"
26 return setvbuf(self
, NULL
, mode
, buf_length
);
28 long file___NativeFile_io_read___impl( FILE* self
, char* buf
, long len
)
30 #line 1383 "../lib/core/file.nit"
33 return fread(buf
, 1, len
, self
);
35 int file___NativeFile_ferror___impl( FILE* self
)
37 #line 1408 "../lib/core/file.nit"
39 return ferror(self
); }
40 long file___NativeFile_io_write___impl( FILE* self
, char* buf
, long from
, long len
)
42 #line 1387 "../lib/core/file.nit"
45 return fwrite(buf
+from
, 1, len
, self
);
47 long file___Sys_buffer_mode_line___impl( Sys self
)
49 #line 1464 "../lib/core/file.nit"
52 int file___NativeFileStat_is_dir___impl( struct stat
* self
)
54 #line 1363 "../lib/core/file.nit"
56 return S_ISDIR(self
->st_mode
); }
57 int file___NativeString_file_exists___impl( char* self
)
59 #line 1301 "../lib/core/file.nit"
62 FILE *hdl
= fopen(self
,"r");
68 struct stat
* file___NativeString_file_stat___impl( char* self
)
70 #line 1309 "../lib/core/file.nit"
74 if(stat(self
, &buff
) != -1) {
75 struct stat
* stat_element
;
76 stat_element
= malloc(sizeof(struct stat
));
77 return memcpy(stat_element
, &buff
, sizeof(struct stat
));
81 char* file___NativeString_file_realpath___impl( char* self
)
83 #line 1338 "../lib/core/file.nit"
85 return realpath(self
, NULL
); }
86 int file___NativeString_file_mkdir___impl( char* self
)
88 #line 1328 "../lib/core/file.nit"
90 return !mkdir(self
, 0777); }
91 char* file___NativeDir_readdir___impl( DIR* self
)
93 #line 1441 "../lib/core/file.nit"
101 void file___NativeDir_closedir___impl( DIR* self
)
103 #line 1438 "../lib/core/file.nit"
106 FILE* file___new_NativeFile_io_open_read___impl( char* path
)
108 #line 1420 "../lib/core/file.nit"
110 return fopen(path
, "r"); }
111 FILE* file___new_NativeFile_io_open_write___impl( char* path
)
113 #line 1422 "../lib/core/file.nit"
115 return fopen(path
, "w"); }
116 FILE* file___new_NativeFile_native_stdin___impl( )
118 #line 1424 "../lib/core/file.nit"
121 FILE* file___new_NativeFile_native_stdout___impl( )
123 #line 1426 "../lib/core/file.nit"
126 FILE* file___new_NativeFile_native_stderr___impl( )
128 #line 1428 "../lib/core/file.nit"
131 DIR* file___new_NativeDir_opendir___impl( char* path
)
133 #line 1435 "../lib/core/file.nit"
135 return opendir(path
); }
136 char* file___Sys_native_getcwd___impl( Sys self
)
138 #line 1584 "../lib/core/file.nit"
140 return getcwd(NULL
, 0); }