]> gitweb.factorcode.org Git - factor.git/commitdiff
Add definition mixin in definitions vocab to replace hard-coded union in ui.tools...
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 27 Mar 2009 02:27:45 +0000 (21:27 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 27 Mar 2009 02:27:45 +0000 (21:27 -0500)
basis/help/topics/topics.factor
basis/math/bitwise/bitwise.factor
basis/opengl/opengl.factor
basis/ui/tools/operations/operations.factor
basis/unicode/breaks/breaks.factor
core/definitions/definitions.factor
core/generic/generic.factor
core/kernel/kernel.factor
core/vocabs/vocabs.factor
core/words/words.factor

index 864b030126947b5f1d1b41441da555169c194359..a251849e8f87fa2507a15d4f2a91fa2f8864bbfd 100644 (file)
@@ -7,8 +7,12 @@ IN: help.topics
 
 TUPLE: link name ;
 
+INSTANCE: link definition
+
 MIXIN: topic
+
 INSTANCE: link topic
+
 INSTANCE: word topic
 
 GENERIC: >link ( obj -- obj )
index 4f639c02a7ce5d6cbbe29f8c5f2e42ecf5d535ae..3148567bc0a0cdf9649dbf822ce9fce4b59f0f69 100755 (executable)
@@ -37,7 +37,7 @@ IN: math.bitwise
 
 ! flags
 MACRO: flags ( values -- )
-    [ 0 ] [ [ dup word? [ execute ] when bitor ] curry compose ] reduce ;
+    [ 0 ] [ [ ?execute bitor ] curry compose ] reduce ;
 
 ! bitfield
 <PRIVATE
index e08a7487aec51fb941cf819d0399d1edea637c02..9e39dac20c26bd8d76251e3639befb0d3bdaeec4 100644 (file)
@@ -28,7 +28,7 @@ IN: opengl
     over glEnableClientState dip glDisableClientState ; inline
 
 : words>values ( word/value-seq -- value-seq )
-    [ dup word? [ execute ] when ] map ;
+    [ ?execute ] map ;
 
 : (all-enabled) ( seq quot -- )
     over [ glEnable ] each dip [ glDisable ] each ; inline
index 28781e24bbc2ac9a2e58a70a080bf94c48d5da65..c6371ac8aaf3794e8f9eae2eb4a639f52e134bd7 100644 (file)
@@ -81,8 +81,6 @@ IN: ui.tools.operations
     { +listener+ t }
 } define-operation
 
-UNION: definition word method-spec link vocab vocab-link ;
-
 [ definition? ] \ edit H{
     { +keyboard+ T{ key-down f { C+ } "e" } }
     { +listener+ t }
index 22d6cddfb973c40b46fff7f019ff6acd8e353556..12314505d9acf700c2211d02266f2c46e5266acd 100644 (file)
@@ -60,7 +60,7 @@ SYMBOL: table
 : finish-table ( -- table )
     table get [ [ 1 = ] map ] map ;
 
-: eval-seq ( seq -- seq ) [ dup word? [ execute ] when ] map ;
+: eval-seq ( seq -- seq ) [ ?execute ] map ;
 
 : (set-table) ( class1 class2 val -- )
     [ table get nth ] dip '[ _ or ] change-nth ;
index 434b133b3f2ad38cc789c43aaf629ac82a0ca0ed..c95c5816ac19c1baa754b6aed779b66b45cc9319 100644 (file)
@@ -3,6 +3,8 @@
 USING: kernel sequences namespaces assocs graphs math math.order ;
 IN: definitions
 
+MIXIN: definition
+
 ERROR: no-compilation-unit definition ;
 
 SYMBOLS: inlined-dependency flushed-dependency called-dependency ;
index 8380a41207a16afa017238cb9ce1bc234bbb4d79..c22641d4391318eb8e28eabd8b877fa9267db2ec 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2006, 2008 Slava Pestov.
+! Copyright (C) 2006, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors words kernel sequences namespaces make assocs
 hashtables definitions kernel.private classes classes.private
@@ -27,6 +27,8 @@ M: generic definition drop f ;
 PREDICATE: method-spec < pair
     first2 generic? swap class? and ;
 
+INSTANCE: method-spec definition
+
 : order ( generic -- seq )
     "methods" word-prop keys sort-classes ;
 
index 56f19595cbbabb099b432033a41f26a2165099ee..baccf5605946a10f2c4a4906ec915683e45002e6 100644 (file)
@@ -23,6 +23,10 @@ GENERIC: call ( callable -- )
 
 GENERIC: execute ( word -- )
 
+GENERIC: ?execute ( word -- value )
+
+M: object ?execute ;
+
 DEFER: if
 
 : ? ( ? true false -- true/false )
index edac418285989cd95b4cd56810dd29e16ab7be4a..2b978e866625c101e51be13c2122119d6d1dd26f 100644 (file)
@@ -108,4 +108,6 @@ SYMBOL: load-vocab-hook ! ( name -- vocab )
 : load-vocab ( name -- vocab ) load-vocab-hook get call( name -- vocab ) ;
 
 PREDICATE: runnable-vocab < vocab
-    vocab-main >boolean ;
\ No newline at end of file
+    vocab-main >boolean ;
+
+INSTANCE: vocab-spec definition
\ No newline at end of file
index cfdcd4517f2e1e49110fa3197de2d61d262dbcc2..5b230c1b0066c095ca20fce950ed3a029b46b158 100755 (executable)
@@ -12,6 +12,8 @@ IN: words
 
 M: word execute (execute) ;
 
+M: word ?execute execute( -- value ) ;
+
 M: word <=>
     [ [ name>> ] [ vocabulary>> ] bi 2array ] compare ;
 
@@ -260,3 +262,5 @@ M: word hashcode*
 M: word literalize <wrapper> ;
 
 : xref-words ( -- ) all-words [ xref ] each ;
+
+INSTANCE: word definition
\ No newline at end of file