Commit Graph

78 Commits

Author SHA1 Message Date
Lephenixnoir d8a55b728d
stdlib: restore private headers 2024-01-14 13:48:41 +01:00
Sylvain PILLOT 09b33ca2fa
stdlib: scanf implementation by SlyVTT
Authored-By: Slyvtt <pillot.sylvain@gmail.com>
2023-05-26 21:04:37 +02:00
Lephenixnoir 1da9d10226
alloca: provide <alloca.h> 2023-04-01 20:30:30 +02:00
Lephenixnoir 7c4de3e295
dso, stdlib: __cxa_atexit(), __dso_handle, atexit() (TEST) 2023-04-01 20:30:30 +02:00
Lephenixnoir 95e33092ec
stdlib: add fileno (DONE) 2023-04-01 20:30:29 +02:00
Lephenixnoir 26e54af8e0
stdlib: scanf-friendly strto* functions 2023-04-01 20:30:29 +02:00
Lephenixnoir 4b61daa602
stdio: use non-zero values for SEEK_*
libstdc++ uses 0, SEEK_CUR, SEEK_END in an internal enumeration. By
having SEEK_CUR=0 we would have a duplicate case.
2022-08-19 15:49:54 +02:00
Lephenixnoir 8231557ff5
add declarations for unsupported functions for libstdc++
So that it compiles - it won't link but we can leave that for later.
2022-08-19 15:49:52 +02:00
Lephenixnoir 714e1cf605
signal: make sig_atomic_t a normal int
Using the _Atomic types is technically more accurate, but equivalent in
practice (glibc uses a normal int) and a bit of a headache for C++
targets since _Atomic is replaced with std::atomic.
2022-08-12 22:46:56 +02:00
Lephenixnoir ed52c1d7c2
sys/mman: fix missing include 2022-08-12 22:46:46 +02:00
Lephenixnoir 143029a837
stdint: do not rely on -ffreestanding
GCC's default stdint.h only defaults to stdint-gcc.h, which we want to
use, when using -ffreestanding. Make our wishes explicit to avoid
needing that flag.
2022-08-12 22:43:37 +02:00
Lephenixnoir 89c6c39405
stdio: support for UTF-8 %lc in printf() 2022-08-01 11:27:24 +01:00
Yann MAGNIN ed77a97547 Merge branch 'dev' of https://gitea.planet-casio.com/Vhex-Kernel-Core/fxlibc into dev 2022-07-30 17:57:55 +02:00
Yann MAGNIN bdf9566723 fxlibc - v1.4.3 : fix vhex missing headers
@update
> CMakeLists.txt
 | remove the generation of the shared version of the fxlibc (deprecated, unused)
> include/errno
 | add some error macros needed in vhex
> src/string/strerror
 | add EINTR support
 | add EAGAIN support
 | add ENOMEDIUM support
 | add EMEDIUMTYPE support

@fix
> include/target/vhex
 | add missing headers
2022-07-30 17:57:08 +02:00
Lephenixnoir 26d5b5d9ab
meta: chase the very last __restrict__ for C++ compatibility 2022-06-29 10:52:48 +01:00
Yann MAGNIN 619afe25da fxlibc - v1.4.2 : fix reallocarray() + remove old Vhex/Casiowin sources
@update
> CMakeLists.txt
  | remove casiowin-* target (unused)
  | remove x86-generic target (unused)
  | update files location
  | remove old vhex sources files (deprecated, unused)
> src/posix
  | remove this folder
> src/libc
  | move its content to src/
  | remove thread module
> src/stdlib/reallocarray
  | check if the multiplication overflow failed
  | set appropriate errno value if multiplication failed
2022-06-03 16:25:31 +02:00
Lephenixnoir d50e44c563
C++ __restrict__, update STATUS, minor formatting 2022-03-31 10:12:01 +01:00
Alice Rozengarden 3f5989ceab Add getline(3) & getdelim(3) 2022-03-30 23:49:44 +02:00
Lephenixnoir 809238e5b8
errno: add EINTR and EAGAIN 2022-02-24 12:48:51 +01:00
Lephenixnoir 294fda9731
stdio: share the FILE implementation between all versions 2022-01-13 21:28:19 +01:00
Lephenixnoir 6ec0c24e2d
stdio: ungetc(), update (+) and append (a) modes (DONE) 2022-01-12 10:20:30 +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 dbfefe5172
errno: add ENOTEMPTY for rmdir() 2021-12-30 18:18:54 +01:00
Lephenixnoir 937b7bfb63
stat: definitions required to support stat(2) 2021-12-23 23:50:48 +01:00
Lephenixnoir e479393a9c
unistd, dirent: definitions for directory functions 2021-12-21 18:55:23 +01:00
Lephenixnoir c2feb94710
fcntl, unistd: declarations for the Unix file API 2021-12-13 18:37:04 +01:00
Lephenixnoir 92ccd8b1db
time: add support for C99 <time.h> (DONE) 2021-12-04 22:02:23 +01:00
Lephenixnoir a6dbcfb227
add C++ header guards 2021-06-28 15:49:05 +02:00
Lephenixnoir f5571e2b3d
time: add general definitions 2021-06-13 18:26:04 +02:00
Lephenixnoir 6e42995388
stdio: add general file management definitions 2021-06-13 18:18:32 +02:00
Lephenixnoir 518a866750
use __restrict__ in headers for g++ compatibility 2021-06-13 18:17:40 +02:00
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