Auto-generate some documentation

This commit is contained in:
Justine Tunney 2020-12-26 02:09:07 -08:00
parent 117d0111ab
commit 13437dd19b
97 changed files with 2033 additions and 661 deletions

View file

@ -19,6 +19,9 @@
*/
#include "libc/str/str.h"
/**
* Returns nonzero if c is lower, alpha, or digit.
*/
int isalnum(int c) {
return ('0' <= c && c <= '9') || ('A' <= c && c <= 'Z') ||
('a' <= c && c <= 'z');

View file

@ -19,6 +19,9 @@
*/
#include "libc/str/str.h"
/**
* Returns nonzero if c is upper or lower.
*/
int isalpha(int c) {
return ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z');
}

View file

@ -19,6 +19,9 @@
*/
#include "libc/str/str.h"
/**
* Returns nonzero if c is ascii.
*/
int isascii(int c) {
return 0x00 <= c && c <= 0x7F;
}

View file

@ -19,6 +19,9 @@
*/
#include "libc/str/str.h"
/**
* Returns nonzero if c is space or tab.
*/
int isblank(int c) {
return c == ' ' || c == '\t';
}

View file

@ -19,6 +19,9 @@
*/
#include "libc/str/str.h"
/**
* Returns nonzero if c is C0 ASCII control code or DEL.
*/
int iscntrl(int c) {
return (0x00 <= c && c <= 0x1F) || c == 0x7F;
}

View file

@ -19,6 +19,9 @@
*/
#include "libc/str/str.h"
/**
* Returns nonzero if c is decimal digit.
*/
int isdigit(int c) {
return '0' <= c && c <= '9';
}

View file

@ -19,6 +19,9 @@
*/
#include "libc/str/str.h"
/**
* Returns nonzero if c is lowercase alpha ascii character.
*/
int islower(int c) {
return 'a' <= c && c <= 'z';
}

View file

@ -19,6 +19,9 @@
*/
#include "libc/str/str.h"
/**
* Returns true if c is space, \t, \r, \n, \f, or \v.
*/
int isspace(int c) {
return c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\f' ||
c == '\v';

View file

@ -19,6 +19,9 @@
*/
#include "libc/str/str.h"
/**
* Returns nonzero if c is uppercase alpha ascii character.
*/
int isupper(int c) {
return 'A' <= c && c <= 'Z';
}

View file

@ -19,6 +19,9 @@
*/
#include "libc/str/str.h"
/**
* Returns nonzero if wc is C0 or C1 control code.
*/
int iswcntrl(wint_t wc) {
return (0x00 <= wc && wc <= 0x1F) || (0x7F <= wc && wc <= 0x9F);
}

View file

@ -19,6 +19,9 @@
*/
#include "libc/str/str.h"
/**
* Returns true if c is hexadecimal digit.
*/
int isxdigit(int c) {
return ('0' <= c && c <= '9') || ('A' <= c && c <= 'F') ||
('a' <= c && c <= 'f');

View file

@ -28,17 +28,17 @@
*
* For example, strictly:
*
* char buf[16];
* CHECK_NOTNULL(memccpy(buf, s, '\0', sizeof(buf)));
* char buf[16];
* CHECK_NOTNULL(memccpy(buf, s, '\0', sizeof(buf)));
*
* Or unstrictly:
*
* if (!memccpy(buf, s, '\0', sizeof(buf))) strcpy(buf, "?");
* if (!memccpy(buf, s, '\0', sizeof(buf))) strcpy(buf, "?");
*
* Are usually more sensible than the following:
*
* char cstrbuf[16];
* snprintf(cstrbuf, sizeof(cstrbuf), "%s", CSTR);
* char cstrbuf[16];
* snprintf(cstrbuf, sizeof(cstrbuf), "%s", CSTR);
*
* @return 𝑑 + idx(𝑐) + 1, or NULL if 𝑐 𝑠
* @note 𝑑 and 𝑠 can't overlap

View file

@ -23,6 +23,7 @@
* Prepares static search buffer.
*
* 1. If SRC is too long, it's truncated and *not* NUL-terminated.
*
* 2. If SRC is too short, the remainder is zero-filled.
*
* Please note this function isn't designed to prevent untrustworthy

View file

@ -23,6 +23,7 @@
* Prepares static search buffer.
*
* 1. If SRC is too long, it's truncated and *not* NUL-terminated.
*
* 2. If SRC is too short, the remainder is zero-filled.
*
* Please note this function isn't designed to prevent untrustworthy