From 43bf846496ed493ab96acb1adff4e622e0dbf95f Mon Sep 17 00:00:00 2001 From: slava Date: Wed, 29 Mar 2006 22:19:58 +0000 Subject: [PATCH] Clean up stack effect display code --- TODO.FACTOR.txt | 36 +++++++++++++++---------------- library/alien/alien-invoke.factor | 6 ++---- library/syntax/see.factor | 15 +++++++------ library/test/prettyprint.factor | 16 ++++++++++++++ 4 files changed, 44 insertions(+), 29 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 5b5503e16a..71281d07b8 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -1,21 +1,27 @@ -0.81: +should fix in 0.82: -- x11 title bars are funny - amd64 %box-struct -- automate .dmg build, put sources there +- get factor running on mac intel +- when generating a 32-bit image on a 64-bit system, large numbers which should + be bignums become fixnums +- httpd fep - defining methods returning structs in objc +- expired aliens in view hash +- clicks sent twice +- speed up ideas: + - only do clipping for certain gadgets + - use glRect +- remove , , set-char*-nth, set-ushort*-nth since they + have incorrect semantics +- cocoa: global menu bar with useful commands + portability: - win64 port -- get factor running on mac intel - amd64 %unbox-struct -- when generating a 32-bit image on a 64-bit system, large numbers which should - be bignums become fixnums + io: -- httpd fep - stream server can hang because of exception handler limitations - better i/o scheduler - yield in a loop starves i/o @@ -27,17 +33,12 @@ - reimplement clicking input - reimplement tab completion - x11 input methods +- x11 title bars are funny - cocoa: - - global menu bar with useful commands - - expired aliens in view hash - don't multiplex in the event loop if there is no pending i/o - horizontal scrolling - fix mouse-overs... -- clicks sent twice -- speed up ideas: - - only do clipping for certain gadgets - - use glRect - - display lists +- display lists - saving the image should save window configuration - make the UI look better, something like this: http://twb.ath.cx/~twb/darcs/OBSOLETE/factor/final.html @@ -55,12 +56,10 @@ + compiler/ffi: -- remove , , set-char*-nth, set-ushort*-nth since they - have incorrect semantics -- can only be called with an alien? - core foundation should use unicode strings -- improve callback efficiency - alien>utf16-string, utf16-string>alien words +- can only be called with an alien? +- improve callback efficiency - float intrinsics - complex float type - complex float intrinsics @@ -78,7 +77,6 @@ + misc: -- clean up stack effect generation code - code walker & exceptions - slice: if sequence or seq start is changed, abstraction violation - make 3.4 bits>double an error diff --git a/library/alien/alien-invoke.factor b/library/alien/alien-invoke.factor index 2fd432ed23..64500b44fa 100644 --- a/library/alien/alien-invoke.factor +++ b/library/alien/alien-invoke.factor @@ -74,10 +74,8 @@ M: alien-invoke stack-reserve* alien-invoke-parameters stack-space ; : parse-arglist ( return seq -- types stack-effect ) - unpair [ - [ "," ?tail drop ] map " " join % " -- " % - swap [ ] [ % ] if-void - ] "" make ; + unpair rot dup "void" = [ drop { } ] [ 1array ] if 2array + effect>string ; : (define-c-word) ( type lib func types stack-effect -- ) >r over create-in >r diff --git a/library/syntax/see.factor b/library/syntax/see.factor index 97784340f4..2f8b6bc080 100644 --- a/library/syntax/see.factor +++ b/library/syntax/see.factor @@ -25,22 +25,25 @@ sequences strings styles words ; [ H{ { font-style italic } } text ] when* ; : stack-picture ( seq -- string ) - dup integer? [ object ] when - [ word-name ] map " " join ; + [ [ % CHAR: \s , ] each ] "" make ; : effect>string ( effect -- string ) [ "( " % dup first stack-picture % - " -- " % + "-- " % second stack-picture % - " )" % + ")" % ] "" make ; : stack-effect ( word -- string ) dup "stack-effect" word-prop [ ] [ - "infer-effect" word-prop - dup [ effect>string ] when + "infer-effect" word-prop dup [ + [ + dup integer? [ object ] when + [ word-name ] map + ] map effect>string + ] when ] ?if ; : synopsis ( word -- string ) diff --git a/library/test/prettyprint.factor b/library/test/prettyprint.factor index 0e10ada2fe..8b89480d9a 100644 --- a/library/test/prettyprint.factor +++ b/library/test/prettyprint.factor @@ -43,6 +43,22 @@ unit-test : baz dup ; +[ "( a b -- c d )" ] [ + { { "a" "b" } { "c" "d" } } effect>string +] unit-test + +[ "( -- c d )" ] [ + { { } { "c" "d" } } effect>string +] unit-test + +[ "( a b -- )" ] [ + { { "a" "b" } { } } effect>string +] unit-test + +[ "( -- )" ] [ + { { } { } } effect>string +] unit-test + [ ] [ [ baz ] infer drop ] unit-test [ "IN: temporary : baz dup ;\n" ] [ [ \ baz see ] string-out ] unit-test