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
omega-mv / apps / interplane-forge / server / pages.om
| 1 | note forged server/pages.om: layout (header, footer), error pages, /explore, /<owner>, /search, |
| 2 | note the repo header used by every repo tab, and the stylesheet. Writes fob through util.om helpers. |
| 3 | global fq uchar 256 |
| 4 | global fql ulong 1 |
| 5 | text tfpsrch "/search" |
| 6 | text tfulrep "<ul class=\"repos\">\n" |
| 7 | text tfempty "" |
| 8 | text tfccpub "public, max-age=300" |
| 9 | text tfctcss "text/css; charset=utf-8" |
| 10 | text tfh1 "<!doctype html>\n<html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><meta name=\"color-scheme\" content=\"dark\"><title>" |
| 11 | text tfh2 " · INTERPLANE Forge</title><link rel=\"stylesheet\" href=\"" |
| 12 | text tfcssp "assets/forge.css" |
| 13 | text tfh3 "\"><link rel=\"icon\" type=\"image/svg+xml\" href=\"" |
| 14 | text tficop "assets/favicon.svg" |
| 15 | text tfh3i "\">" |
| 16 | text tfh3b "</head>\n<body><a class=\"skip\" href=\"#main\">Skip to content</a>" |
| 17 | text tfhal1 "<link rel=\"alternate\" type=\"application/json\" href=\"" |
| 18 | text tfhal2 "explore.json" |
| 19 | text tfhal3 ".json" |
| 20 | text tfhal4 "events.json" |
| 21 | note ---- the site chrome: the interplane.io header and footer and their stylesheet lines are not kept |
| 22 | note here. server/chromegen.om makes them at every build from the site's own source (canonical main of |
| 23 | note rad:z399yKvnXcBQNkKoq86iBDgTvQ5QV, content/_layout.html and public/style.css) into the generated |
| 24 | note unit .build/chrome.om (run.sh units): texts tchrhead, tchrfoot, tchrcss and the site commit |
| 25 | note tchrsite. Every site link is absolute, so the same bytes serve the bases / and /forge/; Forge is |
| 26 | note the current section. server/tests/sitechrome.sh checks the result against the site source. |
| 27 | note the forge's own controls, a second row under the site header |
| 28 | text tfh4 "<div class=\"forge-row\"><div class=\"shell forge-bar\"><nav class=\"forge-nav\" aria-label=\"Forge\"><a href=\"" |
| 29 | text tfexp "explore" |
| 30 | text tfh4b "\">Explore</a><a href=\"" |
| 31 | text tfh5 "\">Stars</a>" |
| 32 | text tfh5b "</nav><form class=\"search\" method=\"get\" action=\"" |
| 33 | text tfsrch "search" |
| 34 | text tfh6 "\" role=\"search\"><input type=\"search\" name=\"q\" maxlength=\"200\" placeholder=\"Search the forge\" aria-label=\"Search the forge\" value=\"" |
| 35 | text tfh7 "\"><button type=\"submit\">Search</button></form><a class=\"lang-link\" href=\"https://interplane.io/translate/\">Read in your language</a><div class=\"who\">" |
| 36 | text tfsignin "\">Sign in</a>" |
| 37 | text tfahref "<a href=\"" |
| 38 | text tfqgt "\">" |
| 39 | text tfaend "</a>" |
| 40 | text tfso1 "<form class=\"inline\" method=\"post\" action=\"" |
| 41 | text tflogout "logout" |
| 42 | text tflogin "login" |
| 43 | text tfso2 "\"><input type=\"hidden\" name=\"csrf\" value=\"" |
| 44 | text tfso3 "\"><button type=\"submit\">Sign out</button></form>" |
| 45 | text tfh8 "</div></div></div>\n<main id=\"main\" tabindex=\"-1\">\n" |
| 46 | text tff1 "\n</main>\n<footer class=\"site-foot\"><div class=\"shell\">\n" |
| 47 | text tff2 "\">Explore</a> · <a href=\"" |
| 48 | text tff3 "\">Search</a> · <a href=\"" |
| 49 | text tfstars "stars" |
| 50 | text tff4 "\">Stars</a> · <a href=\"https://interplane.io/translate/\">Read in your language</a> · <a href=\"" |
| 51 | text tff4q "?format=text" |
| 52 | text tff4a "&format=text" |
| 53 | text tff4b "\" rel=\"alternate\" type=\"text/plain\">This page as plain text</a></p>\n<p class=\"foot-fine\">Translation is done by your own browser or tool, on your machine. This forge translates nothing and keeps no translated copies; the English page is the reference, and commands, fingerprints and file names are marked to stay exactly as written.</p>\n</div></footer>\n</body></html>\n" |
| 54 | text tfq "q" |
| 55 | note ---- error pages |
| 56 | text tfe1 "<section class=\"err\"><h1>" |
| 57 | text tfe2 "</h1><p>" |
| 58 | text tfe3 "</p><p><a href=\"" |
| 59 | text tfe4 "\">Back to the forge</a></p></section>" |
| 60 | text tfm400 "Bad request. The forge refused this request." |
| 61 | text tfm403 "Forbidden. The form token did not match; reload the page and try again." |
| 62 | text tfm404 "Not found. This page does not exist, or the repository is not public on this forge." |
| 63 | text tfm405 "Method not allowed." |
| 64 | text tfm413 "The request body is too large." |
| 65 | text tfm429 "Too many write requests from this address. Wait a minute and try again." |
| 66 | text tfm500 "The forge hit an internal error serving this page." |
| 67 | text tfm501 "Coming soon. This part of the forge is being built and is not served yet; the feature list says what works today." |
| 68 | text tfmoth "The forge could not serve this request." |
| 69 | text tfmicut "The stored data behind this page is larger than the forge reads in one piece, so an answer built from it would have been incomplete. The forge sent this notice and no part of it. The data is whole in the repository: read it with git." |
| 70 | text tfmovf "This page is too large for the forge to send in one piece (the limit is 8 MiB), so the forge sent this notice and no part of the page. The data is whole in the repository: read it with git." |
| 71 | text tfctj "application/json" |
| 72 | note fovf: 0, or why this response is the too-large notice (1 page, 2 JSON document); flay: the |
| 73 | note lengths of the fragment, the head and the foot of a page (flayout) |
| 74 | global fovf ulong 1 |
| 75 | global flay ulong 3 |
| 76 | text tft400 "Bad request" |
| 77 | text tft403 "Forbidden" |
| 78 | text tft404 "Not found" |
| 79 | text tft405 "Method not allowed" |
| 80 | text tft413 "Too large" |
| 81 | text tft429 "Slow down" |
| 82 | text tft500 "Server error" |
| 83 | text tft501 "Coming soon" |
| 84 | text tftmvg "Moving" |
| 85 | text tfmmvg "This part is moving to the new Interplane store and is not available yet." |
| 86 | fn ferrmsg st ulong to void |
| 87 | if ne get fovf 0 0 |
| 88 | if ne get ficut 0 0 |
| 89 | fput tfmicut |
| 90 | ret |
| 91 | end |
| 92 | fput tfmovf |
| 93 | ret |
| 94 | end |
| 95 | if and eq st 503 ne get fmvng 0 0 |
| 96 | fput tfmmvg |
| 97 | ret |
| 98 | end |
| 99 | if eq st 400 |
| 100 | fput tfm400 |
| 101 | ret |
| 102 | end |
| 103 | if eq st 403 |
| 104 | fput tfm403 |
| 105 | ret |
| 106 | end |
| 107 | if eq st 404 |
| 108 | fput tfm404 |
| 109 | ret |
| 110 | end |
| 111 | if eq st 405 |
| 112 | fput tfm405 |
| 113 | ret |
| 114 | end |
| 115 | if eq st 413 |
| 116 | fput tfm413 |
| 117 | ret |
| 118 | end |
| 119 | if eq st 429 |
| 120 | fput tfm429 |
| 121 | ret |
| 122 | end |
| 123 | if eq st 500 |
| 124 | fput tfm500 |
| 125 | ret |
| 126 | end |
| 127 | if eq st 501 |
| 128 | fput tfm501 |
| 129 | ret |
| 130 | end |
| 131 | fput tfmoth |
| 132 | end |
| 133 | fn ferrti st ulong to void |
| 134 | if and eq st 503 ne get fmvng 0 0 |
| 135 | fsetti tftmvg |
| 136 | ret |
| 137 | end |
| 138 | if eq st 400 |
| 139 | fsetti tft400 |
| 140 | ret |
| 141 | end |
| 142 | if eq st 403 |
| 143 | fsetti tft403 |
| 144 | ret |
| 145 | end |
| 146 | if eq st 404 |
| 147 | fsetti tft404 |
| 148 | ret |
| 149 | end |
| 150 | if eq st 405 |
| 151 | fsetti tft405 |
| 152 | ret |
| 153 | end |
| 154 | if eq st 413 |
| 155 | fsetti tft413 |
| 156 | ret |
| 157 | end |
| 158 | if eq st 429 |
| 159 | fsetti tft429 |
| 160 | ret |
| 161 | end |
| 162 | if eq st 501 |
| 163 | fsetti tft501 |
| 164 | ret |
| 165 | end |
| 166 | fsetti tft500 |
| 167 | end |
| 168 | note fctjson: the content type a handler set starts with application/json |
| 169 | fn fctjson to bool |
| 170 | if lt get fctl 0 len tfctj |
| 171 | ret false |
| 172 | end |
| 173 | for i ulong len tfctj |
| 174 | if ne get fct i get tfctj i |
| 175 | ret false |
| 176 | end |
| 177 | end |
| 178 | ret true |
| 179 | end |
| 180 | note fovfl: the body, its layout or a Location did not fit its buffer (fobtr). Nothing of it is |
| 181 | note sent. The partial body and what the handler set for it (content type, disposition, Location, |
| 182 | note ETag, cache rule, Retry-After, sandbox policy) are dropped and the response becomes a whole 500: |
| 183 | note forge/error/1 when the client asked for JSON or the page was a JSON document (a .json or |
| 184 | note .receipt name needs no Accept header), the error page otherwise. A Set-Cookie stays: what it |
| 185 | note records has already happened. 500 because the request is good and the page exists; the |
| 186 | note server cannot hold this page in its 8 MiB body. Not 413 or 414 (the request is not too large), |
| 187 | note not 503 (asking again gives the same), not 507 (WebDAV storage). |
| 188 | fn fovfl to void |
| 189 | w = ulong 1 |
| 190 | if eq get fkind 0 1 |
| 191 | if fctjson |
| 192 | w = ulong 2 |
| 193 | end |
| 194 | end |
| 195 | put fovf 0 w |
| 196 | put fobl 0 0 |
| 197 | put fobtr 0 0 |
| 198 | put fctl 0 0 |
| 199 | put fcdl 0 0 |
| 200 | put flocl 0 0 |
| 201 | put fetagl 0 0 |
| 202 | put fccl 0 0 |
| 203 | put fretry 0 0 |
| 204 | put fcspsb 0 0 |
| 205 | ferrpage 500 |
| 206 | if eq get fkind 0 0 |
| 207 | flayout |
| 208 | end |
| 209 | end |
| 210 | note flayout: kind 0. The fragment is fob[0,L); fhead and ffoot are appended after it, before any |
| 211 | note header is sent, so that an overflow in them is seen too. flay keeps L and the two lengths. |
| 212 | fn flayout to void |
| 213 | l = get fobl 0 |
| 214 | fhead |
| 215 | h = sub get fobl 0 l |
| 216 | ffoot |
| 217 | put flay 0 l |
| 218 | put flay 1 h |
| 219 | put flay 2 sub sub get fobl 0 l h |
| 220 | end |
| 221 | note fovfany: something was dropped while this response was built |
| 222 | fn fovfany to bool |
| 223 | ret ne get fobtr 0 0 |
| 224 | end |
| 225 | note ferrpage: the error page; a JSON request gets the forge/error/1 document (server/jsonp.om) |
| 226 | fn ferrpage st ulong to void |
| 227 | put fkind 0 0 |
| 228 | put fobl 0 0 |
| 229 | put fjalt 0 0 |
| 230 | if or fjwant eq get fovf 0 2 |
| 231 | fyerr st |
| 232 | ret |
| 233 | end |
| 234 | ferrti st |
| 235 | fput tfe1 |
| 236 | fnum st |
| 237 | fputc 32 |
| 238 | for i ulong get ftil 0 bound 256 |
| 239 | fescc get fti i |
| 240 | end |
| 241 | fput tfe2 |
| 242 | ferrmsg st |
| 243 | fput tfe3 |
| 244 | fputb |
| 245 | fput tfe4 |
| 246 | end |
| 247 | note ---- layout: appended AFTER the fragment; main.om sends head, fragment, foot in that order |
| 248 | fn fwho to void |
| 249 | if eq get fuserl 0 0 |
| 250 | fput tfahref |
| 251 | fputb |
| 252 | fput tflogin |
| 253 | fput tfsignin |
| 254 | ret |
| 255 | end |
| 256 | fput tfahref |
| 257 | fputb |
| 258 | for i ulong get fuserl 0 bound 64 |
| 259 | fescc get fuser i |
| 260 | end |
| 261 | fput tfqgt |
| 262 | for i ulong get fuserl 0 bound 64 |
| 263 | fescc get fuser i |
| 264 | end |
| 265 | fput tfaend |
| 266 | fputc 32 |
| 267 | fput tfso1 |
| 268 | fputb |
| 269 | fput tflogout |
| 270 | fput tfso2 |
| 271 | for i ulong get fcsrfl 0 bound 64 |
| 272 | fescc get fcsrf i |
| 273 | end |
| 274 | fput tfso3 |
| 275 | end |
| 276 | fn fhead to void |
| 277 | fput tfh1 |
| 278 | for i ulong get ftil 0 bound 256 |
| 279 | fescc get fti i |
| 280 | end |
| 281 | fput tfh2 |
| 282 | fputb |
| 283 | fput tfcssp |
| 284 | fput tfh3 |
| 285 | fputb |
| 286 | fput tficop |
| 287 | fput tfh3i |
| 288 | fhalt |
| 289 | fput tfh3b |
| 290 | fput tchrhead |
| 291 | fput tfh4 |
| 292 | fputb |
| 293 | fput tfexp |
| 294 | fput tfh4b |
| 295 | fputb |
| 296 | fput tfstars |
| 297 | fput tfh5 |
| 298 | note each slice may add one entry to the forge row (its seam adds nothing) |
| 299 | ohnav |
| 300 | slnav |
| 301 | rxnav |
| 302 | evnav |
| 303 | fput tfh5b |
| 304 | fputb |
| 305 | fput tfsrch |
| 306 | fput tfh6 |
| 307 | fhdq |
| 308 | fput tfh7 |
| 309 | fwho |
| 310 | fput tfh8 |
| 311 | end |
| 312 | note fhalt: the page's JSON form (docs/API.md): 1 explore, 2 the repo home, 3 the page's own URL, |
| 313 | note 4 the event stream (door/ev5feed.om, the feed page) |
| 314 | fn fhalt to void |
| 315 | k = get fjalt 0 |
| 316 | if eq k 0 |
| 317 | ret |
| 318 | end |
| 319 | fput tfhal1 |
| 320 | if eq k 4 |
| 321 | fputb |
| 322 | fput tfhal4 |
| 323 | fput tfqgt |
| 324 | ret |
| 325 | end |
| 326 | if eq k 3 |
| 327 | fhself |
| 328 | fput tfqgt |
| 329 | ret |
| 330 | end |
| 331 | if eq k 1 |
| 332 | fputb |
| 333 | fput tfhal2 |
| 334 | else |
| 335 | fputrl |
| 336 | fput tfhal3 |
| 337 | end |
| 338 | fput tfqgt |
| 339 | end |
| 340 | note fhself: base, the path without its first /, and the query, escaped for the attribute |
| 341 | fn fhself to void |
| 342 | fputb |
| 343 | n = get fpathl 0 |
| 344 | for k ulong sub n 1 bound 4096 |
| 345 | fescc get fpath add k 1 |
| 346 | end |
| 347 | if gt get fqsl 0 0 |
| 348 | fputc 63 |
| 349 | for k ulong get fqsl 0 bound 4096 |
| 350 | fescc get fqs k |
| 351 | end |
| 352 | end |
| 353 | end |
| 354 | note fhdq: echo the search query into the header box on /search |
| 355 | fn fhdq to void |
| 356 | if not fpeq tfpsrch |
| 357 | ret |
| 358 | end |
| 359 | for i ulong get fql 0 bound 256 |
| 360 | fescc get fq i |
| 361 | end |
| 362 | end |
| 363 | fn ffoot to void |
| 364 | fput tff1 |
| 365 | fput tchrfoot |
| 366 | fput tfsf4 |
| 367 | fputb |
| 368 | fput tfexp |
| 369 | fput tff2 |
| 370 | fputb |
| 371 | fput tfsrch |
| 372 | fput tff3 |
| 373 | fputb |
| 374 | fput tfstars |
| 375 | fput tff4 |
| 376 | note the plain-text form of this page: its own address and query plus format=text (server/tr.om) |
| 377 | fhself |
| 378 | if gt get fqsl 0 0 |
| 379 | fput tff4a |
| 380 | else |
| 381 | fput tff4q |
| 382 | end |
| 383 | fput tff4b |
| 384 | end |
| 385 | note ---- the stylesheet (served at <base>assets/forge.css) |
| 386 | note tchrcss (generated, see the site chrome note above): the site's :root token line, then between |
| 387 | note the two marks the site's header and footer rule lines. tfcssv: the forge's own names for tokens. |
| 388 | text tfcssv ":root{--bg:var(--paper);--fg:var(--ink);--mut:var(--muted);--acc:var(--orange-ink);--box:var(--white)}\n" |
| 389 | note tfcss2: the forge's own rules on the site chrome: Forge marked current, the forge row, main |
| 390 | text tfcss2 ".site-head nav a[aria-current]{color:var(--ink);text-decoration-color:currentColor}\n:where(.site-foot) p{margin:0;color:var(--muted)}\n.forge-row{border-bottom:1px solid var(--line)}\n.forge-bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 24px;min-height:60px;padding-top:8px;padding-bottom:8px}\n.forge-nav{display:flex;gap:24px}.forge-nav a{display:inline-flex;align-items:center;min-height:44px;font-size:15px;font-weight:600;text-decoration:underline 2px transparent;text-underline-offset:10px}.forge-nav a:hover{text-decoration-color:currentColor;text-underline-offset:5px}\n.search{display:flex;gap:6px;flex:1;min-width:200px;max-width:460px}\n.search input{flex:1;min-width:0;min-height:44px;padding:8px 12px;border:1px solid var(--line);border-radius:var(--r2);background:var(--white);color:var(--ink);font:inherit;font-size:15px}\nbutton{padding:5px 10px;border:1px solid var(--line);border-radius:var(--r1);background:var(--white);color:var(--ink);cursor:pointer;font:inherit}button:hover{border-color:var(--ink)}\n.search button,.who button{min-height:44px;padding:8px 16px;border-radius:var(--r2);font-size:15px;font-weight:600}\n.who{margin-left:auto;display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;font-size:15px;font-weight:600}.inline{display:inline}\nmain{max-width:1200px;margin:0 auto;padding:var(--s5) 40px var(--s6);font-size:16px;line-height:1.55}\nmain a{color:var(--acc);text-decoration:none}main a:hover{text-decoration:underline}\nmain h1,main h2,main h3{font-weight:600;letter-spacing:-.03em;line-height:1.2}main h1{font-size:clamp(28px,3.4vw,40px);margin:4px 0 12px}\ncode,pre,.mono{font-size:13px}pre{background:var(--box);border:1px solid var(--line);padding:12px;overflow:auto;border-radius:var(--r2)}\ntable.md{display:block;max-width:100%;overflow-x:auto}\n@media(max-width:1000px){main{padding-left:28px;padding-right:28px}}\n@media(max-width:760px){main{padding:16px 20px var(--s5)}.forge-bar{gap:4px 20px}.search{order:3;flex-basis:100%;max-width:none}.readme{padding:12px 14px}}\n" |
| 391 | text tfcss3 ".muted,.meta{color:var(--mut)}.meta{font-size:13px;margin:2px 0}\n.repos{list-style:none;padding:0;margin:0}.repos li{padding:14px 0;border-bottom:1px solid var(--line)}\n.rname{font-size:17px;font-weight:600}.desc{margin:4px 0}.stars{float:right;color:var(--mut)}\n.rhead h1{font-size:22px;margin:0 0 4px;font-weight:500}.rhead h1 b{font-weight:700}\n.tabs{display:flex;flex-wrap:wrap;gap:4px;border-bottom:1px solid var(--line);margin:14px 0 18px}\n.tabs a{padding:8px 12px;border-bottom:2px solid transparent;color:var(--fg)}.tabs a.on{border-bottom-color:var(--acc);font-weight:600}\n.clone{background:var(--box);border:1px solid var(--line);border-radius:6px;padding:6px 10px;display:inline-block}\n" |
| 392 | text tfcss4 ".bar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:8px 0}\ntable{border-collapse:collapse;width:100%}td,th{padding:6px 8px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}\n.err h1{font-size:26px}.box{border:1px solid var(--line);border-radius:6px;padding:12px 16px;margin:12px 0}\n.ok{color:var(--ok)}.bad{color:var(--bad)}.hit{font-family:ui-monospace,Menlo,monospace;font-size:13px;white-space:pre-wrap;overflow-wrap:anywhere}\ninput[type=text],textarea{width:100%;padding:6px 8px;border:1px solid var(--line);border-radius:6px;background:var(--bg);color:var(--fg);font:inherit}\n@media (max-width:640px){.stars{float:none;display:block}.tabs a{padding:6px 8px}}\n" |
| 393 | text tfcss5 ".releases .release{border:1px solid var(--line);border-radius:6px;padding:12px 16px;margin:12px 0}.release h3{margin:0 0 4px}\n.label{display:inline-block;padding:0 8px;border:1px solid var(--line);border-radius:10px;font-size:12px;color:var(--mut);margin-right:4px}\n.subject{font-weight:600}.notes{white-space:pre-wrap}.assets td:last-child{text-align:right;color:var(--mut)}\n.pager{display:flex;gap:12px;margin:14px 0}.empty{color:var(--mut)}\ndiv.clone{display:block;padding:10px 14px;margin:14px 0}div.clone h3{margin:0 0 6px;font-size:15px}div.clone dl{margin:0;display:grid;grid-template-columns:max-content 1fr;gap:4px 14px}div.clone dt{color:var(--mut)}div.clone dd{margin:0;overflow-wrap:anywhere}\n" |
| 394 | text tfcss6 ".md{line-height:1.6;overflow-wrap:break-word}.md img{max-width:100%}.md table{width:auto}.md-l{text-align:left}.md-c{text-align:center}.md-r{text-align:right}.md blockquote{margin:0;padding:0 12px;border-left:3px solid var(--line);color:var(--mut)}\n.so-bar,.so-tabs{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:8px 0}.so-form{display:inline}.so-btn{padding:3px 10px}.so-n{color:var(--mut);margin-left:4px}.so-on{font-weight:600}\n.so-muted{color:var(--mut)}.so-err{color:var(--bad)}.so-list{list-style:none;padding:0}.so-list li{padding:6px 0;border-bottom:1px solid var(--line)}.so-cmd{display:block;white-space:pre-wrap;background:var(--box);border:1px solid var(--line);border-radius:6px;padding:8px}.so-steps li{margin:6px 0}.so-f{margin:10px 0}\n" |
| 395 | text tfcss7 ".crumbs{margin:8px 0;font-size:15px}.ref{display:inline-block;padding:2px 8px;border:1px solid var(--line);border-radius:6px;background:var(--box);font-size:13px;margin-right:8px}\n.latest{border:1px solid var(--line);border-bottom:0;border-radius:6px 6px 0 0;padding:8px 12px;background:var(--box);font-size:13px;color:var(--mut)}\n.files{margin-top:0}.files .dir a{font-weight:600}.files .sz{text-align:right;color:var(--mut);white-space:nowrap}\n.readme{border:1px solid var(--line);border-radius:6px;padding:16px 24px;margin:16px 0}table.md{width:auto}table.md td,table.md th{border:1px solid var(--line)}\n.code{border:1px solid var(--line);border-radius:6px;overflow-x:auto;font-family:ui-monospace,Menlo,monospace;font-size:13px}.code td{border:0;padding:0 8px;line-height:1.5}\n.ln{text-align:right;color:var(--mut);user-select:none;-webkit-user-select:none;width:1%;white-space:nowrap}.lc{white-space:pre}.img img{max-width:100%}\n" |
| 396 | text tfcss8 ".commits{list-style:none;padding:0;margin:0;border:1px solid var(--line);border-radius:6px}.commits li{padding:8px 12px;border-bottom:1px solid var(--line)}.commits li:last-child{border-bottom:0}\n.box.commit h2{margin:0 0 6px;font-size:18px}pre.msg{white-space:pre-wrap;background:none;border:0;padding:0;margin:6px 0}.stat{font-size:13px;color:var(--mut)}table.stat{width:auto}table.stat td{padding:2px 8px}\n.df{border:1px solid var(--line);border-radius:6px;margin:14px 0;overflow-x:auto}.dfh{padding:6px 12px;background:var(--box);border-bottom:1px solid var(--line);font-family:ui-monospace,Menlo,monospace;font-size:13px}\ntable.diff{font-family:ui-monospace,Menlo,monospace;font-size:13px}table.diff td{border:0;padding:0 8px}td.dc{white-space:pre}tr.da{background:rgba(0,210,148,.15)}tr.dd{background:rgba(255,101,104,.15)}tr.dh,tr.dm{background:var(--box);color:var(--mut)}\ntable.refs td{white-space:nowrap}.badge{display:inline-block;padding:0 8px;border:1px solid var(--acc);border-radius:10px;font-size:12px;color:var(--acc);margin-left:6px}\ntable.code.blame td.bl{white-space:nowrap;color:var(--mut);font-size:12px;border-right:1px solid var(--line);width:1%}tr.bs td{border-top:1px solid var(--line)}p.hit{margin:2px 0}form.inline{display:inline}\n" |
| 397 | note tfcss9: the project page (server/state.om, frepohd, the "For developers" section) and the marker |
| 398 | note of a README link that leaves the site (browse/b_md.om class "ext") |
| 399 | text tfcss9 ".pj-head h1{font-size:34px;line-height:1.15;margin:4px 0 6px;font-weight:700}.pj-head h1 a{color:var(--ink);text-decoration:none}.pj-head h1 a.rname,.pj-by a.rname{font-size:inherit;font-weight:inherit}.pj-head .desc{font-size:19px;margin:0 0 6px;max-width:44em}.pj-by{color:var(--mut);font-size:15px;margin:0 0 10px}\n.state{margin:6px 0 2px;font-size:16px}.state b{display:inline-block;padding:1px 10px;border-radius:999px;margin-right:6px;font-size:14px}.state.ok b{background:var(--panel);color:var(--ok)}.state.no b{background:var(--panel);color:var(--ink)}.state-more{font-size:14px;color:var(--mut);margin:2px 0 8px;max-width:48em}\n.pj-get{margin:14px 0 6px}.pj-get summary{cursor:pointer}.pj-get summary::after{content:\" ▾\"}.pj-get[open] summary::after{content:\" ▴\"}.pj-get code{user-select:all;overflow-wrap:anywhere}.pj-get dd{margin-inline-start:0}.pj-btn{display:inline-flex;align-items:center;min-height:44px;padding:8px 22px;border-radius:var(--r2);background:var(--btn-dark-bg);color:var(--btn-dark-ink);font-weight:700;text-decoration:none}.pj-btn:hover{background:var(--btn-dark-hover);color:var(--btn-dark-ink)}.pj-btn:active{background:var(--btn-dark-press)}.pj-what{color:var(--mut);font-size:14px;max-width:36em}\n.pj-tabs+.readme{border:0;padding:0;margin-top:8px}.pj-tabs+.readme .md{font-size:18px;line-height:1.65}.pj-nordme{font-size:17px;margin:16px 0 8px}\n.pj-dev{margin-top:40px;padding-top:18px;border-top:2px solid var(--line)}.pj-dev h2{font-size:24px;margin:0 0 6px}.pj-terms{display:grid;grid-template-columns:max-content 1fr;gap:6px 16px;margin:10px 0 16px;font-size:15px}.pj-terms dt{font-weight:700}.pj-terms dd{margin:0;overflow-wrap:anywhere}.pj-recs{margin:16px 0}\n.repos .state{font-size:14px;margin:4px 0}.repos .meta .stars{float:none;display:inline}\n.md a.ext::after{content:\" \\2197\";content:\" \\2197\" / \" (leaves this site)\"}\n@media (max-width:640px){.pj-head h1{font-size:28px}.pj-head .desc{font-size:17px}.pj-terms{grid-template-columns:1fr}.pj-terms dd{margin-bottom:8px}}\n" |
| 400 | fn fcssout to void |
| 401 | put fkind 0 1 |
| 402 | fsetct tfctcss |
| 403 | fsetcc tfccpub |
| 404 | fput tchrcss |
| 405 | fput tfcssv |
| 406 | fput tfcss2 |
| 407 | fput tfcss3 |
| 408 | fput tfcss4 |
| 409 | fput tfcss5 |
| 410 | fput tfcss6 |
| 411 | fput tfcss7 |
| 412 | fput tfcss8 |
| 413 | fput tfcss9 |
| 414 | fput tlcss |
| 415 | end |
| 416 | note ---- the site icon (served at <base>assets/favicon.svg; the same drawing as interplane.io's |
| 417 | note /public/favicon.svg). Named in every page head so a browser does not ask /favicon.ico. |
| 418 | text tfctsvg "image/svg+xml" |
| 419 | text tfico "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\"><rect width=\"64\" height=\"64\" rx=\"12\" fill=\"#2563eb\"/><g stroke=\"#ffffff\" stroke-width=\"5\"><path d=\"M32 10v44M10 32h44M16 16l32 32M16 48l32-32\"/></g></svg>\n" |
| 420 | fn ficoout to void |
| 421 | put fkind 0 1 |
| 422 | fsetct tfctsvg |
| 423 | fsetcc tfccpub |
| 424 | fput tfico |
| 425 | end |
| 426 | note ---- repo list item, shared by explore, profile and search: the name, the plain sentence (the |
| 427 | note description), the state (server/state.om), then the last commit and the stars. The caller runs |
| 428 | note fpjload first. |
| 429 | text tfli1 "<li class=\"pj-row\"><a class=\"rname\" href=\"" |
| 430 | text tfli3 "</a><p class=\"desc\">" |
| 431 | text tfli4 "</p>" |
| 432 | text tfli4b "<p class=\"meta\">Last commit: " |
| 433 | text tfli4c " · <span class=\"stars\" title=\"stars\">★ " |
| 434 | text tfli5 "</span></p></li>\n" |
| 435 | text tfnodesc "<span class=\"muted\">No description.</span>" |
| 436 | text tfnolc "unknown" |
| 437 | fn frepoli i ulong to void |
| 438 | fput tfli1 |
| 439 | fputb |
| 440 | fput tfowner |
| 441 | fputc 47 |
| 442 | fputrn i |
| 443 | fput tfqgt |
| 444 | fputrn i |
| 445 | fput tfli3 |
| 446 | if eq get fadl i 0 |
| 447 | fput tfnodesc |
| 448 | else |
| 449 | fdesc i |
| 450 | end |
| 451 | fput tfli4 |
| 452 | fpjrow i |
| 453 | fput tfli4b |
| 454 | if eq get falcl i 0 |
| 455 | fput tfnolc |
| 456 | else |
| 457 | fputlc i |
| 458 | end |
| 459 | fput tfli4c |
| 460 | fnum sostarn i |
| 461 | fput tfli5 |
| 462 | end |
| 463 | note ---- /explore (also the forge home /) |
| 464 | text tfex1 "<h1>Explore repositories</h1><p class=\"muted pj-intro\">" |
| 465 | text tfex2 " projects. Open one to read what it is and to get it. <b>Checked</b> means someone rebuilt it from its source and published a receipt; <b>Unfinished</b> means there is no such receipt yet.</p>\n<ul class=\"repos\">\n" |
| 466 | text tfulend "</ul>\n" |
| 467 | text tfhome1 "<section class=\"box\"><h1>INTERPLANE Forge</h1><p>Agents express intent. The forge retains authority. Read about each project, download it, follow proposed changes and issues, and star the projects you care about.</p></section>\n" |
| 468 | text tftexp "Explore" |
| 469 | text tfthome "Home" |
| 470 | fn fexplore home bool to void |
| 471 | put fjalt 0 1 |
| 472 | if home |
| 473 | fsetti tfthome |
| 474 | fput tfhome1 |
| 475 | else |
| 476 | fsetti tftexp |
| 477 | end |
| 478 | fpjload |
| 479 | fput tfex1 |
| 480 | fnum get fan 0 |
| 481 | fput tfex2 |
| 482 | for i ulong get fan 0 bound FAMAX |
| 483 | frepoli i |
| 484 | end |
| 485 | fput tfulend |
| 486 | end |
| 487 | note ---- /<owner> profile (the node delegate is the only owner) |
| 488 | text tfpr1 "<section class=\"rhead\"><h1><b>" |
| 489 | text tfpr2 "</b></h1><p class=\"muted mono\">did:key:" |
| 490 | text tfpr3 "</p><p><a href=\"" |
| 491 | text tfpfol "/followers" |
| 492 | text tfpr4 " followers</a> · <a href=\"" |
| 493 | text tfpfg "/following" |
| 494 | text tfpr5 " following</a> · " |
| 495 | text tfpr6 " stars received · " |
| 496 | text tfpr7 " favorites received</p><div class=\"bar\">" |
| 497 | text tfpr8 "</div></section>\n<h2>Repositories (" |
| 498 | text tfpr9 ")</h2>\n<ul class=\"repos\">\n" |
| 499 | text tfpr10 "<h2>Starred</h2>\n" |
| 500 | fn fstarsum to ulong |
| 501 | s = ulong 0 |
| 502 | for i ulong get fan 0 bound FAMAX |
| 503 | s = add s sostarn i |
| 504 | end |
| 505 | ret s |
| 506 | end |
| 507 | fn ffavsum to ulong |
| 508 | s = ulong 0 |
| 509 | for i ulong get fan 0 bound FAMAX |
| 510 | s = add s sofavn i |
| 511 | end |
| 512 | ret s |
| 513 | end |
| 514 | fn fprofile to void |
| 515 | fsetti tfowner |
| 516 | fput tfpr1 |
| 517 | fput tfowner |
| 518 | fput tfpr2 |
| 519 | fput tfnid |
| 520 | fput tfpr3 |
| 521 | fputb |
| 522 | fput tfowner |
| 523 | fput tfpfol |
| 524 | fput tfqgt |
| 525 | fnum sofolln |
| 526 | fput tfpr4 |
| 527 | fputb |
| 528 | fput tfowner |
| 529 | fput tfpfg |
| 530 | fput tfqgt |
| 531 | fnum sofollg |
| 532 | fput tfpr5 |
| 533 | fnum fstarsum |
| 534 | fput tfpr6 |
| 535 | fnum ffavsum |
| 536 | fput tfpr7 |
| 537 | sofolbar |
| 538 | fput tfpr8 |
| 539 | fnum get fan 0 |
| 540 | fput tfpr9 |
| 541 | fpjload |
| 542 | for i ulong get fan 0 bound FAMAX |
| 543 | frepoli i |
| 544 | end |
| 545 | fput tfulend |
| 546 | fput tfpr10 |
| 547 | sostarsof |
| 548 | end |
| 549 | note Project and owner names carry class rname: server/tr.om marks that class translate="no" when it |
| 550 | note sends the page, so the page holds no hint of its own (fob sizes stay exact; server/tests/overflow.sh). |
| 551 | note ---- repo header: a short friendly header (name, the plain sentence, who brought it; on the repo |
| 552 | note home also the state and one action to get it), then the tabs. Words for developers (the |
| 553 | note project id, the clone notice, the counts) are in the "For developers" section of the repo home |
| 554 | note (fpjdev1 / fpjdev2), whose stable address is <repo>#For-developers. The id has an upper-case |
| 555 | note letter, so no README heading anchor (browse/b_md.om brmslug: lower case only) can take it. |
| 556 | text tfrh1 "<section class=\"rhead pj-head\"><h1><a class=\"rname\" href=\"" |
| 557 | text tfrh3 "</a></h1><p class=\"desc\">" |
| 558 | text tfrh3n "This project has not described itself yet." |
| 559 | text tfrh4 "</p><p class=\"pj-by\">Brought by <a class=\"rname\" href=\"" |
| 560 | text tfrh4b "</a></p>\n" |
| 561 | text tfrh5 "<div class=\"bar\">" |
| 562 | text tfrh6b "</div></section>\n<nav class=\"tabs pj-tabs\" aria-label=\"Project\">" |
| 563 | text tfrh7 "</nav>\n" |
| 564 | text tfton "\" class=\"on\" aria-current=\"page\">" |
| 565 | text tfabout "About" |
| 566 | text tffiles "Files" |
| 567 | text tfcomm "History" |
| 568 | text tfrel "Releases" |
| 569 | text tfpat "Proposed changes" |
| 570 | text tfiss "Issues" |
| 571 | text tfdevt "For developers" |
| 572 | text tfptree "/tree/" |
| 573 | text tfpcom "/commits" |
| 574 | text tfpbr "/branches" |
| 575 | text tfptag "/tags" |
| 576 | text tfprel "/releases" |
| 577 | text tfppat "/patches" |
| 578 | text tfpiss "/issues" |
| 579 | text tfpdev "#For-developers" |
| 580 | text tfpjson ".json" |
| 581 | text tfpzip "/archive/refs/heads/" |
| 582 | text tfpzipx ".zip" |
| 583 | text tfget4 "<p class=\"pj-get pj-what\">Nothing to download yet.</p>\n" |
| 584 | note fpjempty: set by frepohome: the page has no files to offer (no zip link) |
| 585 | global fpjempty ulong 1 |
| 586 | fn ftab me ulong on ulong p view uchar * t view uchar * to void |
| 587 | fput tfahref |
| 588 | fputrl |
| 589 | fput p |
| 590 | if eq me on |
| 591 | fput tfton |
| 592 | else |
| 593 | fput tfqgt |
| 594 | end |
| 595 | fput t |
| 596 | fput tfaend |
| 597 | end |
| 598 | fn frepohd tab ulong to void |
| 599 | i = get fridx 0 |
| 600 | ok = lt i get fan 0 |
| 601 | home = and eq tab 0 eq get frestl 0 0 |
| 602 | fput tfrh1 |
| 603 | fputrl |
| 604 | fput tfqgt |
| 605 | fputrnm |
| 606 | fput tfrh3 |
| 607 | if and ok gt get fadl i 0 |
| 608 | fdesc i |
| 609 | else |
| 610 | fput tfrh3n |
| 611 | end |
| 612 | fput tfrh4 |
| 613 | fputb |
| 614 | fputown |
| 615 | fput tfqgt |
| 616 | fputown |
| 617 | fput tfrh4b |
| 618 | if and home ok |
| 619 | put fjalt 0 2 |
| 620 | fpjload |
| 621 | fpjfull i |
| 622 | if ne get fpjempty 0 0 |
| 623 | fput tfget4 |
| 624 | else |
| 625 | dlclone |
| 626 | end |
| 627 | end |
| 628 | fput tfrh5 |
| 629 | sobar |
| 630 | fput tfrh6b |
| 631 | on = tab |
| 632 | if and eq tab 0 not home |
| 633 | on = 10 |
| 634 | end |
| 635 | if or eq tab 2 eq tab 3 |
| 636 | on = 20 |
| 637 | end |
| 638 | ftab 0 on tfempty tfabout |
| 639 | fput tfahref |
| 640 | fputrl |
| 641 | fput tfptree |
| 642 | if ok |
| 643 | fputbr i |
| 644 | end |
| 645 | if eq on 10 |
| 646 | fput tfton |
| 647 | else |
| 648 | fput tfqgt |
| 649 | end |
| 650 | fput tffiles |
| 651 | fput tfaend |
| 652 | ftab 1 on tfpcom tfcomm |
| 653 | ftab 4 on tfprel tfrel |
| 654 | ftab 5 on tfppat tfpat |
| 655 | ftab 6 on tfpiss tfiss |
| 656 | ftab 20 on tfpdev tfdevt |
| 657 | fput tfrh7 |
| 658 | end |
| 659 | note ---- the "For developers: proof and records" section of the repo home. fpjdev1 opens it: the |
| 660 | note words that are kept off the top of the page, each with one line of explanation, then the counts |
| 661 | note (server/counts.om fzhtml). The caller adds the branch bar, the clone panel, the newest commit and |
| 662 | note the file list, then fpjdev2 closes it with a link to every record page. |
| 663 | text tfdv1 "<section class=\"pj-dev\" id=\"For-developers\" tabindex=\"-1\" aria-labelledby=\"pj-dev-h\"><h2 id=\"pj-dev-h\">For developers: proof and records</h2>\n<p class=\"pj-lead\">The full record of this project. Words that are used only here are explained once:</p>\n<dl class=\"pj-terms\">\n" |
| 664 | text tfdv6 "\">Proposed changes</a>.</dd>\n<dt>Receipt</dt><dd>A public record that someone checked a claim, with the fingerprint of its evidence file. The state at the top of this page is read from the list at <a href=\"https://interplane.io/receipts/\">interplane.io/receipts</a>. " |
| 665 | text tfdv6b "</dd>\n</dl>" |
| 666 | text tfdv7 "<p class=\"pj-recs\">Every record: <a href=\"" |
| 667 | text tfdv8 "\">History (commits)</a> · <a href=\"" |
| 668 | text tfdv9 "\">Branches</a> · <a href=\"" |
| 669 | text tfdv10 "\">Tags</a> · <a href=\"" |
| 670 | text tfdv11 "\">Releases, with the SHA-256 of each download</a> · <a href=\"" |
| 671 | text tfdv12 "\">Patches</a> · <a href=\"" |
| 672 | text tfdv13 "\">Issues</a> · <a href=\"" |
| 673 | text tfdv14 "\">This project as JSON</a></p>\n</section>\n" |
| 674 | text tfdvnl "\n" |
| 675 | fn fpjdev1 to void |
| 676 | i = get fridx 0 |
| 677 | fput tfdv1 |
| 678 | fpjterms |
| 679 | fputrl |
| 680 | fput tfppat |
| 681 | fput tfdv6 |
| 682 | fpjrcpt |
| 683 | fput tfdv6b |
| 684 | if lt i get fan 0 |
| 685 | fzhtml i |
| 686 | else |
| 687 | fput tfdvnl |
| 688 | end |
| 689 | end |
| 690 | fn fpjdev2 to void |
| 691 | fput tfdv7 |
| 692 | fputrl |
| 693 | fput tfpcom |
| 694 | fput tfdv8 |
| 695 | fputrl |
| 696 | fput tfpbr |
| 697 | fput tfdv9 |
| 698 | fputrl |
| 699 | fput tfptag |
| 700 | fput tfdv10 |
| 701 | fputrl |
| 702 | fput tfprel |
| 703 | fput tfdv11 |
| 704 | fputrl |
| 705 | fput tfppat |
| 706 | fput tfdv12 |
| 707 | fputrl |
| 708 | fput tfpiss |
| 709 | fput tfdv13 |
| 710 | fputrl |
| 711 | fput tfpjson |
| 712 | fput tfdv14 |
| 713 | end |
| 714 | note frepohome: the server's repo home when no slice claimed it (browse seam, or a repository whose |
| 715 | note default branch cannot be read) |
| 716 | text tfrhm0 "<p class=\"pj-nordme\">No files to show here yet.</p>\n" |
| 717 | text tfrhm1 "<p class=\"meta\">Default branch <code>" |
| 718 | text tfrhm2 "</code> · last commit " |
| 719 | text tfrhm3 "</p>\n" |
| 720 | fn frepohome to void |
| 721 | i = get fridx 0 |
| 722 | put ftil 0 0 |
| 723 | ftirepo |
| 724 | put fpjempty 0 1 |
| 725 | frepohd 0 |
| 726 | put fpjempty 0 0 |
| 727 | fput tfrhm0 |
| 728 | fpjdev1 |
| 729 | fput tfrhm1 |
| 730 | fputbr i |
| 731 | fput tfrhm2 |
| 732 | fputlc i |
| 733 | fput tfrhm3 |
| 734 | fpjdev2 |
| 735 | end |
| 736 | note ---- /search?q=: repo names and descriptions (case-insensitive), then code via git grep |
| 737 | text tfsr1 "<h1>Search</h1>\n" |
| 738 | text tfsr2 "<p class=\"muted\">Type a word in the search box: repository names and descriptions are matched, and code is searched with git grep on each public repository's default branch.</p>\n" |
| 739 | text tfsr3 "<h2>Repositories (" |
| 740 | text tfsr4 ")</h2>\n" |
| 741 | text tfsr5 "<p class=\"muted\">No repository name or description matches.</p>\n" |
| 742 | text tftsrch "Search" |
| 743 | fn flow c uchar to uchar |
| 744 | if and ge c 65 le c 90 |
| 745 | ret uchar add c 32 |
| 746 | end |
| 747 | ret c |
| 748 | end |
| 749 | fn fqcap to void |
| 750 | n = fqget tfq |
| 751 | if lt n 0 |
| 752 | n = 0 |
| 753 | end |
| 754 | m = ulong n |
| 755 | if gt m 200 |
| 756 | m = 200 |
| 757 | end |
| 758 | for i ulong m bound 256 |
| 759 | put fq i get fval i |
| 760 | end |
| 761 | put fql 0 m |
| 762 | end |
| 763 | fn fsubat src ulong o ulong l ulong to bool |
| 764 | q = get fql 0 |
| 765 | if or eq q 0 gt q l |
| 766 | ret false |
| 767 | end |
| 768 | for s ulong add sub l q 1 bound 70000 |
| 769 | if fsubeq src add o s |
| 770 | ret true |
| 771 | end |
| 772 | end |
| 773 | ret false |
| 774 | end |
| 775 | fn fsubeq src ulong o ulong to bool |
| 776 | for k ulong get fql 0 bound 256 |
| 777 | c = fsubb src add o k |
| 778 | if ne flow c flow get fq k |
| 779 | ret false |
| 780 | end |
| 781 | end |
| 782 | ret true |
| 783 | end |
| 784 | fn fsubb src ulong k ulong to uchar |
| 785 | if eq src 0 |
| 786 | ret get fanm k |
| 787 | end |
| 788 | ret get fadesc k |
| 789 | end |
| 790 | fn fsrmatch i ulong to bool |
| 791 | if fsubat 0 get fano i get fanl i |
| 792 | ret true |
| 793 | end |
| 794 | ret fsubat 1 get fado i get fadl i |
| 795 | end |
| 796 | fn fsearch to void |
| 797 | fsetti tftsrch |
| 798 | fput tfsr1 |
| 799 | if eq get fql 0 0 |
| 800 | fput tfsr2 |
| 801 | ret |
| 802 | end |
| 803 | n = ulong 0 |
| 804 | for i ulong get fan 0 bound FAMAX |
| 805 | if fsrmatch i |
| 806 | n = add n 1 |
| 807 | end |
| 808 | end |
| 809 | fput tfsr3 |
| 810 | fnum n |
| 811 | fput tfsr4 |
| 812 | if eq n 0 |
| 813 | fput tfsr5 |
| 814 | else |
| 815 | fpjload |
| 816 | fput tfulrep |
| 817 | for i ulong get fan 0 bound FAMAX |
| 818 | if fsrmatch i |
| 819 | frepoli i |
| 820 | end |
| 821 | end |
| 822 | fput tfulend |
| 823 | end |
| 824 | fcodesr |
| 825 | end |
| 826 | note ---- code search: git grep -I -n -i -F --max-count=5 -e <q> <default ref> per repo, at most 100 hits |
| 827 | text tfcs1 "<h2>Code</h2>\n" |
| 828 | text tfcs2 "<p class=\"muted\">No code matches.</p>\n" |
| 829 | text tfcs3 "<div class=\"box\"><p><a href=\"" |
| 830 | text tfcs4 "</a></p>\n" |
| 831 | text tfcs5 "</div>\n" |
| 832 | text tfcs6 "<p class=\"hit\"><a href=\"" |
| 833 | text tfcs7 "</a> " |
| 834 | text tfcs8 "</p>\n" |
| 835 | text tfcsblob "/blob/" |
| 836 | text tfcsl "#L" |
| 837 | text tfgrep "grep" |
| 838 | text tfgI "-I" |
| 839 | text tfgn "-n" |
| 840 | text tfgi "-i" |
| 841 | text tfgF "-F" |
| 842 | text tfgmax "--max-count=5" |
| 843 | text tfge "-e" |
| 844 | text tfcsmore "<p class=\"muted\">Showing the first 100 code matches.</p>\n" |
| 845 | global fhits ulong 1 |
| 846 | fn fcodesr to void |
| 847 | fput tfcs1 |
| 848 | put fhits 0 0 |
| 849 | nscodesr |
| 850 | if eq get fhits 0 0 |
| 851 | fput tfcs2 |
| 852 | end |
| 853 | if ge get fhits 0 100 |
| 854 | fput tfcsmore |
| 855 | end |
| 856 | end |
| 857 | fn fgreparg i ulong to void |
| 858 | fkgiti i |
| 859 | fka tfgrep |
| 860 | fka tfgI |
| 861 | fka tfgn |
| 862 | fka tfgi |
| 863 | fka tfgF |
| 864 | fka tfgmax |
| 865 | fka tfge |
| 866 | fkopen |
| 867 | for k ulong get fql 0 bound 256 |
| 868 | fkc get fq k |
| 869 | end |
| 870 | fkopen |
| 871 | fkt tfrh |
| 872 | o = get fabo i |
| 873 | for k ulong get fabl i bound 64 |
| 874 | fkc get fabr add o k |
| 875 | end |
| 876 | end |
| 877 | note fcsrepo: render repo i's git grep output (already in fxo, read by nodes/srch.om nsrun) |
| 878 | fn fcsrepo i ulong to void |
| 879 | ln = get fxol 0 |
| 880 | if eq ln 0 |
| 881 | ret |
| 882 | end |
| 883 | fput tfcs3 |
| 884 | fputb |
| 885 | fput tfowner |
| 886 | fputc 47 |
| 887 | fputrn i |
| 888 | fput tfqgt |
| 889 | fput tfowner |
| 890 | fputc 47 |
| 891 | fputrn i |
| 892 | fput tfcs4 |
| 893 | p = ulong 0 |
| 894 | for it ulong 100000 |
| 895 | if ge p ln |
| 896 | break |
| 897 | end |
| 898 | if ge get fhits 0 100 |
| 899 | break |
| 900 | end |
| 901 | e = fleol p ln |
| 902 | fcshit i p e |
| 903 | p = add e 1 |
| 904 | end |
| 905 | fput tfcs5 |
| 906 | end |
| 907 | note fcshit: one line "refs/heads/<b>:<path>:<line>:<text>"; skip the ref prefix (len 11 + branch + 1) |
| 908 | fn fcshit i ulong p ulong e ulong to void |
| 909 | a = add add p 12 get fabl i |
| 910 | if ge a e |
| 911 | ret |
| 912 | end |
| 913 | c1 = fcolon a e |
| 914 | if ge c1 e |
| 915 | ret |
| 916 | end |
| 917 | c2 = fcolon add c1 1 e |
| 918 | if ge c2 e |
| 919 | ret |
| 920 | end |
| 921 | put fhits 0 add get fhits 0 1 |
| 922 | fput tfcs6 |
| 923 | fputb |
| 924 | fput tfowner |
| 925 | fputc 47 |
| 926 | fputrn i |
| 927 | fput tfcsblob |
| 928 | fputbr i |
| 929 | fputc 47 |
| 930 | fxesc a sub c1 a |
| 931 | fput tfcsl |
| 932 | fxesc add c1 1 sub sub c2 c1 1 |
| 933 | fput tfqgt |
| 934 | fxesc a sub c1 a |
| 935 | fputc 58 |
| 936 | fxesc add c1 1 sub sub c2 c1 1 |
| 937 | fput tfcs7 |
| 938 | m = sub sub e c2 1 |
| 939 | if gt m 300 |
| 940 | m = 300 |
| 941 | end |
| 942 | fxesc add c2 1 m |
| 943 | fput tfcs8 |
| 944 | end |
| 945 | fn fcolon a ulong e ulong to ulong |
| 946 | note the bound is the size of fxo: a path in a search hit can be longer than 100,000 bytes |
| 947 | j = a |
| 948 | while lt j e bound 16777216 |
| 949 | if eq get fxo j 58 |
| 950 | ret j |
| 951 | end |
| 952 | j = add j 1 |
| 953 | end |
| 954 | ret e |
| 955 | end |