diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-01-13 15:23:48 -0500 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-01-13 15:23:48 -0500 |
commit | c962db0783caec9d00a3fe3b01733f1660305834 (patch) | |
tree | cec4ab72f97ce79bb10974b6ff714a43381d2e67 /lib | |
parent | 3b43441c77feb57720e3adf0d8337fd60af9364e (diff) |
Combine lib* directories
Diffstat (limited to 'lib')
-rw-r--r-- | lib/c/.dir | 0 | ||||
-rw-r--r-- | lib/js/urweb.js | 72 | ||||
-rw-r--r-- | lib/ur/basis.urs (renamed from lib/basis.urs) | 0 | ||||
-rw-r--r-- | lib/ur/top.ur (renamed from lib/top.ur) | 0 | ||||
-rw-r--r-- | lib/ur/top.urs (renamed from lib/top.urs) | 0 |
5 files changed, 72 insertions, 0 deletions
diff --git a/lib/c/.dir b/lib/c/.dir new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/lib/c/.dir diff --git a/lib/js/urweb.js b/lib/js/urweb.js new file mode 100644 index 00000000..0ee19992 --- /dev/null +++ b/lib/js/urweb.js @@ -0,0 +1,72 @@ +function cons(v, ls) { + return { n : ls, v : v }; +} +function callAll(ls) { + for (; ls; ls = ls.n) + ls.v(); +} + +function sc(v) { + return {v : v, h : null}; +} +function sv(s, v) { + s.v = v; + callAll(s.h); +} +function sg(s) { + return s.v; +} + +function ss(s) { + return s; +} +function sr(v) { + return {v : v, h : null}; +} +function sb(x,y) { + var z = y(x.v); + var s = {v : z.v, h : null}; + + function reZ() { + z.h = cons(function() { s.v = z.v; callAll(s.h); }, z.h); + } + + x.h = cons(function() { z = y(x.v); reZ(); s.v = z.v; callAll(s.h); }, x.h); + reZ(); + + return s; +} + +function myParent() { + var pos = document; + + while (pos.lastChild && pos.lastChild.nodeType == 1) + pos = pos.lastChild; + + return pos.parentNode; +} + +function dyn(s) { + var x = document.createElement("span"); + x.innerHTML = s.v; + myParent().appendChild(x); + s.h = cons(function() { x.innerHTML = s.v }, s.h); +} + +function inp(t, s) { + var x = document.createElement(t); + x.value = s.v; + myParent().appendChild(x); + s.h = cons(function() { x.value = s.v }, s.h); + x.onkeyup = function() { sv(s, x.value) }; +} + +function eh(x) { + return x.split("&").join("&").split("<").join("<").split(">").join(">"); +} + +function ts(x) { return x.toString() } +function bs(b) { return (b ? "True" : "False") } + +function pf() { alert("Pattern match failure") } + diff --git a/lib/basis.urs b/lib/ur/basis.urs index b4a40fde..b4a40fde 100644 --- a/lib/basis.urs +++ b/lib/ur/basis.urs diff --git a/lib/top.ur b/lib/ur/top.ur index 35e8519b..35e8519b 100644 --- a/lib/top.ur +++ b/lib/ur/top.ur diff --git a/lib/top.urs b/lib/ur/top.urs index d6315b92..d6315b92 100644 --- a/lib/top.urs +++ b/lib/ur/top.urs |