mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2024-12-28 04:23:38 +01:00
cd7fe7a329
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.
179 lines
5.4 KiB
Text
179 lines
5.4 KiB
Text
This file describes the implementation status and some notes; information is
|
|
taken from the C99 standard (ISO/IEC 9899:1999), section 7 ("Library").
|
|
|
|
# Notes for implementers
|
|
|
|
7.1.2§6:
|
|
Use (extern) in all function prototypes
|
|
7.1.3§1:
|
|
Only expose standard identifiers; anything else might be defined as a macro.
|
|
Make sure every argument name, internal function name, etc. starts with
|
|
either "__" or "_X" (where X is any uppercase letter)
|
|
7.1.4§1:
|
|
Always give a function even if there is a macro definition, so that the
|
|
address of the function can be taken; don't rely on the macro being defined,
|
|
as the user can remove it except in some special cases
|
|
|
|
String functions (mainly in <string.h>) can use 4-byte accesses, and in doing
|
|
so read up to 3 bytes after the end of the string if it is not padded (which
|
|
malloc'd strings and literal strings both are, leaving only stack-allocated and
|
|
statically-allocated ones). This allows important speed optimizations. The
|
|
extra access cannot trigger memory protection because there is no valid memory
|
|
less than 4 bytes before the end of any protection region. The extra access
|
|
might trigger the UBC in very specific scenarios, but we don't really care.
|
|
|
|
# Status
|
|
|
|
In this file, every definition is classified in one of several implementation
|
|
statuses. There are 5 stages that every definition should go through.
|
|
|
|
TODO: Function/symbol/macro is not implemented/defined
|
|
BDEPS(...): Function/symbol/macro needs ... to build
|
|
LDEPS(...): Function/symbol/macro needs ... to link
|
|
TEST: Function/symbol/macro needs to be tested
|
|
DONE: Function/symbol/macro is defined, builds, links, and is tested
|
|
|
|
7.2 <assert.h>
|
|
! 7.2.1 assert: LDEPS(fprintf,stderr)
|
|
|
|
7.3 <complex.h> => OpenLibm
|
|
|
|
7.4 <ctype.h>
|
|
7.4.1 is*: DONE
|
|
7.4.2 to*: DONE
|
|
|
|
7.5 <errno.h>
|
|
7.5.2 EDOM EILSEQ ERANGE: DONE
|
|
|
|
7.6 <fenv.h> => OpenLibm
|
|
|
|
7.7 <float.h> => GCC
|
|
|
|
7.8 <inttypes.h>
|
|
! 7.8.1 PRI* macros: LDEPS(*printf)
|
|
! 7.8.1 SCN* macros: LDEPS(*scanf)
|
|
7.8.2.1 imaxabs: DONE
|
|
7.8.2.2 imaxdiv: DONE
|
|
7.8.2.3 strtoimax strtoumax: DONE
|
|
! 7.8.2.4 wcstoimax wcstoumax: TODO
|
|
|
|
7.9 <iso646.h> => GCC
|
|
|
|
7.10 <limits.h> => GCC
|
|
|
|
7.11 <locale.h>
|
|
! 7.11.1 setlocale: TEST
|
|
! 7.11.2 localeconv: TEST
|
|
|
|
7.12 <math.h> => OpenLibm
|
|
|
|
7.13 <setjmp.h>
|
|
7.13.1 setjmp: DONE
|
|
7.13.2 longjmp: DONE
|
|
|
|
7.14 <signal.h>
|
|
7.14 sig_atomic_t SIG_DFL SIG_ERR SIG_IGN: DONE
|
|
7.14 SIGABRT SIGFPE SIGILL SIGINT SIGSEGV SIGTERM: DONE
|
|
7.14.1.1 signal: DONE
|
|
7.14.1.2 raise: DONE
|
|
|
|
7.15 <stdarg.h> => GCC
|
|
|
|
7.16 <stdbool.h> => GCC
|
|
|
|
7.17 <stddef.h> => GCC
|
|
|
|
7.18 <stdint.h> => GCC
|
|
|
|
7.19 <stdio.h>
|
|
! 7.19.1 Introduction: TODO
|
|
! 7.19.4 Operations on files: TODO
|
|
! 7.19.5 File access functions: TODO
|
|
! 7.19.6 Formatted input/output functions: TODO
|
|
! 7.19.7 Character input/output functions: TODO
|
|
! 7.19.8 Direct input/output functions: TODO
|
|
! 7.19.9 File positioning functions: TODO
|
|
! 7.19.10 Error-handling functions: TODO
|
|
|
|
7.20 <stdlib.h>
|
|
7.20 RAND_MAX, MB_CUR_MAX: TODO
|
|
7.20.1.1 atof: DONE
|
|
7.20.1.2 atoi, atol, atoll: DONE
|
|
7.20.1.3 strtod, strtof, strtold: DONE
|
|
7.20.1.4 strtol, strtoul, strtoll, strtoull: DONE
|
|
! 7.20.2 Pseudo-random sequence generation functions: TODO
|
|
! 7.20.3 Memory management functions: TODO (check existing code first)
|
|
7.20.4.1 abort: DONE
|
|
! 7.20.4.2 atexit: TODO
|
|
7.20.4.3 exit: DONE (missing stream flushing/closing/etc)
|
|
7.20.4.4 _Exit: DONE (gint only)
|
|
! 7.20.4.5 getenv: TODO
|
|
! 7.20.4.6 system: TODO
|
|
! 7.20.5 Searching and sorting utilities: TODO
|
|
7.20.6.1 abs, labs, llabs: DONE
|
|
7.20.6.2 div, ldiv, lldiv: DONE
|
|
! 7.20.7 Multibyte/wide character conversion functions: TODO
|
|
! 7.20.8 Multibyte/wide string conversion functions: TODO
|
|
|
|
7.21 <string.h>
|
|
7.21.2.1 memcpy: DONE
|
|
7.21.2.2 memmove: DONE (Unoptimized: byte-by-byte)
|
|
7.21.2.3 strcpy: DONE
|
|
7.21.2.4 strncpy: DONE
|
|
7.21.3.1 strcat: DONE
|
|
7.21.3.2 strncat: DONE
|
|
7.21.4.1 memcmp: DONE
|
|
7.21.4.2 strcmp: DONE
|
|
7.21.4.3 strcoll: DONE
|
|
7.21.4.4 strncmp: DONE
|
|
7.21.4.5 strxfrm: DONE
|
|
7.21.5.1 memchr: DONE
|
|
7.21.5.2 strchr: DONE
|
|
7.21.5.3 strcspn: DONE
|
|
7.21.5.4 strpbrk: DONE
|
|
7.21.5.5 strrchr: DONE
|
|
7.21.5.6 strspn: DONE
|
|
7.21.5.7 strstr: DONE
|
|
7.21.5.8 strtok: DONE
|
|
7.21.6.1 memset: DONE
|
|
7.21.6.2 strerror: DONE
|
|
7.21.6.3 strlen: DONE
|
|
Extensions:
|
|
- strnlen: DONE
|
|
- strchrnul: DONE
|
|
- strcasestr: DONE
|
|
- strcasecmp: DONE
|
|
- strncasecmp: DONE
|
|
- strdup: DONE
|
|
- strndup: DONE
|
|
|
|
7.22 <tgmath.h> => GCC
|
|
|
|
7.23 <time.h>
|
|
! 7.23.1 Components of time: TODO
|
|
! 7.23.2.1 clock: TODO
|
|
! 7.23.2.2 difftime: TODO
|
|
! 7.23.2.3 mktime: TODO
|
|
! 7.23.2.4 time: TODO
|
|
! 7.23.3.1 asctime: TODO
|
|
! 7.23.3.2 ctime: TODO
|
|
! 7.23.3.3 gmtime: TODO
|
|
! 7.23.3.4 localtime: TODO
|
|
! 7.23.3.5 strftime: TODO
|
|
|
|
7.24 <wchar.h>
|
|
TODO (not a priority)
|
|
|
|
7.25 <wctype.h>
|
|
TODO (not a priority)
|
|
|
|
# Supporting locales
|
|
|
|
What if we wanted to support more locales?
|
|
-> Need to a mechanism to supply the raw information, similar to the text files
|
|
in /usr/share/i18n/locales
|
|
-> Implement setlocale() and localeconv() properly (not hard)
|
|
-> Probably support nl_langinfo(), which is much better than localeconv()
|
|
-> Fix the "TODO: locale: ..." messages wherever assumptions on the locale are
|
|
made in the code
|
|
-> Properly implement strcoll() and strxfrm()
|