interplane.Get Omega
Read in your language

aienos.com

Source of www.aienos.com, served from my own hardware

Brought by drakestapleton

branch main Branches Tags History

aienos.com / om / site / verify-data.om

1474 lines · 39617 bytes Raw Blame History
1note verify-data.om: fail-closed validation of every published data file and the source inputs
2note the generator reads (rules B1-B4 plus the oracle.rs verify_data gates). Callable before any
3note output is written: sv_vinit, then sv_vdata kind path (kinds below); it returns true when
4note the file passes and reports every failure as `verify: FAIL <RULE> <path>: ...`.
5note Ports, with their Rust sources at baseline 3d36bd7 + the RustOracle lane (oracle.rs):
6note machines components/machines.rs parse(): serde deny_unknown_fields, check_text,
7note check_link, positive ceilings, speed <= its ceiling, on_main/branch, unique ids
8note omega components/omega.rs parse()+validate(), expand() short links
9note cuda components/cudaplusplus.rs parse()+validate()+check_status(), pinned expand()
10note research components/research_status.rs parse()+validate()
11note facts facts.rs Facts::load (serde shape; unknown fields allowed, known ones once)
12note agents components/agents.rs Repos::load
13note progress collector.rs validate_snapshot
14note status oracle.rs check_status
15note index oracle.rs check_data_index (exact DATA_FILES set, www url each)
16note pages oracle.rs check_pages_json (exact PAGES set, each once, title/description,
17note english == path)
18note now now.json parses
19note quotes data/quotes.json shape (ids unique) for the voice exemption
20note ledger ledger_public.rs check_public (project(x) == x)
21note Numbers stay lexical (json.om). Where serde would round through f64 this port accepts only
22note the exact cases and refuses the rest (documented per check): stricter, never looser.
23note Serde strings are any JSON string; sj_load already decoded escapes, so dash checks run on the
24note raw file bytes (Rust RAW.contains) AND on decoded strings (a \u2014 escape cannot slip by).
25text vrb1 "B1"
26text vrb2 "B2"
27text vrb3 "B3"
28text vrb4 "B4"
29text vrv1 "V1"
30text vrd1 "D1"
31text vrd2 "D2"
32text vrd3 "D3"
33text vrd4 "D4"
34text vrd5 "D5"
35text vrq "Q"
36text vrl "L"
37text vtjr "verify: reading "
38text vtnf "missing or unreadable file"
39text vtnob "not a JSON object"
40text vtnar "not a JSON array"
41text vtmis "missing field"
42text vtdup "duplicate field"
43text vtunk "unknown field (deny_unknown_fields)"
44text vttyp "field has the wrong JSON type"
45text vtdsh "em or en dash"
46text vtfor "forbidden comparison word"
47text vthttps "link must be a public https URL"
48text vtcpos "ceiling tok_s must be a positive plain decimal"
49text vtplain "tok_s must be a plain decimal (exponent forms are refused: no float rounding here)"
50text vtnomach "no machines"
51text vtnospd "no speeds"
52text vtedate "evidence_date must be YYYY-MM-DD (10 bytes)"
53text vtuceil "speed names an unknown ceiling"
54text vtnceil "a ceiling needs a numeric tok_s"
55text vtaceil "tok/s is above its ceiling"
56text vtonm "on_main is true but branch is not main"
57text vtdupid "duplicate id"
58text vtlay "the Omega layer map needs at least 13 rows"
59text vtstat "unknown status"
60text vtempty "empty cell"
61text vtbarc "the bar must be C1 to C6 in order"
62text vtbarp "the performance bar must be P0 to P4 in order"
63text vtpassr "PASS without a receipt"
64text vtpassu "PASS receipt must be under omega evidence/"
65text vtnpr "receipt on a row that is not PASS"
66text vtboxg "box link off the forge"
67text vtlink "bad or unknown short link"
68text vtodoc "source.doc must be omega docs/OMEGA.md"
69text vthops "the path needs at least 8 hops"
70text vtinp "IN PROGRESS needs its ledger id"
71text vtpasse "PASS needs a receipt under evidence/"
72text vtpain "a pain or swap row is PASS or IN PROGRESS"
73text vtcmd "a fixed row shows the command that proves it"
74text vtvis "source.visibility is private or public"
75text vtpin "a file on a branch must be pinned to a full commit"
76text vtallow "allowed list differs from the fixed set"
77text vtlevels "ladder levels must be exactly L0..L7+"
78text vtlstate "ladder step has an unknown state"
79text vtrlink "link must be on the forge or empty"
80text vtcur "current_level does not match the highest unbroken achieved step"
81text vtgap "ladder step achieved above an unachieved step"
82text vtrstat "turing row status outside the allowed set"
83text vtrcls "implementation row class outside the allowed set"
84text vtatt "attempt does not match its row, level or successor"
85text vtu64 "not an unsigned 64-bit integer"
86text vtsnap "Empty or invalid snapshot"
87text vtsord "Unordered snapshot dates"
88text vtsmet "Missing or invalid metric"
89text vtsrec "Snapshot totals do not reconcile"
90text vtslang "Language total mismatch"
91text vtssum "Summary differs from the latest snapshot"
92text vtsrepo "Duplicate repositories"
93text vtsprs "PR totals do not reconcile"
94text vtsci "CI totals do not reconcile"
95text vtscic "CI conclusions do not reconcile"
96text vtshead "Missing pinned head"
97text vtsurl "Invalid repository link"
98text vtst5 "statuses differ from the fixed set"
99text vtstl "no layers"
100text vtstn "layer without a name"
101text vtsts "layer has an unknown status"
102text vtstno "layer has no note"
103text vtstr "receipt must be null, a forge URL or a plain label"
104text vkfrg "https://interplane.io/"
105text vkcss "://"
106text vtixp "entry without a path"
107text vtixu "entry url must be https://www.aienos.com + path"
108text vtixd "path listed twice"
109text vtixm "differs from DATA_FILES"
110note vtixm2: the same words as vtixm, a distinct name because omc error 19 refuses one array in two params.
111text vtixm2 "differs from DATA_FILES"
112text vtpgm "differs from PAGES"
113text vtpgt "page without a title or description"
114text vtpge "english must equal path"
115text vtqid "quote id missing, empty or repeated"
116text vtqq "quote text missing or empty"
117text vtlh "ledger must be newline-terminated TSV with the exact header and no CR"
118text vtlc "ledger row has fewer than five or more than eight columns"
119text vtls "credential-shaped value in ledger"
120text vtle "email-shaped value in ledger"
121text vtlx "control character in ledger field"
122text vtlp "ledger is not its public projection"
123text vtsetx "data kind unknown"
124
125note ---------------------------------------------------------------- kinds and registries
126text vkmach "machines"
127text vkomega "omega"
128text vkcuda "cuda"
129text vkres "research"
130text vkfacts "facts"
131text vkagent "agents"
132text vkprog "progress"
133text vkstat "status"
134text vkindex "index"
135text vkpages "pages"
136text vknow "now"
137text vkquote "quotes"
138text vkledg "ledger"
139text vkengr "engineer"
140text vhost "https://www.aienos.com"
141note seo::PAGES without the /engineer/ pages, which the engineer record supplies (56 paths, in
142note seo.rs order). Every old URL stays listed; /allen/ is a redirect stub, not a page.
143text vpages "/\n/classic/\n/record/\n/start/\n/contact/\n/support/\n/privacy/\n/machine/\n/omega/\n/omega/reference/\n/cudaplusplus/\n/now/\n/dash/\n/hive/\n/aien/\n/alpha/\n/lab/\n/learn/\n/agents/\n/agents/hello/\n/agents/knowledge/\n/agora/\n/aienet/\n/agora/meet/\n/agora/protocol/\n/agora/network/\n/progress/\n/turing/\n/research/\n/research/computing-machinery-and-understanding/\n/research/computing-machinery-and-understanding/profiles/\n/research/computing-machinery-and-understanding-emergence/\n/research/the-turing-brief/\n/research/turing-discovery-gap-conjecture/\n/research/crumb-doctrine/\n/research/omega-language/\n/research/atemporal-aien-postulate/\n/research/the-aien-papers/\n/research/cuda-paper/\n/experiments/\n/discovery/\n/discoveries/\n/evidence/\n/research/status/\n/philosophy/\n/research/the-stapleton-doctrine/\n/post-llm-case/\n/owned/\n/call-to-humanity/\n/still-building/\n/switched-off/\n/quickstart/\n/spark/\n/blog/\n/blog/aien-v3-research-plan/\n/glossary/\n/licensing/\n"
144note seo::DATA_FILES, in seo.rs order (30 files).
145text vdfiles "/data/index.json\n/llms.txt\n/llms-full.txt\n/now.json\n/now/feed.xml\n/machines.json\n/omega.json\n/cudaplusplus.json\n/facts.json\n/status.json\n/research-status.json\n/data/project-progress.json\n/data/now.tsv\n/data/accounts.tsv\n/data/routing.tsv\n/feed.xml\n/sitemap.xml\n/sitemap.md\n/AGENTS.md\n/agents/RULES.md\n/data/agent-repos.json\n/data/pages.json\n/.well-known/agora\n/index.md\n/research/CITATION.cff\n/research/aien-research-plan.md\n/data/engineer.json\n/humans.txt\n/robots.txt\n/funding.json\n"
146
147note ---------------------------------------------------------------- serde shapes
148note One field per line: a type code, then the JSON key. s string, S Option<String> (missing,
149note null or string), a array, T array of strings, o object, O Option<object>, b bool,
150note B #[serde(default)] bool (missing or bool), n f64 (any number), N Option<f64>,
151note u u64 (non-negative integer token), L Vec<(String, String)> (arrays of exactly two strings).
152text vsmt "sas_of\nssource\nsjudging\naceilings\namachines\naspeeds\n"
153text vsmc "sid\nsmodel\nsmachine\nntok_s\nshow\nslink\nsreceipt\nsbranch\nbon_main\n"
154text vsml "slabel\nslink\n"
155text vsmm "sid\nsname\nsdetail\nsrole\nstoday\nsevidence_date\nsevidence\nslink\nsbranch\nbon_main\namore\n"
156text vsms "sid\nswhat\nsmodel\nsmachine\nsengine\nsvalue\nsdetail\nNtok_s\nsceiling\nsprevious\nsdate\nslink\nsreceipt\nsbranch\nbon_main\nsverdict\nsnote\n"
157text vctop "as_of\nsource\njudging\n"
158text vccei "model\nmachine\nhow\nreceipt\nbranch\n"
159text vcmac "name\ndetail\nrole\ntoday\nevidence_date\nevidence\nbranch\n"
160text vclnk "label\n"
161text vcspd "what\nmodel\nmachine\nengine\nvalue\ndetail\nprevious\ndate\nreceipt\nbranch\nverdict\nnote\n"
162note machines.rs FORBIDDEN, compared against the ASCII-lowercased text.
163text vforbid "faster than\nx faster\nllama.cpp\nvllm\nollama\nbeats \nbeat the\n"
164text vsot "osource\nsclaim\nTclaim_rest\nstrue_today\nsnot_true_yet\noseed_birth\naparts\nobelow\nalayers\noreceipt\nanot_yet\nabar\nabeyond\noperformance\n"
165text vsop "sstand\nshow\nLlinks\nsbox\nsrule\nabar\n"
166text vsos "sdoc\nsbranch\nscommit\nschecked\nsledger\nsissue\n"
167text vsoc "sname\nswhat\nLlinks\nsbox\n"
168text vsol "scuda\nsjob\nsomega\nsstatus\nsnote\nLlinks\nsbox\n"
169text vsor "stitle\nstaken\nswhat\nLfacts\nsbox\n"
170text vsog "stitle\nstext\nLlinks\nsbox\n"
171text vsosb "Ttext\nasteps\nTlimits\nLlinks\n"
172text vsost "sname\nswhat\nsbox\n"
173text vksb "seed_birth"
174text vtsb "seed_birth.steps must be 8 stages, each box pinned om@:<40-hex commit>/path"
175text vkompin "om@:"
176text vsob "sid\nstitle\nsdone_when\nsstatus\nsnow\nSreceipt\nLlinks\n"
177text vsct "osource\nsclaim\nTclaim_rest\nspurpose_title\nspurpose\nspurpose_link\nssource_note\nsaudit_link\nahops\nshow_lead\nasteps\nTdid_not\nsdid_not_box\nspain_lead\napains\nsswap_lead\naswaps\n"
178text vscs "srepo\nsreadme\nshow\nshow_branch\nshow_commit\nsmain_commit\nsomega_doc\nsomega_branch\nsomega_commit\nschecked\nsledger\nsvisibility\nsowner_ledger\n"
179text vsch "sstep\nscuda\nsours\nsstatus\nsnote\nSledger\nLlinks\nsbox\n"
180text vscc "stitle\nstext\nLlinks\nsbox\n"
181text vscr "stitle\nstext\nsstatus\nSledger\nScommand\nSreceipt\nLlinks\nsbox\n"
182text vsrt "sas_of\nssource_table\nosource_commits\nsevidence_hierarchy\naabbreviations\nTcaveats\nsturing_definition\nTallowed_statuses\nTallowed_ladder_states\nTallowed_classes\nocurrent_level\noindependent_rechecks\naladder\naattempts\naturing_rows\naimplementation_rows\n"
183text vsrsc "somega\nsaienos\nsaien_architecture\nsaienos_com\n"
184note research_status.rs IndependentRechecks (deny_unknown_fields): every link an https URL.
185text vsrir "sas_of\nsrule\nTlinks\n"
186text vkirc "independent_rechecks"
187text vsrab "sshort\nslong\n"
188text vsrcl "slevel\nssummary\nsoutside_scope\nsnote\nsmeaning\nslimitations\nsevidence\n"
189text vsrld "slevel\nsname\nsstate\nsdetail\nsbasis\nSlink\n"
190text vsrat "sid\nsbeside\nsoutcome\nssummary\nsled_to\n"
191text vsrtr "sid\nstitle\nsstatus\nsstatus_detail\nsplain\nSheadline\nSnot_yield\nsscope\nsclaim_level\nsreceipt\nscommit\nsdate\nslimitations\nsnext_dependency\nsevidence\nSlink\n"
192text vsrim "sid\nsclass\nsstatus_detail\nsscope\nsclaim_level\nsreceipt\nscommit\nsdate\nslimitations\nsnext_dependency\nsevidence\nSlink\n"
193text vsft "sgenerated_at\nacomponents\nadecisions\noreceipt\n"
194text vsfc "skey\nsname\nsrepo\nsrole\nsurl\nspushed_at\nuopen_prs\nOlast_merge\n"
195text vsfm "unumber\nstitle\nsmerged_at\nsurl\n"
196text vsfd "sid\nstitle\nsurl\n"
197text vsfr "srepo\nssha\nscommit_title\nscommitted_at\nsstate\nsdescription\nstarget_url\nsupdated_at\n"
198text vsat "sgenerated_at\nsorg\narepos\n"
199text vsar "sname\nsdescription\nsurl\nsdefault_branch\nbfork\nspushed_at\nBarchived\nSbrief\n"
200text vkid "id"
201text vkstatus "status"
202text vkrcpt "receipt"
203text vkbox "box"
204text vklinks "links"
205text vkfacts2 "facts"
206text vkledger "ledger"
207text vkcmd "command"
208text vktok "tok_s"
209text vkceil "ceiling"
210text vkceils "ceilings"
211text vkmachs "machines"
212text vkspeeds "speeds"
213text vkmore "more"
214text vklink "link"
215text vkedate "evidence_date"
216text vkonmain "on_main"
217text vkbranch "branch"
218text vkmain "main"
219text vkhttps "https://"
220text vkparts "parts"
221text vkbelow "below"
222text vklayers "layers"
223text vkcuda2 "cuda"
224text vkomg "omega"
225text vkjob "job"
226text vknotyet "not_yet"
227text vkbeyond "beyond"
228text vkbar "bar"
229text vkperf "performance"
230text vksource "source"
231text vkdoc "doc"
232text vkissue "issue"
233text vkodoc "o:docs/OMEGA.md"
234text vkoev "o:evidence/"
235text vkoev2 "o/:evidence/"
236text vkpass "PASS"
237text vkpart "PARTIAL"
238text vkmiss "MISSING"
239text vknotr "AS SHIPPED"
240text vkinpr "IN PROGRESS"
241text vknv "AS SHIPPED"
242text vbarc "C1\nC2\nC3\nC4\nC5\nC6\n"
243text vbarp "P0\nP1\nP2\nP3\nP4\n"
244text vkhops "hops"
245text vksteps "steps"
246text vkpains "pains"
247text vkswaps "swaps"
248text vkreadme "readme"
249text vkhow "how"
250text vkodoc2 "omega_doc"
251text vkplink "purpose_link"
252text vkalink "audit_link"
253text vkdnb "did_not_box"
254text vkvis "visibility"
255text vkpriv "private"
256text vkpub "public"
257text vkevid "evidence/"
258text vomap "om@:\no/:\nob:\no:\np:\nc@:\nc/:\nc:\na:\nb:\nissue:\n"
259note vopin: vomap's pin table, entry for entry; an entry starting with '1' is pinned (om@: needs a 40-hex commit). A separate text because omc error 19 refuses vomap in both params, see sv_xlinks.
260text vopin "1m@:\no/:\nob:\no:\np:\nc@:\nc/:\nc:\na:\nb:\nissue:\n"
261text vcmap "cp/:\ncp@:\ncp:\nom@:\nax@:\nsc@/:\ns:\n"
262text vcpin "0\n1\n0\n1\n1\n1\n0\n"
263text vdotdot ".."
264text vsp1 " "
265text vrstat "PASS\nFAIL\nINCOMPLETE\nBLOCKED\nPARTIAL\nNOT ESTABLISHED\nNOT STARTED\n"
266text vrlad "achieved\npartial\nnot achieved\nnot attempted\n"
267text vrcls "Implemented\nPartially implemented\nExperimental\nPlanned\nResearch hypothesis\n"
268text vrlev "L0\nL1\nL2\nL3\nL4\nL5\nL6\nL7+\n"
269text vkals "allowed_statuses"
270text vkall "allowed_ladder_states"
271text vkalc "allowed_classes"
272text vkladder "ladder"
273text vklevel "level"
274text vkstate "state"
275text vkach "achieved"
276text vkcur "current_level"
277text vktrows "turing_rows"
278text vkirows "implementation_rows"
279text vkclass "class"
280text vkatt "attempts"
281text vkbeside "beside"
282text vkoutc "outcome"
283text vkledto "led_to"
284text vkabbr "abbreviations"
285text vkscom "source_commits"
286text vkgh "https://interplane.io/drakestapleton/"
287text vkgh2 "github.com"
288text vkcomp "components"
289text vkdec "decisions"
290text vklm "last_merge"
291text vkrepos "repos"
292text vkseries "series"
293text vksum "summary"
294text vkasof "asof"
295text vkdate "date"
296text vklangs "langs"
297text vkname "name"
298text vkprc "prCount"
299text vkcic "ciCount"
300text vkcico "ciConclusions"
301text vkhead "head"
302text vkurl "url"
303text vmet "source\ntest\ndocs\nloc\nfiles\ntestfiles\ndocfiles\nrepos\ncommits\nprs\nmerged\nci\n"
304text vkloc "loc"
305text vktest "test"
306text vkmerged "merged"
307text vkprs "prs"
308text vktfiles "testfiles"
309text vkfiles "files"
310text vkci "ci"
311text vkghp "https://interplane.io/drakestapleton/"
312text vkrad "https://radicle.network/nodes/rosa.radicle.network/rad:z"
313text vst5 "IMPLEMENTED\nQUALIFIED\nEXPERIMENTAL\nBLOCKED\nPLANNED\n"
314text vkstats "statuses"
315text vknote "note"
316text vkpath "path"
317text vktitle "title"
318text vkdesc "description"
319text vkeng "english"
320text vkquotes "quotes"
321text vkqtxt "quote"
322text vlhead "id\topened_utc\towner\tstatus\titem\tdone_when\tevidence\tupdated_utc\n"
323text vrfcctx "rfc 8032 7.1 test 1"
324text vrfcval "secret is 9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60;"
325global vdec ulong 12
326global vlx ulong 3
327global vseen ulong 4096
328global vqo ulong 512
329global vqn ulong 512
330global vqio ulong 512
331global vqin ulong 512
332global vqc ulong 1
333
334note ---------------------------------------------------------------- report and load
335fn sv_failt rule view uchar * why view uchar * extra view uchar * to void
336sv_head rule
337sr_diag why
338sr_diag vtxo
339sr_diag extra
340sr_diag vtxc
341sr_diag vtnl
342end
343fn sv_jload to ulong
344wp = new uchar 4352 0
345for wj ulong get vpn 0
346put wp wj get vpath wj
347end
348sv_ctxp
349sr_diag vtjr
350sv_errc
351sr_diag vtnl
352ret sj_load view part wp 0 get vpn 0
353end
354note sv_jsl: a decoded JSON string copied into a new slot (0 when the node is not a string).
355fn sv_jsl node ulong to ulong
356if ne sj_kind node 3
357ret 0
358end
359ws = sv_snew
360for wj ulong sj_size node
361sv_push sj_byte node wj
362end
363ret ws
364end
365fn sv_jnum node ulong to ulong
366ws = sv_snew
367for wj ulong sj_numsize node
368sv_push sj_numbyte node wj
369end
370ret ws
371end
372fn sv_teq node ulong t view uchar * k ulong to bool
373wa = sv_tat t k
374ret sj_eq node part t wa sv_tlen t wa
375end
376fn sv_tin node ulong t view uchar * to bool
377for wk ulong sv_tcount t
378if sv_teq node t wk
379ret true
380end
381end
382ret false
383end
384fn sv_fld node ulong t view uchar * k ulong to ulong
385wa = sv_tat t k
386ret sj_find node part t wa sv_tlen t wa
387end
388
389note ---------------------------------------------------------------- numbers (lexical)
390fn sv_isdig c uchar to bool
391ret and ge c 48 le c 57
392end
393note sv_u64: a JSON integer token without sign, fraction or exponent, at most 2^64-1
394note (WolframLanguageEvaluator: 2^64 - 1 -> 18446744073709551615).
395text vu64max "18446744073709551615"
396fn sv_u64 node ulong to bool
397if ne sj_kind node 4
398ret false
399end
400wn = sj_numsize node
401for wj ulong wn
402if not sv_isdig sj_numbyte node wj
403ret false
404end
405end
406if lt wn 20
407ret true
408end
409if gt wn 20
410ret false
411end
412for wj ulong 20
413wc = sj_numbyte node wj
414if lt wc get vu64max wj
415ret true
416end
417if gt wc get vu64max wj
418ret false
419end
420end
421ret true
422end
423note sv_safe: collector.rs safe_count: a non-negative integral value at most 2^53 - 1
424note (WolframLanguageEvaluator: 2^53 - 1 -> 9007199254740991). Every digit of the token
425note (integer and fraction) is read into one integer m with f fraction digits and exponent e, so the
426note value is m * 10^(e - f), evaluated exactly. A value that is not an exact integer is refused;
427note so is a token with more than 16 significant digits (serde would round it through f64; this
428note port refuses instead: stricter, never looser). Returns VNONE when not safe.
429const VSAFE ulong 9007199254740991
430fn sv_safe node ulong to ulong
431if ne sj_kind node 4
432ret VNONE
433end
434wn = sj_numsize node
435wi = ulong 0
436wneg = false
437if eq sj_numbyte node 0 45
438wneg = true
439wi = 1
440end
441wm = ulong 0
442wfr = ulong 0
443wfx = false
444wbig = false
445while lt wi wn bound 400
446c = sj_numbyte node wi
447if or eq c 101 eq c 69
448break
449end
450if eq c 46
451wfx = true
452else
453if wfx
454wfr = add wfr 1
455end
456if gt wm 900719925474099
457wbig = true
458else
459wm = add mul wm 10 ulong sub c 48
460end
461end
462wi = add wi 1
463end
464wex = long 0
465if lt wi wn
466wi = add wi 1
467wes = long 1
468if eq sj_numbyte node wi 45
469wes = -1
470wi = add wi 1
471else
472if eq sj_numbyte node wi 43
473wi = add wi 1
474end
475end
476while lt wi wn bound 400
477if gt wex 100000
478ret VNONE
479end
480wex = add mul wex 10 long sub sj_numbyte node wi 48
481wi = add wi 1
482end
483wex = mul wex wes
484end
485if wbig
486ret VNONE
487end
488ret sv_safe2 wm sub wex long wfr wneg
489end
490fn sv_safe2 wm ulong wsc long wneg bool to ulong
491while lt wsc 0 bound 200100
492if eq wm 0
493break
494end
495if ne rem wm 10 0
496ret VNONE
497end
498wm = div wm 10
499wsc = add wsc 1
500end
501while and gt wsc 0 ne wm 0 bound 200100
502if gt wm 900719925474099
503ret VNONE
504end
505wm = mul wm 10
506wsc = sub wsc 1
507end
508if gt wm VSAFE
509ret VNONE
510end
511if and wneg ne wm 0
512ret VNONE
513end
514ret wm
515end
516note sv_decp: parse a plain JSON decimal (no exponent) in slot s into vdec[6k .. 6k+5]:
517note negative, int offset, int length, fraction offset, fraction length, is-zero. False when an
518note exponent is present (refused: lexical comparison only, never float rounding).
519fn sv_decp s ulong k ulong to bool
520wn = sv_n s
521wi = ulong 0
522wneg = ulong 0
523if and gt wn 0 eq sv_b s 0 45
524wneg = 1
525wi = 1
526end
527wi0 = wi
528while and lt wi wn sv_isdig sv_b s wi bound 400
529wi = add wi 1
530end
531wil = sub wi wi0
532wf0 = wi
533wfl = ulong 0
534if and lt wi wn eq sv_b s wi 46
535wi = add wi 1
536wf0 = wi
537while and lt wi wn sv_isdig sv_b s wi bound 400
538wi = add wi 1
539end
540wfl = sub wi wf0
541end
542if ne wi wn
543ret false
544end
545wz = ulong 1
546for wj ulong wil
547if ne sv_b s add wi0 wj 48
548wz = 0
549end
550end
551for wj ulong wfl
552if ne sv_b s add wf0 wj 48
553wz = 0
554end
555end
556wb = mul k 6
557put vdec wb wneg
558put vdec add wb 1 wi0
559put vdec add wb 2 wil
560put vdec add wb 3 wf0
561put vdec add wb 4 wfl
562put vdec add wb 5 wz
563ret true
564end
565note sv_magcmp: compare magnitudes of parsed decimals 0 (slot a) and 1 (slot b): 0 less, 1 equal,
566note 2 greater. JSON forbids leading zeros except a lone 0, so integer length orders first.
567fn sv_magcmp a ulong b ulong to ulong
568if ne get vdec 2 get vdec 8
569if lt get vdec 2 get vdec 8
570ret 0
571end
572ret 2
573end
574for wj ulong get vdec 2
575wx = sv_b a add get vdec 1 wj
576wy = sv_b b add get vdec 7 wj
577if lt wx wy
578ret 0
579end
580if gt wx wy
581ret 2
582end
583end
584wl = get vdec 4
585if gt get vdec 10 wl
586wl = get vdec 10
587end
588for wj ulong wl
589wx = uchar 48
590wy = uchar 48
591if lt wj get vdec 4
592wx = sv_b a add get vdec 3 wj
593end
594if lt wj get vdec 10
595wy = sv_b b add get vdec 9 wj
596end
597if lt wx wy
598ret 0
599end
600if gt wx wy
601ret 2
602end
603end
604ret 1
605end
606note sv_deccmp: a <=> b for two plain decimal slots; 3 when either is not plain.
607fn sv_deccmp a ulong b ulong to ulong
608if not sv_decp a 0
609ret 3
610end
611if not sv_decp b 1
612ret 3
613end
614wna = and eq get vdec 0 1 eq get vdec 5 0
615wnb = and eq get vdec 6 1 eq get vdec 11 0
616if and wna not wnb
617ret 0
618end
619if and wnb not wna
620ret 2
621end
622wm = sv_magcmp a b
623if wna
624ret sub 2 wm
625end
626ret wm
627end
628
629note ---------------------------------------------------------------- shapes
630fn sv_lpair node ulong to bool
631if ne sj_kind node 2
632ret false
633end
634wc = sj_first node
635while ne wc 0 bound 65536
636if ne sj_kind wc 2
637ret false
638end
639if ne sj_len wc 2
640ret false
641end
642wx = sj_first wc
643if ne sj_kind wx 3
644ret false
645end
646if ne sj_kind sj_next wx 3
647ret false
648end
649wc = sj_next wc
650end
651ret true
652end
653fn sv_strs node ulong to bool
654if ne sj_kind node 2
655ret false
656end
657wc = sj_first node
658while ne wc 0 bound 65536
659if ne sj_kind wc 3
660ret false
661end
662wc = sj_next wc
663end
664ret true
665end
666fn sv_ty node ulong code uchar to bool
667wk = sj_kind node
668if eq code 115
669ret eq wk 3
670end
671if eq code 83
672ret or eq wk 3 eq wk 7
673end
674if eq code 97
675ret eq wk 2
676end
677if eq code 84
678ret sv_strs node
679end
680if eq code 111
681ret eq wk 1
682end
683if eq code 79
684ret or eq wk 1 eq wk 7
685end
686if or eq code 98 eq code 66
687ret or eq wk 5 eq wk 6
688end
689if eq code 110
690ret eq wk 4
691end
692if eq code 78
693ret or eq wk 4 eq wk 7
694end
695if eq code 117
696ret sv_u64 node
697end
698if eq code 76
699ret sv_lpair node
700end
701ret false
702end
703fn sv_opt code uchar to bool
704ret or or eq code 83 eq code 79 or or eq code 66 eq code 78 false
705end
706note sv_keycnt: how many members of object node carry key (serde: a known field twice is an error).
707fn sv_keycnt node ulong key view uchar * to ulong
708wn = ulong 0
709wc = sj_first node
710while ne wc 0 bound 65536
711if sj_keyis wc key
712wn = add wn 1
713end
714wc = sj_next wc
715end
716ret wn
717end
718note sv_shty: one present key's JSON type check for sv_shape (split out for registers).
719fn sv_shty node ulong spec view uchar * wa ulong wl ulong wcode uchar to bool
720wf = sj_find node part spec add wa 1 sub wl 1
721if not sv_ty wf wcode
722sv_failt vrb4 vttyp part spec add wa 1 sub wl 1
723ret false
724end
725ret true
726end
727note sv_shape: serde derive for one struct. deny adds deny_unknown_fields: every member must be
728note a listed field (members counted against distinct listed keys found, each at most once).
729fn sv_shape node ulong spec view uchar * deny bool to bool
730if ne sj_kind node 1
731sv_fail vrb4 vtnob
732ret false
733end
734wok = true
735wfound = ulong 0
736for wk ulong sv_tcount spec
737wa = sv_tat spec wk
738wl = sv_tlen spec wa
739wcode = get spec wa
740wcn = sv_keycnt node part spec add wa 1 sub wl 1
741if gt wcn 1
742sv_failt vrb4 vtdup part spec add wa 1 sub wl 1
743wok = false
744end
745if eq wcn 0
746if not sv_opt wcode
747sv_failt vrb4 vtmis part spec add wa 1 sub wl 1
748wok = false
749end
750else
751wfound = add wfound wcn
752if not sv_shty node spec wa wl wcode
753wok = false
754end
755end
756end
757if and deny ne wfound sj_len node
758sv_fail vrb4 vtunk
759wok = false
760end
761ret wok
762end
763fn sv_shapeat node ulong key view uchar * spec view uchar * deny bool to bool
764ret sv_shape sj_find node key spec deny
765end
766note sv_each: every item of the array under key has the struct shape.
767fn sv_each node ulong key view uchar * spec view uchar * deny bool to bool
768wa = sj_find node key
769if ne sj_kind wa 2
770ret false
771end
772wok = true
773wc = sj_first wa
774while ne wc 0 bound 65536
775if not sv_shape wc spec deny
776wok = false
777end
778wc = sj_next wc
779end
780ret wok
781end
782
783note ---------------------------------------------------------------- text checks
784fn sv_sdash node ulong to bool
785ws = sv_jsl node
786if eq ws 0
787ret false
788end
789wd = sv_dash ws
790sv_drop ws
791ret wd
792end
793note machines.rs check_text: no em/en dash, no FORBIDDEN word in the ASCII-lowercased text.
794fn sv_ctext node ulong to void
795ws = sv_jsl node
796if eq ws 0
797ret
798end
799if sv_dash ws
800sv_failx vrb4 vtdsh get vso ws get vsn ws
801end
802for wk ulong sv_tcount vforbid
803wa = sv_tat vforbid wk
804if sv_hasc ws part vforbid wa sv_tlen vforbid wa
805sv_failx vrb4 vtfor get vso ws get vsn ws
806end
807end
808sv_drop ws
809end
810fn sv_ctexts node ulong fields view uchar * to void
811for wk ulong sv_tcount fields
812sv_ctext sv_fld node fields wk
813end
814end
815fn sv_https node ulong to void
816if not sj_prefix node vkhttps
817ws = sv_jsl node
818if eq ws 0
819sv_fail vrb4 vthttps
820ret
821end
822sv_failx vrb4 vthttps get vso ws get vsn ws
823sv_drop ws
824end
825end
826note research_status.rs: an independent recheck link is https and never names github.com.
827fn sv_rchk node ulong to void
828sv_https node
829ws = sv_jsl node
830if eq ws 0
831ret
832end
833if ne sv_findn ws vkgh2 0 sv_n ws VNONE
834sv_failx vrb4 vthttps get vso ws get vsn ws
835end
836sv_drop ws
837end
838fn sv_rawdash rule view uchar * to void
839ws = sv_load
840if eq ws 0
841ret
842end
843if sv_dash ws
844sv_fail rule vtdsh
845end
846sv_drop ws
847end
848
849note ---------------------------------------------------------------- machines.json
850fn sv_vceil root ulong to void
851wa = sj_find root vkceils
852wc = sj_first wa
853while ne wc 0 bound 65536
854sv_https sj_find wc vklink
855sv_ctexts wc vccei
856wt = sj_find wc vktok
857if eq sj_kind wt 4
858ws = sv_jnum wt
859wz = sv_snew
860sv_push 48
861if ne sv_deccmp ws wz 2
862sv_failx vrb4 vtcpos get vso ws get vsn ws
863end
864sv_drop ws
865end
866wc = sj_next wc
867end
868end
869fn sv_vmachs root ulong to void
870wa = sj_find root vkmachs
871if eq sj_len wa 0
872sv_fail vrb4 vtnomach
873end
874wc = sj_first wa
875while ne wc 0 bound 65536
876sv_https sj_find wc vklink
877sv_ctexts wc vcmac
878if ne sj_size sj_find wc vkedate 10
879sv_fail vrb4 vtedate
880end
881wm = sj_first sj_find wc vkmore
882while ne wm 0 bound 65536
883note An extra with no forge copy is a plain label (empty link), never an outside link.
884if gt sj_size sj_find wm vklink 0
885sv_https sj_find wm vklink
886end
887sv_ctexts wm vclnk
888wm = sj_next wm
889end
890wc = sj_next wc
891end
892end
893note sv_ceilof: the first ceiling with this id (Data::ceiling); 0 for an empty or unknown id.
894fn sv_ceilof root ulong id ulong to ulong
895if eq sj_size id 0
896ret 0
897end
898wc = sj_first sj_find root vkceils
899while ne wc 0 bound 65536
900if sj_same sj_find wc vkid id
901ret wc
902end
903wc = sj_next wc
904end
905ret 0
906end
907fn sv_vspeed root ulong sp ulong to void
908sv_https sj_find sp vklink
909sv_ctexts sp vcspd
910wid = sj_find sp vkceil
911wt = sj_find sp vktok
912wce = sv_ceilof root wid
913if and gt sj_size wid 0 eq wce 0
914sv_fail vrb4 vtuceil
915end
916if and gt sj_size wid 0 ne sj_kind wt 4
917sv_fail vrb4 vtnceil
918end
919if and eq sj_kind wt 4 ne wce 0
920ws = sv_jnum wt
921wz = sv_jnum sj_find wce vktok
922wr = sv_deccmp ws wz
923if eq wr 3
924sv_failx vrb4 vtplain get vso ws get vsn ws
925end
926if eq wr 2
927sv_failx vrb4 vtaceil get vso ws get vsn ws
928end
929sv_drop ws
930end
931if and eq sj_kind sj_find sp vkonmain 5 not sj_eq sj_find sp vkbranch vkmain
932sv_fail vrb4 vtonm
933end
934end
935fn sv_vspeeds root ulong to void
936wa = sj_find root vkspeeds
937if eq sj_len wa 0
938sv_fail vrb4 vtnospd
939end
940wc = sj_first wa
941wi = ulong 0
942while ne wc 0 bound 4096
943sv_vspeed root wc
944put vseen wi sj_find wc vkid
945for wj ulong wi
946if sj_same get vseen wj get vseen wi
947sv_fail vrb4 vtdupid
948end
949end
950wi = add wi 1
951wc = sj_next wc
952end
953end
954fn sv_vmach to bool
955wf = get vfail 0
956sv_ctxp
957wr = sv_jload
958if not sv_shape wr vsmt true
959ret false
960end
961wok = sv_each wr vkceils vsmc true
962wok = and wok sv_each wr vkmachs vsmm true
963wok = and wok sv_each wr vkspeeds vsms true
964wm = sj_first sj_find wr vkmachs
965while ne wm 0 bound 65536
966if eq sj_kind wm 1
967wok = and wok sv_each wm vkmore vsml true
968end
969wm = sj_next wm
970end
971if not wok
972ret false
973end
974sv_ctexts wr vctop
975sv_vceil wr
976sv_vmachs wr
977sv_vspeeds wr
978ret eq get vfail 0 wf
979end
980
981note ---------------------------------------------------------------- short links
982note sv_xlink: omega.rs / cudaplusplus.rs expand(). map is a prefix table, pin marks the prefixes
983note that must name a full 40-hex commit. Box links must expand onto the forge (every base is
984note https://interplane.io/drakestapleton/...; a site-relative / or # link is not a box link).
985fn sv_xlink node ulong map view uchar * pin view uchar * box bool to void
986ws = sv_jsl node
987if eq ws 0
988sv_fail vrb4 vtlink
989ret
990end
991wn = sv_n ws
992if and gt wn 0 or eq sv_b ws 0 47 eq sv_b ws 0 35
993if box
994sv_failx vrb4 vtboxg get vso ws wn
995end
996sv_drop ws
997ret
998end
999for wk ulong sv_tcount map
1000wa = sv_tat map wk
1001wl = sv_tlen map wa
1002if sv_eqat ws 0 part map wa wl
1003sv_xrest ws wl eq get pin sv_tat pin wk 49
1004sv_drop ws
1005ret
1006end
1007end
1008sv_failx vrb4 vtlink get vso ws wn
1009sv_drop ws
1010end
1011fn sv_xrest ws ulong wl ulong pinned bool to void
1012wn = sv_n ws
1013wrn = sub wn wl
1014wbad = or eq wrn 0 or sv_hasn ws vdotdot wl wn sv_hasn ws vsp1 wl wn
1015if wbad
1016sv_failx vrb4 vtlink get vso ws wn
1017ret
1018end
1019if pinned
1020wok = ge wrn 41
1021if wok
1022for wj ulong 40
1023wc = sv_b ws add wl wj
1024wh = and ge wc 97 le wc 102
1025wh = or wh and ge wc 65 le wc 70
1026wh = or sv_isdig wc wh
1027if not wh
1028wok = false
1029end
1030end
1031end
1032if wok
1033wok = eq sv_b ws add wl 40 47
1034end
1035if not wok
1036sv_failx vrb4 vtpin get vso ws wn
1037end
1038end
1039end
1040fn sv_xlinks node ulong map view uchar * pin view uchar * to void
1041wc = sj_first sj_find node vklinks
1042while ne wc 0 bound 65536
1043sv_xlink sj_next sj_first wc map pin false
1044wc = sj_next wc
1045end
1046end
1047fn sv_obox node ulong to void
1048sv_xlink node vomap vopin true
1049end
1050note vopin is the omega pin table: only om@: (written 1m@:) is pinned; every other entry starts with a
1051note byte other than 49 ('1'), so sv_xlink's pin lookup reads false for each.
1052
1053note ---------------------------------------------------------------- omega.json
1054fn sv_vobar node ulong ids view uchar * why view uchar * to void
1055wc = sj_first node
1056wk = ulong 0
1057wok = eq sj_len node sv_tcount ids
1058while ne wc 0 bound 64
1059if lt wk sv_tcount ids
1060if not sv_teq sj_find wc vkid ids wk
1061wok = false
1062end
1063end
1064wst = sj_find wc vkstatus
1065if not or or sj_eq wst vkpass sj_eq wst vkpart sj_eq wst vkmiss
1066sv_failt vrb4 vtstat vkbar
1067end
1068wr = sj_find wc vkrcpt
1069whas = eq sj_kind wr 3
1070if sj_eq wst vkpass
1071if not whas
1072sv_fail vrb4 vtpassr
1073else
1074if not or sj_prefix wr vkoev sj_prefix wr vkoev2
1075sv_fail vrb4 vtpassu
1076end
1077end
1078else
1079if whas
1080sv_fail vrb4 vtnpr
1081end
1082end
1083if whas
1084sv_obox wr
1085end
1086sv_xlinks wc vomap vopin
1087wk = add wk 1
1088wc = sj_next wc
1089end
1090if not wok
1091sv_fail vrb4 why
1092end
1093end
1094fn sv_vocards node ulong to void
1095wc = sj_first node
1096while ne wc 0 bound 65536
1097sv_obox sj_find wc vkbox
1098sv_xlinks wc vomap vopin
1099wc = sj_next wc
1100end
1101end
1102fn sv_volayers node ulong to void
1103if lt sj_len node 13
1104sv_fail vrb4 vtlay
1105end
1106wc = sj_first node
1107while ne wc 0 bound 65536
1108wst = sj_find wc vkstatus
1109if not or or sj_eq wst vkpass sj_eq wst vkpart or sj_eq wst vkmiss sj_eq wst vknotr
1110sv_failt vrb4 vtstat vklayers
1111end
1112wz = or eq sj_size sj_find wc vkcuda2 0 or eq sj_size sj_find wc vkomg 0 eq sj_size sj_find wc vkjob 0
1113if wz
1114sv_fail vrb4 vtempty
1115end
1116sv_obox sj_find wc vkbox
1117sv_xlinks wc vomap vopin
1118wc = sj_next wc
1119end
1120end
1121fn sv_vomega to bool
1122wf = get vfail 0
1123sv_ctxp
1124sv_rawdash vrb4
1125wr = sv_jload
1126if not sv_shape wr vsot true
1127ret false
1128end
1129wok = sv_shapeat wr vksource vsos true
1130wok = and wok sv_shapeat wr vksb vsosb true
1131if wok
1132wok = sv_each sj_find wr vksb vksteps vsost true
1133end
1134wok = and wok sv_each wr vkparts vsoc true
1135wok = and wok sv_shapeat wr vkbelow vsoc true
1136wok = and wok sv_each wr vklayers vsol true
1137wok = and wok sv_shapeat wr vkrcpt vsor true
1138wok = and wok sv_each wr vknotyet vsog true
1139wok = and wok sv_each wr vkbar vsob true
1140wok = and wok sv_each wr vkbeyond vsog true
1141wok = and wok sv_shapeat wr vkperf vsop true
1142if wok
1143wok = sv_each sj_find wr vkperf vkbar vsob true
1144end
1145if not wok
1146ret false
1147end
1148wsrc = sj_find wr vksource
1149sv_obox sj_find wsrc vkdoc
1150sv_obox sj_find wsrc vkissue
1151sv_obox sj_find sj_find wr vkbelow vkbox
1152sv_xlinks sj_find wr vkbelow vomap vopin
1153sv_obox sj_find sj_find wr vkrcpt vkbox
1154wsb = sj_find wr vksb
1155if ne sj_len sj_find wsb vksteps 8
1156sv_fail vrb4 vtsb
1157end
1158wc = sj_first sj_find wsb vksteps
1159while ne wc 0 bound 64
1160if not sj_prefix sj_find wc vkbox vkompin
1161sv_fail vrb4 vtsb
1162end
1163sv_obox sj_find wc vkbox
1164wc = sj_next wc
1165end
1166sv_xlinks wsb vomap vopin
1167sv_vocards sj_find wr vkparts
1168sv_volayers sj_find wr vklayers
1169sv_vocards sj_find wr vknotyet
1170sv_vocards sj_find wr vkbeyond
1171sv_vobar sj_find wr vkbar vbarc vtbarc
1172sv_vobar sj_find sj_find wr vkperf vkbar vbarp vtbarp
1173sv_obox sj_find sj_find wr vkperf vkbox
1174sv_xlinks sj_find wr vkperf vomap vopin
1175if not sj_prefix sj_find wsrc vkdoc vkodoc
1176sv_fail vrb4 vtodoc
1177end
1178ret eq get vfail 0 wf
1179end
1180
1181note ---------------------------------------------------------------- cudaplusplus.json
1182fn sv_cbox node ulong to void
1183sv_xlink node vcmap vcpin true
1184end
1185note check_status(what, status, ledger, receipt): status in STATUSES; IN PROGRESS needs a
1186note ledger id L<digits>; PASS needs a receipt containing evidence/.
1187fn sv_cstat st ulong ledger ulong rcpt ulong to void
1188wok = or or sj_eq st vkpass sj_eq st vkpart or sj_eq st vkinpr sj_eq st vknv
1189if not wok
1190sv_failt vrb4 vtstat vkstatus
1191ret
1192end
1193if sj_eq st vkinpr
1194wl = false
1195if eq sj_kind ledger 3
1196wn = sj_size ledger
1197if and gt wn 1 eq sj_byte ledger 0 76
1198wl = true
1199for wj ulong sub wn 1
1200if not sv_isdig sj_byte ledger add wj 1
1201wl = false
1202end
1203end
1204end
1205end
1206if not wl
1207sv_fail vrb4 vtinp
1208end
1209end
1210if sj_eq st vkpass
1211wr = false
1212ws = sv_jsl rcpt
1213if ne ws 0
1214wr = sv_has ws vkevid
1215sv_drop ws
1216end
1217if not wr
1218sv_fail vrb4 vtpasse
1219end
1220end
1221end
1222fn sv_chops node ulong to void
1223if lt sj_len node 8
1224sv_fail vrb4 vthops
1225end
1226wc = sj_first node
1227while ne wc 0 bound 65536
1228sv_cstat sj_find wc vkstatus sj_find wc vkledger sj_find wc vkbox
1229sv_cbox sj_find wc vkbox
1230sv_xlinks wc vcmap vcpin
1231wc = sj_next wc
1232end
1233end
1234fn sv_ccards node ulong to void
1235wc = sj_first node
1236while ne wc 0 bound 65536
1237sv_cbox sj_find wc vkbox
1238sv_xlinks wc vcmap vcpin
1239wc = sj_next wc
1240end
1241end
1242fn sv_crows node ulong to void
1243wc = sj_first node
1244while ne wc 0 bound 65536
1245wst = sj_find wc vkstatus
1246if or sj_eq wst vknv sj_eq wst vkpart
1247sv_fail vrb4 vtpain
1248end
1249sv_cstat wst sj_find wc vkledger sj_find wc vkrcpt
1250if and sj_eq wst vkpass ne sj_kind sj_find wc vkcmd 3
1251sv_fail vrb4 vtcmd
1252end
1253sv_cbox sj_find wc vkbox
1254wr = sj_find wc vkrcpt
1255if eq sj_kind wr 3
1256sv_cbox wr
1257end
1258sv_xlinks wc vcmap vcpin
1259wc = sj_next wc
1260end
1261end
1262fn sv_vcuda to bool
1263wf = get vfail 0
1264sv_ctxp
1265sv_rawdash vrb4
1266wr = sv_jload
1267if not sv_shape wr vsct true
1268ret false
1269end
1270wok = sv_shapeat wr vksource vscs true
1271wok = and wok sv_each wr vkhops vsch true
1272wok = and wok sv_each wr vksteps vscc true
1273wok = and wok sv_each wr vkpains vscr true
1274wok = and wok sv_each wr vkswaps vscr true
1275if not wok
1276ret false
1277end
1278wsrc = sj_find wr vksource
1279sv_cbox sj_find wsrc vkreadme
1280sv_cbox sj_find wsrc vkhow
1281sv_cbox sj_find wsrc vkodoc2
1282sv_cbox sj_find wr vkplink
1283sv_cbox sj_find wr vkalink
1284sv_cbox sj_find wr vkdnb
1285sv_chops sj_find wr vkhops
1286sv_ccards sj_find wr vksteps
1287sv_crows sj_find wr vkpains
1288sv_crows sj_find wr vkswaps
1289wv = sj_find wsrc vkvis
1290if not or sj_eq wv vkpriv sj_eq wv vkpub
1291sv_fail vrb4 vtvis
1292end
1293ret eq get vfail 0 wf
1294end
1295
1296note ---------------------------------------------------------------- research-status.json
1297fn sv_texact node ulong t view uchar * to bool
1298if ne sj_len node sv_tcount t
1299ret false
1300end
1301wc = sj_first node
1302wk = ulong 0
1303while ne wc 0 bound 64
1304if not sv_teq wc t wk
1305ret false
1306end
1307wk = add wk 1
1308wc = sj_next wc
1309end
1310ret true
1311end
1312fn sv_rlinks node ulong to void
1313wc = sj_first node
1314while ne wc 0 bound 65536
1315wl = sj_find wc vklink
1316if eq sj_kind wl 3
1317if and gt sj_size wl 0 not sj_prefix wl vkgh
1318sv_fail vrb4 vtrlink
1319end
1320end
1321wc = sj_next wc
1322end
1323end
1324fn sv_rladder root ulong to void
1325wl = sj_find root vkladder
1326wc = sj_first wl
1327wk = ulong 0
1328wlev = true
1329wrun = true
1330wtop = ulong 0
1331wgap = false
1332while ne wc 0 bound 64
1333if lt wk sv_tcount vrlev
1334if not sv_teq sj_find wc vklevel vrlev wk
1335wlev = false
1336end
1337end
1338wst = sj_find wc vkstate
1339if not sv_tin wst vrlad
1340sv_fail vrb4 vtlstate
1341end
1342if sj_eq wst vkach
1343if wrun
1344wtop = sj_find wc vklevel
1345end
1346if wgap
1347sv_fail vrb4 vtgap
1348end
1349else
1350wrun = false
1351wgap = true
1352end
1353wk = add wk 1
1354wc = sj_next wc
1355end
1356if or not wlev ne wk sv_tcount vrlev
1357sv_fail vrb4 vtlevels
1358end
1359wcl = sj_find sj_find root vkcur vklevel
1360if eq wtop 0
1361sv_fail vrb4 vtcur
1362else
1363if not sj_same wtop wcl
1364sv_fail vrb4 vtcur
1365end
1366end
1367end
1368note sv_rowid: the turing row whose id equals the string node id (0 when none).
1369fn sv_rowid root ulong id ulong to ulong
1370if ne sj_kind id 3
1371ret 0
1372end
1373wc = sj_first sj_find root vktrows
1374while ne wc 0 bound 65536
1375if sj_same sj_find wc vkid id
1376ret wc
1377end
1378wc = sj_next wc
1379end
1380ret 0
1381end
1382fn sv_rlevel root ulong id ulong to bool
1383wc = sj_first sj_find root vkladder
1384while ne wc 0 bound 64
1385if sj_same sj_find wc vklevel id
1386ret true
1387end
1388wc = sj_next wc
1389end
1390ret false
1391end
1392note sv_runiq: ids unique and the status (sel 0, turing rows) or class (sel 1, implementation rows)
1393note in its fixed set.
1394fn sv_runiq node ulong sel ulong to void
1395wc = sj_first node
1396wi = ulong 0
1397while ne wc 0 bound 4096
1398put vseen wi sj_find wc vkid
1399for wj ulong wi
1400if sj_same get vseen wj get vseen wi
1401sv_fail vrb4 vtdupid
1402end
1403end
1404if eq sel 0
1405if not sv_tin sj_find wc vkstatus vrstat
1406sv_fail vrb4 vtrstat
1407end
1408else
1409if not sv_tin sj_find wc vkclass vrcls
1410sv_fail vrb4 vtrcls
1411end
1412end
1413wi = add wi 1
1414wc = sj_next wc
1415end
1416end
1417fn sv_rattempts root ulong to void
1418wc = sj_first sj_find root vkatt
1419while ne wc 0 bound 65536
1420wrow = sv_rowid root sj_find wc vkid
1421wok = ne wrow 0
1422if wok
1423wok = sj_same sj_find wrow vkstatus sj_find wc vkoutc
1424end
1425wok = and wok sv_rlevel root sj_find wc vkbeside
1426wok = and wok ne sv_rowid root sj_find wc vkledto 0
1427if not wok
1428sv_fail vrb4 vtatt
1429end
1430wc = sj_next wc
1431end
1432end
1433fn sv_vres to bool
1434wf = get vfail 0
1435sv_ctxp
1436sv_rawdash vrb4
1437wr = sv_jload
1438if not sv_shape wr vsrt true
1439ret false
1440end
1441wok = sv_shapeat wr vkscom vsrsc true
1442wok = and wok sv_shapeat wr vkirc vsrir true
1443wok = and wok sv_each wr vkabbr vsrab true
1444wok = and wok sv_shapeat wr vkcur vsrcl true
1445wok = and wok sv_each wr vkladder vsrld true
1446wok = and wok sv_each wr vkatt vsrat true
1447wok = and wok sv_each wr vktrows vsrtr true
1448wok = and wok sv_each wr vkirows vsrim true
1449if not wok
1450ret false
1451end
1452if not sv_texact sj_find wr vkals vrstat
1453sv_failt vrb4 vtallow vkals
1454end
1455if not sv_texact sj_find wr vkall vrlad
1456sv_failt vrb4 vtallow vkall
1457end
1458if not sv_texact sj_find wr vkalc vrcls
1459sv_failt vrb4 vtallow vkalc
1460end
1461sv_rladder wr
1462sv_rlinks sj_find wr vkladder
1463sv_rlinks sj_find wr vktrows
1464sv_rlinks sj_find wr vkirows
1465sv_runiq sj_find wr vktrows 0
1466sv_runiq sj_find wr vkirows 1
1467wc = sj_first sj_find sj_find wr vkirc vklinks
1468while ne wc 0 bound 65536
1469sv_rchk wc
1470wc = sj_next wc
1471end
1472sv_rattempts wr
1473ret eq get vfail 0 wf
1474end