home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / AutoPC / apcsdk10.exe / data1.cab / Emulation_Include_Files / stdlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-13  |  8.7 KB  |  292 lines

  1. /***
  2. *stdlib.h - declarations/definitions for commonly used library functions
  3. *
  4. *    Copyright (c) 1985-1997, 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. #ifndef _CRTIMP
  23. #ifdef _DLL
  24. #define _CRTIMP __declspec(dllimport)
  25. #else
  26. #define _CRTIMP
  27. #endif
  28. #endif
  29.  
  30.  
  31. #ifndef _SIZE_T_DEFINED
  32. typedef unsigned int size_t;
  33. #define _SIZE_T_DEFINED
  34. #endif
  35.  
  36.  
  37. #ifndef _WCHAR_T_DEFINED
  38. typedef unsigned short wchar_t;
  39. #define _WCHAR_T_DEFINED
  40. #endif
  41.  
  42.  
  43. /* define NULL pointer value */
  44.  
  45. #ifndef NULL
  46. #ifdef __cplusplus
  47. #define NULL    0
  48. #else
  49. #define NULL    ((void *)0)
  50. #endif
  51. #endif
  52.  
  53.  
  54. /* definition of the return type for the onexit() function */
  55.  
  56. #define EXIT_SUCCESS    0
  57. #define EXIT_FAILURE    1
  58.  
  59.  
  60. #ifndef _ONEXIT_T_DEFINED
  61. typedef int (__cdecl * _onexit_t)(void);
  62. #if !__STDC__
  63. /* Non-ANSI name for compatibility */
  64. #define onexit_t _onexit_t
  65. #endif
  66. #define _ONEXIT_T_DEFINED
  67. #endif
  68.  
  69.  
  70. /* Data structure definitions for div and ldiv runtimes. */
  71.  
  72. #ifndef _DIV_T_DEFINED
  73.  
  74. typedef struct _div_t {
  75.     int quot;
  76.     int rem;
  77. } div_t;
  78.  
  79. typedef struct _ldiv_t {
  80.     long quot;
  81.     long rem;
  82. } ldiv_t;
  83.  
  84. #define _DIV_T_DEFINED
  85. #endif
  86.  
  87. /* Maximum value that can be returned by the rand function. */
  88.  
  89. #define RAND_MAX 0x7fff
  90.  
  91. /* max mb-len for current locale */
  92.  
  93. #ifndef MB_CUR_MAX
  94. /* also defined in ctype.h */
  95. #define MB_CUR_MAX __mb_cur_max
  96. _CRTIMP extern int __mb_cur_max;
  97. #endif /* MB_CUR_MAX */
  98.  
  99. /* min and max macros */
  100.  
  101. #define __max(a,b)    (((a) > (b)) ? (a) : (b))
  102. #define __min(a,b)    (((a) < (b)) ? (a) : (b))
  103.  
  104.  
  105. /* sizes for buffers used by the _makepath() and _splitpath() functions.
  106.  * note that the sizes include space for 0-terminator
  107.  */
  108.  
  109. #define _MAX_PATH    260    /* max. length of full pathname */
  110. #define _MAX_DRIVE    3    /* max. length of drive component */
  111. #define _MAX_DIR    256    /* max. length of path component */
  112. #define _MAX_FNAME    256    /* max. length of file name component */
  113. #define _MAX_EXT    256    /* max. length of extension component */
  114.  
  115. /* external variable declarations */
  116.  
  117. #ifdef    _MT
  118. _CRTIMP int * __cdecl _errno(void);
  119. _CRTIMP unsigned long * __cdecl __doserrno(void);
  120. #define errno        (*_errno())
  121. #define _doserrno   (*__doserrno())
  122. #else    /* ndef _MT */
  123. _CRTIMP extern int errno;            /* XENIX style error number */
  124. _CRTIMP extern unsigned long _doserrno;     /* OS system error value */
  125. #endif    /* _MT */
  126.  
  127. _CRTIMP extern char * _sys_errlist[];        /* perror error message table */
  128. _CRTIMP extern int _sys_nerr;            /* # of entries in sys_errlist table */
  129.  
  130. _CRTIMP extern int __argc;        /* count of cmd line args */
  131. _CRTIMP extern char ** __argv;        /* pointer to table of cmd line args */
  132.  
  133. _CRTIMP extern char ** _environ;    /* pointer to environment table */
  134.  
  135. _CRTIMP extern int _fmode;        /* default file translation mode */
  136. _CRTIMP extern int _fileinfo;        /* open file info mode (for spawn) */
  137.  
  138. _CRTIMP extern char * _pgmptr;        /* points to the module (EXE) name */
  139.  
  140. /* Windows major/minor and O.S. version numbers */
  141.  
  142. _CRTIMP extern unsigned int _osver;
  143. _CRTIMP extern unsigned int _winver;
  144. _CRTIMP extern unsigned int _winmajor;
  145. _CRTIMP extern unsigned int _winminor;
  146.  
  147. /* function prototypes */
  148.  
  149. _CRTIMP int    __cdecl atoi(const char *);
  150. _CRTIMP long   __cdecl atol(const char *);
  151. _CRTIMP void   __cdecl free(void *);
  152. _CRTIMP char * __cdecl _itoa(int, char *, int);
  153. _CRTIMP char * __cdecl _ltoa(long, char *, int);
  154. _CRTIMP void * __cdecl malloc(size_t);
  155. _CRTIMP char * __cdecl _ultoa(unsigned long, char *, int);
  156. _CRTIMP char * __cdecl _ecvt(double, int, int *, int *);
  157. _CRTIMP char * __cdecl _fcvt(double, int, int *, int *);
  158. _CRTIMP char * __cdecl _gcvt(double, int, char *);
  159. #ifndef tolower     /* tolower has been undefined - use function */
  160. _CRTIMP int __cdecl tolower(int);
  161. #endif    /* tolower */
  162.  
  163.     int    __cdecl atexit(void (__cdecl *)(void));
  164. _CRTIMP void * __cdecl realloc(void *, size_t);
  165. _CRTIMP void   __cdecl _swab(char *, char *, int);
  166. _CRTIMP wchar_t * __cdecl _itow (int, wchar_t *, int);
  167. _CRTIMP wchar_t * __cdecl _ltow (long, wchar_t *, int);
  168. _CRTIMP ldiv_t __cdecl ldiv(long, long);
  169. unsigned long __cdecl _lrotl(unsigned long, int);
  170. unsigned long __cdecl _lrotr(unsigned long, int);
  171. _CRTIMP div_t  __cdecl div(int, int);
  172. _CRTIMP int    __cdecl rand(void);
  173. _CRTIMP void    __cdecl srand(unsigned int);
  174. unsigned int __cdecl _rotl(unsigned int, int);
  175. unsigned int __cdecl _rotr(unsigned int, int);
  176. _CRTIMP wchar_t * __cdecl _ultow (unsigned long, wchar_t *, int);
  177. _CRTIMP void    __cdecl qsort(void *, size_t, size_t, int (__cdecl *)(const void *, const void *));
  178.  
  179. #ifndef _INC_MATH
  180. long    __cdecl labs(long);
  181. #ifndef abs
  182. int    __cdecl abs(int);
  183. #endif
  184. #endif
  185.  
  186. #ifndef UNDER_CE
  187.  
  188. _CRTIMP void   __cdecl abort(void);
  189. _CRTIMP double __cdecl atof(const char *);
  190. _CRTIMP void * __cdecl bsearch(const void *, const void *, size_t, size_t,
  191.     int (__cdecl *)(const void *, const void *));
  192. _CRTIMP void * __cdecl calloc(size_t, size_t);
  193. _CRTIMP void   __cdecl exit(int);
  194. _CRTIMP char * __cdecl getenv(const char *);
  195. _CRTIMP int    __cdecl mblen(const char *, size_t);
  196. _CRTIMP size_t __cdecl _mbstrlen(const char *s);
  197. _CRTIMP int    __cdecl mbtowc(wchar_t *, const char *, size_t);
  198. _CRTIMP size_t __cdecl mbstowcs(wchar_t *, const char *, size_t);
  199. _CRTIMP double __cdecl strtod(const char *, char **);
  200. _CRTIMP long   __cdecl strtol(const char *, char **, int);
  201. _CRTIMP unsigned long __cdecl strtoul(const char *, char **, int);
  202. _CRTIMP int    __cdecl system(const char *);
  203. _CRTIMP int    __cdecl wctomb(char *, wchar_t);
  204. _CRTIMP size_t __cdecl wcstombs(char *, const wchar_t *, size_t);
  205.  
  206. #if !__STDC__
  207. #ifndef _WSTDLIB_DEFINED
  208. /* defined in wchar.h officially */
  209. _CRTIMP double __cdecl wcstod(const wchar_t *, wchar_t **);
  210. _CRTIMP long   __cdecl wcstol(const wchar_t *, wchar_t **, int);
  211. _CRTIMP unsigned long __cdecl wcstoul(const wchar_t *, wchar_t **, int);
  212. #define _WSTDLIB_DEFINED
  213. #endif
  214. #endif    /* !__STDC__ */
  215.  
  216. _CRTIMP void   __cdecl _exit(int);
  217. _CRTIMP char * __cdecl _fullpath(char *, const char *, size_t);
  218. _CRTIMP void   __cdecl _makepath(char *, const char *, const char *, const char *,
  219.     const char *);
  220.     _onexit_t __cdecl _onexit(_onexit_t);
  221. _CRTIMP void   __cdecl perror(const char *);
  222. _CRTIMP int    __cdecl _putenv(const char *);
  223. _CRTIMP void   __cdecl _searchenv(const char *, const char *, char *);
  224. _CRTIMP void   __cdecl _splitpath(const char *, char *, char *, char *, char *);
  225.  
  226. #ifndef toupper     /* toupper has been undefined - use function */
  227. _CRTIMP int __cdecl toupper(int);
  228. #endif    /* toupper */
  229.  
  230.  
  231. #ifndef __STDC__
  232. /* Non-ANSI names for compatibility */
  233.  
  234. #ifndef __cplusplus
  235. #define max(a,b)    (((a) > (b)) ? (a) : (b))
  236. #define min(a,b)    (((a) < (b)) ? (a) : (b))
  237. #endif
  238.  
  239. #define sys_errlist _sys_errlist
  240. #define sys_nerr    _sys_nerr
  241. #define environ     _environ
  242.  
  243. _CRTIMP char * __cdecl ecvt(double, int, int *, int *);
  244. _CRTIMP char * __cdecl fcvt(double, int, int *, int *);
  245. _CRTIMP char * __cdecl gcvt(double, int, char *);
  246. _CRTIMP char * __cdecl itoa(int, char *, int);
  247. _CRTIMP char * __cdecl ltoa(long, char *, int);
  248.     onexit_t __cdecl onexit(onexit_t);
  249. _CRTIMP int    __cdecl putenv(const char *);
  250. _CRTIMP void   __cdecl swab(char *, char *, int);
  251. _CRTIMP char * __cdecl ultoa(unsigned long, char *, int);
  252.  
  253. #endif    /* __STDC__ */
  254.  
  255. #else //Location for WIN32_CE prototypes since wchar.h is not available
  256.  
  257. #include <stdarg.h>
  258.  
  259. // _CRTIMP int __cdecl _snwprintf(wchar_t *, size_t, const wchar_t *, ...);
  260. _CRTIMP int __cdecl swprintf(wchar_t *, const wchar_t *, ...);
  261. _CRTIMP int __cdecl vswprintf(wchar_t *, const wchar_t *, va_list);
  262. _CRTIMP int __cdecl swscanf(const wchar_t *, const wchar_t *, ...);
  263. _CRTIMP double __cdecl wcstod(const wchar_t *, wchar_t **);
  264. _CRTIMP long   __cdecl wcstol(const wchar_t *, wchar_t **, int);
  265. _CRTIMP unsigned long __cdecl wcstoul(const wchar_t *, wchar_t **, int);
  266.  
  267. #ifdef    _MT
  268. _CRTIMP unsigned long  __cdecl _beginthread (void (__cdecl *) (void *),
  269.     unsigned, void *);
  270. _CRTIMP void __cdecl _endthread(void);
  271. _CRTIMP unsigned long __cdecl _beginthreadex(void *, unsigned,
  272.         unsigned (__stdcall *) (void *), void *, unsigned, unsigned *);
  273. _CRTIMP void __cdecl _endthreadex(unsigned);
  274. #endif
  275.  
  276. #ifndef _TIME_T_DEFINED
  277. typedef long time_t;        /* time value */
  278. #define _TIME_T_DEFINED     /* avoid multiple def's of time_t */
  279. #endif
  280.  
  281. _CRTIMP double __cdecl difftime(time_t, time_t);
  282.  
  283. #endif    /* UNDER_CE */
  284.  
  285.  
  286. #ifdef __cplusplus
  287. }
  288. #endif
  289.  
  290. #define _INC_STDLIB
  291. #endif    /* _INC_STDLIB */
  292.