aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/include/stdlib.h
diff options
context:
space:
mode:
authorJohn Wilbert M. Villamor <lameguy64@gmail.com>2019-04-06 10:11:07 +0800
committerJohn Wilbert M. Villamor <lameguy64@gmail.com>2019-04-06 10:11:07 +0800
commitf3e040230772f978540a71aea43dfde200992922 (patch)
treebd8ca31b72dd01e24980b073854e263589530f56 /libpsn00b/include/stdlib.h
downloadpsn00bsdk-f3e040230772f978540a71aea43dfde200992922.tar.gz
First commit
Diffstat (limited to 'libpsn00b/include/stdlib.h')
-rw-r--r--libpsn00b/include/stdlib.h57
1 files changed, 57 insertions, 0 deletions
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
+