|
libsnobol4 1.0.2
High-performance SNOBOL4-style pattern matching library
|
SNOBOL4 built-in comparison and type-checking functions. More...


Go to the source code of this file.
Functions | |
| double | snobol_str_to_double (const char *s, size_t len) |
| bool | snobol_eq (const char *a, size_t a_len, const char *b, size_t b_len) |
| bool | snobol_ne (const char *a, size_t a_len, const char *b, size_t b_len) |
| bool | snobol_lt (const char *a, size_t a_len, const char *b, size_t b_len) |
| bool | snobol_gt (const char *a, size_t a_len, const char *b, size_t b_len) |
| bool | snobol_le (const char *a, size_t a_len, const char *b, size_t b_len) |
| bool | snobol_ge (const char *a, size_t a_len, const char *b, size_t b_len) |
| bool | snobol_ident (const char *a, size_t a_len, const char *b, size_t b_len) |
| bool | snobol_differ (const char *a, size_t a_len, const char *b, size_t b_len) |
| bool | snobol_lexeq (const char *a, size_t a_len, const char *b, size_t b_len) |
| bool | snobol_lexlt (const char *a, size_t a_len, const char *b, size_t b_len) |
| bool | snobol_lexgt (const char *a, size_t a_len, const char *b, size_t b_len) |
| bool | snobol_integer (const char *str, size_t len) |
| bool | snobol_real (const char *str, size_t len) |
| bool | snobol_numeric (const char *str, size_t len) |
SNOBOL4 built-in comparison and type-checking functions.
Comparison functions use lexicographic (byte-level) ordering. Type predicates check string format for numeric types.
All predicates return true (succeed) or false (fail), matching SNOBOL4 semantics where a failing function causes the enclosing pattern to fail.
Definition in file type_fn.h.
| bool snobol_differ | ( | const char * | a, |
| size_t | a_len, | ||
| const char * | b, | ||
| size_t | b_len ) |
DIFFER: difference predicate – succeeds if two strings differ. Logical inverse of IDENT.
| a | First string |
| a_len | Byte length of first string |
| b | Second string |
| b_len | Byte length of second string |
| bool snobol_eq | ( | const char * | a, |
| size_t | a_len, | ||
| const char * | b, | ||
| size_t | b_len ) |
EQ: numeric equality – succeeds if a == b numerically. Both strings are converted to double before comparison.
| a | First string |
| a_len | Byte length |
| b | Second string |
| b_len | Byte length |
| bool snobol_ge | ( | const char * | a, |
| size_t | a_len, | ||
| const char * | b, | ||
| size_t | b_len ) |
GE: greater-than-or-equal – succeeds if a >= b numerically.
| a | First string |
| a_len | Byte length |
| b | Second string |
| b_len | Byte length |
| bool snobol_gt | ( | const char * | a, |
| size_t | a_len, | ||
| const char * | b, | ||
| size_t | b_len ) |
GT: greater-than – succeeds if a > b numerically.
| a | First string |
| a_len | Byte length |
| b | Second string |
| b_len | Byte length |
| bool snobol_ident | ( | const char * | a, |
| size_t | a_len, | ||
| const char * | b, | ||
| size_t | b_len ) |
IDENT: identity predicate – succeeds if two strings are identical. Equivalent to strcmp == 0 on strings.
| a | First string (UTF-8) |
| a_len | Byte length of first string |
| b | Second string (UTF-8) |
| b_len | Byte length of second string |
| bool snobol_integer | ( | const char * | str, |
| size_t | len ) |
INTEGER: type predicate – succeeds if the string represents an integer. Valid format: optional +/- sign followed by one or more decimal digits.
| str | Input string |
| len | Byte length |
| bool snobol_le | ( | const char * | a, |
| size_t | a_len, | ||
| const char * | b, | ||
| size_t | b_len ) |
LE: less-than-or-equal – succeeds if a <= b numerically.
| a | First string |
| a_len | Byte length |
| b | Second string |
| b_len | Byte length |
| bool snobol_lexeq | ( | const char * | a, |
| size_t | a_len, | ||
| const char * | b, | ||
| size_t | b_len ) |
LEXEQ: lexical equality – succeeds if a == b lexicographically. Uses memcmp with length comparison.
| a | First string |
| a_len | Byte length |
| b | Second string |
| b_len | Byte length |
| bool snobol_lexgt | ( | const char * | a, |
| size_t | a_len, | ||
| const char * | b, | ||
| size_t | b_len ) |
LEXGT: lexical greater-than – succeeds if a > b lexicographically.
| a | First string |
| a_len | Byte length |
| b | Second string |
| b_len | Byte length |
| bool snobol_lexlt | ( | const char * | a, |
| size_t | a_len, | ||
| const char * | b, | ||
| size_t | b_len ) |
LEXLT: lexical less-than – succeeds if a < b lexicographically.
| a | First string |
| a_len | Byte length |
| b | Second string |
| b_len | Byte length |
| bool snobol_lt | ( | const char * | a, |
| size_t | a_len, | ||
| const char * | b, | ||
| size_t | b_len ) |
LT: less-than – succeeds if a < b numerically.
| a | First string |
| a_len | Byte length |
| b | Second string |
| b_len | Byte length |
| bool snobol_ne | ( | const char * | a, |
| size_t | a_len, | ||
| const char * | b, | ||
| size_t | b_len ) |
NE: numeric inequality – succeeds if a != b numerically.
| a | First string |
| a_len | Byte length |
| b | Second string |
| b_len | Byte length |
| bool snobol_numeric | ( | const char * | str, |
| size_t | len ) |
NUMERIC: union type predicate – succeeds if the string is INTEGER or REAL. Equivalent to: snobol_integer(str, len) || snobol_real(str, len)
| str | Input string |
| len | Byte length |
| bool snobol_real | ( | const char * | str, |
| size_t | len ) |
REAL: type predicate – succeeds if the string represents a real number. Valid format: optional sign, digits, optional decimal point + digits, optional exponent (e/E with optional sign and digits). Example: "12.34", "1.23e-4", "-0.5", "+1E10"
| str | Input string |
| len | Byte length |
| double snobol_str_to_double | ( | const char * | s, |
| size_t | len ) |
Convert a length-bounded string to double, following SNOBOL4 numeric conversion semantics (non-numeric strings yield 0.0).
| s | Input string (UTF-8, not necessarily null-terminated) |
| len | Byte length of input |