/* * * ANSI-C Standard Library definitions */ #ifndef _STDLIB_H #define _STDLIB_H # ifdef __cplusplus extern "C" { # endif /* note: no !defined(__STDC__) handling, deliberately */ #ifndef _STDDEF_H #include /* get size_t, NULL */ #endif /* These exit macro values work with either exit() or return from main(), and avoid unnecessary warnings from the DCL command intrepretor. They don't match VAX C's , which has 0 and 2 respectively. Using 0 for success works with VAXCRTL's exit() but requires additional compiler support in main() (which VAX C neglects to provide). 2 always provokes "%NONAME-E-NOMSG, Message number 00000002"; similarly for unfixed 0. */ #define EXIT_SUCCESS 1 /* SS$_NORMAL, STS$K_SUCCESS */ #define EXIT_FAILURE 0x10000002 /* (STS$K_ERROR | STS$M_INHIB_MSG) */ #define RAND_MAX 2147483647 /* 0x7FFFFFFF */ #define lrand48() rand() #if (__GNUC__ == 2 && !__STRICT_ANSI__) #if (__GNUC_MINOR__ >= 5) void abort(void) __asm ("decc$abort") __attribute__((noreturn)); void exit(int) __asm ("decc$exit") __attribute__((noreturn)); void _exit(int) __attribute__((noreturn)); #else volatile void abort(void) __asm ("decc$abort"); volatile void exit(int) __asm ("decc$exit"); volatile void _exit(int); #endif #else void abort(void) __asm ("decc$abort"); void exit(int) __asm ("decc$exit"); void _exit(int); #endif int atexit(void (*)(void)); void *bsearch(const void *,const void *,size_t,size_t, int (*)(const void *,const void *)); void qsort(void *,size_t,size_t,int (*)(const void *,const void *)) __asm ("decc$qsort"); int rand(void); int srand(int); /* routine to initialize rand() */ char *getenv(const char *) __asm ("decc$getenv"); int system(const char *); /* math related routines */ #ifndef _DIV_T #define _DIV_T typedef struct DIV_T { int quot, rem; } div_t; #endif #ifndef _LDIV_T #define _LDIV_T typedef struct LDIV_T { long quot, rem; } ldiv_t; #endif # define ___fdecl(_func,_arglist) _func _arglist __asm("decc$" #_func) #if __IEEE_FLOAT # define ___gdecl(_func, _arglist) _func _arglist __asm("decc$t" #_func) #elif __G_FLOAT # define ___gdecl(_func, _arglist) _func _arglist __asm("decc$g" #_func) #else # error "No floating format defined" #endif int abs(int); int ___fdecl (atoi, (const char *)); long ___fdecl (atol, (const char *)); double ___gdecl (atof, (const char *)); div_t div(int,int); long labs(long); ldiv_t ldiv(long,long); double ___gdecl (strtod, (const char *,char **)); long strtol(const char *,char **,int); unsigned long strtoul(const char *,char **,int); /* memory manipulation routines; note: cfree() is gone; see also */ void * ___fdecl (malloc, (size_t)); void * ___fdecl (calloc, (size_t, size_t)); void * ___fdecl (realloc, (void *, size_t)); void ___fdecl (free, (void *)); #undef ___gdecl #undef ___fdecl # ifdef __cplusplus } # endif #endif /*_STDLIB_H*/