]> gitweb.factorcode.org Git - factor.git/commitdiff
various code cleanups, removing some redundant calls to >list, fix i/o timeouts
authorSlava Pestov <slava@factorcode.org>
Sat, 23 Jul 2005 02:18:47 +0000 (02:18 +0000)
committerSlava Pestov <slava@factorcode.org>
Sat, 23 Jul 2005 02:18:47 +0000 (02:18 +0000)
CHANGES.html
TODO.FACTOR.txt
library/bootstrap/image.factor
library/generic/tuple.factor
library/io/directories.factor
library/syntax/prettyprint.factor
library/test/benchmark/hashtables.factor
library/test/interpreter.factor
library/unix/io.factor

index c4d79e75e1af71b8e0de4371071ab146a2a3b6df..ff7f199285ba381979361536c10fa9bcb9716616 100644 (file)
@@ -7,12 +7,14 @@
 
 <ul>
 <li>
-Major improvements to the GUI:
+UI framework:
 <ul>
 <li>Now uses 3-dimensional co-ordinates throughout</li>
-<li>The listener supports styled text output and presentations</li>
 <li>Gradient paint, bevel border paint</li>
-<li>Wheel mouse scrolling</li>
+<li>Split pane gadget</li>
+<li>Horizontal scroll bars and wheel mouse scrolling in scroller gadgets</li>
+<li>Incremental layout improves listener responsiveness</li>
+<li>The listener supports styled text output and presentations</li>
 <li>Slide-show tutorial with live code examples</li>
 <li>Performance improvements, code cleanups, bug fixes</li>
 </ul>
@@ -51,7 +53,7 @@ find-with* ( obj i seq quot -- i elt | quot: elt -- ? )</pre>
 
 <li> The <code>string-compare</code> primitive has been replaced with the lexi word
   which now operates on any pair of sequences of numbers. The
-  string> word has been replaced with <code>>lexi></code>.
+  string> word has been replaced with <code>lexi></code>.
 
 <li> The <code>,</code> word no longer accepts a string as input inside a <code>make-string</code>. In 0.75, the following
   two lines were equivalent:
@@ -94,6 +96,10 @@ write1 ( char -- )</pre>
   a stream that reads from the given string.
 </ul>
 
+<li>Everything else:
+
+<ul>
+
 <li>Many improvements to the matrices library.
 
 <li>Improved inspector. Call it with <code>inspect ( obj -- )</code>.
@@ -111,3 +117,5 @@ write1 ( char -- )</pre>
 <li>md5 hashing algorithm in <code>contrib/crypto/</code> (Doug Coleman).
 
 </ul>
+
+</ul>
index d8ace373c64309056e82abfe758ef77350aab9e4..2a9d1e37230b30fe88a1a35d67138e245f610a96 100644 (file)
@@ -1,5 +1,4 @@
-76:\r
----\r
+- timeouts broken on unix\r
 \r
 + ui:\r
 \r
@@ -9,7 +8,6 @@
 - fix up the min thumb size hack\r
 - gaps in pack layout\r
 - find out why so many small bignums get consed\r
-- repaint only dirty regions of the screen\r
 - faster mouse tracking\r
 - binary search to locate visible children of packs\r
 - rewrite frame layout for new style\r
 - use incremental strategy for all pack layouts where possible\r
 - multiline editing in listener\r
 - sort out clipping off-by-one flaw when filling rectangles\r
+- better menu positioning\r
+- only redraw dirty gadgets\r
+- get stuff in examples dir running in the ui\r
+- opengl rendering\r
+- text selection\r
+- clipboard support\r
 \r
 + tutorial:\r
 \r
@@ -31,7 +35,7 @@
 \r
 + misc\r
 \r
-Investigate:\r
+- sigsegv handling on OS X:\r
 \r
   http://developer.apple.com/technotes/tn2004/tn2123.html#SECLIMITATIONS\r
   http://www.caddr.com/macho/archives/sbcl-devel/2005-3/4742.html\r
@@ -40,6 +44,7 @@ Investigate:
 \r
 - http keep alive, and range get\r
 - code walker & exceptions\r
+- sleep word\r
 \r
 + ffi:\r
 \r
@@ -81,7 +86,6 @@ Investigate:
 \r
 + kernel:\r
 \r
-- sleep word\r
 - there is a problem with hashcodes of words and bootstrapping\r
 - delegating generic words with a non-standard picker\r
 - powerpc has weird callstack residue\r
@@ -93,13 +97,11 @@ Investigate:
 - code gc\r
 - doc comments of generics\r
 - M: object should not inhibit delegation\r
-- renumber types appopriately\r
 \r
 + i/o:\r
 \r
 - faster stream-copy\r
 - reading and writing byte arrays\r
-- clean up line reading code in win32-io\r
 - unix io: handle \n\r and \n\0\r
 - stream server can hang because of exception handler limitations\r
 - better i/o scheduler\r
index dc60eadb7a4e536299bb6c3671b9907d245b6c0c..e50e211561727ddcfe4a625ef0fed752adcdf187 100644 (file)
@@ -193,7 +193,7 @@ M: cons ' ( c -- tagged )
     tuck length - CHAR: \0 fill append ;
 
 : emit-chars ( str -- )
-    >list "big-endian" get [ reverse ] unless
+    "big-endian" get [ reverse ] unless
     0 swap [ swap 16 shift + ] each emit ;
 
 : (pack-string) ( n list -- )
@@ -232,10 +232,10 @@ M: string ' ( string -- pointer )
     align-here r> ;
 
 M: tuple ' ( tuple -- pointer )
-    <mirror> >list tuple-type emit-array ;
+    <mirror> tuple-type emit-array ;
 
 : emit-vector ( vector -- pointer )
-    dup >list array-type emit-array swap length
+    dup array-type emit-array swap length
     object-tag here-as >r
     vector-type >header emit
     emit-fixnum ( length )
@@ -316,8 +316,6 @@ M: hashtable ' ( hashtable -- pointer )
     #! The quotation leaves a boot quotation on the stack.
     [ begin call end ] with-minimal-image ;
 
-: test-image ( quot -- ) with-image >list . ;
-
 : make-image ( name -- )
     #! Make an image for the C interpreter.
     [
index 0080d8c6063d3fd4d0ce61a59cb4726024089918..011f8a639dbb898c7b69896c20f31d5d0c670bd2 100644 (file)
@@ -174,10 +174,6 @@ M: mirror set-nth ( n mirror -- elt )
 M: mirror length ( mirror -- len )
     mirror-tuple array-capacity ;
 
-: tuple>list ( tuple -- list )
-    #! We have to type check here, since <mirror> is unsafe.
-    <mirror> >list ;
-
 : clone-tuple ( tuple -- tuple )
     #! Make a shallow copy of a tuple, without cloning its
     #! delegate.
index fe148bcc7fab57cba691d6ed69aed6510134f287..5c505f658fc274b7575ff799bba3ee801d26edce 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2004, 2005 Slava Pestov.
 ! See http://factor.sf.net/license.txt for BSD license.
 IN: io
-USING: kernel hashtables lists namespaces presentation
-sequences strings unparser ;
+USING: hashtables kernel lists namespaces presentation sequences
+strings styles unparser ;
 
 ! Hyperlinked directory listings.
 
index 8b5b373298f0ba12b4f4d55c40a3012c6eab2a23..e1d2a67ab3789e0959b7cedef43a3f69e82e0f23 100644 (file)
@@ -115,7 +115,7 @@ M: hashtable prettyprint* ( indent hashtable -- indent )
 
 M: tuple prettyprint* ( indent tuple -- indent )
     [
-        \ << swap tuple>list \ >> prettyprint-sequence
+        \ << swap <mirror> >list \ >> prettyprint-sequence
     ] check-recursion ;
 
 M: alien prettyprint* ( alien -- str )
index 087cfb95b8bc3f0ede6ac395e4a42b0d6a591409..53a7a722908da0f1b30b49f7c3d75e8777088a64 100644 (file)
@@ -1,20 +1,14 @@
-USE: strings
-USE: kernel
-USE: math
-USE: test
-USE: unparser
-USE: hashtables
-USE: compiler
-
-! http://inferno.bell-labs.com/cm/cs/who/bwk/interps/pap.html
+USING: compiler hashtables kernel math namespaces test ;
 
 : store-hash ( hashtable n -- )
-    [ [ dup >hex swap pick set-hash ] keep ] repeat drop ; compiled
+    [ [ >float dup pick set-hash ] keep ] repeat drop ;
 
 : lookup-hash ( hashtable n -- )
-    [ [ unparse over hash drop ] keep ] repeat drop ; compiled
+    [ [ >float over hash drop ] keep ] repeat drop ;
 
-: hashtable-benchmark ( n -- )
-    60000 <hashtable> swap 2dup store-hash lookup-hash ; compiled
+: hashtable-benchmark ( -- )
+    100 [
+        80000 1000 <hashtable> swap 2dup store-hash lookup-hash
+    ] times ; compiled
 
-[ ] [ 80000 hashtable-benchmark ] unit-test
+[ ] [ hashtable-benchmark ] unit-test
index 7115d7bb1edd68f6a257970d1447a6aa1868f82b..965eeda937d45b333665ae2b43579081d39c141e 100644 (file)
@@ -72,10 +72,6 @@ USE: sequences
     [ 3 "x" set "x" get ] test-interpreter
 ] unit-test
 
-[ { } ] [
-    [ 2 2 + . ] test-interpreter
-] unit-test
-
 [ { "hi\n" } ] [
     [ [ "hi" print ] string-out ] test-interpreter
 ] unit-test
index 561a3b841ad3b0276d46a665a5db694818a58ca1..004f020c86a08eaa4e5c839ed3c7138449ed5ca0 100644 (file)
@@ -64,6 +64,7 @@ C: port ( handle buffer -- port )
     80 <sbuf> over set-port-sbuf ;
 
 : touch-port ( port -- )
+    ! "touch-port called\n" 14 getenv fwrite 14 getenv fflush
     dup port-timeout dup 0 =
     [ 2drop ] [ millis + swap set-port-cutoff ] ifte ;
 
@@ -77,16 +78,17 @@ M: port set-timeout ( timeout port -- )
 : pending-error ( port -- )
     dup port-error f rot set-port-error throw ;
 
+: report-error ( error port -- )
+    [
+        "Error on fd " %
+        dup port-handle unparse %
+        ": " % swap %
+    ] make-string swap set-port-error ;
+
 : defer-error ( port -- ? )
     #! Return t if it is an unrecoverable error.
-    err_no dup EAGAIN = over EINTR = or [
-        2drop f
-    ] [
-        [
-            "Error on fd " % over port-handle unparse %
-            ": " % strerror %
-        ] make-string swap set-port-error  t
-    ] ifte ;
+    err_no dup EAGAIN = over EINTR = or
+    [ 2drop f ] [ strerror swap report-error ] ifte ;
 
 ! Associates a port with a list of continuations waiting on the
 ! port to finish I/O
@@ -117,7 +119,7 @@ GENERIC: task-container ( task -- vector )
 
 : handle-fd ( task -- )
     dup do-io-task [
-        dup io-task-port touch-port pop-callback [ call ] when*
+        dup io-task-port touch-port pop-callback call
     ] [
         drop
     ] ifte ;
@@ -125,16 +127,15 @@ GENERIC: task-container ( task -- vector )
 : timeout? ( port -- ? )
     port-cutoff dup 0 = not swap millis < and ;
 
-: handle-fd? ( fdset task -- ? )
-    dup io-task-port timeout? [
-        2drop t
-    ] [
-        io-task-fd swap bit-nth
-    ] ifte ;
-
 : handle-fdset ( fdset tasks -- )
     [
-        cdr tuck handle-fd? [ handle-fd ] [ drop ] ifte
+        cdr dup io-task-port timeout? [
+            dup io-task-port "Timeout" swap report-error
+            nip pop-callback call
+        ] [
+            tuck io-task-fd swap bit-nth
+            [ handle-fd ] [ drop ] ifte
+        ] ifte
     ] hash-each-with ;
 
 : init-fdset ( fdset tasks -- )