interplane.Get Omega
Read in your language

cortex

aien-dev/cortex

Brought by drakestapleton

branch main Branches Tags History

cortex / tests / fts / t_tok.om

72 lines · 1171 bytes Raw Blame History
1note ===== tests/fts/t_tok.om : tokenizer differential harness =====
2note usage: t_tok DUMP > out ; prints "<rowid> c<col>( <start>:<end>:<hex token>)*" per column,
3note the same format as `oracle tok` (which calls SQLite's own unicode61 xTokenize)
4global tmd uchar 8
5fn main to int
6uf_init
7fd = t_open 1
8if gt argcnt 2
9ret t_recs fd
10end
11z = t_need fd 12
12put tibp 0 8
13nf = t_u32
14for r ulong nf
15z = t_need fd 8
16row = t_u64
17b = t_rdsb fd
18t_rdnm fd
19t_rdct fd
20b = t_rdsb fd
21b = t_rdsb fd
22z = t_need fd 1
23put tibp 0 add get tibp 0 1
24t_tline row 1 1 get qnml 0
25t_tline row 2 0 get qctl 0
26end
27t_flush
28ret 0
29end
30fn t_tline row ulong col ulong src ulong n ulong to void
31t_dec row
32t_ch 32
33t_ch 99
34t_dec col
35uf_start src n
36for k ulong 17
37dn = false
38for j ulong 999999
39if not uf_next
40dn = true
41break
42end
43t_ch 32
44t_dec get qtis 0
45t_ch 58
46t_dec get qtie 0
47t_ch 58
48m = get qtfn 0
49if gt m 32768
50m = ulong 32768
51end
52for i ulong m
53t_hex ulong get qtf i 2
54end
55end
56if dn
57break
58end
59end
60t_ch 10
61end
62note records mode: u32 length + bytes, tokenized from qct
63fn t_recs fd int to int
64r = ulong 0
65while t_need fd 4 bound 999999
66t_rdct fd
67t_tline r 2 0 get qctl 0
68r = add r 1
69end
70t_flush
71ret 0
72end