aboutsummaryrefslogtreecommitdiff
path: root/src/lib/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/include')
-rw-r--r--src/lib/include/math.h41
-rw-r--r--src/lib/include/setjmp.h6
-rw-r--r--src/lib/include/signal.h6
-rw-r--r--src/lib/include/stdio.h6
-rw-r--r--src/lib/include/stdlib.h5
-rw-r--r--src/lib/include/time.h25
6 files changed, 52 insertions, 37 deletions
diff --git a/src/lib/include/math.h b/src/lib/include/math.h
index 64c46e7..4a23bd8 100644
--- a/src/lib/include/math.h
+++ b/src/lib/include/math.h
@@ -10,29 +10,50 @@
#define HUGE_VALF 0
#define HUGE_VALL 0
+// Float
float fabsf(float x);
- float cosf(float x);
- float sinf(float x);
- float tanf(float x);
+float cosf(float x);
+float sinf(float x);
+float tanf(float x);
- float acosf(float x);
- float asinf(float x);
+float acosf(float x);
+float asinf(float x);
float atan2f(float y, float x);
float floorf(float x);
float ceilf(float x);
float fmodf(float x, float y);
+
float sqrtf(float x);
float logf(float x);
float log2f(float x);
float log10f(float x);
float expf(float x);
float frexpf(float x, int *exp);
- float powf(float x, float y);
-
-
-
-
+float powf(float x, float y);
+
+// Double
+double fabs(double x);
+
+double cos(double x);
+double sin(double x);
+double tan(double x);
+
+double acos(double x);
+double asin(double x);
+double atan2(double y, double x);
+
+double floor(double x);
+double ceil(double x);
+double fmod(double x, double y);
+
+double sqrt(double x);
+double log(double x);
+double log2(double x);
+double log10(double x);
+double exp(double x);
+double frexp(double x, int *exp);
+double pow(double x, double y);
/* vim: set sts=0 ts=4 sw=4 tw=0 noet :*/
diff --git a/src/lib/include/setjmp.h b/src/lib/include/setjmp.h
index 7fab8c3..42df49e 100644
--- a/src/lib/include/setjmp.h
+++ b/src/lib/include/setjmp.h
@@ -3,17 +3,13 @@
// TODO
struct _jmp_buf {
- // TODO
- int a;
+ uint32_t stuff[10]; // 40 bytes
};
typedef struct _jmp_buf jmp_buf;
int setjmp(jmp_buf env);
-//int sigsetjmp(sigjmp_buf env, int savesigs);
void longjmp(jmp_buf env, int val);
-//void siglongjmp(sigjmp_buf env, int val);
-
/* vim: set sts=0 ts=4 sw=4 tw=0 noet :*/
diff --git a/src/lib/include/signal.h b/src/lib/include/signal.h
index 297db87..4b1b58f 100644
--- a/src/lib/include/signal.h
+++ b/src/lib/include/signal.h
@@ -1,8 +1,10 @@
#pragma once
-// TODO
+#include <stdatomic.h>
+
+typedef atomic_int sig_atomic_t;
-typedef int sig_atomic_t;
+// TODO
#define SIG_DFL 0 // stupid
diff --git a/src/lib/include/stdio.h b/src/lib/include/stdio.h
index 1e75270..3914a89 100644
--- a/src/lib/include/stdio.h
+++ b/src/lib/include/stdio.h
@@ -38,7 +38,7 @@ int ferror(FILE *stream);
int fileno(FILE *stream);
-size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
+size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
int fflush(FILE* f);
@@ -70,7 +70,7 @@ int fsetpos(FILE *stream, const fpos_t *pos);
#define SEEK_CUR 1
#define SEEK_END 2
-#define L_tmpnam 12
+#define L_tmpnam 128
FILE *tmpfile(void);
char *tmpnam(char *s);
@@ -79,8 +79,6 @@ int remove(const char *pathname);
-
-
int printf(const char *format, ...);
int fprintf(FILE *stream, const char *format, ...);
int dprintf(int fd, const char *format, ...);
diff --git a/src/lib/include/stdlib.h b/src/lib/include/stdlib.h
index 30da9a6..53aef80 100644
--- a/src/lib/include/stdlib.h
+++ b/src/lib/include/stdlib.h
@@ -14,9 +14,8 @@ void srand(unsigned int seed);
void abort() __attribute__((__noreturn__));
-double strtod(const char *nptr, char **endptr);
-float strtof(const char *nptr, char **endptr);
-long double strtold(const char *nptr, char **endptr);
+double strtod(const char *nptr, const char **endptr);
+float strtof(const char *nptr, const char **endptr);
char *getenv(const char *name);
diff --git a/src/lib/include/time.h b/src/lib/include/time.h
index 6529c9a..fe274bb 100644
--- a/src/lib/include/time.h
+++ b/src/lib/include/time.h
@@ -1,17 +1,20 @@
#pragma once
+#include <stdint.h>
+#include <stddef.h>
+
// TODO
struct tm {
- int tm_sec; // Seconds [0,60].
- int tm_min; // Minutes [0,59].
- int tm_hour; // Hour [0,23].
- int tm_mday; // Day of month [1,31].
- int tm_mon; // Month of year [0,11].
- int tm_year; // Years since 1900.
- int tm_wday; // Day of week [0,6] (Sunday =0).
- int tm_yday; // Day of year [0,365].
- int tm_isdst; // Daylight Savings flag.
+ int tm_sec; // Seconds [0,60].
+ int tm_min; // Minutes [0,59].
+ int tm_hour; // Hour [0,23].
+ int tm_mday; // Day of month [1,31].
+ int tm_mon; // Month of year [0,11].
+ int tm_year; // Years since 1900.
+ int tm_wday; // Day of week [0,6] (Sunday =0).
+ int tm_yday; // Day of year [0,365].
+ int tm_isdst; // Daylight Savings flag.
};
typedef int64_t time_t;
@@ -20,16 +23,12 @@ time_t time(time_t*);
double difftime(time_t time1, time_t time0);
char *asctime(const struct tm *tm);
-char *asctime_r(const struct tm *tm, char *buf);
char *ctime(const time_t *timep);
-char *ctime_r(const time_t *timep, char *buf);
struct tm *gmtime(const time_t *timep);
-struct tm *gmtime_r(const time_t *timep, struct tm *result);
struct tm *localtime(const time_t *timep);
-struct tm *localtime_r(const time_t *timep, struct tm *result);
time_t mktime(struct tm *tm);