Fix some annoying circularity; prettyprinter cannot depend on any vocab that depends on locals or stack-checker

db4
Slava Pestov 2009-09-08 15:15:36 -05:00
parent d596e3abe7
commit 33bfb95614
2 changed files with 21 additions and 23 deletions

View File

@ -1,17 +1,15 @@
! Copyright (C) 2009 Slava Pestov. ! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel assocs math math.parser memoize io.encodings.utf8 USING: kernel assocs math math.parser memoize io.encodings.utf8
io.files lexer parser colors sequences splitting io.files lexer parser colors sequences splitting ascii ;
combinators.smart ascii ;
IN: colors.constants IN: colors.constants
<PRIVATE <PRIVATE
: parse-color ( line -- name color ) : parse-color ( line -- name color )
[ first4
[ [ string>number 255 /f ] tri@ 1.0 <rgba> ] dip [ [ string>number 255 /f ] tri@ 1.0 <rgba> ] dip
[ blank? ] trim-head { { CHAR: \s CHAR: - } } substitute swap [ blank? ] trim-head { { CHAR: \s CHAR: - } } substitute swap ;
] input<sequence ;
: parse-rgb.txt ( lines -- assoc ) : parse-rgb.txt ( lines -- assoc )
[ "!" head? not ] filter [ "!" head? not ] filter

View File

@ -1,15 +1,15 @@
USING: kernel combinators quotations arrays sequences assocs USING: kernel combinators quotations arrays sequences assocs
locals generalizations macros fry ; generalizations macros fry ;
IN: combinators.short-circuit IN: combinators.short-circuit
MACRO:: n&& ( quots n -- quot ) MACRO: n&& ( quots n -- quot )
[ f ] quots [| q | [
n [ [ f ] ] 2dip swap [
[ q '[ drop _ ndup @ dup not ] ] [ '[ drop _ ndup @ dup not ] ]
[ '[ drop _ ndrop f ] ] [ drop '[ drop _ ndrop f ] ]
bi 2array 2bi 2array
] map ] with map
n '[ _ nnip ] suffix 1array ] [ '[ _ nnip ] suffix 1array ] bi
[ cond ] 3append ; [ cond ] 3append ;
<PRIVATE <PRIVATE
@ -24,14 +24,14 @@ PRIVATE>
: 2&& ( obj1 obj2 quots -- ? ) [ with with ] unoptimized-&& ; : 2&& ( obj1 obj2 quots -- ? ) [ with with ] unoptimized-&& ;
: 3&& ( obj1 obj2 obj3 quots -- ? ) [ with with with ] unoptimized-&& ; : 3&& ( obj1 obj2 obj3 quots -- ? ) [ with with with ] unoptimized-&& ;
MACRO:: n|| ( quots n -- quot ) MACRO: n|| ( quots n -- quot )
[ f ] quots [| q | [
n [ [ f ] ] 2dip swap [
[ q '[ drop _ ndup @ dup ] ] [ '[ drop _ ndup @ dup ] ]
[ '[ _ nnip ] ] [ drop '[ _ nnip ] ]
bi 2array 2bi 2array
] map ] with map
n '[ drop _ ndrop t ] [ f ] 2array suffix 1array ] [ '[ drop _ ndrop t ] [ f ] 2array suffix 1array ] bi
[ cond ] 3append ; [ cond ] 3append ;
<PRIVATE <PRIVATE