home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / g__lib / nonstdio.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-23  |  4.5 KB  |  162 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. /* 
  3. Copyright (C) 1988 Free Software Foundation
  4.     written by Doug Lea (dl@rocky.oswego.edu)
  5.  
  6. This file is part of GNU CC.
  7.  
  8. GNU CC is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY.  No author or distributor
  10. accepts responsibility to anyone for the consequences of using it
  11. or for whether it serves any particular purpose or works at all,
  12. unless he says so in writing.  Refer to the GNU CC General Public
  13. License for full details.
  14.  
  15. Everyone is granted permission to copy, modify and redistribute
  16. GNU CC, but only under the conditions described in the
  17. GNU CC General Public License.   A copy of this license is
  18. supposed to have been given to you along with GNU CC so you
  19. can know your rights and responsibilities.  It should be in a
  20. file named COPYING.  Among other things, the copyright notice
  21. and this notice must be preserved on all copies.  
  22. */
  23.  
  24. /*
  25.  *  Please check the following before installing this file:
  26.  *
  27.  *  If you are running AT&T System V or similar systems in which
  28.  *  there is no _bufsiz field in _iobuf, then comment out the
  29.  *  #define HAVE_BUFSIZ line below.
  30.  *
  31.  *  Check whether your libc.a sprintf function returns
  32.  *  an int (as do most) versus a char* (BSD), and (un)comment
  33.  *  the corresponding SPRINTF_RETURNS_INT line.
  34.  *
  35.  *  Check the value of BUFSIZ against the one in your /usr/include/stdio.h.
  36.  *
  37.  *  Carefully check the fields and order of _iobuf declaration against
  38.  *  the one in your /usr/include/stdio.h. Xenix-based systems
  39.  *  may need some re-ordering of _iobuf. fields.
  40.  *
  41.  *  Note that some _IOXXX #defines may not be present in your 
  42.  *  /usr/include/stdio.h. This is ok, so long as the ones that
  43.  *  are present in both are set to the same values.
  44.  *
  45.  *  Some of the prototypes refer to functions that may not be
  46.  *  present in your libc.a. This is ok so long as you do not
  47.  *  actually call such functions.
  48.  *
  49.  */
  50.  
  51. #ifndef FILE
  52. #pragma once
  53.  
  54.  
  55. /* check and possibly comment out the following */
  56.  
  57. #ifndef USG
  58. #define HAVE_BUFSIZ 
  59. #endif
  60.  
  61. #define SPRINTF_RETURNS_INT
  62.  
  63. /* check and possibly redefine the following */
  64. #define BUFSIZ  1024            
  65.  
  66. extern  struct  _iobuf {
  67.     int      _cnt;
  68.     char*    _ptr;
  69.     char*    _base;
  70. #   ifdef HAVE_BUFSIZ
  71.     int     _bufsiz;
  72.     short   _flag;
  73. #   else
  74.     char    _flag;
  75. #   endif
  76.     char    _file;
  77. } _iob[];
  78.  
  79. #define FILE     struct _iobuf
  80.  
  81. #define _IOFBF    00000
  82. #define _IOREAD   00001
  83. #define _IOWRT    00002
  84. #define _IONBF    00004
  85. #define _IOMYBUF  00010
  86. #define _IOEOF    00020
  87. #define _IOERR    00040
  88. #define _IOSTRG   00100
  89. #define _IOLBF    00200
  90. #define _IORW     00400
  91. #define _IOAPPEND 01000
  92.  
  93. #define EOF       (-1)
  94.  
  95. #ifndef NULL
  96. #define NULL      0
  97. #endif
  98.  
  99. #define stdin     (&_iob[0])
  100. #define stdout    (&_iob[1])
  101. #define stderr    (&_iob[2])
  102.  
  103. #define getc(p) (--(p)->_cnt>=0?(int)(*(unsigned char*)(p)->_ptr++):_filbuf(p))
  104. #define putc(x,p) (--(p)->_cnt>=0? ((int)((unsigned char)((*(p)->_ptr++=(unsigned)(x))))):_flsbuf((unsigned)(x),p))
  105.  
  106. #define clearerr(p) ((p)->_flag &= ~(_IOERR|_IOEOF))
  107. #define getchar()   getc(stdin)
  108. #define putchar(x)  putc(x,stdout)
  109. #define feof(p)     (((p)->_flag&_IOEOF)!=0)
  110. #define ferror(p)   (((p)->_flag&_IOERR)!=0)
  111. #define fileno(p)   ((p)->_file)
  112.  
  113. extern "C" {
  114.  
  115. int    _doprnt(const char*, void*, FILE*);
  116. int    _doscan(FILE*, const char*, void*);
  117. int    _filbuf(FILE*);
  118. int    _flsbuf(unsigned, FILE*);
  119. int    fclose(FILE*);
  120. FILE*  fdopen(int, const char*);
  121. int    fflush(FILE*);
  122. int    fgetc(FILE*);
  123. char*  fgets(char*, int, FILE *);
  124. FILE*  fopen(const char*, const char*);
  125. int    fprintf(FILE*, const char* ...);
  126. int    fputc(int, FILE*);
  127. int    fputs(const char*, FILE*);
  128. int    fread(void*, int, int, FILE*);
  129. FILE*  freopen(const char*, const char*, FILE*);
  130. int    fscanf(FILE*, const char* ...);
  131. int    fseek(FILE*, long, int);
  132. long   ftell(FILE *);
  133. int    fwrite(const void*, int, int, FILE*);
  134. char*  gets(char*);
  135. int    getw(FILE*);
  136. int    pclose(FILE*);
  137. FILE*  popen(const char*, const char*);
  138. int    printf(const char* ...);
  139. void   puts(const char*);
  140. int    putw(int, FILE*);
  141. int    scanf(const char* ...);
  142. void   setbuf(FILE*, char*);
  143. void   setbuffer(FILE*, char*, int);
  144. void   setlinebuf(FILE*);
  145. void   setvbuf(FILE*, char*, int, int);
  146. int    sscanf(char*, const char* ...);
  147. FILE*  tmpfile();
  148. int    ungetc(int, FILE*);
  149. int    vfprintf(FILE*, const char*, void* ap);
  150. int    vprintf(const char*, void* ap);
  151. int    vsprintf(char*, const char*, void* ap);
  152.  
  153. #ifdef SPRINTF_RETURNS_INT
  154. int    sprintf(char*, const char* ...);
  155. #else
  156. char*  sprintf(char*, const char* ...);
  157. #endif
  158.  
  159. }
  160.  
  161. #endif // FILE
  162.