Closed pipcet closed 7 years ago
Thank you.
I tried to test this. I loaded the forth.html file locally in Firefox, and also made a gh-pages thing: http://larsbrinkhoff.github.io/lbForth/targets/asmjs/forth.html
In both cases, typing something in the input field displays something above it, but quickly dissapears. If I type e.g. words
, I don't see the expected output.
Tested with nodejs:
$nodejs --version
v0.10.25
$nodejs asmjs-forth
readline.js:73
terminal = !!output.isTTY;
^
TypeError: Cannot read property 'isTTY' of undefined
at new Interface (readline.js:73:24)
at Object.exports.createInterface (readline.js:39:10)
at Object.<anonymous> (/home/lars/src/lbForth/asmjs-forth:52:23)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
Maybe that version is ancient. It's what I got in Ubuntu 14.
I added testing with nodejs to the Travis build. I expect it to fail for now, but I'll fix that.
Newlines in stdin doesn't quite work in nodejs. SpiderMonkey is fine:
(echo 42; echo 42 .s) | js24 asmjs-forth
lbForth
ok
ok
<2> 42 42 ok
But nodejs:
(echo 42; echo 42 .s) | nodejs asmjs-forth
lbForth
ok
<1> 4242 ok
I made a hack to add a newline to the nodejs input. This makes the tests pass. BUT it now seems the newlines are sometimes doubled in the input.
The forth.html
needs to be in the lbForth/
folder, not targets/asmjs/
, or we won't find load.fth
.
Ok! This seems good:
http://larsbrinkhoff.github.io/lbForth/targets/asmjs/forth.html
It seems old versions of readline
require an output parameter even if no output is intended. Furthermore, as you've discovered, they don't necessarily wait for one line to complete handling before queueing the second.
I think I've fixed both issues, can you verify the duplicated newlines are gone?
I think you still have the wrong URL there. http://larsbrinkhoff.github.io/lbForth/forth.html works for me.
Yes, sorry. I mean that URL.
Newlines seem good.
Node.js echoes doubly when used from the command line.
I can reproduce that within Emacs, which readline
presumably doesn't recognize as a "terminal", but not in an xterm.
Hopefully fixed. It'd probably be best to avoid the readline library entirely and rely on OS buffering...
Right, I run my shell in Emacs 99% of the time. It does produce strange effects occasionally.
I think this is fine for merging now.
Okay, cool. I've squashed the commits.
Thanks!
IE11 doesn't work, but meh.
Start addressing #36.
nodejs ./forth
should simply work; Firefox should work after copyingforth
toforth.js
andforth.html
toforth.html
in thelbForth/
directory; with the right security settings, afile:///
url will work, but with a web server, it should always work. Chromium won't work withfile:///
urls (I believe there are command line options to fix this but I keep forgetting them), but should work with a web server just like Firefox does.I can't really test Microsoft browsers, but I'm optimistic it shouldn't be too hard to get them working.
No VT100 emulation yet, and the first line of output ("lbForth") gets eaten right now.