Annotation of mstools/h/stdio.h, revision 1.1.1.4

1.1       root        1: /***
                      2: *stdio.h - definitions/declarations for standard I/O routines
                      3: *
1.1.1.4 ! root        4: *      Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
1.1       root        5: *
                      6: *Purpose:
                      7: *      This file defines the structures, values, macros, and functions
                      8: *      used by the level 2 I/O ("standard I/O") routines.
                      9: *      [ANSI/System V]
                     10: *
                     11: ****/
                     12: 
                     13: #ifndef _INC_STDIO
                     14: 
                     15: #ifdef __cplusplus
                     16: extern "C" {
                     17: #endif
                     18: 
                     19: 
1.1.1.3   root       20: /*
                     21:  * Conditional macro definition for function calling type and variable type
                     22:  * qualifiers.
                     23:  */
                     24: #if   ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
                     25: 
                     26: /*
                     27:  * Definitions for MS C8-32 (386/486) compiler
                     28:  */
                     29: #define _CRTAPI1 __cdecl
                     30: #define _CRTAPI2 __cdecl
                     31: 
                     32: #else
                     33: 
                     34: /*
                     35:  * Other compilers (e.g., MIPS)
                     36:  */
                     37: #define _CRTAPI1
                     38: #define _CRTAPI2
                     39: 
1.1.1.2   root       40: #endif
1.1       root       41: 
1.1.1.3   root       42: 
1.1       root       43: #ifndef _SIZE_T_DEFINED
                     44: typedef unsigned int size_t;
                     45: #define _SIZE_T_DEFINED
                     46: #endif
                     47: 
1.1.1.2   root       48: #ifndef _WCHAR_T_DEFINED
                     49: typedef unsigned short wchar_t;
                     50: #define _WCHAR_T_DEFINED
                     51: #endif
                     52: 
1.1.1.4 ! root       53: #ifndef _WCTYPE_T_DEFINED
        !            54: typedef wchar_t wint_t;
        !            55: typedef wchar_t wctype_t;
        !            56: #define _WCTYPE_T_DEFINED
        !            57: #endif
        !            58: 
1.1       root       59: #ifndef _VA_LIST_DEFINED
1.1.1.4 ! root       60: #if    defined(_ALPHA_)
        !            61: typedef struct {
        !            62:        char *a0;       /* pointer to first homed integer argument */
        !            63:        int offset;     /* byte offset of next parameter */
        !            64: } va_list;
        !            65: #else
        !            66: typedef char * va_list;
        !            67: #endif
1.1       root       68: #define _VA_LIST_DEFINED
                     69: #endif
                     70: 
                     71: 
                     72: /* buffered I/O macros */
                     73: 
                     74: #define BUFSIZ 512
1.1.1.2   root       75: 
                     76: /*
                     77:  * Number of supported streams. _NFILE is confusing and obsolete, but
                     78:  * supported anyway for backwards compatibility.
                     79:  */
                     80: #define _NFILE     _NSTREAM_
1.1       root       81: #ifdef _MT
1.1.1.2   root       82: #define _NSTREAM_   40
1.1       root       83: #else
1.1.1.2   root       84: #define _NSTREAM_   20
1.1       root       85: #endif
1.1.1.2   root       86: 
                     87: 
1.1       root       88: #define EOF    (-1)
                     89: 
                     90: #ifndef _FILE_DEFINED
                     91: struct _iobuf {
                     92:        char *_ptr;
                     93:        int   _cnt;
                     94:        char *_base;
                     95:        int   _flag;
                     96:        int   _file;
                     97:        int   _charbuf;
                     98:        int   _bufsiz;
1.1.1.2   root       99:        char *_tmpfname;
1.1       root      100:        };
                    101: typedef struct _iobuf FILE;
                    102: #define _FILE_DEFINED
                    103: #endif
                    104: 
1.1.1.2   root      105: /* Directory where temporary files may be created. */
1.1.1.4 ! root      106: #ifdef _POSIX_
1.1.1.3   root      107: #define _P_tmpdir   "/"
1.1.1.4 ! root      108: #else
        !           109: #define _P_tmpdir   "\\"
        !           110: #endif
1.1.1.2   root      111: 
                    112: /* L_tmpnam = size of P_tmpdir
1.1.1.3   root      113:  *           + 1 (in case P_tmpdir does not end in "/")
1.1.1.2   root      114:  *           + 12 (for the filename string)
                    115:  *           + 1 (for the null terminator)
1.1       root      116:  */
1.1.1.2   root      117: #define L_tmpnam sizeof(_P_tmpdir)+12
1.1       root      118: 
                    119: 
1.1.1.3   root      120: #ifdef _POSIX_
                    121: #define L_ctermid   9
1.1.1.4 ! root      122: #define L_cuserid   32
1.1.1.3   root      123: #endif
                    124: 
1.1       root      125: #define SEEK_CUR 1
                    126: #define SEEK_END 2
                    127: #define SEEK_SET 0
                    128: 
1.1.1.4 ! root      129: #define FILENAME_MAX   260
        !           130: #define FOPEN_MAX      20
        !           131: #define _SYS_OPEN      20
        !           132: #define TMP_MAX        32767
1.1       root      133: 
                    134: 
                    135: /* define NULL pointer value */
                    136: 
                    137: #ifndef NULL
                    138: #ifdef __cplusplus
                    139: #define NULL   0
                    140: #else
                    141: #define NULL   ((void *)0)
                    142: #endif
                    143: #endif
                    144: 
                    145: 
                    146: /* declare _iob[] array */
                    147: 
                    148: #ifndef _STDIO_DEFINED
1.1.1.2   root      149: #ifdef _DLL
                    150: extern FILE * _iob;
                    151: #else
1.1       root      152: extern FILE _iob[];
                    153: #endif
1.1.1.2   root      154: #endif
1.1       root      155: 
                    156: 
                    157: /* define file position type */
                    158: 
                    159: #ifndef _FPOS_T_DEFINED
                    160: typedef long fpos_t;
                    161: #define _FPOS_T_DEFINED
                    162: #endif
                    163: 
                    164: 
                    165: #define stdin  (&_iob[0])
                    166: #define stdout (&_iob[1])
                    167: #define stderr (&_iob[2])
                    168: 
                    169: 
                    170: #define _IOREAD        0x0001
                    171: #define _IOWRT         0x0002
                    172: 
                    173: #define _IOFBF         0x0000
                    174: #define _IOLBF         0x0040
                    175: #define _IONBF         0x0004
                    176: 
                    177: #define _IOMYBUF       0x0008
                    178: #define _IOEOF         0x0010
                    179: #define _IOERR         0x0020
                    180: #define _IOSTRG        0x0040
                    181: #define _IORW          0x0080
1.1.1.2   root      182: #ifdef _POSIX_
1.1.1.4 ! root      183: #define        _IOAPPEND       0x0200
1.1.1.2   root      184: #endif
1.1       root      185: 
                    186: /* function prototypes */
                    187: 
                    188: #ifndef _STDIO_DEFINED
1.1.1.3   root      189: int _CRTAPI1 _filbuf(FILE *);
                    190: int _CRTAPI1 _flsbuf(int, FILE *);
1.1.1.2   root      191: 
                    192: #ifdef _POSIX_
1.1.1.3   root      193: FILE * _CRTAPI1 _fsopen(const char *, const char *);
1.1.1.2   root      194: #else
1.1.1.3   root      195: FILE * _CRTAPI1 _fsopen(const char *, const char *, int);
1.1.1.2   root      196: #endif
                    197: 
1.1.1.3   root      198: void _CRTAPI1 clearerr(FILE *);
                    199: int _CRTAPI1 fclose(FILE *);
                    200: int _CRTAPI1 _fcloseall(void);
1.1.1.2   root      201: #ifdef _POSIX_
1.1.1.3   root      202: FILE * _CRTAPI1 fdopen(int, const char *);
1.1.1.2   root      203: #else
1.1.1.3   root      204: FILE * _CRTAPI1 _fdopen(int, const char *);
1.1.1.2   root      205: #endif
1.1.1.3   root      206: int _CRTAPI1 feof(FILE *);
                    207: int _CRTAPI1 ferror(FILE *);
                    208: int _CRTAPI1 fflush(FILE *);
                    209: int _CRTAPI1 fgetc(FILE *);
                    210: int _CRTAPI1 _fgetchar(void);
                    211: int _CRTAPI1 fgetpos(FILE *, fpos_t *);
                    212: char * _CRTAPI1 fgets(char *, int, FILE *);
1.1.1.2   root      213: #ifdef _POSIX_
1.1.1.3   root      214: int _CRTAPI1 fileno(FILE *);
1.1.1.2   root      215: #else
1.1.1.3   root      216: int _CRTAPI1 _fileno(FILE *);
1.1.1.2   root      217: #endif
1.1.1.3   root      218: int _CRTAPI1 _flushall(void);
                    219: FILE * _CRTAPI1 fopen(const char *, const char *);
                    220: int _CRTAPI2 fprintf(FILE *, const char *, ...);
                    221: int _CRTAPI1 fputc(int, FILE *);
                    222: int _CRTAPI1 _fputchar(int);
                    223: int _CRTAPI1 fputs(const char *, FILE *);
                    224: size_t _CRTAPI1 fread(void *, size_t, size_t, FILE *);
                    225: FILE * _CRTAPI1 freopen(const char *, const char *, FILE *);
                    226: int _CRTAPI2 fscanf(FILE *, const char *, ...);
                    227: int _CRTAPI1 fsetpos(FILE *, const fpos_t *);
                    228: int _CRTAPI1 fseek(FILE *, long, int);
                    229: long _CRTAPI1 ftell(FILE *);
                    230: size_t _CRTAPI1 fwrite(const void *, size_t, size_t, FILE *);
                    231: int _CRTAPI1 getc(FILE *);
                    232: int _CRTAPI1 getchar(void);
                    233: char * _CRTAPI1 gets(char *);
                    234: int _CRTAPI1 _getw(FILE *);
                    235: void _CRTAPI1 perror(const char *);
                    236: int _CRTAPI1 _pclose(FILE *);
                    237: FILE * _CRTAPI1 _popen(const char *, const char *);
                    238: int _CRTAPI2 printf(const char *, ...);
                    239: int _CRTAPI1 putc(int, FILE *);
                    240: int _CRTAPI1 putchar(int);
                    241: int _CRTAPI1 puts(const char *);
                    242: int _CRTAPI1 _putw(int, FILE *);
                    243: int _CRTAPI1 remove(const char *);
                    244: int _CRTAPI1 rename(const char *, const char *);
                    245: void _CRTAPI1 rewind(FILE *);
                    246: int _CRTAPI1 _rmtmp(void);
                    247: int _CRTAPI2 scanf(const char *, ...);
                    248: void _CRTAPI1 setbuf(FILE *, char *);
                    249: int _CRTAPI1 setvbuf(FILE *, char *, int, size_t);
                    250: int _CRTAPI2 _snprintf(char *, size_t, const char *, ...);
                    251: int _CRTAPI2 sprintf(char *, const char *, ...);
                    252: int _CRTAPI2 sscanf(const char *, const char *, ...);
                    253: char * _CRTAPI1 _tempnam(char *, char *);
                    254: FILE * _CRTAPI1 tmpfile(void);
                    255: char * _CRTAPI1 tmpnam(char *);
                    256: int _CRTAPI1 ungetc(int, FILE *);
                    257: int _CRTAPI1 _unlink(const char *);
                    258: int _CRTAPI1 vfprintf(FILE *, const char *, va_list);
                    259: int _CRTAPI1 vprintf(const char *, va_list);
                    260: int _CRTAPI1 _vsnprintf(char *, size_t, const char *, va_list);
                    261: int _CRTAPI1 vsprintf(char *, const char *, va_list);
1.1.1.4 ! root      262: 
        !           263: #if    !__STDC__
1.1.1.2   root      264: #ifndef _WSTDIO_DEFINED
1.1.1.4 ! root      265: 
1.1.1.2   root      266: /* declared in wchar.h, officially */
1.1.1.4 ! root      267: wint_t _CRTAPI1 fgetwc(FILE *);
        !           268: wint_t _CRTAPI1 _fgetwchar(void);
        !           269: wint_t _CRTAPI1 fputwc(wint_t, FILE *);
        !           270: wint_t _CRTAPI1 _fputwchar(wint_t);
        !           271: wint_t _CRTAPI1 getwc(FILE *);
        !           272: wint_t _CRTAPI1 getwchar(void);
        !           273: wint_t _CRTAPI1 putwc(wint_t, FILE *);
        !           274: wint_t _CRTAPI1 putwchar(wint_t);
        !           275: wint_t _CRTAPI1 ungetwc(wint_t, FILE *);
        !           276: 
1.1.1.3   root      277: int _CRTAPI2 fwprintf(FILE *, const wchar_t *, ...);
                    278: int _CRTAPI2 wprintf(const wchar_t *, ...);
                    279: int _CRTAPI2 _snwprintf(wchar_t *, size_t, const wchar_t *, ...);
                    280: int _CRTAPI2 swprintf(wchar_t *, const wchar_t *, ...);
                    281: int _CRTAPI1 vfwprintf(FILE *, const wchar_t *, va_list);
                    282: int _CRTAPI1 vwprintf(const wchar_t *, va_list);
                    283: int _CRTAPI1 _vsnwprintf(wchar_t *, size_t, const wchar_t *, va_list);
                    284: int _CRTAPI1 vswprintf(wchar_t *, const wchar_t *, va_list);
                    285: int _CRTAPI2 fwscanf(FILE *, const wchar_t *, ...);
                    286: int _CRTAPI2 swscanf(const wchar_t *, const wchar_t *, ...);
                    287: int _CRTAPI2 wscanf(const wchar_t *, ...);
1.1.1.4 ! root      288: 
        !           289: #define getwchar()             fgetwc(stdin)
        !           290: #define putwchar(_c)           fputwc((_c),stdout)
        !           291: #define getwc(_stm)            fgetwc(_stm)
        !           292: #define putwc(_c,_stm)         fputwc(_c,_stm)
        !           293: 
        !           294: 
1.1.1.2   root      295: #define _WSTDIO_DEFINED
                    296: #endif
                    297: #endif /* !__STDC__ */
1.1       root      298: #define _STDIO_DEFINED
                    299: #endif
                    300: 
                    301: 
                    302: /* macro definitions */
                    303: 
                    304: #define feof(_stream)    ((_stream)->_flag & _IOEOF)
                    305: #define ferror(_stream)   ((_stream)->_flag & _IOERR)
                    306: #define _fileno(_stream)  ((_stream)->_file)
                    307: #define getc(_stream)    (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ \
                    308:        : _filbuf(_stream))
                    309: #define putc(_c,_stream)  (--(_stream)->_cnt >= 0 \
                    310:        ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) :  _flsbuf((_c),(_stream)))
                    311: #define getchar()        getc(stdin)
                    312: #define putchar(_c)      putc((_c),stdout)
                    313: 
1.1.1.4 ! root      314: 
1.1       root      315: #ifdef _MT
                    316: #undef getc
                    317: #undef putc
                    318: #undef getchar
                    319: #undef putchar
                    320: #endif
                    321: 
1.1.1.2   root      322: #if !__STDC__ && !defined(_POSIX_)
1.1       root      323: /* Non-ANSI names for compatibility */
                    324: 
                    325: #define P_tmpdir  _P_tmpdir
                    326: #define SYS_OPEN  _SYS_OPEN
                    327: 
                    328: #define fcloseall _fcloseall
                    329: #define fdopen   _fdopen
                    330: #define fgetchar  _fgetchar
                    331: #define fileno   _fileno
                    332: #define flushall  _flushall
                    333: #define fputchar  _fputchar
                    334: #define getw     _getw
                    335: #define putw     _putw
                    336: #define rmtmp    _rmtmp
                    337: #define tempnam   _tempnam
                    338: #define unlink   _unlink
                    339: 
                    340: #endif /* __STDC__ */
                    341: 
                    342: #ifdef __cplusplus
                    343: }
                    344: #endif
                    345: 
                    346: #define _INC_STDIO
                    347: #endif /* _INC_STDIO */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.