From df0aeb5005b5da6ff74b51f602fcd34476f2c454 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 27 Feb 2013 17:43:28 -0600 Subject: [PATCH] more work --- lib/tput.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/tput.js b/lib/tput.js index b34b2ea..64ac6bc 100644 --- a/lib/tput.js +++ b/lib/tput.js @@ -686,6 +686,7 @@ Tput.prototype._compile = function(val) { } else { // echo('stack.pop()'); // TODO: check screen terminfo for an example echo('String.fromCharCode(stack.pop())'); + //echo('(v = stack.pop() || "", isFinite(v) ? String.fromCharCode(v) : v[0])'); } continue; } @@ -869,6 +870,30 @@ Tput.prototype._compile = function(val) { // Then the same is done for the second parameter. More complex // arithmetic is possible using the stack. + // $ man termcap + if (this.options.termcap) { + // %r Single parameter capability + if (read(/^%r/)) { + expr('()'); + continue; + } + // %+ Add value of next character to this parameter and do binary output + // if (read(/^%\+/)) { + // echo('stack.pop()'); + // continue; + // } + // %2 Do ASCII output of this parameter with a field with of 2 + if (read(/^%2/)) { + echo('stack.pop()'); + continue; + } + // %d Do ASCII output of this parameter with a field with of 3 + // if (read(/^%d/)) { + // echo('stack.pop()'); + // continue; + // } + } + buff += val[0]; val = val.substring(1); } @@ -1179,6 +1204,7 @@ function sprintf(src) { param = isFinite(param) ? String.fromCharCode(param) : ''; + //: param[0]; break; }