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 / collab / co9page.om
| 1 | note collab/co9page.om (ForgePatches): GET <o>/<r>/compose/<cid>, the checked text with its preview and |
| 2 | note the note that publishing is closed for now, and GET compose/<cid>/<file>, the checked text as a file. |
| 3 | text tcfnc "comment.md" |
| 4 | text tcfnr "review.md" |
| 5 | text tcfni "issue.md" |
| 6 | text tcfnp "patch.md" |
| 7 | text tcmdct "text/markdown; charset=utf-8" |
| 8 | text tccdp "attachment; filename=\"" |
| 9 | text tcpg1 "<section class=\"box\"><h2>" |
| 10 | text tcpk1 "Comment on issue " |
| 11 | text tcpk2 "Comment on patch " |
| 12 | text tcpk3 "Review of patch " |
| 13 | text tcpk4 "New issue" |
| 14 | text tcpk5 "New patch" |
| 15 | text tcpkr ", revision " |
| 16 | text tcpkacc " (accept)" |
| 17 | text tcpkrej " (reject)" |
| 18 | text tcpkdr " (draft)" |
| 19 | text tcpg2 "</h2>\n<p class=\"meta\">The forge checked this text and keeps it for 15 minutes, for this session only. It wrote nothing to this repository.</p>\n<h3>Preview</h3>\n" |
| 20 | text tcpgt1 "<p><b>" |
| 21 | text tcpgt2 "</b></p>\n" |
| 22 | text tcpgnone "<p class=\"muted\">No text.</p>\n" |
| 23 | text tcpg3 "<h3>Publish it</h3>\n<ol class=\"so-steps\">\n" |
| 24 | text tcpgdl1 "<li>Save <a href=\"" |
| 25 | text tcpgdl2 "\" download>" |
| 26 | text tcpgdl3 "</a> to keep a copy.</li>\n" |
| 27 | text tcpgcl "<li>Publishing it is closed for now: Interplane does not accept comments, reviews, issues or patches yet.</li>\n" |
| 28 | text tcpgb1 "<li><a href=\"" |
| 29 | text tcpgb2 "\">Back</a>.</li>\n</ol></section>\n" |
| 30 | note cofneq kd a b: frest[a,b) is the file name of kind kd |
| 31 | fn cofneq kd ulong a ulong b ulong to bool |
| 32 | if or eq kd 1 eq kd 2 |
| 33 | ret coseqat a b tcfnc |
| 34 | end |
| 35 | if eq kd 3 |
| 36 | ret coseqat a b tcfnr |
| 37 | end |
| 38 | if eq kd 4 |
| 39 | ret coseqat a b tcfni |
| 40 | end |
| 41 | ret coseqat a b tcfnp |
| 42 | end |
| 43 | fn cofname kd ulong to void |
| 44 | if or eq kd 1 eq kd 2 |
| 45 | fput tcfnc |
| 46 | ret |
| 47 | end |
| 48 | if eq kd 3 |
| 49 | fput tcfnr |
| 50 | ret |
| 51 | end |
| 52 | if eq kd 4 |
| 53 | fput tcfni |
| 54 | ret |
| 55 | end |
| 56 | fput tcfnp |
| 57 | end |
| 58 | note cocdlf s: the downloaded file: the body (comments, reviews), or the title, a blank line |
| 59 | note and the description (new issues and patches) |
| 60 | fn cocdlf s ulong to long |
| 61 | kd = get gczk s |
| 62 | put fkind 0 1 |
| 63 | fsetct tcmdct |
| 64 | fsetcd tccdp |
| 65 | cocdname kd |
| 66 | fcdc 34 |
| 67 | put fobl 0 0 |
| 68 | if ge kd 4 |
| 69 | for k ulong get gcztl s bound 256 |
| 70 | fputc get gczti add mul s 256 k |
| 71 | end |
| 72 | fputc 10 |
| 73 | if gt get gczbl s 0 |
| 74 | fputc 10 |
| 75 | end |
| 76 | end |
| 77 | n = get gczbl s |
| 78 | o = mul s 60000 |
| 79 | for k ulong n bound 60000 |
| 80 | fputc get gczb add o k |
| 81 | end |
| 82 | if gt n 0 |
| 83 | fputc 10 |
| 84 | end |
| 85 | ret 200 |
| 86 | end |
| 87 | fn cocdname kd ulong to void |
| 88 | if or eq kd 1 eq kd 2 |
| 89 | cocdt tcfnc |
| 90 | ret |
| 91 | end |
| 92 | if eq kd 3 |
| 93 | cocdt tcfnr |
| 94 | ret |
| 95 | end |
| 96 | if eq kd 4 |
| 97 | cocdt tcfni |
| 98 | ret |
| 99 | end |
| 100 | cocdt tcfnp |
| 101 | end |
| 102 | fn cocdt t view uchar * to void |
| 103 | for i ulong len t bound 64 |
| 104 | fcdc get t i |
| 105 | end |
| 106 | end |
| 107 | note ---- the page |
| 108 | fn cocpage s ulong to long |
| 109 | kd = get gczk s |
| 110 | put ftil 0 0 |
| 111 | for i ulong len tctpub |
| 112 | ftic get tctpub i |
| 113 | end |
| 114 | ftirepo |
| 115 | if or eq kd 1 eq kd 4 |
| 116 | frepohd 6 |
| 117 | else |
| 118 | frepohd 5 |
| 119 | end |
| 120 | fput tcpg1 |
| 121 | cocphd s |
| 122 | fput tcpg2 |
| 123 | if ge kd 4 |
| 124 | fput tcpgt1 |
| 125 | for k ulong get gcztl s bound 256 |
| 126 | fescc get gczti add mul s 256 k |
| 127 | end |
| 128 | fput tcpgt2 |
| 129 | end |
| 130 | comdz s |
| 131 | fput tcpg3 |
| 132 | cocpdl s |
| 133 | fput tcpgcl |
| 134 | fput tcpgb1 |
| 135 | cocpback s |
| 136 | fput tcpgb2 |
| 137 | ret 200 |
| 138 | end |
| 139 | note cocphd s: the heading, naming the target |
| 140 | fn cocphd s ulong to void |
| 141 | kd = get gczk s |
| 142 | f = get gczf s |
| 143 | if eq kd 4 |
| 144 | fput tcpk4 |
| 145 | ret |
| 146 | end |
| 147 | if eq kd 5 |
| 148 | fput tcpk5 |
| 149 | if eq and f 8 8 |
| 150 | fput tcpkdr |
| 151 | end |
| 152 | ret |
| 153 | end |
| 154 | if eq kd 1 |
| 155 | fput tcpk1 |
| 156 | else |
| 157 | if eq kd 2 |
| 158 | fput tcpk2 |
| 159 | else |
| 160 | fput tcpk3 |
| 161 | end |
| 162 | end |
| 163 | for k ulong 8 |
| 164 | fputc get gcztg add mul s 40 k |
| 165 | end |
| 166 | if ge kd 2 |
| 167 | fput tcpkr |
| 168 | fnum get gczrn s |
| 169 | end |
| 170 | if and eq kd 3 eq f 1 |
| 171 | fput tcpkacc |
| 172 | end |
| 173 | if and eq kd 3 eq f 2 |
| 174 | fput tcpkrej |
| 175 | end |
| 176 | end |
| 177 | note comdz s: the body of slot s rendered as Markdown (relative links against the default branch) |
| 178 | fn comdz s ulong to void |
| 179 | n = get gczbl s |
| 180 | if eq n 0 |
| 181 | fput tcpgnone |
| 182 | ret |
| 183 | end |
| 184 | o = mul s 60000 |
| 185 | for k ulong n bound 60000 |
| 186 | put fxo k get gczb add o k |
| 187 | end |
| 188 | codrefb |
| 189 | put gbmdl 0 0 |
| 190 | fput tcmd1 |
| 191 | brmd 0 n |
| 192 | fput tcmd2 |
| 193 | end |
| 194 | note cocpdl s: the download step (a review without text needs no file) |
| 195 | fn cocpdl s ulong to void |
| 196 | if and eq get gczk s 3 eq get gczbl s 0 |
| 197 | ret |
| 198 | end |
| 199 | fput tcpgdl1 |
| 200 | fputrl |
| 201 | fput tccompp |
| 202 | for k ulong 32 |
| 203 | fputc get gczid add mul s 32 k |
| 204 | end |
| 205 | fputc 47 |
| 206 | cofname get gczk s |
| 207 | fput tcpgdl2 |
| 208 | cofname get gczk s |
| 209 | fput tcpgdl3 |
| 210 | end |
| 211 | note cocpback s: link back to the issue, the patch or the list |
| 212 | fn cocpback s ulong to void |
| 213 | kd = get gczk s |
| 214 | fputrl |
| 215 | if or eq kd 1 eq kd 4 |
| 216 | fput tcissn |
| 217 | else |
| 218 | fput tcpatn |
| 219 | end |
| 220 | if le kd 3 |
| 221 | for k ulong 40 |
| 222 | fputc get gcztg add mul s 40 k |
| 223 | end |
| 224 | end |
| 225 | end |