PSXSDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
stdlib.h
Go to the documentation of this file.
1 /*
2  * stdlib.h
3  *
4  * Standard library functions
5  *
6  * PSXSDK
7  */
8 
9 #ifndef _STDLIB_H
10 #define _STDLIB_H
11 
12 typedef unsigned int size_t;
13 typedef signed int ssize_t;
14 
15 /* Conversion functions */
16 
17 int atoi(const char *s);
18 long atol(const char *s);
19 char *itoa(int value, char *str, int base);
20 char *ltoa(long value, char *str, int base);
21 char *lltoa(long long value, char *str, int base);
22 char *utoa(unsigned int value, char *str, int base);
23 char *ultoa(unsigned long value, char *str, int base);
24 char *ulltoa(unsigned long long value, char *str, int base);
25 //extern char atob(char *s); // Is this right?
26 
27 
28 // Random number functions
29 
30 #define RAND_MAX 0x7fffffff
31 
32 int rand(void);
33 void srand(unsigned int seed);
34 
35 // Quick sort
36 
37 void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
38 
39 // Memory allocation functions
40 
41 //#warning "malloc() family of functions NEEDS MORE TESTING"
42 
43 void *malloc(size_t size);
44 void free(void *buf);
45 void *calloc(size_t number, size_t size);
46 void *realloc(void *buf , size_t n);
47 
48 int abs(int x);
49 long long strtoll(const char *nptr, char **endptr, int base);
50 long strtol(const char *nptr, char **endptr, int base);
51 double strtod(const char *nptr, char **endptr);
52 long double strtold(const char *nptr, char **endptr);
53 float strtof(const char *nptr, char **endptr);
54 
55 // Misc
56 void abort(void);
57 void exit(int status);
58 void call_atexit_callbacks(void);
59 
60 // Program return codes
61 
62 #define EXIT_SUCCESS 0
63 #define EXIT_FAILURE 1
64 
65 #endif
66