Changeset 1693


Ignore:
Timestamp:
Dec 3, 2004, 5:44:50 AM (21 years ago)
Author:
bird
Message:

BSD cleanup. rand() and stuff.

Location:
trunk/src/emx/include
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/InnoTekLIBC/thread.h

    • Property cvs2svn:cvs-rev changed from 1.10 to 1.11
    r1692 r1693  
    104104    /** The nesting depth of the default logger. */
    105105    unsigned        cDefLoggerDepth;
    106     /** Current rand() seed value. */
    107     unsigned int    iRand;
    108106    /** Buffer used by asctime() and indirectly by ctime() . (Adds two 2 bytes for padding). */
    109107    char            szAscTimeAndCTimeBuf[26+2];
  • trunk/src/emx/include/alloca.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1692 r1693  
    1010#include <stddef.h>
    1111
    12 #undef alloca
    13 
    1412__BEGIN_DECLS
    15 void *alloca(size_t);
     13#if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
     14#undef  alloca  /* some GNU bits try to get cute and define this on their own */
     15#define alloca(sz) __builtin_alloca(sz)
     16#elif defined(lint)
     17void    *alloca(size_t);
     18#endif
    1619__END_DECLS
    1720
    18 #if !defined (alloca)
    19 #define alloca(x) __builtin_alloca(x)
    20 #endif
    2121
    2222#endif /* not _ALLOCA_H */
  • trunk/src/emx/include/emx/io.h

    • Property cvs2svn:cvs-rev changed from 1.12 to 1.13
    r1692 r1693  
    77#include <sys/types.h>
    88#include <InnoTekLIBC/fork.h>
     9#include <alloca.h>
    910
    1011__BEGIN_DECLS
     
    163164#define _endbuf(s) (tbuf (s) ? _endbuf1 (s) : 0)
    164165
    165 #define alloca(x) __builtin_alloca(x)
    166 
    167166struct streamvec
    168167{
  • trunk/src/emx/include/math.h

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r1692 r1693  
    143143
    144144double atof (__const__ char *);
    145 
    146 #if !defined (_ABS_DECLARED) && !defined(_LABS_DECLARED)    /* see also stdlib.h */
    147 #define _ABS_DECLARED
    148 #define _LABS_DECLARED
    149 #if !defined (__GNUC__) || __GNUC__ >= 2
    150 extern int abs (int);
    151 extern long labs (long);
    152 #else
    153 extern __inline__ int abs (int _n) { return (_n < 0 ? -_n : _n); }
    154 extern __inline__ long labs (long _n) { return (_n < 0 ? -_n : _n); }
    155 #endif
    156 #endif
    157145
    158146#endif
  • trunk/src/emx/include/stdlib.h

    • Property cvs2svn:cvs-rev changed from 1.28 to 1.29
    r1692 r1693  
    11/* stdlib.h,v 1.24 2004/09/14 22:27:36 bird Exp */
    22/** @file
    3  * FreeBSD 5.1
     3 * FreeBSD 5.3
    44 * @changed bird: EMXifications and OS2ifications.
    55 */
     
    3838 *
    3939 *      @(#)stdlib.h    8.5 (Berkeley) 5/19/95
    40  * $FreeBSD: src/include/stdlib.h,v 1.48 2003/03/12 20:29:58 das Exp $
     40 * $FreeBSD: src/include/stdlib.h,v 1.56 2004/02/23 03:16:58 ache Exp $
    4141 */
    4242
     
    4545
    4646#include <sys/cdefs.h>
     47#include <sys/_null.h>
    4748#include <sys/_types.h>
    4849
     
    7879} ldiv_t;
    7980
    80 #ifndef NULL
    81 #define NULL    0
    82 #endif
    83 
    8481#define EXIT_FAILURE    1
    8582#define EXIT_SUCCESS    0
    8683
    87 #define RAND_MAX        0x7fff /* bird: emx, old value 0x7fffffff */
     84#define RAND_MAX        0x7fffffff
    8885
    8986extern int _mb_cur_max;                 /* bird: one underscore, not two for us. */
     
    9289__BEGIN_DECLS
    9390void     abort(void) __dead2;
    94 #ifndef _ABS_DECLARED                   /* bird: emx, also math.h */
    9591int      abs(int) __pure2;
    96 #if !defined (__GNUC__) || __GNUC__ >= 2
    97 extern __inline__ int abs(int _n) { return (_n < 0 ? -_n : _n); }
    98 #endif
    99 #define _ABS_DECLARED
    100 #endif
    10192int      atexit(void (*)(void));
    10293double   atof(const char *);
     
    110101void     free(void *);
    111102char    *getenv(const char *);
    112 #ifndef _LABS_DECLARED                  /* bird: emx, also math.h */
    113103long     labs(long) __pure2;
    114 #if !defined (__GNUC__) || __GNUC__ >= 2
    115 extern __inline__ long labs(long _n) { return (_n < 0 ? -_n : _n); }
    116 #endif
    117 #define _LABS_DECLARED
    118 #endif
    119104ldiv_t   ldiv(long, long) __pure2;
    120105void    *malloc(size_t);
     
    163148         llabs(long long) __pure2;
    164149/* LONGLONG */
    165 /** @todo lldiv_t        lldiv(long long, long long) __pure2; */
     150lldiv_t  lldiv(long long, long long) __pure2;
    166151/* LONGLONG */
    167152long long
     
    182167#if __POSIX_VISIBLE /* >= ??? */
    183168int      posix_memalign(void **, size_t, size_t); /* bird: we implement this. */
    184 /** @todo int    rand_r(unsigned *);    */              /* (TSF) */
     169int      rand_r(unsigned *);                    /* (TSF) */
    185170int      setenv(const char *, const char *, int);
    186171int      unsetenv(const char *);        /* bird: standard saith shall return int. */
     
    201186/* char *fcvt(double, int, int * __restrict, int * __restrict); */
    202187/* char *gcvt(double, int, int * __restrict, int * __restrict); */
    203 #ifndef _GETSUBOPT_DECLARED
    204 /** @todo int    getsubopt(char **, char *const *, char **); */
    205 #define _GETSUBOPT_DECLARED
    206 #endif
     188int      getsubopt(char **, char *const *, char **);
    207189/** @todo int    grantpt(int); */
    208190char    *initstate(unsigned long /* XSI requires u_int */, char *, long);
     
    243225            const char *);
    244226
    245 void    *alloca(size_t);                /* built-in for gcc */
     227/*
     228 * The alloca() function can't be implemented in C, and on some
     229 * platforms it can't be implemented at all as a callable function.
     230 * The GNU C compiler provides a built-in alloca() which we can use;
     231 * in all other cases, provide a prototype, mainly to pacify various
     232 * incarnations of lint.  On platforms where alloca() is not in libc,
     233 * programs which use it will fail to link when compiled with non-GNU
     234 * compilers.
     235 */
     236#if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
     237#undef  alloca  /* some GNU bits try to get cute and define this on their own */
     238#define alloca(sz) __builtin_alloca(sz)
     239#elif defined(lint)
     240void    *alloca(size_t);
     241#endif
     242
    246243/** @todo __uint32_t
    247244         arc4random(void); */
     
    263260/** @todo int    daemon(int, int); */
    264261/** @todo char  *devname(int, int); */
     262/** @todo char  *devname_r(int, int, char *, int); */
    265263int      getloadavg(double [], int);
    266264__const char *
     
    277275int      sradixsort(const unsigned char **, int, const unsigned char *,
    278276            unsigned);
    279 /** @todo void   sranddev(void); */
     277void     sranddev(void);
    280278void     srandomdev(void);
    281279
     
    285283/** @todo __uint64_t
    286284         strtouq(const char *, char **, int); */
     285
     286extern char *suboptarg;                 /* getsubopt(3) external variable */
    287287#endif /* __BSD_VISIBLE */
    288288
     
    292292#ifdef __BSD_VISIBLE
    293293char    *_getcwdux(char *, size_t);
    294 /* todo: int     _chdirux(char *); */
     294/** @todo: int     _chdirux(char *); */
    295295char    *_realrealpath(const char *, char *, size_t);
    296296#endif
     
    486486__END_DECLS
    487487
    488 /* bird: EMX/PC stuff - start */
     488/* bird: EMX/PC stuff - end */
    489489
    490490#endif /* !_STDLIB_H_ */
Note: See TracChangeset for help on using the changeset viewer.