aboutsummaryrefslogtreecommitdiffstats
path: root/core/module-text.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-13 07:40:30 +0100
committereunhhu <[email protected]>2026-10-13 07:40:30 +0100
commit8481b12fb794690cce0d9c54032ffba3de1fe31d (patch)
tree55a7f3c74b8521b84262acb4cf444ddda9ef5070 /core/module-text.h
parentd83ccb2e3b3d276577c61b30a4a323909a654690 (diff)
downloadpure-8481b12fb794690cce0d9c54032ffba3de1fe31d.tar.gz
pure-8481b12fb794690cce0d9c54032ffba3de1fe31d.zip
Module format and executor: 027's stage 2b, lists in records: a record field of type LIST (its items' record in its default) holds a list the event made, its number an i64 in the cell (0 an empty one), so lists keep their inside, batches and the JIT as they were (the JIT's append fast path leaves such records alone); LIST_VALUE (a copy of an event's list, nothing made for an empty one), LIST_BIND (a register, an event's list flagged PURE_LIST_BOUND, read and walked, never changed by code), APPEND_IN (an item into the list in a field of an event's list's item, copied first when another value shares it or a register is bound to it), sharing counted where cells take them; such records only in event lists (no stored, transient or message list, no key); the event's lists go as each event or view's body begins, registers given back their own; record field names may be paths (at.x: records in records, flattened by aup); NUM_PARSE (a text written as a JSON number, its nearest double, core's pure_parse_number); unit tests (values copied, shared then appended, a bound register seeing what it was bound to, three events alike, 6 refused; under ASan and UBSan too, which found the record kinds' missing LIST)
Diffstat (limited to 'core/module-text.h')
-rw-r--r--core/module-text.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/module-text.h b/core/module-text.h
index 4843928..e718a40 100644
--- a/core/module-text.h
+++ b/core/module-text.h
@@ -24,6 +24,10 @@ size_t pure_utf8_newlines(PureSpan span);
* exponent. -0 prints as 0. Returns the length written (at most 32). */
size_t pure_format_number(double value, char out[32]);
+/* A number written as JSON writes one, -?(0|[1-9][0-9]*)(.[0-9]+)?([eE][+-]?[0-9]+)?, as the nearest double (ties to
+ * even): false where the text is not one or its value is not finite (027's NUM_PARSE). */
+bool pure_parse_number(const unsigned char *text, size_t size, double *value);
+
/* Positions in one version of a text draft (size is version.bytes). */
size_t pure_text_step(const PureDraft *, PureVersion, size_t position, double count);
size_t pure_text_line_step(const PureDraft *, PureVersion, size_t position, double count);