cleanups, cctx

This commit is contained in:
p.kosyh 2009-10-27 15:07:42 +00:00
parent 9ff01b1c2b
commit c4ce8587b6

View file

@ -8,6 +8,10 @@ stead = {
cctx = { txt = nil, self = nil }, cctx = { txt = nil, self = nil },
} }
function cctx()
return stead.cctx[stead.call_top];
end
function callpush() function callpush()
stead.call_top = stead.call_top + 1; stead.call_top = stead.call_top + 1;
stead.cctx[stead.call_top] = { txt = nil, self = nil }; stead.cctx[stead.call_top] = { txt = nil, self = nil };
@ -23,30 +27,30 @@ end
function self(v) function self(v)
if v ~= nil then if v ~= nil then
stead.cctx[stead.call_top].self = v; cctx().self = v;
end end
return stead.cctx[stead.call_top].self; return cctx().self;
end end
function pclr() function pclr()
stead.cctx[stead.call_top].txt = nil cctx().txt = nil
end end
function pget() function pget()
return stead.cctx[stead.call_top].txt; return cctx().txt;
end end
function p(...) function p(...)
local i local i
for i = 1, stead.table.maxn(arg) do for i = 1, stead.table.maxn(arg) do
stead.cctx[stead.call_top].txt = par('',stead.cctx[stead.call_top].txt, arg[i]); cctx().txt = par('',cctx().txt, arg[i]);
end end
stead.cctx[stead.call_top].txt = cat(stead.cctx[stead.call_top].txt, ' '); cctx().txt = cat(cctx().txt, ' ');
end end
function pn(...) function pn(...)
p(unpack(arg)); p(unpack(arg));
stead.cctx[stead.call_top].txt = par('',stead.cctx[stead.call_top].txt,'^'); cctx().txt = par('',cctx().txt,'^');
end end
-- merge strings with "space" as separator -- merge strings with "space" as separator