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

1.1       root        1: /***
                      2: *stdio.h - definitions/declarations for standard I/O routines
                      3: *
1.1.1.2 ! root        4: *      Copyright (c) 1985-1992, 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.2 ! root       20: #ifndef MIPS
1.1       root       21: #if (_MSC_VER <= 600)
                     22: #define __cdecl _cdecl
                     23: #endif
1.1.1.2 ! root       24: #endif
1.1       root       25: 
                     26: #ifndef _SIZE_T_DEFINED
                     27: typedef unsigned int size_t;
                     28: #define _SIZE_T_DEFINED
                     29: #endif
                     30: 
1.1.1.2 ! root       31: #ifndef _WCHAR_T_DEFINED
        !            32: typedef unsigned short wchar_t;
        !            33: #define _WCHAR_T_DEFINED
        !            34: #endif
        !            35: 
1.1       root       36: #ifndef _VA_LIST_DEFINED
                     37: typedef char * va_list;
                     38: #define _VA_LIST_DEFINED
                     39: #endif
                     40: 
                     41: 
                     42: /* buffered I/O macros */
                     43: 
                     44: #define BUFSIZ 512
1.1.1.2 ! root       45: 
        !            46: /*
        !            47:  * Number of supported streams. _NFILE is confusing and obsolete, but
        !            48:  * supported anyway for backwards compatibility.
        !            49:  */
        !            50: #define _NFILE     _NSTREAM_
1.1       root       51: #ifdef _MT
1.1.1.2 ! root       52: #define _NSTREAM_   40
1.1       root       53: #else
1.1.1.2 ! root       54: #define _NSTREAM_   20
1.1       root       55: #endif
1.1.1.2 ! root       56: 
        !            57: 
1.1       root       58: #define EOF    (-1)
                     59: 
                     60: #ifndef _FILE_DEFINED
                     61: struct _iobuf {
                     62:        char *_ptr;
                     63:        int   _cnt;
                     64:        char *_base;
                     65:        int   _flag;
                     66:        int   _file;
                     67:        int   _charbuf;
                     68:        int   _bufsiz;
1.1.1.2 ! root       69:        char *_tmpfname;
1.1       root       70:        };
                     71: typedef struct _iobuf FILE;
                     72: #define _FILE_DEFINED
                     73: #endif
                     74: 
1.1.1.2 ! root       75: /* Directory where temporary files may be created. */
        !            76: #define _P_tmpdir "\\"
        !            77: 
        !            78: /* L_tmpnam = size of P_tmpdir
        !            79:  *           + 1 (in case P_tmpdir does not end in "\\")
        !            80:  *           + 12 (for the filename string)
        !            81:  *           + 1 (for the null terminator)
1.1       root       82:  */
1.1.1.2 ! root       83: #define L_tmpnam sizeof(_P_tmpdir)+12
1.1       root       84: 
                     85: 
                     86: #define SEEK_CUR 1
                     87: #define SEEK_END 2
                     88: #define SEEK_SET 0
                     89: 
                     90: #define FILENAME_MAX 63
                     91: #define FOPEN_MAX 20
                     92: #define _SYS_OPEN 20
                     93: #define TMP_MAX 32767
                     94: 
                     95: 
                     96: /* define NULL pointer value */
                     97: 
                     98: #ifndef NULL
                     99: #ifdef __cplusplus
                    100: #define NULL   0
                    101: #else
                    102: #define NULL   ((void *)0)
                    103: #endif
                    104: #endif
                    105: 
                    106: 
                    107: /* declare _iob[] array */
                    108: 
                    109: #ifndef _STDIO_DEFINED
1.1.1.2 ! root      110: #ifdef _DLL
        !           111: extern FILE * _iob;
        !           112: #else
1.1       root      113: extern FILE _iob[];
                    114: #endif
1.1.1.2 ! root      115: #endif
1.1       root      116: 
                    117: 
                    118: /* define file position type */
                    119: 
                    120: #ifndef _FPOS_T_DEFINED
                    121: typedef long fpos_t;
                    122: #define _FPOS_T_DEFINED
                    123: #endif
                    124: 
                    125: 
                    126: #define stdin  (&_iob[0])
                    127: #define stdout (&_iob[1])
                    128: #define stderr (&_iob[2])
                    129: 
                    130: 
                    131: #define _IOREAD        0x0001
                    132: #define _IOWRT         0x0002
                    133: 
                    134: #define _IOFBF         0x0000
                    135: #define _IOLBF         0x0040
                    136: #define _IONBF         0x0004
                    137: 
                    138: #define _IOMYBUF       0x0008
                    139: #define _IOEOF         0x0010
                    140: #define _IOERR         0x0020
                    141: #define _IOSTRG        0x0040
                    142: #define _IORW          0x0080
1.1.1.2 ! root      143: #ifdef _POSIX_
        !           144: #define        _IOAPPEND       0x0100
        !           145: #endif
1.1       root      146: 
                    147: /* function prototypes */
                    148: 
                    149: #ifndef _STDIO_DEFINED
                    150: int _filbuf(FILE *);
                    151: int _flsbuf(int, FILE *);
1.1.1.2 ! root      152: 
        !           153: #ifdef _POSIX_
        !           154: FILE * _fsopen(const char *, const char *);
        !           155: #else
1.1       root      156: FILE * _fsopen(const char *, const char *, int);
1.1.1.2 ! root      157: #endif
        !           158: 
1.1       root      159: void clearerr(FILE *);
                    160: int fclose(FILE *);
                    161: int _fcloseall(void);
1.1.1.2 ! root      162: #ifdef _POSIX_
        !           163: FILE * fdopen(int, const char *);
        !           164: #else
1.1       root      165: FILE * _fdopen(int, const char *);
1.1.1.2 ! root      166: #endif
1.1       root      167: int feof(FILE *);
                    168: int ferror(FILE *);
                    169: int fflush(FILE *);
                    170: int fgetc(FILE *);
                    171: int _fgetchar(void);
                    172: int fgetpos(FILE *, fpos_t *);
                    173: char * fgets(char *, int, FILE *);
1.1.1.2 ! root      174: #ifdef _POSIX_
        !           175: int fileno(FILE *);
        !           176: #else
1.1       root      177: int _fileno(FILE *);
1.1.1.2 ! root      178: #endif
1.1       root      179: int _flushall(void);
                    180: FILE * fopen(const char *, const char *);
                    181: int fprintf(FILE *, const char *, ...);
                    182: int fputc(int, FILE *);
                    183: int _fputchar(int);
                    184: int fputs(const char *, FILE *);
                    185: size_t fread(void *, size_t, size_t, FILE *);
                    186: FILE * freopen(const char *, const char *, FILE *);
                    187: int fscanf(FILE *, const char *, ...);
                    188: int fsetpos(FILE *, const fpos_t *);
                    189: int fseek(FILE *, long, int);
                    190: long ftell(FILE *);
                    191: size_t fwrite(const void *, size_t, size_t, FILE *);
                    192: int getc(FILE *);
                    193: int getchar(void);
                    194: char * gets(char *);
                    195: int _getw(FILE *);
                    196: void perror(const char *);
                    197: int _pclose(FILE *);
                    198: FILE * _popen(const char *, const char *);
                    199: int printf(const char *, ...);
                    200: int putc(int, FILE *);
                    201: int putchar(int);
                    202: int puts(const char *);
                    203: int _putw(int, FILE *);
                    204: int remove(const char *);
                    205: int rename(const char *, const char *);
                    206: void rewind(FILE *);
                    207: int _rmtmp(void);
                    208: int scanf(const char *, ...);
                    209: void setbuf(FILE *, char *);
                    210: int setvbuf(FILE *, char *, int, size_t);
                    211: int _snprintf(char *, size_t, const char *, ...);
                    212: int sprintf(char *, const char *, ...);
                    213: int sscanf(const char *, const char *, ...);
                    214: char * _tempnam(char *, char *);
                    215: FILE * tmpfile(void);
                    216: char * tmpnam(char *);
                    217: int ungetc(int, FILE *);
                    218: int _unlink(const char *);
                    219: int vfprintf(FILE *, const char *, va_list);
                    220: int vprintf(const char *, va_list);
                    221: int _vsnprintf(char *, size_t, const char *, va_list);
                    222: int vsprintf(char *, const char *, va_list);
1.1.1.2 ! root      223: #ifndef __STDC__
        !           224: #ifndef _WSTDIO_DEFINED
        !           225: /* declared in wchar.h, officially */
        !           226: int fwprintf(FILE *, const wchar_t *, ...);
        !           227: int wprintf(const wchar_t *, ...);
        !           228: int _snwprintf(wchar_t *, size_t, const wchar_t *, ...);
        !           229: int swprintf(wchar_t *, const wchar_t *, ...);
        !           230: int vfwprintf(FILE *, const wchar_t *, va_list);
        !           231: int vwprintf(const wchar_t *, va_list);
        !           232: int _vsnwprintf(wchar_t *, size_t, const wchar_t *, va_list);
        !           233: int vswprintf(wchar_t *, const wchar_t *, va_list);
        !           234: #define _WSTDIO_DEFINED
        !           235: #endif
        !           236: #endif /* !__STDC__ */
1.1       root      237: #define _STDIO_DEFINED
                    238: #endif
                    239: 
                    240: 
                    241: /* macro definitions */
                    242: 
                    243: #define feof(_stream)    ((_stream)->_flag & _IOEOF)
                    244: #define ferror(_stream)   ((_stream)->_flag & _IOERR)
                    245: #define _fileno(_stream)  ((_stream)->_file)
                    246: #define getc(_stream)    (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ \
                    247:        : _filbuf(_stream))
                    248: #define putc(_c,_stream)  (--(_stream)->_cnt >= 0 \
                    249:        ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) :  _flsbuf((_c),(_stream)))
                    250: #define getchar()        getc(stdin)
                    251: #define putchar(_c)      putc((_c),stdout)
                    252: 
                    253: #ifdef _MT
                    254: #undef getc
                    255: #undef putc
                    256: #undef getchar
                    257: #undef putchar
                    258: #endif
                    259: 
1.1.1.2 ! root      260: #if !__STDC__ && !defined(_POSIX_)
1.1       root      261: /* Non-ANSI names for compatibility */
                    262: 
                    263: #define P_tmpdir  _P_tmpdir
                    264: #define SYS_OPEN  _SYS_OPEN
                    265: 
                    266: #define fcloseall _fcloseall
                    267: #define fdopen   _fdopen
                    268: #define fgetchar  _fgetchar
                    269: #define fileno   _fileno
                    270: #define flushall  _flushall
                    271: #define fputchar  _fputchar
                    272: #define getw     _getw
                    273: #define putw     _putw
                    274: #define rmtmp    _rmtmp
                    275: #define tempnam   _tempnam
                    276: #define unlink   _unlink
                    277: 
                    278: #endif /* __STDC__ */
                    279: 
                    280: #ifdef __cplusplus
                    281: }
                    282: #endif
                    283: 
                    284: #define _INC_STDIO
                    285: #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.