Commit graph

43 commits

Author SHA1 Message Date
Lephenixnoir
f1512125d0
stdio: initial versions of fputc() and fputs() (TEST) 2022-01-13 21:21:23 +01:00
Lephenixnoir
6ec0c24e2d
stdio: ungetc(), update (+) and append (a) modes (DONE) 2022-01-12 10:20:30 +01:00
Lephenixnoir
06b66252c9
stdio: line buffering, test fgetpos and fsetpos (DONE) 2022-01-10 21:32:24 +01:00
Lephenixnoir
0c2f81e5bb
string: add and test a naive memrchr (DONE) 2022-01-10 21:21:03 +01:00
Lephenixnoir
4461bdb96a
stdio: basic fread/fwrite (WIP) 2022-01-05 21:26:06 +01:00
Lephenixnoir
b6dbdf321d
stdio: error handling and positioning functions (WIP) 2022-01-02 22:09:06 +01:00
Lephenixnoir
a12b84f1ef
stdio: opening primitives for FILE (WIP) 2022-01-02 19:22:43 +01:00
Lephenixnoir
51528170bb
stdio: FILE barebones with buffering model (WIP) 2022-01-02 19:22:42 +01:00
Lephenixnoir
92ccd8b1db
time: add support for C99 <time.h> (DONE) 2021-12-04 22:02:23 +01:00
Lephenixnoir
ea35c18c41
stdlib: add qsort (TEST) 2021-06-28 23:54:43 +02:00
Lephenixnoir
6e42995388
stdio: add general file management definitions 2021-06-13 18:18:32 +02:00
Lephenixnoir
009a2eef6e
stdlib: add TinyMT-based rand, and malloc/etc for gint 2021-06-07 22:00:41 +02:00
Lephenixnoir
cd7fe7a329
signal: simple implementation (DONE)
This version of signal (which does not rely on a notion of userland
processes and is thus excluded from Vhex) follows C99 semantics but does
not generate any signals by default.

Basically, the signal function sets up function pointers and the signal
function calls them. Termination signals call exit() while other signals
call _Exit(), which is a quicker program termination similar to abort().

C99 allows programs to long jump out of signal handlers (!) which is
unbelievably scary because it would bypass stack switching code in Vhex
as well as normal interrupt handler termination in gint.
2021-05-30 15:09:33 +02:00
Lephenixnoir
4b90740d3b
stdlib: add exit() based on target-provided _Exit()
This is implemented for gint only currently; on Vhex, _Exit() is likely
just going to be a syscall. For CASIOWIN, this is slightly more
difficult, as there is no native exit syscall.
2021-05-29 16:45:35 +02:00
Lephenixnoir
73d6b2eb7c
setjmp: do not disable interrupts (#1) (DONE)
SR.BL=1 could cause problems if setjmp or longjmp is loader over a page
boundary and the second page is not loaded when interrupts are masked.

SR.IMASK=15 is another option, but it seems unnecessary per #1.

Blocking interrupts in longjmp did not make too much sense because the
blocked SR was immediately replaced by the restored one.
2021-05-29 11:18:02 +02:00
Lephenixnoir
1e7e2c656b
string: add and test strtok (DONE) 2021-05-24 10:25:32 +02:00
Lephenixnoir
df9073e6ff
string: add and test str[n]casecmp and KMP str[case]str (DONE) 2021-05-24 10:04:54 +02:00
Lephenixnoir
8ffc104798
string: add and test strpbrk (DONE) 2021-05-23 18:11:12 +02:00
Lephenixnoir
d105b1d60a
string: add stubs for strcoll and strxfrm (TEST)
These extend the stub locale; strcoll is simply strcmp and strxfrm is
simply strncpy.
2021-05-23 18:07:36 +02:00
Lephenixnoir
cda27ac2db
string: add and test strspn and strcspn (DONE) 2021-05-23 18:02:38 +02:00
Lephenixnoir
8368ba70fd
string: split and fix strdup and strndup (DONE) 2021-05-23 17:58:04 +02:00
Lephenixnoir
b78cec4f6d
string: add and test strerror (DONE) 2021-05-23 17:44:37 +02:00
Lephenixnoir
2a78c17597
string: strchr*, strmp*, strcpy*, strcat* are now tested (DONE) 2021-05-23 17:44:03 +02:00
Lephenixnoir
bd344d5bb2
string: split strchr, strchrnul and strrchr (TEST) 2021-05-23 16:07:01 +02:00
Lephenixnoir
6021c536f7
string: split strnlen, optimize strlen in assembler (DONE)
This change provides an optimized hand-written strlen function for
SuperH targets. The original plan was to declare the C-based naive
version weak and just let the linker figure out the proper one to use,
but unfortunately static libraries don't work like that; ld
intentionally stops at the first version even if it's weak. Instead,
some #ifdef's are used in the C-based strlen to not compile it when
unneeded.

The optimized strlen uses 4-byte accesses and cmp/str.
2021-05-23 16:00:12 +02:00
Lephenixnoir
d6f606fa5c
string: add and test an optimized memchr (DONE)
This version works on both SH3 and SH4.
2021-05-23 14:30:35 +02:00
Lephenixnoir
b96970e26d
string: memcmp is now tested (DONE) 2021-05-22 09:10:30 +02:00
Lephenixnoir
f5cca84ae8
stdlib: add and test strtod, strtof and atof (DONE)
This uses a generic function strto_fp similar to strto_int that is used
for strtol and its derivatives.
2021-05-21 23:56:35 +02:00
Lephenixnoir
efb37cf783
stdlib: add and test strtold (DONE)
The method is rather naive - digits read as an integer, then multipled
by a power of 10 or 2. This does not always give exact results, but it's
close enough for now. A stub support for long double larger than 64 bits
is provided.
2021-05-21 22:49:55 +02:00
Lephenixnoir
6847596bcd
clean up the STATUS file
Also add "!" in front of lines requiring more work to complete for
visual cues of progress.
2021-05-20 16:40:39 +02:00
Lephenixnoir
cc03641522
inttypes: add strtoimax and strtoumax 2021-05-20 16:05:20 +02:00
Lephenixnoir
9de2f5c391
math, fenv, complex: add headers through OpenLibm 2021-05-20 11:35:14 +02:00
Lephenixnoir
ade01b532e
stdlib: add atoi, atol and atoll 2021-05-20 11:35:14 +02:00
Lephenixnoir
06f975f75c
stdlib: add a test strtol, strtoul, strtoll (DONE)
The presumed bug where the value computed without the sign overflows
even though the negative result can be represented is not actually a
problem, because this only happens with signed results and the temporary
value is computed as unsigned (thus with extra range).
2021-05-20 11:03:19 +02:00
Lephenixnoir
b1dc3e77de
stdlib: add and test strtoull (DONE) 2021-05-19 21:50:08 +02:00
Lephenixnoir
41ab197ba2
inttypes: imaxabs and imaxdiv are now tested (DONE) 2021-05-19 21:50:02 +02:00
Lephenixnoir
6e66c531ca
stdlib: abs, labs, llabs, div, ldiv and lldiv are now tested (DONE) 2021-05-19 21:50:00 +02:00
Lephenixnoir
36b4854137
inttypes: add imaxabs and imaxdiv (TEST) 2021-05-18 21:31:00 +02:00
Lephenixnoir
73b536bbb6
stdlib: add abs, labs, llabs, div, ldiv, lldiv (TEST) 2021-05-18 21:25:45 +02:00
Lephenixnoir
e8aaadf2e7
inttypes: add PRI* and SCN* macros (LDEPS)
These macros cannot be tested properly until support for *printf and
*scanf is added (support for *printf currently exists but with a
temporary implementation), so this is LDEPS.

The size of the types has been checked though, so the definitions here
should be correct, the rest is printf/scanf logic.
2021-05-18 18:56:06 +02:00
Lephenixnoir
b1fa650914
ctype: test and fix character conversion functions (DONE)
Some shenanigans with the scope of variables in block expressions.
2021-05-18 11:52:17 +02:00
Lephenixnoir
50629bf479
ctype: test and fix character class functions (DONE) 2021-05-18 11:37:37 +02:00
Lephenixnoir
d70a2c671c
add a STATUS file to keep track of implementation progress 2021-05-16 18:12:46 +02:00