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

1.1       root        1: /***
                      2: *stdlib.h - declarations/definitions for commonly used library functions
                      3: *
1.1.1.2 ! root        4: *      Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved.
1.1       root        5: *
                      6: *Purpose:
                      7: *      This include file contains the function declarations for
                      8: *      commonly used library functions which either don't fit somewhere
                      9: *      else, or, like toupper/tolower, can't be declared in the normal
                     10: *      place for other reasons.
                     11: *      [ANSI]
                     12: *
                     13: ****/
                     14: 
                     15: #ifndef _INC_STDLIB
                     16: 
                     17: #ifdef __cplusplus
                     18: extern "C" {
                     19: #endif
                     20: 
                     21: 
1.1.1.2 ! root       22: #ifndef MIPS
1.1       root       23: #if (_MSC_VER <= 600)
                     24: #define __cdecl _cdecl
                     25: #endif
1.1.1.2 ! root       26: #endif
1.1       root       27: 
                     28: #ifndef _SIZE_T_DEFINED
                     29: typedef unsigned int size_t;
                     30: #define _SIZE_T_DEFINED
                     31: #endif
                     32: 
                     33: 
                     34: #ifndef _WCHAR_T_DEFINED
                     35: typedef unsigned short wchar_t;
                     36: #define _WCHAR_T_DEFINED
                     37: #endif
                     38: 
                     39: 
                     40: /* define NULL pointer value */
                     41: 
                     42: #ifndef NULL
                     43: #ifdef __cplusplus
                     44: #define NULL   0
                     45: #else
                     46: #define NULL   ((void *)0)
                     47: #endif
                     48: #endif
                     49: 
                     50: 
                     51: /* definition of the return type for the onexit() function */
                     52: 
                     53: #define EXIT_SUCCESS   0
                     54: #define EXIT_FAILURE   1
                     55: 
                     56: 
                     57: #ifndef _ONEXIT_T_DEFINED
                     58: typedef int (* _onexit_t)(void);
                     59: #if !__STDC__
                     60: /* Non-ANSI name for compatibility */
                     61: #define onexit_t _onexit_t
                     62: #endif
                     63: #define _ONEXIT_T_DEFINED
                     64: #endif
                     65: 
                     66: 
                     67: /* Data structure definitions for div and ldiv runtimes. */
                     68: 
                     69: #ifndef _DIV_T_DEFINED
                     70: 
                     71: typedef struct _div_t {
                     72:        int quot;
                     73:        int rem;
                     74: } div_t;
                     75: 
                     76: typedef struct _ldiv_t {
                     77:        long quot;
                     78:        long rem;
                     79: } ldiv_t;
                     80: 
                     81: #define _DIV_T_DEFINED
                     82: #endif
                     83: 
                     84: /* Maximum value that can be returned by the rand function. */
                     85: 
                     86: #define RAND_MAX 0x7fff
                     87: 
1.1.1.2 ! root       88: /* max mb-len for current locale */
        !            89: #ifdef _DLL
        !            90: #define __mb_cur_max   (*__mb_cur_max_dll)
        !            91: #define MB_CUR_MAX     (*__mb_cur_max_dll)
        !            92: extern unsigned short *__mb_cur_max_dll;
        !            93: #else
        !            94: #define MB_CUR_MAX __mb_cur_max
        !            95: extern unsigned short __mb_cur_max;
        !            96: #endif
1.1       root       97: 
                     98: /* min and max macros */
                     99: 
                    100: #define __max(a,b)     (((a) > (b)) ? (a) : (b))
                    101: #define __min(a,b)     (((a) < (b)) ? (a) : (b))
                    102: 
                    103: 
                    104: /* sizes for buffers used by the _makepath() and _splitpath() functions.
                    105:  * note that the sizes include space for 0-terminator
                    106:  */
                    107: 
                    108: #define _MAX_PATH      260     /* max. length of full pathname */
                    109: #define _MAX_DRIVE     3       /* max. length of drive component */
                    110: #define _MAX_DIR       256     /* max. length of path component */
                    111: #define _MAX_FNAME     256     /* max. length of file name component */
                    112: #define _MAX_EXT       256     /* max. length of extension component */
                    113: 
                    114: /* constants for _seterrormode() */
                    115: #define _CRIT_ERROR_PROMPT  0
                    116: #define _CRIT_ERROR_FAIL    1
                    117: 
                    118: /* constants for _sleep() */
                    119: #define _SLEEP_MINIMUM 0
                    120: #define _SLEEP_FOREVER -1
                    121: 
                    122: /* external variable declarations */
                    123: 
                    124: #ifdef _MT
                    125: extern int * _errno(void);
                    126: extern unsigned long * __doserrno(void);
                    127: #define errno      (*_errno())
                    128: #define _doserrno   (*__doserrno())
                    129: #else  /* ndef _MT */
                    130: extern int errno;                      /* XENIX style error number */
                    131: extern unsigned long _doserrno;        /* OS system error value */
                    132: #endif /* _MT */
1.1.1.2 ! root      133: 
        !           134: #ifdef _DLL
        !           135: 
        !           136: extern char ** _sys_errlist;   /* perror error message table */
        !           137: 
        !           138: #define _sys_nerr   (*_sys_nerr_dll)
        !           139: #define _environ    (*_environ_dll)
        !           140: #define _fmode     (*_fmode_dll)
        !           141: #define _fileinfo   (*_fileinfo_dll)
        !           142: 
        !           143: extern int * _sys_nerr_dll;    /* # of entries in sys_errlist table */
        !           144: extern char *** _environ_dll;  /* pointer to environment table */
        !           145: extern int * _fmode_dll;       /* default file translation mode */
        !           146: extern int * _fileinfo_dll;    /* open file info mode (for spawn) */
        !           147: 
        !           148: /* DOS major/minor version numbers */
        !           149: 
        !           150: #define _osmajor    (*_osmajor_dll)
        !           151: #define _osminor    (*_osminor_dll)
        !           152: 
        !           153: extern unsigned int * _osmajor_dll;
        !           154: extern unsigned int * _osminor_dll;
        !           155: 
        !           156: #else
        !           157: 
        !           158: 
1.1       root      159: extern char * _sys_errlist[]; /* perror error message table */
                    160: extern int _sys_nerr;  /* # of entries in sys_errlist table */
                    161: 
1.1.1.2 ! root      162: #ifdef _POSIX_
        !           163: extern char ** environ;        /* pointer to environment table */
        !           164: #else
1.1       root      165: extern char ** _environ;       /* pointer to environment table */
1.1.1.2 ! root      166: #endif
        !           167: 
1.1       root      168: extern int _fmode;             /* default file translation mode */
                    169: extern int _fileinfo;  /* open file info mode (for spawn) */
                    170: 
                    171: /* DOS major/minor version numbers */
                    172: 
                    173: extern unsigned int _osmajor;
                    174: extern unsigned int _osminor;
                    175: 
1.1.1.2 ! root      176: #endif
        !           177: 
        !           178: 
1.1       root      179: /* OS API mode */
                    180: 
                    181: #define _DOS_MODE      0       /* DOS */
                    182: #define _OS2_MODE      1       /* OS/2 */
                    183: #define _WIN_MODE      2       /* Windows */
                    184: #define _OS2_20_MODE   3       /* OS/2 2.0 */
                    185: #define _DOSX32_MODE   4       /* DOSX32 */
1.1.1.2 ! root      186: #define _POSIX_MODE_   5       /* POSIX */
1.1       root      187: 
1.1.1.2 ! root      188: #ifdef _DLL
        !           189: #define _osmode     (*_osmode_dll)
        !           190: extern unsigned char * _osmode_dll;
        !           191: #else
1.1       root      192: extern unsigned char _osmode;
1.1.1.2 ! root      193: #endif
1.1       root      194: 
                    195: /* CPU addressing mode */
                    196: 
                    197: #define _REAL_MODE     0       /* real mode */
                    198: #define _PROT_MODE     1       /* protect mode */
                    199: #define _FLAT_MODE     2       /* flat mode */
                    200: 
1.1.1.2 ! root      201: #ifdef _DLL
        !           202: #define _cpumode    (*_cpumode_dll)
        !           203: extern unsigned char * _cpumode_dll;
        !           204: #else
1.1       root      205: extern unsigned char _cpumode;
1.1.1.2 ! root      206: #endif
1.1       root      207: 
                    208: /* function prototypes */
                    209: 
                    210: void   abort(void);
                    211: int    abs(int);
                    212: int    atexit(void (*)(void));
                    213: double atof(const char *);
                    214: int    atoi(const char *);
                    215: long   atol(const char *);
                    216: void * bsearch(const void *, const void *, size_t, size_t,
                    217:        int (*)(const void *, const void *));
                    218: void * calloc(size_t, size_t);
                    219: div_t  div(int, int);
                    220: void   exit(int);
1.1.1.2 ! root      221: void   free(void *);
        !           222: char * getenv(const char *);
        !           223: long   labs(long);
        !           224: ldiv_t ldiv(long, long);
        !           225: void * malloc(size_t);
        !           226: void   qsort(void *, size_t, size_t, int (*)
        !           227:        (const void *, const void *));
        !           228: int    rand(void);
        !           229: void * realloc(void *, size_t);
        !           230: void   srand(unsigned int);
        !           231: double strtod(const char *, char **);
        !           232: long   strtol(const char *, char **, int);
        !           233: unsigned long strtoul(const char *, char **, int);
        !           234: int    system(const char *);
        !           235: int    wctomb(char *, wchar_t);
        !           236: size_t wcstombs(char *, const wchar_t *, size_t);
        !           237: 
        !           238: #ifndef _POSIX_
        !           239: #if defined(i386)
        !           240: long double _atold(const char *);
        !           241: #endif
        !           242: char * _ecvt(double, int, int *, int *);
1.1       root      243: void   _exit(int);
                    244: char * _fcvt(double, int, int *, int *);
                    245: char * _fullpath(char *, const char *, size_t);
                    246: char * _gcvt(double, int, char *);
                    247: char * _itoa(int, char *, int);
                    248: unsigned long _lrotl(unsigned long, int);
                    249: unsigned long _lrotr(unsigned long, int);
                    250: char * _ltoa(long, char *, int);
                    251: void   _makepath(char *, const char *, const char *, const char *,
                    252:        const char *);
                    253: _onexit_t _onexit(_onexit_t);
                    254: void   perror(const char *);
                    255: int    _putenv(const char *);
                    256: unsigned int _rotl(unsigned int, int);
                    257: unsigned int _rotr(unsigned int, int);
                    258: void   _searchenv(const char *, const char *, char *);
                    259: void   _splitpath(const char *, char *, char *, char *, char *);
                    260: void   _swab(char *, char *, int);
                    261: char * _ultoa(unsigned long, char *, int);
                    262: int    mblen(const char *, size_t);
                    263: int    mbtowc(wchar_t *, const char *, size_t);
                    264: size_t mbstowcs(wchar_t *, const char *, size_t);
                    265: void _seterrormode(int);
                    266: void _beep(unsigned, unsigned);
                    267: void _sleep(unsigned long);
1.1.1.2 ! root      268: #endif
1.1       root      269: 
                    270: #ifndef tolower        /* tolower has been undefined - use function */
                    271: int tolower(int);
                    272: #endif /* tolower */
                    273: 
                    274: #ifndef toupper        /* toupper has been undefined - use function */
                    275: int toupper(int);
                    276: #endif /* toupper */
                    277: 
1.1.1.2 ! root      278: #if (!__STDC__ && !defined(_POSIX_))
1.1       root      279: /* Non-ANSI names for compatibility */
                    280: 
                    281: #ifndef __cplusplus
                    282: #define max(a,b)       (((a) > (b)) ? (a) : (b))
                    283: #define min(a,b)       (((a) < (b)) ? (a) : (b))
                    284: #endif
                    285: 
                    286: #define sys_errlist _sys_errlist
                    287: #define sys_nerr    _sys_nerr
                    288: #define environ     _environ
                    289: 
                    290: #define DOS_MODE    _DOS_MODE
                    291: #define OS2_MODE    _OS2_MODE
                    292: 
                    293: #define ecvt       _ecvt
                    294: #define fcvt       _fcvt
                    295: #define gcvt       _gcvt
                    296: #define itoa       _itoa
                    297: #define ltoa       _ltoa
                    298: #define onexit     _onexit
                    299: #define putenv     _putenv
                    300: #define swab       _swab
                    301: #define ultoa      _ultoa
                    302: 
1.1.1.2 ! root      303: #endif /* !__STDC__ && !_POSIX_ */
1.1       root      304: 
                    305: #ifdef __cplusplus
                    306: }
                    307: #endif
                    308: 
                    309: #define _INC_STDLIB
                    310: #endif /* _INC_STDLIB */

unix.superglobalmegacorp.com

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