178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
self.buf = [rawstring](lib.mem.heapr_raw(self.buf, self.space))
end
lib.mem.cpy(self.buf + self.sz, str, len)
self.sz = self.sz + len
self.buf[self.sz] = 0
return self
end;
m.lit = macro(function(str)
if str:asvalue() ~= nil then
return `[lib.mem.ref(int8)] {ptr = [str:asvalue()], ct = [#(str:asvalue())]}
else
return `[lib.mem.ref(int8)] {ptr = nil, ct = 0}
end
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
self.buf = [rawstring](lib.mem.heapr_raw(self.buf, self.space))
end
lib.mem.cpy(self.buf + self.sz, str, len)
self.sz = self.sz + len
self.buf[self.sz] = 0
return self
end;
terra m.acc:ipush(i: intptr)
var decbuf: int8[21]
var si = lib.math.decstr_friendly(i, &decbuf[20])
var len: intptr = [decbuf.type.N] - (si - &decbuf[0])
return self:push(si,len)
end
terra m.acc:shpush(i: uint64)
var sbuf: int8[lib.math.shorthand.maxlen]
var len = lib.math.shorthand.gen(i,&sbuf[0])
return self:push(&sbuf[0], len)
end
m.lit = macro(function(str)
if str:asvalue() ~= nil then
return `[lib.mem.ref(int8)] {ptr = [str:asvalue()], ct = [#(str:asvalue())]}
else
return `[lib.mem.ref(int8)] {ptr = nil, ct = 0}
end
|