Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
  2. /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
  3. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  4. #ifndef __dj_include_stdlib_h_
  5. #define __dj_include_stdlib_h_
  6.  
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10.  
  11. #ifndef __dj_ENFORCE_ANSI_FREESTANDING
  12.  
  13. #include <sys/djtypes.h>
  14. #include <dos.h>
  15.  
  16. /* Some programs think they know better... */
  17. #undef NULL
  18.  
  19. #define EXIT_FAILURE    1
  20. #define EXIT_SUCCESS    0
  21. #define MB_CUR_MAX      __dj_mb_cur_max
  22. #define NULL            0
  23. #define RAND_MAX        2147483647
  24.  
  25. extern int __dj_mb_cur_max;
  26.  
  27. typedef struct {
  28.   int quot;
  29.   int rem;
  30. } div_t;
  31.  
  32. typedef struct {
  33.   long quot;
  34.   long rem;
  35. } ldiv_t;
  36.  
  37. __DJ_size_t
  38. #undef __DJ_size_t
  39. #define __DJ_size_t
  40. __DJ_wchar_t
  41. #undef __DJ_wchar_t
  42. #define __DJ_wchar_t
  43.  
  44. void    abort(void) __attribute__((noreturn));
  45. int     abs(int _i);
  46. int     atexit(void (*_func)(void));
  47. double  atof(const char *_s);
  48. int     atoi(const char *_s);
  49. long    atol(const char *_s);
  50. void *  bsearch(const void *_key, const void *_base, size_t _nelem,
  51.                 size_t _size, int (*_cmp)(const void *_ck, const void *_ce));
  52. void *  calloc(size_t _nelem, size_t _size);
  53. div_t   div(int _numer, int _denom);
  54. void    exit(int _status) __attribute__((noreturn));
  55. void    free(void *_ptr);
  56. char *  getenv(const char *_name);
  57. long    labs(long _i);
  58. ldiv_t  ldiv(long _numer, long _denom);
  59. void *  malloc(size_t _size);
  60. int     mblen(const char *_s, size_t _n);
  61. size_t  mbstowcs(wchar_t *_wcs, const char *_s, size_t _n);
  62. int     mbtowc(wchar_t *_pwc, const char *_s, size_t _n);
  63. void    qsort(void *_base, size_t _nelem, size_t _size,
  64.               int (*_cmp)(const void *_e1, const void *_e2));
  65. int     rand(void);
  66. void *  realloc(void *_ptr, size_t _size);
  67. void    srand(unsigned _seed);
  68. double  strtod(const char *_s, char **_endptr);
  69. long    strtol(const char *_s, char **_endptr, int _base);
  70. unsigned long   strtoul(const char *_s, char **_endptr, int _base);
  71. int     system(const char *_s);
  72. size_t  wcstombs(char *_s, const wchar_t *_wcs, size_t _n);
  73. int     wctomb(char *_s, wchar_t _wchar);
  74.  
  75. #ifndef __STRICT_ANSI__
  76.  
  77. #ifndef _POSIX_SOURCE
  78.  
  79. typedef struct {
  80.   long long quot;
  81.   long long rem;
  82. } lldiv_t;
  83.  
  84. void *          alloca(size_t _size);
  85. long double     _atold(const char *_s);
  86. long long       atoll(const char *_s);
  87. void            cfree(void *_ptr);
  88. double          drand48(void);
  89. char *          ecvtbuf(double _val, int _nd, int *_dp, int *_sn, char *_bf);
  90. char *          ecvt(double _val, int _nd, int *_dp, int *_sn);
  91. double          erand48(unsigned short state[3]);
  92. char *          fcvtbuf(double _val, int _nd, int *_dp, int *_sn, char *_bf);
  93. char *          fcvt(double _val, int _nd, int *_dp, int *_sn);
  94. char *          gcvt(double _val, int _nd, char *_buf);
  95. char *          getpass(const char *_prompt);
  96. int             getlongpass(const char *_prompt, char *_buffer, int _max_len);
  97. char *          itoa(int value, char *buffer, int radix);
  98. long            jrand48(unsigned short state[3]);
  99. long long       llabs(long long _i);
  100. lldiv_t         lldiv(long long _numer, long long _denom);
  101. void            lcong48(unsigned short param[7]);
  102. unsigned long   lrand48(void);
  103. long            mrand48(void);
  104. unsigned long   nrand48(unsigned short state[3]);
  105. int             putenv(const char *_val);
  106. unsigned short *seed48(unsigned short state_seed[3]);
  107. int             setenv(const char *_var, const char *_val, int _replace);
  108. void            srand48(long seedval);
  109. int             stackavail(void);
  110. long double     _strtold(const char *_s, char **_endptr);
  111. long long       strtoll(const char *_s, char **_endptr, int _base);
  112. unsigned long long strtoull(const char *_s, char **_endptr, int _base);
  113. void            swab(const void *from, void *to, int nbytes);
  114.  
  115. #ifndef alloca
  116. #define alloca __builtin_alloca
  117. #endif
  118.  
  119. /* BSD Random Number Generator */
  120. char  * initstate (unsigned _seed, char *_arg_state, int _n);
  121. char  * setstate(char *_arg_state);
  122. long    random(void);
  123. int     srandom(int _seed);
  124.  
  125. /* These vary in expected prototype, so we just don't prototype them.
  126. void            xfree(void *_ptr);
  127. void *          xmalloc(size_t _size);
  128. void *          xrealloc(void *ptr, size_t _size);
  129. */
  130.  
  131. #define __system_redirect             0x0001 /* redirect internally */
  132. #define __system_call_cmdproc         0x0002 /* always call COMMAND/$SHELL */
  133. #define __system_use_shell            0x0004 /* use $SHELL if set */
  134. #define __system_allow_multiple_cmds  0x0008 /* allow `cmd1; cmd2; ...' */
  135. #define __system_allow_long_cmds      0x0010 /* handle commands > 126 chars  */
  136. #define __system_emulate_command      0x0020 /* try to emulate the shell */
  137. #define __system_handle_null_commands 0x1000 /* ignore cmds with no effect */
  138. #define __system_ignore_chdir         0x2000 /* make `cd' be a null command */
  139. #define __system_emulate_chdir        0x4000 /* handle `cd' internally */
  140.  
  141. extern int __system_flags;
  142.  
  143. #endif /* !_POSIX_SOURCE */
  144. #endif /* !__STRICT_ANSI__ */
  145. #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
  146.  
  147. #ifndef __dj_ENFORCE_FUNCTION_CALLS
  148. #endif /* !__dj_ENFORCE_FUNCTION_CALLS */
  149.  
  150. #ifdef __cplusplus
  151. }
  152. #endif
  153.  
  154. #endif /* !__dj_include_stdlib_h_ */
  155.