2 Extern implementation of Nit module file
7 #define new_HashSet_of_String file___new_HashSet_of_String
8 #define HashSet_of_String_add file___HashSet_of_String_add
9 #define NativeString_to_s file___NativeString_to_s
10 #define String_to_cstring file___String_to_cstring
12 Set_of_String
file___String_files___impl( String recv
)
14 #line 379 "lib/standard/file.nit"
20 dir_path
= String_to_cstring( recv
);
21 if ((dir
= opendir(dir_path
)) == NULL
)
28 HashSet_of_String results
;
32 results
= new_HashSet_of_String();
34 while ( ( de
= readdir( dir
) ) != NULL
)
35 if ( strcmp( de
->d_name
, ".." ) != 0 &&
36 strcmp( de
->d_name
, "." ) != 0 )
38 file_name
= NativeString_to_s( strdup( de
->d_name
) );
39 HashSet_of_String_add( results
, file_name
);
43 return HashSet_of_String_as_Set_of_String( results
);
47 struct stat
* file___NativeString_file_lstat___impl( char* recv
)
49 #line 414 "lib/standard/file.nit"
52 struct stat
* stat_element
;
54 stat_element
= malloc(sizeof(struct stat
));
55 res
= lstat(recv
, stat_element
);
56 if (res
== -1) return NULL
;
60 int file___FileStat_is_reg___impl( struct stat
* recv
)
62 #line 436 "lib/standard/file.nit"
64 return S_ISREG(recv
->st_mode
); }
66 int file___FileStat_is_dir___impl( struct stat
* recv
)
68 #line 437 "lib/standard/file.nit"
70 return S_ISDIR(recv
->st_mode
); }
72 int file___FileStat_is_chr___impl( struct stat
* recv
)
74 #line 438 "lib/standard/file.nit"
76 return S_ISCHR(recv
->st_mode
); }
78 int file___FileStat_is_blk___impl( struct stat
* recv
)
80 #line 439 "lib/standard/file.nit"
82 return S_ISBLK(recv
->st_mode
); }
84 int file___FileStat_is_fifo___impl( struct stat
* recv
)
86 #line 440 "lib/standard/file.nit"
88 return S_ISFIFO(recv
->st_mode
); }
90 int file___FileStat_is_lnk___impl( struct stat
* recv
)
92 #line 441 "lib/standard/file.nit"
94 return S_ISLNK(recv
->st_mode
); }
96 int file___FileStat_is_sock___impl( struct stat
* recv
)
98 #line 442 "lib/standard/file.nit"
100 return S_ISSOCK(recv
->st_mode
); }