# stdlib.h

Go to the documentation of this file.

    00001 /*
    00002  * PSP Software Development Kit - http://www.pspdev.org
    00003  * -----------------------------------------------------------------------
    00004  * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
    00005  *
    00006  * stdlib.h
    00007  *
    00008  * Copyright (c) 2002-2004 PS2DEV
    00009  * Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
    00010  * Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
    00011  * Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
    00012  *
    00013  * $Id: stdlib.h 1095 2005-09-27 21:02:16Z jim $
    00014  */
    00015
    00016 #ifndef __STDLIB_H__
    00017 #define __STDLIB_H__
    00018
    00019 #include <pspkernel.h>
    00020 #include <stddef.h>
    00021
    00022 #ifdef __cplusplus
    00023 extern "C" {
    00024 #endif
    00025
    00026
    00027 /* ensure NULL is defined. */
    00028 #ifndef NULL
    00029 #define NULL                           (void *)0
    00030 #endif
    00031
    00032
    00033 /* exit status constants. */
    00034 #define EXIT_SUCCESS                   0
    00035 #define EXIT_FAILURE                   1
    00036
    00037
    00038 /* multibyte maximum character constant. */
    00039 #define MB_CUR_MAX                     1
    00040
    00041 /* ensure div_t is defined. */
    00042 #ifndef __DIV_T_DEFINED
    00043 #define __DIV_T_DEFINED
    00044 typedef struct {
    00045   int quot;
    00046   int rem;
    00047 } div_t;
    00048 #endif // __DIV_T_DEFINED
    00049
    00050
    00051 /* ensure ldiv_t is defined. */
    00052 #ifndef __LDIV_T_DEFINED
    00053 #define __LDIV_T_DEFINED
    00054 typedef struct {
    00055   long quot;
    00056   long rem;
    00057 } ldiv_t;
    00058 #endif // __LDIV_T_DEFINED
    00059
    00060
    00061 #ifndef __STRICT_ANSI__
    00062 #ifndef __LLDIV_T_DEFINED
    00063 #define __LLDIV_T_DEFINED
    00064 typedef struct {
    00065   long long quot;
    00066   long long rem;
    00067 } lldiv_t;
    00068 #endif // __LLDIV_T_DEFINED
    00069 #endif // __STRICT_ANSI__
    00070
    00071 /* we don't check for any previously defined value. This HAS to be that. */
    00072 #define        RAND_MAX        2147483647
    00073
    00074
    00075 /* function declarations. */
    00076 void          abort(void) __attribute__ ((noreturn));
    00077 int           abs(int);
    00078 int           atexit(void (*)(void));
    00079 double        atof(const char *);
    00080 void          exit(int);
    00081 //int           atoi(const char *);
    00082 //long          atol(const char *);
    00083 //#define       atoi(x) strtol(x, NULL, 10)
    00084 //#define       atol atoi
    00085 void          *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
    00086 div_t         div(int, int);
    00087 char          *getenv(const char *);
    00088 long          labs(long);
    00089 ldiv_t        ldiv(long, long);
    00090 #ifndef __STRICT_ANSI__
    00091 long long     llabs(long long);
    00092 lldiv_t       lldiv(long long, long long);
    00093 #endif
    00094 int           rand(void);
    00095 int           setenv(const char *, const char *, int);
    00096 void          srand(unsigned int);
    00097 double        strtod(const char *, char **);
    00098 long          strtol(const char *, char **, int);
    00099 unsigned long strtoul(const char *, char **, int);
    00100 static __inline__ int atoi(const char * x) { return strtol(x, NULL, 10); }
    00101 static __inline__ long atol(const char * x) { return strtol(x, NULL, 10); }
    00102
    00103
    00104 void          qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
    00105
    00106
    00107 /* Multibyte disabled, but prototyped for C++... */
    00108 int           mblen(const char *, size_t);
    00109 size_t        mbstowcs(wchar_t *, const char *, size_t);
    00110 int           mbtowc(wchar_t *, const char *, size_t);
    00111 size_t        wcstombs(char *, const wchar_t *, size_t);
    00112 int           wctomb(char *, wchar_t);
    00113
    00114 //char          *_gcvt(double, size_t, char *);
    00115 char          *_itoa(int, char *, int);
    00116 char          *_ltoa(long, char *, int);
    00117 #ifndef __STRICT_ANSI__
    00118 char          *_lltoa(long long, char *, int);
    00119 #endif
    00120
    00121 // blah! C++ is evil.
    00122 int system (const char * string);
    00123
    00124 #ifdef __cplusplus
    00125 }
    00126
    00127 /* C++ is evil, let's defeat it... */
    00128 #define _CPP_CSTDLIB 1
    00129
    00130 #endif
    00131
    00132
    00133 #endif // __STDLIB_H__