diff --git a/libc/docs/headers/stdio.rst b/libc/docs/headers/stdio.rst index 3cd355529d400..1833eb5acf8ab 100644 --- a/libc/docs/headers/stdio.rst +++ b/libc/docs/headers/stdio.rst @@ -1,93 +1,359 @@ +.. include:: ../check.rst + ======= stdio.h ======= -.. include:: ../check.rst - ---------------- -Source location ---------------- - -- The main source for string functions is located at: - ``libc/src/stdio`` with subdirectories for internal implementations. - ---------------------- -Implementation Status ---------------------- - -Formatted Input/Output Functions -================================ - -These functions take in format strings and arguments of various types and -convert either to or from those arguments. These functions are the current focus -(owner: michaelrj). - -============= ========= -Function Name Available -============= ========= -\*printf Mostly -\*scanf |check| -============= ========= - -``FILE`` Access -=============== - -These functions are used to interact with the ``FILE`` object type, which is an -I/O stream, often used to represent a file on the host's hard drive. Currently -the ``FILE`` object is only available on linux. - -============= ========= -Function Name Available -============= ========= -fopen |check| -freopen -fclose |check| -fflush |check| -setbuf |check| -setvbuf |check| -ftell |check| -fgetpos -fseek |check| -fsetpos -rewind -tmpfile -clearerr |check| -feof |check| -ferror |check| -flockfile |check| -funlockfile |check| -============= ========= - -Operations on system files -========================== +Macros +====== -These functions operate on files on the host's system, without using the -``FILE`` object type. They only take the name of the file being operated on. +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 -============= ========= -Function_Name Available -============= ========= -remove |check| -rename |check| -tmpnam -============= ========= + * - Macro + - Implemented + - C23 Standard Section + - POSIX Docs + * - BUFSIZ + - |check| + - 7.23.1 + - `POSIX.1-2024 `__ + * - EOF + - |check| + - 7.23.1 + - `POSIX.1-2024 `__ + * - FILENAME_MAX + - + - 7.23.1 + - `POSIX.1-2024 `__ + * - FOPEN_MAX + - + - 7.23.1 + - `POSIX.1-2024 `__ + * - L_ctermid + - + - + - `POSIX.1-2024 `__ + * - L_tmpnam + - + - 7.23.1 + - `POSIX.1-2024 `__ + * - SEEK_CUR + - |check| + - 7.23.1 + - `POSIX.1-2024 `__ + * - SEEK_END + - |check| + - 7.23.1 + - `POSIX.1-2024 `__ + * - SEEK_SET + - |check| + - 7.23.1 + - `POSIX.1-2024 `__ + * - TMP_MAX + - + - 7.23.1 + - `POSIX.1-2024 `__ + * - _IOFBF + - |check| + - 7.23.1 + - `POSIX.1-2024 `__ + * - _IOLBF + - |check| + - 7.23.1 + - `POSIX.1-2024 `__ + * - _IONBF + - |check| + - 7.23.1 + - `POSIX.1-2024 `__ + * - _PRINTF_NAN_LEN_MAX + - + - 7.23.1 + - + * - __STDC_VERSION_STDIO_H__ + - + - 7.23.1 + - + * - stderr + - |check| + - 7.23.1 + - `POSIX.1-2024 `__ + * - stdin + - |check| + - 7.23.1 + - `POSIX.1-2024 `__ + * - stdout + - |check| + - 7.23.1 + - `POSIX.1-2024 `__ -Unformatted ``FILE`` Input/Output Functions -=========================================== +Functions +========= -The ``gets`` function was removed in C11 for having no bounds checking and -therefor being impossible to use safely. +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 -============= ========= -Function Name Available -============= ========= -(f)getc |check| -fgets |check| -getchar |check| -fread |check| -(f)putc |check| -(f)puts |check| -putchar |check| -fwrite |check| -ungetc |check| -============= ========= + * - Function + - Implemented + - C23 Standard Section + - POSIX Docs + * - clearerr + - |check| + - 7.23.10.1 + - `POSIX.1-2024 `__ + * - ctermid + - + - + - `POSIX.1-2024 `__ + * - dprintf + - + - + - `POSIX.1-2024 `__ + * - fclose + - |check| + - 7.23.5.1 + - `POSIX.1-2024 `__ + * - fdopen + - |check| + - + - `POSIX.1-2024 `__ + * - feof + - |check| + - 7.23.10.2 + - `POSIX.1-2024 `__ + * - ferror + - |check| + - 7.23.10.3 + - `POSIX.1-2024 `__ + * - fflush + - |check| + - 7.23.5.2 + - `POSIX.1-2024 `__ + * - fgetc + - |check| + - 7.23.7.1 + - `POSIX.1-2024 `__ + * - fgetpos + - + - 7.23.9.1 + - `POSIX.1-2024 `__ + * - fgets + - |check| + - 7.23.7.2 + - `POSIX.1-2024 `__ + * - fileno + - |check| + - + - `POSIX.1-2024 `__ + * - flockfile + - |check| + - + - `POSIX.1-2024 `__ + * - fmemopen + - + - + - `POSIX.1-2024 `__ + * - fopen + - |check| + - 7.23.5.3 + - `POSIX.1-2024 `__ + * - fprintf + - |check| + - 7.23.6.1 + - `POSIX.1-2024 `__ + * - fputc + - |check| + - 7.23.7.3 + - `POSIX.1-2024 `__ + * - fputs + - |check| + - 7.23.7.4 + - `POSIX.1-2024 `__ + * - fread + - |check| + - 7.23.8.1 + - `POSIX.1-2024 `__ + * - freopen + - + - 7.23.5.4 + - `POSIX.1-2024 `__ + * - fscanf + - |check| + - 7.23.6.2 + - `POSIX.1-2024 `__ + * - fseek + - |check| + - 7.23.9.2 + - `POSIX.1-2024 `__ + * - fseeko + - |check| + - + - `POSIX.1-2024 `__ + * - fsetpos + - + - 7.23.9.3 + - `POSIX.1-2024 `__ + * - ftell + - |check| + - 7.23.9.4 + - `POSIX.1-2024 `__ + * - ftello + - |check| + - + - `POSIX.1-2024 `__ + * - ftrylockfile + - + - + - `POSIX.1-2024 `__ + * - funlockfile + - |check| + - + - `POSIX.1-2024 `__ + * - fwrite + - |check| + - 7.23.8.2 + - `POSIX.1-2024 `__ + * - getc + - |check| + - 7.23.7.5 + - `POSIX.1-2024 `__ + * - getchar + - |check| + - 7.23.7.6 + - `POSIX.1-2024 `__ + * - getdelim + - + - + - `POSIX.1-2024 `__ + * - getline + - + - + - `POSIX.1-2024 `__ + * - open_memstream + - + - + - `POSIX.1-2024 `__ + * - pclose + - + - + - `POSIX.1-2024 `__ + * - perror + - + - 7.23.10.4 + - `POSIX.1-2024 `__ + * - popen + - + - + - `POSIX.1-2024 `__ + * - printf + - |check| + - 7.23.6.3 + - `POSIX.1-2024 `__ + * - putc + - |check| + - 7.23.7.7 + - `POSIX.1-2024 `__ + * - putc_unlocked + - + - + - `POSIX.1-2024 `__ + * - putchar + - |check| + - 7.23.7.8 + - `POSIX.1-2024 `__ + * - putchar_unlocked + - + - + - `POSIX.1-2024 `__ + * - puts + - |check| + - 7.23.7.9 + - `POSIX.1-2024 `__ + * - remove + - |check| + - 7.23.4.1 + - `POSIX.1-2024 `__ + * - rename + - |check| + - 7.23.4.2 + - `POSIX.1-2024 `__ + * - renameat + - + - + - `POSIX.1-2024 `__ + * - rewind + - + - 7.23.9.5 + - `POSIX.1-2024 `__ + * - scanf + - |check| + - 7.23.6.4 + - `POSIX.1-2024 `__ + * - setbuf + - |check| + - 7.23.5.5 + - `POSIX.1-2024 `__ + * - setvbuf + - |check| + - 7.23.5.6 + - `POSIX.1-2024 `__ + * - snprintf + - |check| + - 7.23.6.5 + - `POSIX.1-2024 `__ + * - sprintf + - |check| + - 7.23.6.6 + - `POSIX.1-2024 `__ + * - sscanf + - |check| + - 7.23.6.7 + - `POSIX.1-2024 `__ + * - tmpfile + - + - 7.23.4.3 + - `POSIX.1-2024 `__ + * - tmpnam + - + - 7.23.4.4 + - `POSIX.1-2024 `__ + * - ungetc + - |check| + - 7.23.7.10 + - `POSIX.1-2024 `__ + * - vdprintf + - + - + - `POSIX.1-2024 `__ + * - vfprintf + - |check| + - 7.23.6.8 + - `POSIX.1-2024 `__ + * - vfscanf + - |check| + - 7.23.6.9 + - `POSIX.1-2024 `__ + * - vprintf + - |check| + - 7.23.6.10 + - `POSIX.1-2024 `__ + * - vscanf + - |check| + - 7.23.6.11 + - `POSIX.1-2024 `__ + * - vsnprintf + - |check| + - 7.23.6.12 + - `POSIX.1-2024 `__ + * - vsprintf + - |check| + - 7.23.6.13 + - `POSIX.1-2024 `__ + * - vsscanf + - |check| + - 7.23.6.14 + - `POSIX.1-2024 `__ diff --git a/libc/utils/docgen/stdio.yaml b/libc/utils/docgen/stdio.yaml new file mode 100644 index 0000000000000..9dabee44a51c8 --- /dev/null +++ b/libc/utils/docgen/stdio.yaml @@ -0,0 +1,226 @@ +macros: + __STDC_VERSION_STDIO_H__: + c-definition: '7.23.1' + _IOFBF: + c-definition: '7.23.1' + in-latest-posix: '' + _IOLBF: + c-definition: '7.23.1' + in-latest-posix: '' + _IONBF: + c-definition: '7.23.1' + in-latest-posix: '' + BUFSIZ: + c-definition: '7.23.1' + in-latest-posix: '' + EOF: + c-definition: '7.23.1' + in-latest-posix: '' + FOPEN_MAX: + c-definition: '7.23.1' + in-latest-posix: '' + FILENAME_MAX: + c-definition: '7.23.1' + in-latest-posix: '' + _PRINTF_NAN_LEN_MAX: + c-definition: '7.23.1' + L_tmpnam: + c-definition: '7.23.1' + in-latest-posix: '' + L_ctermid: + in-latest-posix: '' + SEEK_CUR: + c-definition: '7.23.1' + in-latest-posix: '' + SEEK_END: + c-definition: '7.23.1' + in-latest-posix: '' + SEEK_SET: + c-definition: '7.23.1' + in-latest-posix: '' + TMP_MAX: + c-definition: '7.23.1' + in-latest-posix: '' + stderr: + c-definition: '7.23.1' + in-latest-posix: '' + stdin: + c-definition: '7.23.1' + in-latest-posix: '' + stdout: + c-definition: '7.23.1' + in-latest-posix: '' +functions: + remove: + c-definition: '7.23.4.1' + in-latest-posix: '' + rename: + c-definition: '7.23.4.2' + in-latest-posix: '' + tmpfile: + c-definition: '7.23.4.3' + in-latest-posix: '' + tmpnam: + c-definition: '7.23.4.4' + in-latest-posix: '' + fclose: + c-definition: '7.23.5.1' + in-latest-posix: '' + fflush: + c-definition: '7.23.5.2' + in-latest-posix: '' + fopen: + c-definition: '7.23.5.3' + in-latest-posix: '' + freopen: + c-definition: '7.23.5.4' + in-latest-posix: '' + setbuf: + c-definition: '7.23.5.5' + in-latest-posix: '' + setvbuf: + c-definition: '7.23.5.6' + in-latest-posix: '' + fprintf: + c-definition: '7.23.6.1' + in-latest-posix: '' + fscanf: + c-definition: '7.23.6.2' + in-latest-posix: '' + printf: + c-definition: '7.23.6.3' + in-latest-posix: '' + scanf: + c-definition: '7.23.6.4' + in-latest-posix: '' + snprintf: + c-definition: '7.23.6.5' + in-latest-posix: '' + sprintf: + c-definition: '7.23.6.6' + in-latest-posix: '' + sscanf: + c-definition: '7.23.6.7' + in-latest-posix: '' + vfprintf: + c-definition: '7.23.6.8' + in-latest-posix: '' + vfscanf: + c-definition: '7.23.6.9' + in-latest-posix: '' + vprintf: + c-definition: '7.23.6.10' + in-latest-posix: '' + vscanf: + c-definition: '7.23.6.11' + in-latest-posix: '' + vsnprintf: + c-definition: '7.23.6.12' + in-latest-posix: '' + vsprintf: + c-definition: '7.23.6.13' + in-latest-posix: '' + vsscanf: + c-definition: '7.23.6.14' + in-latest-posix: '' + fgetc: + c-definition: '7.23.7.1' + in-latest-posix: '' + fgets: + c-definition: '7.23.7.2' + in-latest-posix: '' + fputc: + c-definition: '7.23.7.3' + in-latest-posix: '' + fputs: + c-definition: '7.23.7.4' + in-latest-posix: '' + getc: + c-definition: '7.23.7.5' + in-latest-posix: '' + getchar: + c-definition: '7.23.7.6' + in-latest-posix: '' + putc: + c-definition: '7.23.7.7' + in-latest-posix: '' + putchar: + c-definition: '7.23.7.8' + in-latest-posix: '' + puts: + c-definition: '7.23.7.9' + in-latest-posix: '' + ungetc: + c-definition: '7.23.7.10' + in-latest-posix: '' + fread: + c-definition: '7.23.8.1' + in-latest-posix: '' + fwrite: + c-definition: '7.23.8.2' + in-latest-posix: '' + fgetpos: + c-definition: '7.23.9.1' + in-latest-posix: '' + fseek: + c-definition: '7.23.9.2' + in-latest-posix: '' + fsetpos: + c-definition: '7.23.9.3' + in-latest-posix: '' + ftell: + c-definition: '7.23.9.4' + in-latest-posix: '' + rewind: + c-definition: '7.23.9.5' + in-latest-posix: '' + clearerr: + c-definition: '7.23.10.1' + in-latest-posix: '' + feof: + c-definition: '7.23.10.2' + in-latest-posix: '' + ferror: + c-definition: '7.23.10.3' + in-latest-posix: '' + perror: + c-definition: '7.23.10.4' + in-latest-posix: '' + ctermid: + in-latest-posix: '' + dprintf: + in-latest-posix: '' + fdopen: + in-latest-posix: '' + fileno: + in-latest-posix: '' + flockfile: + in-latest-posix: '' + fmemopen: + in-latest-posix: '' + fseeko: + in-latest-posix: '' + ftello: + in-latest-posix: '' + ftrylockfile: + in-latest-posix: '' + funlockfile: + in-latest-posix: '' + getdelim: + in-latest-posix: '' + getline: + in-latest-posix: '' + open_memstream: + in-latest-posix: '' + pclose: + in-latest-posix: '' + popen: + in-latest-posix: '' + putc_unlocked: + in-latest-posix: '' + putchar_unlocked: + in-latest-posix: '' + renameat: + in-latest-posix: '' + vdprintf: + in-latest-posix: ''