Untangling some dependencies

db4
Slava Pestov 2008-12-08 14:58:00 -06:00
parent 73b3cd6367
commit 4f0a9f311e
67 changed files with 386 additions and 339 deletions

View File

@ -0,0 +1,14 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel combinators alien alien.strings alien.syntax
prettyprint.backend prettyprint.custom prettyprint.sections ;
IN: alien.prettyprint
M: alien pprint*
{
{ [ dup expired? ] [ drop \ BAD-ALIEN pprint-word ] }
{ [ dup pinned-c-ptr? not ] [ drop "( displaced alien )" text ] }
[ \ ALIEN: [ alien-address pprint* ] pprint-prefix ]
} cond ;
M: dll pprint* dll-path dup "DLL\" " "\"" pprint-string ;

View File

@ -3,8 +3,7 @@
USING: accessors arrays alien alien.c-types alien.structs USING: accessors arrays alien alien.c-types alien.structs
alien.arrays alien.strings kernel math namespaces parser alien.arrays alien.strings kernel math namespaces parser
sequences words quotations math.parser splitting grouping sequences words quotations math.parser splitting grouping
effects prettyprint prettyprint.sections prettyprint.backend effects assocs combinators lexer strings.parser alien.parser ;
assocs combinators lexer strings.parser alien.parser ;
IN: alien.syntax IN: alien.syntax
: DLL" lexer get skip-blank parse-string dlopen parsed ; parsing : DLL" lexer get skip-blank parse-string dlopen parsed ; parsing
@ -34,12 +33,3 @@ IN: alien.syntax
dup length dup length
[ [ create-in ] dip 1quotation define ] 2each ; [ [ create-in ] dip 1quotation define ] 2each ;
parsing parsing
M: alien pprint*
{
{ [ dup expired? ] [ drop \ BAD-ALIEN pprint-word ] }
{ [ dup pinned-c-ptr? not ] [ drop "( displaced alien )" text ] }
[ \ ALIEN: [ alien-address pprint* ] pprint-prefix ]
} cond ;
M: dll pprint* dll-path dup "DLL\" " "\"" pprint-string ;

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types accessors math alien.accessors kernel USING: alien.c-types accessors math alien.accessors kernel
kernel.private locals sequences sequences.private byte-arrays kernel.private locals sequences sequences.private byte-arrays
parser prettyprint.backend fry ; parser prettyprint.custom fry ;
IN: bit-arrays IN: bit-arrays
TUPLE: bit-array TUPLE: bit-array

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays kernel kernel.private math sequences USING: arrays kernel kernel.private math sequences
sequences.private growable bit-arrays prettyprint.backend sequences.private growable bit-arrays prettyprint.custom
parser accessors ; parser accessors ;
IN: bit-vectors IN: bit-vectors

View File

@ -0,0 +1,8 @@
USING: continuations kernel io debugger vocabs words system namespaces ;
:c
:error
"listener" vocab
[ restarts. vocab-main execute ]
[ die ] if*
1 exit

View File

@ -5,17 +5,22 @@ sequences namespaces parser kernel kernel.private classes
classes.private arrays hashtables vectors classes.tuple sbufs classes.private arrays hashtables vectors classes.tuple sbufs
hashtables.private sequences.private math classes.tuple.private hashtables.private sequences.private math classes.tuple.private
growable namespaces.private assocs words command-line vocabs io growable namespaces.private assocs words command-line vocabs io
io.encodings.string prettyprint libc splitting math.parser io.encodings.string libc splitting math.parser
compiler.units math.order compiler.tree.builder compiler.units math.order compiler.tree.builder
compiler.tree.optimizer compiler.cfg.optimizer ; compiler.tree.optimizer compiler.cfg.optimizer ;
IN: bootstrap.compiler IN: bootstrap.compiler
! Don't bring this in when deploying, since it will store a ! Don't bring this in when deploying, since it will store a
! reference to 'eval' in a global variable ! reference to 'eval' in a global variable
"deploy-vocab" get [ "deploy-vocab" get "staging" get or [
"alien.remote-control" require "alien.remote-control" require
] unless ] unless
"prettyprint" vocab [
"stack-checker.errors.prettyprint" require
"alien.prettyprint" require
] when
"cpu." cpu name>> append require "cpu." cpu name>> append require
enable-compiler enable-compiler
@ -86,7 +91,7 @@ nl
"." write flush "." write flush
{ {
. malloc calloc free memcpy malloc calloc free memcpy
} compile-uncompiled } compile-uncompiled
"." write flush "." write flush

View File

@ -0,0 +1,16 @@
USING: init command-line debugger system continuations
namespaces eval kernel vocabs.loader io ;
[
boot
do-init-hooks
[
(command-line) parse-command-line
load-vocab-roots
run-user-init
"e" get [ eval ] when*
ignore-cli-args? not script get and
[ run-script ] [ "run" get run ] if*
output-stream get [ stream-flush ] when*
] [ print-error 1 exit ] recover
] set-boot-quot

View File

@ -0,0 +1,10 @@
USING: init command-line system namespaces kernel vocabs.loader
io ;
[
boot
do-init-hooks
(command-line) parse-command-line
"run" get run
output-stream get [ stream-flush ] when*
] set-boot-quot

View File

@ -1,5 +1,7 @@
USE: vocabs.loader USING: vocabs vocabs.loader kernel ;
"math.ratios" require "math.ratios" require
"math.floats" require "math.floats" require
"math.complex" require "math.complex" require
"prettyprint" vocab [ "math.complex.prettyprint" require ] when

View File

@ -2,10 +2,10 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors init namespaces words io USING: accessors init namespaces words io
kernel.private math memory continuations kernel io.files kernel.private math memory continuations kernel io.files
io.backend system parser vocabs sequences prettyprint io.backend system parser vocabs sequences
vocabs.loader combinators splitting source-files strings vocabs.loader combinators splitting source-files strings
definitions assocs compiler.errors compiler.units definitions assocs compiler.errors compiler.units
math.parser generic sets debugger command-line ; math.parser generic sets command-line ;
IN: bootstrap.stage2 IN: bootstrap.stage2
SYMBOL: core-bootstrap-time SYMBOL: core-bootstrap-time
@ -86,25 +86,18 @@ SYMBOL: bootstrap-time
f error set-global f error set-global
f error-continuation set-global f error-continuation set-global
millis swap - bootstrap-time set-global
print-report
"deploy-vocab" get [ "deploy-vocab" get [
"tools.deploy.shaker" run "tools.deploy.shaker" run
] [ ] [
[ "staging" get [
boot "resource:basis/bootstrap/finish-staging.factor" run-file
do-init-hooks ] [
handle-command-line "resource:basis/bootstrap/finish-bootstrap.factor" run-file
] set-boot-quot ] if
millis swap - bootstrap-time set-global
print-report
"output-image" get save-image-and-exit "output-image" get save-image-and-exit
] if ] if
] [ ] [ drop "resource:basis/bootstrap/bootstrap-error.factor" run-file ] recover
:c
dup print-error flush
"listener" vocab
[ restarts. vocab-main execute ]
[ die ] if*
1 exit
] recover

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays kernel kernel.private math sequences USING: arrays kernel kernel.private math sequences
sequences.private growable byte-arrays accessors parser sequences.private growable byte-arrays accessors parser
prettyprint.backend ; prettyprint.custom ;
IN: byte-vectors IN: byte-vectors
TUPLE: byte-vector TUPLE: byte-vector

View File

@ -4,7 +4,7 @@ USING: kernel io io.binary io.files io.streams.byte-array math
math.functions math.parser namespaces splitting grouping strings math.functions math.parser namespaces splitting grouping strings
sequences byte-arrays locals sequences.private sequences byte-arrays locals sequences.private
io.encodings.binary symbols math.bitwise checksums io.encodings.binary symbols math.bitwise checksums
checksums.common ; checksums.common checksums.stream ;
IN: checksums.md5 IN: checksums.md5
! See http://www.faqs.org/rfcs/rfc1321.html ! See http://www.faqs.org/rfcs/rfc1321.html
@ -180,7 +180,7 @@ PRIVATE>
SINGLETON: md5 SINGLETON: md5
INSTANCE: md5 checksum INSTANCE: md5 stream-checksum
M: md5 checksum-stream ( stream -- byte-array ) M: md5 checksum-stream ( stream -- byte-array )
drop [ initialize-md5 stream>md5 get-md5 ] with-input-stream ; drop [ initialize-md5 stream>md5 get-md5 ] with-input-stream ;

View File

@ -1,7 +1,8 @@
! Copyright (C) 2008 Slava Pestov ! Copyright (C) 2008 Slava Pestov
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors byte-arrays alien.c-types kernel continuations USING: accessors byte-arrays alien.c-types kernel continuations
destructors sequences io openssl openssl.libcrypto checksums ; destructors sequences io openssl openssl.libcrypto checksums
checksums.stream ;
IN: checksums.openssl IN: checksums.openssl
ERROR: unknown-digest name ; ERROR: unknown-digest name ;
@ -12,7 +13,7 @@ TUPLE: openssl-checksum name ;
: openssl-sha1 T{ openssl-checksum f "sha1" } ; : openssl-sha1 T{ openssl-checksum f "sha1" } ;
INSTANCE: openssl-checksum checksum INSTANCE: openssl-checksum stream-checksum
C: <openssl-checksum> openssl-checksum C: <openssl-checksum> openssl-checksum

View File

@ -3,7 +3,8 @@
USING: arrays combinators kernel io io.encodings.binary io.files USING: arrays combinators kernel io io.encodings.binary io.files
io.streams.byte-array math.vectors strings sequences namespaces io.streams.byte-array math.vectors strings sequences namespaces
make math parser sequences assocs grouping vectors io.binary make math parser sequences assocs grouping vectors io.binary
hashtables symbols math.bitwise checksums checksums.common ; hashtables symbols math.bitwise checksums checksums.common
checksums.stream ;
IN: checksums.sha1 IN: checksums.sha1
! Implemented according to RFC 3174. ! Implemented according to RFC 3174.
@ -113,7 +114,7 @@ SYMBOLS: h0 h1 h2 h3 h4 A B C D E w K ;
SINGLETON: sha1 SINGLETON: sha1
INSTANCE: sha1 checksum INSTANCE: sha1 stream-checksum
M: sha1 checksum-stream ( stream -- sha1 ) M: sha1 checksum-stream ( stream -- sha1 )
drop [ initialize-sha1 stream>sha1 get-sha1 ] with-input-stream ; drop [ initialize-sha1 stream>sha1 get-sha1 ] with-input-stream ;

View File

@ -0,0 +1,12 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: io.encodings.binary io.streams.byte-array kernel
checksums ;
IN: checksums.stream
MIXIN: stream-checksum
M: stream-checksum checksum-bytes
[ binary <byte-reader> ] dip checksum-stream ;
INSTANCE: stream-checksum checksum

View File

@ -1,8 +1,8 @@
! Copyright (C) 2003, 2008 Slava Pestov. ! Copyright (C) 2003, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: init continuations debugger hashtables io USING: init continuations hashtables io io.encodings.utf8
io.encodings.utf8 io.files kernel kernel.private namespaces io.files kernel kernel.private namespaces parser sequences
parser sequences strings system splitting eval vocabs.loader ; strings system splitting vocabs.loader ;
IN: command-line IN: command-line
SYMBOL: script SYMBOL: script
@ -31,8 +31,6 @@ SYMBOL: command-line
] [ drop ] if ] [ drop ] if
] when ; ] when ;
<PRIVATE
: var-param ( name value -- ) swap set-global ; : var-param ( name value -- ) swap set-global ;
: bool-param ( name -- ) "no-" ?head not var-param ; : bool-param ( name -- ) "no-" ?head not var-param ;
@ -43,8 +41,6 @@ SYMBOL: command-line
: run-script ( file -- ) : run-script ( file -- )
t "quiet" set-global run-file ; t "quiet" set-global run-file ;
PRIVATE>
: parse-command-line ( args -- ) : parse-command-line ( args -- )
[ command-line off script off ] [ [ command-line off script off ] [
unclip "-" ?head unclip "-" ?head
@ -76,15 +72,4 @@ SYMBOL: main-vocab-hook
: script-mode ( -- ) ; : script-mode ( -- ) ;
: handle-command-line ( -- )
[
(command-line) parse-command-line
load-vocab-roots
run-user-init
"e" get [ eval ] when*
ignore-cli-args? not script get and
[ run-script ] [ "run" get run ] if*
output-stream get [ stream-flush ] when*
] [ print-error 1 exit ] recover ;
[ default-cli-args ] "command-line" add-init-hook [ default-cli-args ] "command-line" add-init-hook

View File

@ -1,6 +1,6 @@
USING: compiler.cfg.instructions compiler.cfg.registers USING: compiler.cfg.instructions compiler.cfg.registers
compiler.cfg.alias-analysis cpu.architecture tools.test compiler.cfg.alias-analysis compiler.cfg.debugger
kernel ; cpu.architecture tools.test kernel ;
IN: compiler.cfg.alias-analysis.tests IN: compiler.cfg.alias-analysis.tests
[ ] [ [ ] [

View File

@ -1,5 +1,6 @@
USING: compiler.cfg.dead-code compiler.cfg.instructions USING: compiler.cfg.dead-code compiler.cfg.instructions
compiler.cfg.registers cpu.architecture tools.test ; compiler.cfg.registers compiler.cfg.debugger
cpu.architecture tools.test ;
IN: compiler.cfg.dead-code.tests IN: compiler.cfg.dead-code.tests
[ { } ] [ [ { } ] [

View File

@ -2,10 +2,12 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel words sequences quotations namespaces io USING: kernel words sequences quotations namespaces io
classes.tuple accessors prettyprint prettyprint.config classes.tuple accessors prettyprint prettyprint.config
compiler.tree.builder compiler.tree.optimizer prettyprint.backend prettyprint.custom prettyprint.sections
parser compiler.tree.builder compiler.tree.optimizer
compiler.cfg.builder compiler.cfg.linearization compiler.cfg.builder compiler.cfg.linearization
compiler.cfg.stack-frame compiler.cfg.linear-scan compiler.cfg.registers compiler.cfg.stack-frame
compiler.cfg.two-operand compiler.cfg.optimizer ; compiler.cfg.linear-scan compiler.cfg.two-operand
compiler.cfg.optimizer ;
IN: compiler.cfg.debugger IN: compiler.cfg.debugger
GENERIC: test-cfg ( quot -- cfgs ) GENERIC: test-cfg ( quot -- cfgs )
@ -40,3 +42,15 @@ SYMBOL: allocate-registers?
instructions>> [ insn. ] each instructions>> [ insn. ] each
nl nl
] each ; ] each ;
! Prettyprinting
M: vreg pprint*
<block
\ V pprint-word [ reg-class>> pprint* ] [ n>> pprint* ] bi
block> ;
: pprint-loc ( loc word -- ) <block pprint-word n>> pprint* block> ;
M: ds-loc pprint* \ D pprint-loc ;
M: rs-loc pprint* \ R pprint-loc ;

View File

@ -1,7 +1,6 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors namespaces kernel arrays USING: accessors namespaces kernel arrays parser ;
parser prettyprint.backend prettyprint.sections ;
IN: compiler.cfg.registers IN: compiler.cfg.registers
! Virtual registers, used by CFG and machine IRs ! Virtual registers, used by CFG and machine IRs
@ -18,20 +17,6 @@ C: <ds-loc> ds-loc
TUPLE: rs-loc < loc ; TUPLE: rs-loc < loc ;
C: <rs-loc> rs-loc C: <rs-loc> rs-loc
! Prettyprinting
: V scan-word scan-word vreg boa parsed ; parsing : V scan-word scan-word vreg boa parsed ; parsing
M: vreg pprint*
<block
\ V pprint-word [ reg-class>> pprint* ] [ n>> pprint* ] bi
block> ;
: pprint-loc ( loc word -- ) <block pprint-word n>> pprint* block> ;
: D scan-word <ds-loc> parsed ; parsing : D scan-word <ds-loc> parsed ; parsing
M: ds-loc pprint* \ D pprint-loc ;
: R scan-word <rs-loc> parsed ; parsing : R scan-word <rs-loc> parsed ; parsing
M: rs-loc pprint* \ R pprint-loc ;

View File

@ -1,7 +1,8 @@
IN: compiler.cfg.value-numbering.tests IN: compiler.cfg.value-numbering.tests
USING: compiler.cfg.value-numbering compiler.cfg.instructions USING: compiler.cfg.value-numbering compiler.cfg.instructions
compiler.cfg.registers cpu.architecture tools.test kernel math compiler.cfg.registers compiler.cfg.debugger cpu.architecture
combinators.short-circuit accessors sequences ; tools.test kernel math combinators.short-circuit accessors
sequences ;
: trim-temps ( insns -- insns ) : trim-temps ( insns -- insns )
[ [

View File

@ -1,5 +1,6 @@
USING: compiler.cfg.write-barrier compiler.cfg.instructions USING: compiler.cfg.write-barrier compiler.cfg.instructions
compiler.cfg.registers cpu.architecture arrays tools.test ; compiler.cfg.registers compiler.cfg.debugger cpu.architecture
arrays tools.test ;
IN: compiler.cfg.write-barrier.tests IN: compiler.cfg.write-barrier.tests
[ [

View File

@ -1,10 +1,10 @@
! Copyright (C) 2007, 2008 Slava Pestov. ! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays byte-arrays generic assocs hashtables io.binary USING: arrays byte-arrays byte-vectors generic assocs hashtables
kernel kernel.private math namespaces make sequences words io.binary kernel kernel.private math namespaces make sequences
quotations strings alien.accessors alien.strings layouts system words quotations strings alien.accessors alien.strings layouts
combinators math.bitwise words.private math.order accessors system combinators math.bitwise words.private math.order
growable cpu.architecture compiler.constants ; accessors growable cpu.architecture compiler.constants ;
IN: compiler.codegen.fixup IN: compiler.codegen.fixup
GENERIC: fixup* ( obj -- ) GENERIC: fixup* ( obj -- )

View File

@ -1,15 +1,14 @@
! Copyright (C) 2004, 2008 Slava Pestov. ! Copyright (C) 2004, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel namespaces arrays sequences io debugger USING: accessors kernel namespaces arrays sequences io
words fry continuations vocabs assocs dlists definitions words fry continuations vocabs assocs dlists definitions math
math threads graphs generic combinators deques search-deques threads graphs generic combinators deques search-deques io
prettyprint io stack-checker stack-checker.state stack-checker stack-checker.state stack-checker.inlining
stack-checker.inlining compiler.errors compiler.units compiler.errors compiler.units compiler.tree.builder
compiler.tree.builder compiler.tree.optimizer compiler.tree.optimizer compiler.cfg.builder
compiler.cfg.builder compiler.cfg.optimizer compiler.cfg.optimizer compiler.cfg.linearization
compiler.cfg.linearization compiler.cfg.two-operand compiler.cfg.two-operand compiler.cfg.linear-scan
compiler.cfg.linear-scan compiler.cfg.stack-frame compiler.cfg.stack-frame compiler.codegen ;
compiler.codegen ;
IN: compiler IN: compiler
SYMBOL: compile-queue SYMBOL: compile-queue
@ -45,7 +44,7 @@ SYMBOL: +failed+
2bi ; 2bi ;
: start ( word -- ) : start ( word -- )
"trace-compilation" get [ dup . flush ] when "trace-compilation" get [ dup name>> print flush ] when
H{ } clone dependencies set H{ } clone dependencies set
H{ } clone generic-dependencies set H{ } clone generic-dependencies set
f swap compiler-error ; f swap compiler-error ;

View File

@ -2,8 +2,9 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel assocs match fry accessors namespaces make effects USING: kernel assocs match fry accessors namespaces make effects
sequences sequences.private quotations generic macros arrays sequences sequences.private quotations generic macros arrays
prettyprint prettyprint.backend prettyprint.sections math words prettyprint prettyprint.backend prettyprint.custom
combinators combinators.short-circuit io sorting hints qualified prettyprint.sections math words combinators
combinators.short-circuit io sorting hints qualified
compiler.tree compiler.tree
compiler.tree.recursive compiler.tree.recursive
compiler.tree.normalization compiler.tree.normalization

View File

@ -22,9 +22,6 @@ M: tuple error-help class ;
M: string error. print ; M: string error. print ;
: :error ( -- )
error get error. ;
: :s ( -- ) : :s ( -- )
error-continuation get data>> stack. ; error-continuation get data>> stack. ;
@ -63,6 +60,9 @@ M: string error. print ;
[ global [ "Error in print-error!" print drop ] bind ] [ global [ "Error in print-error!" print drop ] bind ]
recover ; recover ;
: :error ( -- )
error get print-error ;
: print-error-and-restarts ( error -- ) : print-error-and-restarts ( error -- )
print-error print-error
restarts. restarts.

View File

@ -1,7 +1,8 @@
! Copyright (C) 2007, 2008 Slava Pestov. ! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors definitions help help.topics help.syntax USING: accessors definitions help help.topics help.syntax
prettyprint.backend prettyprint words kernel effects ; prettyprint.backend prettyprint.custom prettyprint words kernel
effects ;
IN: help.definitions IN: help.definitions
! Definition protocol implementation ! Definition protocol implementation

View File

@ -150,7 +150,7 @@ M: help-error error.
] [ ] [
[ [
swap vocab-heading. swap vocab-heading.
[ error. nl ] each [ print-error nl ] each
] assoc-each ] assoc-each
] if-empty ; ] if-empty ;

View File

@ -1,6 +1,7 @@
! Copyright (C) 2005, 2008 Slava Pestov. ! Copyright (C) 2005, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: hashtables io colors ; USING: hashtables io colors summary make accessors splitting
kernel ;
IN: io.styles IN: io.styles
SYMBOL: plain SYMBOL: plain
@ -43,4 +44,11 @@ TUPLE: input string ;
C: <input> input C: <input> input
M: input summary
[
"Input: " %
string>> "\n" split1 swap %
"..." "" ? %
] "" make ;
: write-object ( str obj -- ) presented associate format ; : write-object ( str obj -- ) presented associate format ;

View File

@ -2,9 +2,9 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel namespaces make sequences sequences.private assocs USING: kernel namespaces make sequences sequences.private assocs
math vectors strings classes.tuple generalizations parser words math vectors strings classes.tuple generalizations parser words
quotations debugger macros arrays macros splitting combinators quotations macros arrays macros splitting combinators
prettyprint.backend definitions prettyprint hashtables prettyprint.backend prettyprint.custom definitions prettyprint
prettyprint.sections sets sequences.private effects hashtables prettyprint.sections sets sequences.private effects
effects.parser generic generic.parser compiler.units accessors effects.parser generic generic.parser compiler.units accessors
locals.backend memoize macros.expander lexer classes summary fry locals.backend memoize macros.expander lexer classes summary fry
fry.private ; fry.private ;

View File

@ -1,8 +1,8 @@
! Copyright (C) 2006, 2008 Slava Pestov. ! Copyright (C) 2006, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel kernel.private math math.private USING: accessors kernel kernel.private math math.private
math.libm math.functions prettyprint.backend arrays math.libm math.functions arrays math.functions.private sequences
math.functions.private sequences parser ; parser ;
IN: math.complex.private IN: math.complex.private
M: real real-part ; M: real real-part ;
@ -47,7 +47,3 @@ M: complex sqrt >polar [ fsqrt ] [ 2.0 / ] bi* polar> ;
IN: syntax IN: syntax
: C{ \ } [ first2 rect> ] parse-literal ; parsing : C{ \ } [ first2 rect> ] parse-literal ; parsing
M: complex pprint-delims drop \ C{ \ } ;
M: complex >pprint-sequence >rect 2array ;
M: complex pprint* pprint-object ;

View File

@ -0,0 +1,8 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: math math.functions arrays prettyprint.custom kernel ;
IN: math.complex.prettyprint
M: complex pprint* pprint-object ;
M: complex pprint-delims drop \ C{ \ } ;
M: complex >pprint-sequence >rect 2array ;

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: math kernel sequences sequences.private byte-arrays USING: math kernel sequences sequences.private byte-arrays
alien.c-types prettyprint.backend parser accessors ; alien.c-types prettyprint.custom parser accessors ;
IN: nibble-arrays IN: nibble-arrays
TUPLE: nibble-array TUPLE: nibble-array

View File

@ -1,7 +1,7 @@
! Based on Clojure's PersistentHashMap by Rich Hickey. ! Based on Clojure's PersistentHashMap by Rich Hickey.
USING: kernel math accessors assocs fry combinators parser USING: kernel math accessors assocs fry combinators parser
prettyprint.backend make prettyprint.custom make
persistent.assocs persistent.assocs
persistent.hashtables.nodes persistent.hashtables.nodes
persistent.hashtables.nodes.empty persistent.hashtables.nodes.empty

View File

@ -1,7 +1,7 @@
! Based on Clojure's PersistentVector by Rich Hickey. ! Based on Clojure's PersistentVector by Rich Hickey.
USING: math accessors kernel sequences.private sequences arrays USING: math accessors kernel sequences.private sequences arrays
combinators combinators.short-circuit parser prettyprint.backend combinators combinators.short-circuit parser prettyprint.custom
persistent.sequences ; persistent.sequences ;
IN: persistent.vectors IN: persistent.vectors

View File

@ -1,14 +1,10 @@
USING: help.markup help.syntax io kernel USING: help.markup help.syntax io kernel
prettyprint.config prettyprint.sections words strings ; prettyprint.config prettyprint.sections prettyprint.custom
words strings ;
IN: prettyprint.backend IN: prettyprint.backend
ABOUT: "prettyprint-extension" ABOUT: "prettyprint-extension"
HELP: pprint*
{ $values { "obj" "an object" } }
{ $contract "Adds sections to the current block corresponding to the prettyprinted representation of the object." }
$prettyprinting-note ;
HELP: pprint-word HELP: pprint-word
{ $values { "word" "a word" } } { $values { "word" "a word" } }
{ $description "Adds a text section for the word. Unlike the " { $link word } " method of " { $link pprint* } ", this does not add a " { $link POSTPONE: POSTPONE: } " prefix to parsing words." } { $description "Adds a text section for the word. Unlike the " { $link word } " method of " { $link pprint* } ", this does not add a " { $link POSTPONE: POSTPONE: } " prefix to parsing words." }

View File

@ -1,15 +1,13 @@
! Copyright (C) 2003, 2008 Slava Pestov. ! Copyright (C) 2003, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays byte-arrays byte-vectors generic USING: accessors arrays byte-arrays generic hashtables io assocs
hashtables io assocs kernel math namespaces make sequences kernel math namespaces make sequences strings sbufs io.styles
strings sbufs io.styles vectors words prettyprint.config vectors words prettyprint.config prettyprint.custom
prettyprint.sections quotations io io.files math.parser effects prettyprint.sections quotations io io.files math.parser effects
classes.tuple math.order classes.tuple.private classes classes.tuple math.order classes.tuple.private classes
combinators colors ; combinators colors ;
IN: prettyprint.backend IN: prettyprint.backend
GENERIC: pprint* ( obj -- )
M: effect pprint* effect>string "(" ")" surround text ; M: effect pprint* effect>string "(" ")" surround text ;
: ?effect-height ( word -- n ) : ?effect-height ( word -- n )
@ -161,26 +159,19 @@ M: tuple pprint*
[ [ pprint* ] each ] dip [ [ pprint* ] each ] dip
[ "~" swap number>string " more~" 3append text ] when* ; [ "~" swap number>string " more~" 3append text ] when* ;
GENERIC: pprint-delims ( obj -- start end )
M: quotation pprint-delims drop \ [ \ ] ; M: quotation pprint-delims drop \ [ \ ] ;
M: curry pprint-delims drop \ [ \ ] ; M: curry pprint-delims drop \ [ \ ] ;
M: compose pprint-delims drop \ [ \ ] ; M: compose pprint-delims drop \ [ \ ] ;
M: array pprint-delims drop \ { \ } ; M: array pprint-delims drop \ { \ } ;
M: byte-array pprint-delims drop \ B{ \ } ; M: byte-array pprint-delims drop \ B{ \ } ;
M: byte-vector pprint-delims drop \ BV{ \ } ;
M: vector pprint-delims drop \ V{ \ } ; M: vector pprint-delims drop \ V{ \ } ;
M: hashtable pprint-delims drop \ H{ \ } ; M: hashtable pprint-delims drop \ H{ \ } ;
M: tuple pprint-delims drop \ T{ \ } ; M: tuple pprint-delims drop \ T{ \ } ;
M: wrapper pprint-delims drop \ W{ \ } ; M: wrapper pprint-delims drop \ W{ \ } ;
M: callstack pprint-delims drop \ CS{ \ } ; M: callstack pprint-delims drop \ CS{ \ } ;
GENERIC: >pprint-sequence ( obj -- seq )
M: object >pprint-sequence ; M: object >pprint-sequence ;
M: vector >pprint-sequence ; M: vector >pprint-sequence ;
M: byte-vector >pprint-sequence ;
M: curry >pprint-sequence ; M: curry >pprint-sequence ;
M: compose >pprint-sequence ; M: compose >pprint-sequence ;
M: hashtable >pprint-sequence >alist ; M: hashtable >pprint-sequence >alist ;
@ -191,16 +182,13 @@ M: tuple >pprint-sequence
[ class ] [ tuple-slots ] bi [ class ] [ tuple-slots ] bi
[ 1array ] [ [ f 2array ] dip append ] if-empty ; [ 1array ] [ [ f 2array ] dip append ] if-empty ;
GENERIC: pprint-narrow? ( obj -- ? )
M: object pprint-narrow? drop f ; M: object pprint-narrow? drop f ;
M: array pprint-narrow? drop t ; M: array pprint-narrow? drop t ;
M: vector pprint-narrow? drop t ; M: vector pprint-narrow? drop t ;
M: hashtable pprint-narrow? drop t ; M: hashtable pprint-narrow? drop t ;
M: tuple pprint-narrow? drop t ; M: tuple pprint-narrow? drop t ;
: pprint-object ( obj -- ) M: object pprint-object ( obj -- )
[ [
<flow <flow
dup pprint-delims [ dup pprint-delims [
@ -213,7 +201,6 @@ M: tuple pprint-narrow? drop t ;
M: object pprint* pprint-object ; M: object pprint* pprint-object ;
M: vector pprint* pprint-object ; M: vector pprint* pprint-object ;
M: byte-vector pprint* pprint-object ;
M: hashtable pprint* pprint-object ; M: hashtable pprint* pprint-object ;
M: curry pprint* pprint-object ; M: curry pprint* pprint-object ;
M: compose pprint* pprint-object ; M: compose pprint* pprint-object ;

View File

@ -0,0 +1,9 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel help.markup help.syntax ;
IN: prettyprint.custom
HELP: pprint*
{ $values { "obj" object } }
{ $contract "Adds sections to the current block corresponding to the prettyprinted representation of the object." }
$prettyprinting-note ;

View File

@ -0,0 +1,9 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
IN: prettyprint.custom
GENERIC: pprint* ( obj -- )
GENERIC: pprint-object ( obj -- )
GENERIC: pprint-delims ( obj -- start end )
GENERIC: >pprint-sequence ( obj -- seq )
GENERIC: pprint-narrow? ( obj -- ? )

View File

@ -1,4 +1,4 @@
USING: prettyprint.backend prettyprint.config USING: prettyprint.backend prettyprint.config prettyprint.custom
prettyprint.sections prettyprint.private help.markup help.syntax prettyprint.sections prettyprint.private help.markup help.syntax
io kernel words definitions quotations strings generic classes ; io kernel words definitions quotations strings generic classes ;
IN: prettyprint IN: prettyprint

View File

@ -2,12 +2,13 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays generic generic.standard assocs io kernel math USING: arrays generic generic.standard assocs io kernel math
namespaces make sequences strings io.styles io.streams.string namespaces make sequences strings io.styles io.streams.string
vectors words prettyprint.backend prettyprint.sections vectors words prettyprint.backend prettyprint.custom
prettyprint.config sorting splitting grouping math.parser vocabs prettyprint.sections prettyprint.config sorting splitting
definitions effects classes.builtin classes.tuple io.files grouping math.parser vocabs definitions effects classes.builtin
classes continuations hashtables classes.mixin classes.union classes.tuple io.files classes continuations hashtables
classes.intersection classes.predicate classes.singleton classes.mixin classes.union classes.intersection
combinators quotations sets accessors colors parser ; classes.predicate classes.singleton combinators quotations sets
accessors colors parser summary ;
IN: prettyprint IN: prettyprint
: make-pprint ( obj quot -- block in use ) : make-pprint ( obj quot -- block in use )
@ -231,6 +232,8 @@ M: pathname synopsis* pprint* ;
[ synopsis* ] with-in [ synopsis* ] with-in
] with-string-writer ; ] with-string-writer ;
M: word summary synopsis ;
: synopsis-alist ( definitions -- alist ) : synopsis-alist ( definitions -- alist )
[ dup synopsis swap ] { } map>assoc ; [ dup synopsis swap ] { } map>assoc ;

View File

@ -1,7 +1,7 @@
! Copyright (C) 2007, 2008 Daniel Ehrenberg. ! Copyright (C) 2007, 2008 Daniel Ehrenberg.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel sequences assocs hashtables parser lexer USING: kernel sequences assocs hashtables parser lexer
vocabs words namespaces vocabs.loader debugger sets fry ; vocabs words namespaces vocabs.loader sets fry ;
IN: qualified IN: qualified
: define-qualified ( vocab-name prefix-name -- ) : define-qualified ( vocab-name prefix-name -- )

View File

@ -1,10 +1,10 @@
! Copyright (C) 2008 Doug Coleman. ! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors combinators kernel math sequences strings USING: accessors combinators kernel math sequences strings sets
sets assocs prettyprint.backend make lexer namespaces parser assocs prettyprint.backend prettyprint.custom make lexer
arrays fry regexp.backend regexp.utils regexp.parser regexp.nfa namespaces parser arrays fry regexp.backend regexp.utils
regexp.dfa regexp.traversal regexp.transition-tables splitting regexp.parser regexp.nfa regexp.dfa regexp.traversal
sorting ; regexp.transition-tables splitting sorting ;
IN: regexp IN: regexp
: default-regexp ( string -- regexp ) : default-regexp ( string -- regexp )

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: functors sequences sequences.private prettyprint.backend USING: functors sequences sequences.private prettyprint.custom
kernel words classes math parser alien.c-types byte-arrays kernel words classes math parser alien.c-types byte-arrays
accessors summary ; accessors summary ;
IN: specialized-arrays.functor IN: specialized-arrays.functor

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: functors sequences sequences.private growable USING: functors sequences sequences.private growable
prettyprint.backend kernel words classes math parser ; prettyprint.custom kernel words classes math parser ;
IN: specialized-vectors.functor IN: specialized-vectors.functor
FUNCTOR: define-vector ( T -- ) FUNCTOR: define-vector ( T -- )

View File

@ -1,12 +1,12 @@
! Copyright (C) 2004, 2008 Slava Pestov. ! Copyright (C) 2004, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: fry arrays generic io io.streams.string kernel math USING: fry arrays generic io io.streams.string kernel math
namespaces parser prettyprint sequences strings vectors words namespaces parser sequences strings vectors words quotations
quotations effects classes continuations debugger assocs effects classes continuations assocs combinators
combinators compiler.errors accessors math.order definitions compiler.errors accessors math.order definitions sets
sets generic.standard.engines.tuple hints stack-checker.state generic.standard.engines.tuple hints stack-checker.state
stack-checker.visitor stack-checker.errors stack-checker.visitor stack-checker.errors stack-checker.values
stack-checker.values stack-checker.recursive-state ; stack-checker.recursive-state ;
IN: stack-checker.backend IN: stack-checker.backend
: push-d ( obj -- ) meta-d push ; : push-d ( obj -- ) meta-d push ;

View File

@ -1,8 +1,7 @@
! Copyright (C) 2006, 2008 Slava Pestov. ! Copyright (C) 2006, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel generic sequences prettyprint io words arrays USING: kernel generic sequences io words arrays summary effects
summary effects debugger assocs accessors namespaces assocs accessors namespaces compiler.errors stack-checker.values
compiler.errors stack-checker.values
stack-checker.recursive-state ; stack-checker.recursive-state ;
IN: stack-checker.errors IN: stack-checker.errors
@ -10,8 +9,6 @@ TUPLE: inference-error error type word ;
M: inference-error compiler-error-type type>> ; M: inference-error compiler-error-type type>> ;
M: inference-error error-help error>> error-help ;
: (inference-error) ( ... class type -- * ) : (inference-error) ( ... class type -- * )
[ boa ] dip [ boa ] dip
recursive-state get word>> recursive-state get word>>
@ -23,14 +20,8 @@ M: inference-error error-help error>> error-help ;
: inference-warning ( ... class -- * ) : inference-warning ( ... class -- * )
+warning+ (inference-error) ; inline +warning+ (inference-error) ; inline
M: inference-error error.
[ word>> [ "In word: " write . ] when* ] [ error>> error. ] bi ;
TUPLE: literal-expected ; TUPLE: literal-expected ;
M: literal-expected summary
drop "Literal value expected" ;
M: object (literal) \ literal-expected inference-warning ; M: object (literal) \ literal-expected inference-warning ;
TUPLE: unbalanced-branches-error branches quots ; TUPLE: unbalanced-branches-error branches quots ;
@ -38,79 +29,25 @@ TUPLE: unbalanced-branches-error branches quots ;
: unbalanced-branches-error ( branches quots -- * ) : unbalanced-branches-error ( branches quots -- * )
\ unbalanced-branches-error inference-error ; \ unbalanced-branches-error inference-error ;
M: unbalanced-branches-error error.
"Unbalanced branches:" print
[ quots>> ] [ branches>> [ length <effect> ] { } assoc>map ] bi zip
[ [ first pprint-short bl ] [ second effect>string print ] bi ] each ;
TUPLE: too-many->r ; TUPLE: too-many->r ;
M: too-many->r summary
drop
"Quotation pushes elements on retain stack without popping them" ;
TUPLE: too-many-r> ; TUPLE: too-many-r> ;
M: too-many-r> summary
drop
"Quotation pops retain stack elements which it did not push" ;
TUPLE: missing-effect word ; TUPLE: missing-effect word ;
M: missing-effect error.
"The word " write
word>> pprint
" must declare a stack effect" print ;
TUPLE: effect-error word inferred declared ; TUPLE: effect-error word inferred declared ;
: effect-error ( word inferred declared -- * ) : effect-error ( word inferred declared -- * )
\ effect-error inference-error ; \ effect-error inference-error ;
M: effect-error error.
"Stack effects of the word " write
[ word>> pprint " do not match." print ]
[ "Inferred: " write inferred>> . ]
[ "Declared: " write declared>> . ] tri ;
TUPLE: recursive-quotation-error quot ; TUPLE: recursive-quotation-error quot ;
M: recursive-quotation-error error.
"The quotation " write
quot>> pprint
" calls itself." print
"Stack effect inference is undecidable when quotation-level recursion is permitted." print ;
TUPLE: undeclared-recursion-error word ; TUPLE: undeclared-recursion-error word ;
M: undeclared-recursion-error error.
"The inline recursive word " write
word>> pprint
" must be declared recursive" print ;
TUPLE: diverging-recursion-error word ; TUPLE: diverging-recursion-error word ;
M: diverging-recursion-error error.
"The recursive word " write
word>> pprint
" digs arbitrarily deep into the stack" print ;
TUPLE: unbalanced-recursion-error word height ; TUPLE: unbalanced-recursion-error word height ;
M: unbalanced-recursion-error error.
"The recursive word " write
word>> pprint
" leaves with the stack having the wrong height" print ;
TUPLE: inconsistent-recursive-call-error word ; TUPLE: inconsistent-recursive-call-error word ;
M: inconsistent-recursive-call-error error.
"The recursive word " write
word>> pprint
" calls itself with a different set of quotation parameters than were input" print ;
TUPLE: unknown-primitive-error ; TUPLE: unknown-primitive-error ;
M: unknown-primitive-error error.
drop
"Cannot determine stack effect statically" print ;

View File

@ -0,0 +1,67 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel prettyprint io debugger
sequences assocs stack-checker.errors summary effects ;
IN: stack-checker.errors.prettyprint
M: inference-error error-help error>> error-help ;
M: inference-error error.
[ word>> [ "In word: " write . ] when* ] [ error>> error. ] bi ;
M: literal-expected summary
drop "Literal value expected" ;
M: unbalanced-branches-error error.
"Unbalanced branches:" print
[ quots>> ] [ branches>> [ length <effect> ] { } assoc>map ] bi zip
[ [ first pprint-short bl ] [ second effect>string print ] bi ] each ;
M: too-many->r summary
drop
"Quotation pushes elements on retain stack without popping them" ;
M: too-many-r> summary
drop
"Quotation pops retain stack elements which it did not push" ;
M: missing-effect error.
"The word " write
word>> pprint
" must declare a stack effect" print ;
M: effect-error error.
"Stack effects of the word " write
[ word>> pprint " do not match." print ]
[ "Inferred: " write inferred>> . ]
[ "Declared: " write declared>> . ] tri ;
M: recursive-quotation-error error.
"The quotation " write
quot>> pprint
" calls itself." print
"Stack effect inference is undecidable when quotation-level recursion is permitted." print ;
M: undeclared-recursion-error error.
"The inline recursive word " write
word>> pprint
" must be declared recursive" print ;
M: diverging-recursion-error error.
"The recursive word " write
word>> pprint
" digs arbitrarily deep into the stack" print ;
M: unbalanced-recursion-error error.
"The recursive word " write
word>> pprint
" leaves with the stack having the wrong height" print ;
M: inconsistent-recursive-call-error error.
"The recursive word " write
word>> pprint
" calls itself with a different set of quotation parameters than were input" print ;
M: unknown-primitive-error error.
drop
"Cannot determine stack effect statically" print ;

View File

@ -5,7 +5,7 @@ classes sequences.private continuations.private effects generic
hashtables hashtables.private io io.backend io.files hashtables hashtables.private io io.backend io.files
io.files.private io.streams.c kernel kernel.private math io.files.private io.streams.c kernel kernel.private math
math.private memory namespaces namespaces.private parser math.private memory namespaces namespaces.private parser
prettyprint quotations quotations.private sbufs sbufs.private quotations quotations.private sbufs sbufs.private
sequences sequences.private slots.private strings sequences sequences.private slots.private strings
strings.private system threads.private classes.tuple strings.private system threads.private classes.tuple
classes.tuple.private vectors vectors.private words definitions classes.tuple.private vectors vectors.private words definitions

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors classes sequences splitting kernel namespaces USING: accessors classes sequences kernel namespaces
make words math math.parser io.styles prettyprint assocs ; make words math math.parser assocs ;
IN: summary IN: summary
GENERIC: summary ( object -- string ) GENERIC: summary ( object -- string )
@ -11,15 +11,6 @@ GENERIC: summary ( object -- string )
M: object summary object-summary ; M: object summary object-summary ;
M: input summary
[
"Input: " %
string>> "\n" split1 swap %
"..." "" ? %
] "" make ;
M: word summary synopsis ;
M: sequence summary M: sequence summary
[ [
dup class name>> % dup class name>> %

View File

@ -5,8 +5,8 @@ assocs kernel vocabs words sequences memory io system arrays
continuations math definitions mirrors splitting parser classes continuations math definitions mirrors splitting parser classes
summary layouts vocabs.loader prettyprint.config prettyprint summary layouts vocabs.loader prettyprint.config prettyprint
debugger io.streams.c io.files io.backend quotations io.launcher debugger io.streams.c io.files io.backend quotations io.launcher
words.private tools.deploy.config bootstrap.image words.private tools.deploy.config tools.deploy.config.editor
io.encodings.utf8 destructors accessors ; bootstrap.image io.encodings.utf8 destructors accessors ;
IN: tools.deploy.backend IN: tools.deploy.backend
: copy-vm ( executable bundle-name extension -- vm ) : copy-vm ( executable bundle-name extension -- vm )
@ -88,6 +88,10 @@ DEFER: ?make-staging-image
dup staging-image-name exists? dup staging-image-name exists?
[ drop ] [ make-staging-image ] if ; [ drop ] [ make-staging-image ] if ;
: make-deploy-config ( vocab -- file )
[ deploy-config unparse-use ] [ "deploy-config-" prepend ] bi
[ utf8 set-file-contents ] keep ;
: deploy-command-line ( image vocab config -- flags ) : deploy-command-line ( image vocab config -- flags )
[ [
bootstrap-profile ?make-staging-image bootstrap-profile ?make-staging-image
@ -99,7 +103,8 @@ DEFER: ?make-staging-image
"-run=tools.deploy.shaker" , "-run=tools.deploy.shaker" ,
"-deploy-vocab=" prepend , [ "-deploy-vocab=" prepend , ]
[ make-deploy-config "-deploy-config=" prepend , ] bi
"-output-image=" prepend , "-output-image=" prepend ,

View File

@ -2,16 +2,6 @@ USING: help.markup help.syntax words alien.c-types assocs
kernel math ; kernel math ;
IN: tools.deploy.config IN: tools.deploy.config
ARTICLE: "deploy-config" "Deployment configuration"
"The deployment configuration is a key/value mapping stored in the " { $snippet "deploy.factor" } " file in the vocabulary's directory. If this file does not exist, the default deployment configuration is used:"
{ $subsection default-config }
"The deployment configuration can be read and written with a pair of words:"
{ $subsection deploy-config }
{ $subsection set-deploy-config }
"A utility word is provided to load the configuration, change a flag, and store it back to disk:"
{ $subsection set-deploy-flag }
"The " { $link "ui.tools.deploy" } " provides a graphical way of editing the configuration." ;
ARTICLE: "deploy-flags" "Deployment flags" ARTICLE: "deploy-flags" "Deployment flags"
"There are two sets of deployment flags. The first set controls the major subsystems which are to be included in the deployment image:" "There are two sets of deployment flags. The first set controls the major subsystems which are to be included in the deployment image:"
{ $subsection deploy-math? } { $subsection deploy-math? }
@ -25,12 +15,7 @@ ARTICLE: "deploy-flags" "Deployment flags"
{ $subsection deploy-word-props? } { $subsection deploy-word-props? }
{ $subsection deploy-c-types? } ; { $subsection deploy-c-types? } ;
ARTICLE: "prepare-deploy" "Preparing to deploy an application" ABOUT: "deploy-flags"
"In order to deploy an application as a stand-alone image, the application's vocabulary must first be given a " { $link POSTPONE: MAIN: } " hook. Then, a " { $emphasis "deployment configuration" } " must be created."
{ $subsection "deploy-config" }
{ $subsection "deploy-flags" } ;
ABOUT: "prepare-deploy"
HELP: deploy-name HELP: deploy-name
{ $description "Deploy setting. The name of the executable." { $description "Deploy setting. The name of the executable."
@ -114,15 +99,3 @@ HELP: deploy-reflection
HELP: default-config HELP: default-config
{ $values { "vocab" "a vocabulary specifier" } { "assoc" assoc } } { $values { "vocab" "a vocabulary specifier" } { "assoc" assoc } }
{ $description "Outputs the default deployment configuration for a vocabulary." } ; { $description "Outputs the default deployment configuration for a vocabulary." } ;
HELP: deploy-config
{ $values { "vocab" "a vocabulary specifier" } { "assoc" assoc } }
{ $description "Loads a vocabulary's deployment configuration from the " { $snippet "deploy.factor" } " file in the vocabulary's directory. If the file does not exist, the " { $link default-config } " is output." } ;
HELP: set-deploy-config
{ $values { "assoc" assoc } { "vocab" "a vocabulary specifier" } }
{ $description "Stores a vocabulary's deployment configuration to the " { $snippet "deploy.factor" } " file in the vocabulary's directory." } ;
HELP: set-deploy-flag
{ $values { "value" object } { "key" object } { "vocab" "a vocabulary specifier" } }
{ $description "Modifies an entry in a vocabulary's deployment configuration on disk." } ;

View File

@ -1,8 +1,7 @@
! Copyright (C) 2007, 2008 Slava Pestov. ! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: vocabs.loader io.files io kernel sequences assocs USING: io.files io kernel sequences assocs splitting parser
splitting parser prettyprint namespaces math vocabs namespaces math vocabs hashtables ;
hashtables tools.vocabs ;
IN: tools.deploy.config IN: tools.deploy.config
SYMBOL: deploy-name SYMBOL: deploy-name
@ -66,18 +65,3 @@ SYMBOL: deploy-image
! default value for deploy.macosx ! default value for deploy.macosx
{ "stop-after-last-window?" t } { "stop-after-last-window?" t }
} assoc-union ; } assoc-union ;
: deploy-config-path ( vocab -- string )
vocab-dir "deploy.factor" append-path ;
: deploy-config ( vocab -- assoc )
dup default-config swap
dup deploy-config-path vocab-file-contents
parse-fresh [ first assoc-union ] unless-empty ;
: set-deploy-config ( assoc vocab -- )
[ unparse-use string-lines ] dip
dup deploy-config-path set-vocab-file-contents ;
: set-deploy-flag ( value key vocab -- )
[ deploy-config [ set-at ] keep ] keep set-deploy-config ;

View File

@ -0,0 +1,27 @@
USING: assocs help.markup help.syntax kernel
tools.deploy.config ;
IN: tools.deploy.config.editor
ARTICLE: "deploy-config" "Deployment configuration"
"The deployment configuration is a key/value mapping stored in the " { $snippet "deploy.factor" } " file in the vocabulary's directory. If this file does not exist, the default deployment configuration is used:"
{ $subsection default-config }
"The deployment configuration can be read and written with a pair of words:"
{ $subsection deploy-config }
{ $subsection set-deploy-config }
"A utility word is provided to load the configuration, change a flag, and store it back to disk:"
{ $subsection set-deploy-flag }
"The " { $link "ui.tools.deploy" } " provides a graphical way of editing the configuration." ;
HELP: deploy-config
{ $values { "vocab" "a vocabulary specifier" } { "assoc" assoc } }
{ $description "Loads a vocabulary's deployment configuration from the " { $snippet "deploy.factor" } " file in the vocabulary's directory. If the file does not exist, the " { $link default-config } " is output." } ;
HELP: set-deploy-config
{ $values { "assoc" assoc } { "vocab" "a vocabulary specifier" } }
{ $description "Stores a vocabulary's deployment configuration to the " { $snippet "deploy.factor" } " file in the vocabulary's directory." } ;
HELP: set-deploy-flag
{ $values { "value" object } { "key" object } { "vocab" "a vocabulary specifier" } }
{ $description "Modifies an entry in a vocabulary's deployment configuration on disk." } ;
ABOUT: "deploy-config"

View File

@ -0,0 +1,20 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: assocs io.files kernel parser prettyprint sequences
splitting tools.deploy.config tools.vocabs vocabs.loader ;
IN: tools.deploy.config.editor
: deploy-config-path ( vocab -- string )
vocab-dir "deploy.factor" append-path ;
: deploy-config ( vocab -- assoc )
dup default-config swap
dup deploy-config-path vocab-file-contents
parse-fresh [ first assoc-union ] unless-empty ;
: set-deploy-config ( assoc vocab -- )
[ unparse-use string-lines ] dip
dup deploy-config-path set-vocab-file-contents ;
: set-deploy-flag ( value key vocab -- )
[ deploy-config [ set-at ] keep ] keep set-deploy-config ;

View File

@ -2,6 +2,11 @@ USING: help.markup help.syntax words alien.c-types assocs
kernel ; kernel ;
IN: tools.deploy IN: tools.deploy
ARTICLE: "prepare-deploy" "Preparing to deploy an application"
"In order to deploy an application as a stand-alone image, the application's vocabulary must first be given a " { $link POSTPONE: MAIN: } " hook. Then, a " { $emphasis "deployment configuration" } " must be created."
{ $subsection "deploy-config" }
{ $subsection "deploy-flags" } ;
ARTICLE: "tools.deploy" "Application deployment" ARTICLE: "tools.deploy" "Application deployment"
"The stand-alone application deployment tool compiles a vocabulary down to a native executable which runs the vocabulary's " { $link POSTPONE: MAIN: } " hook. Deployed executables do not depend on Factor being installed, and do not expose any source code, and thus are suitable for delivering commercial end-user applications." "The stand-alone application deployment tool compiles a vocabulary down to a native executable which runs the vocabulary's " { $link POSTPONE: MAIN: } " hook. Deployed executables do not depend on Factor being installed, and do not expose any source code, and thus are suitable for delivering commercial end-user applications."
$nl $nl

View File

@ -1,11 +1,11 @@
! Copyright (C) 2007, 2008 Slava Pestov. ! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors qualified io.backend io.streams.c init fry USING: accessors qualified io.backend io.streams.c init fry
namespaces make assocs kernel parser lexer strings.parser namespaces make assocs kernel parser lexer strings.parser vocabs
tools.deploy.config vocabs sequences words words.private memory sequences words words.private memory kernel.private
kernel.private continuations io prettyprint vocabs.loader continuations io vocabs.loader system strings sets
debugger system strings sets vectors quotations byte-arrays vectors quotations byte-arrays sorting compiler.units
sorting compiler.units definitions generic generic.standard ; definitions generic generic.standard tools.deploy.config ;
QUALIFIED: bootstrap.stage2 QUALIFIED: bootstrap.stage2
QUALIFIED: classes QUALIFIED: classes
QUALIFIED: command-line QUALIFIED: command-line
@ -14,7 +14,6 @@ QUALIFIED: continuations
QUALIFIED: definitions QUALIFIED: definitions
QUALIFIED: init QUALIFIED: init
QUALIFIED: layouts QUALIFIED: layouts
QUALIFIED: prettyprint.config
QUALIFIED: source-files QUALIFIED: source-files
QUALIFIED: vocabs QUALIFIED: vocabs
IN: tools.deploy.shaker IN: tools.deploy.shaker
@ -41,7 +40,7 @@ IN: tools.deploy.shaker
] when ; ] when ;
: strip-debugger ( -- ) : strip-debugger ( -- )
strip-debugger? [ strip-debugger? "debugger" vocab and [
"Stripping debugger" show "Stripping debugger" show
"resource:basis/tools/deploy/shaker/strip-debugger.factor" "resource:basis/tools/deploy/shaker/strip-debugger.factor"
run-file run-file
@ -81,14 +80,11 @@ IN: tools.deploy.shaker
>alist f like >alist f like
] change-props drop ] change-props drop
] each ] each
] [
"Remaining word properties:\n" show
[ props>> keys ] gather unparse show
] [ ] [
H{ } clone '[ H{ } clone '[
[ [ _ [ ] cache ] map ] change-props drop [ [ _ [ ] cache ] map ] change-props drop
] each ] each
] tri ; ] bi ;
: stripped-word-props ( -- seq ) : stripped-word-props ( -- seq )
[ [
@ -275,12 +271,7 @@ IN: tools.deploy.shaker
] when ] when
strip-prettyprint? [ strip-prettyprint? [
{ { } { "prettyprint.config" } strip-vocab-globals %
prettyprint.config:margin
prettyprint.config:string-limit?
prettyprint.config:boa-tuples?
prettyprint.config:tab-size
} %
] when ] when
strip-debugger? [ strip-debugger? [
@ -308,7 +299,6 @@ IN: tools.deploy.shaker
'[ drop _ member? not ] assoc-filter '[ drop _ member? not ] assoc-filter
[ drop string? not ] assoc-filter ! strip CLI args [ drop string? not ] assoc-filter ! strip CLI args
sift-assoc sift-assoc
dup keys unparse show
21 setenv 21 setenv
] [ drop ] if ; ] [ drop ] if ;
@ -362,7 +352,7 @@ SYMBOL: deploy-vocab
init-hooks get values concat % init-hooks get values concat %
, ,
strip-io? [ \ flush , ] unless strip-io? [ \ flush , ] unless
] [ ] make "Boot quotation: " show dup unparse show ] [ ] make
set-boot-quot ; set-boot-quot ;
: init-stripper ( -- ) : init-stripper ( -- )
@ -405,16 +395,14 @@ SYMBOL: deploy-vocab
deploy-vocab get require deploy-vocab get require
strip strip
finish-deploy finish-deploy
] [ ] [ die 1 exit ] recover
print-error flush 1 exit
] recover
] bind ; ] bind ;
: do-deploy ( -- ) : do-deploy ( -- )
"output-image" get "output-image" get
"deploy-vocab" get "deploy-vocab" get
"Deploying " write dup write "..." print "Deploying " write dup write "..." print
dup deploy-config dup . "deploy-config" get parse-file first
(deploy) ; (deploy) ;
MAIN: do-deploy MAIN: do-deploy

View File

@ -1,6 +1,6 @@
IN: tools.disassembler.tests IN: tools.disassembler.tests
USING: math classes.tuple prettyprint.backend tools.disassembler USING: math classes.tuple prettyprint.custom
tools.test strings ; tools.disassembler tools.test strings ;
[ ] [ \ + disassemble ] unit-test [ ] [ \ + disassemble ] unit-test
[ ] [ { string pprint* } disassemble ] unit-test [ ] [ { string pprint* } disassemble ] unit-test

View File

@ -2,9 +2,9 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel ascii combinators combinators.short-circuit USING: kernel ascii combinators combinators.short-circuit
sequences splitting fry namespaces make assocs arrays strings sequences splitting fry namespaces make assocs arrays strings
io.sockets io.encodings.string io.sockets io.encodings.string io.encodings.utf8 math
io.encodings.utf8 math math.parser accessors parser math.parser accessors parser strings.parser lexer
strings.parser lexer prettyprint.backend hashtables present prettyprint.backend prettyprint.custom hashtables present
peg.ebnf urls.encoding ; peg.ebnf urls.encoding ;
IN: urls IN: urls

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays accessors sequences sequences.private USING: arrays accessors sequences sequences.private
persistent.sequences assocs persistent.assocs kernel math persistent.sequences assocs persistent.assocs kernel math
vectors parser prettyprint.backend ; vectors parser prettyprint.custom ;
IN: vlists IN: vlists
TUPLE: vlist TUPLE: vlist

View File

@ -68,7 +68,6 @@ bootstrapping? on
"alien.accessors" "alien.accessors"
"arrays" "arrays"
"byte-arrays" "byte-arrays"
"byte-vectors"
"classes.private" "classes.private"
"classes.tuple" "classes.tuple"
"classes.tuple.private" "classes.tuple.private"

View File

@ -31,7 +31,7 @@ load-help? off
"math.integers" require "math.integers" require
"math.floats" require "math.floats" require
"memory" require "memory" require
"io.streams.c" require "io.streams.c" require
"vocabs.loader" require "vocabs.loader" require

View File

@ -16,7 +16,6 @@ IN: bootstrap.syntax
"<PRIVATE" "<PRIVATE"
"BIN:" "BIN:"
"B{" "B{"
"BV{"
"C:" "C:"
"CHAR:" "CHAR:"
"DEFER:" "DEFER:"

View File

@ -1,7 +1,7 @@
! Copyright (c) 2008 Slava Pestov ! Copyright (c) 2008 Slava Pestov
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: sequences math.parser io io.streams.byte-array USING: sequences math.parser io io.encodings.binary io.files
io.encodings.binary io.files kernel ; kernel ;
IN: checksums IN: checksums
MIXIN: checksum MIXIN: checksum
@ -12,9 +12,6 @@ GENERIC: checksum-stream ( stream checksum -- value )
GENERIC: checksum-lines ( lines checksum -- value ) GENERIC: checksum-lines ( lines checksum -- value )
M: checksum checksum-bytes
[ binary <byte-reader> ] dip checksum-stream ;
M: checksum checksum-stream M: checksum checksum-stream
[ contents ] dip checksum-bytes ; [ contents ] dip checksum-bytes ;

View File

@ -4,6 +4,7 @@ IN: classes.algebra
ARTICLE: "class-operations" "Class operations" ARTICLE: "class-operations" "Class operations"
"Set-theoretic operations on classes:" "Set-theoretic operations on classes:"
{ $subsection class= }
{ $subsection class< } { $subsection class< }
{ $subsection class<= } { $subsection class<= }
{ $subsection class-and } { $subsection class-and }

View File

@ -14,7 +14,7 @@ $nl
} }
"The underlying sequence must implement a generic word:" "The underlying sequence must implement a generic word:"
{ $subsection resize } { $subsection resize }
{ $link "vectors" } ", " { $link "byte-vectors" } " and " { $link "sbufs" } " are implemented using the resizable sequence facility." ; { $link "vectors" } " and " { $link "sbufs" } " are implemented using the resizable sequence facility." ;
ABOUT: "growable" ABOUT: "growable"

View File

@ -1,14 +1,13 @@
! Copyright (C) 2004, 2008 Slava Pestov. ! Copyright (C) 2004, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien arrays byte-arrays byte-vectors USING: accessors alien arrays byte-arrays definitions generic
definitions generic hashtables kernel math namespaces parser hashtables kernel math namespaces parser lexer sequences strings
lexer sequences strings strings.parser sbufs vectors strings.parser sbufs vectors words quotations io assocs
words quotations io assocs splitting classes.tuple splitting classes.tuple generic.standard generic.math
generic.standard generic.math generic.parser classes io.files generic.parser classes io.files vocabs classes.parser
vocabs classes.parser classes.union classes.union classes.intersection classes.mixin
classes.intersection classes.mixin classes.predicate classes.predicate classes.singleton classes.tuple.parser
classes.singleton classes.tuple.parser compiler.units compiler.units combinators effects.parser slots ;
combinators effects.parser slots ;
IN: bootstrap.syntax IN: bootstrap.syntax
! These words are defined as a top-level form, instead of with ! These words are defined as a top-level form, instead of with
@ -81,7 +80,6 @@ IN: bootstrap.syntax
"{" [ \ } [ >array ] parse-literal ] define-syntax "{" [ \ } [ >array ] parse-literal ] define-syntax
"V{" [ \ } [ >vector ] parse-literal ] define-syntax "V{" [ \ } [ >vector ] parse-literal ] define-syntax
"B{" [ \ } [ >byte-array ] parse-literal ] define-syntax "B{" [ \ } [ >byte-array ] parse-literal ] define-syntax
"BV{" [ \ } [ >byte-vector ] parse-literal ] define-syntax
"H{" [ \ } [ >hashtable ] parse-literal ] define-syntax "H{" [ \ } [ >hashtable ] parse-literal ] define-syntax
"T{" [ parse-tuple-literal parsed ] define-syntax "T{" [ parse-tuple-literal parsed ] define-syntax
"W{" [ \ } [ first <wrapper> ] parse-literal ] define-syntax "W{" [ \ } [ first <wrapper> ] parse-literal ] define-syntax