home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / e / emxdev8f.zip / STDIO.H < prev    next >
C/C++ Source or Header  |  1992-11-18  |  5KB  |  194 lines

  1. /* stdio.h (emx+gcc) */
  2.  
  3. #if !defined (_STDIO_H)
  4. #define _STDIO_H
  5.  
  6. #if defined (__cplusplus)
  7. extern "C" {
  8. #endif
  9.  
  10. #if !defined (_SIZE_T)
  11. #define _SIZE_T
  12. typedef unsigned long size_t;
  13. #endif
  14.  
  15. #if !defined (NULL)
  16. #define NULL ((void *)0)
  17. #endif
  18.  
  19. #if !defined (BUFSIZ)
  20. #define BUFSIZ 5120
  21. #endif
  22.  
  23. #if !defined (_FILE_T)
  24. #define _FILE_T
  25. struct _FILE
  26. {
  27.   char * ptr;
  28.   char * buffer;
  29.   int    rcount;
  30.   int    wcount;
  31.   int    handle;
  32.   int    flags;
  33.   int    buf_size;
  34.   int    tmpidx;
  35.   int    pid;
  36.   char   char_buf;
  37.   char   reserved1[3];
  38.   int    (*flush)(struct _FILE *f, int c);
  39.   unsigned long sem;
  40. };
  41.  
  42. typedef struct _FILE FILE;
  43.  
  44. extern FILE _streamv[];
  45.  
  46. #define stdin  (&_streamv[0])
  47. #define stdout (&_streamv[1])
  48. #define stderr (&_streamv[2])
  49.  
  50. #endif
  51.  
  52. #if !defined (SEEK_SET)
  53. #define SEEK_SET 0
  54. #define SEEK_CUR 1
  55. #define SEEK_END 2
  56. #endif
  57.  
  58. #if !defined (EOF)
  59. #define EOF (-1)
  60. #endif
  61.  
  62. #if !defined (_IOREAD)
  63. #define _IOREAD 0x01
  64. #define _IOWRT  0x02
  65. #define _IORW   0x04
  66. #define _IOEOF  0x08
  67. #define _IOERR  0x10
  68. #define _IOFBF  0x00
  69. #define _IOLBF  0x20
  70. #define _IONBF  0x40
  71. #endif
  72.  
  73. #if !defined (FOPEN_MAX)
  74. #define    FOPEN_MAX       14
  75. #endif
  76.  
  77. #if !defined (FILENAME_MAX)
  78. #define    FILENAME_MAX    260
  79. #endif
  80.  
  81. #if !defined (TMP_MAX)
  82. #define TMP_MAX         1000
  83. #endif
  84.  
  85. #if !defined (P_tmpdir)
  86. #define P_tmpdir "."
  87. #define L_tmpnam (sizeof (P_tmpdir) + 13)
  88. #endif
  89.  
  90. #if !defined (_FPOS_T)
  91. #define _FPOS_T
  92. typedef long fpos_t;
  93. #endif
  94.  
  95. #if !defined (_VA_LIST)
  96. #define _VA_LIST
  97. typedef char *va_list;
  98. #endif
  99.  
  100. void clearerr (FILE *stream);
  101. int fclose (FILE *stream);
  102. int fcloseall (void);
  103. FILE *fdopen (int handle, __const__ char *mode);
  104. int fflush (FILE *stream);
  105. int fgetc (FILE *stream);
  106. int fgetchar (void);
  107. int fgetpos (FILE *stream, fpos_t *pos);
  108. char *fgets (char *buffer, int n, FILE *stream);
  109. int flushall (void);
  110. FILE *fopen (__const__ char *fname, __const__ char *mode);
  111. int fprintf (FILE *stream, __const__ char *format, ...);
  112. int fputc (int c, FILE *stream);
  113. int fputchar (int c);
  114. int fputs (__const__ char *string, FILE *stream);
  115. size_t fread (void *buffer, size_t size, size_t count, FILE *stream);
  116. FILE *freopen (__const__ char *fname, __const__ char *mode, FILE *stream);
  117. int fscanf (FILE *stream, __const__ char *format, ...);
  118. int fseek (FILE *stream, long offset, int origin);
  119. int fsetpos (FILE *stream, __const__ fpos_t *pos);
  120. long ftell (FILE *stream);
  121. size_t fwrite (__const__ void *buffer, size_t size, size_t count,
  122.     FILE *stream);
  123. char *gets (char *buffer);
  124. int getw (FILE *stream);
  125. int pclose (FILE *stream);
  126. void perror (__const__ char *string);
  127. FILE *popen (__const__ char *command, __const__ char *mode);
  128. int printf (__const__ char *format, ...);
  129. int puts (__const__ char *string);
  130. int putw (int x, FILE *stream);
  131. int remove (__const__ char *name);
  132. int rename (__const__ char *old_name, __const__ char *new_name);
  133. void rewind (FILE *stream);
  134. int _rmtmp (void);
  135. int scanf (__const__ char *format, ...);
  136. int setbuf (FILE *stream, char *buffer);
  137. int setbuffer (FILE *stream, char *buffer, size_t size);
  138. int setvbuf (FILE *stream, char *buffer, int mode, size_t size);
  139. int sprintf (char *buffer, __const__ char *format, ...);
  140. int sscanf (__const__ char *buffer, __const__ char *format, ...);
  141. char *tempnam (__const__ char *dir, __const__ char *prefix);
  142. FILE *tmpfile (void);
  143. char *tmpnam (char *string);
  144. int ungetc (int c, FILE *stream);
  145. int unlink (__const__ char *name);
  146. int vfprintf (FILE *stream, __const__ char *format, va_list arg_ptr);
  147. int vfscanf (FILE *stream, __const__ char *format, va_list arg_ptr);
  148. int vprintf (__const__ char *format, va_list arg_ptr);
  149. int vscanf (__const__ char *format, va_list arg_ptr);
  150. int vsprintf (char *buffer, __const__ char *format, va_list arg_ptr);
  151. int vsscanf (__const__ char *buffer, __const__ char *format, va_list arg_ptr);
  152.  
  153. int _fill (FILE *stream);
  154. int _flush (int c, FILE *stream);
  155.  
  156. int _fseek_hdr (FILE *stream);
  157. FILE *_fsopen (__const__ char *fname, __const__ char *mode, int shflag);
  158.  
  159. static __inline__ int fileno (FILE *s) { return (s->handle); }
  160. static __inline__ int feof (FILE *s) { return (s->flags & _IOEOF ? 1 : 0); }
  161. static __inline__ int ferror (FILE *s) { return (s->flags & _IOERR ? 1 : 0); }
  162.  
  163. #if defined (__MT__)
  164.  
  165. #define getc fgetc
  166. #define putc fputc
  167.  
  168. #else
  169.  
  170. static __inline__ int getc (FILE *s)
  171. {
  172.   return (--s->rcount >= 0
  173.           ? (unsigned char)*s->ptr++
  174.           : _fill (s));
  175. }
  176.  
  177. static __inline__ int putc (int c, FILE *s)
  178. {
  179.   return (--s->wcount >= 0 && (c != '\n' || !(s->flags & _IOLBF))
  180.           ? (unsigned char)(*s->ptr++ = (char)c)
  181.           : _flush (c, s));
  182. }
  183.  
  184. #endif
  185.  
  186. static __inline__ int getchar (void) { return (getc (stdin)); }
  187. static __inline__ int putchar (int c) { return (putc (c, stdout)); }
  188.  
  189. #if defined (__cplusplus)
  190. }
  191. #endif
  192.  
  193. #endif /* !defined (_STDIO_H) */
  194.