stdlib.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:5k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* stdlib.h - standard library header file */
  2. /* Copyright 1992-1999 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 02m,26mar01,max  Fixing a type
  7. 02l,26mar01,max  According to the AltiVec ABI, we need to introduce new
  8.                  functions for memory allocation/deallocation:
  9.                  vec_malloc, vec_calloc, vec_realloc, and vec_free.
  10.  They should be 16-byte aligned and are supposed to be used
  11.  for memory operations with AltiVec vector data.
  12. 02k,10oct00,sn   deleted size_t, wchar_t definitions
  13. 02j,17feb99,mrs  Add C++ support for NULL, (SPR #25079).
  14. 02i,15oct93,cd   added #ifndef _ASMLANGUAGE.
  15. 02h,05feb93,smb  corrected prototype for strtoul
  16. 02g,22sep92,rrr  added support for c++
  17. 02f,21sep92,smb  reordered prototype list.
  18. 02e,24jul92,smb  replaced types.
  19. 02d,24jul92,smb  added prototypes for div_r and ldiv_r
  20.  removed the ifndef for types div_t, ldiv_t and wchar_T
  21. 02c,20jul92,smb  replaced modification history.
  22. 02b,19jul92,smb  rewritten
  23. 02a,04jul92,jcf  cleaned up.
  24. 01f,26may92,rrr  the tree shuffle
  25. 01e,25nov91,llk  added ansi definitions EXIT_FAILURE, EXIT_SUCCESS, RAND_MAX,
  26.                    MB_CUR_MAX.
  27.                  included more function prototypes.  Some are commented out.
  28. 01d,04oct91,rrr  passed through the ansification filter
  29.                   -fixed #else and #endif
  30.                   -changed copyright notice
  31. 01c,10jun91.del  added pragma for gnu960 alignment.
  32. 01b,19oct90,shl  fixed typo in modhist 01a.
  33. 01a,05oct90,dnw  created based on Marc Ullman's version
  34. */
  35. #ifndef __INCstdlibh
  36. #define __INCstdlibh
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. #include "types/vxANSI.h" /* includes types div_t, ldiv_t, wchar_t */
  41. #ifndef _ASMLANGUAGE
  42. #define EXIT_FAILURE _PARM_EXIT_FAILURE
  43. #define EXIT_SUCCESS _PARM_EXIT_SUCCESS
  44. #define MB_CUR_MAX _PARM_MB_CUR_MAX
  45. #define RAND_MAX _PARM_RAND_MAX
  46. #ifndef NULL
  47. #if defined __GNUG__
  48. #define NULL (__null)
  49. #else
  50. #if !defined(__cplusplus) && 0
  51. #define NULL ((void*)0)
  52. #else
  53. #define NULL (0)
  54. #endif
  55. #endif
  56. #endif
  57. /* AltiVec ABI extension. As soon as we decided to force VxWorks
  58.    to do all memory allocations with 16-byte alignment (At least
  59.    for the EAR) we can just alias standard "malloc"-family
  60.    functions with appropriate "vec_malloc" functions.
  61. */
  62. #ifdef __VEC__ /* PowerPC AltiVec technology */
  63. #define vec_malloc(SIZE) malloc (SIZE)
  64. #define vec_calloc(N,SIZE) calloc (N,SIZE)
  65. #define vec_realloc(PTR,SIZE) realloc(PTR,SIZE)
  66. #define vec_free(PTR) free   (PTR)
  67. #endif
  68. #ifdef _TYPE_div_t
  69. _TYPE_div_t;
  70. #undef _TYPE_div_t
  71. #endif
  72. #ifdef _TYPE_ldiv_t
  73. _TYPE_ldiv_t;
  74. #undef _TYPE_ldiv_t
  75. #endif
  76. typedef struct { /* used by mblen and mbtowc */
  77. unsigned char __state;
  78. unsigned short __wchar;
  79. } _Mbsave;
  80. #if defined(__STDC__) || defined(__cplusplus)
  81. extern void abort (void);
  82. extern int abs (int __i);
  83. extern int atexit (void (*__func)(void));
  84. extern double atof (const char *__s);
  85. extern int atoi (const char *__s);
  86. extern long atol (const char *__s);
  87. extern void * bsearch (const void *__key, const void *__base,
  88.          size_t __nelem, size_t __size,
  89.          int  (*__cmp)(const void *__ck, const void *__ce));
  90. extern div_t div (int __numer, int __denom);
  91. extern long labs (long __i);
  92. extern ldiv_t ldiv (long __numer, long __denom);
  93. extern int mblen (const char *__s, size_t __n);
  94. extern size_t mbstowcs (wchar_t *__wcs, const char *__s, size_t __n);
  95. extern int mbtowc (wchar_t *__pwc, const char *__s, size_t __n);
  96. extern void qsort (void *__base, size_t __nelem, size_t __size,
  97.        int  (*__cmp)(const void *__e1, const void *__e2));
  98. extern int rand (void);
  99. extern void * srand (unsigned int __seed);
  100. extern double strtod (const char *__s, char **__endptr);
  101. extern long strtol (const char *__s, char **__endptr, int __base);
  102. extern unsigned long strtoul (const char *__s, char **__endptr, int __base);
  103. extern int system (const char *__s);
  104. extern size_t wcstombs (char *__s, const wchar_t *__wcs, size_t __n);
  105. extern int wctomb (char *__s, wchar_t __wchar);
  106. extern void * calloc (size_t __nelem, size_t __size);
  107. extern void exit (int __status);
  108. extern void free (void *__ptr);
  109. extern char * getenv (const char *__name);
  110. extern void * malloc (size_t __size);
  111. extern void * realloc (void *__ptr, size_t __size);
  112. #if _EXTENSION_WRS
  113. extern void     div_r (int numer, int denom, div_t * divStructPtr);
  114. extern void     ldiv_r (long numer, long denom, ldiv_t * divStructPtr);
  115. #endif
  116. #else   /* __STDC__ */
  117. extern void     abort ();
  118. extern int      abs ();
  119. extern int      atexit ();
  120. extern double   atof ();
  121. extern int      atoi ();
  122. extern long     atol ();
  123. extern void *   bsearch ();
  124. extern div_t    div ();
  125. extern long     labs ();
  126. extern ldiv_t   ldiv ();
  127. extern int      mblen ();
  128. extern size_t   mbstowcs ();
  129. extern int      mbtowc ();
  130. extern void     qsort ();
  131. extern int      rand ();
  132. extern void *   srand ();
  133. extern double   strtod ();
  134. extern long     strtol ();
  135. extern unsigned long strtoul ();
  136. extern int      system ();
  137. extern size_t   wcstombs ();
  138. extern int      wctomb ();
  139. extern void *   calloc ();
  140. extern void     exit ();
  141. extern void     free ();
  142. extern char *   getenv ();
  143. extern void *   malloc ();
  144. extern void *   realloc ();
  145. #if _EXTENSION_WRS
  146. extern void     div_r ();
  147. extern void     ldiv_r ();
  148. #endif
  149. #endif /* _ASMLANGUAGE */
  150. #endif  /* __STDC__ */
  151. #ifdef __cplusplus
  152. }
  153. #endif
  154. #endif /* __INCstdlibh */