fxlibc/STATUS
2022-01-02 19:22:42 +01:00

222 lines
8.6 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
-: 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* -
7.4.2 to* -
7.5 <errno.h>
7.5.2 EDOM, EILSEQ, ERANGE -
7.6 <fenv.h> => OpenLibm
7.7 <float.h> => GCC
7.8 <inttypes.h>
7.8.1 PRI* macros -
7.8.1 SCN* macros -
7.8.2.1 imaxabs -
7.8.2.2 imaxdiv -
7.8.2.3 strtoimax, strtoumax -
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 -
7.13.2 longjmp -
7.14 <signal.h>
7.14.1.1 signal -
7.14.1.2 raise -
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 TEST
No wide-oriented streams (see notes)
7.19.4.1 remove TEST
7.19.4.2 rename TODO
7.19.4.3 tmpfile TODO
7.19.4.4 tmpnam TODO
7.19.5.1 fclose TODO
7.19.5.2 fflush TODO
7.19.5.3 fopen TODO
7.19.5.4 freopen TODO
7.19.5.5 setbuf TODO
7.19.5.6 setvbuf TODO
7.19.6.1 fprintf LDEPS(fwrite)
7.19.6.2 fscanf TODO
7.19.6.3 printf LDEPS(fwrite, stdout)
7.19.6.4 scanf TODO
7.19.6.5 snprintf -
7.19.6.6 sprintf -
7.19.6.7 sscanf TODO
7.19.6.8 vfprintf LDEPS(fwrite)
7.19.6.9 vfscanf TODO
7.19.6.10 vprintf LDEPS(fwrite, stdout)
7.19.6.11 vscanf TODO
7.19.6.12 vsnprintf -
7.19.6.13 vsprintf -
7.19.6.14 vsscanf TODO
(EXT) asprintf -
(EXT) vasprintf -
(EXT) dprintf TEST
(EXT) vdprintf TEST
7.19.7 Character input/output TODO
7.19.8 Direct input/output TODO
7.19.9 File positioning TODO
7.19.10 Error-handling TODO
7.20 <stdlib.h>
7.20 MB_CUR_MAX TODO
7.20.1.1 atof -
7.20.1.2 atoi, atol, atoll -
7.20.1.3 strtod, strtof, strtold -
7.20.1.4 strtol, strtoul -
7.20.1.4 strtoll, strtoull -
7.20.2.1 rand -
7.20.2.2 srand -
7.20.3.1 calloc -
7.20.3.2 free - (gint)
7.20.3.3 malloc - (gint)
7.20.3.4 realloc - (gint)
7.20.4.1 abort - (stream flushing/closing/etc?)
7.20.4.2 atexit TODO
7.20.4.3 exit - (stream flushing/closing/etc?)
7.20.4.4 _Exit - (gint)
7.20.4.5 getenv TODO
7.20.4.6 system TODO
7.20.5.1 bsearch TODO
7.20.5.2 qsort TEST
7.20.6.1 abs, labs, llabs -
7.20.6.2 div, ldiv, lldiv -
7.20.7 Multibyte/wide char conv TODO
7.20.8 Multibyte/wide string conv TODO
7.21 <string.h>
7.21.2.1 memcpy -
7.21.2.2 memmove - (Unoptimized: byte-by-byte)
7.21.2.3 strcpy -
7.21.2.4 strncpy -
7.21.3.1 strcat -
7.21.3.2 strncat -
7.21.4.1 memcmp -
7.21.4.2 strcmp -
7.21.4.3 strcoll -
7.21.4.4 strncmp -
7.21.4.5 strxfrm -
7.21.5.1 memchr -
7.21.5.2 strchr -
7.21.5.3 strcspn -
7.21.5.4 strpbrk -
7.21.5.5 strrchr -
7.21.5.6 strspn -
7.21.5.7 strstr -
7.21.5.8 strtok -
7.21.6.1 memset -
7.21.6.2 strerror -
7.21.6.3 strlen -
(EXT) strnlen -
(EXT) strchrnul -
(EXT) strcasestr -
(EXT) strcasecmp -
(EXT) strncasecmp -
(EXT) strdup -
(EXT) strndup -
7.22 <tgmath.h> => GCC
7.23 <time.h>
7.23.2.1 clock -
7.23.2.2 difftime -
7.23.2.3 mktime - (DST flag ignored)
7.23.2.4 time -
7.23.3.1 asctime -
7.23.3.2 ctime -
7.23.3.3 gmtime -
7.23.3.4 localtime - (No timezones; same as gmtime)
7.23.3.5 strftime - (No %g, %G, %U, %V, %W, %z, %Z)
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()
-> Add support in strftime()
# Supporting text and binary files (newline translation)
Because of 7.19.2§1.223 we don't need to support newline translation.
# Support wide-oriented streams
This requires all the wide-char functions but also updating fpos_t to be a
structure with at least some mbstate_t member (7.19.2§6).
I really don't want to do that. Use multi-byte functions with UTF-8.
# Supporting timezones
-> Update localtime()
-> Add some timezone API