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 3c740bf8a46753f80385e80e67bbee0c2562eb7a
parent f01aae80efc12779609d33bf1b6ba46eb4e55bc7
Author: Alexander Burger <abu@software-lab.de>
Date:   Wed, 26 Jun 2013 20:36:14 +0200

'Chg' + 'auto' flags to "Suppress update of currently modified input field"
Diffstat:
Mersatz/picolisp.jar | 0
Mlib/form.js | 284++++++++++++++++++++++++++++++++++++++++++-------------------------------------
Msrc/vers.h | 2+-
Msrc64/tags | 244++++++++++++++++++++++++++++++++++++++++---------------------------------------
Msrc64/version.l | 4++--
5 files changed, 277 insertions(+), 257 deletions(-)

diff --git a/ersatz/picolisp.jar b/ersatz/picolisp.jar Binary files differ. diff --git a/lib/form.js b/lib/form.js @@ -1,4 +1,4 @@ -/* 11may13abu +/* 26jun13abu * (c) Software Lab. Alexander Burger */ @@ -8,7 +8,7 @@ FormReq.upload.addEventListener("load", dropLoad, false); var Btn = []; var Queue = []; -var SesId, Key, InBtn, Auto, Drop, Hint, Hints, Item, Beg, End; +var SesId, Key, InBtn, Auto, Chg, Drop, Hint, Hints, Item, Beg, End; function inBtn(flg) {InBtn = flg;} @@ -22,12 +22,15 @@ function formKey(event) { return false; } } + if (event.charCode || event.keyCode == 8) + Chg = true; return true; } function fldChg(field) { + Chg = true; if (!InBtn && Key != 13) - post(field.form, null, null); + post(field.form, false, null, null); return true; } @@ -46,7 +49,7 @@ function doDrop(btn, event) { if (event.dataTransfer.files.length != 0) { Btn.push(Drop = btn); btn.value = "0 %"; - post(btn.form, null, event.dataTransfer.files[0]); + post(btn.form, false, null, event.dataTransfer.files[0]); } } @@ -83,18 +86,17 @@ function doPost(form) { if (i == Btn.length) return true; if (Btn[i].form == form) - break; + return post(form, false, null, null); } - return post(form, null, null); } -function post(form, exe, file) { +function post(form, auto, exe, file) { var i, data; if (!FormReq || !hasElement(form,"*Get") || (i = form.action.indexOf("~")) <= 0) return true; if (FormReq.readyState > 0 && FormReq.readyState < 4) { - Queue.push([form, exe, file]); + Queue.push([form, auto, exe, file]); return false; } form.style.cursor = "wait"; @@ -115,152 +117,165 @@ function post(form, exe, file) { if (Auto) clearTimeout(Auto); - if (r[1]) - Auto = setTimeout("document.getElementById(\"" + r[0] + "\").click()", r[1]); - } - for (i = 1; i < txt.length;) { - var fld = txt[i++]; - var val = decodeURIComponent(txt[i++]); - - if (!fld) { - window[txt[i++]](val); - continue; - } - if (!(fld = document.getElementById(fld))) - continue; - if (fld.tagName == "SPAN") { - if (i != txt.length && txt[i].charAt(0) == "=") - ++i; - if (i == txt.length || txt[i].charAt(0) != "+") { - if (fld.firstChild.tagName != "A") - fld.firstChild.data = val? val : "\u00A0"; - else - fld.replaceChild(document.createTextNode(val? val : "\u00A0"), fld.firstChild); - } - else { - var a = document.createElement("A"); - - setHref(a, txt[i++].substr(1)); - a.appendChild(document.createTextNode(val)); - fld.replaceChild(a, fld.firstChild); - } + if (!r[1]) + Auto = null; + else { + Auto = setTimeout(function() { + if (Chg) + Auto = setTimeout(arguments.callee, r[1]); + else { + Btn.push(document.getElementById(r[0])); + post(form, true, null, null); + } + }, r[1] ); } - else if (fld.tagName == "A") { - if (i != txt.length && txt[i].charAt(0) == "=") - ++i; - if (i == txt.length || txt[i].charAt(0) != "+") { - fld.replaceChild(document.createTextNode(val? val : "\u00A0"), fld.firstChild); - fld.removeAttribute("href"); - } - else { - fld.firstChild.data = val; - setHref(fld, txt[i++].substr(1)); + } + if (!auto || !Chg) { + for (i = 1; i < txt.length;) { + var fld = txt[i++]; + var val = decodeURIComponent(txt[i++]); + + if (!fld) { + window[txt[i++]](val); + continue; } - } - else if (fld.tagName == "IMG") { - var parent = fld.parentNode; - - fld.src = val; - fld.alt = txt[i++]; - if (parent.tagName == "A") { - if (txt[i]) - setHref(parent, txt[i]); + if (!(fld = document.getElementById(fld))) + continue; + if (fld.tagName == "SPAN") { + if (i != txt.length && txt[i].charAt(0) == "=") + ++i; + if (i == txt.length || txt[i].charAt(0) != "+") { + if (fld.firstChild.tagName != "A") + fld.firstChild.data = val? val : "\u00A0"; + else + fld.replaceChild(document.createTextNode(val? val : "\u00A0"), fld.firstChild); + } else { - var grand = parent.parentNode; + var a = document.createElement("A"); - grand.removeChild(parent); - grand.appendChild(fld); + setHref(a, txt[i++].substr(1)); + a.appendChild(document.createTextNode(val)); + fld.replaceChild(a, fld.firstChild); } } - else if (txt[i]) { - var a = document.createElement("A"); - - parent.removeChild(fld); - parent.appendChild(a); - a.appendChild(fld); - setHref(a, txt[i]); - } - ++i; - } - else { - if (fld.type == "checkbox") { - fld.checked = val != ""; - document.getElementsByName(fld.name)[0].value = ""; - } - else if (fld.type == "select-one") { - for (j = 0; j < fld.options.length; ++j) { - if (fld.options[j].text == val) - fld.selectedIndex = j; - fld.options[j].disabled = false; + else if (fld.tagName == "A") { + if (i != txt.length && txt[i].charAt(0) == "=") + ++i; + if (i == txt.length || txt[i].charAt(0) != "+") { + fld.replaceChild(document.createTextNode(val? val : "\u00A0"), fld.firstChild); + fld.removeAttribute("href"); + } + else { + fld.firstChild.data = val; + setHref(fld, txt[i++].substr(1)); } } - else if (fld.type == "radio") { - fld.value = val; - fld.checked = txt[i++].charAt(0) != ""; - } - else if (fld.type == "image") + else if (fld.tagName == "IMG") { + var parent = fld.parentNode; + fld.src = val; - else if (fld.value != val) { - fld.value = val; - fld.scrollTop = fld.scrollHeight; - } - fld.disabled = false; - if (i < txt.length && txt[i].charAt(0) == "=") { - if (fld.type == "select-one") { - for (j = 0; j < fld.options.length; ++j) - if (fld.options[j].text != val) - fld.options[j].disabled = true; + fld.alt = txt[i++]; + if (parent.tagName == "A") { + if (txt[i]) + setHref(parent, txt[i]); + else { + var grand = parent.parentNode; + + grand.removeChild(parent); + grand.appendChild(fld); + } } - fld.disabled = true; - InBtn = 0; // 'onblur' on won't come when disabled - if (fld.type == "checkbox" && fld.checked) - document.getElementsByName(fld.name)[0].value = "T"; - ++i; - } - } - while (i < txt.length && (j = "#*?".indexOf(txt[i].charAt(0))) >= 0) { - switch (j) { - - case 0: // '#' - var cls; - - val = txt[i++].substr(1); - if ((cls = fld.getAttribute("class")) != null && (j = cls.indexOf(" ")) >= 0) - val += cls.substr(j); - fld.setAttribute("class", val); - break; - - case 1: // '*' - var node = fld.parentNode.parentNode.lastChild; - var img = document.createElement("IMG"); - - if (!node.firstChild) - node = fld.parentNode.parentNode.parentNode.lastChild; - node.removeChild(node.firstChild); - img.src = txt[i++].substr(1); - if (!txt[i]) - node.appendChild(img); - else { + else if (txt[i]) { var a = document.createElement("A"); + parent.removeChild(fld); + parent.appendChild(a); + a.appendChild(fld); setHref(a, txt[i]); - a.appendChild(img); - node.appendChild(a); } ++i; - break; - - case 2: // '?' - fld.title = decodeURIComponent(txt[i++].substr(1)); - break; + } + else { + if (fld.type == "checkbox") { + fld.checked = val != ""; + document.getElementsByName(fld.name)[0].value = ""; + } + else if (fld.type == "select-one") { + for (j = 0; j < fld.options.length; ++j) { + if (fld.options[j].text == val) + fld.selectedIndex = j; + fld.options[j].disabled = false; + } + } + else if (fld.type == "radio") { + fld.value = val; + fld.checked = txt[i++].charAt(0) != ""; + } + else if (fld.type == "image") + fld.src = val; + else if (fld.value != val) { + fld.value = val; + fld.scrollTop = fld.scrollHeight; + } + fld.disabled = false; + if (i < txt.length && txt[i].charAt(0) == "=") { + if (fld.type == "select-one") { + for (j = 0; j < fld.options.length; ++j) + if (fld.options[j].text != val) + fld.options[j].disabled = true; + } + fld.disabled = true; + InBtn = 0; // 'onblur' on won't come when disabled + if (fld.type == "checkbox" && fld.checked) + document.getElementsByName(fld.name)[0].value = "T"; + ++i; + } + } + while (i < txt.length && (j = "#*?".indexOf(txt[i].charAt(0))) >= 0) { + switch (j) { + + case 0: // '#' + var cls; + + val = txt[i++].substr(1); + if ((cls = fld.getAttribute("class")) != null && (j = cls.indexOf(" ")) >= 0) + val += cls.substr(j); + fld.setAttribute("class", val); + break; + + case 1: // '*' + var node = fld.parentNode.parentNode.lastChild; + var img = document.createElement("IMG"); + + if (!node.firstChild) + node = fld.parentNode.parentNode.parentNode.lastChild; + node.removeChild(node.firstChild); + img.src = txt[i++].substr(1); + if (!txt[i]) + node.appendChild(img); + else { + var a = document.createElement("A"); + + setHref(a, txt[i]); + a.appendChild(img); + node.appendChild(a); + } + ++i; + break; + + case 2: // '?' + fld.title = decodeURIComponent(txt[i++].substr(1)); + break; + } } } + Chg = false; } } form.style.cursor = ""; if (Queue.length > 0) { var a = Queue.shift(); - post(a[0], a[1], a[2]); + post(a[0], a[1], a[2], a[3]); } } if (!exe) @@ -463,7 +478,8 @@ function addHint(i, field, str) { function setHint(field, item) { Hint.style.visibility = "hidden"; field.value = field.value.substr(0,Beg) + item.firstChild.nodeValue + field.value.substr(End); - post(field.form, null, null); + Chg = true; + post(field.form, false, null, null); field.setSelectionRange(Beg + item.firstChild.nodeValue.length, field.value.length); field.focus(); field.onchange = function() { @@ -493,7 +509,7 @@ function lisp(form, fun) { exe[i-1] = "+" + arguments[i]; else exe[i-1] = "." + encodeURIComponent(arguments[i]); - return post(form, exe, null); + return post(form, false, exe, null); } if (arguments.length > 2) { fun += "?" + lispVal(arguments[2]); diff --git a/src/vers.h b/src/vers.h @@ -1 +1 @@ -static byte Version[4] = {3,1,2,13}; +static byte Version[4] = {3,1,2,14}; diff --git a/src64/tags b/src64/tags @@ -48,119 +48,122 @@ CHAR_LETTER63,1516 CHAR_DIGIT64,1537 -sys/x86-64.linux.defs.l,1959 -ENOENT5,59 -EINTR6,108 -EBADF7,155 -EAGAIN8,194 -EACCES9,227 -EPIPE10,268 -ECONNRESET11,303 -O_RDONLY14,365 -O_WRONLY15,382 -O_RDWR16,399 -O_CREAT17,414 -O_EXCL18,431 -O_TRUNC19,448 -O_APPEND20,466 -F_GETFD21,486 -F_SETFD22,502 -FD_CLOEXEC23,518 -BUFSIZ26,546 -PIPE_BUF27,564 -MAXPATHLEN29,585 -RTLD_LAZY32,613 -RTLD_GLOBAL33,631 -FLOCK36,662 -L_TYPE37,702 -L_WHENCE38,722 -L_START39,744 -L_LEN40,760 -L_PID41,775 -SEEK_SET42,790 -SEEK_CUR43,807 -F_RDLCK44,824 -F_WRLCK45,840 -F_UNLCK46,856 -F_GETFL47,872 -F_SETFL48,888 -F_GETLK49,904 -F_SETLK50,920 -F_SETLKW51,936 -F_SETOWN52,953 -O_NONBLOCK53,970 -O_ASYNC54,992 -STAT57,1019 -ST_MODE58,1061 -ST_SIZE59,1083 -ST_MTIME60,1100 -S_IFMT61,1118 -S_IFDIR62,1144 -TMS65,1180 -TMS_UTIME66,1214 -TMS_STIME67,1232 -TERMIOS70,1261 -C_IFLAG71,1304 -C_LFLAG72,1320 -C_CC73,1337 -ISIG74,1351 -VMIN75,1364 -VTIME76,1377 -TCSADRAIN77,1391 -SIGACTION80,1419 -SIGSET_T81,1462 -SA_HANDLER82,1481 -SA_MASK83,1500 -SA_FLAGS84,1516 -SIG_DFL86,1536 -SIG_IGN87,1552 -SIG_UNBLOCK88,1568 -SIGHUP90,1589 -SIGINT91,1615 -SIGUSR192,1630 -SIGUSR293,1647 -SIGPIPE94,1664 -SIGALRM95,1681 -SIGTERM96,1698 -SIGCHLD97,1715 -SIGCONT98,1732 -SIGSTOP99,1749 -SIGTSTP100,1766 -SIGTTIN101,1783 -SIGTTOU102,1800 -SIGIO103,1817 -SIGNALS104,1832 -WNOHANG107,1894 -WUNTRACED108,1910 -FD_SET111,1938 -TM_SEC114,1975 -TM_MIN115,1990 -TM_HOUR116,2005 -TM_MDAY117,2021 -TM_MON118,2038 -TM_YEAR119,2054 -D_NAME122,2078 -SOCK_STREAM125,2105 -SOCK_DGRAM126,2125 -AF_UNSPEC127,2144 -AF_INET6128,2162 -SOL_SOCKET129,2180 -SO_REUSEADDR130,2199 -IPPROTO_IPV6131,2220 -IPV6_V6ONLY132,2242 -INET6_ADDRSTRLEN133,2263 -NI_MAXHOST135,2290 -NI_NAMEREQD136,2312 -SOCKADDR_IN6138,2333 -SIN6_FAMILY139,2355 -SIN6_PORT140,2375 -SIN6_ADDR141,2393 -ADDRINFO143,2412 -AI_FAMILY144,2430 -AI_SOCKTYPE145,2448 -AI_ADDRLEN146,2468 -AI_ADDR147,2488 -AI_NEXT148,2505 +sys/x86-64.freeBsd.defs.l,1994 +ENOENT5,56 +EINTR6,71 +EBADF7,85 +EAGAIN8,99 +EACCES9,115 +EPIPE10,131 +ECONNRESET11,146 +O_RDONLY14,180 +O_WRONLY15,197 +O_RDWR16,214 +O_CREAT17,229 +O_EXCL18,247 +O_TRUNC19,265 +O_APPEND20,284 +F_GETFD21,301 +F_SETFD22,317 +FD_CLOEXEC23,333 +BUFSIZ26,361 +PIPE_BUF27,379 +MAXPATHLEN28,398 +stdin29,417 +stdout30,442 +stderr31,468 +RTLD_LAZY35,504 +RTLD_GLOBAL36,522 +FLOCK39,553 +L_TYPE40,568 +L_WHENCE41,584 +L_START42,602 +L_LEN43,618 +L_PID44,632 +SEEK_SET45,647 +SEEK_CUR46,664 +F_RDLCK47,681 +F_WRLCK48,697 +F_UNLCK49,713 +F_GETFL50,729 +F_SETFL51,745 +F_GETLK52,761 +F_SETLK53,778 +F_SETLKW54,795 +F_SETOWN55,813 +O_NONBLOCK56,830 +O_ASYNC57,849 +STAT60,874 +ST_MODE61,889 +ST_SIZE62,905 +ST_MTIME63,922 +S_IFMT64,940 +S_IFDIR65,959 +TMS68,988 +TMS_UTIME69,1001 +TMS_STIME70,1019 +TERMIOS73,1048 +C_IFLAG74,1065 +C_LFLAG75,1081 +C_CC76,1098 +ISIG77,1112 +VMIN78,1127 +VTIME79,1141 +TCSADRAIN80,1156 +SIGACTION83,1184 +SIGSET_T84,1203 +SA_HANDLER85,1221 +SA_MASK86,1240 +SA_FLAGS87,1257 +SIG_DFL88,1274 +SIG_IGN89,1290 +SIG_UNBLOCK90,1306 +SIGHUP91,1326 +SIGINT92,1341 +SIGUSR193,1356 +SIGUSR294,1373 +SIGPIPE95,1390 +SIGALRM96,1407 +SIGTERM97,1424 +SIGCHLD98,1441 +SIGCONT99,1458 +SIGSTOP100,1475 +SIGTSTP101,1492 +SIGTTIN102,1509 +SIGTTOU103,1526 +SIGIO104,1543 +SIGNALS105,1558 +WNOHANG108,1583 +WUNTRACED109,1599 +FD_SET112,1627 +TM_SEC115,1652 +TM_MIN116,1667 +TM_HOUR117,1682 +TM_MDAY118,1698 +TM_MON119,1715 +TM_YEAR120,1731 +D_NAME123,1755 +SOCK_STREAM126,1781 +SOCK_DGRAM127,1801 +AF_UNSPEC128,1820 +AF_INET6129,1838 +SOL_SOCKET130,1856 +SO_REUSEADDR131,1879 +IPPROTO_IPV6132,1900 +IPV6_V6ONLY133,1922 +INET6_ADDRSTRLEN134,1943 +NI_MAXHOST135,1969 +NI_NAMEREQD136,1991 +SOCKADDR_IN6137,2011 +SIN6_FAMILY138,2033 +SIN6_PORT139,2053 +SIN6_ADDR140,2071 +ADDRINFO141,2089 +AI_FAMILY142,2107 +AI_SOCKTYPE143,2125 +AI_ADDRLEN144,2145 +AI_ADDR145,2165 +AI_NEXT146,2182 ./glob.l,4331 Data4,51 @@ -410,7 +413,7 @@ sys/x86-64.linux.defs.l,1959 UndefErr1247,85443 DlErr1248,85472 -./main.l,2242 +./main.l,2261 Code4,51 Ret8,106 Retc10,127 @@ -509,6 +512,7 @@ sys/x86-64.linux.defs.l,1959 putStringB2538,62459 begString2550,62673 endString_E2561,62899 +msec_A2576,63247 doArgs2590,63556 doNext2597,63670 doArg2614,63986 @@ -1253,9 +1257,9 @@ sys/x86-64.linux.defs.l,1959 getUdpZ_FB373,9872 putUdpBZ380,10017 -sys/x86-64.linux.code.l,94 -errno_A5,67 -errnoC10,169 -wifstoppedS_F16,287 -wifsignaledS_F21,413 -wtermsigS_A28,568 +sys/x86-64.freeBsd.code.l,94 +errno_A5,64 +errnoC10,158 +wifstoppedS_F21,537 +wifsignaledS_F27,688 +wtermsigS_A36,897 diff --git a/src64/version.l b/src64/version.l @@ -1,6 +1,6 @@ -# 23jun13abu +# 26jun13abu # (c) Software Lab. Alexander Burger -(de *Version 3 1 2 13) +(de *Version 3 1 2 14) # vi:et:ts=3:sw=3