home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_07 / LATTIC_3.ZIP / HEADERS / STDIO.H < prev    next >
C/C++ Source or Header  |  1990-08-21  |  6KB  |  209 lines

  1. /*
  2.  * stdio.h - level 2 I/O interface file
  3.  *
  4.  * Started 30/8/89 Alex G. Kiernan, based on Lattice source
  5.  *
  6.  * Copyright (c) 1989 HiSoft and Lattice, Inc.
  7.  */
  8.  
  9. #ifndef _STDIO_H
  10. #define _STDIO_H
  11.  
  12. #ifndef    _SIZE_T
  13. #define    _SIZE_T
  14. typedef unsigned long int size_t;
  15. #endif
  16.  
  17. __regargs long _CXCERR(long);        /* always __regargs for efficiency */
  18.  
  19. #ifndef _VA_LIST
  20. #define _VA_LIST
  21. typedef char *va_list;
  22. #endif
  23.  
  24. typedef struct _iobuf FILE;
  25. typedef unsigned long fpos_t;
  26.  
  27. #define    NULL    ((void *)0)
  28.  
  29. #define _BUFSIZ    512                /* standard buffer size */
  30. #define BUFSIZ    _BUFSIZ            /* standard buffer size */
  31. #define OPEN_MAX    20            /* maximum number of files */
  32. #define _NFILE    OPEN_MAX        /* maximum number of files */
  33. #define FOPEN_MAX    OPEN_MAX    /* maximum number of files */
  34. #define FILENAME_MAX    128        /* FMSIZE */
  35. #define L_tmpnam    9            /* maximum tmpnam filename length */
  36. #define TMP_MAX    17576            /* Guaranteed unique temp names */
  37.  
  38. /**
  39. *
  40. * Definitions associated with _iobuf._flag
  41. *
  42. **/
  43.  
  44. #define _IOFBF    0        /* fully buffered (for setvbuf) */
  45. #define _IOREAD    1        /* read flag */
  46. #define _IOWRT    2        /* write flag */
  47. #define _IONBF    4        /* non-buffered flag */
  48. #define _IOMYBUF    8    /* private buffer flag */
  49. #define _IOEOF    16        /* end-of-file flag */
  50. #define _IOERR    32        /* error flag */
  51. #define _IOLBF    64        /* line-buffered flag */
  52. #define _IORW    128        /* read-write (update) flag */
  53. #define _IOAPP    0x4000    /* append flag */
  54. #define _IOXLAT    0x8000    /* translation flag */
  55.  
  56. #define EOF (-1)        /* end-of-file code */
  57.  
  58. #define SEEK_SET    0    /* Seek from beginning of file */
  59. #define SEEK_CUR    1    /* Seek from current file position */
  60. #define SEEK_END    2    /* Seek from end of file */
  61.  
  62. struct _iobuf {
  63.     struct _iobuf *_next;
  64.     unsigned char *_ptr;    /* current buffer pointer */
  65.     int _rcnt;                /* current byte count for reading */
  66.     int _wcnt;                /* current byte count for writing */
  67.     unsigned char *_base;    /* base address of I/O buffer */
  68.     int _size;                /* size of buffer */
  69.     int _flag;                /* control flags */
  70.     int _file;                /* file descriptor */
  71.     unsigned char _cbuff;    /* single char buffer */
  72. };
  73.  
  74. extern struct _iobuf _iob[];
  75.  
  76. #define stdin (&_iob[0])    /* standard input file pointer */
  77. #define stdout (&_iob[1])    /* standard output file pointer */
  78. #define stderr (&_iob[2])    /* standard error file pointer */
  79. #define    stdaux (&_iob[3])    /* standard auxiliary file pointer */
  80. #define    stdprt (&_iob[4])    /* standard printer file pointer */
  81.  
  82. /*
  83.  * Prototypes for ANSI standard functions.
  84.  */
  85. #undef rename
  86. int rename(const char *,const char *);
  87. #ifndef __NO_STDIO_DEFINES
  88. long _lgscc(int,int,const char *,const char *);
  89. #pragma inline d0=_lgscc((short),(short),,)    {register d2,a2; "4e41";}
  90. #define rename(x,y)    _CXCERR(_lgscc(0x56,0,x,y))
  91. #endif
  92.  
  93. #undef remove
  94. int remove(const char *);
  95. #ifndef __NO_STDIO_DEFINES
  96. long _lgc(int,const char *);
  97. #pragma inline d0=_lgc((short),)    {register d2,a2; "4e41";}
  98. #define remove(x)    _CXCERR(_lgc(0x41,x))
  99. #endif
  100.  
  101. FILE *tmpfile(void);
  102. char *tmpnam(char *s);
  103.  
  104. int fclose(FILE *);
  105. int fflush(FILE *);
  106. FILE *fopen(const char *, const char *);
  107. FILE *freopen(const char *, const char *, FILE *);
  108. void setbuf(FILE *, char *);
  109. int setvbuf(FILE *, char *, int, size_t);
  110.  
  111. int fprintf(FILE *, const char *, ...);
  112. int fscanf(FILE *, const char *, ...);
  113. int printf(const char *, ...);
  114. int lprintf(const char *, ...);
  115. int scanf(const char *, ...);
  116. int sprintf(char *, const char *, ...);
  117. int sscanf(const char *, const char *, ...);
  118. int vfprintf(FILE *, const char *, va_list);
  119. int vprintf(const char *, va_list);
  120. int vsprintf(char *, const char *, va_list);
  121.  
  122. int __builtin_printf(const char *, ...);
  123. #define printf __builtin_printf
  124.  
  125. int fgetc(FILE *);
  126. char *fgets(char *, int, FILE *);
  127. int fputc(int, FILE *);
  128. int fputs(const char *, FILE *);
  129. int getc(FILE *);
  130. #define getc(p) (--(p)->_rcnt>=0 ? *(p)->_ptr++ : fgetc(p))
  131. int getchar(void);
  132. #define getchar() getc(stdin)
  133. char *gets(char *);
  134. int putc(int, FILE *);
  135. #define putc(c,p) (--(p)->_wcnt>=0 ? *(p)->_ptr++=(c) : fputc(c,p))
  136. int putchar(int);
  137. #define putchar(c) putc(c,stdout)
  138. int puts(const char *);
  139. int ungetc(int, FILE *);
  140.  
  141. size_t fread(void *, size_t, size_t, FILE *);
  142. size_t fwrite(const void *, size_t, size_t, FILE *);
  143. int fgetpos(FILE *, fpos_t *);
  144. int fseek(FILE *, long int, int);
  145. int fsetpos(FILE *, const fpos_t *);
  146. long int ftell(FILE *);
  147. void rewind(FILE *);
  148. #ifndef __NO_STDIO_DEFINES
  149. #define rewind(p) fseek(p, 0L, 0)
  150. #endif
  151.  
  152. void clearerr(FILE *);
  153. #define clearerr(p) ((p)->_flag &= ~(_IOERR | _IOEOF))
  154. int feof(FILE *);
  155. #define feof(p) (((p)->_flag & _IOEOF) != 0)
  156. int ferror(FILE *);
  157. #define ferror(p) (((p)->_flag & _IOERR) != 0)
  158. void perror(const char *);
  159.  
  160. /*
  161.  * Prototypes for Non-ANSI functions.
  162.  */
  163. int fcloseall(void);
  164. FILE *fdopen(int, const char *);
  165. int fgetchar(void);
  166. int fileno(FILE *);
  167. int flushall(void);
  168. void fmode(FILE *, int);
  169. __stdargs int _writes(char *);
  170. int _tinyprintf(char *, ...);
  171. int fputchar(int);
  172. int setnbf(FILE *);
  173. int __flushbuff(int, FILE *);
  174. int access(const char *, int);
  175. int chdir(const char *);
  176. int chmod(const char *, int);
  177. char *getcwd(char *, int);
  178. int mkdir(const char *);
  179. int rmdir(const char *);
  180. FILE *fopene(const char *, const char *,char *);
  181.  
  182. FILE *popen(const char *,const char *);
  183. int    pclose(FILE *);
  184.  
  185. #undef unlink
  186. int unlink(const char *);
  187. #ifndef __NO_STDIO_DEFINES
  188. #define unlink remove
  189. #endif
  190.  
  191. char *mktemp(char *s);
  192. short fputw(short,FILE *);
  193. long fputl(long,FILE *);
  194. short fgetw(FILE *);
  195. long fgetl(FILE *);
  196.  
  197. #define    clrerr    clearerr
  198. #define    fileno(p) ((p)->_file)
  199. #define    _flsbf    __flushbuff
  200. #define    _getbf    __getbuff
  201.  
  202. int _getbf(FILE *);
  203.  
  204. extern unsigned long __fmask;
  205. extern int _fmode;
  206. extern int _bufsiz;        /* default file buffer size */
  207.  
  208. #endif
  209.