aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/include/stdlib.h
blob: de3ab47658fdbee75f78231ee28ce6e535a30a01 (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
58
59
60
61
62
/*
 * 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?
*/

// Quick sort (not yet implemented)

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

#ifdef __cplusplus
extern "C" {
#endif

extern int __argc;
extern const char **__argv;

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

int abs(int j);
long labs(long i);
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);
// BIOS temporary
int atoi(const char *s);
long atol(const char *s);

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

// Memory allocation functions
unsigned int *GetBSSend();
void InitHeap(unsigned int *addr, int size);
int SetHeapSize(int size);
void *malloc(int size);
void *calloc(int number, int size);
void free(void *ptr);

#ifdef __cplusplus
}
#endif

#endif