2021-05-16 18:11:09 +02:00
|
|
|
This file describes the implementation status and some notes; information is
|
|
|
|
taken from the C99 standard (ISO/IEC 9899:1999), section 7 ("Library").
|
|
|
|
|
2021-05-20 16:40:39 +02:00
|
|
|
# Notes for implementers
|
2021-05-16 18:11:09 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-05-23 14:30:35 +02:00
|
|
|
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.
|
|
|
|
|
2021-05-20 16:40:39 +02:00
|
|
|
# Status
|
|
|
|
|
2021-05-16 18:11:09 +02:00
|
|
|
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
|
2022-01-01 17:11:04 +01:00
|
|
|
-: Function/symbol/macro is defined, builds, links, and is tested
|
2021-05-16 18:11:09 +02:00
|
|
|
|
|
|
|
7.2 <assert.h>
|
2022-01-01 17:11:04 +01:00
|
|
|
7.2.1 assert LDEPS(fprintf,stderr)
|
2021-05-16 18:11:09 +02:00
|
|
|
|
2021-05-20 16:40:39 +02:00
|
|
|
7.3 <complex.h> => OpenLibm
|
2021-05-16 18:11:09 +02:00
|
|
|
|
|
|
|
7.4 <ctype.h>
|
2022-01-01 17:11:04 +01:00
|
|
|
7.4.1 is* -
|
|
|
|
7.4.2 to* -
|
2021-05-16 18:11:09 +02:00
|
|
|
|
|
|
|
7.5 <errno.h>
|
2022-01-01 17:11:04 +01:00
|
|
|
7.5.2 EDOM, EILSEQ, ERANGE -
|
2021-05-16 18:11:09 +02:00
|
|
|
|
2021-05-20 16:40:39 +02:00
|
|
|
7.6 <fenv.h> => OpenLibm
|
2021-05-16 18:11:09 +02:00
|
|
|
|
2021-05-20 16:40:39 +02:00
|
|
|
7.7 <float.h> => GCC
|
2021-05-16 18:11:09 +02:00
|
|
|
|
|
|
|
7.8 <inttypes.h>
|
2022-01-01 17:11:04 +01:00
|
|
|
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
|
2021-05-16 18:11:09 +02:00
|
|
|
|
2021-05-20 16:40:39 +02:00
|
|
|
7.9 <iso646.h> => GCC
|
2021-05-16 18:11:09 +02:00
|
|
|
|
2021-05-20 16:40:39 +02:00
|
|
|
7.10 <limits.h> => GCC
|
2021-05-16 18:11:09 +02:00
|
|
|
|
|
|
|
7.11 <locale.h>
|
2022-01-01 17:11:04 +01:00
|
|
|
7.11.1 setlocale TEST
|
|
|
|
7.11.2 localeconv TEST
|
2021-05-16 18:11:09 +02:00
|
|
|
|
2021-05-20 16:40:39 +02:00
|
|
|
7.12 <math.h> => OpenLibm
|
2021-05-16 18:11:09 +02:00
|
|
|
|
|
|
|
7.13 <setjmp.h>
|
2022-01-01 17:11:04 +01:00
|
|
|
7.13.1 setjmp -
|
|
|
|
7.13.2 longjmp -
|
2021-05-16 18:11:09 +02:00
|
|
|
|
|
|
|
7.14 <signal.h>
|
2022-01-01 17:11:04 +01:00
|
|
|
7.14.1.1 signal -
|
|
|
|
7.14.1.2 raise -
|
2021-05-16 18:11:09 +02:00
|
|
|
|
2021-05-20 16:40:39 +02:00
|
|
|
7.15 <stdarg.h> => GCC
|
2021-05-16 18:11:09 +02:00
|
|
|
|
2021-05-20 16:40:39 +02:00
|
|
|
7.16 <stdbool.h> => GCC
|
2021-05-16 18:11:09 +02:00
|
|
|
|
2021-05-20 16:40:39 +02:00
|
|
|
7.17 <stddef.h> => GCC
|
2021-05-16 18:11:09 +02:00
|
|
|
|
2021-05-20 16:40:39 +02:00
|
|
|
7.18 <stdint.h> => GCC
|
2021-05-16 18:11:09 +02:00
|
|
|
|
|
|
|
7.19 <stdio.h>
|
2022-01-02 18:51:16 +01:00
|
|
|
7.19.1 Introduction TEST (no wide-oriented streams *)
|
2022-01-12 10:20:12 +01:00
|
|
|
7.19.1 stdin, stdout, stderr TODO
|
2022-01-02 18:51:16 +01:00
|
|
|
|
2022-01-01 17:11:04 +01:00
|
|
|
7.19.4.1 remove TEST
|
|
|
|
7.19.4.2 rename TODO
|
|
|
|
7.19.4.3 tmpfile TODO
|
|
|
|
7.19.4.4 tmpnam TODO
|
2022-01-02 18:51:16 +01:00
|
|
|
|
2022-01-10 21:32:24 +01:00
|
|
|
7.19.5.1 fclose -
|
|
|
|
7.19.5.2 fflush -
|
2022-01-12 10:20:12 +01:00
|
|
|
7.19.5.3 fopen -
|
2022-01-13 21:21:23 +01:00
|
|
|
(EXT) fdopen -
|
|
|
|
7.19.5.4 freopen -
|
2022-01-10 21:32:24 +01:00
|
|
|
7.19.5.5 setbuf -
|
|
|
|
7.19.5.6 setvbuf -
|
2022-01-02 18:51:16 +01:00
|
|
|
|
2022-01-12 10:20:12 +01:00
|
|
|
7.19.6.1 fprintf TEST
|
2022-01-01 17:11:04 +01:00
|
|
|
7.19.6.2 fscanf TODO
|
2022-01-12 10:20:12 +01:00
|
|
|
7.19.6.3 printf LDEPS(stdout)
|
2022-01-01 17:11:04 +01:00
|
|
|
7.19.6.4 scanf TODO
|
|
|
|
7.19.6.5 snprintf -
|
|
|
|
7.19.6.6 sprintf -
|
|
|
|
7.19.6.7 sscanf TODO
|
2022-01-12 10:20:12 +01:00
|
|
|
7.19.6.8 vfprintf TEST
|
2022-01-01 17:11:04 +01:00
|
|
|
7.19.6.9 vfscanf TODO
|
2022-01-12 10:20:12 +01:00
|
|
|
7.19.6.10 vprintf LDEPS(stdout)
|
2022-01-01 17:11:04 +01:00
|
|
|
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
|
2022-01-02 18:51:16 +01:00
|
|
|
|
2022-01-14 17:16:04 +01:00
|
|
|
7.19.7.1 fgetc -
|
|
|
|
7.19.7.2 fgets -
|
|
|
|
7.19.7.3 fputc -
|
|
|
|
7.19.7.4 fputs -
|
|
|
|
7.19.7.5 getc -
|
|
|
|
7.19.7.6 getchar LDEPS(stdin)
|
|
|
|
7.19.7.7 gets LDEPS(stdin)
|
|
|
|
7.19.7.8 putc -
|
|
|
|
7.19.7.9 putchar LDEPS(stdout)
|
|
|
|
7.19.7.10 puts LDEPS(stdout)
|
2022-01-12 10:20:12 +01:00
|
|
|
7.19.7.11 ungetc -
|
2022-01-02 18:51:16 +01:00
|
|
|
|
2022-01-12 10:20:12 +01:00
|
|
|
7.19.8.1 fread -
|
|
|
|
7.19.8.2 fwrite -
|
2022-01-02 18:51:16 +01:00
|
|
|
|
2022-01-10 21:32:24 +01:00
|
|
|
7.19.9.1 fgetpos -
|
|
|
|
7.19.9.2 fseek -
|
|
|
|
7.19.9.3 fsetpos -
|
|
|
|
7.19.9.4 ftell -
|
|
|
|
7.19.9.5 rewind -
|
2022-01-02 18:51:16 +01:00
|
|
|
|
2022-01-02 22:09:06 +01:00
|
|
|
7.19.10.1 clearerr -
|
|
|
|
7.19.10.2 feof -
|
|
|
|
7.19.10.3 ferror -
|
2022-01-02 18:51:16 +01:00
|
|
|
7.19.10.4 perror TODO
|
2021-05-16 18:11:09 +02:00
|
|
|
|
|
|
|
7.20 <stdlib.h>
|
2022-01-01 17:11:04 +01:00
|
|
|
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
|
2021-05-16 18:11:09 +02:00
|
|
|
|
|
|
|
7.21 <string.h>
|
2022-01-01 17:11:04 +01:00
|
|
|
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 -
|
2022-01-12 10:20:12 +01:00
|
|
|
(EXT) memrchr - (Unoptimized: byte-by-byte)
|
2021-05-20 16:40:39 +02:00
|
|
|
|
|
|
|
7.22 <tgmath.h> => GCC
|
2021-05-16 18:11:09 +02:00
|
|
|
|
|
|
|
7.23 <time.h>
|
2022-01-01 17:11:04 +01:00
|
|
|
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)
|
2021-05-20 16:40:39 +02:00
|
|
|
|
|
|
|
# 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()
|
2021-11-29 17:10:54 +01:00
|
|
|
-> Add support in strftime()
|
2021-06-13 17:26:32 +02:00
|
|
|
|
|
|
|
# Supporting text and binary files (newline translation)
|
|
|
|
|
2022-01-01 17:11:04 +01:00
|
|
|
Because of 7.19.2§1.223 we don't need to support newline translation.
|
2021-06-13 17:26:32 +02:00
|
|
|
|
|
|
|
# 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.
|
2021-11-29 17:10:54 +01:00
|
|
|
|
|
|
|
# Supporting timezones
|
|
|
|
|
|
|
|
-> Update localtime()
|
|
|
|
-> Add some timezone API
|