-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for node.js, Firefox, Chromium #39
Conversation
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. |
Tested with nodejs:
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:
But nodejs:
|
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. |
targets/asmjs/forth.html
Outdated
{ | ||
var n = document.getElementById("output"); | ||
|
||
if (n) n.innerHTML += str; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why check n
? Isn't the output div always present in this html file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forth_output gets called before the HTML file has been parsed, so it's necessary to drop (or delay) the first line of output. In Firefox, this is much simpler, since you can simply defer execution of the script until after the HTML has been loaded.
The |
Ok! This seems good: |
It seems old versions of I think I've fixed both issues, can you verify the duplicated newlines are gone? |
I think you still have the wrong URL there. |
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 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.