Skip to content

Commit

Permalink
asmjs: add support for node.js, Firefox, Chromium
Browse files Browse the repository at this point in the history
  • Loading branch information
pipcet committed Apr 24, 2017
1 parent df617ad commit be1656a
Show file tree
Hide file tree
Showing 5 changed files with 263 additions and 79 deletions.
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ env:
- TARGET=arm OS=linux M32=-m32
- TARGET=m68k OS=linux M32=-m32
- TARGET=pdp11 OS=unix M32=-m32 CHECK=check-16-bit
- TARGET=asmjs M32=
- TARGET=asmjs M32=-m32
- TARGET=asmjs M32= JS=js24
- TARGET=asmjs M32=-m32 JS=js24
- TARGET=asmjs M32=-m32 JS=nodejs
matrix:
exclude:
- os: osx
Expand All @@ -26,9 +27,11 @@ matrix:
- os: osx
env: TARGET=pdp11 OS=unix M32=-m32 CHECK=check-16-bit
- os: osx
env: TARGET=asmjs M32=
env: TARGET=asmjs M32= JS=js24
- os: osx
env: TARGET=asmjs M32=-m32
env: TARGET=asmjs M32=-m32 JS=js24
- os: osx
env: TARGET=asmjs M32=-m32 JS=nodejs
install: sh -e install-deps.sh install_${TRAVIS_OS_NAME:-linux}
script: make ${CHECK:-check} M32=$M32 TARGET=$TARGET OS=$OS
notifications:
Expand Down
7 changes: 6 additions & 1 deletion install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ install_linux() {
m68k-tos) download_tosemu;;
pdp11-unix) download_apout;;
avr-*) sudo apt-get install simulavr;;
asmjs-*) sudo apt-get install libmozjs-24-bin;;
esac
case "$TARGET-$JS" in
asmjs-js24) sudo apt-get install libmozjs-24-bin;;
asmjs-nodejs)
wget -qO- https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install nodejs;;
esac
}

Expand Down
42 changes: 42 additions & 0 deletions targets/asmjs/forth.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<title>lbForth</title>
<script>
window.onload = function () {
var node = document.getElementById("input");
document.getElementsByTagName("form")[0].addEventListener("submit", function (e) {
forth_output(node.value + "\n");
forth_input(node.value + "\n");
node.value = "";
e.preventDefault();
});

forth_output("");
};

var output = "";

function forth_output(str)
{
output += str;

var n = document.getElementById("output");

if (n) n.innerHTML = output;
}
</script>
<script type="application/javascript"
src="forth.js">
</script>
</head>
<body>
<pre style="white-space: pre-wrap !important">
<div id="output"></div>
</pre>
<form>
<input id="input"/>
</form>
</body>
</html>
Loading

0 comments on commit be1656a

Please sign in to comment.