1 2 // automatically generated by m4 from headers in proto subdir 3 4 5 #ifndef __STDIO_H__ 6 #define __STDIO_H__ 7 8 #include <stdint.h> 9 10 // DATA STRUCTURES 11 12 #ifndef _SIZE_T_DEFINED 13 #define _SIZE_T_DEFINED 14 typedef unsigned int size_t; 15 #endif 16 17 typedef unsigned long fpos_t; 18 typedef struct { unsigned char file[13];} FILE; 19 20 #ifndef NULL 21 #define NULL ((void*)(0)) 22 #endif 23 24 #define _IOFBF 0 25 #define _IOLBF 1 26 #define _IONBF 2 27 28 #define BUFSIZ 1 // clib does not do high level buffering 29 30 #define EOF (-1) 31 32 extern unsigned char _MAX_FOPEN[]; 33 #define FOPEN_MAX ((unsigned int)_MAX_FOPEN) 34 35 #define FILENAME_MAX 128 36 37 #ifndef SEEK_SET 38 #define SEEK_SET 0 39 #endif 40 41 #ifndef SEEK_CUR 42 #define SEEK_CUR 1 43 #endif 44 45 #ifndef SEEK_END 46 #define SEEK_END 2 47 #endif 48 49 extern FILE *stdin; 50 extern FILE *stdout; 51 extern FILE *stderr; 52 53 #ifdef __CPM 54 extern FILE *stdrdr; 55 extern FILE *stdpun; 56 extern FILE *stdlst; 57 #endif 58 59 #ifdef __HBIOS 60 extern FILE *ttyin; 61 extern FILE *ttyout; 62 extern FILE *ttyerr; 63 #endif 64 65 #ifdef __RC2014 66 extern FILE *ttyin; 67 extern FILE *ttyout; 68 extern FILE *ttyerr; 69 #endif 70 71 #ifdef __SCZ180 72 extern FILE *ttyin; 73 extern FILE *ttyout; 74 extern FILE *ttyerr; 75 #endif 76 77 #ifdef __YAZ180 78 extern FILE *ttyin; 79 extern FILE *ttyout; 80 extern FILE *ttyerr; 81 #endif 82 83 // FUNCTIONS 84 85 extern FILE *_fmemopen_(void **bufp,size_t *sizep,char *mode); 86 extern FILE *_fmemopen__callee(void **bufp,size_t *sizep,char *mode) __z88dk_callee; 87 #define _fmemopen_(a,b,c) _fmemopen__callee(a,b,c) 88 89 90 extern int asprintf(char **ptr,char *format,...); 91 92 93 extern void clearerr(FILE *stream); 94 extern void clearerr_fastcall(FILE *stream) __z88dk_fastcall; 95 #define clearerr(a) clearerr_fastcall(a) 96 97 98 extern int fclose(FILE *stream); 99 extern int fclose_fastcall(FILE *stream) __z88dk_fastcall; 100 #define fclose(a) fclose_fastcall(a) 101 102 103 extern FILE *fdopen(int fd,const char *mode); 104 extern FILE *fdopen_callee(int fd,const char *mode) __z88dk_callee; 105 #define fdopen(a,b) fdopen_callee(a,b) 106 107 108 extern int feof(FILE *stream); 109 extern int feof_fastcall(FILE *stream) __z88dk_fastcall; 110 #define feof(a) feof_fastcall(a) 111 112 113 extern int ferror(FILE *stream); 114 extern int ferror_fastcall(FILE *stream) __z88dk_fastcall; 115 #define ferror(a) ferror_fastcall(a) 116 117 118 extern int fflush(FILE *stream); 119 extern int fflush_fastcall(FILE *stream) __z88dk_fastcall; 120 #define fflush(a) fflush_fastcall(a) 121 122 123 extern int fgetc(FILE *stream); 124 extern int fgetc_fastcall(FILE *stream) __z88dk_fastcall; 125 #define fgetc(a) fgetc_fastcall(a) 126 127 128 extern int fgetpos(FILE *stream,fpos_t *pos); 129 extern int fgetpos_callee(FILE *stream,fpos_t *pos) __z88dk_callee; 130 #define fgetpos(a,b) fgetpos_callee(a,b) 131 132 133 extern char *fgets(char *s,int n,FILE *stream); 134 extern char *fgets_callee(char *s,int n,FILE *stream) __z88dk_callee; 135 #define fgets(a,b,c) fgets_callee(a,b,c) 136 137 138 extern int fileno(FILE *stream); 139 extern int fileno_fastcall(FILE *stream) __z88dk_fastcall; 140 #define fileno(a) fileno_fastcall(a) 141 142 143 extern void flockfile(FILE *stream); 144 extern void flockfile_fastcall(FILE *stream) __z88dk_fastcall; 145 #define flockfile(a) flockfile_fastcall(a) 146 147 148 extern FILE *fmemopen(void *buf,size_t size,char *mode); 149 extern FILE *fmemopen_callee(void *buf,size_t size,char *mode) __z88dk_callee; 150 #define fmemopen(a,b,c) fmemopen_callee(a,b,c) 151 152 153 extern FILE *fopen(const char *filename,const char *mode); 154 extern FILE *fopen_callee(const char *filename,const char *mode) __z88dk_callee; 155 #define fopen(a,b) fopen_callee(a,b) 156 157 158 extern int fprintf(FILE *stream,char *format,...); 159 160 161 extern int fputc(int c,FILE *stream); 162 extern int fputc_callee(int c,FILE *stream) __z88dk_callee; 163 #define fputc(a,b) fputc_callee(a,b) 164 165 166 extern int fputs(char *s,FILE *stream); 167 extern int fputs_callee(char *s,FILE *stream) __z88dk_callee; 168 #define fputs(a,b) fputs_callee(a,b) 169 170 171 extern size_t fread(void *ptr,size_t size,size_t nmemb,FILE *stream); 172 extern size_t fread_callee(void *ptr,size_t size,size_t nmemb,FILE *stream) __z88dk_callee; 173 #define fread(a,b,c,d) fread_callee(a,b,c,d) 174 175 176 extern FILE *freopen(char *filename,char *mode,FILE *stream); 177 extern FILE *freopen_callee(char *filename,char *mode,FILE *stream) __z88dk_callee; 178 #define freopen(a,b,c) freopen_callee(a,b,c) 179 180 181 extern int fscanf(FILE *stream,char *format,...); 182 183 184 extern int fseek(FILE *stream,long offset,int whence); 185 extern int fseek_callee(FILE *stream,long offset,int whence) __z88dk_callee; 186 #define fseek(a,b,c) fseek_callee(a,b,c) 187 188 189 extern int fsetpos(FILE *stream,fpos_t *pos); 190 extern int fsetpos_callee(FILE *stream,fpos_t *pos) __z88dk_callee; 191 #define fsetpos(a,b) fsetpos_callee(a,b) 192 193 194 extern uint32_t ftell(FILE *stream); 195 extern uint32_t ftell_fastcall(FILE *stream) __z88dk_fastcall; 196 #define ftell(a) ftell_fastcall(a) 197 198 199 extern int ftrylockfile(FILE *stream); 200 extern int ftrylockfile_fastcall(FILE *stream) __z88dk_fastcall; 201 #define ftrylockfile(a) ftrylockfile_fastcall(a) 202 203 204 extern void funlockfile(FILE *stream); 205 extern void funlockfile_fastcall(FILE *stream) __z88dk_fastcall; 206 #define funlockfile(a) funlockfile_fastcall(a) 207 208 209 extern size_t fwrite(void *ptr,size_t size,size_t nmemb,FILE *stream); 210 extern size_t fwrite_callee(void *ptr,size_t size,size_t nmemb,FILE *stream) __z88dk_callee; 211 #define fwrite(a,b,c,d) fwrite_callee(a,b,c,d) 212 213 214 extern int getc(FILE *stream); 215 extern int getc_fastcall(FILE *stream) __z88dk_fastcall; 216 #define getc(a) getc_fastcall(a) 217 218 219 extern int getchar(void); 220 221 extern int getdelim(char **lineptr,size_t *n,int delim,FILE *stream); 222 extern int getdelim_callee(char **lineptr,size_t *n,int delim,FILE *stream) __z88dk_callee; 223 #define getdelim(a,b,c,d) getdelim_callee(a,b,c,d) 224 225 226 extern int getline(char **lineptr,size_t *n,FILE *stream); 227 extern int getline_callee(char **lineptr,size_t *n,FILE *stream) __z88dk_callee; 228 #define getline(a,b,c) getline_callee(a,b,c) 229 230 231 extern char *gets(char *s); 232 extern char *gets_fastcall(char *s) __z88dk_fastcall; 233 #define gets(a) gets_fastcall(a) 234 235 236 extern int obstack_printf(struct obstack *ob,char *format,...); 237 238 239 extern int obstack_vprintf(struct obstack *ob,char *format,void *arg); 240 extern int obstack_vprintf_callee(struct obstack *ob,char *format,void *arg) __z88dk_callee; 241 #define obstack_vprintf(a,b,c) obstack_vprintf_callee(a,b,c) 242 243 244 extern FILE *open_memstream(char **bufp,size_t *sizep); 245 extern FILE *open_memstream_callee(char **bufp,size_t *sizep) __z88dk_callee; 246 #define open_memstream(a,b) open_memstream_callee(a,b) 247 248 249 extern void perror(char *s); 250 extern void perror_fastcall(char *s) __z88dk_fastcall; 251 #define perror(a) perror_fastcall(a) 252 253 254 extern int printf(char *format,...); 255 256 257 extern int putc(int c,FILE *stream); 258 extern int putc_callee(int c,FILE *stream) __z88dk_callee; 259 #define putc(a,b) putc_callee(a,b) 260 261 262 extern int putchar(int c); 263 extern int putchar_fastcall(int c) __z88dk_fastcall; 264 #define putchar(a) putchar_fastcall(a) 265 266 267 extern int puts(char *s); 268 extern int puts_fastcall(char *s) __z88dk_fastcall; 269 #define puts(a) puts_fastcall(a) 270 271 272 extern void rewind(FILE *stream); 273 extern void rewind_fastcall(FILE *stream) __z88dk_fastcall; 274 #define rewind(a) rewind_fastcall(a) 275 276 277 extern int scanf(char *format,...); 278 279 280 extern int snprintf(char *s,size_t n,char *format,...); 281 282 283 extern int sprintf(char *s,char *format,...); 284 285 286 extern int sscanf(char *s,char *format,...); 287 288 289 extern int ungetc(int c,FILE *stream); 290 extern int ungetc_callee(int c,FILE *stream) __z88dk_callee; 291 #define ungetc(a,b) ungetc_callee(a,b) 292 293 294 extern int vasprintf(char **ptr,char *format,void *arg); 295 extern int vasprintf_callee(char **ptr,char *format,void *arg) __z88dk_callee; 296 #define vasprintf(a,b,c) vasprintf_callee(a,b,c) 297 298 299 extern int vfprintf(FILE *stream,char *format,void *arg); 300 extern int vfprintf_callee(FILE *stream,char *format,void *arg) __z88dk_callee; 301 #define vfprintf(a,b,c) vfprintf_callee(a,b,c) 302 303 304 extern int vfscanf(FILE *stream,char *format,void *arg); 305 extern int vfscanf_callee(FILE *stream,char *format,void *arg) __z88dk_callee; 306 #define vfscanf(a,b,c) vfscanf_callee(a,b,c) 307 308 309 extern int vprintf(char *format,void *arg); 310 extern int vprintf_callee(char *format,void *arg) __z88dk_callee; 311 #define vprintf(a,b) vprintf_callee(a,b) 312 313 314 extern int vscanf(char *format,void *arg); 315 extern int vscanf_callee(char *format,void *arg) __z88dk_callee; 316 #define vscanf(a,b) vscanf_callee(a,b) 317 318 319 extern int vsnprintf(char *s,size_t n,char *format,void *arg); 320 extern int vsnprintf_callee(char *s,size_t n,char *format,void *arg) __z88dk_callee; 321 #define vsnprintf(a,b,c,d) vsnprintf_callee(a,b,c,d) 322 323 324 extern int vsprintf(char *s,char *format,void *arg); 325 extern int vsprintf_callee(char *s,char *format,void *arg) __z88dk_callee; 326 #define vsprintf(a,b,c) vsprintf_callee(a,b,c) 327 328 329 extern int vsscanf(char *s,char *format,void *arg); 330 extern int vsscanf_callee(char *s,char *format,void *arg) __z88dk_callee; 331 #define vsscanf(a,b,c) vsscanf_callee(a,b,c) 332 333 334 335 extern void clearerr_unlocked(FILE *stream) __preserves_regs(b,c,d,e); 336 extern void clearerr_unlocked_fastcall(FILE *stream) __preserves_regs(b,c,d,e) __z88dk_fastcall; 337 #define clearerr_unlocked(a) clearerr_unlocked_fastcall(a) 338 339 340 extern int fclose_unlocked(FILE *stream); 341 extern int fclose_unlocked_fastcall(FILE *stream) __z88dk_fastcall; 342 #define fclose_unlocked(a) fclose_unlocked_fastcall(a) 343 344 345 extern int feof_unlocked(FILE *stream) __preserves_regs(b,c,d,e); 346 extern int feof_unlocked_fastcall(FILE *stream) __preserves_regs(b,c,d,e) __z88dk_fastcall; 347 #define feof_unlocked(a) feof_unlocked_fastcall(a) 348 349 350 extern int ferror_unlocked(FILE *stream) __preserves_regs(b,c,d,e); 351 extern int ferror_unlocked_fastcall(FILE *stream) __preserves_regs(b,c,d,e) __z88dk_fastcall; 352 #define ferror_unlocked(a) ferror_unlocked_fastcall(a) 353 354 355 extern int fflush_unlocked(FILE *stream); 356 extern int fflush_unlocked_fastcall(FILE *stream) __z88dk_fastcall; 357 #define fflush_unlocked(a) fflush_unlocked_fastcall(a) 358 359 360 extern int fgetc_unlocked(FILE *stream); 361 extern int fgetc_unlocked_fastcall(FILE *stream) __z88dk_fastcall; 362 #define fgetc_unlocked(a) fgetc_unlocked_fastcall(a) 363 364 365 extern int fgetpos_unlocked(FILE *stream,fpos_t *pos); 366 extern int fgetpos_unlocked_callee(FILE *stream,fpos_t *pos) __z88dk_callee; 367 #define fgetpos_unlocked(a,b) fgetpos_unlocked_callee(a,b) 368 369 370 extern char *fgets_unlocked(char *s,int n,FILE *stream); 371 extern char *fgets_unlocked_callee(char *s,int n,FILE *stream) __z88dk_callee; 372 #define fgets_unlocked(a,b,c) fgets_unlocked_callee(a,b,c) 373 374 375 extern int fileno_unlocked(FILE *stream); 376 extern int fileno_unlocked_fastcall(FILE *stream) __z88dk_fastcall; 377 #define fileno_unlocked(a) fileno_unlocked_fastcall(a) 378 379 380 extern int fprintf_unlocked(FILE *stream,char *format,...); 381 382 383 extern int fputc_unlocked(int c,FILE *stream); 384 extern int fputc_unlocked_callee(int c,FILE *stream) __z88dk_callee; 385 #define fputc_unlocked(a,b) fputc_unlocked_callee(a,b) 386 387 388 extern int fputs_unlocked(char *s,FILE *stream); 389 extern int fputs_unlocked_callee(char *s,FILE *stream) __z88dk_callee; 390 #define fputs_unlocked(a,b) fputs_unlocked_callee(a,b) 391 392 393 extern size_t fread_unlocked(void *ptr,size_t size,size_t nmemb,FILE *stream); 394 extern size_t fread_unlocked_callee(void *ptr,size_t size,size_t nmemb,FILE *stream) __z88dk_callee; 395 #define fread_unlocked(a,b,c,d) fread_unlocked_callee(a,b,c,d) 396 397 398 extern FILE *freopen_unlocked(char *filename,char *mode,FILE *stream); 399 extern FILE *freopen_unlocked_callee(char *filename,char *mode,FILE *stream) __z88dk_callee; 400 #define freopen_unlocked(a,b,c) freopen_unlocked_callee(a,b,c) 401 402 403 extern int fscanf_unlocked(FILE *stream,char *format,...); 404 405 406 extern int fseek_unlocked(FILE *stream,long offset,int whence); 407 extern int fseek_unlocked_callee(FILE *stream,long offset,int whence) __z88dk_callee; 408 #define fseek_unlocked(a,b,c) fseek_unlocked_callee(a,b,c) 409 410 411 extern int fsetpos_unlocked(FILE *stream,fpos_t *pos); 412 extern int fsetpos_unlocked_callee(FILE *stream,fpos_t *pos) __z88dk_callee; 413 #define fsetpos_unlocked(a,b) fsetpos_unlocked_callee(a,b) 414 415 416 extern uint32_t ftell_unlocked(FILE *stream); 417 extern uint32_t ftell_unlocked_fastcall(FILE *stream) __z88dk_fastcall; 418 #define ftell_unlocked(a) ftell_unlocked_fastcall(a) 419 420 421 extern size_t fwrite_unlocked(void *ptr,size_t size,size_t nmemb,FILE *stream); 422 extern size_t fwrite_unlocked_callee(void *ptr,size_t size,size_t nmemb,FILE *stream) __z88dk_callee; 423 #define fwrite_unlocked(a,b,c,d) fwrite_unlocked_callee(a,b,c,d) 424 425 426 extern int getc_unlocked(FILE *stream); 427 extern int getc_unlocked_fastcall(FILE *stream) __z88dk_fastcall; 428 #define getc_unlocked(a) getc_unlocked_fastcall(a) 429 430 431 extern int getchar_unlocked(void); 432 433 extern int getdelim_unlocked(char **lineptr,size_t *n,int delim,FILE *stream); 434 extern int getdelim_unlocked_callee(char **lineptr,size_t *n,int delim,FILE *stream) __z88dk_callee; 435 #define getdelim_unlocked(a,b,c,d) getdelim_unlocked_callee(a,b,c,d) 436 437 438 extern int getline_unlocked(char **lineptr,size_t *n,FILE *stream); 439 extern int getline_unlocked_callee(char **lineptr,size_t *n,FILE *stream) __z88dk_callee; 440 #define getline_unlocked(a,b,c) getline_unlocked_callee(a,b,c) 441 442 443 extern char *gets_unlocked(char *s); 444 extern char *gets_unlocked_fastcall(char *s) __z88dk_fastcall; 445 #define gets_unlocked(a) gets_unlocked_fastcall(a) 446 447 448 extern int printf_unlocked(char *format,...); 449 450 451 extern int putc_unlocked(int c,FILE *stream); 452 extern int putc_unlocked_callee(int c,FILE *stream) __z88dk_callee; 453 #define putc_unlocked(a,b) putc_unlocked_callee(a,b) 454 455 456 extern int putchar_unlocked(int c); 457 extern int putchar_unlocked_fastcall(int c) __z88dk_fastcall; 458 #define putchar_unlocked(a) putchar_unlocked_fastcall(a) 459 460 461 extern int puts_unlocked(char *s); 462 extern int puts_unlocked_fastcall(char *s) __z88dk_fastcall; 463 #define puts_unlocked(a) puts_unlocked_fastcall(a) 464 465 466 extern void rewind_unlocked(FILE *stream); 467 extern void rewind_unlocked_fastcall(FILE *stream) __z88dk_fastcall; 468 #define rewind_unlocked(a) rewind_unlocked_fastcall(a) 469 470 471 extern int scanf_unlocked(char *format,...); 472 473 474 extern int ungetc_unlocked(int c,FILE *stream); 475 extern int ungetc_unlocked_callee(int c,FILE *stream) __z88dk_callee; 476 #define ungetc_unlocked(a,b) ungetc_unlocked_callee(a,b) 477 478 479 extern int vfprintf_unlocked(FILE *stream,char *format,void *arg); 480 extern int vfprintf_unlocked_callee(FILE *stream,char *format,void *arg) __z88dk_callee; 481 #define vfprintf_unlocked(a,b,c) vfprintf_unlocked_callee(a,b,c) 482 483 484 extern int vfscanf_unlocked(FILE *stream,char *format,void *arg); 485 extern int vfscanf_unlocked_callee(FILE *stream,char *format,void *arg) __z88dk_callee; 486 #define vfscanf_unlocked(a,b,c) vfscanf_unlocked_callee(a,b,c) 487 488 489 extern int vprintf_unlocked(char *format,void *arg); 490 extern int vprintf_unlocked_callee(char *format,void *arg) __z88dk_callee; 491 #define vprintf_unlocked(a,b) vprintf_unlocked_callee(a,b) 492 493 494 extern int vscanf_unlocked(char *format,void *arg); 495 extern int vscanf_unlocked_callee(char *format,void *arg) __z88dk_callee; 496 #define vscanf_unlocked(a,b) vscanf_unlocked_callee(a,b) 497 498 499 500 #ifdef __ZXNEXT 501 502 #include <arch.h> 503 504 #define L_tmpnam __ENV_LTMPNAM 505 #define TMP_MAX 0xffff 506 507 extern char *tmpnam(char *s); 508 extern char *tmpnam_fastcall(char *s) __z88dk_fastcall; 509 #define tmpnam(a) tmpnam_fastcall(a) 510 511 512 extern char *tmpnam_ex(char *template); 513 extern char *tmpnam_ex_fastcall(char *template) __z88dk_fastcall; 514 #define tmpnam_ex(a) tmpnam_ex_fastcall(a) 515 516 517 518 #endif 519 520 #endif 521