]> gitweb.factorcode.org Git - factor.git/commitdiff
see shows stack effect of primitives, sdl console fix
authorSlava Pestov <slava@factorcode.org>
Mon, 7 Feb 2005 17:16:39 +0000 (17:16 +0000)
committerSlava Pestov <slava@factorcode.org>
Mon, 7 Feb 2005 17:16:39 +0000 (17:16 +0000)
library/sdl/sdl-utils.factor
library/syntax/parser.factor
library/syntax/see.factor
library/words.factor

index da0ebd71659a48790bccf78ace70ce9a7877f583..28bd0be72cc0e51f5e8bb92cdbf85cf46115980d 100644 (file)
@@ -133,8 +133,10 @@ global [
 ] bind
 
 : (lookup-font) ( [[ name ptsize ]] -- font )
-    unswons logical-font swons dup get dup alien-address 0 = [
-        drop f
+    unswons logical-font swons dup get dup alien? [
+        dup alien-address 0 = [
+            drop f
+        ] when
     ] when ;
 
 : lookup-font ( [[ name ptsize ]] -- font )
index ff43e999e076450665f1965c877873e244c2a09c..245087faf6b748f4875af223f6580214da2cac80 100644 (file)
@@ -177,7 +177,7 @@ global [ string-mode off ] bind
 
 : parsed-stack-effect ( parsed str -- parsed )
     over doc-comment-here? [
-        word stack-effect [
+        word "stack-effect" word-property [
             drop
         ] [
             word swap "stack-effect" set-word-property
index 3b7805246335fc1825f8e7d33ee79d38b9a67d58..8d14ce7df5bac80b8a90b0658357be5aa69b2aa8 100644 (file)
@@ -47,14 +47,29 @@ presentation unparser words ;
 : prettyprint-comment ( comment -- )
     "comments" style write-attr ;
 
+: infer-effect. ( effect -- )
+    0 swap
+    " ( " prettyprint-comment
+    2unlist >r [ prettyprint-element ] each r>
+    "-- " write
+    [ prettyprint-element ] each
+    ")" prettyprint-comment
+    drop ;
+
 : stack-effect. ( word -- )
-    stack-effect [
+    dup "stack-effect" word-property [
         " " write
         [ CHAR: ( , , CHAR: ) , ] make-string prettyprint-comment
-    ] when* ;
+    ] [
+        "infer-effect" word-property dup [
+            infer-effect.
+        ] [
+            2drop
+        ] ifte
+    ] ?ifte ;
 
 : documentation. ( indent word -- indent )
-    documentation [
+    "documentation" word-property [
         "\n" split [
             "#!" swap cat2 prettyprint-comment
             dup prettyprint-newline
index bee206f3472c0999a10573b4eb44296be5bdeb42..0c44a095d0f427a574d7636a5bf99a46ff7a9d06 100644 (file)
@@ -66,10 +66,3 @@ PREDICATE: compound promise ( obj -- ? )
     "name" word-property >string ;
 
 : word-vocabulary ( word -- str ) "vocabulary" word-property ;
-
-: stack-effect    ( word -- str )
-    dup "stack-effect" word-property [
-        
-    ] ?unless ;
-
-: documentation   ( word -- str ) "documentation" word-property ;