home *** CD-ROM | disk | FTP | other *** search
/ ANews 3 / AnewsCD3.iso / DP / Programmation / GCC / gcc_include / stdlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-08  |  1.5 KB  |  52 lines

  1. /*    standard library for ansic.library        */
  2. /*    (c)Copyright 1992 Davide Pasetto         */
  3.  
  4. #ifndef    _STDLIB_H
  5. #define _STDLIB_H
  6.  
  7. #include    <limits.h>
  8. #include    <stddef.h>
  9.  
  10. #ifdef    __cplusplus
  11. extern "C" {
  12. #endif
  13.  
  14. extern    double        atof(const char *);
  15. extern    int        atoi(const char *);
  16. extern    long        atol(const char *);
  17. extern    int        rand(void);
  18. extern    void        srand(unsigned int);
  19. extern    void        *calloc(size_t, size_t);
  20. extern    int        system(const char *);
  21. extern    char        *getenv(const char *);
  22. extern    void        qsort(void *, size_t, size_t, int (*)(const void *, const void *));
  23. extern    long const    labs(long);
  24. extern    div_t const    div(int, int);
  25. extern    ldiv_t const    ldiv(long, long);
  26. extern    int        atexit(void (*)(void));
  27. extern    void volatile    abort(void);
  28. extern    void volatile    exit(int);
  29. extern    void volatile    _exit(int);
  30. extern    void        *malloc(size_t);
  31. extern    void        *realloc(void *, size_t);
  32. extern    void        free(void*);
  33.  
  34. #ifdef    __cplusplus
  35. }
  36. #endif
  37.  
  38. #define RAND_MAX        INT_MAX
  39.  
  40. #ifdef  TARGET_CHECK_STACK
  41. #define alloca(x)      ({ extern unsigned long __Stack_Limit; \
  42.                          register unsigned long z asm ("d0"),y=x;  \
  43.                          asm volatile ( "move.l a7,%0\n\tsub.l ___Stack_Limit,%0\n\tsub.l %2,%0\n\tbgt 0f\n\tmove.l d0,-(a7)\n\tmove.l %2,-(a7)\n\tjsr ___Stack_Overflow\n\tadda.w #4,a7\n0:" :  \
  44.                            "=g" (z) : "0" (z) , "g" (y) );         \
  45.                          __builtin_alloca(y);                      \
  46.                        })
  47. #else
  48. #define    alloca(x)        __builtin_alloca(x)
  49. #endif
  50.  
  51. #endif    /* _STDLIB_H */
  52.