picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit 2e92a8bfec176e8f4eb220234ab7b0513b8b102b
parent b8243c2d126155520aa1d68c4936b54196b5fb14
Author: Alexander Burger <abu@software-lab.de>
Date:   Wed,  4 Jul 2012 13:34:44 +0200

JavaScript 'lisp' calls
Diffstat:
MCHANGES | 1+
Mlib/form.js | 28++++++++++++++++++++++++++--
2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/CHANGES b/CHANGES @@ -1,4 +1,5 @@ * DDmmm12 picoLisp-3.1.1 + JavaScript 'lisp' calls '+DbHint' gui prefix class Stack alignments (64-bit) Native 'struct' function (64-bit) diff --git a/lib/form.js b/lib/form.js @@ -1,14 +1,16 @@ -/* 07mar12abu +/* 04jul12abu * (c) Software Lab. Alexander Burger */ var FormReq = false; var HintReq = false; +var LispReq = false; var Hint, Hints, Item, Beg, End; try { FormReq = new XMLHttpRequest(); HintReq = new XMLHttpRequest(); + LispReq = new XMLHttpRequest(); FormReq.upload.addEventListener("progress", dropProgress, false); FormReq.upload.addEventListener("load", dropLoad, false); } @@ -408,7 +410,10 @@ function hintKey(field, event, tok, coy) { data += "&*Form=" + fld.value; } try {HintReq.send(data);} - catch (e) {HintReq.abort();} + catch (e) { + HintReq.abort(); + return true; + } return (event.keyCode != 45); // INS } @@ -461,3 +466,22 @@ function hintOff(i) { s.background = "white"; s.color= "black"; } + +/*** Lisp calls ***/ +function lisp(url) { + if (!LispReq) + return true; + if (arguments.length > 1) { + url += "?" + encodeURIComponent(arguments[1]); + for (var i = 2; i < arguments.length; ++i) + url += "&" + encodeURIComponent(arguments[i]); + } + try {LispReq.open("GET", url);} + catch (e) {return true;} + try {LispReq.send(null);} + catch (e) { + LispReq.abort(); + return true; + } + return false; +}