aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/include/stdlib.h
blob: 39097963dcbb1834a89d5b510faae7e04e33eae6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * stdlib.h
 *
 * Standard library functions
 *
 * Inherited from PSXSDK
 */

#ifndef _STDLIB_H
#define _STDLIB_H

#define RAND_MAX	0x7fff

/* Conversion functions (not yet implemented) */

/*
extern int atoi(char *s);
extern long atol(char *s);
extern char atob(char *s); // Is this right?
*/

// Random number functions (not yet implemented)

/*
int rand();
void srand(unsigned int seed);
*/

// Quick sort (not yet implemented)

//void qsort(void *base , int nel , int width , int (*cmp)(const void *,const void *));

// Memory allocation functions (not yet implemented, avoid using BIOS as they are reportedly buggy)

/*
#warning "malloc() family of functions NEEDS MORE TESTING"

void *malloc(int size);
void free(void *buf);
void *calloc(int number, int size);
void *realloc(void *buf , int n);
*/

int rand();
void srand(unsigned long seed);

int abs(int j);
long long strtoll(const char *nptr, char **endptr, int base);
long strtol(const char *nptr, char **endptr, int base);
long double strtold(const char *nptr, char **endptr);

// Note: these use floats internally!
double strtod(const char *nptr, char **endptr);
float strtof(const char *nptr, char **endptr);

#endif