Untangling some dependencies
parent
73b3cd6367
commit
4f0a9f311e
|
@ -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 ;
|
|
@ -3,8 +3,7 @@
|
|||
USING: accessors arrays alien alien.c-types alien.structs
|
||||
alien.arrays alien.strings kernel math namespaces parser
|
||||
sequences words quotations math.parser splitting grouping
|
||||
effects prettyprint prettyprint.sections prettyprint.backend
|
||||
assocs combinators lexer strings.parser alien.parser ;
|
||||
effects assocs combinators lexer strings.parser alien.parser ;
|
||||
IN: alien.syntax
|
||||
|
||||
: DLL" lexer get skip-blank parse-string dlopen parsed ; parsing
|
||||
|
@ -34,12 +33,3 @@ IN: alien.syntax
|
|||
dup length
|
||||
[ [ create-in ] dip 1quotation define ] 2each ;
|
||||
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 ;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien.c-types accessors math alien.accessors kernel
|
||||
kernel.private locals sequences sequences.private byte-arrays
|
||||
parser prettyprint.backend fry ;
|
||||
parser prettyprint.custom fry ;
|
||||
IN: bit-arrays
|
||||
|
||||
TUPLE: bit-array
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: arrays kernel kernel.private math sequences
|
||||
sequences.private growable bit-arrays prettyprint.backend
|
||||
sequences.private growable bit-arrays prettyprint.custom
|
||||
parser accessors ;
|
||||
IN: bit-vectors
|
||||
|
||||
|
|
|
@ -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
|
|
@ -5,17 +5,22 @@ sequences namespaces parser kernel kernel.private classes
|
|||
classes.private arrays hashtables vectors classes.tuple sbufs
|
||||
hashtables.private sequences.private math classes.tuple.private
|
||||
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.tree.optimizer compiler.cfg.optimizer ;
|
||||
IN: bootstrap.compiler
|
||||
|
||||
! Don't bring this in when deploying, since it will store a
|
||||
! reference to 'eval' in a global variable
|
||||
"deploy-vocab" get [
|
||||
"deploy-vocab" get "staging" get or [
|
||||
"alien.remote-control" require
|
||||
] unless
|
||||
|
||||
"prettyprint" vocab [
|
||||
"stack-checker.errors.prettyprint" require
|
||||
"alien.prettyprint" require
|
||||
] when
|
||||
|
||||
"cpu." cpu name>> append require
|
||||
|
||||
enable-compiler
|
||||
|
@ -86,7 +91,7 @@ nl
|
|||
"." write flush
|
||||
|
||||
{
|
||||
. malloc calloc free memcpy
|
||||
malloc calloc free memcpy
|
||||
} compile-uncompiled
|
||||
|
||||
"." write flush
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -1,5 +1,7 @@
|
|||
USE: vocabs.loader
|
||||
USING: vocabs vocabs.loader kernel ;
|
||||
|
||||
"math.ratios" require
|
||||
"math.floats" require
|
||||
"math.complex" require
|
||||
|
||||
"prettyprint" vocab [ "math.complex.prettyprint" require ] when
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors init namespaces words io
|
||||
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
|
||||
definitions assocs compiler.errors compiler.units
|
||||
math.parser generic sets debugger command-line ;
|
||||
math.parser generic sets command-line ;
|
||||
IN: bootstrap.stage2
|
||||
|
||||
SYMBOL: core-bootstrap-time
|
||||
|
@ -86,25 +86,18 @@ SYMBOL: bootstrap-time
|
|||
f error set-global
|
||||
f error-continuation set-global
|
||||
|
||||
"deploy-vocab" get [
|
||||
"tools.deploy.shaker" run
|
||||
] [
|
||||
[
|
||||
boot
|
||||
do-init-hooks
|
||||
handle-command-line
|
||||
] set-boot-quot
|
||||
|
||||
millis swap - bootstrap-time set-global
|
||||
print-report
|
||||
|
||||
"deploy-vocab" get [
|
||||
"tools.deploy.shaker" run
|
||||
] [
|
||||
"staging" get [
|
||||
"resource:basis/bootstrap/finish-staging.factor" run-file
|
||||
] [
|
||||
"resource:basis/bootstrap/finish-bootstrap.factor" run-file
|
||||
] if
|
||||
|
||||
"output-image" get save-image-and-exit
|
||||
] if
|
||||
] [
|
||||
:c
|
||||
dup print-error flush
|
||||
"listener" vocab
|
||||
[ restarts. vocab-main execute ]
|
||||
[ die ] if*
|
||||
1 exit
|
||||
] recover
|
||||
] [ drop "resource:basis/bootstrap/bootstrap-error.factor" run-file ] recover
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: arrays kernel kernel.private math sequences
|
||||
sequences.private growable byte-arrays accessors parser
|
||||
prettyprint.backend ;
|
||||
prettyprint.custom ;
|
||||
IN: byte-vectors
|
||||
|
||||
TUPLE: byte-vector
|
||||
|
|
|
@ -4,7 +4,7 @@ USING: kernel io io.binary io.files io.streams.byte-array math
|
|||
math.functions math.parser namespaces splitting grouping strings
|
||||
sequences byte-arrays locals sequences.private
|
||||
io.encodings.binary symbols math.bitwise checksums
|
||||
checksums.common ;
|
||||
checksums.common checksums.stream ;
|
||||
IN: checksums.md5
|
||||
|
||||
! See http://www.faqs.org/rfcs/rfc1321.html
|
||||
|
@ -180,7 +180,7 @@ PRIVATE>
|
|||
|
||||
SINGLETON: md5
|
||||
|
||||
INSTANCE: md5 checksum
|
||||
INSTANCE: md5 stream-checksum
|
||||
|
||||
M: md5 checksum-stream ( stream -- byte-array )
|
||||
drop [ initialize-md5 stream>md5 get-md5 ] with-input-stream ;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
! Copyright (C) 2008 Slava Pestov
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
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
|
||||
|
||||
ERROR: unknown-digest name ;
|
||||
|
@ -12,7 +13,7 @@ TUPLE: openssl-checksum name ;
|
|||
|
||||
: openssl-sha1 T{ openssl-checksum f "sha1" } ;
|
||||
|
||||
INSTANCE: openssl-checksum checksum
|
||||
INSTANCE: openssl-checksum stream-checksum
|
||||
|
||||
C: <openssl-checksum> openssl-checksum
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
USING: arrays combinators kernel io io.encodings.binary io.files
|
||||
io.streams.byte-array math.vectors strings sequences namespaces
|
||||
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
|
||||
|
||||
! Implemented according to RFC 3174.
|
||||
|
@ -113,7 +114,7 @@ SYMBOLS: h0 h1 h2 h3 h4 A B C D E w K ;
|
|||
|
||||
SINGLETON: sha1
|
||||
|
||||
INSTANCE: sha1 checksum
|
||||
INSTANCE: sha1 stream-checksum
|
||||
|
||||
M: sha1 checksum-stream ( stream -- sha1 )
|
||||
drop [ initialize-sha1 stream>sha1 get-sha1 ] with-input-stream ;
|
||||
|
|
|
@ -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
|
|
@ -1,8 +1,8 @@
|
|||
! Copyright (C) 2003, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: init continuations debugger hashtables io
|
||||
io.encodings.utf8 io.files kernel kernel.private namespaces
|
||||
parser sequences strings system splitting eval vocabs.loader ;
|
||||
USING: init continuations hashtables io io.encodings.utf8
|
||||
io.files kernel kernel.private namespaces parser sequences
|
||||
strings system splitting vocabs.loader ;
|
||||
IN: command-line
|
||||
|
||||
SYMBOL: script
|
||||
|
@ -31,8 +31,6 @@ SYMBOL: command-line
|
|||
] [ drop ] if
|
||||
] when ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
: var-param ( name value -- ) swap set-global ;
|
||||
|
||||
: bool-param ( name -- ) "no-" ?head not var-param ;
|
||||
|
@ -43,8 +41,6 @@ SYMBOL: command-line
|
|||
: run-script ( file -- )
|
||||
t "quiet" set-global run-file ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: parse-command-line ( args -- )
|
||||
[ command-line off script off ] [
|
||||
unclip "-" ?head
|
||||
|
@ -76,15 +72,4 @@ SYMBOL: main-vocab-hook
|
|||
|
||||
: 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
USING: compiler.cfg.instructions compiler.cfg.registers
|
||||
compiler.cfg.alias-analysis cpu.architecture tools.test
|
||||
kernel ;
|
||||
compiler.cfg.alias-analysis compiler.cfg.debugger
|
||||
cpu.architecture tools.test kernel ;
|
||||
IN: compiler.cfg.alias-analysis.tests
|
||||
|
||||
[ ] [
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
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
|
||||
|
||||
[ { } ] [
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel words sequences quotations namespaces io
|
||||
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.stack-frame compiler.cfg.linear-scan
|
||||
compiler.cfg.two-operand compiler.cfg.optimizer ;
|
||||
compiler.cfg.registers compiler.cfg.stack-frame
|
||||
compiler.cfg.linear-scan compiler.cfg.two-operand
|
||||
compiler.cfg.optimizer ;
|
||||
IN: compiler.cfg.debugger
|
||||
|
||||
GENERIC: test-cfg ( quot -- cfgs )
|
||||
|
@ -40,3 +42,15 @@ SYMBOL: allocate-registers?
|
|||
instructions>> [ insn. ] each
|
||||
nl
|
||||
] 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 ;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors namespaces kernel arrays
|
||||
parser prettyprint.backend prettyprint.sections ;
|
||||
USING: accessors namespaces kernel arrays parser ;
|
||||
IN: compiler.cfg.registers
|
||||
|
||||
! Virtual registers, used by CFG and machine IRs
|
||||
|
@ -18,20 +17,6 @@ C: <ds-loc> ds-loc
|
|||
TUPLE: rs-loc < loc ;
|
||||
C: <rs-loc> rs-loc
|
||||
|
||||
! Prettyprinting
|
||||
: 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
|
||||
|
||||
M: ds-loc pprint* \ D pprint-loc ;
|
||||
|
||||
: R scan-word <rs-loc> parsed ; parsing
|
||||
|
||||
M: rs-loc pprint* \ R pprint-loc ;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
IN: compiler.cfg.value-numbering.tests
|
||||
USING: compiler.cfg.value-numbering compiler.cfg.instructions
|
||||
compiler.cfg.registers cpu.architecture tools.test kernel math
|
||||
combinators.short-circuit accessors sequences ;
|
||||
compiler.cfg.registers compiler.cfg.debugger cpu.architecture
|
||||
tools.test kernel math combinators.short-circuit accessors
|
||||
sequences ;
|
||||
|
||||
: trim-temps ( insns -- insns )
|
||||
[
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
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
|
||||
|
||||
[
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
! Copyright (C) 2007, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: arrays byte-arrays generic assocs hashtables io.binary
|
||||
kernel kernel.private math namespaces make sequences words
|
||||
quotations strings alien.accessors alien.strings layouts system
|
||||
combinators math.bitwise words.private math.order accessors
|
||||
growable cpu.architecture compiler.constants ;
|
||||
USING: arrays byte-arrays byte-vectors generic assocs hashtables
|
||||
io.binary kernel kernel.private math namespaces make sequences
|
||||
words quotations strings alien.accessors alien.strings layouts
|
||||
system combinators math.bitwise words.private math.order
|
||||
accessors growable cpu.architecture compiler.constants ;
|
||||
IN: compiler.codegen.fixup
|
||||
|
||||
GENERIC: fixup* ( obj -- )
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
! Copyright (C) 2004, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors kernel namespaces arrays sequences io debugger
|
||||
words fry continuations vocabs assocs dlists definitions
|
||||
math threads graphs generic combinators deques search-deques
|
||||
prettyprint io stack-checker stack-checker.state
|
||||
stack-checker.inlining compiler.errors compiler.units
|
||||
compiler.tree.builder compiler.tree.optimizer
|
||||
compiler.cfg.builder compiler.cfg.optimizer
|
||||
compiler.cfg.linearization compiler.cfg.two-operand
|
||||
compiler.cfg.linear-scan compiler.cfg.stack-frame
|
||||
compiler.codegen ;
|
||||
USING: accessors kernel namespaces arrays sequences io
|
||||
words fry continuations vocabs assocs dlists definitions math
|
||||
threads graphs generic combinators deques search-deques io
|
||||
stack-checker stack-checker.state stack-checker.inlining
|
||||
compiler.errors compiler.units compiler.tree.builder
|
||||
compiler.tree.optimizer compiler.cfg.builder
|
||||
compiler.cfg.optimizer compiler.cfg.linearization
|
||||
compiler.cfg.two-operand compiler.cfg.linear-scan
|
||||
compiler.cfg.stack-frame compiler.codegen ;
|
||||
IN: compiler
|
||||
|
||||
SYMBOL: compile-queue
|
||||
|
@ -45,7 +44,7 @@ SYMBOL: +failed+
|
|||
2bi ;
|
||||
|
||||
: start ( word -- )
|
||||
"trace-compilation" get [ dup . flush ] when
|
||||
"trace-compilation" get [ dup name>> print flush ] when
|
||||
H{ } clone dependencies set
|
||||
H{ } clone generic-dependencies set
|
||||
f swap compiler-error ;
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel assocs match fry accessors namespaces make effects
|
||||
sequences sequences.private quotations generic macros arrays
|
||||
prettyprint prettyprint.backend prettyprint.sections math words
|
||||
combinators combinators.short-circuit io sorting hints qualified
|
||||
prettyprint prettyprint.backend prettyprint.custom
|
||||
prettyprint.sections math words combinators
|
||||
combinators.short-circuit io sorting hints qualified
|
||||
compiler.tree
|
||||
compiler.tree.recursive
|
||||
compiler.tree.normalization
|
||||
|
|
|
@ -22,9 +22,6 @@ M: tuple error-help class ;
|
|||
|
||||
M: string error. print ;
|
||||
|
||||
: :error ( -- )
|
||||
error get error. ;
|
||||
|
||||
: :s ( -- )
|
||||
error-continuation get data>> stack. ;
|
||||
|
||||
|
@ -63,6 +60,9 @@ M: string error. print ;
|
|||
[ global [ "Error in print-error!" print drop ] bind ]
|
||||
recover ;
|
||||
|
||||
: :error ( -- )
|
||||
error get print-error ;
|
||||
|
||||
: print-error-and-restarts ( error -- )
|
||||
print-error
|
||||
restarts.
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
! Copyright (C) 2007, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
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
|
||||
|
||||
! Definition protocol implementation
|
||||
|
|
|
@ -150,7 +150,7 @@ M: help-error error.
|
|||
] [
|
||||
[
|
||||
swap vocab-heading.
|
||||
[ error. nl ] each
|
||||
[ print-error nl ] each
|
||||
] assoc-each
|
||||
] if-empty ;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
! Copyright (C) 2005, 2008 Slava Pestov.
|
||||
! 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
|
||||
|
||||
SYMBOL: plain
|
||||
|
@ -43,4 +44,11 @@ TUPLE: input string ;
|
|||
|
||||
C: <input> input
|
||||
|
||||
M: input summary
|
||||
[
|
||||
"Input: " %
|
||||
string>> "\n" split1 swap %
|
||||
"..." "" ? %
|
||||
] "" make ;
|
||||
|
||||
: write-object ( str obj -- ) presented associate format ;
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel namespaces make sequences sequences.private assocs
|
||||
math vectors strings classes.tuple generalizations parser words
|
||||
quotations debugger macros arrays macros splitting combinators
|
||||
prettyprint.backend definitions prettyprint hashtables
|
||||
prettyprint.sections sets sequences.private effects
|
||||
quotations macros arrays macros splitting combinators
|
||||
prettyprint.backend prettyprint.custom definitions prettyprint
|
||||
hashtables prettyprint.sections sets sequences.private effects
|
||||
effects.parser generic generic.parser compiler.units accessors
|
||||
locals.backend memoize macros.expander lexer classes summary fry
|
||||
fry.private ;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
! Copyright (C) 2006, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors kernel kernel.private math math.private
|
||||
math.libm math.functions prettyprint.backend arrays
|
||||
math.functions.private sequences parser ;
|
||||
math.libm math.functions arrays math.functions.private sequences
|
||||
parser ;
|
||||
IN: math.complex.private
|
||||
|
||||
M: real real-part ;
|
||||
|
@ -47,7 +47,3 @@ M: complex sqrt >polar [ fsqrt ] [ 2.0 / ] bi* polar> ;
|
|||
IN: syntax
|
||||
|
||||
: C{ \ } [ first2 rect> ] parse-literal ; parsing
|
||||
|
||||
M: complex pprint-delims drop \ C{ \ } ;
|
||||
M: complex >pprint-sequence >rect 2array ;
|
||||
M: complex pprint* pprint-object ;
|
||||
|
|
|
@ -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 ;
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
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
|
||||
|
||||
TUPLE: nibble-array
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Based on Clojure's PersistentHashMap by Rich Hickey.
|
||||
|
||||
USING: kernel math accessors assocs fry combinators parser
|
||||
prettyprint.backend make
|
||||
prettyprint.custom make
|
||||
persistent.assocs
|
||||
persistent.hashtables.nodes
|
||||
persistent.hashtables.nodes.empty
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Based on Clojure's PersistentVector by Rich Hickey.
|
||||
|
||||
USING: math accessors kernel sequences.private sequences arrays
|
||||
combinators combinators.short-circuit parser prettyprint.backend
|
||||
combinators combinators.short-circuit parser prettyprint.custom
|
||||
persistent.sequences ;
|
||||
IN: persistent.vectors
|
||||
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
USING: help.markup help.syntax io kernel
|
||||
prettyprint.config prettyprint.sections words strings ;
|
||||
prettyprint.config prettyprint.sections prettyprint.custom
|
||||
words strings ;
|
||||
IN: prettyprint.backend
|
||||
|
||||
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
|
||||
{ $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." }
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
! Copyright (C) 2003, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors arrays byte-arrays byte-vectors generic
|
||||
hashtables io assocs kernel math namespaces make sequences
|
||||
strings sbufs io.styles vectors words prettyprint.config
|
||||
USING: accessors arrays byte-arrays generic hashtables io assocs
|
||||
kernel math namespaces make sequences strings sbufs io.styles
|
||||
vectors words prettyprint.config prettyprint.custom
|
||||
prettyprint.sections quotations io io.files math.parser effects
|
||||
classes.tuple math.order classes.tuple.private classes
|
||||
combinators colors ;
|
||||
IN: prettyprint.backend
|
||||
|
||||
GENERIC: pprint* ( obj -- )
|
||||
|
||||
M: effect pprint* effect>string "(" ")" surround text ;
|
||||
|
||||
: ?effect-height ( word -- n )
|
||||
|
@ -161,26 +159,19 @@ M: tuple pprint*
|
|||
[ [ pprint* ] each ] dip
|
||||
[ "~" swap number>string " more~" 3append text ] when* ;
|
||||
|
||||
GENERIC: pprint-delims ( obj -- start end )
|
||||
|
||||
M: quotation pprint-delims drop \ [ \ ] ;
|
||||
M: curry pprint-delims drop \ [ \ ] ;
|
||||
M: compose pprint-delims drop \ [ \ ] ;
|
||||
M: array pprint-delims drop \ { \ } ;
|
||||
M: byte-array pprint-delims drop \ B{ \ } ;
|
||||
M: byte-vector pprint-delims drop \ BV{ \ } ;
|
||||
M: vector pprint-delims drop \ V{ \ } ;
|
||||
M: hashtable pprint-delims drop \ H{ \ } ;
|
||||
M: tuple pprint-delims drop \ T{ \ } ;
|
||||
M: wrapper pprint-delims drop \ W{ \ } ;
|
||||
M: callstack pprint-delims drop \ CS{ \ } ;
|
||||
|
||||
GENERIC: >pprint-sequence ( obj -- seq )
|
||||
|
||||
M: object >pprint-sequence ;
|
||||
|
||||
M: vector >pprint-sequence ;
|
||||
M: byte-vector >pprint-sequence ;
|
||||
M: curry >pprint-sequence ;
|
||||
M: compose >pprint-sequence ;
|
||||
M: hashtable >pprint-sequence >alist ;
|
||||
|
@ -191,16 +182,13 @@ M: tuple >pprint-sequence
|
|||
[ class ] [ tuple-slots ] bi
|
||||
[ 1array ] [ [ f 2array ] dip append ] if-empty ;
|
||||
|
||||
GENERIC: pprint-narrow? ( obj -- ? )
|
||||
|
||||
M: object pprint-narrow? drop f ;
|
||||
|
||||
M: array pprint-narrow? drop t ;
|
||||
M: vector pprint-narrow? drop t ;
|
||||
M: hashtable pprint-narrow? drop t ;
|
||||
M: tuple pprint-narrow? drop t ;
|
||||
|
||||
: pprint-object ( obj -- )
|
||||
M: object pprint-object ( obj -- )
|
||||
[
|
||||
<flow
|
||||
dup pprint-delims [
|
||||
|
@ -213,7 +201,6 @@ M: tuple pprint-narrow? drop t ;
|
|||
|
||||
M: object pprint* pprint-object ;
|
||||
M: vector pprint* pprint-object ;
|
||||
M: byte-vector pprint* pprint-object ;
|
||||
M: hashtable pprint* pprint-object ;
|
||||
M: curry pprint* pprint-object ;
|
||||
M: compose pprint* pprint-object ;
|
||||
|
|
|
@ -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 ;
|
|
@ -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 -- ? )
|
|
@ -1,4 +1,4 @@
|
|||
USING: prettyprint.backend prettyprint.config
|
||||
USING: prettyprint.backend prettyprint.config prettyprint.custom
|
||||
prettyprint.sections prettyprint.private help.markup help.syntax
|
||||
io kernel words definitions quotations strings generic classes ;
|
||||
IN: prettyprint
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: arrays generic generic.standard assocs io kernel math
|
||||
namespaces make sequences strings io.styles io.streams.string
|
||||
vectors words prettyprint.backend prettyprint.sections
|
||||
prettyprint.config sorting splitting grouping math.parser vocabs
|
||||
definitions effects classes.builtin classes.tuple io.files
|
||||
classes continuations hashtables classes.mixin classes.union
|
||||
classes.intersection classes.predicate classes.singleton
|
||||
combinators quotations sets accessors colors parser ;
|
||||
vectors words prettyprint.backend prettyprint.custom
|
||||
prettyprint.sections prettyprint.config sorting splitting
|
||||
grouping math.parser vocabs definitions effects classes.builtin
|
||||
classes.tuple io.files classes continuations hashtables
|
||||
classes.mixin classes.union classes.intersection
|
||||
classes.predicate classes.singleton combinators quotations sets
|
||||
accessors colors parser summary ;
|
||||
IN: prettyprint
|
||||
|
||||
: make-pprint ( obj quot -- block in use )
|
||||
|
@ -231,6 +232,8 @@ M: pathname synopsis* pprint* ;
|
|||
[ synopsis* ] with-in
|
||||
] with-string-writer ;
|
||||
|
||||
M: word summary synopsis ;
|
||||
|
||||
: synopsis-alist ( definitions -- alist )
|
||||
[ dup synopsis swap ] { } map>assoc ;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2007, 2008 Daniel Ehrenberg.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel sequences assocs hashtables parser lexer
|
||||
vocabs words namespaces vocabs.loader debugger sets fry ;
|
||||
vocabs words namespaces vocabs.loader sets fry ;
|
||||
IN: qualified
|
||||
|
||||
: define-qualified ( vocab-name prefix-name -- )
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors combinators kernel math sequences strings
|
||||
sets assocs prettyprint.backend make lexer namespaces parser
|
||||
arrays fry regexp.backend regexp.utils regexp.parser regexp.nfa
|
||||
regexp.dfa regexp.traversal regexp.transition-tables splitting
|
||||
sorting ;
|
||||
USING: accessors combinators kernel math sequences strings sets
|
||||
assocs prettyprint.backend prettyprint.custom make lexer
|
||||
namespaces parser arrays fry regexp.backend regexp.utils
|
||||
regexp.parser regexp.nfa regexp.dfa regexp.traversal
|
||||
regexp.transition-tables splitting sorting ;
|
||||
IN: regexp
|
||||
|
||||
: default-regexp ( string -- regexp )
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! 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
|
||||
accessors summary ;
|
||||
IN: specialized-arrays.functor
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: functors sequences sequences.private growable
|
||||
prettyprint.backend kernel words classes math parser ;
|
||||
prettyprint.custom kernel words classes math parser ;
|
||||
IN: specialized-vectors.functor
|
||||
|
||||
FUNCTOR: define-vector ( T -- )
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
! Copyright (C) 2004, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: fry arrays generic io io.streams.string kernel math
|
||||
namespaces parser prettyprint sequences strings vectors words
|
||||
quotations effects classes continuations debugger assocs
|
||||
combinators compiler.errors accessors math.order definitions
|
||||
sets generic.standard.engines.tuple hints stack-checker.state
|
||||
stack-checker.visitor stack-checker.errors
|
||||
stack-checker.values stack-checker.recursive-state ;
|
||||
namespaces parser sequences strings vectors words quotations
|
||||
effects classes continuations assocs combinators
|
||||
compiler.errors accessors math.order definitions sets
|
||||
generic.standard.engines.tuple hints stack-checker.state
|
||||
stack-checker.visitor stack-checker.errors stack-checker.values
|
||||
stack-checker.recursive-state ;
|
||||
IN: stack-checker.backend
|
||||
|
||||
: push-d ( obj -- ) meta-d push ;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
! Copyright (C) 2006, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel generic sequences prettyprint io words arrays
|
||||
summary effects debugger assocs accessors namespaces
|
||||
compiler.errors stack-checker.values
|
||||
USING: kernel generic sequences io words arrays summary effects
|
||||
assocs accessors namespaces compiler.errors stack-checker.values
|
||||
stack-checker.recursive-state ;
|
||||
IN: stack-checker.errors
|
||||
|
||||
|
@ -10,8 +9,6 @@ TUPLE: inference-error error type word ;
|
|||
|
||||
M: inference-error compiler-error-type type>> ;
|
||||
|
||||
M: inference-error error-help error>> error-help ;
|
||||
|
||||
: (inference-error) ( ... class type -- * )
|
||||
[ boa ] dip
|
||||
recursive-state get word>>
|
||||
|
@ -23,14 +20,8 @@ M: inference-error error-help error>> error-help ;
|
|||
: inference-warning ( ... class -- * )
|
||||
+warning+ (inference-error) ; inline
|
||||
|
||||
M: inference-error error.
|
||||
[ word>> [ "In word: " write . ] when* ] [ error>> error. ] bi ;
|
||||
|
||||
TUPLE: literal-expected ;
|
||||
|
||||
M: literal-expected summary
|
||||
drop "Literal value expected" ;
|
||||
|
||||
M: object (literal) \ literal-expected inference-warning ;
|
||||
|
||||
TUPLE: unbalanced-branches-error branches quots ;
|
||||
|
@ -38,79 +29,25 @@ TUPLE: unbalanced-branches-error branches quots ;
|
|||
: unbalanced-branches-error ( branches quots -- * )
|
||||
\ 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 ;
|
||||
|
||||
M: too-many->r summary
|
||||
drop
|
||||
"Quotation pushes elements on retain stack without popping them" ;
|
||||
|
||||
TUPLE: too-many-r> ;
|
||||
|
||||
M: too-many-r> summary
|
||||
drop
|
||||
"Quotation pops retain stack elements which it did not push" ;
|
||||
|
||||
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 ;
|
||||
|
||||
: effect-error ( word inferred declared -- * )
|
||||
\ 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 ;
|
||||
|
||||
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 ;
|
||||
|
||||
M: undeclared-recursion-error error.
|
||||
"The inline recursive word " write
|
||||
word>> pprint
|
||||
" must be declared recursive" print ;
|
||||
|
||||
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 ;
|
||||
|
||||
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 ;
|
||||
|
||||
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 ;
|
||||
|
||||
M: unknown-primitive-error error.
|
||||
drop
|
||||
"Cannot determine stack effect statically" print ;
|
||||
|
|
|
@ -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 ;
|
|
@ -5,7 +5,7 @@ classes sequences.private continuations.private effects generic
|
|||
hashtables hashtables.private io io.backend io.files
|
||||
io.files.private io.streams.c kernel kernel.private math
|
||||
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
|
||||
strings.private system threads.private classes.tuple
|
||||
classes.tuple.private vectors vectors.private words definitions
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors classes sequences splitting kernel namespaces
|
||||
make words math math.parser io.styles prettyprint assocs ;
|
||||
USING: accessors classes sequences kernel namespaces
|
||||
make words math math.parser assocs ;
|
||||
IN: summary
|
||||
|
||||
GENERIC: summary ( object -- string )
|
||||
|
@ -11,15 +11,6 @@ GENERIC: summary ( object -- string )
|
|||
|
||||
M: object summary object-summary ;
|
||||
|
||||
M: input summary
|
||||
[
|
||||
"Input: " %
|
||||
string>> "\n" split1 swap %
|
||||
"..." "" ? %
|
||||
] "" make ;
|
||||
|
||||
M: word summary synopsis ;
|
||||
|
||||
M: sequence summary
|
||||
[
|
||||
dup class name>> %
|
||||
|
|
|
@ -5,8 +5,8 @@ assocs kernel vocabs words sequences memory io system arrays
|
|||
continuations math definitions mirrors splitting parser classes
|
||||
summary layouts vocabs.loader prettyprint.config prettyprint
|
||||
debugger io.streams.c io.files io.backend quotations io.launcher
|
||||
words.private tools.deploy.config bootstrap.image
|
||||
io.encodings.utf8 destructors accessors ;
|
||||
words.private tools.deploy.config tools.deploy.config.editor
|
||||
bootstrap.image io.encodings.utf8 destructors accessors ;
|
||||
IN: tools.deploy.backend
|
||||
|
||||
: copy-vm ( executable bundle-name extension -- vm )
|
||||
|
@ -88,6 +88,10 @@ DEFER: ?make-staging-image
|
|||
dup staging-image-name exists?
|
||||
[ 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 )
|
||||
[
|
||||
bootstrap-profile ?make-staging-image
|
||||
|
@ -99,7 +103,8 @@ DEFER: ?make-staging-image
|
|||
|
||||
"-run=tools.deploy.shaker" ,
|
||||
|
||||
"-deploy-vocab=" prepend ,
|
||||
[ "-deploy-vocab=" prepend , ]
|
||||
[ make-deploy-config "-deploy-config=" prepend , ] bi
|
||||
|
||||
"-output-image=" prepend ,
|
||||
|
||||
|
|
|
@ -2,16 +2,6 @@ USING: help.markup help.syntax words alien.c-types assocs
|
|||
kernel math ;
|
||||
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"
|
||||
"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? }
|
||||
|
@ -25,12 +15,7 @@ ARTICLE: "deploy-flags" "Deployment flags"
|
|||
{ $subsection deploy-word-props? }
|
||||
{ $subsection deploy-c-types? } ;
|
||||
|
||||
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" } ;
|
||||
|
||||
ABOUT: "prepare-deploy"
|
||||
ABOUT: "deploy-flags"
|
||||
|
||||
HELP: deploy-name
|
||||
{ $description "Deploy setting. The name of the executable."
|
||||
|
@ -114,15 +99,3 @@ HELP: deploy-reflection
|
|||
HELP: default-config
|
||||
{ $values { "vocab" "a vocabulary specifier" } { "assoc" assoc } }
|
||||
{ $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." } ;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
! Copyright (C) 2007, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: vocabs.loader io.files io kernel sequences assocs
|
||||
splitting parser prettyprint namespaces math vocabs
|
||||
hashtables tools.vocabs ;
|
||||
USING: io.files io kernel sequences assocs splitting parser
|
||||
namespaces math vocabs hashtables ;
|
||||
IN: tools.deploy.config
|
||||
|
||||
SYMBOL: deploy-name
|
||||
|
@ -66,18 +65,3 @@ SYMBOL: deploy-image
|
|||
! default value for deploy.macosx
|
||||
{ "stop-after-last-window?" t }
|
||||
} 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 ;
|
||||
|
|
|
@ -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"
|
|
@ -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 ;
|
|
@ -2,6 +2,11 @@ USING: help.markup help.syntax words alien.c-types assocs
|
|||
kernel ;
|
||||
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"
|
||||
"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
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
! Copyright (C) 2007, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors qualified io.backend io.streams.c init fry
|
||||
namespaces make assocs kernel parser lexer strings.parser
|
||||
tools.deploy.config vocabs sequences words words.private memory
|
||||
kernel.private continuations io prettyprint vocabs.loader
|
||||
debugger system strings sets vectors quotations byte-arrays
|
||||
sorting compiler.units definitions generic generic.standard ;
|
||||
namespaces make assocs kernel parser lexer strings.parser vocabs
|
||||
sequences words words.private memory kernel.private
|
||||
continuations io vocabs.loader system strings sets
|
||||
vectors quotations byte-arrays sorting compiler.units
|
||||
definitions generic generic.standard tools.deploy.config ;
|
||||
QUALIFIED: bootstrap.stage2
|
||||
QUALIFIED: classes
|
||||
QUALIFIED: command-line
|
||||
|
@ -14,7 +14,6 @@ QUALIFIED: continuations
|
|||
QUALIFIED: definitions
|
||||
QUALIFIED: init
|
||||
QUALIFIED: layouts
|
||||
QUALIFIED: prettyprint.config
|
||||
QUALIFIED: source-files
|
||||
QUALIFIED: vocabs
|
||||
IN: tools.deploy.shaker
|
||||
|
@ -41,7 +40,7 @@ IN: tools.deploy.shaker
|
|||
] when ;
|
||||
|
||||
: strip-debugger ( -- )
|
||||
strip-debugger? [
|
||||
strip-debugger? "debugger" vocab and [
|
||||
"Stripping debugger" show
|
||||
"resource:basis/tools/deploy/shaker/strip-debugger.factor"
|
||||
run-file
|
||||
|
@ -81,14 +80,11 @@ IN: tools.deploy.shaker
|
|||
>alist f like
|
||||
] change-props drop
|
||||
] each
|
||||
] [
|
||||
"Remaining word properties:\n" show
|
||||
[ props>> keys ] gather unparse show
|
||||
] [
|
||||
H{ } clone '[
|
||||
[ [ _ [ ] cache ] map ] change-props drop
|
||||
] each
|
||||
] tri ;
|
||||
] bi ;
|
||||
|
||||
: stripped-word-props ( -- seq )
|
||||
[
|
||||
|
@ -275,12 +271,7 @@ IN: tools.deploy.shaker
|
|||
] when
|
||||
|
||||
strip-prettyprint? [
|
||||
{
|
||||
prettyprint.config:margin
|
||||
prettyprint.config:string-limit?
|
||||
prettyprint.config:boa-tuples?
|
||||
prettyprint.config:tab-size
|
||||
} %
|
||||
{ } { "prettyprint.config" } strip-vocab-globals %
|
||||
] when
|
||||
|
||||
strip-debugger? [
|
||||
|
@ -308,7 +299,6 @@ IN: tools.deploy.shaker
|
|||
'[ drop _ member? not ] assoc-filter
|
||||
[ drop string? not ] assoc-filter ! strip CLI args
|
||||
sift-assoc
|
||||
dup keys unparse show
|
||||
21 setenv
|
||||
] [ drop ] if ;
|
||||
|
||||
|
@ -362,7 +352,7 @@ SYMBOL: deploy-vocab
|
|||
init-hooks get values concat %
|
||||
,
|
||||
strip-io? [ \ flush , ] unless
|
||||
] [ ] make "Boot quotation: " show dup unparse show
|
||||
] [ ] make
|
||||
set-boot-quot ;
|
||||
|
||||
: init-stripper ( -- )
|
||||
|
@ -405,16 +395,14 @@ SYMBOL: deploy-vocab
|
|||
deploy-vocab get require
|
||||
strip
|
||||
finish-deploy
|
||||
] [
|
||||
print-error flush 1 exit
|
||||
] recover
|
||||
] [ die 1 exit ] recover
|
||||
] bind ;
|
||||
|
||||
: do-deploy ( -- )
|
||||
"output-image" get
|
||||
"deploy-vocab" get
|
||||
"Deploying " write dup write "..." print
|
||||
dup deploy-config dup .
|
||||
"deploy-config" get parse-file first
|
||||
(deploy) ;
|
||||
|
||||
MAIN: do-deploy
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
IN: tools.disassembler.tests
|
||||
USING: math classes.tuple prettyprint.backend tools.disassembler
|
||||
tools.test strings ;
|
||||
USING: math classes.tuple prettyprint.custom
|
||||
tools.disassembler tools.test strings ;
|
||||
|
||||
[ ] [ \ + disassemble ] unit-test
|
||||
[ ] [ { string pprint* } disassemble ] unit-test
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel ascii combinators combinators.short-circuit
|
||||
sequences splitting fry namespaces make assocs arrays strings
|
||||
io.sockets io.encodings.string
|
||||
io.encodings.utf8 math math.parser accessors parser
|
||||
strings.parser lexer prettyprint.backend hashtables present
|
||||
io.sockets io.encodings.string io.encodings.utf8 math
|
||||
math.parser accessors parser strings.parser lexer
|
||||
prettyprint.backend prettyprint.custom hashtables present
|
||||
peg.ebnf urls.encoding ;
|
||||
IN: urls
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: arrays accessors sequences sequences.private
|
||||
persistent.sequences assocs persistent.assocs kernel math
|
||||
vectors parser prettyprint.backend ;
|
||||
vectors parser prettyprint.custom ;
|
||||
IN: vlists
|
||||
|
||||
TUPLE: vlist
|
||||
|
|
|
@ -68,7 +68,6 @@ bootstrapping? on
|
|||
"alien.accessors"
|
||||
"arrays"
|
||||
"byte-arrays"
|
||||
"byte-vectors"
|
||||
"classes.private"
|
||||
"classes.tuple"
|
||||
"classes.tuple.private"
|
||||
|
|
|
@ -16,7 +16,6 @@ IN: bootstrap.syntax
|
|||
"<PRIVATE"
|
||||
"BIN:"
|
||||
"B{"
|
||||
"BV{"
|
||||
"C:"
|
||||
"CHAR:"
|
||||
"DEFER:"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (c) 2008 Slava Pestov
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: sequences math.parser io io.streams.byte-array
|
||||
io.encodings.binary io.files kernel ;
|
||||
USING: sequences math.parser io io.encodings.binary io.files
|
||||
kernel ;
|
||||
IN: checksums
|
||||
|
||||
MIXIN: checksum
|
||||
|
@ -12,9 +12,6 @@ GENERIC: checksum-stream ( stream checksum -- value )
|
|||
|
||||
GENERIC: checksum-lines ( lines checksum -- value )
|
||||
|
||||
M: checksum checksum-bytes
|
||||
[ binary <byte-reader> ] dip checksum-stream ;
|
||||
|
||||
M: checksum checksum-stream
|
||||
[ contents ] dip checksum-bytes ;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ IN: classes.algebra
|
|||
|
||||
ARTICLE: "class-operations" "Class operations"
|
||||
"Set-theoretic operations on classes:"
|
||||
{ $subsection class= }
|
||||
{ $subsection class< }
|
||||
{ $subsection class<= }
|
||||
{ $subsection class-and }
|
||||
|
|
|
@ -14,7 +14,7 @@ $nl
|
|||
}
|
||||
"The underlying sequence must implement a generic word:"
|
||||
{ $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"
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
! Copyright (C) 2004, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors alien arrays byte-arrays byte-vectors
|
||||
definitions generic hashtables kernel math namespaces parser
|
||||
lexer sequences strings strings.parser sbufs vectors
|
||||
words quotations io assocs splitting classes.tuple
|
||||
generic.standard generic.math generic.parser classes io.files
|
||||
vocabs classes.parser classes.union
|
||||
classes.intersection classes.mixin classes.predicate
|
||||
classes.singleton classes.tuple.parser compiler.units
|
||||
combinators effects.parser slots ;
|
||||
USING: accessors alien arrays byte-arrays definitions generic
|
||||
hashtables kernel math namespaces parser lexer sequences strings
|
||||
strings.parser sbufs vectors words quotations io assocs
|
||||
splitting classes.tuple generic.standard generic.math
|
||||
generic.parser classes io.files vocabs classes.parser
|
||||
classes.union classes.intersection classes.mixin
|
||||
classes.predicate classes.singleton classes.tuple.parser
|
||||
compiler.units combinators effects.parser slots ;
|
||||
IN: bootstrap.syntax
|
||||
|
||||
! These words are defined as a top-level form, instead of with
|
||||
|
@ -81,7 +80,6 @@ IN: bootstrap.syntax
|
|||
"{" [ \ } [ >array ] parse-literal ] define-syntax
|
||||
"V{" [ \ } [ >vector ] parse-literal ] define-syntax
|
||||
"B{" [ \ } [ >byte-array ] parse-literal ] define-syntax
|
||||
"BV{" [ \ } [ >byte-vector ] parse-literal ] define-syntax
|
||||
"H{" [ \ } [ >hashtable ] parse-literal ] define-syntax
|
||||
"T{" [ parse-tuple-literal parsed ] define-syntax
|
||||
"W{" [ \ } [ first <wrapper> ] parse-literal ] define-syntax
|
||||
|
|
Loading…
Reference in New Issue