interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / collab / native / json.om

447 lines · 6137 bytes Raw Blame History
1note ---- issues of the native store (collab/co5iss.om): forge/issues/1 and forge/issue/1. An imported
2note issue has "author": null and an "imported" object naming its GitHub source and login (plain data,
3note never an account or a DID of this forge); the first comment is the issue body, as on the page.
4text tnjimp "imported"
5text tnjdid "did"
6text tnjnm "name"
7text tnjfrom "from"
8text tnjgh "github"
9text tnjown "owner"
10text tnjrepo "repo"
11text tnjurl "url"
12text tnjlog "login"
13text tnjkind "kind"
14text tnjclos "closed"
15text tnjline "line"
16text tnjurlk "\"url\":\""
17fn nijlist to long
18if not niidx
19ret 500
20end
21f = nifilt
22nipagen f
23fyrhead tcjsis
24fyk tcstn
25cojsn 2 f
26fyk tcjsts
27cojtabs 2
28fyk tcjtr
29paged = ne get gnpaged 0 0
30fybool and not paged gt get gnmatch 0 NILEG
31if paged
32fyk tnpkey
33fnum get gnpage 0
34fyk tnpp
35fnum NIPAGE
36nijnav f
37end
38fyk tcjisss
39fputc 91
40if not nijrows f paged
41ret 500
42end
43fputc 93
44fyk tcnwr
45niwnewjson
46fputc 10
47fyend
48ret 200
49end
50fn nijrows f ulong paged bool to bool
51m = ulong 0
52skip = ulong 0
53count = NILEG
54if paged
55skip = mul sub get gnpage 0 1 NIPAGE
56count = NIPAGE
57end
58n = get gnn 0
59for j ulong n bound NIROWS
60k = j
61if paged
62k = sub sub n 1 j
63end
64s = nistate k
65if or eq f 9 eq f s
66if ge m skip
67if gt m skip
68fputc 44
69end
70fputc 10
71if not nijrow k s
72ret false
73end
74end
75m = add m 1
76if eq m add skip count
77break
78end
79end
80end
81ret true
82end
83fn nijnav f ulong to void
84p = get gnpage 0
85fyk tnprev
86if gt p 1
87cojq
88nipageurl f sub p 1 false
89cojq
90else
91fynull
92end
93fyk tnnext
94if gt get gnmatch 0 mul p NIPAGE
95cojq
96nipageurl f add p 1 false
97cojq
98else
99fynull
100end
101end
102fn nijid k ulong to void
103cojq
104for i ulong 16
105fputc get gnix add mul k 17 i
106end
107cojq
108end
109fn nijtitle k ulong to void
110n = nismall k tnfttl
111fjtb
112for i ulong n bound 65536
113fjtc get gnf i
114end
115fjstr
116end
117fn nijrow k ulong s ulong to bool
118fputc 123
119fyk0 tcid
120nijid k
121fyk tcjtitl
122nijtitle k
123fyk tcstn
124cojsn 2 s
125nigh k
126fyk tcjauth
127nijauthor
128nijimp k
129if not nithr k
130ret false
131end
132fyk tcjupd
133nijupd
134fyk tcjcoms
135fnum nicount
136fyk tcjverd
137fynull
138fyk tcjpath
139cojq
140nilink k
141cojq
142fputc 125
143ret true
144end
145fn nijauthor to void
146if eq get gnative 0 0
147fynull
148ret
149end
150fputc 123
151fyk0 tnjdid
152nijgh tniwdid
153fyk tnjnm
154fynull
155fputc 125
156end
157note nijgh t: the gh value t as a JSON string (null when "-" or absent)
158fn nijgh t view uchar * to void
159o = nighv t
160n = get gnr 15
161if or eq n 0 and eq n 1 eq get gngh o 45
162fynull
163ret
164end
165fjtb
166for i ulong n bound 65536
167fjtc get gngh add o i
168end
169fjstr
170end
171note nijsv t: in gnf (a source.json), the string value after t as a JSON string
172fn nijsv t view uchar * to void
173fjtb
174n = get gnfl 0
175for s ulong n bound 65536
176if nijat s t
177p = add s len t
178while lt p n bound 65536
179c = get gnf p
180if eq c 34
181break
182end
183fjtc c
184p = add p 1
185end
186break
187end
188end
189fjstr
190end
191note nighnum: imported issue number as a bounded decimal; invalid or missing is zero
192fn nighnum to ulong
193o = nighv tnghn
194n = get gnr 15
195if gt n 18
196ret 0
197end
198v = ulong 0
199for i ulong n bound 18
200c = get gngh add o i
201if not fisdig c
202ret 0
203end
204v = add mul v 10 ulong sub c 48
205end
206ret v
207end
208note nijimp k: ,"imported":{"from":"github","owner","repo","number","url","login"} (gh must be loaded)
209fn nijimp k ulong to void
210x = nismall k tnfsrc
211fyk tnjimp
212if eq get gnative 0 1
213fynull
214ret
215end
216fputc 123
217fyk0 tnjfrom
218fysv tnjgh
219fyk tnjown
220nijsv tnjow
221fyk tnjrepo
222nijsv tnjrp
223fyk tcjnum
224fnum nighnum
225fyk tnjurl
226nijsv tnjurlk
227fyk tnjlog
228nijgh tnghl
229fputc 125
230end
231note nijupd: the newest of the opened and closed times and the loaded thread's record times
232fn nijupd to void
233o = nighv tnghop
234if ne get gnr 15 20
235fynull
236ret
237end
238for i ulong 20
239put gnf i get gngh add o i
240end
241c = nighv tnghcl
242if eq get gnr 15 20
243if nighlt 0 c
244for i ulong 20
245put gnf i get gngh add c i
246end
247end
248end
249p = ulong 0
250n = get gnthl 0
251while lt p n bound 16777216
252p = nirec p
253if and ne get gnr 0 0 eq get gnr 2 20
254if nithlt get gnr 1
255for i ulong 20
256put gnf i get gnth add get gnr 1 i
257end
258end
259end
260end
261fjtb
262for i ulong 20
263fjtc get gnf i
264end
265fjstr
266end
267note nighlt a c: gnf[a, a+20) sorts before gngh[c, c+20)
268fn nighlt a ulong c ulong to bool
269for i ulong 20
270x = get gnf add a i
271y = get gngh add c i
272if ne x y
273ret lt x y
274end
275end
276ret false
277end
278fn nithlt c ulong to bool
279for i ulong 20
280x = get gnf i
281y = get gnth add c i
282if ne x y
283ret lt x y
284end
285end
286ret false
287end
288note nijraw a: gnth[gnr a, + gnr a+1) as a JSON string
289fn nijraw a ulong to void
290fjtb
291o = get gnr a
292for i ulong get gnr add a 1 bound 16777216
293fjtc get gnth add o i
294end
295fjstr
296end
297fn nijone to long
298if not niidx
299ret 500
300end
301k = niref
302if ge k get gnn 0
303ret 404
304end
305s = nistate k
306fyrhead tcjsi
307fyk tcid
308nijid k
309fyk tcjtitl
310nijtitle k
311fyk tcstn
312cojsn 2 s
313nigh k
314fyk tcjauth
315nijauthor
316nijimp k
317fyk tcjopen
318nijgh tnghop
319fyk tnjclos
320nijgh tnghcl
321fyk tcjpath
322cojq
323nilink k
324cojq
325fyk tcjreas
326nijgh tnghre
327nijlabs k
328fyk tcjasg
329fputc 91
330fputc 93
331if not nithr k
332ret 500
333end
334if not nijcoms k
335ret 500
336end
337fyend
338ret 200
339end
340fn nijlabs k ulong to void
341fyk tcjlabs
342fputc 91
343n = nismall k tnflab
344s = ulong 0
345c = ulong 0
346for i ulong n bound 65536
347if eq get gnf i 10
348if gt c 0
349fputc 44
350end
351fjtb
352for j ulong sub i s bound 65536
353fjtc get gnf add s j
354end
355fjstr
356c = add c 1
357s = add i 1
358end
359end
360fputc 93
361end
362note nijcoms k: "comments": the body first (author null, the GitHub login, opened), then the thread
363fn nijcoms k ulong to bool
364fyk tcjcoms
365fputc 91
366fputc 10
367fputc 123
368fyk0 tcjauth
369nijauthor
370fyk tnjlog
371nijgh tnghl
372fyk tnjkind
373fysv tcjtcom
374fyk tcjtime
375nijgh tnghop
376fyk tcjbody
377nipf k tnfdsc
378r = frdall
379if lt r 0
380r = 0
381end
382if ne get fxotr 0 0
383ret false
384end
385fjfx 0 ulong r
386fyk tcjred
387fybool false
388fputc 125
389p = ulong 0
390n = get gnthl 0
391while lt p n bound 16777216
392p = nirec p
393if ne get gnr 0 0
394fputc 44
395fputc 10
396nijcom
397end
398end
399fputc 93
400ret true
401end
402fn nijcom to void
403k = get gnr 0
404fputc 123
405fyk0 tcjauth
406if eq k 4
407fputc 123
408fyk0 tnjdid
409nijraw 3
410fyk tnjnm
411fynull
412fputc 125
413fyk tnjlog
414fynull
415else
416fynull
417fyk tnjlog
418nijraw 3
419end
420fyk tnjkind
421if or eq k 1 eq k 4
422fysv tcjtcom
423end
424if eq k 2
425fysv tcjtrvw
426fyk tcstn
427nijraw 5
428end
429if eq k 3
430fysv tnrrc
431fyk tcjpath
432nijraw 8
433fyk tnjline
434fnum get gnr 7
435end
436fyk tcjtime
437if eq get gnr 2 20
438nijraw 1
439else
440fynull
441end
442fyk tcjbody
443nijraw 10
444fyk tcjred
445fybool false
446fputc 125
447end