Commit Graph

43 Commits

Author SHA1 Message Date
Lephenixnoir dcaf203f46
stdio: improve printf extension API and type size support 2021-06-08 10:32:08 +02:00
Lephenixnoir ed8134970b
add nonstandard GNU endian.h 2021-06-08 10:05:00 +02:00
Lephenixnoir 009a2eef6e
stdlib: add TinyMT-based rand, and malloc/etc for gint 2021-06-07 22:00:41 +02:00
Lephenixnoir 625a6af459
stdio: add asprintf and vasprintf 2021-06-07 19:09:55 +02:00
Lephenixnoir f52e0923bc
stdio: move the printf implementation from gint 2021-06-07 18:57:11 +02:00
Lephenixnoir 66463bfe17
assert: fix silly mistake 2021-05-30 23:16:09 +02:00
Lephenixnoir d261db447b
add some function attributes 2021-05-30 15:09:33 +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 13c3390b22
setjmp: expose setjmp and longjmp to sh-generic
... instead of vhex-generic, where it doesn't really belong because Vhex
might run on other architectures.
2021-05-29 09:56:47 +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 cda27ac2db
string: add and test strspn and strcspn (DONE) 2021-05-23 18:02:38 +02:00
Lephenixnoir 591e453717
sh-generic: add CPU capabilities for optimized SH4 code
On sh-generic targets, the headers <bits/cpucap.h> (in C) and
<bits/asm/cpucap.h> (in assembler) provide definitions to acces the
__cpucap symbol which provides information on the CPU.

Currently, a single capability __CPUCAP_SH4ALDSP is defined; it
represents the SH4 extended instructions together with the integrated
DSP instructions. The main uses of this capability are [movua.l]
(unaligned reads) and [ldrc] (built-in tight loops).

Capabilities are initialized to 0 (their safest default) and the runtime
can enable them based on what hardware is running.
2021-05-23 15:31:01 +02:00
Lephenixnoir 53751aa9a1
string: fill all prototypes in <string.h> 2021-05-23 15:29:37 +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 865b01c812
math, fenv, complex: use OpenLibm unconditionally
This won't build on vhex-x86 but that can be left for another time. The
previous approach did not work because the __SUPPORT flags are not
defined when interfacing the library.
2021-05-20 23:19:40 +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 b1dc3e77de
stdlib: add and test strtoull (DONE) 2021-05-19 21:50:08 +02:00
Lephenixnoir e4c385d0df
stdlib: safeguard prototypes against user-defined macros 2021-05-19 10:12:41 +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 5f48a6b4e0
errno: add the errno variable and base macros
A <bits/errno.h> file will likely by added later on for each target to
add more specific values.
2021-05-16 18:12:46 +02:00
Lephenixnoir c87805ef10
ctype: add a simple implementation for the "C" locale (TEST) 2021-05-16 18:12:45 +02:00
Lephenixnoir fdf32aeb97
locale: add a stub that supports only the "C" locale (TEST)
This is enough to support the standard and likely the C++ library and
external programs to port, but also the most we can do without a proper
locale data storage and more target-specific developments that aren't a
priority right now.
2021-05-16 18:12:45 +02:00
Lephenixnoir 676601b894
assert: add a partial assert implementation (LDEPS)
This currently does not link because fprintf, stderr and abort are
missing on most platforms. But the code is there.
2021-05-16 18:12:45 +02:00
Lephenixnoir 97d52ff0b1
stdio: declare stdin, stdout and stderr on all targets
This is needed for some basic stuff like assert.
2021-05-16 18:12:45 +02:00
Lephenixnoir c88b31ec94
setjmp: make setjmp a macro 2021-05-16 18:12:42 +02:00
Lephenixnoir 6275b3e73b
move bits/unistd_32.h to bits/asm on all targets
Only Vhex had it at the correct place previously.
2021-05-11 09:22:34 +02:00
Lephenixnoir f6bed55f75
update header guard convention 2021-05-09 23:00:11 +02:00
Lephenixnoir f58187c55e
remove unneeded __SUPPORT macros 2021-05-09 22:11:49 +02:00
Lephenixnoir e719af2f63
update include hierarchy 2021-05-09 17:59:07 +02:00
Yatis 64e7001d22 new include hierarchy 2021-05-09 16:35:40 +02:00
Yatis f76757ecd2 Fix installation / uninstallation rules + Fix compilation ABI support 2020-11-03 15:15:01 +01:00
Yatis 565a159370 Release the 0.3.0 (add README + LICENSE and fix norm) 2020-10-21 22:26:47 +02:00
Yatis 44bd67431c Fix norme + move arch-specific header 2020-10-14 15:18:10 +02:00
Yatis 3764de9a27 fix compilation error (common) 2020-10-14 12:07:29 +02:00
Yatis aeedfcdb02 project architecture rework + handle ABI specific code (WIP) 2020-10-14 11:45:08 +02:00
Yatis 8fac0c2272 Initial commit 2020-09-17 19:27:01 +02:00