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 __LIB__ *_fmemopen_(void **bufp,size_t *sizep,char *mode) __smallc; 86 extern FILE __LIB__ *_fmemopen__callee(void **bufp,size_t *sizep,char *mode) __smallc __z88dk_callee; 87 #define _fmemopen_(a,b,c) _fmemopen__callee(a,b,c) 88 89 90 extern int __LIB__ asprintf(char **ptr,char *format,...) __smallc; 91 92 93 extern void __LIB__ clearerr(FILE *stream) __smallc __z88dk_fastcall; 94 95 96 extern int __LIB__ fclose(FILE *stream) __smallc __z88dk_fastcall; 97 98 99 extern FILE __LIB__ *fdopen(int fd,const char *mode) __smallc; 100 extern FILE __LIB__ *fdopen_callee(int fd,const char *mode) __smallc __z88dk_callee; 101 #define fdopen(a,b) fdopen_callee(a,b) 102 103 104 extern int __LIB__ feof(FILE *stream) __smallc __z88dk_fastcall; 105 106 107 extern int __LIB__ ferror(FILE *stream) __smallc __z88dk_fastcall; 108 109 110 extern int __LIB__ fflush(FILE *stream) __smallc __z88dk_fastcall; 111 112 113 extern int __LIB__ fgetc(FILE *stream) __smallc __z88dk_fastcall; 114 115 116 extern int __LIB__ fgetpos(FILE *stream,fpos_t *pos) __smallc; 117 extern int __LIB__ fgetpos_callee(FILE *stream,fpos_t *pos) __smallc __z88dk_callee; 118 #define fgetpos(a,b) fgetpos_callee(a,b) 119 120 121 extern char __LIB__ *fgets(char *s,int n,FILE *stream) __smallc; 122 extern char __LIB__ *fgets_callee(char *s,int n,FILE *stream) __smallc __z88dk_callee; 123 #define fgets(a,b,c) fgets_callee(a,b,c) 124 125 126 extern int __LIB__ fileno(FILE *stream) __smallc __z88dk_fastcall; 127 128 129 extern void __LIB__ flockfile(FILE *stream) __smallc __z88dk_fastcall; 130 131 132 extern FILE __LIB__ *fmemopen(void *buf,size_t size,char *mode) __smallc; 133 extern FILE __LIB__ *fmemopen_callee(void *buf,size_t size,char *mode) __smallc __z88dk_callee; 134 #define fmemopen(a,b,c) fmemopen_callee(a,b,c) 135 136 137 extern FILE __LIB__ *fopen(const char *filename,const char *mode) __smallc; 138 extern FILE __LIB__ *fopen_callee(const char *filename,const char *mode) __smallc __z88dk_callee; 139 #define fopen(a,b) fopen_callee(a,b) 140 141 142 extern int __LIB__ fprintf(FILE *stream,char *format,...) __smallc; 143 144 145 extern int __LIB__ fputc(int c,FILE *stream) __smallc; 146 extern int __LIB__ fputc_callee(int c,FILE *stream) __smallc __z88dk_callee; 147 #define fputc(a,b) fputc_callee(a,b) 148 149 150 extern int __LIB__ fputs(char *s,FILE *stream) __smallc; 151 extern int __LIB__ fputs_callee(char *s,FILE *stream) __smallc __z88dk_callee; 152 #define fputs(a,b) fputs_callee(a,b) 153 154 155 extern size_t __LIB__ fread(void *ptr,size_t size,size_t nmemb,FILE *stream) __smallc; 156 extern size_t __LIB__ fread_callee(void *ptr,size_t size,size_t nmemb,FILE *stream) __smallc __z88dk_callee; 157 #define fread(a,b,c,d) fread_callee(a,b,c,d) 158 159 160 extern FILE __LIB__ *freopen(char *filename,char *mode,FILE *stream) __smallc; 161 extern FILE __LIB__ *freopen_callee(char *filename,char *mode,FILE *stream) __smallc __z88dk_callee; 162 #define freopen(a,b,c) freopen_callee(a,b,c) 163 164 165 extern int __LIB__ fscanf(FILE *stream,char *format,...) __smallc; 166 167 168 extern int __LIB__ fseek(FILE *stream,long offset,int whence) __smallc; 169 extern int __LIB__ fseek_callee(FILE *stream,long offset,int whence) __smallc __z88dk_callee; 170 #define fseek(a,b,c) fseek_callee(a,b,c) 171 172 173 extern int __LIB__ fsetpos(FILE *stream,fpos_t *pos) __smallc; 174 extern int __LIB__ fsetpos_callee(FILE *stream,fpos_t *pos) __smallc __z88dk_callee; 175 #define fsetpos(a,b) fsetpos_callee(a,b) 176 177 178 extern uint32_t __LIB__ ftell(FILE *stream) __smallc __z88dk_fastcall; 179 180 181 extern int __LIB__ ftrylockfile(FILE *stream) __smallc __z88dk_fastcall; 182 183 184 extern void __LIB__ funlockfile(FILE *stream) __smallc __z88dk_fastcall; 185 186 187 extern size_t __LIB__ fwrite(void *ptr,size_t size,size_t nmemb,FILE *stream) __smallc; 188 extern size_t __LIB__ fwrite_callee(void *ptr,size_t size,size_t nmemb,FILE *stream) __smallc __z88dk_callee; 189 #define fwrite(a,b,c,d) fwrite_callee(a,b,c,d) 190 191 192 extern int __LIB__ getc(FILE *stream) __smallc __z88dk_fastcall; 193 194 195 extern int __LIB__ getchar(void) __smallc; 196 197 198 extern int __LIB__ getdelim(char **lineptr,size_t *n,int delim,FILE *stream) __smallc; 199 extern int __LIB__ getdelim_callee(char **lineptr,size_t *n,int delim,FILE *stream) __smallc __z88dk_callee; 200 #define getdelim(a,b,c,d) getdelim_callee(a,b,c,d) 201 202 203 extern int __LIB__ getline(char **lineptr,size_t *n,FILE *stream) __smallc; 204 extern int __LIB__ getline_callee(char **lineptr,size_t *n,FILE *stream) __smallc __z88dk_callee; 205 #define getline(a,b,c) getline_callee(a,b,c) 206 207 208 extern char __LIB__ *gets(char *s) __smallc __z88dk_fastcall; 209 210 211 extern int __LIB__ obstack_printf(struct obstack *ob,char *format,...) __smallc; 212 213 214 extern int __LIB__ obstack_vprintf(struct obstack *ob,char *format,void *arg) __smallc; 215 extern int __LIB__ obstack_vprintf_callee(struct obstack *ob,char *format,void *arg) __smallc __z88dk_callee; 216 #define obstack_vprintf(a,b,c) obstack_vprintf_callee(a,b,c) 217 218 219 extern FILE __LIB__ *open_memstream(char **bufp,size_t *sizep) __smallc; 220 extern FILE __LIB__ *open_memstream_callee(char **bufp,size_t *sizep) __smallc __z88dk_callee; 221 #define open_memstream(a,b) open_memstream_callee(a,b) 222 223 224 extern void __LIB__ perror(char *s) __smallc __z88dk_fastcall; 225 226 227 extern int __LIB__ printf(char *format,...) __smallc; 228 229 230 extern int __LIB__ putc(int c,FILE *stream) __smallc; 231 extern int __LIB__ putc_callee(int c,FILE *stream) __smallc __z88dk_callee; 232 #define putc(a,b) putc_callee(a,b) 233 234 235 extern int __LIB__ putchar(int c) __smallc __z88dk_fastcall; 236 237 238 extern int __LIB__ puts(char *s) __smallc __z88dk_fastcall; 239 240 241 extern void __LIB__ rewind(FILE *stream) __smallc __z88dk_fastcall; 242 243 244 extern int __LIB__ scanf(char *format,...) __smallc; 245 246 247 extern int __LIB__ snprintf(char *s,size_t n,char *format,...) __smallc; 248 249 250 extern int __LIB__ sprintf(char *s,char *format,...) __smallc; 251 252 253 extern int __LIB__ sscanf(char *s,char *format,...) __smallc; 254 255 256 extern int __LIB__ ungetc(int c,FILE *stream) __smallc; 257 extern int __LIB__ ungetc_callee(int c,FILE *stream) __smallc __z88dk_callee; 258 #define ungetc(a,b) ungetc_callee(a,b) 259 260 261 extern int __LIB__ vasprintf(char **ptr,char *format,void *arg) __smallc; 262 extern int __LIB__ vasprintf_callee(char **ptr,char *format,void *arg) __smallc __z88dk_callee; 263 #define vasprintf(a,b,c) vasprintf_callee(a,b,c) 264 265 266 extern int __LIB__ vfprintf(FILE *stream,char *format,void *arg) __smallc; 267 extern int __LIB__ vfprintf_callee(FILE *stream,char *format,void *arg) __smallc __z88dk_callee; 268 #define vfprintf(a,b,c) vfprintf_callee(a,b,c) 269 270 271 extern int __LIB__ vfscanf(FILE *stream,char *format,void *arg) __smallc; 272 extern int __LIB__ vfscanf_callee(FILE *stream,char *format,void *arg) __smallc __z88dk_callee; 273 #define vfscanf(a,b,c) vfscanf_callee(a,b,c) 274 275 276 extern int __LIB__ vprintf(char *format,void *arg) __smallc; 277 extern int __LIB__ vprintf_callee(char *format,void *arg) __smallc __z88dk_callee; 278 #define vprintf(a,b) vprintf_callee(a,b) 279 280 281 extern int __LIB__ vscanf(char *format,void *arg) __smallc; 282 extern int __LIB__ vscanf_callee(char *format,void *arg) __smallc __z88dk_callee; 283 #define vscanf(a,b) vscanf_callee(a,b) 284 285 286 extern int __LIB__ vsnprintf(char *s,size_t n,char *format,void *arg) __smallc; 287 extern int __LIB__ vsnprintf_callee(char *s,size_t n,char *format,void *arg) __smallc __z88dk_callee; 288 #define vsnprintf(a,b,c,d) vsnprintf_callee(a,b,c,d) 289 290 291 extern int __LIB__ vsprintf(char *s,char *format,void *arg) __smallc; 292 extern int __LIB__ vsprintf_callee(char *s,char *format,void *arg) __smallc __z88dk_callee; 293 #define vsprintf(a,b,c) vsprintf_callee(a,b,c) 294 295 296 extern int __LIB__ vsscanf(char *s,char *format,void *arg) __smallc; 297 extern int __LIB__ vsscanf_callee(char *s,char *format,void *arg) __smallc __z88dk_callee; 298 #define vsscanf(a,b,c) vsscanf_callee(a,b,c) 299 300 301 302 extern void __LIB__ clearerr_unlocked(FILE *stream) __smallc __z88dk_fastcall; 303 304 305 extern int __LIB__ fclose_unlocked(FILE *stream) __smallc __z88dk_fastcall; 306 307 308 extern int __LIB__ feof_unlocked(FILE *stream) __smallc __z88dk_fastcall; 309 310 311 extern int __LIB__ ferror_unlocked(FILE *stream) __smallc __z88dk_fastcall; 312 313 314 extern int __LIB__ fflush_unlocked(FILE *stream) __smallc __z88dk_fastcall; 315 316 317 extern int __LIB__ fgetc_unlocked(FILE *stream) __smallc __z88dk_fastcall; 318 319 320 extern int __LIB__ fgetpos_unlocked(FILE *stream,fpos_t *pos) __smallc; 321 extern int __LIB__ fgetpos_unlocked_callee(FILE *stream,fpos_t *pos) __smallc __z88dk_callee; 322 #define fgetpos_unlocked(a,b) fgetpos_unlocked_callee(a,b) 323 324 325 extern char __LIB__ *fgets_unlocked(char *s,int n,FILE *stream) __smallc; 326 extern char __LIB__ *fgets_unlocked_callee(char *s,int n,FILE *stream) __smallc __z88dk_callee; 327 #define fgets_unlocked(a,b,c) fgets_unlocked_callee(a,b,c) 328 329 330 extern int __LIB__ fileno_unlocked(FILE *stream) __smallc __z88dk_fastcall; 331 332 333 extern int __LIB__ fprintf_unlocked(FILE *stream,char *format,...) __smallc; 334 335 336 extern int __LIB__ fputc_unlocked(int c,FILE *stream) __smallc; 337 extern int __LIB__ fputc_unlocked_callee(int c,FILE *stream) __smallc __z88dk_callee; 338 #define fputc_unlocked(a,b) fputc_unlocked_callee(a,b) 339 340 341 extern int __LIB__ fputs_unlocked(char *s,FILE *stream) __smallc; 342 extern int __LIB__ fputs_unlocked_callee(char *s,FILE *stream) __smallc __z88dk_callee; 343 #define fputs_unlocked(a,b) fputs_unlocked_callee(a,b) 344 345 346 extern size_t __LIB__ fread_unlocked(void *ptr,size_t size,size_t nmemb,FILE *stream) __smallc; 347 extern size_t __LIB__ fread_unlocked_callee(void *ptr,size_t size,size_t nmemb,FILE *stream) __smallc __z88dk_callee; 348 #define fread_unlocked(a,b,c,d) fread_unlocked_callee(a,b,c,d) 349 350 351 extern FILE __LIB__ *freopen_unlocked(char *filename,char *mode,FILE *stream) __smallc; 352 extern FILE __LIB__ *freopen_unlocked_callee(char *filename,char *mode,FILE *stream) __smallc __z88dk_callee; 353 #define freopen_unlocked(a,b,c) freopen_unlocked_callee(a,b,c) 354 355 356 extern int __LIB__ fscanf_unlocked(FILE *stream,char *format,...) __smallc; 357 358 359 extern int __LIB__ fseek_unlocked(FILE *stream,long offset,int whence) __smallc; 360 extern int __LIB__ fseek_unlocked_callee(FILE *stream,long offset,int whence) __smallc __z88dk_callee; 361 #define fseek_unlocked(a,b,c) fseek_unlocked_callee(a,b,c) 362 363 364 extern int __LIB__ fsetpos_unlocked(FILE *stream,fpos_t *pos) __smallc; 365 extern int __LIB__ fsetpos_unlocked_callee(FILE *stream,fpos_t *pos) __smallc __z88dk_callee; 366 #define fsetpos_unlocked(a,b) fsetpos_unlocked_callee(a,b) 367 368 369 extern uint32_t __LIB__ ftell_unlocked(FILE *stream) __smallc __z88dk_fastcall; 370 371 372 extern size_t __LIB__ fwrite_unlocked(void *ptr,size_t size,size_t nmemb,FILE *stream) __smallc; 373 extern size_t __LIB__ fwrite_unlocked_callee(void *ptr,size_t size,size_t nmemb,FILE *stream) __smallc __z88dk_callee; 374 #define fwrite_unlocked(a,b,c,d) fwrite_unlocked_callee(a,b,c,d) 375 376 377 extern int __LIB__ getc_unlocked(FILE *stream) __smallc __z88dk_fastcall; 378 379 380 extern int __LIB__ getchar_unlocked(void) __smallc; 381 382 383 extern int __LIB__ getdelim_unlocked(char **lineptr,size_t *n,int delim,FILE *stream) __smallc; 384 extern int __LIB__ getdelim_unlocked_callee(char **lineptr,size_t *n,int delim,FILE *stream) __smallc __z88dk_callee; 385 #define getdelim_unlocked(a,b,c,d) getdelim_unlocked_callee(a,b,c,d) 386 387 388 extern int __LIB__ getline_unlocked(char **lineptr,size_t *n,FILE *stream) __smallc; 389 extern int __LIB__ getline_unlocked_callee(char **lineptr,size_t *n,FILE *stream) __smallc __z88dk_callee; 390 #define getline_unlocked(a,b,c) getline_unlocked_callee(a,b,c) 391 392 393 extern char __LIB__ *gets_unlocked(char *s) __smallc __z88dk_fastcall; 394 395 396 extern int __LIB__ printf_unlocked(char *format,...) __smallc; 397 398 399 extern int __LIB__ putc_unlocked(int c,FILE *stream) __smallc; 400 extern int __LIB__ putc_unlocked_callee(int c,FILE *stream) __smallc __z88dk_callee; 401 #define putc_unlocked(a,b) putc_unlocked_callee(a,b) 402 403 404 extern int __LIB__ putchar_unlocked(int c) __smallc __z88dk_fastcall; 405 406 407 extern int __LIB__ puts_unlocked(char *s) __smallc __z88dk_fastcall; 408 409 410 extern void __LIB__ rewind_unlocked(FILE *stream) __smallc __z88dk_fastcall; 411 412 413 extern int __LIB__ scanf_unlocked(char *format,...) __smallc; 414 415 416 extern int __LIB__ ungetc_unlocked(int c,FILE *stream) __smallc; 417 extern int __LIB__ ungetc_unlocked_callee(int c,FILE *stream) __smallc __z88dk_callee; 418 #define ungetc_unlocked(a,b) ungetc_unlocked_callee(a,b) 419 420 421 extern int __LIB__ vfprintf_unlocked(FILE *stream,char *format,void *arg) __smallc; 422 extern int __LIB__ vfprintf_unlocked_callee(FILE *stream,char *format,void *arg) __smallc __z88dk_callee; 423 #define vfprintf_unlocked(a,b,c) vfprintf_unlocked_callee(a,b,c) 424 425 426 extern int __LIB__ vfscanf_unlocked(FILE *stream,char *format,void *arg) __smallc; 427 extern int __LIB__ vfscanf_unlocked_callee(FILE *stream,char *format,void *arg) __smallc __z88dk_callee; 428 #define vfscanf_unlocked(a,b,c) vfscanf_unlocked_callee(a,b,c) 429 430 431 extern int __LIB__ vprintf_unlocked(char *format,void *arg) __smallc; 432 extern int __LIB__ vprintf_unlocked_callee(char *format,void *arg) __smallc __z88dk_callee; 433 #define vprintf_unlocked(a,b) vprintf_unlocked_callee(a,b) 434 435 436 extern int __LIB__ vscanf_unlocked(char *format,void *arg) __smallc; 437 extern int __LIB__ vscanf_unlocked_callee(char *format,void *arg) __smallc __z88dk_callee; 438 #define vscanf_unlocked(a,b) vscanf_unlocked_callee(a,b) 439 440 441 442 #ifdef __ZXNEXT 443 444 #include <arch.h> 445 446 #define L_tmpnam __ENV_LTMPNAM 447 #define TMP_MAX 0xffff 448 449 extern char __LIB__ *tmpnam(char *s) __smallc __z88dk_fastcall; 450 451 452 extern char __LIB__ *tmpnam_ex(char *template) __smallc __z88dk_fastcall; 453 454 455 456 #endif 457 458 #endif 459