a C standard library for fx Casio calculators
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

197 lines
6.0 KiB

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
Use (extern) in all function prototypes
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)
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.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) imaxabs: DONE imaxdiv: DONE strtoimax strtoumax: DONE
! 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.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
TODO: Handle wide-oriented streams? (see notes)
! 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 MB_CUR_MAX: TODO atof: DONE atoi, atol, atoll: DONE strtod, strtof, strtold: DONE strtol, strtoul, strtoll, strtoull: DONE rand: DONE srand: DONE calloc: DONE free: DONE (at least gint) malloc: DONE (at least gint) realloc: DONE (at least gint) abort: DONE
! atexit: TODO exit: DONE (missing stream flushing/closing/etc) _Exit: DONE (gint only)
! getenv: TODO
! system: TODO
! bsearch: TODO
! qsort: TEST abs, labs, llabs: DONE 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> memcpy: DONE memmove: DONE (Unoptimized: byte-by-byte) strcpy: DONE strncpy: DONE strcat: DONE strncat: DONE memcmp: DONE strcmp: DONE strcoll: DONE strncmp: DONE strxfrm: DONE memchr: DONE strchr: DONE strcspn: DONE strpbrk: DONE strrchr: DONE strspn: DONE strstr: DONE strtok: DONE memset: DONE strerror: DONE strlen: DONE
- 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
! clock: TODO
! difftime: TODO
! mktime: TODO
! time: TODO
! asctime: TODO
! ctime: TODO
! gmtime: TODO
! localtime: TODO
! 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()
# 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.