5 #define __FILE_typedef 1
6 #define _FILE_DEFINED 1
7 #define _FILE_defined 1
11 #define __FILE_TAG _sfio_s
19 typedef struct _sfio_s _sfio_FILE;
21 #define FILE _sfio_FILE
24 #if !defined(__FILE) && !__CYGWIN__
29 #if defined(_AST_H) || defined(_SFIO_H)
31 #define BUFSIZ SF_BUFSIZE
60 #define _sf_(f) ((struct _sfio_s*)(f))
63 #define _SF_EOF 0000200
64 #define _SF_ERROR 0000400
68 #ifdef _NO_LARGEFILE64_SOURCE
69 #undef _LARGEFILE64_SOURCE
72 #ifdef _LARGEFILE64_SOURCE
76 #define fpos_t _ast_fpos_t
78 #define fpos64_t _ast_fpos_t
81 typedef struct _ast_fpos_s
84 unsigned char _sf_state[64 - sizeof(intmax_t)];
93 #if defined(__cplusplus) && defined(__THROW) && !defined(_UWIN)
97 typedef struct _sfio_s FILE;
100 extern char* strerror(int) __THROW;
102 extern int _doprnt(const char*, va_list, FILE*);
103 extern int _doscan(FILE*, const char*, va_list);
104 extern int asprintf(char**, const char*, ...);
105 extern int clearerr(FILE*);
106 extern int fclose(FILE*);
107 extern FILE* fdopen(int, const char*);
108 extern int feof(FILE*);
109 extern int ferror(FILE*);
110 extern int fflush(FILE*);
111 extern int fgetc(FILE*);
112 extern int fgetpos(FILE*, fpos_t*);
113 extern char* fgets(char*, int, FILE*);
114 extern int fileno(FILE*);
115 extern FILE* fopen(const char*, const char*);
116 extern int fprintf(FILE*, const char*, ...);
117 extern int fpurge(FILE*);
118 extern int fputc(int, FILE*);
119 extern int fputs(const char*, FILE*);
120 extern size_t fread(void*, size_t, size_t, FILE*);
121 extern FILE* freopen(const char*, const char*, FILE*);
122 extern int fscanf(FILE*, const char*, ...);
123 extern int fseek(FILE*, long, int);
124 extern int fseeko(FILE*, off_t, int);
125 extern int fsetpos(FILE*, const fpos_t*);
126 extern long ftell(FILE*);
127 extern off_t ftello(FILE*);
128 extern size_t fwrite(const void*, size_t, size_t, FILE*);
129 extern int getc(FILE*);
130 extern int getchar(void);
131 extern char* gets(char*);
132 extern int getw(FILE*);
133 extern int pclose(FILE*);
134 extern FILE* popen(const char*, const char*);
135 extern int printf(const char*, ...);
136 extern int putc(int, FILE*);
137 extern int putchar(int);
138 extern int puts(const char*);
139 extern int putw(int, FILE*);
140 extern void rewind(FILE*);
141 extern int scanf(const char*, ...);
142 extern void setbuf(FILE*, char*);
143 extern int setbuffer(FILE*, char*, int);
144 extern int setlinebuf(FILE*);
145 extern int setvbuf(FILE*, char*, int, size_t);
146 extern int snprintf(char*, int, const char*, ...);
147 extern int sprintf(char*, const char*, ...);
148 extern int sscanf(const char*, const char*, ...);
149 extern FILE* tmpfile(void);
150 extern int ungetc(int, FILE*);
151 extern int vasprintf(char**, const char*, va_list);
152 extern int vfprintf(FILE*, const char*, va_list);
153 extern int vfscanf(FILE*, const char*, va_list);
154 extern int vprintf(const char*, va_list);
155 extern int vscanf(const char*, va_list);
156 extern int vsnprintf(char*, int, const char*, va_list);
157 extern int vsprintf(char*, const char*, va_list);
158 extern int vsscanf(const char*, const char*, va_list);
162 extern int fgetpos64(FILE*, fpos64_t*);
163 extern int fsetpos64(FILE*, const fpos64_t*);
164 extern int fseek64(FILE*, int64_t, int);
165 extern int fseeko64(FILE*, int64_t, int);
166 extern int64_t ftell64(FILE*);
167 extern int64_t ftello64(FILE*);
171 extern void clearerr_unlocked(FILE*);
172 extern int feof_unlocked(FILE*);
173 extern int ferror_unlocked(FILE*);
174 extern int fflush_unlocked(FILE*);
175 extern int fgetc_unlocked(FILE*);
176 extern char* fgets_unlocked(char*, int, FILE*);
177 extern int fileno_unlocked(FILE*);
178 extern int fputc_unlocked(int, FILE*);
179 extern int fputs_unlocked(char*, FILE*);
180 extern size_t fread_unlocked(void*, size_t, size_t, FILE*);
181 extern size_t fwrite_unlocked(void*, size_t, size_t, FILE*);
182 extern int getc_unlocked(FILE*);
183 extern int getchar_unlocked(void);
184 extern int putc_unlocked(int, FILE*);
185 extern int putchar_unlocked(int);
187 extern void flockfile(FILE*);
188 extern int ftrylockfile(FILE*);
189 extern void funlockfile(FILE*);
193 extern int fcloseall(void);
194 extern FILE* fmemopen(void*, size_t, const char*);
195 extern ssize_t __getdelim(char**, size_t*, int, FILE*);
196 extern ssize_t getdelim(char**, size_t*, int, FILE*);
197 extern ssize_t getline(char**, size_t*, FILE*);
207 #ifndef _POSIX_NAME_MAX
208 #define _POSIX_NAME_MAX 14
210 #define NAME_MAX _POSIX_NAME_MAX
212 #define FILENAME_MAX NAME_MAX
216 #define FOPEN_MAX STREAM_MAX
219 #ifndef _POSIX_OPEN_MAX
220 #define _POSIX_OPEN_MAX 20
222 #define OPEN_MAX _POSIX_OPEN_MAX
224 #define FOPEN_MAX OPEN_MAX
228 #define TMP_MAX 33520641
233 printf("#ifndef FILENAME_MAX\n");
234 printf("#define FILENAME_MAX %d\n", FILENAME_MAX);
236 printf("#ifndef FOPEN_MAX\n");
237 printf("#define FOPEN_MAX %d\n", FOPEN_MAX);
239 printf("#ifndef TMP_MAX\n");
240 printf("#define TMP_MAX %d\n", TMP_MAX);
244 printf("#define _doprnt _ast_doprnt\n");
245 printf("#define _doscan _ast_doscan\n");
246 printf("#define asprintf _ast_asprintf\n");
247 printf("#define clearerr _ast_clearerr\n");
248 printf("#define fclose _ast_fclose\n");
249 printf("#define fdopen _ast_fdopen\n");
250 printf("#define fflush _ast_fflush\n");
251 printf("#define fgetc _ast_fgetc\n");
252 printf("#define fgetpos _ast_fgetpos\n");
253 printf("#define fgetpos64 _ast_fgetpos64\n");
254 printf("#define fgets _ast_fgets\n");
255 printf("#define fopen _ast_fopen\n");
256 printf("#define fprintf _ast_fprintf\n");
257 printf("#define fpurge _ast_fpurge\n");
258 printf("#define fputs _ast_fputs\n");
259 printf("#define fread _ast_fread\n");
260 printf("#define freopen _ast_freopen\n");
261 printf("#define fscanf _ast_fscanf\n");
262 printf("#define fseek _ast_fseek\n");
263 printf("#define fseek64 _ast_fseek64\n");
264 printf("#define fseeko _ast_fseeko\n");
265 printf("#define fseeko64 _ast_fseeko64\n");
266 printf("#define fsetpos _ast_fsetpos\n");
267 printf("#define fsetpos64 _ast_fsetpos64\n");
268 printf("#define ftell _ast_ftell\n");
269 printf("#define ftell64 _ast_ftell64\n");
270 printf("#define ftello _ast_ftello\n");
271 printf("#define ftello64 _ast_ftello64\n");
272 printf("#define fwrite _ast_fwrite\n");
273 printf("#define gets _ast_gets\n");
274 printf("#define getw _ast_getw\n");
275 printf("#define pclose _ast_pclose\n");
276 printf("#define popen _ast_popen\n");
277 printf("#define printf _ast_printf\n");
278 printf("#define puts _ast_puts\n");
279 printf("#define putw _ast_putw\n");
280 printf("#define rewind _ast_rewind\n");
281 printf("#define scanf _ast_scanf\n");
282 printf("#define setbuf _ast_setbuf\n");
283 printf("#undef setbuffer\n");
284 printf("#define setbuffer _ast_setbuffer\n");
285 printf("#define setlinebuf _ast_setlinebuf\n");
286 printf("#define setvbuf _ast_setvbuf\n");
287 printf("#define snprintf _ast_snprintf\n");
288 printf("#define sprintf _ast_sprintf\n");
289 printf("#define sscanf _ast_sscanf\n");
290 printf("#define tmpfile _ast_tmpfile\n");
291 printf("#define ungetc _ast_ungetc\n");
292 printf("#define vasprintf _ast_vasprintf\n");
293 printf("#define vfprintf _ast_vfprintf\n");
294 printf("#define vfscanf _ast_vfscanf\n");
295 printf("#define vprintf _ast_vprintf\n");
296 printf("#define vscanf _ast_vscanf\n");
297 printf("#define vsnprintf _ast_vsnprintf\n");
298 printf("#define vsprintf _ast_vsprintf\n");
299 printf("#define vsscanf _ast_vsscanf\n");
301 printf("#define fcloseall _ast_fcloseall\n");
302 printf("#define _filbuf _ast__filbuf\n");
303 printf("#define fmemopen _ast_fmemopen\n");
304 printf("#define __getdelim _ast___getdelim\n");
305 printf("#define getdelim _ast_getdelim\n");
306 printf("#define getline _ast_getline\n");
308 printf("#define clearerr_unlocked _ast_clearerr_unlocked\n");
309 printf("#define feof_unlocked _ast_feof_unlocked\n");
310 printf("#define ferror_unlocked _ast_ferror_unlocked\n");
311 printf("#define fflush_unlocked _ast_fflush_unlocked\n");
312 printf("#define fgetc_unlocked _ast_fgetc_unlocked\n");
313 printf("#define fgets_unlocked _ast_fgets_unlocked\n");
314 printf("#define fileno_unlocked _ast_fileno_unlocked\n");
315 printf("#define fputc_unlocked _ast_fputc_unlocked\n");
316 printf("#define fputs_unlocked _ast_fputs_unlocked\n");
317 printf("#define fread_unlocked _ast_fread_unlocked\n");
318 printf("#define fwrite_unlocked _ast_fwrite_unlocked\n");
319 printf("#define getc_unlocked _ast_getc_unlocked\n");
320 printf("#define getchar_unlocked _ast_getchar_unlocked\n");
321 printf("#define putc_unlocked _ast_putc_unlocked\n");
322 printf("#define putchar_unlocked _ast_putchar_unlocked\n");
324 printf("#define flockfile _ast_flockfile\n");
325 printf("#define ftrylockfile _ast_ftrylockfile\n");
326 printf("#define funlockfile _ast_funlockfile\n");
334 <<"#if defined(__STDPP__directive) && defined(__STDPP__initial)">>
335 <<"__STDPP__directive pragma pp:initial">>
337 <<"#ifndef P_tmpdir">>
339 #define P_tmpdir "/usr/tmp/"
341 <<"#define P_tmpdir">> P_tmpdir <<"/*NOCATLITERAL*/">>
343 <<"#ifndef L_ctermid">>
347 <<"#define L_ctermid">> L_ctermid
349 <<"#ifndef L_tmpnam">>
351 #define L_tmpnam (sizeof(P_tmpdir)+15)
353 <<"#define L_tmpnam">> L_tmpnam
355 <<"#if defined(__STDPP__directive) && defined(__STDPP__initial)">>
356 <<"__STDPP__directive pragma pp:noinitial">>
360 #if defined(__cplusplus) && defined(__THROW)
361 extern char* ctermid(char*) __THROW;
363 extern char* ctermid(char*);
365 extern char* tmpnam(char*);
366 extern char* tempnam(const char*, const char*);
367 extern void perror(const char*);
370 extern int remove(const char*);
373 extern int rename(const char*, const char*);
379 #if _BLD_ast && defined(__EXPORT__)
380 #define extern __EXPORT__
383 extern int _doprnt(const char*, va_list, FILE*);
384 extern int _doscan(FILE*, const char*, va_list);
385 extern int asprintf(char**, const char*, ...);
386 extern int clearerr(FILE*);
387 extern int fclose(FILE*);
388 extern FILE* fdopen(int, const char*);
389 extern int feof(FILE*);
390 extern int ferror(FILE*);
391 extern int fflush(FILE*);
392 extern int fgetc(FILE*);
393 extern int fgetpos(FILE*, fpos_t*);
394 extern char* fgets(char*, int, FILE*);
395 extern int fileno(FILE*);
396 extern FILE* fopen(const char*, const char*);
397 extern int fprintf(FILE*, const char*, ...);
398 extern int fpurge(FILE*);
399 extern int fputc(int, FILE*);
400 extern int fputs(const char*, FILE*);
401 extern size_t fread(void*, size_t, size_t, FILE*);
402 extern FILE* freopen(const char*, const char*, FILE*);
403 extern int fscanf(FILE*, const char*, ...);
404 extern int fseek(FILE*, long, int);
405 extern int fseeko(FILE*, off_t, int);
406 extern int fsetpos(FILE*, const fpos_t*);
407 extern long ftell(FILE*);
408 extern off_t ftello(FILE*);
409 extern size_t fwrite(const void*, size_t, size_t, FILE*);
410 extern int getc(FILE*);
411 extern int getchar(void);
412 extern char* gets(char*);
413 extern int getw(FILE*);
414 extern int pclose(FILE*);
415 extern FILE* popen(const char*, const char*);
416 extern int printf(const char*, ...);
417 extern int putc(int, FILE*);
418 extern int putchar(int);
419 extern int puts(const char*);
420 extern int putw(int, FILE*);
421 extern void rewind(FILE*);
422 extern int scanf(const char*, ...);
423 extern void setbuf(FILE*, char*);
424 extern int setbuffer(FILE*, char*, int);
425 extern int setlinebuf(FILE*);
426 extern int setvbuf(FILE*, char*, int, size_t);
427 extern int snprintf(char*, int, const char*, ...);
428 extern int sprintf(char*, const char*, ...);
429 extern int sscanf(const char*, const char*, ...);
430 extern FILE* tmpfile(void);
431 extern int ungetc(int, FILE*);
432 extern int vasprintf(char**, const char*, va_list);
433 extern int vfprintf(FILE*, const char*, va_list);
434 extern int vfscanf(FILE*, const char*, va_list);
435 extern int vprintf(const char*, va_list);
436 extern int vscanf(const char*, va_list);
437 extern int vsnprintf(char*, int, const char*, va_list);
438 extern int vsprintf(char*, const char*, va_list);
439 extern int vsscanf(const char*, const char*, va_list);
443 extern int fgetpos64(FILE*, fpos64_t*);
444 extern int fsetpos64(FILE*, const fpos64_t*);
445 extern int fseek64(FILE*, int64_t, int);
446 extern int fseeko64(FILE*, int64_t, int);
447 extern int64_t ftell64(FILE*);
448 extern int64_t ftello64(FILE*);
450 #ifdef _LARGEFILE64_SOURCE
461 #define fpos_t fpos64_t
463 #define off_t off64_t
465 #define off_t int64_t
468 #define fgetpos fgetpos64
469 #define fsetpos fsetpos64
470 #define fseek fseek64
471 #define fseeko fseeko64
472 #define ftell ftell64
473 #define ftello ftello64
479 extern void clearerr_unlocked(FILE*);
480 extern int feof_unlocked(FILE*);
481 extern int ferror_unlocked(FILE*);
482 extern int fflush_unlocked(FILE*);
483 extern int fgetc_unlocked(FILE*);
484 extern char* fgets_unlocked(char*, int, FILE*);
485 extern int fileno_unlocked(FILE*);
486 extern int fputc_unlocked(int, FILE*);
487 extern int fputs_unlocked(char*, FILE*);
488 extern size_t fread_unlocked(void*, size_t, size_t, FILE*);
489 extern size_t fwrite_unlocked(void*, size_t, size_t, FILE*);
490 extern int getc_unlocked(FILE*);
491 extern int getchar_unlocked(void);
492 extern int putc_unlocked(int, FILE*);
493 extern int putchar_unlocked(int);
497 extern int fcloseall(void);
498 extern FILE* fmemopen(void*, size_t, const char*);
499 extern ssize_t __getdelim(char**, size_t*, int, FILE*);
500 extern ssize_t getdelim(char**, size_t*, int, FILE*);
501 extern ssize_t getline(char**, size_t*, FILE*);
507 #if _BLD_DLL && _DLL_INDIRECT_DATA
509 #define stdin ((FILE*)_ast_dll->_ast_stdin)
510 #define stdout ((FILE*)_ast_dll->_ast_stdout)
511 #define stderr ((FILE*)_ast_dll->_ast_stderr)
515 #define stdin (&_Sfstdin)
516 #define stdout (&_Sfstdout)
517 #define stderr (&_Sfstderr)
521 #if defined(_AST_H) || defined(_SFIO_H)
523 #define feof(f) sfeof(f)
524 #define ferror(f) sferror(f)
525 #define fileno(f) sffileno(f)
526 #define fputc(c,f) sfputc(f,c)
527 #define getc(f) sfgetc(f)
528 #define getchar() sfgetc(sfstdin)
529 #define putc(c,f) sfputc(f,c)
530 #define putchar(c) sfputc(sfstdout,c)
535 #if _BLD_ast && defined(__EXPORT__)
536 #define extern extern __EXPORT__
538 #if !_BLD_ast && defined(__IMPORT__)
539 #define extern extern __IMPORT__
543 extern FILE _Sfstdin;
544 extern FILE _Sfstdout;
545 extern FILE _Sfstderr;
549 #define feof(f) (_sf_(f)->_flags&_SF_EOF)
550 #define ferror(f) (_sf_(f)->_flags&_SF_ERROR)
551 #define fileno(f) (_sf_(f)->_file)
552 #define fputc(c,f) (_sf_(f)->_next>=_sf_(f)->_endw?_sfflsbuf(_sf_(f),(int)((unsigned char)(c))):(int)(*_sf_(f)->_next++=(unsigned char)(c)))
553 #define getc(f) (_sf_(f)->_next>=_sf_(f)->_endr?_sffilbuf(_sf_(f),0):(int)(*_sf_(f)->_next++))
554 #define getchar() getc(stdin)
555 #define putc(c,f) fputc(c,f)
556 #define putchar(c) fputc(c,stdout)
558 #if _BLD_ast && defined(__EXPORT__)
559 #define extern __EXPORT__
562 extern int _sffilbuf(FILE*, int);
563 extern int _sfflsbuf(FILE*, int);