-- need line and paragraph spacing\r
-- update HTML stream\r
-- help cross-referencing\r
-- UI browser pane needs 'back' button\r
-- if cell is rebound, and we allocate c objects, bang\r
-- runtime primitives like fopen: check for null input\r
-- -with combinators are awkward\r
-- amd64 to do:\r
- - alien calls\r
- - port ffi to win64\r
-- intrinsic char-slot set-char-slot for x86\r
-- fix up the min thumb size hack\r
-- the invalid recursion form case needs to be fixed, for inlines too\r
-- code walker & exceptions\r
-- signal handler should not lose stack pointers\r
-- FIELD: char key_vector[32];\r
-- FIELD: union { char b[20]; short s[10]; long l[5]; } data;\r
-- MEMBER: long pad[24];\r
-- C structs, enums, unions: use new-style string mode parsing\r
-- ffi unicode strings: null char security hole\r
-- utf16 string boxing\r
-- [ [ dup call ] dup call ] infer hangs\r
-- slice: if sequence or seq start is changed, abstraction violation\r
-- out of memory error when printing global namespace\r
-- delegating generic words with a non-standard picker\r
-- code gc\r
-- stream server can hang because of exception handler limitations\r
-- better i/o scheduler\r
-- if two tasks write to a unix stream, the buffer can overflow\r
-- font problem: http://iarc1.ece.utexas.edu/~erg/font-bug.JPG\r
-- implement 3.3 floor 4.7 ceiling 4.5 truncate\r
-- make 3.4 bits>double cause an error like 3.4 bits>float does\r
-- float>bits bits>double etc fail in gcc 4.0.3 with -fschedule-insns\r
-- C{ 0/0. 0/0. } C{ 0/0. 0/0. } = . -> f when -ffast-math is not used on x86\r
-- can't type C{ nan.0 nan.0 } or C{ nan nan } at the repl\r
-- "contrib/math/prime.factor" run-file is too slow (~100 seconds)\r
-- test-2integer>x-throws causes an infinite loop in bignum_multiply_unsigned()\r
-- add some tests below to the unit tests\r
-\r
-ALL TESTS BELOW FAIL ON x86 linux 32bit\r
-- 10 [ tan tan tan ] compile-1 ! runs out of memory\r
-\r
-- float not commutative bug (?)\r
- : a 237241607 1516.925984289192 3036109462846 913470293/554864\r
- max min * 994.5872660892654 306803761/112249 -216866846 + -\r
- max 6073750751093 364.7737275664338 3629914314951 + max max\r
- 9630706289317 6275800738949 179761544 + + + 88005566/945\r
- 2358.939297157175 1365.124822588899 max max - 61906796\r
- 388692629/82301 342893943/210229 * min * 381.5493627025407\r
- 10548296/49539 996.7264162840083 * + - ;\r
-\r
-- min/max inline bug\r
- : math-dummy\r
- 1507049 1812.446640674088 2682190027553 7662348747253 max\r
- max max 175956841558 9163603105116 100680937 max min min\r
- 67305963/106562 78534496 63.25709285387058 max + min\r
- 116934358/596083 124000630 27821944/48045 - + max\r
- 357331489/880112 1760057/587415 7297976710833 - * max\r
- -113698191 1404.610575779506 51191522 * * -\r
- 1977.861343144055 -50892488 947579163/437404 * min * ;\r
-\r
-- compiled vs interpreted output differs!\r
- : math-dummy 692476975489 >fixnum ;\r
- : math-dummy -248461184 float>bits ; FAILS\r
-\r
----RATIO---\r
-Compiles VERY SLOWLY\r
-: math-dummy\r
- 292025505/568715131 587196182/778552531 cos neg\r
- 133163510/474434699 >bignum 57689734/429093367 tan cos\r
- 585585439/262485063 neg ;\r
-\r
-Compile fails\r
-: math-dummy 41614997/15884070 392881821/294492125 + sin sin sin tan sin 830428019/886540270 * neg ;\r
-\r
----FLOAT---\r
-Compile fails:\r
-: math-dummy\r
- 0.5589927916549555 tan 2.261878253481278 + tan sin ;\r
-\r
-SLOW compile\r
-: math-dummy\r
- 1.550108042325469 3.888423982091886 - tan tan ;\r
-\r
-Compile fails:\r
-: math-dummy\r
- 2.522378181825594 tan 7.825249292551574 - cos\r
- 0.2875868408644093 + sin >bignum cos >float sin ;\r
-\r
-\r
-x86 problems below\r
-Compile failes:\r
-[ 0.0 cos coth cot neg ]\r
-[ C{ -740108126/802208755 246440723/614809409 } coth sin cot -22338167 - ]\r
-\r
-\r
-\r
-\r
-[ 101637844 ]\r
-Compiling G:374994\r
-101637844 -32579884\r
-\r
-[ -235345183 ]\r
-Compiling G:359656\r
--235345183 33090273\r
-\r
-[ 0 bits>float ]\r
-Compiling G:455019\r
-4.203895392974451e-45 110.8125\r
-\r
-[ -1 float>bits ]\r
-Compiling G:455338\r
-1099286058 4\r
-\r
-[ -15766735 double>bits ]\r
-Compiling G:455023\r
-4702233936300867587 4777205847159578624\r
-\r
-[ -23841331 bits>double ]\r
-Compiling G:455027\r
-5.127236739868035e-270 5.097526873523571e-270\r
-\r
-[ -251924354 1+ ]\r
-Compiling G:455128\r
--251924353 16511103\r
-\r
-[ -258114108 1- ]\r
-Compiling G:455920\r
--258114109 10321347\r
-\r
-[ 259957324 bitnot ]\r
-Compiling G:455227\r
--259957325 8478131\r
-\r
-[ -268435456 quadrant ]\r
-Compiling G:455335\r
-1 0\r
-\r
-[ 620858855246776348355165240843829248 >fixnum ]\r
-Compiling G:457023\r
--268435456 0\r
-\r
-[ 268435455 neg ]\r
-Compiling G:457031\r
--268435455 1\r
-\r
-[ -60976708 next-power-of-2 ]\r
-Compiling G:457308\r
-1 8388608\r
-\r
-[ -132458581 real ]\r
-Compiling G:459251\r
--132458581 1759147\r
-\r
-[ -200388566 floor ]\r
-Compiling G:461226\r
--200388566 938026\r
-\r
-\r
-2 ARGUEMENT INTEGER WORDS\r
-[ 252475730 -1 * ]\r
-Compiling G:452424\r
--252475730 15959726\r
-\r
-[ -268435456 209630756 min ]\r
-Compiling G:452492\r
--268435456 0\r
-\r
-[ -258355397 -181752298 max ]\r
-Compiling G:452699\r
--181752298 19574294\r
-\r
-[ -14282409 -22156592 + ]\r
-Compiling G:452838\r
--36439001 30669863\r
-\r
-[ -48101335 0 - ]\r
-Compiling G:454874\r
--48101335 19007529\r
-\r
-[ -48174218 0 bitxor ]\r
-Compiling G:561725\r
--48174218 18934646\r
-\r
-[ -57534898 -1 bitand ]\r
-Compiling G:562430\r
--57534898 9573966\r
-\r
-[ 75915195 -268435456 bitor ]\r
-Compiling G:563342\r
--192520261 8806331\r
-\r
-[ -264174045 66395852 align ]\r
-Compiling G:564824\r
--201187292 139300\r
-\r
-\r
+- need line and paragraph spacing
+- update HTML stream
+- help cross-referencing
+- UI browser pane needs 'back' button
+- if cell is rebound, and we allocate c objects, bang
+- runtime primitives like fopen: check for null input
+- -with combinators are awkward
+- amd64 to do:
+ - alien calls
+ - port ffi to win64
+- intrinsic char-slot set-char-slot for x86
+- fix up the min thumb size hack
+- the invalid recursion form case needs to be fixed, for inlines too
+- code walker & exceptions
+- signal handler should not lose stack pointers
+- FIELD: char key_vector[32];
+- FIELD: union { char b[20]; short s[10]; long l[5]; } data;
+- MEMBER: long pad[24];
+- C structs, enums, unions: use new-style string mode parsing
+- ffi unicode strings: null char security hole
+- utf16 string boxing
+- [ [ dup call ] dup call ] infer hangs
+- slice: if sequence or seq start is changed, abstraction violation
+- out of memory error when printing global namespace
+- delegating generic words with a non-standard picker
+- code gc
+- stream server can hang because of exception handler limitations
+- better i/o scheduler
+- if two tasks write to a unix stream, the buffer can overflow
+- font problem: http://iarc1.ece.utexas.edu/~erg/font-bug.JPG
+- implement 3.3 floor 4.7 ceiling 4.5 truncate
+- make 3.4 bits>double an error
+- float>bits bits>double etc fail in gcc 4.0.3 with -fschedule-insns
+- C{ 0/0. 0/0. } C{ 0/0. 0/0. } = . -> f when -ffast-math is not used on x86
+- can't type C{ nan.0 nan.0 } or C{ nan nan } at the repl
+++ /dev/null
-/* \r liveUpdater.js originally written by Avi Bryant, author of\r Seaside (http://www.beta4.com/seaside2) \r\r Modifed by Chris Double to add LiveUpdaterPost and use ' \r instead of " for the id.\r*/\rfunction liveUpdaterUri(uri)\r{\r return liveUpdater(function() { return uri; });\r}\r\rfunction liveUpdater(uriFunc)\r{\r var request = false;\r var regex = /<(\w+).*?id='(\w+)'.*?>((.|\n)*)<\/\1>/;\r \r if (window.XMLHttpRequest) {\r request = new XMLHttpRequest();\r }\r \r function update()\r {\r if(request && request.readyState < 4)\r request.abort();\r \r if(!window.XMLHttpRequest)\r request = new ActiveXObject("Microsoft.XMLHTTP");\r \r request.onreadystatechange = processRequestChange;\r request.open("GET", uriFunc());\r request.send(null);\r return false;\r }\r \r function processRequestChange()\r {\r if(request.readyState == 4)\r {\r var results = regex.exec(request.responseText);\r if(results)\r document.getElementById(results[2]).innerHTML = results[3];\r }\r }\r\r return update;\r}\r\rfunction liveUpdaterPost(uriFunc)\r{\r var request = false;\r var regex = /<(\w+).*?id='(\w+)'.*?>((.|\n)*)<\/\1>/;\r \r if (window.XMLHttpRequest) {\r request = new XMLHttpRequest();\r }\r \r function update(data)\r {\r if(request && request.readyState < 4)\r request.abort();\r \r if(!window.XMLHttpRequest)\r request = new ActiveXObject("Microsoft.XMLHTTP");\r \r request.onreadystatechange = processRequestChange;\r request.open("POST", uriFunc());\r request.send(data);\r return false;\r }\r \r function processRequestChange()\r {\r if(request.readyState == 4)\r {\r var results = regex.exec(request.responseText);\r if(results)\r document.getElementById(results[2]).innerHTML = results[3];\r }\r }\r\r return update;\r}\r\r\rfunction liveSearch(id, uri)\r{\r var updater = liveUpdaterPost((function() { return uri; }));\r var last = "";\r var timeout = false;\r \r function update()\r {\r if (last != document.getElementById(id).value)\r updater("s=" + escape(document.getElementById(id).value));\r }\r \r function start() {\r if (timeout)\r window.clearTimeout(timeout);\r \r timeout = window.setTimeout(update, 300);\r }\r\r \r if (navigator.userAgent.indexOf("Safari") > 0)\r document.getElementById(id).addEventListener("keydown",start,false);\r else if (navigator.product == "Gecko")\r document.getElementById(id).addEventListener("keypress",start,false);\r else\r document.getElementById(id).attachEvent("onkeydown",start);\r}
\ No newline at end of file
+++ /dev/null
-! Copyright (C) 2004 Chris Double.
-!
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-!
-! 1. Redistributions of source code must retain the above copyright notice,
-! this list of conditions and the following disclaimer.
-!
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-! this list of conditions and the following disclaimer in the documentation
-! and/or other materials provided with the distribution.
-!
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-!
-! cont-responder code for display forms and anchors that use XMLHttpRequest
-! and the 'liveUpdater.js' code.
-IN: live-updater
-USE: kernel
-USE: io
-USE: strings
-USE: html
-USE: cont-responder
-USE: namespaces
-USE: lists
-
-: get-live-updater-js* ( stream -- string )
- #! Read all lines from the stream, creating a string of the result.
- dup stream-readln dup [ % "\n" % get-live-updater-js* ] [ drop stream-close ] if ;
-
-: get-live-updater-js ( filename -- string )
- #! Return the liveUpdater javascript code as a string.
- <file-reader> [ get-live-updater-js* ] "" make ;
-
-: live-updater-url ( -- url )
- #! Generate an URL to the liveUpdater.js code.
- t [
- [
- "js/liveUpdater.js" get-live-updater-js write
- ] show
- ] register-continuation id>url ;
-
-: include-live-updater-js ( -- )
- #! Write out the HTML script to include the live updater
- #! javascript code.
- <script "JavaScript" =language live-updater-url =src script>
- "" write
- </script> ;
-
-: write-live-anchor-tag ( text -- id )
- #! Write out the HTML for the clickable anchor. This
- #! will have no actionable HREF assigned to it. Instead
- #! an onclick is set via DHTML later to make it run a
- #! quotation on the server. The randomly generated id
- #! for the anchor is returned.
- <a get-random-id dup =id "#" =href a>
- swap write
- </a> ;
-
-: register-live-anchor-quot ( div-id div-quot -- kid )
- #! Register the 'quot' with the cont-responder so
- #! that when it is run it will produce an HTML
- #! fragment which is the output generated by calling
- #! 'quot'. That HTML fragment will be wrapped in a
- #! 'div' with the given id.
- [
- "div-quot" set
- "div-id" set
- ] make-hash [
- [
- t "disable-initial-redirect?" set
- [
- <div "div-id" get =id div> "div-quot" get call </div>
- ] show
- ] bind
- ] cons t swap register-continuation ;
-
-: write-live-anchor-script ( div-id div-quot anchor-id -- )
- #! Write the javascript that will attach the onclick
- #! event handler to the anchor with the 'anchor-id'. The
- #! onclick, when clicked, will retrieve from the server
- #! the HTML generated by the output of 'div-quot' wrapped
- #! in a 'div' tag with the 'div-id'. That 'div' tag will
- #! replace whatever HTML DOM object currently has that same
- #! id.
- <script "JavaScript" =language script>
- "document.getElementById('" write
- write
- "').onclick=liveUpdaterUri('" write
- register-live-anchor-quot id>url write
- "');" write
- </script> ;
-
-: live-anchor ( id quot text -- )
- #! Write out the HTML for an anchor that when clicked
- #! will replace the DOM object on the current page with
- #! the given 'id' with the result of the output of calling
- #! 'quot'.
- write-live-anchor-tag
- write-live-anchor-script ;
-
-: write-live-search-tag ( -- id )
- #! Write out the HTML for the input box. This
- #! will have no actionable keydown assigned to it. Instead
- #! a keydown is set via DHTML later to make it run a
- #! quotation on the server. The randomly generated id
- #! for the input box is returned.
- <input get-random-id dup =id "text" =type input/> ;
-
-: register-live-search-quot ( div-id div-quot -- kid )
- #! Register the 'quot' with the cont-responder so
- #! that when it is run it will produce an HTML
- #! fragment which is the output generated by calling
- #! 'quot'. That HTML fragment will be wrapped in a
- #! 'div' with the given id. The 'quot' is called with
- #! a string on top of the stack. This is the input string
- #! entered in the live search input box.
- [
- "div-quot" set
- "div-id" set
- ] make-hash [
- [
- t "disable-initial-redirect?" set
- #! Retrieve the search query value from the POST parameters.
- [ "s" get ] bind
- [
- #! Don't need the URL as the 'show' won't be resumed.
- drop
- <div "div-id" get =id div> "div-quot" get call </div>
- ] show
- ] bind
- ] cons t swap register-continuation ;
-
-: write-live-search-script ( div-id div-quot id-id -- )
- #! Write the javascript that will attach the keydown handler
- #! to the input box with the give id. Whenever a keydown is
- #! received the 'div-quot' will be executed on the server,
- #! with the input boxes text on top of the stack. The
- #! output of the quot will be an HTML fragment, it is wrapped in
- #! a 'div' with the id 'div-id' and will
- #! replace whatever HTML DOM object currently has that same
- #! id.
- <script "JavaScript" =language script>
- "liveSearch('" write
- write
- "', '" write
- register-live-search-quot id>url write
- "');" write
- </script> ;
-
-: live-search ( div-id div-quot -- )
- #! Write an input text field. The keydown of this
- #! text field will run 'div-quot' on the server with
- #! the value of the text field on the stack. The output
- #! of div-quot will replace the HTML DOM object with the
- #! given id.
- write-live-search-tag
- write-live-search-script ;
"cont-numbers-game"
"todo"
"todo-example"
- "live-updater"
"eval-responder"
"live-updater-responder"
"cont-testing"
: vocab-list ( vocab -- )
#! Write out the HTML for the list of vocabularies. Make the currently
#! selected vocab be 'vocab'.
- <select "vocab" =name "width: 200" =style "20" =size "document.forms.main.submit()" =onchange select>
+ <select "vocab" =name "width: 200px; " =style "20" =size "document.forms.main.submit()" =onchange select>
vocabs [ over swap option ] each drop
</select> ;
: word-list ( vocab word -- )
#! Write out the HTML for the list of words in a vocabulary. Make the 'word' item
#! the currently selected option.
- <select "word" =name "width: 200" =style "20" =size "document.forms.main.submit()" =onchange select>
+ <select "word" =name "width: 200px; " =style "20" =size "document.forms.main.submit()" =onchange select>
swap words natural-sort
[ word-name over swap option ] each drop
</select> ;
<th> "Documentation" write </th>
</tr>
<tr>
- <td "top" =valign "width: 200" =style td> over vocab-list </td>
- <td "top" =valign "width: 200" =style td> 2dup word-list </td>
+ <td "top" =valign "width: 200px;" =style td> over vocab-list </td>
+ <td "top" =valign "width: 200px;" =style td> 2dup word-list </td>
<td "top" =valign td> word-source </td>
</tr>
</table> ;
: get-random-id ( -- id )
#! Generate a random id to use for continuation URL's
- [ 32 [ 9 random-int CHAR: 0 + , ] times ] "" make
- string>number 36 >base ;
+ [ "ID" % 32 [ 9 random-int CHAR: 0 + , ] times ] "" make ;
SYMBOL: table
: do-foo> write-attributes n> drop ">" write-html ;
+: do-foo/> write-attributes n> drop "/>" write-html ;
+
: def-for-html-word-foo> ( name -- )
#! Return the name and code for the foo> patterned
#! word.
: <foo/> [ "<" % % "/>" % ] "" make ;
+: do-<foo/> <foo/> write-html ;
+
: def-for-html-word-<foo/> ( name -- )
#! Return the name and code for the <foo/> patterned
#! word.
- dup <foo/> swap [ do-<foo> ] cons html-word drop ;
+ dup <foo/> swap [ do-<foo/> ] cons html-word drop ;
: foo/> "/>" append ;
: def-for-html-word-foo/> ( name -- )
#! Return the name and code for the foo/> patterned
#! word.
- foo/> [ do-foo> ] html-word define-close ;
+ foo/> [ do-foo/> ] html-word define-close ;
: define-closed-html-word ( name -- )
#! Given an HTML tag name, define the words for
<table>
<tr>
<td>
- "replaceme" swap [
- [ with-html-stream ] show-final
+ get-random-id dup >r swap [
+ with-html-stream
] curry "+" live-anchor
</td>
<td>
</tr>
<tr>
<td> </td>
- <td> <div "replaceme" =id div> </div>
+ <td r> =id td> </td>
</tr>
</table> ;
"A:hover, A:hover { text-decoration: none; color: black; }" print
</style> ;
+: xhtml-preamble
+ "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>" print
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">" print ;
+
: html-document ( title quot -- )
+ xhtml-preamble
swap chars>entities dup
<html>
<head>
! Copyright (C) 2004 Chris Double.
-!
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-!
-! 1. Redistributions of source code must retain the above copyright notice,
-! this list of conditions and the following disclaimer.
-!
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-! this list of conditions and the following disclaimer in the documentation
-! and/or other materials provided with the distribution.
-!
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+! See http://factorcode.org/license.txt for BSD license.
!
-! cont-responder code for display forms and anchors that use XMLHttpRequest
-! and the 'liveUpdater.js' code.
+! cont-responder code for display forms and anchors that use
+! XMLHttpRequest and the 'liveUpdater.js' code.
IN: live-updater
-USING: kernel io strings html cont-responder namespaces lists ;
-
-: get-live-updater-js* ( stream -- string )
- #! Read all lines from the stream, creating a string of the result.
- dup stream-readln dup [ % "\n" % get-live-updater-js* ] [ drop stream-close ] if ;
+USING: cont-responder html io kernel lists namespaces strings
+xml ;
: get-live-updater-js ( filename -- string )
#! Return the liveUpdater javascript code as a string.
"/contrib/httpd/liveUpdater.js" <resource-stream> contents ;
-: live-updater-url ( -- url )
- #! Generate an URL to the liveUpdater.js code.
- t [
- [ get-live-updater-js write ] show
- ] register-continuation id>url ;
-
: include-live-updater-js ( -- )
#! Write out the HTML script to include the live updater
#! javascript code.
- <script "JavaScript" =language live-updater-url =src script>
- "" write
+ <script "JavaScript" =language script>
+ get-live-updater-js write-html
</script> ;
: write-live-anchor-tag ( text -- id )
#! an onclick is set via DHTML later to make it run a
#! quotation on the server. The randomly generated id
#! for the anchor is returned.
- <a get-random-id dup =id "#" =href a>
- swap write
- </a> ;
+ <a get-random-id dup =id "#" =href a> swap write </a> ;
: register-live-anchor-quot ( div-id div-quot -- kid )
#! Register the 'quot' with the cont-responder so
"div-id" set
] make-hash [
[
- t "disable-initial-redirect?" set
+ "disable-initial-redirect?" on
[
<div "div-id" get =id div> "div-quot" get call </div>
] show
#! replace whatever HTML DOM object currently has that same
#! id.
<script "JavaScript" =language script>
- "document.getElementById('" write
- write
- "').onclick=liveUpdaterUri('" write
- register-live-anchor-quot id>url write
- "');" write
+ "document.getElementById('" write-html
+ write-html
+ "').onclick=liveUpdaterUri('" write-html
+ register-live-anchor-quot id>url write-html
+ "');" write-html
</script> ;
: live-anchor ( id quot text -- )
"div-id" set
] make-hash [
[
- t "disable-initial-redirect?" set
+ "disable-initial-redirect?" on
#! Retrieve the search query value from the POST parameters.
[ "s" get ] bind
[
"which stack item(s) the generic word dispatches upon,"
"which methods out of the set of applicable methods are called"
}
-"The " { $link POSTPONE: GENERIC: } " parsing word creates a generic word using the " { $emphasis "simple method combination." } ". Most generic words that come up in practice use this method combination:"
+"The " { $link POSTPONE: GENERIC: } " parsing word creates a generic word using the " { $emphasis "simple method combination" } ". Most generic words that come up in practice use this method combination:"
{ $subsection simple-combination }
"The " { $link POSTPONE: G: } " parsing word allows a different method combination to be specified:"
{ $subsection POSTPONE: G: }
last-block off [ print-element ] with-style ;
: ($block) ( quot -- )
- last-block [ [ terpri ] unless f ] change
+ last-block [ [ terpri ] unless t ] change
call
terpri
last-block on ; inline
\ alien-float t "flushable" set-word-prop
\ set-alien-float [ [ float c-ptr integer ] [ ] ] "infer-effect" set-word-prop
+\ alien-float [ [ c-ptr integer ] [ float ] ] "infer-effect" set-word-prop
+\ alien-float t "flushable" set-word-prop
+
+\ set-alien-double [ [ float c-ptr integer ] [ ] ] "infer-effect" set-word-prop
\ alien-double [ [ c-ptr integer ] [ float ] ] "infer-effect" set-word-prop
\ alien-double t "flushable" set-word-prop
HELP: random-int "( n -- rand )"
{ $values { "rand" "an integer between 0 and n" } }
-{ $description "Outputs a pseudo-random integer in the interval " { $snippet "[0,n]" } "." }
+{ $description "Outputs a pseudo-random integer in the interval " { $snippet "[0,n)" } "." }
{ $notes "As per the closed interval notation, the end-points are included in the interval." } ;
scan-word [ create-constructor ] keep
[ define-constructor ] [ ] ; parsing
-: FORGET: scan use get hash-stack [ forget ] when* ; parsing
+: FORGET: scan use get hash [ forget ] when* ; parsing
error-continuation get continuation-name hash-stack ;
: debug-help ( -- )
- ":s :r show stacks at time of error." print
- ":get ( var -- value ) inspects the error namestack." print
+ ":s :r show stacks at time of error" print
+ ":get ( var -- value ) accesses variables at time of error" print
+ ":error starts the inspector with the error" print
+ ":cc starts the inspector with the error continuation" print
flush ;
: flush-error-handler ( -- )
: go ( n -- ) inspector-slots get nth (inspect) ;
: up ( -- ) inspector-stack get dup pop* pop (inspect) ;
+
+! Another feature.
+IN: errors
+
+: :error ( -- ) error get inspect ;
+: :cc ( -- ) error-continuation get inspect ;
command-button-object dup word? [ synopsis ] [ summary ] if ;
"Describe object" [ drop t ] [ describe ] \ in-browser define-default-command
+"Inspect object" [ drop t ] [ inspect ] \ in-listener define-command
"Describe commands" [ drop t ] [ applicable describe ] \ in-browser define-command
"Prettyprint" [ drop t ] [ . ] \ in-listener define-command
"Push on data stack" [ drop t ] [ ] \ in-listener define-command
TUPLE: pack align fill gap ;
-: pref-dims ( gadget -- list )
- gadget-children [ pref-dim ] map ;
+: pref-dims ( gadget -- list ) [ pref-dim ] map ;
: orient ( gadget seq1 seq2 -- seq )
>r >r gadget-orientation r> r> [ pick set-axis ] 2map nip ;
: <shelf> ( -- pack ) { 1 0 0 } <pack> ;
-M: pack pref-dim ( pack -- dim )
+: pack-pref-dim ( children gadget -- dim )
[
- [
- pref-dims [ max-dim ] keep
- [ { 0 0 0 } [ v+ ] reduce ] keep length 1 - 0 max
- ] keep pack-gap n*v v+
+ >r [ max-dim ] keep
+ [ { 0 0 0 } [ v+ ] reduce ] keep length 1 - 0 max
+ r> pack-gap n*v v+
] keep gadget-orientation set-axis ;
-M: pack layout* ( pack -- ) dup pref-dims packed-layout ;
+M: pack pref-dim ( pack -- dim )
+ [ gadget-children pref-dims ] keep pack-pref-dim ;
+
+M: pack layout* ( pack -- )
+ dup gadget-children pref-dims packed-layout ;
: fast-children-on ( dim axis gadgets -- i )
swapd [ rect-loc origin get v+ v- over v. ] binsearch nip ;