3 /* This file is part of NIT ( http://www.nitlanguage.org ).
5 * Copyright 2004-2008 Jean Privat <jean@pryen.org>
6 * Copyright 2008 Floréal Morandat <morandat@lirmm.fr>
7 * Copyright 2008 Jean-Sébastien Gélinas <calestar@gmail.com>
9 * This file is free software, which comes along with NIT. This software is
10 * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 * PARTICULAR PURPOSE. You can modify it is you want, provided this header
13 * is kept unaltered, and a notification of the changes is added.
14 * You are allowed to redistribute it and sell it, alone or is a part of
21 #include <sys/types.h>
23 extern int string_NativeString_NativeString_file_exists_0(char *f
);
24 extern void *string_NativeString_NativeString_file_stat_0(char *f
);
25 extern void *file_NativeFile_NativeFile_file_stat_0(FILE *f
);
26 extern int string_NativeString_NativeString_file_delete_0(char *f
);
27 FILE* file_int_fdtostream(int fd
, char* mode
);
29 #define file_NativeFile_NativeFile_io_read_2(p, b, l) fread((b), 1, (l), (FILE*)(p))
30 #define file_NativeFile_NativeFile_io_write_2(p, b, l) fwrite((b), 1, (l), (FILE*)(p))
31 #define file_NativeFile_NativeFile_io_close_0(self) fclose((FILE*)(self))
33 #define file_NativeFileCapable_NativeFileCapable_io_open_read_1(p0) fopen((p0), "r")
35 #define file_NativeFileCapable_NativeFileCapable_io_open_write_1(p0) fopen((p0), "w")
36 #define file_NativeFileCapable_NativeFileCapable_native_stdin_0() stdin
37 #define file_NativeFileCapable_NativeFileCapable_native_stdout_0() stdout
38 #define file_NativeFileCapable_NativeFileCapable_native_stderr_0() stderr
39 #define file_FileStat_FileStat_mode_0(self) (((struct stat*)self)->st_mode)
40 #define file_FileStat_FileStat_atime_0(self) (((struct stat*)self)->st_atime)
41 #define file_FileStat_FileStat_ctime_0(self) (((struct stat*)self)->st_ctime)
42 #define file_FileStat_FileStat_mtime_0(self) (((struct stat*)self)->st_mtime)
43 #define file_FileStat_FileStat_size_0(self) (((struct stat*)self)->st_size)
45 #define string_NativeString_NativeString_file_mkdir_0(p) (mkdir(p, 0777))
46 #define string_NativeString_NativeString_file_getcwd_0(p) (getcwd(NULL, 0))
47 #define string_NativeString_NativeString_file_chdir_0(p) (chdir(p)?-1:0) /* hack to avoid warn_unused_result */
48 #define file_NativeString_realpath(p) (realpath(p, NULL))
50 #define file_stdin_poll_in(self) file_stdin_poll_in_()
51 int file_stdin_poll_in_(void);