/******************************************** ** ** Full libc content. ** ** Legend ** - entry : to do ** entry : done ** * entry : see notes ** ********************************************/ assert.h - void assert (int expression) ctype.h int isalnum (int c) int isalpha (int c) int iscntrl (int c) int isdigit (int c) int isgraph (int c) int islower (int c) int isprint (int c) int ispunct (int c) int isspace (int c) int isupper (int c) int isxdigit (int c) int tolower (int c) int toupper (int c) errno.h - errno {int} - EDOM {int} - ERANGE {int} - EILSEQ {int} float.h FLT_RADIX {macro} FLT_MANT_DIG {macro} DBL_MANT_DIG {macro} FLT_DIG {macro} DBL_DIG {macro} FLT_MIN_EXP {macro} DBL_MIN_EXP {macro} FLT_MAX_EXP {macro} DBL_MAX_EXP {macro} - FLT_MAX {macro} - DBL_MAX {macro} - FLT_EPSILON {macro} - DBL_EPSILON {macro} - FLT_MIN {macro} - DBL_MIN {macro} FLT_ROUNDS {macro} FLT_EVAL_METHOD {macro},C99 DECIMAL_DIG {macro},C99 iso646.h and {macro} and_eq {macro} bitand {macro} bitor {macro} compl {macro} not {macro} not_eq {macro} or {macro} or_eq {macro} xor {macro} xor_eq {macro} limits.h CHAR_BIT {macro} SCHAR_MIN {macro} SCHAR_MAX {macro} UCHAR_MAX {macro} CHAR_MIN {macro} CHAR_MAX {macro} SHRT_MIN {macro} SHRT_MAX {macro} USHRT_MAX {macro} INT_MIN {macro} INT_MAX {macro} UINT_MAX {macro} LONG_MIN {macro} LONG_MAX {macro} ULONG_MAX {macro} locale.h lconv {struct} lconv_category {enum} - char *setlocale (int category, const char *locale) - lconv *localeconv (void) NULL (void *)(0L) math.h - double cos (double x) - double sin (double x) - double tan (double x) - double acos (double x) - double asin (double x) - double atan (double x) - double atan2 (double x, double y) - double cosh (double x) - double sinh (double x) - double tanh (double x) - double acosh (double x) - double asinh (double x) - double atanh (double x) - double exp (double x) - double frexp (double x, int *exp) - double ldexp (double x, int exp) - double log (double x) - double log10 (double x) - double modf (double x, double *intpart) - double exp2 (double x) - double expm1 (double x) - int ilogb (double x) - double log1p (double x) - double log2 (double x) - double logb (double x) - double scalbn (double x, int n) - double pow (double base, double exponent) - double sqrt (double x) - double cbrt (double x) - double hypot (double x, double y) - double erf (double x) - double erfc (double x) - double tgamma (double x) - double lgamma (double x) - double ceil (double x) - double floor (double x) - double fmod (double numer, double denom) - double trunc (double x) - double round (double x) - double rint (double x) - double nearbyint (double x) - double remainder (double numer, double denom) - double remquo (double numer, double denom, int *quot) - double copysign (double x, double y) - double nan (const char *tagp) - double nextafter (double x, double y) - double fdim (double x, double y) - double fmax (double x, double y) - double fmin (double x, double y) - double fabs (double x) - double abs (double x) * double fma (double x, double y, double z) - fpclassify {macro} - isfinite {macro} - isinf {macro} - isnan {macro} - isnormal {macro} - signibit {macro} - isgreater {macro} - isgreaterequal {macro} - isless {macro} - islessequal {macro} - islessgreater {macro} - isunordered {macro} - NAN {float} - HUGE_VAL {double} - FP_FAST_FMA {macro} - FP_INFINITE {macro} - FP_NAN {macro} - FP_NORMAL {macro} - FP_SUBNORMAL {macro} - FP_ZERO {macro} - FP_ILOGB0 {macro} - FP_ILOGBNAN {macro} - float_t {float+} setjmp.h - void longjmp (jmp_buf env, int val) - setjmp {macro} - jmp_buf {type} signal.h stdarg.h void va_start (va_list list, {parameter}) T va_arg (va_list list, T) void va_end (va_list list) void va_copy (va_list dest, va_list src) va_list {builtin-type} stddef.h ptrdiff_t {signed int} size_t {unsigned int} ssize_t {signed int} size_t offsetof (type{struct,union},member) NULL (void *)(0L) stdio.h - int remove (const char *filename) - int rename (const char *oldname, const char *newname) - FILE *tmpfile (void) - char *tmpnam (char *str) - int fclose (FILE *) - int fflush (FILE *) - FILE *fopen (const char *filename, const char *mode) - FILE *freopen (const char *filename, const char *mode, FILE *stream) - void setbuf (FILE *stream, char *buffer) - int setvbuf (FILE *stream, char *buffer, int mode, size_t size) - int fprintf (FILE *stream, const char *format, ...) - int fscanf (FILE *stream, const char *format, ...) - int printf (const char *format, ...) - int scanf (const char *format, ...) int sprintf (char *str, const char *format, ...) int snprintf (char *str, size_t size, const char *format, ...),C99 - int sscanf (const char *str, const char *format, ...) int vsnprintf (char *str, size_t size, const char *format, va_list args),C99 - int vfprintf (FILE *stream, const char *format, va_list args) int vsprintf (char *str, const char *format, va_list args) - int fgetc (FILE *stream) - char *fgets (char *str, int max, FILE *stream) - int fputc (int character, FILE *stream) - int fputs (const char *str, FILE *stream) * int getc (FILE *stream) - int getchar (void) - char *gets (char *str) - int putc (int character, FILE *stream) - int putchar (int character) - int puts (const char *str) - int ungetc (int character, FILE *stream) - size_t fread (void *ptr, size_t size, size_t count, FILE *stream) - size_t fwrite (const void *ptr, size_t size, size_t count, FILE *stream) - int fgetpos (FILE *stream, fpos_t *pos) - int fseek (FILE *stream, int offset, int origin) - int fsetpos (FILE *stream, const fpos_t *pos) - int ftell (FILE *stream) - void rewind (FILE *stream) - void clearerr (FILE *stream) - int feof (FILE *stream) - int ferror (FILE *stream) - void perror (const char *str) - BUFSIZ {macro} - EOF {macro} - FILENAME_MAX {macro} - FOPEN_MAX {macro} - L_tmpnam {macro} NULL (void *)(0L) - TMP_MAX {macro} - _IOFBF {macro} - _IOLBF {macro} - _IONBF {macro} - SEEK_SET {enum member} - SEEK_CUR {enum member} - SEEK_END {enum member} - FILE {struct} - fpos_t {type} size_t {unsigned int} stdlib.h double atof (const char *str) int atoi (const char *str) - double strtod (const char *str) int rand (void) void srand (unsigned int) void *calloc (size_t num, size_t size) void free (void *ptr) void *malloc (size_t size) void *realloc (void *ptr, size_t size) - void abort (void) - int atexit (void (*func)(void)) - void exit (int status) - char *getenv (const char *name) - int system (const char *command) - void *bsearch (const void *key, const void *base, size_t num, size_t size, int (*compare)(const void *,const void *)) - void qsort (void *base, size_t num, size_t size, int (*compare)(const void *,const void *)) int abs (int n) div_t div (int numer, int denom) EXIT_FAILURE {macro} EXIT_SUCCESS {macro} NULL (void *)(0L) RAND_MAX {macro} div_t {struct} size_t {unsigned int} string.h - memcpy - memmove - strcpy - strncpy - strcat - strncat - memcmp - strcmp - strcoll - strncmp - strxfrm - memchr - strchr - strcspn - strpbrk - strrchr - strspn - strstr - strtok - memset - strerror - strlen time.h - clock_t clock (void) - double difftime (time_t end, time_t beginning) - time_t mktime (struct tm *timeptr) - time_t time (time_t *timer) - char *asctime (const struct tm *timeptr) - char *ctime (const time_t *timer) - struct tm *gmtime (const time_t *timer) - struct tm *localtime (const time_t *timer) - size_t strftime (char *ptr, size_t maxsize, const char *format, const struct tm *timeptr) - CLOCKS_PER_SEC {macro} - NULL (void *)(0L) - clock_t {signed int} - size_t {unsigned int} - time_t {unsigned int} - struct tm {struct} (Main source : C++ Reference at cplusplus.com/reference) /******************************************** ** ** Notes. ** ********************************************/ math.h - fma() shoud use a specific Asm instruction that is made for this operation. stdio.h - getc() and putc() should be implemented as macros. If not, they become the same as fgetc() and fputc(). /******************************************** ** ** Other notes. ** ********************************************/ Lists of macros shared between all the headers. :: Standard macros __cplusplus Shall be used in every header to insert 'extern "C" {' and '}' if needed, in order to make headers C++-compatible. :: Types and generic macros for definitions Every type definition shall test if the type hasn't already be defined. Therefore, it must test the definition of the corresponding macro, and define it if it's not as well. _PTRDIFF_T _SIZE_T _SSIZE_T _NULL _DIV_T _STRUCT_LCONV _ENUM_LCONV_CATEGORY :: Internal macros __NEED___BASE_PRINTF Used in printf() family functions. If defined, defines __base_printf(). If not, __base_printf() cannot be used. __NO_ABS Prevents the abs() macro to be defined. Used in stdlib/abs.c. Header macro format. Each header must be associated a macro, that shall use the following pattern : _HEADERNAME_EXTENSION For example, the macro matching 'stdlib.h' is '_STDLIB_H'. Macro symbols definition. Every defined symbol should be matched a value of 1. #define _PTRDIFF_T 1 It allows the user program to make test on these symbols, as they are replaced. Other conventions Parameters names must be defined in the function prototype, in the header. Functions affected by locale. strcoll() and strxrfm(). Formatted functions from printf() and scanf() families. setlocale() and localeconv(). strtod(). Things to do. Finish __base_printf(). Reimplement calloc() and realloc() using malloc(), removing two system calls. Reimplement as many functions as possible in Asm if faster.