diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-20 12:02:09 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-20 12:02:09 +0000 |
| commit | 5a54ecdade484168846b8db83a7f41c5275059c0 (patch) | |
| tree | f3ce7fd6c81e8a747b9a2e19b94588c307bef243 /doc/language/function | |
| parent | be964b4df4db9f42e0b7d615c1cbfa6cf268e646 (diff) | |
docs(strings): document the embedded standard library and STRING values
Describe -no-std, C_STRING literals, library function semantics and
owning string lifetimes in the manuals and contributor guidance.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'doc/language/function')
| -rw-r--r-- | doc/language/function/cpsc-function-asc.7.md | 4 | ||||
| -rw-r--r-- | doc/language/function/cpsc-function-chr.7.md | 4 | ||||
| -rw-r--r-- | doc/language/function/cpsc-function-is_num.7.md | 2 | ||||
| -rw-r--r-- | doc/language/function/cpsc-function-lcase.7.md | 5 | ||||
| -rw-r--r-- | doc/language/function/cpsc-function-left.7.md | 2 | ||||
| -rw-r--r-- | doc/language/function/cpsc-function-length.7.md | 4 | ||||
| -rw-r--r-- | doc/language/function/cpsc-function-mid.7.md | 2 | ||||
| -rw-r--r-- | doc/language/function/cpsc-function-num_to_str.7.md | 2 | ||||
| -rw-r--r-- | doc/language/function/cpsc-function-right.7.md | 2 | ||||
| -rw-r--r-- | doc/language/function/cpsc-function-str_to_num.7.md | 4 | ||||
| -rw-r--r-- | doc/language/function/cpsc-function-ucase.7.md | 5 |
11 files changed, 30 insertions, 6 deletions
diff --git a/doc/language/function/cpsc-function-asc.7.md b/doc/language/function/cpsc-function-asc.7.md index 17ba8fe..6cc8cb6 100644 --- a/doc/language/function/cpsc-function-asc.7.md +++ b/doc/language/function/cpsc-function-asc.7.md @@ -13,7 +13,9 @@ ASC(text : STRING) RETURNS INTEGER # DESCRIPTION -Return the unsigned byte code of the character, or of the first byte of a string. Use a nonempty string; for ASCII characters this is the ASCII code. +Provided by the standard string library, loaded and linked by default. + +Return the unsigned byte code of the character, or of the first byte of a string. An empty string returns zero; for ASCII characters this is the ASCII code. # EXAMPLE diff --git a/doc/language/function/cpsc-function-chr.7.md b/doc/language/function/cpsc-function-chr.7.md index 1eab413..cc471a5 100644 --- a/doc/language/function/cpsc-function-chr.7.md +++ b/doc/language/function/cpsc-function-chr.7.md @@ -12,7 +12,9 @@ CHR(code : INTEGER) RETURNS STRING # DESCRIPTION -Convert the low eight bits of code to a one-byte string. The result is STRING, not CHAR. Use ASCII codes 1 to 127 for ordinary text; code 0 produces an empty string. +Provided by the standard string library, loaded and linked by default. + +Convert the low eight bits of code to a one-byte string. The result is STRING, not CHAR. Use ASCII codes 1 to 127 for ordinary text; code 0 produces one NUL byte, so LENGTH(CHR(0)) is 1. # EXAMPLE diff --git a/doc/language/function/cpsc-function-is_num.7.md b/doc/language/function/cpsc-function-is_num.7.md index a1fe34e..efb5f1a 100644 --- a/doc/language/function/cpsc-function-is_num.7.md +++ b/doc/language/function/cpsc-function-is_num.7.md @@ -12,6 +12,8 @@ IS_NUM(text : STRING) RETURNS BOOLEAN # DESCRIPTION +Provided by the standard string library, loaded and linked by default. + Return true for a nonempty string fully consumed by the runtime's numeric conversion. Leading whitespace is accepted; trailing whitespace or other trailing text is rejected. # EXAMPLE diff --git a/doc/language/function/cpsc-function-lcase.7.md b/doc/language/function/cpsc-function-lcase.7.md index a2cbf44..0d542be 100644 --- a/doc/language/function/cpsc-function-lcase.7.md +++ b/doc/language/function/cpsc-function-lcase.7.md @@ -7,12 +7,15 @@ cpsc-function-lcase - convert text to lower case # SYNOPSIS ```text +LCASE(character : CHAR) RETURNS CHAR LCASE(text : STRING) RETURNS STRING ``` # DESCRIPTION -Return a copy with letters converted to lower case. Unlike guide section 5.5's CHAR-to-CHAR signature, cpsc accepts text and returns STRING. Use ASCII text for predictable character conversion. +Provided by the standard string library, loaded and linked by default. + +Return a copy with letters converted to lower case. The CHAR overload follows guide section 5.5; the STRING overload is a compatibility extension. Use ASCII text for predictable character conversion. # EXAMPLE diff --git a/doc/language/function/cpsc-function-left.7.md b/doc/language/function/cpsc-function-left.7.md index 8f27e24..5bb5002 100644 --- a/doc/language/function/cpsc-function-left.7.md +++ b/doc/language/function/cpsc-function-left.7.md @@ -12,6 +12,8 @@ LEFT(text : STRING, count : INTEGER) RETURNS STRING # DESCRIPTION +Provided by the standard string library, loaded and linked by default. + Return up to count bytes from the beginning. Counts larger than the string length return the whole string; negative counts return an empty string. # EXAMPLE diff --git a/doc/language/function/cpsc-function-length.7.md b/doc/language/function/cpsc-function-length.7.md index fcdc47a..470b975 100644 --- a/doc/language/function/cpsc-function-length.7.md +++ b/doc/language/function/cpsc-function-length.7.md @@ -12,7 +12,9 @@ LENGTH(text : STRING) RETURNS INTEGER # DESCRIPTION -Return the number of bytes before the string terminator. String operations are byte-based, so this is not a Unicode character count. +Provided by the standard string library, loaded and linked by default. + +Return the number of bytes in the owning string, including embedded NUL bytes. String operations are byte-based, so this is not a Unicode character count. # EXAMPLE diff --git a/doc/language/function/cpsc-function-mid.7.md b/doc/language/function/cpsc-function-mid.7.md index 0956b43..e033543 100644 --- a/doc/language/function/cpsc-function-mid.7.md +++ b/doc/language/function/cpsc-function-mid.7.md @@ -12,6 +12,8 @@ MID(text : STRING, start : INTEGER, count : INTEGER) RETURNS STRING # DESCRIPTION +Provided by the standard string library, loaded and linked by default. + Return up to count bytes starting at the one-based position start. Positions below 1 clamp to 1; positions beyond the end return an empty string. The count clamps to the available bytes; negative counts return an empty string. # EXAMPLE diff --git a/doc/language/function/cpsc-function-num_to_str.7.md b/doc/language/function/cpsc-function-num_to_str.7.md index fb8e6fd..39b6890 100644 --- a/doc/language/function/cpsc-function-num_to_str.7.md +++ b/doc/language/function/cpsc-function-num_to_str.7.md @@ -12,6 +12,8 @@ NUM_TO_STR(number : INTEGER or REAL) RETURNS STRING # DESCRIPTION +Provided by the standard string library, loaded and linked by default. + Format INTEGER as signed decimal text and REAL with six digits after the decimal point. # EXAMPLE diff --git a/doc/language/function/cpsc-function-right.7.md b/doc/language/function/cpsc-function-right.7.md index 2f70fbd..89e58af 100644 --- a/doc/language/function/cpsc-function-right.7.md +++ b/doc/language/function/cpsc-function-right.7.md @@ -12,6 +12,8 @@ RIGHT(text : STRING, count : INTEGER) RETURNS STRING # DESCRIPTION +Provided by the standard string library, loaded and linked by default. + Return up to count bytes from the end. Use a nonnegative count. Counts larger than the string length return the whole string. # EXAMPLE diff --git a/doc/language/function/cpsc-function-str_to_num.7.md b/doc/language/function/cpsc-function-str_to_num.7.md index b0ceef2..acdf60b 100644 --- a/doc/language/function/cpsc-function-str_to_num.7.md +++ b/doc/language/function/cpsc-function-str_to_num.7.md @@ -12,7 +12,9 @@ STR_TO_NUM(text : STRING) RETURNS REAL # DESCRIPTION -Return REAL, including for integer-looking text. Conversion can stop at trailing text; invalid text returns zero. Use IS_NUM first when the whole string must be a valid number. +Provided by the standard string library, loaded and linked by default. + +Return REAL, including for integer-looking text. The whole string must be consumed. Invalid text, trailing junk and values outside the REAL range throw a catchable exception. Use IS_NUM first to check numeric text without throwing for invalid input. # EXAMPLE diff --git a/doc/language/function/cpsc-function-ucase.7.md b/doc/language/function/cpsc-function-ucase.7.md index 728ae14..868c448 100644 --- a/doc/language/function/cpsc-function-ucase.7.md +++ b/doc/language/function/cpsc-function-ucase.7.md @@ -7,12 +7,15 @@ cpsc-function-ucase - convert text to upper case # SYNOPSIS ```text +UCASE(character : CHAR) RETURNS CHAR UCASE(text : STRING) RETURNS STRING ``` # DESCRIPTION -Return a copy with letters converted to upper case. Unlike guide section 5.5's CHAR-to-CHAR signature, cpsc accepts text and returns STRING. Use ASCII text for predictable character conversion. +Provided by the standard string library, loaded and linked by default. + +Return a copy with letters converted to upper case. The CHAR overload follows guide section 5.5; the STRING overload is a compatibility extension. Use ASCII text for predictable character conversion. # EXAMPLE |
