Add definition mixin in definitions vocab to replace hard-coded union in ui.tools.operations; add ?execute to kernel to replace dup word? [ execute ] when calls in unicode.breaks and opengl
parent
b51ed8559e
commit
6c0986f8b2
|
@ -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 )
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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 ;
|
||||
|
|
|
@ -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 ;
|
||||
|
|
|
@ -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 ;
|
||||
|
||||
|
|
|
@ -23,6 +23,10 @@ GENERIC: call ( callable -- )
|
|||
|
||||
GENERIC: execute ( word -- )
|
||||
|
||||
GENERIC: ?execute ( word -- value )
|
||||
|
||||
M: object ?execute ;
|
||||
|
||||
DEFER: if
|
||||
|
||||
: ? ( ? true false -- true/false )
|
||||
|
|
|
@ -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 ;
|
||||
vocab-main >boolean ;
|
||||
|
||||
INSTANCE: vocab-spec definition
|
|
@ -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
|
Loading…
Reference in New Issue