From f3e040230772f978540a71aea43dfde200992922 Mon Sep 17 00:00:00 2001 From: "John Wilbert M. Villamor" Date: Sat, 6 Apr 2019 10:11:07 +0800 Subject: First commit --- libpsn00b/include/stdlib.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 libpsn00b/include/stdlib.h (limited to 'libpsn00b/include/stdlib.h') diff --git a/libpsn00b/include/stdlib.h b/libpsn00b/include/stdlib.h new file mode 100644 index 0000000..3909796 --- /dev/null +++ b/libpsn00b/include/stdlib.h @@ -0,0 +1,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 + -- cgit v1.2.3