Commit graph

170 commits

Author SHA1 Message Date
Lephenixnoir
5b85d53826
(formatting: case indent) 2024-01-14 20:23:55 +01:00
Lephenixnoir
55ae7df318
stdio: simplify output size management in scanf 2024-01-14 20:23:21 +01:00
Lephenixnoir
69eadb67d2
stdio: deduplicate scanf cases and remove most gotos 2024-01-14 20:07:24 +01:00
Lephenixnoir
b11c059c0f
stdio: start simplifying scanf limit tracking logic
Basically removing it from the __scanf_input structure and specializing
it at format sites. The reason is that pretending it's the end of the
stream after the limit is reached does not work because we have to
return EOF at end of stream but not when the limit is hit. So we have to
handle it explicitly, and since we do, no need to have it in the
structure too.
2024-01-14 19:28:36 +01:00
Lephenixnoir
2215b3c267
stdio: make all scanf tests pass
The tests are still far from exhaustive but that's a good start.
2024-01-14 17:31:21 +01:00
Lephenixnoir
b61cc096d9
stdio: fix scanf buffering so all tests pass
Code factoring and performance improvements will follow.
2024-01-14 17:31:19 +01:00
Lephenixnoir
c776336a0d
stdio: fix scanf bounds breaking strto*
Mostly an initialization problem. But I also optimized the check by
making the bound a maximal unsigned integer when there is no bound,
since __scanf_peek() is used a lot.
2024-01-14 17:31:15 +01:00
Lephenixnoir
d8a55b728d
stdlib: restore private headers 2024-01-14 13:48:41 +01:00
Slyvtt
09b33ca2fa
stdlib: scanf implementation by SlyVTT
Authored-By: Slyvtt <pillot.sylvain@gmail.com>
2023-05-26 21:04:37 +02:00
Lephenixnoir
031e0ccb65
bump version to 1.4.5 2023-04-01 20:30:30 +02:00
Lephenixnoir
74b805e8b5
stdlib: automatically seed PRNG with srand(1) 2023-04-01 20:30:30 +02:00
Yann MAGNIN
7eb2a6e8ab
add shared lib generation support for Vhex 2023-04-01 20:30:30 +02:00
Yann MAGNIN
c85182d07e
update vxSDK integration 2023-04-01 20:30:30 +02:00
Lephenixnoir
465655674b
dso: dynamically allocate destructor table
This saves static memory on mono targets where it's scarce.
2023-04-01 20:30:30 +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
fda0d950ed
time: fix strftime being called strftime2 2023-04-01 20:30:29 +02:00
Lephenixnoir
eb83e7442f Merge pull request 'Fix signedness issues with strcmp and strncmp' (#4) from Heath123/fxlibc:heath123-patch-1 into master
Reviewed-on: https://gitea.planet-casio.com/Vhex-Kernel-Core/fxlibc/pulls/4
2022-11-24 14:23:21 +01:00
Heath Mitchell
aeeae3810d Update 'src/string/strcmp.c' 2022-11-24 13:36:02 +01:00
Heath Mitchell
ee42660ea5 Update 'src/string/strncmp.c' 2022-11-24 13:30:46 +01:00
Lephenixnoir
ddec761f61
bump version to 1.4.4 2022-08-21 20:09:54 +02:00
Lephenixnoir
ca6c39bf56
meta: update build instructions 2022-08-21 17:11:28 +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
31ee6fdbee
cmake: remove the OpenLibm include path workaround
This is no longer needed when the fxSDK sysroot is in use; and anyway no
2022-08-12 22:40:20 +02:00
Lephenixnoir
b38dd3f894
cmake: use *dynamic* fxSDK compiler path as default for gint
Previously FXSDK_COMPILER_INSTALL would be stored as the install prefix.
However, this prefix is subject to unannounced changes when the compiler
version is upgraded without reconfiguring the fxlibc, which happens in
the GiteaPC workflow.

This commit avoids the use of CMAKE_INSTALL_PREFIX when using gint with
no specified prefix, and instead uses another cached variable which
leaves the prefix to be dynamically resolved based on the uncached
variable FXSDK_COMPILER_INSTALL, like most repositories do (eg. gint).
We need the cached indicator because we frequently reconfigure and
CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT is not persistent.
2022-08-12 22:39:53 +02:00
Lephenixnoir
89c6c39405
stdio: support for UTF-8 %lc in printf() 2022-08-01 11:27:24 +01:00
Yann MAGNIN
e8779145c2 fix vhex target folders 2022-07-30 18:55:40 +02: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
Yann MAGNIN
996b2b8ded fxlibc - v1.4.1 : update Vhex stdlib
@update
> malloc  : do not use syscall, involve kmalloc
> realloc : do not use syscall, involve krealloc
> free    : do not use syscall, involve kfree

@fix
> _Exit : remove syscall
2022-05-14 11:49:08 +02:00
Lephenixnoir
d50e44c563
C++ __restrict__, update STATUS, minor formatting 2022-03-31 10:12:01 +01:00
Lephenixnoir
94faa6cbea Merge pull request 'Add getline(3) & getdelim(3)' (#2) from Alice/fxlibc:dev into dev
Reviewed-on: https://gitea.planet-casio.com/Vhex-Kernel-Core/fxlibc/pulls/2
2022-03-31 11:11:26 +02:00
Alice Rozengarden
3f5989ceab Add getline(3) & getdelim(3) 2022-03-30 23:49:44 +02:00
Lephenixnoir
3c29639988
string: fix a bug in SuperH memset 2022-03-26 15:19:15 +00:00
Lephenixnoir
4d464bde01
bump version to 1.4.0 2022-03-19 19:29:17 +00:00
Lephenixnoir
809238e5b8
errno: add EINTR and EAGAIN 2022-02-24 12:48:51 +01:00
Yann MAGNIN
fa4adc5620 add PIC option + vxsdk support 2022-01-26 16:34:16 +01:00
Lephenixnoir
71866ed769
stdio: stdin/stdout/stderr, perror, final adjustments
Support for <stdio.h> will stop here for now.
2022-01-14 18:38:48 +01:00
Lephenixnoir
ed873a652e
stdio: fgetc(), fgets(), tests for fputc() and fputs() (DONE) 2022-01-14 17:16:04 +01:00
Lephenixnoir
294fda9731
stdio: share the FILE implementation between all versions 2022-01-13 21:28:19 +01:00
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