interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / apps / interplane-forge / collab / native / helpers.om

256 lines · 3847 bytes Raw Blame History
1note HTML and JSON helpers shared by the imported issue views.
2global gcrq uchar 16
3global gcrql ulong 1
4text tcid "id"
5text tcdraft "draft"
6text tcarch "archived"
7text tcclosed "closed"
8global gcm ulong 16
9text tcah "<a href=\""
10text tcqg "\">"
11text tcae "</a>"
12text tcissp "/issues/"
13text tcpats "/patches"
14text tcisss "/issues"
15text tcnot "(no title)"
16text tcmidd " &#183; "
17text tcstq "?state="
18text tcstn "state"
19text tcopen "open"
20text tcmerged "merged"
21text tcall "all"
22text tcsopen "Open"
23text tcsdraft "Draft"
24text tcsclos "Closed"
25text tcsmerg "Merged"
26text tcsarch "Archived"
27text tcsall "All"
28text tciss "Issues"
29text tcbon "<b>"
30text tcboff "</b>"
31text tcopar " ("
32text tccpar ")"
33global gcsn ulong 1
34global gccnt ulong 8
35text tcbok "<b class=\"ok\">"
36text tcbbad "<b class=\"bad\">"
37text tcbmut "<b class=\"muted\">"
38text tclh1 "<h2>"
39text tclh2 "</h2>\n<p class=\"bar\">"
40text tclh3 "</p>\n"
41text tclul "<ul class=\"repos\">\n"
42text tcluln "</ul>\n"
43text tclnone "<p class=\"muted\">Nothing here in this state.</p>\n"
44text tcli1 "<li><a class=\"rname\" href=\""
45text tcli2 "</a> "
46text tcli7 "</p>"
47text tcli10 "</li>\n"
48text tcnwr "new"
49text tcjsis "forge/issues/1"
50text tcjsi "forge/issue/1"
51text tcjsts "states"
52text tcjcnt "count"
53text tcjpath "path"
54text tcjtr "truncated"
55text tcjisss "issues"
56text tcjtitl "title"
57text tcjauth "author"
58text tcjupd "updated"
59text tcjcoms "comments"
60text tcjverd "verdict"
61text tcjopen "opened"
62text tcjlabs "labels"
63text tcjasg "assignees"
64text tcjnum "number"
65text tcjred "redacted"
66text tcjtime "time"
67text tcjbody "body"
68text tcjreas "reason"
69text tcjtrvw "review"
70text tcjtcom "comment"
71fn cosp to void
72fputc 32
73end
74fn coqeq n long t view uchar * to bool
75if ne ulong n len t
76ret false
77end
78for i ulong len t
79if ne get fval i get t i
80ret false
81end
82end
83ret true
84end
85fn coqstate kd ulong to ulong
86n = fqget tcstn
87if lt n 0
88ret ulong 0
89end
90if coqeq n tcdraft
91ret ulong 1
92end
93if or coqeq n tcclosed coqeq n tcarch
94ret ulong 2
95end
96if coqeq n tcmerged
97ret ulong 3
98end
99if coqeq n tcall
100ret ulong 9
101end
102ret ulong 0
103end
104fn costname kd ulong s ulong to void
105if eq s 9
106fput tcsall
107ret
108end
109if eq s 0
110fput tcsopen
111ret
112end
113if eq s 1
114fput tcsdraft
115ret
116end
117if eq s 3
118fput tcsmerg
119ret
120end
121if eq kd 1
122fput tcsarch
123ret
124end
125fput tcsclos
126end
127fn costbadge kd ulong s ulong to void
128if or eq s 0 eq s 3
129fput tcbok
130else
131if eq s 1
132fput tcbmut
133else
134fput tcbbad
135end
136end
137costname kd s
138fput tcboff
139end
140fn cotab f ulong s ulong nm view uchar * v view uchar * to void
141kd = get gcm 9
142fput tcah
143fputrl
144if eq kd 1
145fput tcpats
146else
147fput tcisss
148end
149fput tcstq
150fput v
151fput tcqg
152if eq f s
153fput tcbon
154end
155fput nm
156fput tcopar
157cotabn kd s
158fput tccpar
159if eq f s
160fput tcboff
161end
162fput tcae
163cosp
164end
165fn cotabn kd ulong s ulong to void
166if eq s 9
167fnum get gcsn 0
168ret
169end
170fnum get gccnt s
171end
172fn cotabs kd ulong f ulong to void
173cotab f 0 tcsopen tcopen
174if eq kd 1
175cotab f 1 tcsdraft tcdraft
176cotab f 3 tcsmerg tcmerged
177cotab f 2 tcsarch tcarch
178else
179cotab f 2 tcsclos tcclosed
180end
181cotab f 9 tcsall tcall
182end
183fn codrefb to void
184i = get fridx 0
185o = get fabo i
186n = get fabl i
187for k ulong n bound 64
188put gbref k get fabr add o k
189end
190put gbrefl 0 n
191end
192fn cojq to void
193fputc 34
194end
195fn cojsn kd ulong s ulong to void
196cojq
197cojsv kd s
198cojq
199end
200fn cojsv kd ulong s ulong to void
201if eq s 9
202fput tcall
203end
204if eq s 0
205fput tcopen
206end
207if eq s 1
208fput tcdraft
209end
210if eq s 3
211fput tcmerged
212end
213if eq s 2
214if eq kd 1
215fput tcarch
216else
217fput tcclosed
218end
219end
220ret
221end
222fn cojtabs kd ulong to void
223fputc 91
224cojtab kd 0 false
225if eq kd 1
226cojtab kd 1 true
227cojtab kd 3 true
228cojtab kd 2 true
229else
230cojtab kd 2 true
231end
232cojtab kd 9 true
233fputc 93
234end
235fn cojtab kd ulong s ulong c bool to void
236if c
237fputc 44
238end
239fputc 123
240fyk0 tcstn
241cojsn kd s
242fyk tcjcnt
243cotabn kd s
244fyk tcjpath
245cojq
246fputrl
247if eq kd 1
248fput tcpats
249else
250fput tcisss
251end
252fput tcstq
253cojsv kd s
254cojq
255fputc 125
256end