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