aboutsummaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-19 04:42:05 +0100
committereunhhu <[email protected]>2026-10-19 04:42:05 +0100
commit6596533b0d5fe10f3cab028d7fa69a40e5416ecd (patch)
tree9c5a64858ac749d892e673b7aab04928cd3bbe60 /cli
parent5a2292a389989b71b99ea582cf306cf1719d8aae (diff)
downloadpure-6596533b0d5fe10f3cab028d7fa69a40e5416ecd.tar.gz
pure-6596533b0d5fe10f3cab028d7fa69a40e5416ecd.zip
028's bytes alone as a state, made: module state type 6 read as a text state flagged PURE_TEXT_BYTES in state_flags (so serve's same_states compares it for queries and replaces), its TEXT_LOAD giving bytes and its TEXT_SET taking them, a cursor's ops on it refused (anchor in bytes) and an anchor in it refused at load; one store file text-NAME, the values record marking each bytes state (kind 7, its name, 8 zero bytes), a text state's file that is no UTF-8 its initial value when marked and store_error when not (as before); a replace carrying bytes to a text only when its draft is UTF-8, else opening the store's draft anew; pure-run shows a bytes state's hex; unit test bytes_states (seven starts from a store: 0xff and 0x00 kept, bytes to text to bytes to text with no UTF-8 and with it; three replaces; four refused); counts: b47 against b46 BFS with batches +0.12%, the rest within 0.001%; the bank's queries (s45 and s47 in turns, six each, bytes compared among them) in_credit -0.31%, per_branch -0.18%, ranks -0.11%, the rest within 0.01%, the seven answers the same bytes; Pure, Vega and aup checks green; 008, 028
Diffstat (limited to 'cli')
-rw-r--r--cli/pure-run.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/cli/pure-run.c b/cli/pure-run.c
index 67a3041..86ead6d 100644
--- a/cli/pure-run.c
+++ b/cli/pure-run.c
@@ -68,6 +68,12 @@ static void show_value_items(const PureModule *m, uint32_t record, const unsigne
putchar(']');
}
+static bool hex_span(void *context, PureSpan span) {
+ (void)context;
+ for (size_t i = 0; i < span.size; ++i) printf("%02x", span.data[i]);
+ return true;
+}
+
static void show_hex(PureSpan bytes) {
putchar('"');
for (size_t i = 0; i < bytes.size; ++i) printf("%02x", bytes.data[i]);
@@ -141,7 +147,11 @@ static void show(PureApp *app, const char *failure) {
printf("{\"states\":{");
for (uint32_t i = 0; i < m->states; ++i) {
printf("%s\"%s\":", i ? "," : "", m->state_names[i]);
- if (m->state_type[i] == PURE_STATE_TEXT) {
+ if (m->state_type[i] == PURE_STATE_TEXT && m->state_flags[i] & PURE_TEXT_BYTES) {
+ putchar('"'); /* a bytes state (028): its bytes' hex digits */
+ pure_draft_read(app->texts[i], 0, pure_draft_size(app->texts[i]), hex_span, NULL);
+ putchar('"');
+ } else if (m->state_type[i] == PURE_STATE_TEXT) {
putchar('"');
pure_draft_read(app->texts[i], 0, pure_draft_size(app->texts[i]), json_span, NULL);
putchar('"');