34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
..
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
..
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
str = str:gsub('%s+[\n$]','')
str = str:gsub('\n','')
str = str:gsub('</a><a ','</a> <a ') -- keep nav links from getting smooshed
str = str:gsub(tplchar .. '%?([-%w]+)', function(file)
if not docs[file] then docs[file] = data.doc[file] end
return string.format('<a href="#help-%s" class="help">?</a>', file)
end)
for start, mode, key, stop in string.gmatch(str,'()'..tplchar..'([:!]?)([-a-zA-Z0-9_]+)()') do
if string.sub(str,start-1,start-1) ~= '\\' then
segs[#segs+1] = string.sub(str,last,start-1)
fields[#segs] = { key = key:gsub('-','_'), mode = (mode ~= '' and mode or nil) }
last = stop
end
end
segs[#segs+1] = string.sub(str,last)
................................................................................
if not kfac[fld.key] then
rec.entries[#rec.entries + 1] = {
field = fld.key;
type = lib.mem.ptr(int8);
}
end
kfac[fld.key] = (kfac[fld.key] or 0) + 1
sanmode[fld.key] = fld.mode == ':' and 6 or fld.mode == '!' and 5 or 1
end
for key, fac in pairs(kfac) do
local sanfac = sanmode[key]
tallyup[#tallyup + 1] = quote
[runningtally] = [runningtally] + ([symself].[key].ct)*fac*sanfac
end
................................................................................
for idx, seg in ipairs(segs) do
copiers[#copiers+1] = quote [cpypos] = lib.mem.cpy([cpypos], [&opaque]([seg]), [#seg]) end
senders[#senders+1] = quote lib.net.mg_send([destcon], [seg], [#seg]) end
appenders[#appenders+1] = quote [accumulator]:push([seg], [#seg]) end
if fields[idx] and fields[idx].mode then
local f = fields[idx]
local fp = `symself.[f.key]
copiers[#copiers+1] = quote
if fp.ct > 0 then
var san = lib.html.sanitize(pool, fp, [f.mode == ':'])
[cpypos] = lib.mem.cpy([cpypos], [&opaque](san.ptr), san.ct)
--san:free()
end
end
senders[#senders+1] = quote
if fp.ct > 0 then
var san = lib.html.sanitize(pool, fp, [f.mode == ':'])
lib.net.mg_send([destcon], san.ptr, san.ct)
--san:free()
end
end
appenders[#appenders+1] = quote
if fp.ct > 0 then
var san = lib.html.sanitize(pool, fp, [f.mode == ':'])
[accumulator]:ppush(san)
--san:free()
end
end
elseif fields[idx] then
local f = fields[idx]
local fp = `symself.[f.key]
|
|
|
>
>
>
>
>
>
>
>
<
>
|
|
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
..
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
...
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
str = str:gsub('%s+[\n$]','')
str = str:gsub('\n','')
str = str:gsub('</a><a ','</a> <a ') -- keep nav links from getting smooshed
str = str:gsub(tplchar .. '%?([-%w]+)', function(file)
if not docs[file] then docs[file] = data.doc[file] end
return string.format('<a href="#help-%s" class="help">?</a>', file)
end)
for start, mode, key, stop in string.gmatch(str,'()'..tplchar..'([:!$]?)([-a-zA-Z0-9_]+)()') do
if string.sub(str,start-1,start-1) ~= '\\' then
segs[#segs+1] = string.sub(str,last,start-1)
fields[#segs] = { key = key:gsub('-','_'), mode = (mode ~= '' and mode or nil) }
last = stop
end
end
segs[#segs+1] = string.sub(str,last)
................................................................................
if not kfac[fld.key] then
rec.entries[#rec.entries + 1] = {
field = fld.key;
type = lib.mem.ptr(int8);
}
end
kfac[fld.key] = (kfac[fld.key] or 0) + 1
sanmode[fld.key] = fld.mode == ':' and 6
or fld.mode == '!' and 5
or fld.mode == '$' and 2 or 1
end
for key, fac in pairs(kfac) do
local sanfac = sanmode[key]
tallyup[#tallyup + 1] = quote
[runningtally] = [runningtally] + ([symself].[key].ct)*fac*sanfac
end
................................................................................
for idx, seg in ipairs(segs) do
copiers[#copiers+1] = quote [cpypos] = lib.mem.cpy([cpypos], [&opaque]([seg]), [#seg]) end
senders[#senders+1] = quote lib.net.mg_send([destcon], [seg], [#seg]) end
appenders[#appenders+1] = quote [accumulator]:push([seg], [#seg]) end
if fields[idx] and fields[idx].mode then
local f = fields[idx]
local fp = `symself.[f.key]
local sanexp
if f.mode == '$' then
sanexp = `lib.str.qesc(pool, fp)
else
sanexp = `lib.html.sanitize(pool, fp, [f.mode == ':'])
end
copiers[#copiers+1] = quote
if fp.ct > 0 then
var san = sanexp
[cpypos] = lib.mem.cpy([cpypos], [&opaque](san.ptr), san.ct)
--san:free()
end
end
senders[#senders+1] = quote
if fp.ct > 0 then
var san = sanexp
lib.net.mg_send([destcon], san.ptr, san.ct)
--san:free()
end
end
appenders[#appenders+1] = quote
if fp.ct > 0 then
var san = sanexp
[accumulator]:ppush(san)
--san:free()
end
end
elseif fields[idx] then
local f = fields[idx]
local fp = `symself.[f.key]
|