FreeBASIC  0.91.0
rtl-file.bas
Go to the documentation of this file.
1 '' intrinsic runtime lib file functions (OPEN, CLOSE, SEEK, GET, PUT, ... )
2 ''
3 '' chng: oct/2004 written [v1ctor]
4 
5 #include once "fb.bi"
6 #include once "fbint.bi"
7 #include once "ast.bi"
8 #include once "lex.bi"
9 #include once "rtl.bi"
10 
11  dim shared as FB_RTL_PROCDEF funcdata( 0 to 66 ) = _
12  { _
13 /' function fb_FileOpen _
14  ( _
15  byref str as string, _
16  byval mode as ulong, _
17  byval access as ulong, _
18  byval lock as ulong, _
19  byval fnum as long, _
20  byval len as long _
21  ) as long '/ _
22  ( _
23  @FB_RTL_FILEOPEN, NULL, _
24  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
25  NULL, FB_RTL_OPT_NONE, _
26  6, _
27  { _
28  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ), _
29  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
30  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
31  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
32  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
33  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
34  } _
35  ), _
36 /' function fb_FileOpenEncod _
37  ( _
38  byref str as string, _
39  byval mode as ulong, _
40  byval access as ulong, _
41  byval lock as ulong, _
42  byval fnum as long, _
43  byval len as long, _
44  byval encoding as zstring ptr _
45  ) as long '/ _
46  ( _
47  @FB_RTL_FILEOPEN_ENCOD, NULL, _
48  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
49  NULL, FB_RTL_OPT_NONE, _
50  7, _
51  { _
52  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ), _
53  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
54  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
55  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
56  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
57  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
58  ( typeAddrOf( FB_DATATYPE_CHAR ), FB_PARAMMODE_BYVAL, FALSE ) _
59  } _
60  ), _
61 /' function fb_FileOpenShort _
62  ( _
63  byref str_file_mode as string, _
64  byval fnum as long, _
65  byref filename as string, _
66  byval len as long, _
67  byref str_access_mode as string, _
68  byref str_lock_mode as string _
69  ) as long '/ _
70  ( _
71  @FB_RTL_FILEOPEN_SHORT, NULL, _
72  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
73  NULL, FB_RTL_OPT_NONE, _
74  6, _
75  { _
76  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ), _
77  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
78  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ), _
79  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
80  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ), _
81  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ) _
82  } _
83  ), _
84 /' function fb_FileOpenCons _
85  ( _
86  byref str_filename as string, _
87  byval mode as ulong, _
88  byval access as ulong, _
89  byval lock as ulong, _
90  byval fnum as long, _
91  byval len as long, _
92  byval encoding as zstring ptr _
93  ) as long '/ _
94  ( _
95  @FB_RTL_FILEOPEN_CONS, NULL, _
96  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
97  NULL, FB_RTL_OPT_NONE, _
98  7, _
99  { _
100  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ), _
101  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
102  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
103  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
104  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
105  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
106  ( typeAddrOf( FB_DATATYPE_CHAR ), FB_PARAMMODE_BYVAL, FALSE ) _
107  } _
108  ), _
109 /' function fb_FileOpenErr _
110  ( _
111  byref str_filename as string, _
112  byval mode as ulong, _
113  byval access as ulong, _
114  byval lock as ulong, _
115  byval fnum as long, _
116  byval len as long, _
117  byval encoding as zstring ptr _
118  ) as long '/ _
119  ( _
120  @FB_RTL_FILEOPEN_ERR, NULL, _
121  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
122  NULL, FB_RTL_OPT_NONE, _
123  7, _
124  { _
125  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ), _
126  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
127  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
128  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
129  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
130  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
131  ( typeAddrOf( FB_DATATYPE_CHAR ), FB_PARAMMODE_BYVAL, FALSE ) _
132  } _
133  ), _
134 /' function fb_FileOpenPipe _
135  ( _
136  byref str_filename as string, _
137  byval mode as ulong, _
138  byval access as ulong, _
139  byval lock as ulong, _
140  byval fnum as long, _
141  byval len as long, _
142  byval encoding as zstring ptr _
143  ) as long '/ _
144  ( _
145  @FB_RTL_FILEOPEN_PIPE, NULL, _
146  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
147  NULL, FB_RTL_OPT_NONE, _
148  7, _
149  { _
150  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ), _
151  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
152  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
153  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
154  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
155  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
156  ( typeAddrOf( FB_DATATYPE_CHAR ), FB_PARAMMODE_BYVAL, FALSE ) _
157  } _
158  ), _
159 /' function fb_FileOpenScrn _
160  ( _
161  byref str_filename as string, _
162  byval mode as ulong, _
163  byval access as ulong, _
164  byval lock as ulong, _
165  byval fnum as long, _
166  byval len as long, _
167  byval encoding as zstring ptr _
168  ) as long '/ _
169  ( _
170  @FB_RTL_FILEOPEN_SCRN, NULL, _
171  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
172  @rtlMultinput_cb, FB_RTL_OPT_NONE, _
173  7, _
174  { _
175  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ), _
176  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
177  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
178  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
179  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
180  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
181  ( typeAddrOf( FB_DATATYPE_CHAR ), FB_PARAMMODE_BYVAL, FALSE ) _
182  } _
183  ), _
184 /' function fb_FileOpenLpt _
185  ( _
186  byref str_filename as string, _
187  byval mode as ulong, _
188  byval access as ulong, _
189  byval lock as ulong, _
190  byval fnum as long, _
191  byval len as long, _
192  byval encoding as zstring ptr _
193  ) as long '/ _
194  ( _
195  @FB_RTL_FILEOPEN_LPT, NULL, _
196  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
197  @rtlPrinter_cb, FB_RTL_OPT_NONE, _
198  7, _
199  { _
200  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ), _
201  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
202  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
203  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
204  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
205  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
206  ( typeAddrOf( FB_DATATYPE_CHAR ), FB_PARAMMODE_BYVAL, FALSE ) _
207  } _
208  ), _
209 /' function fb_FileOpenCom _
210  ( _
211  byref str_filename as string, _
212  byval mode as ulong, _
213  byval access as ulong, _
214  byval lock as ulong, _
215  byval fnum as long, _
216  byval len as long, _
217  byval encoding as zstring ptr _
218  ) as long '/ _
219  ( _
220  @FB_RTL_FILEOPEN_COM, NULL, _
221  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
222  NULL, FB_RTL_OPT_NONE, _
223  7, _
224  { _
225  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ), _
226  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
227  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
228  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
229  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
230  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
231  ( typeAddrOf( FB_DATATYPE_CHAR ), FB_PARAMMODE_BYVAL, FALSE ) _
232  } _
233  ), _
234 /' function fb_FileOpenQB _
235  ( _
236  byref s as string, _
237  byval mode as ulong, _
238  byval access as ulong, _
239  byval lock as ulong, _
240  byval filenum as long, _
241  byval len as long _
242  ) as long '/ _
243  ( _
244  @FB_RTL_FILEOPEN_QB, NULL, _
245  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
246  NULL, FB_RTL_OPT_NONE, _
247  6, _
248  { _
249  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ), _
250  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
251  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
252  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
253  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
254  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
255  } _
256  ), _
257 /' function fb_FileClose( byval fnum as long ) as long '/ _
258  ( _
259  @FB_RTL_FILECLOSE, NULL, _
260  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
261  NULL, FB_RTL_OPT_NONE, _
262  1, _
263  { _
264  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
265  } _
266  ), _
267 /' function fb_FileCloseAll( ) as long '/ _
268  ( _
269  @FB_RTL_FILECLOSEALL, NULL, _
270  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
271  NULL, FB_RTL_OPT_NONE, _
272  0 _
273  ), _
274 /' function fb_FilePut _
275  ( _
276  byval fnum as long, _
277  byval pos as long, _
278  byref value as any, _
279  byval valuelen as uinteger _
280  ) as long '/ _
281  ( _
282  @FB_RTL_FILEPUT, NULL, _
283  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
284  NULL, FB_RTL_OPT_NONE, _
285  4, _
286  { _
287  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
288  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
289  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYREF, FALSE ), _
290  ( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ) _
291  } _
292  ), _
293 /' function fb_FilePutLarge _
294  ( _
295  byval fnum as long, _
296  byval pos as longint, _
297  byref value as any, _
298  byval valuelen as uinteger _
299  ) as long '/ _
300  ( _
301  @FB_RTL_FILEPUTLARGE, NULL, _
302  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
303  NULL, FB_RTL_OPT_NONE, _
304  4, _
305  { _
306  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
307  ( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYVAL, FALSE ), _
308  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYREF, FALSE ), _
309  ( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ) _
310  } _
311  ), _
312 /' function fb_FilePutStr _
313  ( _
314  byval fnum as long, _
315  byval pos as long, _
316  byref str as any, _
317  byval str_len as integer _
318  ) as long '/ _
319  ( _
320  @FB_RTL_FILEPUTSTR, NULL, _
321  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
322  NULL, FB_RTL_OPT_NONE, _
323  4, _
324  { _
325  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
326  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
327  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYREF, FALSE ), _
328  ( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ) _
329  } _
330  ), _
331 /' function fb_FilePutStrLarge _
332  ( _
333  byval fnum as long, _
334  byval pos as longint, _
335  byref str as any, _
336  byval str_len as integer _
337  ) as long '/ _
338  ( _
339  @FB_RTL_FILEPUTSTRLARGE, NULL, _
340  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
341  NULL, FB_RTL_OPT_NONE, _
342  4, _
343  { _
344  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
345  ( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYVAL, FALSE ), _
346  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYREF, FALSE ), _
347  ( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ) _
348  } _
349  ), _
350 /' function fb_FilePutArray _
351  ( _
352  byval fnum as long, _
353  byval pos as long, _
354  array() as any _
355  ) as long '/ _
356  ( _
357  @FB_RTL_FILEPUTARRAY, NULL, _
358  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
359  NULL, FB_RTL_OPT_NONE, _
360  3, _
361  { _
362  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
363  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
364  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ) _
365  } _
366  ), _
367 /' function fb_FilePutArrayLarge _
368  ( _
369  byval fnum as long, _
370  byval pos as longint, _
371  array() as any _
372  ) as long '/ _
373  ( _
374  @FB_RTL_FILEPUTARRAYLARGE, NULL, _
375  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
376  NULL, FB_RTL_OPT_NONE, _
377  3, _
378  { _
379  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
380  ( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYVAL, FALSE ), _
381  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ) _
382  } _
383  ), _
384 /' function fb_FileGet _
385  ( _
386  byval fnum as long, _
387  byval pos as long, _
388  byref value as any, _
389  byval valuelen as uinteger _
390  ) as long '/ _
391  ( _
392  @FB_RTL_FILEGET, NULL, _
393  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
394  NULL, FB_RTL_OPT_NONE, _
395  4, _
396  { _
397  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
398  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
399  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYREF, FALSE ), _
400  ( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ) _
401  } _
402  ), _
403 /' function fb_FileGetLarge _
404  ( _
405  byval fnum as long, _
406  byval pos as longint, _
407  byref value as any, _
408  byval valuelen as uinteger _
409  ) as long '/ _
410  ( _
411  @FB_RTL_FILEGETLARGE, NULL, _
412  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
413  NULL, FB_RTL_OPT_NONE, _
414  4, _
415  { _
416  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
417  ( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYVAL, FALSE ), _
418  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYREF, FALSE ), _
419  ( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ) _
420  } _
421  ), _
422 /' function fb_FileGetStr _
423  ( _
424  byval fnum as long, _
425  byval pos as long, _
426  byref str as any, _
427  byval str_len as integer _
428  ) as long '/ _
429  ( _
430  @FB_RTL_FILEGETSTR, NULL, _
431  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
432  NULL, FB_RTL_OPT_NONE, _
433  4, _
434  { _
435  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
436  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
437  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYREF, FALSE ), _
438  ( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ) _
439  } _
440  ), _
441 /' function fb_FileGetStrLarge _
442  ( _
443  byval fnum as long, _
444  byval pos as longint, _
445  byref str as any, _
446  byval str_len as integer _
447  ) as long '/ _
448  ( _
449  @FB_RTL_FILEGETSTRLARGE, NULL, _
450  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
451  NULL, FB_RTL_OPT_NONE, _
452  4, _
453  { _
454  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
455  ( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYVAL, FALSE ), _
456  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYREF, FALSE ), _
457  ( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ) _
458  } _
459  ), _
460 /' function fb_FileGetArray _
461  ( _
462  byval fnum as long, _
463  byval pos as long, _
464  array() as any _
465  ) as long '/ _
466  ( _
467  @FB_RTL_FILEGETARRAY, NULL, _
468  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
469  NULL, FB_RTL_OPT_NONE, _
470  3, _
471  { _
472  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
473  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
474  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ) _
475  } _
476  ), _
477 /' function fb_FileGetArrayLarge _
478  ( _
479  byval fnum as long, _
480  byval pos as longint, _
481  array() as any _
482  ) as long '/ _
483  ( _
484  @FB_RTL_FILEGETARRAYLARGE, NULL, _
485  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
486  NULL, FB_RTL_OPT_NONE, _
487  3, _
488  { _
489  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
490  ( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYVAL, FALSE ), _
491  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ) _
492  } _
493  ), _
494 /' function fb_FileGetIOB _
495  ( _
496  byval fnum as long, _
497  byval pos as long, _
498  byref dst as any, _
499  byval chars as uinteger, _
500  byref bytesread as uinteger _
501  ) as long '/ _
502  ( _
503  @FB_RTL_FILEGETIOB, NULL, _
504  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
505  NULL, FB_RTL_OPT_NONE, _
506  5, _
507  { _
508  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
509  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
510  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYREF, FALSE ), _
511  ( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ), _
512  ( FB_DATATYPE_UINT, FB_PARAMMODE_BYREF, FALSE ) _
513  } _
514  ), _
515 /' function fb_FileGetLargeIOB _
516  ( _
517  byval fnum as long, _
518  byval pos as longint, _
519  byref dst as any, _
520  byval chars as uinteger, _
521  byref bytesread as uinteger _
522  ) as long '/ _
523  ( _
524  @FB_RTL_FILEGETLARGEIOB, NULL, _
525  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
526  NULL, FB_RTL_OPT_NONE, _
527  5, _
528  { _
529  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
530  ( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYVAL, FALSE ), _
531  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYREF, FALSE ), _
532  ( FB_DATATYPE_UINT, FB_PARAMMODE_BYVAL, FALSE ), _
533  ( FB_DATATYPE_UINT, FB_PARAMMODE_BYREF, FALSE ) _
534  } _
535  ), _
536 /' function fb_FileGetStrIOB _
537  ( _
538  byval fnum as long, _
539  byval pos as long, _
540  byref str as any, _
541  byval str_len as integer, _
542  byref bytesread as uinteger _
543  ) as long '/ _
544  ( _
545  @FB_RTL_FILEGETSTRIOB, NULL, _
546  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
547  NULL, FB_RTL_OPT_NONE, _
548  5, _
549  { _
550  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
551  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
552  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYREF, FALSE ), _
553  ( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ), _
554  ( FB_DATATYPE_UINT, FB_PARAMMODE_BYREF, FALSE ) _
555  } _
556  ), _
557 /' function fb_FileGetStrLargeIOB _
558  ( _
559  byval fnum as long, _
560  byval pos as longint, _
561  byref str as any, _
562  byval str_len as integer, _
563  byref bytesread as uinteger _
564  ) as long '/ _
565  ( _
566  @FB_RTL_FILEGETSTRLARGEIOB, NULL, _
567  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
568  NULL, FB_RTL_OPT_NONE, _
569  5, _
570  { _
571  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
572  ( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYVAL, FALSE ), _
573  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYREF, FALSE ), _
574  ( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ), _
575  ( FB_DATATYPE_UINT, FB_PARAMMODE_BYREF, FALSE ) _
576  } _
577  ), _
578 /' function fb_FileGetArrayIOB _
579  ( _
580  byval fnum as long, _
581  byval pos as long, _
582  array() as any, _
583  byref bytesread as uinteger _
584  ) as long '/ _
585  ( _
586  @FB_RTL_FILEGETARRAYIOB, NULL, _
587  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
588  NULL, FB_RTL_OPT_NONE, _
589  4, _
590  { _
591  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
592  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
593  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ), _
594  ( FB_DATATYPE_UINT, FB_PARAMMODE_BYREF, FALSE ) _
595  } _
596  ), _
597 /' function fb_FileGetArrayLargeIOB _
598  ( _
599  byval fnum as long, _
600  byval pos as longint, _
601  array() as any, _
602  byref bytesread as uinteger _
603  ) as long '/ _
604  ( _
605  @FB_RTL_FILEGETARRAYLARGEIOB, NULL, _
606  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
607  NULL, FB_RTL_OPT_NONE, _
608  4, _
609  { _
610  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
611  ( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYVAL, FALSE ), _
612  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYDESC, FALSE ), _
613  ( FB_DATATYPE_UINT, FB_PARAMMODE_BYREF, FALSE ) _
614  } _
615  ), _
616 /' function fb_FileTell( byval fnum as long ) as longint '/ _
617  ( _
618  @FB_RTL_FILETELL, NULL, _
619  FB_DATATYPE_LONGINT, FB_FUNCMODE_FBCALL, _
620  NULL, FB_RTL_OPT_NONE, _
621  1, _
622  { _
623  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
624  } _
625  ), _
626 /' function fb_FileSeek( byval fnum as long, byval newpos as long ) as long '/ _
627  ( _
628  @FB_RTL_FILESEEK, NULL, _
629  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
630  NULL, FB_RTL_OPT_NONE, _
631  2, _
632  { _
633  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
634  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
635  } _
636  ), _
637 /' function fb_FileSeekLarge _
638  ( _
639  byval fnum as long, _
640  byval newpos as longint _
641  ) as long '/ _
642  ( _
643  @FB_RTL_FILESEEKLARGE, NULL, _
644  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
645  NULL, FB_RTL_OPT_NONE, _
646  2, _
647  { _
648  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
649  ( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYVAL, FALSE ) _
650  } _
651  ), _
652 /' function fb_FileStrInput _
653  ( _
654  byval bytes as integer, _
655  byval fnum as long = 0 _
656  ) as string '/ _
657  ( _
658  @FB_RTL_FILESTRINPUT, NULL, _
659  FB_DATATYPE_STRING, FB_FUNCMODE_FBCALL, _
660  @rtlMultinput_cb, FB_RTL_OPT_NONE, _
661  2, _
662  { _
663  ( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ), _
664  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, TRUE, 0 ) _
665  } _
666  ), _
667 /' function fb_FileLineInput _
668  ( _
669  byval fnum as long, _
670  byref dst as any, _
671  byval dst_len as integer, _
672  byval fillrem as long = 1 _
673  ) as long '/ _
674  ( _
675  @FB_RTL_FILELINEINPUT, NULL, _
676  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
677  NULL, FB_RTL_OPT_NONE, _
678  4, _
679  { _
680  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
681  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYREF, FALSE ), _
682  ( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ), _
683  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, TRUE, 1 ) _
684  } _
685  ), _
686 /' function fb_FileLineInputWstr _
687  ( _
688  byval fnum as long, _
689  byval dst as wstring ptr, _
690  byval max_chars as integer _
691  ) as long '/ _
692  ( _
693  @FB_RTL_FILELINEINPUTWSTR, NULL, _
694  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
695  NULL, FB_RTL_OPT_NONE, _
696  3, _
697  { _
698  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
699  ( typeAddrOf( FB_DATATYPE_WCHAR ), FB_PARAMMODE_BYVAL, FALSE ), _
700  ( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ) _
701  } _
702  ), _
703 /' function fb_LineInput _
704  ( _
705  byref text as string, _
706  byref dst as any, _
707  byval dst_len as integer, _
708  byval fillrem as long, _
709  byval addquestion as long, _
710  byval addnewline as long = 1 _
711  ) as long '/ _
712  ( _
713  @FB_RTL_CONSOLELINEINPUT, NULL, _
714  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
715  @rtlMultinput_cb, FB_RTL_OPT_NONE, _
716  6, _
717  { _
718  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ), _
719  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYREF, FALSE ), _
720  ( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ), _
721  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
722  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
723  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, TRUE, 1 ) _
724  } _
725  ), _
726 /' function fb_LineInputWstr _
727  ( _
728  byval text as wstring ptr, _
729  byval dst as wstring ptr, _
730  byval max_chars as integer, _
731  byval addquestion as long, _
732  byval addnewline as long _
733  ) as long '/ _
734  ( _
735  @FB_RTL_CONSOLELINEINPUTWSTR, NULL, _
736  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
737  @rtlMultinput_cb, FB_RTL_OPT_NONE, _
738  5, _
739  { _
740  ( typeAddrOf( FB_DATATYPE_WCHAR ), FB_PARAMMODE_BYVAL, FALSE ), _
741  ( typeAddrOf( FB_DATATYPE_WCHAR ), FB_PARAMMODE_BYVAL, FALSE ), _
742  ( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ), _
743  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
744  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
745  } _
746  ), _
747 /' function fb_FileInput( byval fnum as long ) as long '/ _
748  ( _
749  @FB_RTL_FILEINPUT, NULL, _
750  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
751  NULL, FB_RTL_OPT_NONE, _
752  1, _
753  { _
754  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
755  } _
756  ), _
757 /' function fb_ConsoleInput _
758  ( _
759  byref text as string, _
760  byval addquestion as long, _
761  byval addnewline as long _
762  ) as long '/ _
763  ( _
764  @FB_RTL_CONSOLEINPUT, NULL, _
765  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
766  @rtlMultinput_cb, FB_RTL_OPT_NONE, _
767  3, _
768  { _
769  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ), _
770  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
771  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
772  } _
773  ), _
774 /' function fb_InputByte( byref dst as byte ) as long '/ _
775  ( _
776  @FB_RTL_INPUTBYTE, NULL, _
777  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
778  NULL, FB_RTL_OPT_NONE, _
779  1, _
780  { _
781  ( FB_DATATYPE_BYTE, FB_PARAMMODE_BYREF, FALSE ) _
782  } _
783  ), _
784 /' function fb_InputUbyte( byref dst as ubyte ) as long '/ _
785  ( _
786  @FB_RTL_INPUTUBYTE, NULL, _
787  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
788  NULL, FB_RTL_OPT_NONE, _
789  1, _
790  { _
791  ( FB_DATATYPE_UBYTE, FB_PARAMMODE_BYREF, FALSE ) _
792  } _
793  ), _
794 /' function fb_InputShort( byref dst as short ) as long '/ _
795  ( _
796  @FB_RTL_INPUTSHORT, NULL, _
797  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
798  @rtlMultinput_cb, FB_RTL_OPT_NONE, _
799  1, _
800  { _
801  ( FB_DATATYPE_SHORT, FB_PARAMMODE_BYREF, FALSE ) _
802  } _
803  ), _
804 /' function fb_InputUshort( byref dst as ushort ) as long '/ _
805  ( _
806  @FB_RTL_INPUTUSHORT, NULL, _
807  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
808  @rtlMultinput_cb, FB_RTL_OPT_NONE, _
809  1, _
810  { _
811  ( FB_DATATYPE_USHORT, FB_PARAMMODE_BYREF, FALSE ) _
812  } _
813  ), _
814 /' function fb_InputInt( byref dst as long ) as long '/ _
815  ( _
816  @FB_RTL_INPUTINT, NULL, _
817  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
818  NULL, FB_RTL_OPT_NONE, _
819  1, _
820  { _
821  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYREF, FALSE ) _
822  } _
823  ), _
824 /' function fb_InputUint( byref dst as ulong ) as long '/ _
825  ( _
826  @FB_RTL_INPUTUINT, NULL, _
827  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
828  NULL, FB_RTL_OPT_NONE, _
829  1, _
830  { _
831  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYREF, FALSE ) _
832  } _
833  ), _
834 /' function fb_InputLongint( byref dst as longint ) as long '/ _
835  ( _
836  @FB_RTL_INPUTLONGINT, NULL, _
837  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
838  NULL, FB_RTL_OPT_NONE, _
839  1, _
840  { _
841  ( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYREF, FALSE ) _
842  } _
843  ), _
844 /' function fb_InputUlongint( byref dst as ulongint ) as long '/ _
845  ( _
846  @FB_RTL_INPUTULONGINT, NULL, _
847  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
848  NULL, FB_RTL_OPT_NONE, _
849  1, _
850  { _
851  ( FB_DATATYPE_ULONGINT, FB_PARAMMODE_BYREF, FALSE ) _
852  } _
853  ), _
854 /' function fb_InputSingle( byref dst as single ) as long '/ _
855  ( _
856  @FB_RTL_INPUTSINGLE, NULL, _
857  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
858  NULL, FB_RTL_OPT_NONE, _
859  1, _
860  { _
861  ( FB_DATATYPE_SINGLE, FB_PARAMMODE_BYREF, FALSE ) _
862  } _
863  ), _
864 /' function fb_InputDouble( byref dst as double ) as long '/ _
865  ( _
866  @FB_RTL_INPUTDOUBLE, NULL, _
867  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
868  NULL, FB_RTL_OPT_NONE, _
869  1, _
870  { _
871  ( FB_DATATYPE_DOUBLE, FB_PARAMMODE_BYREF, FALSE ) _
872  } _
873  ), _
874 /' function fb_InputString _
875  ( _
876  byref dst as any, _
877  byval strlen as integer, _
878  byval fillrem as long = 1 _
879  ) as long '/ _
880  ( _
881  @FB_RTL_INPUTSTR, NULL, _
882  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
883  NULL, FB_RTL_OPT_NONE, _
884  3, _
885  { _
886  ( FB_DATATYPE_VOID, FB_PARAMMODE_BYREF, FALSE ), _
887  ( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ), _
888  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, TRUE, 1 ) _
889  } _
890  ), _
891 /' function fb_InputWstr _
892  ( _
893  byval str as wstring ptr, _
894  byval length as integer _
895  ) as long '/ _
896  ( _
897  @FB_RTL_INPUTWSTR, NULL, _
898  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
899  NULL, FB_RTL_OPT_NONE, _
900  2, _
901  { _
902  ( typeAddrOf( FB_DATATYPE_WCHAR ), FB_PARAMMODE_BYVAL, FALSE ), _
903  ( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ) _
904  } _
905  ), _
906 /' function fb_FileLock _
907  ( _
908  byval fnum as long, _
909  byval inipos as ulong, _
910  byval endpos as ulong _
911  ) as long '/ _
912  ( _
913  @FB_RTL_FILELOCK, NULL, _
914  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
915  NULL, FB_RTL_OPT_NONE, _
916  3, _
917  { _
918  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
919  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
920  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, TRUE, 0 ) _
921  } _
922  ), _
923 /' function fb_FileLockLarge _
924  ( _
925  byval fnum as long, _
926  byval inipos as longint, _
927  byval endpos as longint _
928  ) as long '/ _
929  ( _
930  @FB_RTL_FILELOCKLARGE, NULL, _
931  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
932  NULL, FB_RTL_OPT_NONE, _
933  3, _
934  { _
935  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
936  ( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYVAL, FALSE ), _
937  ( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYVAL, TRUE, 0 ) _
938  } _
939  ), _
940 /' function fb_FileUnlock _
941  ( _
942  byval fnum as long, _
943  byval inipos as ulong, _
944  byval endpos as ulong _
945  ) as long '/ _
946  ( _
947  @FB_RTL_FILEUNLOCK, NULL, _
948  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
949  NULL, FB_RTL_OPT_NONE, _
950  3, _
951  { _
952  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
953  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, FALSE ), _
954  ( FB_DATATYPE_ULONG, FB_PARAMMODE_BYVAL, TRUE, 0 ) _
955  } _
956  ), _
957 /' function fb_FileUnlockLarge _
958  ( _
959  byval fnum as long, _
960  byval inipos as longint, _
961  byval endpos as longint _
962  ) as long '/ _
963  ( _
964  @FB_RTL_FILEUNLOCKLARGE, NULL, _
965  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
966  NULL, FB_RTL_OPT_NONE, _
967  3, _
968  { _
969  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ), _
970  ( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYVAL, FALSE ), _
971  ( FB_DATATYPE_LONGINT, FB_PARAMMODE_BYVAL, TRUE, 0 ) _
972  } _
973  ), _
974 /' function fb_rename alias "rename" cdecl _
975  ( _
976  byval oldname as zstring ptr, _
977  byval newname as zstring ptr _
978  ) as long '/ _
979  ( _
980  @FB_RTL_FILERENAME, @"rename", _
981  FB_DATATYPE_LONG, FB_FUNCMODE_CDECL, _
982  NULL, FB_RTL_OPT_NONE, _
983  2, _
984  { _
985  ( typeAddrOf( FB_DATATYPE_CHAR ), FB_PARAMMODE_BYVAL, FALSE ), _
986  ( typeAddrOf( FB_DATATYPE_CHAR ), FB_PARAMMODE_BYVAL, FALSE ) _
987  } _
988  ), _
989 /' function fb_FileWstrInput _
990  ( _
991  byval chars as integer, _
992  byval fnum as long = 0 _
993  ) as wstring '/ _
994  ( _
995  @FB_RTL_FILEWSTRINPUT, NULL, _
996  FB_DATATYPE_WCHAR, FB_FUNCMODE_FBCALL, _
997  @rtlMultinput_cb, FB_RTL_OPT_NONE, _
998  2, _
999  { _
1000  ( FB_DATATYPE_INTEGER, FB_PARAMMODE_BYVAL, FALSE ), _
1001  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, TRUE, 0 ) _
1002  } _
1003  ), _
1004 /' function freefile( ) as long '/ _
1005  ( _
1006  @"freefile", @"fb_FileFree", _
1007  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
1008  NULL, FB_RTL_OPT_NONE, _
1009  0 _
1010  ), _
1011 /' function eof( byval fnum as long ) as long '/ _
1012  ( _
1013  @"eof", @"fb_FileEof", _
1014  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
1015  NULL, FB_RTL_OPT_NONE, _
1016  1, _
1017  { _
1018  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
1019  } _
1020  ), _
1021 /' function kill( byref str as string ) as long '/ _
1022  ( _
1023  @"kill", @"fb_FileKill", _
1024  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
1025  NULL, FB_RTL_OPT_NONE, _
1026  1, _
1027  { _
1028  ( FB_DATATYPE_STRING, FB_PARAMMODE_BYREF, FALSE ) _
1029  } _
1030  ), _
1031 /' sub reset overload( ) '/ _
1032  ( _
1033  @"reset", @"fb_FileReset", _
1034  FB_DATATYPE_VOID, FB_FUNCMODE_FBCALL, _
1035  NULL, FB_RTL_OPT_OVER, _
1036  0 _
1037  ), _
1038 /' sub reset overload( byval streamno as long ) '/ _
1039  ( _
1040  @"reset", @"fb_FileResetEx", _
1041  FB_DATATYPE_VOID, FB_FUNCMODE_FBCALL, _
1042  NULL, FB_RTL_OPT_OVER, _
1043  1, _
1044  { _
1045  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
1046  } _
1047  ), _
1048 /' function lof( byval fnum as long ) as longint '/ _
1049  ( _
1050  @"lof", @"fb_FileSize", _
1051  FB_DATATYPE_LONGINT, FB_FUNCMODE_FBCALL, _
1052  NULL, FB_RTL_OPT_NONE, _
1053  1, _
1054  { _
1055  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
1056  } _
1057  ), _
1058 /' function loc( byval fnum as long ) as longint '/ _
1059  ( _
1060  @"loc", @"fb_FileLocation", _
1061  FB_DATATYPE_LONGINT, FB_FUNCMODE_FBCALL, _
1062  NULL, FB_RTL_OPT_NONE, _
1063  1, _
1064  { _
1065  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
1066  } _
1067  ), _
1068 /' function lpos( byval printer_index as long ) as long '/ _
1069  ( _
1070  @"lpos", @"fb_LPos", _
1071  FB_DATATYPE_LONG, FB_FUNCMODE_FBCALL, _
1072  @rtlPrinter_cb, FB_RTL_OPT_NONE, _
1073  1, _
1074  { _
1075  ( FB_DATATYPE_LONG, FB_PARAMMODE_BYVAL, FALSE ) _
1076  } _
1077  ), _
1078 /' EOL '/ _
1079  ( _
1080  NULL _
1081  ) _
1082  }
1083 
1084 '':::::
1086 
1088 
1089 end sub
1090 
1091 '':::::
1093 
1094  '' procs will be deleted when symbEnd is called
1095 
1096 end sub
1097 
1098 '':::::
1099 function rtlFileOpen _
1100  ( _
1101  byval filename as ASTNODE ptr, _
1102  byval fmode as ASTNODE ptr, _
1103  byval faccess as ASTNODE ptr, _
1104  byval flock as ASTNODE ptr, _
1105  byval filenum as ASTNODE ptr, _
1106  byval flen as ASTNODE ptr, _
1107  byval fencoding as ASTNODE ptr, _
1108  byval isfunc as integer, _
1109  byval openkind as FBOPENKIND _
1110  ) as ASTNODE ptr
1111 
1112  dim as ASTNODE ptr proc = any
1113  dim as FBSYMBOL ptr f = any
1114  dim as integer doencoding = any
1115 
1116  function = NULL
1117 
1118  ''
1119  doencoding = TRUE
1120 
1121  select case openkind
1122  case FB_FILE_TYPE_FILE
1123  if( fencoding = NULL ) then
1124  f = PROCLOOKUP( FILEOPEN )
1125  doencoding = FALSE
1126  else
1127  f = PROCLOOKUP( FILEOPEN_ENCOD )
1128  end if
1129 
1130  case FB_FILE_TYPE_CONS
1131  f = PROCLOOKUP( FILEOPEN_CONS )
1132 
1133  case FB_FILE_TYPE_ERR
1134  f = PROCLOOKUP( FILEOPEN_ERR )
1135 
1136  case FB_FILE_TYPE_PIPE
1137  f = PROCLOOKUP( FILEOPEN_PIPE )
1138 
1139  case FB_FILE_TYPE_SCRN
1140  f = PROCLOOKUP( FILEOPEN_SCRN )
1141 
1142  case FB_FILE_TYPE_LPT
1143  f = PROCLOOKUP( FILEOPEN_LPT )
1144 
1145  case FB_FILE_TYPE_COM
1146  f = PROCLOOKUP( FILEOPEN_COM )
1147 
1148  case else
1149  assert(openkind = FB_FILE_TYPE_QB)
1150  f = PROCLOOKUP( FILEOPEN_QB )
1151  doencoding = FALSE
1152  select case env.clopt.target
1153  case FB_COMPTARGET_WIN32, FB_COMPTARGET_CYGWIN
1154  fbAddLib("user32")
1155  fbAddLib("gdi32")
1156  fbAddLib("winspool")
1157  end select
1158  end select
1159 
1160  proc = astNewCALL( f )
1161 
1162  '' filename as string
1163  if( astNewARG( proc, filename ) = NULL ) then
1164  exit function
1165  end if
1166 
1167  '' byval mode as integer
1168  if( astNewARG( proc, fmode ) = NULL ) then
1169  exit function
1170  end if
1171 
1172  '' byval access as integer
1173  if( astNewARG( proc, faccess ) = NULL ) then
1174  exit function
1175  end if
1176 
1177  '' byval lock as integer
1178  if( astNewARG( proc, flock ) = NULL ) then
1179  exit function
1180  end if
1181 
1182  '' byval filenum as integer
1183  if( astNewARG( proc, filenum ) = NULL ) then
1184  exit function
1185  end if
1186 
1187  '' byval len as integer
1188  if( astNewARG( proc, flen ) = NULL ) then
1189  exit function
1190  end if
1191 
1192  if( doencoding ) then
1193  '' byval encoding as zstring ptr
1194  if( fencoding = NULL ) then
1195  fencoding = astNewCONSTi( 0, typeAddrOf( FB_DATATYPE_CHAR ) )
1196  end if
1197  if( astNewARG( proc, fencoding ) = NULL ) then
1198  exit function
1199  end if
1200  end if
1201 
1202  if( isfunc = FALSE ) then
1203  astAdd( rtlErrorCheck( proc ) )
1204  end if
1205 
1206  function = proc
1207 end function
1208 
1209 '':::::
1210 function rtlFileOpenShort _
1211  ( _
1212  byval filename as ASTNODE ptr, _
1213  byval fmode as ASTNODE ptr, _
1214  byval faccess as ASTNODE ptr, _
1215  byval flock as ASTNODE ptr, _
1216  byval filenum as ASTNODE ptr, _
1217  byval flen as ASTNODE ptr, _
1218  byval isfunc as integer _
1219  ) as ASTNODE ptr
1220 
1221  dim as ASTNODE ptr proc = any
1222  dim as FBSYMBOL ptr f = any
1223 
1224  function = NULL
1225 
1226  '' this is the short form of the OPEN command
1227  proc = astNewCALL( PROCLOOKUP( FILEOPEN_SHORT ) )
1228 
1229  '' mode as string
1230  if( astNewARG( proc, fmode ) = NULL ) then
1231  exit function
1232  end if
1233 
1234  '' byval filenum as integer
1235  if( astNewARG( proc, filenum ) = NULL ) then
1236  exit function
1237  end if
1238 
1239  '' filename as string
1240  if( astNewARG( proc, filename ) = NULL ) then
1241  exit function
1242  end if
1243 
1244  '' byval len as integer
1245  if( astNewARG( proc, flen ) = NULL ) then
1246  exit function
1247  end if
1248 
1249  '' faccess as string
1250  if( astNewARG( proc, faccess ) = NULL ) then
1251  exit function
1252  end if
1253 
1254  '' flock as string
1255  if( astNewARG( proc, flock ) = NULL ) then
1256  exit function
1257  end if
1258 
1259  if( isfunc = FALSE ) then
1260  astAdd( rtlErrorCheck( proc ) )
1261  end if
1262 
1263  function = proc
1264 end function
1265 
1266 '':::::
1267 function rtlFileClose _
1268  ( _
1269  byval filenum as ASTNODE ptr, _
1270  byval isfunc as integer _
1271  ) as ASTNODE ptr
1272 
1273  dim as ASTNODE ptr proc = any
1274 
1275  function = NULL
1276 
1277  ''
1278  if( filenum <> NULL ) then
1279  proc = astNewCALL( PROCLOOKUP( FILECLOSE ) )
1280 
1281  '' byval filenum as integer
1282  if( astNewARG( proc, filenum ) = NULL ) then
1283  exit function
1284  end if
1285  else
1286  proc = astNewCALL( PROCLOOKUP( FILECLOSEALL) )
1287  end if
1288 
1289  if( isfunc = FALSE ) then
1290  astAdd( rtlErrorCheck( proc ) )
1291  end if
1292 
1293  function = proc
1294 end function
1295 
1296 '':::::
1297 function rtlFileSeek _
1298  ( _
1299  byval filenum as ASTNODE ptr, _
1300  byval newpos as ASTNODE ptr _
1301  ) as integer
1302 
1303  dim as ASTNODE ptr proc = any
1304  dim as FBSYMBOL ptr f = any
1305  dim as integer pos_dtype = any
1306 
1307  function = FALSE
1308 
1309  pos_dtype = astGetDataType( newpos )
1310  assert( typeGetClass( pos_dtype ) = FB_DATACLASS_INTEGER )
1311  if( typeGetSize( pos_dtype ) = 8 ) then
1312  f = PROCLOOKUP( FILESEEKLARGE )
1313  else
1314  f = PROCLOOKUP( FILESEEK )
1315  end if
1316 
1317  proc = astNewCALL( f )
1318 
1319  '' byval filenum as integer
1320  if( astNewARG( proc, filenum ) = NULL ) then
1321  exit function
1322  end if
1323 
1324  '' byval newpos as integer
1325  if( astNewARG( proc, newpos ) = NULL ) then
1326  exit function
1327  end if
1328 
1329  astAdd( rtlErrorCheck( proc ) )
1330  function = TRUE
1331 end function
1332 
1333 '':::::
1334 function rtlFileTell _
1335  ( _
1336  byval filenum as ASTNODE ptr _
1337  ) as ASTNODE ptr
1338 
1339  dim as ASTNODE ptr proc = any
1340 
1341  function = NULL
1342 
1343  ''
1344  proc = astNewCALL( PROCLOOKUP( FILETELL ) )
1345 
1346  '' byval filenum as integer
1347  if( astNewARG( proc, filenum ) = NULL ) then
1348  exit function
1349  end if
1350 
1351  ''
1352  function = proc
1353 
1354 end function
1355 
1356 '':::::
1357 function rtlFilePut _
1358  ( _
1359  byval filenum as ASTNODE ptr, _
1360  byval offset as ASTNODE ptr, _
1361  byval src as ASTNODE ptr, _
1362  byval elements as ASTNODE ptr, _
1363  byval isfunc as integer _
1364  ) as ASTNODE ptr
1365 
1366  dim as ASTNODE ptr proc = any, bytes = any
1367  dim as integer dtype = any, o_dtype = any, isstring = any, islarge = any
1368  dim as longint lgt = any
1369  dim as FBSYMBOL ptr f = any
1370 
1371  function = NULL
1372 
1373  ''
1374  dtype = astGetDataType( src )
1375  isstring = symbIsString( dtype )
1376 
1377  if( offset = NULL ) then
1378  offset = astNewCONSTi( 0 )
1379  end if
1380  o_dtype = astGetDataType( offset )
1381 
1382  assert( typeGetClass( o_dtype ) = FB_DATACLASS_INTEGER )
1383  islarge = (typeGetSize( o_dtype ) = 8)
1384 
1385  if( isstring ) then
1386  if( islarge ) then
1387  f = PROCLOOKUP( FILEPUTSTRLARGE )
1388  else
1389  f = PROCLOOKUP( FILEPUTSTR )
1390  end if
1391  else
1392  if( islarge ) then
1393  f = PROCLOOKUP( FILEPUTLARGE )
1394  else
1395  f = PROCLOOKUP( FILEPUT )
1396  end if
1397  end if
1398 
1399  proc = astNewCALL( f )
1400 
1401  '' byval filenum as integer
1402  if( astNewARG( proc, filenum ) = NULL ) then
1403  exit function
1404  end if
1405 
1406  '' byval offset as integer
1407  if( astNewARG( proc, offset ) = NULL ) then
1408  exit function
1409  end if
1410 
1411  '' always calc len before pushing the param
1412  if( isstring ) then
1413  lgt = rtlCalcStrLen( src, dtype )
1414  else
1415  lgt = rtlCalcExprLen( src )
1416  end if
1417 
1418  if( elements = NULL ) then
1419  bytes = astNewCONSTi( lgt )
1420  else
1421  bytes = astNewBOP( AST_OP_MUL, elements, astNewCONSTi( lgt ) )
1422  end if
1423 
1424  '' any pointer fields?
1425  if( astGetDataType( src ) = FB_DATATYPE_STRUCT ) then
1426  if( symbGetUDTHasPtrField( astGetSubType( src ) ) ) then
1427  errReportParamWarn( proc->sym, 3, NULL, FB_WARNINGMSG_POINTERFIELDS )
1428  end if
1429  '' warn if data is pointer
1430  elseif( typeIsPtr( astGetDataType( src ) ) ) then
1431  errReportParamWarn( proc->sym, 3, NULL, FB_WARNINGMSG_PASSINGPTR )
1432  end if
1433 
1434  '' value as any | s as string
1435  if( astNewARG( proc, src ) = NULL ) then
1436  exit function
1437  end if
1438 
1439  '' byval bytes as integer
1440  if( astNewARG( proc, bytes ) = NULL ) then
1441  exit function
1442  end if
1443 
1444  if( isfunc = FALSE ) then
1445  astAdd( rtlErrorCheck( proc ) )
1446  end if
1447 
1448  function = proc
1449 end function
1450 
1451 '':::::
1452 function rtlFilePutArray _
1453  ( _
1454  byval filenum as ASTNODE ptr, _
1455  byval offset as ASTNODE ptr, _
1456  byval src as ASTNODE ptr, _
1457  byval isfunc as integer _
1458  ) as ASTNODE ptr
1459 
1460  dim as ASTNODE ptr proc = any
1461  dim as FBSYMBOL ptr f = any
1462  dim as integer o_dtype = any
1463 
1464  function = NULL
1465 
1466  if( offset = NULL ) then
1467  offset = astNewCONSTi( 0 )
1468  end if
1469  o_dtype = astGetDataType( offset )
1470 
1471  assert( typeGetClass( o_dtype ) = FB_DATACLASS_INTEGER )
1472  if( typeGetSize( o_dtype ) = 8 ) then
1473  f = PROCLOOKUP( FILEPUTARRAYLARGE )
1474  else
1475  f = PROCLOOKUP( FILEPUTARRAY )
1476  end if
1477 
1478  proc = astNewCALL( f )
1479 
1480  '' byval filenum as integer
1481  if( astNewARG( proc, filenum ) = NULL ) then
1482  exit function
1483  end if
1484 
1485  '' byval offset as integer
1486  if( astNewARG( proc, offset ) = NULL ) then
1487  exit function
1488  end if
1489 
1490  '' any pointer fields?
1491  if( astGetDataType( src ) = FB_DATATYPE_STRUCT ) then
1492  if( symbGetUDTHasPtrField( astGetSubType( src ) ) ) then
1493  errReportParamWarn( proc->sym, 3, NULL, FB_WARNINGMSG_POINTERFIELDS )
1494  end if
1495  '' warn if data is pointer
1496  elseif( typeIsPtr( astGetDataType( src ) ) ) then
1497  errReportParamWarn( proc->sym, 3, NULL, FB_WARNINGMSG_PASSINGPTR )
1498  end if
1499 
1500  '' array() as any
1501  if( astNewARG( proc, src ) = NULL ) then
1502  exit function
1503  end if
1504 
1505  if( isfunc = FALSE ) then
1506  astAdd( rtlErrorCheck( proc ) )
1507  end if
1508 
1509  function = proc
1510 end function
1511 
1512 '':::::
1513 function rtlFileGet _
1514  ( _
1515  byval filenum as ASTNODE ptr, _
1516  byval offset as ASTNODE ptr, _
1517  byval dst as ASTNODE ptr, _
1518  byval elements as ASTNODE ptr, _
1519  byval iobytes as ASTNODE ptr, _
1520  byval isfunc as integer _
1521  ) as ASTNODE ptr
1522 
1523  dim as ASTNODE ptr proc = any, bytes = any
1524  dim as integer dtype = any, o_dtype = any, isstring = any, islarge = any
1525  dim as longint lgt = any
1526  dim as FBSYMBOL ptr f = any
1527 
1528  function = NULL
1529 
1530  ''
1531  dtype = astGetDataType( dst )
1532  isstring = symbIsString( dtype )
1533 
1534  if( offset = NULL ) then
1535  offset = astNewCONSTi( 0 )
1536  end if
1537  o_dtype = astGetDataType( offset )
1538 
1539  assert( typeGetClass( o_dtype ) = FB_DATACLASS_INTEGER )
1540  islarge = (typeGetSize( o_dtype ) = 8)
1541 
1542  if( iobytes ) then
1543  if( isstring ) then
1544  if( islarge ) then
1545  f = PROCLOOKUP( FILEGETSTRLARGEIOB )
1546  else
1547  f = PROCLOOKUP( FILEGETSTRIOB )
1548  end if
1549  else
1550  if( islarge ) then
1551  f = PROCLOOKUP( FILEGETLARGEIOB )
1552  else
1553  f = PROCLOOKUP( FILEGETIOB )
1554  end if
1555  end if
1556  else
1557  if( isstring ) then
1558  if( islarge ) then
1559  f = PROCLOOKUP( FILEGETSTRLARGE )
1560  else
1561  f = PROCLOOKUP( FILEGETSTR )
1562  end if
1563  else
1564  if( islarge ) then
1565  f = PROCLOOKUP( FILEGETLARGE )
1566  else
1567  f = PROCLOOKUP( FILEGET )
1568  end if
1569  end if
1570  end if
1571 
1572  proc = astNewCALL( f )
1573 
1574  '' byval filenum as integer
1575  if( astNewARG( proc, filenum ) = NULL ) then
1576  exit function
1577  end if
1578 
1579  '' byval offset as integer
1580  if( astNewARG( proc, offset ) = NULL ) then
1581  exit function
1582  end if
1583 
1584  '' always calc len before pushing the param
1585  if( isstring ) then
1586  lgt = rtlCalcStrLen( dst, dtype )
1587  else
1588  lgt = rtlCalcExprLen( dst )
1589  end if
1590 
1591  if( elements = NULL ) then
1592  bytes = astNewCONSTi( lgt )
1593  else
1594  bytes = astNewBOP( AST_OP_MUL, elements, astNewCONSTi( lgt ) )
1595  end if
1596 
1597  '' any pointer fields?
1598  if( dtype = FB_DATATYPE_STRUCT ) then
1599  if( symbGetUDTHasPtrField( astGetSubType( dst ) ) ) then
1600  errReportParamWarn( proc->sym, 3, NULL, FB_WARNINGMSG_POINTERFIELDS )
1601  end if
1602  '' warn if data is pointer
1603  elseif( typeIsPtr( astGetDataType( dst ) ) ) then
1604  errReportParamWarn( proc->sym, 3, NULL, FB_WARNINGMSG_PASSINGPTR )
1605  end if
1606 
1607  '' value as any
1608  if( astNewARG( proc, dst ) = NULL ) then
1609  exit function
1610  end if
1611 
1612  '' byval bytes as integer
1613  if( astNewARG( proc, bytes ) = NULL ) then
1614  exit function
1615  end if
1616 
1617  '' byref iobytes as uinteger/ulongint
1618  if( iobytes ) then
1619  if( astNewARG( proc, iobytes ) = NULL ) then
1620  exit function
1621  end if
1622  end if
1623 
1624  if( isfunc = FALSE ) then
1625  astAdd( rtlErrorCheck( proc ) )
1626  end if
1627 
1628  function = proc
1629 end function
1630 
1631 '':::::
1632 function rtlFileGetArray _
1633  ( _
1634  byval filenum as ASTNODE ptr, _
1635  byval offset as ASTNODE ptr, _
1636  byval dst as ASTNODE ptr, _
1637  byval iobytes as ASTNODE ptr, _
1638  byval isfunc as integer _
1639  ) as ASTNODE ptr
1640 
1641  dim as ASTNODE ptr proc = any
1642  dim as FBSYMBOL ptr f = any
1643  dim as integer o_dtype = any, islarge = any
1644 
1645  function = NULL
1646 
1647  if( offset = NULL ) then
1648  offset = astNewCONSTi( 0 )
1649  end if
1650  o_dtype = astGetDataType( offset )
1651 
1652  assert( typeGetClass( o_dtype ) = FB_DATACLASS_INTEGER )
1653  islarge = (typeGetSize( o_dtype ) = 8)
1654 
1655  if( iobytes ) then
1656  if( islarge ) then
1657  f = PROCLOOKUP( FILEGETARRAYLARGEIOB )
1658  else
1659  f = PROCLOOKUP( FILEGETARRAYIOB )
1660  end if
1661  else
1662  if( islarge ) then
1663  f = PROCLOOKUP( FILEGETARRAYLARGE )
1664  else
1665  f = PROCLOOKUP( FILEGETARRAY )
1666  end if
1667  end if
1668 
1669  proc = astNewCALL( f )
1670 
1671  '' byval filenum as integer
1672  if( astNewARG( proc, filenum ) = NULL ) then
1673  exit function
1674  end if
1675 
1676  '' byval offset as integer
1677  if( astNewARG( proc, offset ) = NULL ) then
1678  exit function
1679  end if
1680 
1681  '' any pointer fields?
1682  if( astGetDataType( dst ) = FB_DATATYPE_STRUCT ) then
1683  if( symbGetUDTHasPtrField( astGetSubType( dst ) ) ) then
1684  errReportParamWarn( proc->sym, 3, NULL, FB_WARNINGMSG_POINTERFIELDS )
1685  end if
1686  '' warn if data is pointer
1687  elseif( typeIsPtr( astGetDataType( dst ) ) ) then
1688  errReportParamWarn( proc->sym, 3, NULL, FB_WARNINGMSG_PASSINGPTR )
1689  end if
1690 
1691  '' array() as any
1692  if( astNewARG( proc, dst ) = NULL ) then
1693  exit function
1694  end if
1695 
1696  if( iobytes ) then
1697  '' byref iobytes as uinteger
1698  if( astNewARG( proc, iobytes ) = NULL ) then
1699  exit function
1700  end if
1701  end if
1702 
1703  if( isfunc = FALSE ) then
1704  astAdd( rtlErrorCheck( proc ) )
1705  end if
1706 
1707  function = proc
1708 end function
1709 
1710 function rtlFileStrInput _
1711  ( _
1712  byval bytesexpr as ASTNODE ptr, _
1713  byval filenum as ASTNODE ptr, _
1714  byval tk as integer _
1715  ) as ASTNODE ptr
1716 
1717  dim as ASTNODE ptr proc = any
1718 
1719  function = NULL
1720 
1721  proc = astNewCALL( iif( tk = FB_TK_WINPUT, _
1722  PROCLOOKUP( FILEWSTRINPUT ), _
1723  PROCLOOKUP( FILESTRINPUT ) ) )
1724 
1725  '' byval bytes as integer
1726  if( astNewARG( proc, bytesexpr ) = NULL ) then
1727  exit function
1728  end if
1729 
1730  '' byval filenum as integer
1731  if( astNewARG( proc, filenum ) = NULL ) then
1732  exit function
1733  end if
1734 
1735  function = proc
1736 end function
1737 
1738 '':::::
1739 function rtlFileLineInput _
1740  ( _
1741  byval isfile as integer, _
1742  byval expr as ASTNODE ptr, _
1743  byval dstexpr as ASTNODE ptr, _
1744  byval addquestion as integer, _
1745  byval addnewline as integer _
1746  ) as integer
1747 
1748  dim as ASTNODE ptr proc = any
1749  dim as FBSYMBOL ptr f = any
1750  dim as integer args = any, dtype = any
1751  dim as longint lgt = any
1752 
1753  function = FALSE
1754 
1755  ''
1756  if( isfile ) then
1757  f = PROCLOOKUP( FILELINEINPUT )
1758  args = 4
1759  else
1760  f = PROCLOOKUP( CONSOLELINEINPUT )
1761  args = 6
1762  end if
1763 
1764  proc = astNewCALL( f )
1765 
1766  '' "byval filenum as integer" or "text as string "
1767  if( (isfile = FALSE) and (expr = NULL) ) then
1768  expr = astNewVAR( symbAllocStrConst( "", 0 ) )
1769  end if
1770 
1771  if( astNewARG( proc, expr ) = NULL ) then
1772  exit function
1773  end if
1774 
1775  '' always calc len before pushing the param
1776  dtype = astGetDataType( dstexpr )
1777  lgt = rtlCalcStrLen( dstexpr, dtype )
1778 
1779  '' dst as any
1780  if( astNewARG( proc, dstexpr ) = NULL ) then
1781  exit function
1782  end if
1783 
1784  '' byval dstlen as integer
1785  if( astNewARG( proc, astNewCONSTi( lgt ) ) = NULL ) then
1786  exit function
1787  end if
1788 
1789  '' byval fillrem as integer
1790  if( astNewARG( proc, astNewCONSTi( dtype = FB_DATATYPE_FIXSTR ) ) = NULL ) then
1791  exit function
1792  end if
1793 
1794  if( args = 6 ) then
1795  '' byval addquestion as integer
1796  if( astNewARG( proc, astNewCONSTi( addquestion ) ) = NULL ) then
1797  exit function
1798  end if
1799 
1800  '' byval addnewline as integer
1801  if( astNewARG( proc, astNewCONSTi( addnewline ) ) = NULL ) then
1802  exit function
1803  end if
1804  end if
1805 
1806  astAdd( proc )
1807 
1808  function = TRUE
1809 
1810 end function
1811 
1812 '':::::
1813 function rtlFileLineInputWstr _
1814  ( _
1815  byval isfile as integer, _
1816  byval expr as ASTNODE ptr, _
1817  byval dstexpr as ASTNODE ptr, _
1818  byval addquestion as integer, _
1819  byval addnewline as integer _
1820  ) as integer
1821 
1822  dim as ASTNODE ptr proc = any
1823  dim as FBSYMBOL ptr f = any
1824  dim as integer args = any, dtype = any
1825  dim as longint lgt = any
1826 
1827  function = FALSE
1828 
1829  ''
1830  if( isfile ) then
1831  f = PROCLOOKUP( FILELINEINPUTWSTR )
1832  args = 3
1833  else
1834  f = PROCLOOKUP( CONSOLELINEINPUTWSTR )
1835  args = 5
1836  end if
1837 
1838  proc = astNewCALL( f )
1839 
1840  '' "byval filenum as integer" or "byval text as wstring ptr"
1841  if( (isfile = FALSE) and (expr = NULL) ) then
1842  expr = astNewVAR( symbAllocWStrConst( "", 0 ) )
1843  end if
1844 
1845  if( astNewARG( proc, expr ) = NULL ) then
1846  exit function
1847  end if
1848 
1849  '' always calc len before pushing the param
1850  dtype = astGetDataType( dstexpr )
1851  lgt = rtlCalcStrLen( dstexpr, dtype )
1852 
1853  '' byval dst as wstring ptr
1854  if( astNewARG( proc, dstexpr ) = NULL ) then
1855  exit function
1856  end if
1857 
1858  '' byval max_chars as integer
1859  if( astNewARG( proc, astNewCONSTi( lgt ) ) = NULL ) then
1860  exit function
1861  end if
1862 
1863  if( args = 5 ) then
1864  '' byval addquestion as integer
1865  if( astNewARG( proc, astNewCONSTi( addquestion ) ) = NULL ) then
1866  exit function
1867  end if
1868 
1869  '' byval addnewline as integer
1870  if( astNewARG( proc, astNewCONSTi( addnewline ) ) = NULL ) then
1871  exit function
1872  end if
1873  end if
1874 
1875  astAdd( proc )
1876 
1877  function = TRUE
1878 
1879 end function
1880 
1881 '':::::
1882 function rtlFileInput _
1883  ( _
1884  byval isfile as integer, _
1885  byval expr as ASTNODE ptr, _
1886  byval addquestion as integer, _
1887  byval addnewline as integer _
1888  ) as integer
1889 
1890  dim as ASTNODE ptr proc = any
1891  dim as FBSYMBOL ptr f = any
1892  dim as integer args = any
1893 
1894  function = FALSE
1895 
1896  ''
1897  if( isfile ) then
1898  f = PROCLOOKUP( FILEINPUT )
1899  args = 1
1900  else
1901  f = PROCLOOKUP( CONSOLEINPUT )
1902  args = 3
1903  end if
1904 
1905  proc = astNewCALL( f )
1906 
1907  '' "byval filenum as integer" or "text as string "
1908  if( (isfile = FALSE) and (expr = NULL) ) then
1909  expr = astNewVAR( symbAllocStrConst( "", 0 ) )
1910  end if
1911 
1912  if( astNewARG( proc, expr ) = NULL ) then
1913  exit function
1914  end if
1915 
1916  if( args = 3 ) then
1917  '' byval addquestion as integer
1918  if( astNewARG( proc, astNewCONSTi( addquestion ) ) = NULL ) then
1919  exit function
1920  end if
1921 
1922  '' byval addnewline as integer
1923  if( astNewARG( proc, astNewCONSTi( addnewline ) ) = NULL ) then
1924  exit function
1925  end if
1926  end if
1927 
1928  astAdd( proc )
1929 
1930  function = TRUE
1931 
1932 end function
1933 
1934 '':::::
1935 function rtlFileInputGet _
1936  ( _
1937  byval dstexpr as ASTNODE ptr _
1938  ) as integer
1939 
1940  dim as ASTNODE ptr proc = any
1941  dim as FBSYMBOL ptr f = any
1942  dim as integer args = any, dtype = any
1943  dim as longint lgt = any
1944 
1945  function = FALSE
1946 
1947  ''
1948  args = 1
1949  dtype = astGetDataType( dstexpr )
1950 
1951  select case as const typeGet( dtype )
1952  case FB_DATATYPE_FIXSTR, FB_DATATYPE_STRING, FB_DATATYPE_CHAR
1953  f = PROCLOOKUP( INPUTSTR )
1954  args = 3
1955 
1956  case FB_DATATYPE_WCHAR
1957  f = PROCLOOKUP( INPUTWSTR )
1958  args = 2
1959 
1960  case FB_DATATYPE_BYTE, FB_DATATYPE_UBYTE, _
1961  FB_DATATYPE_SHORT, FB_DATATYPE_USHORT, _
1962  FB_DATATYPE_INTEGER, FB_DATATYPE_ENUM, FB_DATATYPE_UINT, _
1963  FB_DATATYPE_LONG, FB_DATATYPE_ULONG, FB_DATATYPE_POINTER, _
1964  FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT
1965 
1966  select case as const( typeGetSizeType( dtype ) )
1967  case FB_SIZETYPE_INT8 : f = PROCLOOKUP( INPUTBYTE )
1968  case FB_SIZETYPE_UINT8 : f = PROCLOOKUP( INPUTUBYTE )
1969  case FB_SIZETYPE_INT16 : f = PROCLOOKUP( INPUTSHORT )
1970  case FB_SIZETYPE_UINT16 : f = PROCLOOKUP( INPUTUSHORT )
1971  case FB_SIZETYPE_INT32 : f = PROCLOOKUP( INPUTINT )
1972  case FB_SIZETYPE_UINT32 : f = PROCLOOKUP( INPUTUINT )
1973  case FB_SIZETYPE_INT64 : f = PROCLOOKUP( INPUTLONGINT )
1974  case FB_SIZETYPE_UINT64 : f = PROCLOOKUP( INPUTULONGINT )
1975  end select
1976 
1977  case FB_DATATYPE_SINGLE
1978  f = PROCLOOKUP( INPUTSINGLE )
1979 
1980  case FB_DATATYPE_DOUBLE
1981  f = PROCLOOKUP( INPUTDOUBLE )
1982 
1983  case else
1984  errReport( FB_ERRMSG_INVALIDDATATYPES )
1985  exit function
1986  end select
1987 
1988  proc = astNewCALL( f )
1989 
1990  '' always calc len before pushing the param
1991  if( args > 1 ) then
1992  lgt = rtlCalcStrLen( dstexpr, dtype )
1993  end if
1994 
1995  '' byref dst as any | byval dst as wstring ptr
1996  if( astNewARG( proc, dstexpr ) = NULL ) then
1997  exit function
1998  end if
1999 
2000  if( args > 1 ) then
2001  '' byval dstlen as integer
2002  if( astNewARG( proc, astNewCONSTi( lgt ) ) = NULL ) then
2003  exit function
2004  end if
2005 
2006  if( args > 2 ) then
2007  '' byval fillrem as integer
2008  if( astNewARG( proc, astNewCONSTi( dtype = FB_DATATYPE_FIXSTR ) ) = NULL ) then
2009  exit function
2010  end if
2011  end if
2012  end if
2013 
2014  astAdd( proc )
2015 
2016  function = TRUE
2017 
2018 end function
2019 
2020 '':::::
2021 function rtlFileLock _
2022  ( _
2023  byval islock as integer, _
2024  byval filenum as ASTNODE ptr, _
2025  byval iniexpr as ASTNODE ptr, _
2026  byval endexpr as ASTNODE ptr _
2027  ) as integer
2028 
2029  dim as ASTNODE ptr proc = any
2030  dim as FBSYMBOL ptr f = any
2031  dim as integer islarge = any, i_dtype = any, e_dtype = any
2032 
2033  function = FALSE
2034 
2035  i_dtype = astGetDataType( iniexpr )
2036  e_dtype = astGetDataType( endexpr )
2037 
2038  assert( typeGetClass( i_dtype ) = FB_DATACLASS_INTEGER )
2039  assert( typeGetClass( e_dtype ) = FB_DATACLASS_INTEGER )
2040  islarge = (typeGetSize( i_dtype ) = 8) or (typeGetSize( e_dtype ) = 8)
2041 
2042  if( islock ) then
2043  if( islarge ) then
2044  f = PROCLOOKUP( FILELOCKLARGE )
2045  else
2046  f = PROCLOOKUP( FILELOCK )
2047  end if
2048  else
2049  if( islarge ) then
2050  f = PROCLOOKUP( FILEUNLOCKLARGE )
2051  else
2052  f = PROCLOOKUP( FILEUNLOCK )
2053  end if
2054  end if
2055 
2056  proc = astNewCALL( f )
2057 
2058  '' byval filenum as integer
2059  if( astNewARG( proc, filenum ) = NULL ) then
2060  exit function
2061  end if
2062 
2063  '' byval inipos as integer
2064  if( astNewARG( proc, iniexpr ) = NULL ) then
2065  exit function
2066  end if
2067 
2068  '' byval endpos as integer
2069  if( astNewARG( proc, endexpr ) = NULL ) then
2070  exit function
2071  end if
2072 
2073  astAdd( proc )
2074 
2075  function = TRUE
2076 
2077 end function
2078 
2079 '':::::
2080 function rtlFileRename _
2081  ( _
2082  byval filename_new as ASTNODE ptr, _
2083  byval filename_old as ASTNODE ptr, _
2084  byval isfunc as integer _
2085  ) as ASTNODE ptr
2086 
2087  dim as ASTNODE ptr proc = any
2088 
2089  function = NULL
2090 
2091  proc = astNewCALL( PROCLOOKUP( FILERENAME ) )
2092 
2093  '' byval filename_old as zstring ptr
2094  if( astNewARG( proc, filename_old ) = NULL ) then
2095  exit function
2096  end if
2097 
2098  '' byval filename_new as zstring ptr
2099  if( astNewARG( proc, filename_new ) = NULL ) then
2100  exit function
2101  end if
2102 
2103  if( isfunc = FALSE ) then
2104  astAdd( rtlErrorCheck( proc ) )
2105  end if
2106 
2107  function = proc
2108 end function
2109 
2110 '':::::
2111 function rtlWidthFile _
2112  ( _
2113  byval fnum as ASTNODE ptr, _
2114  byval width_arg as ASTNODE ptr, _
2115  byval isfunc as integer _
2116  ) as ASTNODE ptr
2117 
2118  dim as ASTNODE ptr proc = any
2119 
2120  function = NULL
2121 
2122  ''
2123  proc = astNewCALL( PROCLOOKUP( WIDTHFILE ) )
2124 
2125  '' byval fnum as integer
2126  if( astNewARG( proc, fnum ) = NULL ) then
2127  exit function
2128  end if
2129 
2130  '' byval width_arg as integer
2131  if( astNewARG( proc, width_arg ) = NULL ) then
2132  exit function
2133  end if
2134 
2135  if( isfunc = FALSE ) then
2136  astAdd( rtlErrorCheck( proc ) )
2137  end if
2138 
2139  function = proc
2140 end function
2141