home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s038 / 10.ddi / 017.LIF / STDIO.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-02  |  5.2 KB  |  179 lines

  1. /* stdio.h - standard I/O header file
  2.  * $Version: 1.1 $
  3.  * Copyright (c) 1988-91 Intel Corporation, ALL RIGHTS RESERVED.
  4.  */
  5.  
  6. #ifndef _stdioh 
  7. #define _stdioh
  8. /*lint -library */
  9.  
  10. #pragma fixedparams("rename",    "tempnam", "tmpnam")
  11. #pragma fixedparams("_fsopen")
  12. #pragma fixedparams("clearerr")
  13. #pragma fixedparams("fclose",    "feof",    "ferror",   "fflush",  "fgetc")
  14. #pragma fixedparams("fgets",     "fopen",   "fputc",    "fputs",   "fread")
  15. #pragma fixedparams("freopen",   "fseek",   "ftell",    "fwrite",  "getc")
  16. #pragma fixedparams("getchar",   "gets",    "perror",   "putc",    "putchar")
  17. #pragma fixedparams("puts",      "remove",  "rewind",   "setbuf",  "setvbuf")
  18. #pragma fixedparams("tmpfile",   "ungetc",  "vfprintf", "vprintf", "vsprintf")
  19. #pragma fixedparams("fgetpos",   "fsetpos")
  20. #pragma fixedparams("fcloseall", "fdopen",  "fgetchar", "fileno",  "flushall")
  21. #pragma fixedparams("fputchar",  "getw",    "putw",     "rmtmp")
  22. #pragma varparams("fprintf",     "fscanf",  "printf",   "scanf",   "sprintf")
  23. #pragma varparams("sscanf")
  24.  
  25.  
  26. #ifndef NULL
  27. #define NULL ((void *)0)
  28. #endif
  29.  
  30. #ifndef _fpos_t
  31. #define _fpos_t
  32. typedef unsigned long fpos_t;
  33. #endif
  34.  
  35. #ifndef _size_t
  36. #define _size_t
  37. typedef unsigned size_t;
  38. #endif
  39.  
  40. #ifndef _va_list
  41. typedef char *va_list;
  42. #define _VA_LIST_DEFINED
  43. #define _va_list
  44. #endif
  45.  
  46. #define BUFSIZ          512
  47. #define FOPEN_MAX        20
  48. #define TMP_MAX        4096
  49. #define FILENAME_MAX    127
  50. #define EOF             (-1)
  51.  
  52. #define L_tmpnam         13
  53. #define P_tmpdir       "\\"
  54.  
  55. #define _IOREAD        0x01
  56. #define _IOWRT         0x02
  57.  
  58. #define _IOFBF         0x00          /* neither line nor char buffering */
  59. #define _IOLBF         0x40
  60. #define _IONBF         0x04
  61.  
  62. #define _IOMYBUF       0x08
  63. #define _IOEOF         0x10
  64. #define _IOERR         0x20
  65. #define _IOSTRG        0x40
  66. #define _IORW          0x80
  67.  
  68. #define _IODIRTY       0x200
  69. #define _IO_STD_STREAM 0x1000
  70.  
  71. /* seek */
  72. #ifndef SEEK_SET
  73. #define SEEK_SET       0
  74. #define SEEK_CUR       1
  75. #define SEEK_END       2
  76. #endif
  77.  
  78. #ifndef _reenth
  79. #pragma align (_iobuf)
  80. #endif
  81.  
  82. #ifndef _FILE_t
  83. struct _iobuf {
  84.     unsigned char *_ptr;
  85.     int _cnt;
  86.     unsigned char *_base;
  87.     int _flag;
  88.     int _fd;                              /* File descriptor number */
  89.     int _size;                            /* File buffer size */
  90.     char *_temp_name;                     /* Temporary file name */
  91.     void *_sem;                           /* Semaphore */
  92.     struct _iobuf *_next_stream;          /* Pointer to the next stream */
  93. };
  94. typedef struct _iobuf FILE;
  95. #define _FILE_t
  96. #endif
  97.  
  98. #include <reent.h>
  99.  
  100. #define stdin          (&_stdio_ptr()->_stdin)
  101. #define stdout         (&_stdio_ptr()->_stdout)
  102. #define stderr         (&_stdio_ptr()->_stderr)
  103.  
  104. /*
  105.  * Function prototypes:
  106.  */
  107. void     clearerr(FILE *);
  108. int      fclose(FILE *);
  109. int      fcloseall(void);
  110. FILE    *fdopen(int, const char *);
  111. int      feof(FILE *);
  112. int      ferror(FILE *);
  113. int      fflush(FILE *);
  114. int      fgetc(FILE *);
  115. int      fgetchar(void);
  116. int      fgetpos(FILE *, fpos_t *);
  117. char    *fgets(char *, int, FILE *);
  118. int      fileno(FILE *);
  119. int      flushall(void);
  120. FILE    *fopen(const char *, const char *);
  121. int      fprintf(FILE *, const char *, ...);
  122. int      fputc(int, FILE *);
  123. int      fputchar(int);
  124. int      fputs(const char *, FILE *);
  125. size_t   fread(void *, size_t, size_t, FILE *);
  126. FILE    *freopen(const char *, const char *, FILE *);
  127. int      fscanf(FILE *, const char *, ...);
  128. int      fseek(FILE *, long int, int);
  129. int      fsetpos(FILE *, const fpos_t *);
  130. FILE   *_fsopen(const char *, const char *, int);
  131. long int ftell(FILE *);
  132. size_t   fwrite(const void *, size_t, size_t, FILE *);
  133. int      getc(FILE *);
  134. int      getchar(void);
  135. char    *gets(char *);
  136. int      getw(FILE *);
  137. void     perror(const char *);
  138. int      printf(const char *, ...);
  139. int      putc(int, FILE *);
  140. int      putchar(int);
  141. int      puts(const char *);
  142. int      putw(int, FILE *);
  143. int      remove(const char *);
  144. int      rename(const char *, const char *);
  145. void     rewind(FILE *);
  146. int      rmtmp(void);
  147. int      scanf(const char *, ...);
  148. void     setbuf(FILE *, char *);
  149. int      setvbuf(FILE *, char *, int, size_t);
  150. int      sprintf(char *, const char *, ...);
  151. int      sscanf(const char *, const char *, ...);
  152. char    *tempnam(char *, const char *);
  153. FILE    *tmpfile(void);
  154. char    *tmpnam(char *);
  155. int      ungetc(int, FILE *);
  156. int      vfprintf(FILE *, const char *, va_list);
  157. int      vprintf( const char *, va_list);
  158. int      vsprintf(char *, const char *, va_list);
  159.  
  160. /*
  161.  * Macro implementation of stdio functions:
  162.  */
  163. #define feof(f)    ((f)->_flag & _IOEOF)
  164. #define ferror(f)  ((f)->_flag & _IOERR)
  165. #define fgetchar() fgetc(stdin)
  166. #define fileno(f)  ((f)->_fd)
  167. #define getchar()  getc(stdin)
  168. #define putchar(c) putc((c),stdout)
  169. #define _ungetc_
  170.  
  171. #define getc(_s)     (((((_s)->_cnt) > 0) && (((_s)->_cnt) < ((_s)->_size))) \
  172. ? (((_s)->_cnt--), (unsigned char)(*(_s)->_ptr++)) : ((getc)(_s)))
  173.  
  174. #define putc(_c,_s)  (((((_s)->_cnt) > 0) && (((_s)->_cnt) < ((_s)->_size))) \
  175. ? (((_s)->_cnt--), (*((_s)->_ptr++)=(unsigned char)(_c))) : ((putc)(_c,_s)))
  176.  
  177. #endif /* _stdioh */
  178.  
  179.