6d7a8a0d0b
libc: Add very basic strtoul()
...
As well as returning NULL in getenv() instead of aborting.
2022-10-21 18:32:46 +02:00
45afd3e243
Replace the rand() which reads from /dev/random with a Mersenne PRNG.
...
Much better now.
Also, it is seeded by reading from /dev/random at startup. Not sure if that's the best idea, but we'll see.
2022-10-15 16:46:54 +02:00
18f1f8b7ca
Add VERY HACKY rand() implementation.
2022-10-15 16:31:08 +02:00
f50017912d
libc: Implement atoi(), atol() and atoll()
2022-10-15 14:02:24 +02:00
2395c7a871
libc: Implement _Exit
...
Exactly the same as _exit, but in stdlib.h instead of unistd.h
2022-10-15 14:02:10 +02:00
b0e071e964
libc: Make functions with no arguments be defined as type function(void)
...
Instead of type function().
2022-10-15 11:39:13 +02:00
8398b2e2e4
libc: Change bits/macros.h to use a __lc_ prefix for internal macros
...
That way, we don't pollute user programs with our own 'noreturn' and 'deprecated' macros
2022-10-15 09:52:37 +02:00
743aedcd49
libc: Implement atexit() and _exit()
...
exit() now calls registered handlers before calling _exit().
And initialize_libc() can now register a handler to close stdout and stderr on program termination!! :)
2022-10-12 20:41:55 +02:00
ffc223c2cf
libc: Document functions in stdlib.h
...
Also, add prototypes for calloc() and realloc(), which were already implemented but not in the header.
2022-10-12 11:30:21 +02:00
560b0a1705
libc: Rename the _ folder to bits, as used internally by libraries
2022-10-04 19:11:54 +02:00
a050ed9133
libc: add an internal macros.h header with headers to make attributes less verbose
2022-10-04 19:06:56 +02:00
fcf5923cc0
WIP: Add a C Library, let's try to compile a Hosted GCC cross-compiler using this!
2022-10-01 20:59:22 +02:00