Overview
Comment: | add workaround for broken luac |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f673b2abfe779c4bba7a493076762d96 |
User & Date: | lexi on 2022-12-14 08:43:47 |
Other Links: | manifest | tags |
Context
2022-12-14
| ||
08:54 | fix some bugs in luac.lua check-in: 72cb09e451 user: lexi tags: trunk | |
08:43 | add workaround for broken luac check-in: f673b2abfe user: lexi tags: trunk | |
2022-09-30
| ||
21:15 | beginning to hack in fixes to the hideously broken refid resolver check-in: c50482b020 user: lexi tags: trunk | |
Changes
Modified cortav.ct from [607ec9b33c] to [e74ca97d6f].
578 578 *** [`narrative] 579 579 *** [`screenplay]: uses asides to denote actions, quotes for dialogue 580 580 *** [`stageplay]: uses asides to denote actions, quotes for dialogue 581 581 *** [`manual] 582 582 *** [`glossary] 583 583 *** [`news] 584 584 *** [`book]: section depths 1-3 gain additional semantics 585 -***: [*part]: the section gets a page to itself to announce the beginning of a new part or appendix 585 +***: [*part]: the section gets a page to itself to announce the beginning of a new part or appendix. the first part is treated as the title page. 586 586 ***: [*chapter]: the section is preceded by a page break 587 587 ***: [*heading]: the section can occur on the same page as text and headings from other sections 588 588 ** {d pragma accent} specifies an accent hue (in degrees around the color wheel) for renderers which support colorized output 589 589 ** {d pragma accent-spread} is a factor that controls the "spread" of hues used in the document. if 0, only the accent color will be used; if larger, other hues will be used in addition to the primary accent color. 590 590 ** {d pragma dark-on-light on\|off} controls whether the color scheme used should be light-on-dark or dark-on-light 591 591 ** {d pragma page-width} indicates how wide the pages should be 592 592 ** {d pragma title-page} specifies a section to use as a title page, for renderer backends that support pagination ................................................................................ 601 601 the following excerpts of text were recovered from a partially erased hard drive found in the Hawthorne manor in the weeks after the Incident. context is unknown. 602 602 603 603 > —spoke to the man under the bridge again, the one who likes to bite the heads off the fish, and he suggested i take a brief sabbatical and journey to the Wandering Oak (where all paths meet) in search of inspiration and the forsaken sword of Pirate Queen Granuaile. a capital idea! i shall depart upon the morrow, having honored the Lord Odin and poisoned my accursed minstrels as is tradition— 604 604 > —can't smell my soul anymore, but that's beside the point entirely— 605 605 > —that second moon (always have wondered why nobody else seems to notice the damn fool thing except on Michaelmas day). alas, my luck did not endure, and i was soon to find myself knee-deep in— 606 606 > —just have to see about that, won't we!— 607 607 608 -the nearest surviving relative of Lord Hawthorne is believed to be a wandering beggar with a small pet meerkat who sells cursed wooden trinkets to unwary children. she will not be contacted, as the officers of the Yard fear her. 608 +the nearest surviving relative of Lord Hawthorne is believed to be a wandering beggar with a small slow loris for a pet who sells cursed wooden trinkets to unwary children. she will not be contacted, as the officers of the Yard fear her. 609 609 ~~~ 610 610 611 611 ~~~links & notes #lnr [cortav] ~~~ 612 612 this sentence contains a [>zombo link] to zombo com. you can do anything[^any] at zombo com. 613 613 zombo: https://zombo.com 614 614 any: anything you want 615 615 ~~~
Modified cortav.lua from [49893a127f] to [1054336dd5].
158 158 if not id:find'%.' then 159 159 if sec then 160 160 local rid = sec.refs[id] 161 161 if rid then 162 162 return rid, id, sec 163 163 end 164 164 end 165 + 166 + for _, i in ipairs(sec.imports) do 167 + local rr, ri, rs = checkFromSec(i, doc) 168 + if ri then return rr, ri, rs end 169 + end 165 170 166 171 if doc.sections[id] then 167 172 return nil, id, doc.sections[id] 168 173 end 174 + 175 + for _, i in ipairs(doc.globals) do 176 + local rr, ri, rs = checkFromSec(i, doc) 177 + if ri then return rr, ri, rs end 178 + end 169 179 else 170 180 local secid, ref = string.match(id, "(.-)%.(.+)") 171 181 local s 172 182 s = s or doc.sections[secid] 173 183 if s then 174 184 if s.refs[ref] then 175 185 return s.refs[ref], ref, s ................................................................................ 221 231 } 222 232 223 233 ct.sec = declare { 224 234 ident = 'section'; 225 235 mk = function() return { 226 236 blocks = {}; 227 237 refs = {}; 238 + imports = {}; 228 239 depth = 0; 229 240 kind = 'ordinary'; 230 241 } end; 231 242 construct = function(self, id, depth) 232 243 self.id = id 233 244 self.depth = depth or self.depth 234 245 end; ................................................................................ 355 366 nctx.line = ctx.line 356 367 nctx.docDepth = (ctx.docDepth or 0) + ctx.sec.depth - 1 357 368 return newdoc, nctx 358 369 end; 359 370 }; 360 371 mk = function(...) return { 361 372 sections = {}; 373 + globals = {}; 362 374 secorder = {}; 363 375 embed = {}; 364 376 meta = {}; 365 377 vars = {}; 366 378 parents = {...}; 367 379 ext = { 368 380 inhibit = {}; ................................................................................ 1004 1016 ct.directives = { 1005 1017 author = dsetmeta; 1006 1018 license = dsetmeta; 1007 1019 keywords = dsetmeta; 1008 1020 desc = dsetmeta; 1009 1021 when = dcond; 1010 1022 unless = dcond; 1023 + with = function(w,c) 1024 + local _,str = w(2) 1025 + local aka, name = str:match '^([^=])=(.*)$' 1026 + if aka == nil then name=str aka=name end 1027 + 1028 + local o,id,s = c:ref(name) 1029 + if o then -- import object 1030 + c.sec.import.objs[aka] = o 1031 + else -- import scope 1032 + table.insert(c.sec.import.scope, s) 1033 + end 1034 + end; 1035 + global = function(w,c) 1036 + local _,str = w(2) 1037 + if str ~= nil and str ~= '' then 1038 + local aka, name = str:match '^([^=])=(.*)$' 1039 + if aka == nil then name=str aka=name end 1040 + 1041 + local o,id,s = c:ref(name) 1042 + 1043 + if o then 1044 + c.doc.globals.objs[aka] = name 1045 + else 1046 + table.insert(c.doc.globals, s) 1047 + end 1048 + else 1049 + table.insert(c.doc.globals, c.sec) 1050 + end 1051 + end; 1011 1052 pragma = function(w,c) 1012 1053 end; 1013 1054 lang = function(w,c) 1014 1055 local _, op, l = w(2) 1015 1056 local langstack = c.doc.stage.langstack 1016 1057 if op == 'is' then 1017 1058 langstack[math.max(1, #langstack)] = l
Modified ext/transmogrify.lua from [b92020d7d8] to [3dcf8ba97f].
8 8 ['--->'] = '⟶'; 9 9 ['<---'] = '⟵'; 10 10 ['----'] = '⸻'; 11 11 }; 12 12 13 13 { 14 14 ['<==>'] = '⟺'; 15 - ['===>'] = '⇐'; 15 + ['===>'] = '⟹'; 16 16 ['<==='] = '⟸'; 17 17 }; 18 18 19 19 { 20 20 ['<->'] = '↔'; 21 21 ['-->'] = '→'; 22 22 ['<--'] = '←';
Modified makefile from [97fc0b1491] to [a11f003028].
57 57 lua-standalone = $(if $(lua-lib-prefix),$(lua-lib-prefix)/liblua.a,-llua) 58 58 lua-bindeps = -lm -ldl 59 59 60 60 ifneq ($(filter net,$(binds-names)),) 61 61 lua-bindeps += -lcurl 62 62 endif 63 63 64 -dbg-flags-luac = $(if $(debug),,-s) 65 -dbg-flags-cc = $(if $(debug),-g,-s) 66 - 64 +ifneq (luac-broken,) 65 + comp-lua = $(if $(debug),,env strip=1) $(lua) tool/luac.lua $1 $(if $2,>$2) 66 +else 67 + comp-lua = $(luac) $(if $(debug),,-s) -o $(if $2,$2,-) $1 68 +endif 67 69 68 70 # by default, we fetch and parse information about encodings we 69 71 # support so that cortav can do fancy things like format math 70 72 # equations by character class (e.g. italicizing variables) 71 73 # this is not necessary for parsing the format, and can be 72 74 # disabled by blanking the encoding-data list when building 73 75 # ($ make encoding-data=) ................................................................................ 83 85 cat $< >>$@ 84 86 chmod +x $@ 85 87 86 88 # raw bytecode without shebang header, must be run as `lua cortav.lc` 87 89 $(build)/$(executable).lc: sirsem.lua $(encoding-files) cortav.lua $(rendrs) $(extens) cli.lua | $(build)/ 88 90 @echo ' » building with extensions $(extens-names)' 89 91 @echo ' » building with renderers $(rendrs-names)' 90 - $(luac) $(dbg-flags-luac) -o $@ $^ 92 + $(call comp-lua,$^,$@) 91 93 92 94 # true standalone binary, wraps bytecode file and (optionally) lua 93 95 $(build)/$(executable).bin: $(build)/$(executable).lc tool/makeshim.lua $(binds) 94 96 $(lua) tool/makeshim.lua $< "" $(binds-names) |\ 95 97 $(CC) -s -o$@ -xc - -xnone $(binds) $(lua-standalone) $(lua-bindeps) 96 98 97 99 # loadable lua modules for binds, mainly useful for testing ................................................................................ 128 130 129 131 %/: 130 132 mkdir -p $@ 131 133 132 134 $(build)/unicode.txt: | $(build)/ 133 135 curl $(encoding-data-ucs-url) > $@ 134 136 $(build)/ucstbls.lc: $(encoding-data-ucs) tool/ucs.lua | $(build)/ 135 - $(lua) tool/ucs.lua $< | $(luac) -o $@ - 137 + $(lua) tool/ucs.lua $< >$@ 136 138 137 139 .PHONY: install 138 140 install: $(build)/cortav $(build)/cortav-view.sh $(build)/velartrill-cortav-view.desktop | $(bin-prefix)/ 139 141 install $(build)/$(executable) $(bin-prefix) 140 142 install $(build)/cortav-view.sh $(bin-prefix) 141 143 xdg-mime install desk/velartrill-cortav.xml 142 144 xdg-desktop-menu install $(build)/velartrill-cortav-view.desktop
Added tool/luac.lua version [e99572ed87].
1 +-- luac is broken in some distributions, and cannot take more than one 2 +-- argument without crashing on a double free or similar. this 3 +-- completely breaks the cortav build process, so we supply our own 4 +-- ultra-simplistic and painfully primitive luac replacement. 5 +-- this does not generate very good object code. 6 +-- pass luac-broken=1 when building to use 7 +local pgm = "" 8 +local strip = os.getenv("strip")=="1" 9 +if #arg > 1 then 10 + local chunks = {} 11 + for i, f in ipairs(arg) do 12 + local nc = assert(loadfile(f)) 13 + nc = string.format("load%q(...)", string.dump(nc)) 14 + table.insert(chunks, nc) 15 + end 16 + pgm = assert(string.dump(load(table.concat(chunks)))) 17 +else 18 + pgm = assert(string.dump(loadfile(arg[1]))) 19 +end 20 + 21 +io.stdout:write(pgm)
Modified tool/ucs.lua from [cf6aee3c65] to [ccdca620ac].
151 151 152 152 local tab = {} 153 153 local top = 1 154 154 for k,v in pairs(ranges) do 155 155 tab[top] = string.format('{0x%x,0x%x,%u}',table.unpack(v)) 156 156 top = top + 1 157 157 end 158 -io.stdout:write(string.format(tpl, table.concat(tab,',\n'))) 158 +io.stdout:write(string.dump(load(string.format(tpl, table.concat(tab,',\n')))))