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 ;
|
TUPLE: link name ;
|
||||||
|
|
||||||
|
INSTANCE: link definition
|
||||||
|
|
||||||
MIXIN: topic
|
MIXIN: topic
|
||||||
|
|
||||||
INSTANCE: link topic
|
INSTANCE: link topic
|
||||||
|
|
||||||
INSTANCE: word topic
|
INSTANCE: word topic
|
||||||
|
|
||||||
GENERIC: >link ( obj -- obj )
|
GENERIC: >link ( obj -- obj )
|
||||||
|
|
|
@ -37,7 +37,7 @@ IN: math.bitwise
|
||||||
|
|
||||||
! flags
|
! flags
|
||||||
MACRO: flags ( values -- )
|
MACRO: flags ( values -- )
|
||||||
[ 0 ] [ [ dup word? [ execute ] when bitor ] curry compose ] reduce ;
|
[ 0 ] [ [ ?execute bitor ] curry compose ] reduce ;
|
||||||
|
|
||||||
! bitfield
|
! bitfield
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
|
@ -28,7 +28,7 @@ IN: opengl
|
||||||
over glEnableClientState dip glDisableClientState ; inline
|
over glEnableClientState dip glDisableClientState ; inline
|
||||||
|
|
||||||
: words>values ( word/value-seq -- value-seq )
|
: words>values ( word/value-seq -- value-seq )
|
||||||
[ dup word? [ execute ] when ] map ;
|
[ ?execute ] map ;
|
||||||
|
|
||||||
: (all-enabled) ( seq quot -- )
|
: (all-enabled) ( seq quot -- )
|
||||||
over [ glEnable ] each dip [ glDisable ] each ; inline
|
over [ glEnable ] each dip [ glDisable ] each ; inline
|
||||||
|
|
|
@ -81,8 +81,6 @@ IN: ui.tools.operations
|
||||||
{ +listener+ t }
|
{ +listener+ t }
|
||||||
} define-operation
|
} define-operation
|
||||||
|
|
||||||
UNION: definition word method-spec link vocab vocab-link ;
|
|
||||||
|
|
||||||
[ definition? ] \ edit H{
|
[ definition? ] \ edit H{
|
||||||
{ +keyboard+ T{ key-down f { C+ } "e" } }
|
{ +keyboard+ T{ key-down f { C+ } "e" } }
|
||||||
{ +listener+ t }
|
{ +listener+ t }
|
||||||
|
|
|
@ -60,7 +60,7 @@ SYMBOL: table
|
||||||
: finish-table ( -- table )
|
: finish-table ( -- table )
|
||||||
table get [ [ 1 = ] map ] map ;
|
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 -- )
|
: (set-table) ( class1 class2 val -- )
|
||||||
[ table get nth ] dip '[ _ or ] change-nth ;
|
[ table get nth ] dip '[ _ or ] change-nth ;
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
USING: kernel sequences namespaces assocs graphs math math.order ;
|
USING: kernel sequences namespaces assocs graphs math math.order ;
|
||||||
IN: definitions
|
IN: definitions
|
||||||
|
|
||||||
|
MIXIN: definition
|
||||||
|
|
||||||
ERROR: no-compilation-unit definition ;
|
ERROR: no-compilation-unit definition ;
|
||||||
|
|
||||||
SYMBOLS: inlined-dependency flushed-dependency called-dependency ;
|
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.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors words kernel sequences namespaces make assocs
|
USING: accessors words kernel sequences namespaces make assocs
|
||||||
hashtables definitions kernel.private classes classes.private
|
hashtables definitions kernel.private classes classes.private
|
||||||
|
@ -27,6 +27,8 @@ M: generic definition drop f ;
|
||||||
PREDICATE: method-spec < pair
|
PREDICATE: method-spec < pair
|
||||||
first2 generic? swap class? and ;
|
first2 generic? swap class? and ;
|
||||||
|
|
||||||
|
INSTANCE: method-spec definition
|
||||||
|
|
||||||
: order ( generic -- seq )
|
: order ( generic -- seq )
|
||||||
"methods" word-prop keys sort-classes ;
|
"methods" word-prop keys sort-classes ;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,10 @@ GENERIC: call ( callable -- )
|
||||||
|
|
||||||
GENERIC: execute ( word -- )
|
GENERIC: execute ( word -- )
|
||||||
|
|
||||||
|
GENERIC: ?execute ( word -- value )
|
||||||
|
|
||||||
|
M: object ?execute ;
|
||||||
|
|
||||||
DEFER: if
|
DEFER: if
|
||||||
|
|
||||||
: ? ( ? true false -- true/false )
|
: ? ( ? true false -- true/false )
|
||||||
|
|
|
@ -109,3 +109,5 @@ SYMBOL: load-vocab-hook ! ( name -- vocab )
|
||||||
|
|
||||||
PREDICATE: runnable-vocab < 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) ;
|
||||||
|
|
||||||
|
M: word ?execute execute( -- value ) ;
|
||||||
|
|
||||||
M: word <=>
|
M: word <=>
|
||||||
[ [ name>> ] [ vocabulary>> ] bi 2array ] compare ;
|
[ [ name>> ] [ vocabulary>> ] bi 2array ] compare ;
|
||||||
|
|
||||||
|
@ -260,3 +262,5 @@ M: word hashcode*
|
||||||
M: word literalize <wrapper> ;
|
M: word literalize <wrapper> ;
|
||||||
|
|
||||||
: xref-words ( -- ) all-words [ xref ] each ;
|
: xref-words ( -- ) all-words [ xref ] each ;
|
||||||
|
|
||||||
|
INSTANCE: word definition
|
Loading…
Reference in New Issue