ni_nitdoc: added fast copy past utility to signatures.
[nit.git] / c_src / file._nitni.c
1 #include "file._nitni.h"
2 #include "file_nit.h"
3 /* out/indirect function for file::Stdin::poll_in */
4 val_t Stdin_poll_in___out( val_t recv )
5 {
6 int orig_return;
7 val_t trans_return;
8 orig_return = file_stdin_poll_in( NULL );
9 trans_return = TAG_Bool(orig_return);
10 nitni_local_ref_clean( );
11 return trans_return;
12 }
13 /* out/indirect function for file::String::files */
14 val_t String_files___out( val_t recv )
15 {
16 String trans_recv;
17 Set orig_return;
18 val_t trans_return;
19 trans_recv = malloc( sizeof( struct s_String ) );
20 trans_recv->ref.val = NIT_NULL;
21 trans_recv->ref.count = 0;
22 nitni_local_ref_add( (struct nitni_ref *)trans_recv );
23 trans_recv->ref.val = recv;
24 orig_return = malloc( sizeof( struct s_Set ) );
25 orig_return->ref.val = NIT_NULL;
26 orig_return->ref.count = 0;
27 orig_return = String_files___impl( trans_recv );
28 trans_return = orig_return->ref.val;
29 nitni_local_ref_clean( );
30 return trans_return;
31 }
32 /* out/indirect function for file::NativeString::file_exists */
33 val_t NativeString_file_exists___out( val_t recv )
34 {
35 char * trans_recv;
36 int orig_return;
37 val_t trans_return;
38 trans_recv = UNBOX_NativeString(recv);
39 orig_return = string_NativeString_NativeString_file_exists_0( trans_recv );
40 trans_return = TAG_Bool(orig_return);
41 nitni_local_ref_clean( );
42 return trans_return;
43 }
44 /* out/indirect function for file::NativeString::file_stat */
45 val_t NativeString_file_stat___out( val_t recv )
46 {
47 char * trans_recv;
48 void* orig_return;
49 val_t trans_return;
50 trans_recv = UNBOX_NativeString(recv);
51 orig_return = string_NativeString_NativeString_file_stat_0( trans_recv );
52 trans_return = BOX_FileStat(orig_return);
53 nitni_local_ref_clean( );
54 return trans_return;
55 }
56 /* out/indirect function for file::NativeString::file_mkdir */
57 val_t NativeString_file_mkdir___out( val_t recv )
58 {
59 char * trans_recv;
60 int orig_return;
61 val_t trans_return;
62 trans_recv = UNBOX_NativeString(recv);
63 orig_return = string_NativeString_NativeString_file_mkdir_0( trans_recv );
64 trans_return = TAG_Bool(orig_return);
65 nitni_local_ref_clean( );
66 return trans_return;
67 }
68 /* out/indirect function for file::NativeString::file_delete */
69 val_t NativeString_file_delete___out( val_t recv )
70 {
71 char * trans_recv;
72 int orig_return;
73 val_t trans_return;
74 trans_recv = UNBOX_NativeString(recv);
75 orig_return = string_NativeString_NativeString_file_delete_0( trans_recv );
76 trans_return = TAG_Bool(orig_return);
77 nitni_local_ref_clean( );
78 return trans_return;
79 }
80 /* out/indirect function for file::FileStat::mode */
81 val_t FileStat_mode___out( val_t recv )
82 {
83 void* trans_recv;
84 bigint orig_return;
85 val_t trans_return;
86 trans_recv = UNBOX_FileStat(recv);
87 orig_return = file_FileStat_FileStat_mode_0( trans_recv );
88 trans_return = TAG_Int(orig_return);
89 nitni_local_ref_clean( );
90 return trans_return;
91 }
92 /* out/indirect function for file::FileStat::atime */
93 val_t FileStat_atime___out( val_t recv )
94 {
95 void* trans_recv;
96 bigint orig_return;
97 val_t trans_return;
98 trans_recv = UNBOX_FileStat(recv);
99 orig_return = file_FileStat_FileStat_atime_0( trans_recv );
100 trans_return = TAG_Int(orig_return);
101 nitni_local_ref_clean( );
102 return trans_return;
103 }
104 /* out/indirect function for file::FileStat::ctime */
105 val_t FileStat_ctime___out( val_t recv )
106 {
107 void* trans_recv;
108 bigint orig_return;
109 val_t trans_return;
110 trans_recv = UNBOX_FileStat(recv);
111 orig_return = file_FileStat_FileStat_ctime_0( trans_recv );
112 trans_return = TAG_Int(orig_return);
113 nitni_local_ref_clean( );
114 return trans_return;
115 }
116 /* out/indirect function for file::FileStat::mtime */
117 val_t FileStat_mtime___out( val_t recv )
118 {
119 void* trans_recv;
120 bigint orig_return;
121 val_t trans_return;
122 trans_recv = UNBOX_FileStat(recv);
123 orig_return = file_FileStat_FileStat_mtime_0( trans_recv );
124 trans_return = TAG_Int(orig_return);
125 nitni_local_ref_clean( );
126 return trans_return;
127 }
128 /* out/indirect function for file::FileStat::size */
129 val_t FileStat_size___out( val_t recv )
130 {
131 void* trans_recv;
132 bigint orig_return;
133 val_t trans_return;
134 trans_recv = UNBOX_FileStat(recv);
135 orig_return = file_FileStat_FileStat_size_0( trans_recv );
136 trans_return = TAG_Int(orig_return);
137 nitni_local_ref_clean( );
138 return trans_return;
139 }
140 /* out/indirect function for file::NativeFile::io_read */
141 val_t NativeFile_io_read___out( val_t recv, val_t buf, val_t len )
142 {
143 void* trans_recv;
144 char * trans___buf;
145 bigint orig_return;
146 val_t trans_return;
147 trans_recv = UNBOX_NativeFile(recv);
148 trans___buf = UNBOX_NativeString(buf);
149 orig_return = file_NativeFile_NativeFile_io_read_2( trans_recv, trans___buf, UNTAG_Int(len) );
150 trans_return = TAG_Int(orig_return);
151 nitni_local_ref_clean( );
152 return trans_return;
153 }
154 /* out/indirect function for file::NativeFile::io_write */
155 val_t NativeFile_io_write___out( val_t recv, val_t buf, val_t len )
156 {
157 void* trans_recv;
158 char * trans___buf;
159 bigint orig_return;
160 val_t trans_return;
161 trans_recv = UNBOX_NativeFile(recv);
162 trans___buf = UNBOX_NativeString(buf);
163 orig_return = file_NativeFile_NativeFile_io_write_2( trans_recv, trans___buf, UNTAG_Int(len) );
164 trans_return = TAG_Int(orig_return);
165 nitni_local_ref_clean( );
166 return trans_return;
167 }
168 /* out/indirect function for file::NativeFile::io_close */
169 val_t NativeFile_io_close___out( val_t recv )
170 {
171 void* trans_recv;
172 bigint orig_return;
173 val_t trans_return;
174 trans_recv = UNBOX_NativeFile(recv);
175 orig_return = file_NativeFile_NativeFile_io_close_0( trans_recv );
176 trans_return = TAG_Int(orig_return);
177 nitni_local_ref_clean( );
178 return trans_return;
179 }
180 /* out/indirect function for file::NativeFile::file_stat */
181 val_t NativeFile_file_stat___out( val_t recv )
182 {
183 void* trans_recv;
184 void* orig_return;
185 val_t trans_return;
186 trans_recv = UNBOX_NativeFile(recv);
187 orig_return = file_NativeFile_NativeFile_file_stat_0( trans_recv );
188 trans_return = BOX_FileStat(orig_return);
189 nitni_local_ref_clean( );
190 return trans_return;
191 }
192 /* out/indirect function for file::NativeFile::io_open_read */
193 val_t NEW_NativeFile_standard___file___NativeFile___io_open_read( val_t path )
194 {
195 char * trans___path;
196 void* orig_return;
197 val_t trans_return;
198 trans___path = UNBOX_NativeString(path);
199 orig_return = file_NativeFileCapable_NativeFileCapable_io_open_read_1( trans___path );
200 trans_return = BOX_NativeFile(orig_return);
201 nitni_local_ref_clean( );
202 return trans_return;
203 }
204 /* out/indirect function for file::NativeFile::io_open_write */
205 val_t NEW_NativeFile_standard___file___NativeFile___io_open_write( val_t path )
206 {
207 char * trans___path;
208 void* orig_return;
209 val_t trans_return;
210 trans___path = UNBOX_NativeString(path);
211 orig_return = file_NativeFileCapable_NativeFileCapable_io_open_write_1( trans___path );
212 trans_return = BOX_NativeFile(orig_return);
213 nitni_local_ref_clean( );
214 return trans_return;
215 }
216 /* out/indirect function for file::NativeFile::native_stdin */
217 val_t NEW_NativeFile_standard___file___NativeFile___native_stdin( )
218 {
219 void* orig_return;
220 val_t trans_return;
221 orig_return = file_NativeFileCapable_NativeFileCapable_native_stdin_0( );
222 trans_return = BOX_NativeFile(orig_return);
223 nitni_local_ref_clean( );
224 return trans_return;
225 }
226 /* out/indirect function for file::NativeFile::native_stdout */
227 val_t NEW_NativeFile_standard___file___NativeFile___native_stdout( )
228 {
229 void* orig_return;
230 val_t trans_return;
231 orig_return = file_NativeFileCapable_NativeFileCapable_native_stdout_0( );
232 trans_return = BOX_NativeFile(orig_return);
233 nitni_local_ref_clean( );
234 return trans_return;
235 }
236 /* out/indirect function for file::NativeFile::native_stderr */
237 val_t NEW_NativeFile_standard___file___NativeFile___native_stderr( )
238 {
239 void* orig_return;
240 val_t trans_return;
241 orig_return = file_NativeFileCapable_NativeFileCapable_native_stderr_0( );
242 trans_return = BOX_NativeFile(orig_return);
243 nitni_local_ref_clean( );
244 return trans_return;
245 }
246 /* friendly for hash_collection::HashSet::init */
247 HashSet file_new_HashSet( )
248 {
249 val_t orig_return;
250 HashSet trans_return;
251 trans_return = malloc( sizeof( struct s_HashSet ) );
252 trans_return->ref.val = NIT_NULL;
253 trans_return->ref.count = 0;
254 nitni_local_ref_add( (struct nitni_ref *)trans_return );
255 orig_return = NEW_HashSet_standard___collection___hash_collection___HashSet___init( );
256 trans_return->ref.val = orig_return;
257 return trans_return;
258 }
259 /* friendly for hash_collection::HashSet::(abstract_collection::SimpleCollection::add) */
260 void file_HashSet_add( HashSet recv, Object item )
261 {
262 val_t trans_recv;
263 val_t trans___item;
264 trans_recv = recv->ref.val;
265 trans___item = item->ref.val;
266 CALL_standard___collection___abstract_collection___SimpleCollection___add( trans_recv )( trans_recv, trans___item );
267 }
268 /* friendly for string::String::from_cstring */
269 String file_new_String_from_cstring( char * str )
270 {
271 val_t trans___str;
272 val_t orig_return;
273 String trans_return;
274 trans___str = BOX_NativeString(str);
275 trans_return = malloc( sizeof( struct s_String ) );
276 trans_return->ref.val = NIT_NULL;
277 trans_return->ref.count = 0;
278 nitni_local_ref_add( (struct nitni_ref *)trans_return );
279 orig_return = NEW_String_standard___string___String___from_cstring( trans___str );
280 trans_return->ref.val = orig_return;
281 return trans_return;
282 }
283 /* friendly for string::String::to_cstring */
284 char * file_String_to_cstring( String recv )
285 {
286 val_t trans_recv;
287 val_t orig_return;
288 char * trans_return;
289 trans_recv = recv->ref.val;
290 orig_return = CALL_standard___string___String___to_cstring( trans_recv )( trans_recv );
291 trans_return = UNBOX_NativeString(orig_return);
292 return trans_return;
293 }
294 int file_HashSet_is_a_Set( HashSet value )
295 {
296 val_t temp;
297 temp = value->ref.val;
298 if ( ! ( ISOBJ( temp ) ? ISNULL( temp ) || OBJISA( temp, standard___collection___abstract_collection___Set ): VALISA( temp, standard___collection___abstract_collection___Set ) ) ) return 0;
299 return 1;
300 }
301 Set file_HashSet_as_Set( HashSet value )
302 {
303 val_t temp;
304 Set out;
305 out = malloc( sizeof( struct s_Set ) );
306 out->ref.val = NIT_NULL;
307 out->ref.count = 0;
308 nitni_local_ref_add( (struct nitni_ref *)out );
309 temp = value->ref.val;
310 if ( ISNULL(temp) ){ fprintf( stderr, "Casting from HashSet[String] to Set[String] failed because value is null." );
311 abort();
312 }if ( ! ( ISOBJ( temp ) ? ISNULL( temp ) || OBJISA( temp, standard___collection___abstract_collection___Set ): VALISA( temp, standard___collection___abstract_collection___Set ) ) ){
313 fprintf( stderr, "Casting to Set[String] failed because value is not a Set[String]." );
314 abort();
315 }
316 out->ref.val = temp;
317 return out;
318 }
319 int file_String_is_a_Object( String value )
320 {
321 val_t temp;
322 temp = value->ref.val;
323 if ( ! ( ISOBJ( temp ) ? ISNULL( temp ) || OBJISA( temp, standard___kernel___Object ): VALISA( temp, standard___kernel___Object ) ) ) return 0;
324 return 1;
325 }
326 Object file_String_as_Object( String value )
327 {
328 val_t temp;
329 Object out;
330 out = malloc( sizeof( struct s_Object ) );
331 out->ref.val = NIT_NULL;
332 out->ref.count = 0;
333 nitni_local_ref_add( (struct nitni_ref *)out );
334 temp = value->ref.val;
335 if ( ISNULL(temp) ){ fprintf( stderr, "Casting from String to Object failed because value is null." );
336 abort();
337 }if ( ! ( ISOBJ( temp ) ? ISNULL( temp ) || OBJISA( temp, standard___kernel___Object ): VALISA( temp, standard___kernel___Object ) ) ){
338 fprintf( stderr, "Casting to Object failed because value is not a Object." );
339 abort();
340 }
341 out->ref.val = temp;
342 return out;
343 }