home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_07 / MARK_WC2.LZH / INCLUDE / STDIO.H < prev    next >
C/C++ Source or Header  |  1988-04-27  |  3KB  |  90 lines

  1. /*
  2.  * stdio.h -- standard I/O library for Atari ST.
  3.  *
  4.  * Copyright (c) 1986-1987, Mark Williams Company, Chicago
  5.  * This file and its contents may not be copied or distributed
  6.  * without permission.
  7.  */
  8. #ifndef    STDIO_H
  9. #define    STDIO_H    STDIO_H
  10. typedef struct    FILE {
  11.     unsigned char    *_cp,        /* Current character pointer */
  12.             *_dp,        /* pointer to start of data in buffer */
  13.             *_bp;        /* Buffer pointer */
  14.     int    _cc;            /* Character count */
  15.     int    (*_gt)(),        /* getc() function */
  16.         (*_pt)();        /* putc() function */
  17.     char    _ff;            /* Flags; see below */
  18.     char    _fd;            /* File descriptor (reqd by reopen) */
  19.     int    _uc;            /* unget char */
  20. }    FILE;
  21.  
  22. #define    NULL    ((char *)0)
  23. #define    EOF    (-1)
  24. #define CTRLZ    26
  25. #define    BUFSIZ    (1<<9)
  26. #define    _NFILE    20
  27.  
  28. extern    FILE    _stdin, _stdout, _stderr, *_fp[_NFILE];
  29.  
  30. /* Flags in _ff */
  31. #define    _FINUSE    0x01
  32. #define    _FSTBUF    0x02        /* setbuf was called */
  33. #define    _FUNGOT    0x04        /* Ungotten char present */
  34. #define    _FEOF    0x08
  35. #define    _FERR    0x10
  36. #define _FASCII    0x20        /* ASCII mode (default) */
  37. #define _FWRITE 0        /* File is opened for writing, not used */
  38. #define _FDONTC    0        /* Don't close, not used */
  39.  
  40. #define    _ep(fp)        ((fp)->_bp+BUFSIZ)
  41.  
  42. char    *gets();
  43. char    *fgets();
  44. FILE    *fopen();
  45. FILE    *freopen();
  46. FILE    *fdopen();
  47. FILE    *_stropen();
  48. char    *malloc();
  49. char    *sbrk();
  50. long    ftell();
  51. void    puts();
  52. void    fputs();
  53. void    setbuf();
  54. long    bdos();
  55.  
  56. #define    getchar()    getc(stdin)
  57. #define    putchar(c)    putc(c, stdout)
  58. #define getc(fp)    ((*(fp)->_gt)((fp)))
  59. #define putc(c,fp)    ((*(fp)->_pt)(c,(fp)))
  60. #define    bingetc(fp)    (++(fp)->_cc>0 ? --(fp)->_cc,(*(fp)->_gt)(fp) :\
  61.                 *(fp)->_cp++)
  62. #define    binputc(c,fp)    (--(fp)->_cc<0 ? ++(fp)->_cc,(*(fp)->_pt)(c,fp) :\
  63.                 (*(fp)->_cp++=c))
  64. #define    bingetw(fp)    ((fp)->_cc>-2 ? fgetw(fp) :    ((fp)->_cc+=2\
  65.                             ,(fp)->_cp+=2\
  66.                             ,(fp)->_cp[-2]<<8\
  67.                             |(fp)->_cp[-1]))
  68. #define    binputw(w,fp)    ((fp)->_cc<2 ? fputw(w,fp) :    ((fp)->_cc-=2\
  69.                             ,*(fp)->_cp++=w>>8\
  70.                             ,*(fp)->_cp++=w\
  71.                             ,w))
  72. #define    feof(fp)    ((fp)->_ff&(_FEOF|_FERR))
  73. #define    ferror(fp)    ((fp)->_ff&_FERR)
  74. #define    clearerr(fp)    ((fp)->_ff &= ~(_FERR|_FEOF))
  75. #define    fileno(fp)    ((fp)->_fd)
  76. #define    wdleng()    (16)
  77.  
  78. #define    stdin    (&_stdin)
  79. #define    stdout    (&_stdout)
  80. #define    stderr    (&_stderr)
  81.  
  82. /*
  83.  * Temporary file directory manifests for System V compatibility
  84.  */
  85. #define P_tmpdir    "\\tmp"        /* Default temporary directory */
  86. #define L_tempnam    64        /* Maximum length of temp file name */
  87.  
  88. #endif
  89. /* End of stdio.h */
  90.