Merge branch 'master' of git://factorcode.org/git/factor
commit
2e95f58ee1
|
@ -2,10 +2,10 @@ USING: help.markup help.syntax parser vocabs.loader strings ;
|
|||
IN: command-line
|
||||
|
||||
HELP: run-bootstrap-init
|
||||
{ $description "Runs the " { $snippet ".factor-boot-rc" } " file in the user's home directory unless the " { $snippet "-no-user-init" } " command line switch was given." } ;
|
||||
{ $description "Runs the bootstrap initialization file in the user's home directory, unless the " { $snippet "-no-user-init" } " command line switch was given. This file is named " { $snippet ".factor-boot-rc" } " on Unix and " { $snippet "factor-boot-rc" } " on Windows." } ;
|
||||
|
||||
HELP: run-user-init
|
||||
{ $description "Runs the " { $snippet ".factor-rc" } " file in the user's home directory unless the " { $snippet "-no-user-init" } " command line switch was given." } ;
|
||||
{ $description "Runs the startup initialization file in the user's home directory, unless the " { $snippet "-no-user-init" } " command line switch was given. This file is named " { $snippet ".factor-rc" } " on Unix and " { $snippet "factor-rc" } " on Windows." } ;
|
||||
|
||||
HELP: cli-param
|
||||
{ $values { "param" string } }
|
||||
|
@ -57,7 +57,7 @@ ARTICLE: "bootstrap-cli-args" "Command line switches for bootstrap"
|
|||
"A number of command line switches can be passed to a bootstrap image to modify the behavior of the resulting image:"
|
||||
{ $table
|
||||
{ { $snippet "-output-image=" { $emphasis "image" } } { "Save the result to " { $snippet "image" } ". The default is " { $snippet "factor.image" } "." } }
|
||||
{ { $snippet "-no-user-init" } { "Inhibits the running of the " { $snippet ".factor-boot-rc" } " file in the user's home directory." } }
|
||||
{ { $snippet "-no-user-init" } { "Inhibits the running of user initialization files on startup. See " { $link "rc-files" } "." } }
|
||||
{ { $snippet "-include=" { $emphasis "components..." } } "A list of components to include (see below)." }
|
||||
{ { $snippet "-exclude=" { $emphasis "components..." } } "A list of components to exclude." }
|
||||
{ { $snippet "-ui-backend=" { $emphasis "backend" } } { "One of " { $snippet "x11" } ", " { $snippet "windows" } ", or " { $snippet "cocoa" } ". The default is platform-specific." } }
|
||||
|
@ -74,9 +74,9 @@ ARTICLE: "bootstrap-cli-args" "Command line switches for bootstrap"
|
|||
"By default, all optional components are loaded. To load all optional components except for a given list, use the " { $snippet "-exclude=" } " switch; to only load specified optional components, use the " { $snippet "-include=" } "."
|
||||
$nl
|
||||
"For example, to build an image with the compiler but no other components, you could do:"
|
||||
{ $code "./factor -i=boot.ppc.image -include=compiler" }
|
||||
{ $code "./factor -i=boot.macosx-ppc.image -include=compiler" }
|
||||
"To build an image with everything except for the user interface and graphical tools,"
|
||||
{ $code "./factor -i=boot.ppc.image -exclude=\"ui ui.tools\"" }
|
||||
{ $code "./factor -i=boot.macosx-ppc.image -exclude=\"ui ui.tools\"" }
|
||||
"To generate a bootstrap image in the first place, see " { $link "bootstrap.image" } "." ;
|
||||
|
||||
ARTICLE: "standard-cli-args" "Command line switches for general usage"
|
||||
|
@ -84,17 +84,43 @@ ARTICLE: "standard-cli-args" "Command line switches for general usage"
|
|||
{ $table
|
||||
{ { $snippet "-e=" { $emphasis "code" } } { "This specifies a code snippet to evaluate. If you want Factor to exit immediately after, also specify " { $snippet "-run=none" } "." } }
|
||||
{ { $snippet "-run=" { $emphasis "vocab" } } { { $snippet { $emphasis "vocab" } } " is the name of a vocabulary with a " { $link POSTPONE: MAIN: } " hook to run on startup, for example " { $vocab-link "listener" } ", " { $vocab-link "ui" } " or " { $vocab-link "none" } "." } }
|
||||
{ { $snippet "-no-user-init" } { "Inhibits the running of the " { $snippet ".factor-rc" } " file in the user's home directory on startup." } }
|
||||
{ { $snippet "-no-user-init" } { "Inhibits the running of user initialization files on startup. See " { $link "rc-files" } "." } }
|
||||
{ { $snippet "-quiet" } { "If set, " { $link run-file } " and " { $link require } " will not print load messages." } }
|
||||
{ { $snippet "-script" } { "Equivalent to " { $snippet "-quiet -run=none" } "." $nl "On Unix systems, Factor can be used for scripting - just create an executable text file whose first line is:" { $code "#! /usr/local/bin/factor -script" } "The space after " { $snippet "#!" } " is necessary because of Factor syntax." } }
|
||||
} ;
|
||||
|
||||
ARTICLE: "rc-files" "Running code on startup"
|
||||
"Unless the " { $snippet "-no-user-init" } " command line switch is specified, The startup routine runs the " { $snippet ".factor-rc" } " file in the user's home directory, if it exists. This file can contain initialization and customization for your development environment."
|
||||
ARTICLE: "factor-boot-rc" "Bootstrap initialization file"
|
||||
"The botstrap initialization file is named " { $snippet "factor-boot-rc" } " on Windows and " { $snippet ".factor-boot-rc" } " on Unix. This file can contain " { $link require } " calls for vocabularies you use frequently, and other such long-running tasks that you do not want to perform every time Factor starts."
|
||||
$nl
|
||||
"The " { $snippet ".factor-rc" } " and " { $snippet ".factor-boot-rc" } " files can be run explicitly:"
|
||||
{ $subsection run-user-init }
|
||||
{ $subsection run-bootstrap-init } ;
|
||||
"A word to run this file from an existing Factor session:"
|
||||
{ $subsection run-bootstrap-init }
|
||||
"For example, if you changed " { $snippet ".factor-boot-rc" } " and do not want to bootstrap again, you can just invoke " { $link run-bootstrap-init } " in the listener." ;
|
||||
|
||||
ARTICLE: "factor-rc" "Startup initialization file"
|
||||
"The startup initialization file is named " { $snippet "factor-rc" } " on Windows and " { $snippet ".factor-rc" } " on Unix. If it exists, it is run every time Factor starts."
|
||||
$nl
|
||||
"A word to run this file from an existing Factor session:"
|
||||
{ $subsection run-user-init } ;
|
||||
|
||||
ARTICLE: "rc-files" "Running code on startup"
|
||||
"Factor looks for two files in your home directory."
|
||||
{ $subsection "factor-boot-rc" }
|
||||
{ $subsection "factor-rc" }
|
||||
"The " { $snippet "-no-user-init" } " command line switch will inhibit the running of these files."
|
||||
$nl
|
||||
"If you are unsure where the files should be located, evaluate the following code:"
|
||||
{ $code
|
||||
"USE: command-line"
|
||||
"\"factor-rc\" rc-path print"
|
||||
"\"factor-boot-rc\" rc-path print"
|
||||
}
|
||||
"Here is an example " { $snippet ".factor-boot-rc" } " which sets up GVIM editor integration, adds an additional vocabulary root (see " { $link "vocabs.roots" } "), and increases the font size in the UI by setting the DPI (dots-per-inch) variable:"
|
||||
{ $code
|
||||
"USING: editors.gvim vocabs.loader ui.freetype namespaces sequences ;"
|
||||
"\"/opt/local/bin\" \\ gvim-path set-global"
|
||||
"\"/home/jane/src/\" vocab-roots get push"
|
||||
"100 dpi set-global"
|
||||
} ;
|
||||
|
||||
ARTICLE: "cli" "Command line usage"
|
||||
"Zero or more command line arguments may be passed to the Factor runtime. Command line arguments starting with a dash (" { $snippet "-" } ") is interpreted as switches. All other arguments are taken to be file names to be run by " { $link run-file } "."
|
||||
|
|
|
@ -5,14 +5,18 @@ kernel.private namespaces parser sequences strings system
|
|||
splitting io.files eval ;
|
||||
IN: command-line
|
||||
|
||||
: rc-path ( name -- path )
|
||||
os windows? [ "." prepend ] unless
|
||||
home prepend-path ;
|
||||
|
||||
: run-bootstrap-init ( -- )
|
||||
"user-init" get [
|
||||
home ".factor-boot-rc" append-path ?run-file
|
||||
"factor-boot-rc" rc-path ?run-file
|
||||
] when ;
|
||||
|
||||
: run-user-init ( -- )
|
||||
"user-init" get [
|
||||
home ".factor-rc" append-path ?run-file
|
||||
"factor-rc" rc-path ?run-file
|
||||
] when ;
|
||||
|
||||
: cli-var-param ( name value -- ) swap set-global ;
|
||||
|
|
|
@ -34,14 +34,10 @@ IN: compiler.tree.builder
|
|||
if ;
|
||||
|
||||
: (build-tree-from-word) ( word -- )
|
||||
dup
|
||||
[ "inline" word-prop ]
|
||||
[ "recursive" word-prop ] bi and [
|
||||
1quotation f initial-recursive-state infer-quot
|
||||
] [
|
||||
[ specialized-def ] [ initial-recursive-state ] bi
|
||||
infer-quot
|
||||
] if ;
|
||||
dup initial-recursive-state recursive-state set
|
||||
dup [ "inline" word-prop ] [ "recursive" word-prop ] bi and
|
||||
[ 1quotation ] [ specialized-def ] if
|
||||
infer-quot-here ;
|
||||
|
||||
: check-cannot-infer ( word -- )
|
||||
dup "cannot-infer" word-prop [ cannot-infer-effect ] [ drop ] if ;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
USING: definitions io.launcher kernel parser words sequences math
|
||||
math.parser namespaces editors make ;
|
||||
math.parser namespaces editors make system ;
|
||||
IN: editors.emacs
|
||||
|
||||
: emacsclient ( file line -- )
|
||||
[
|
||||
\ emacsclient get "emacsclient" or ,
|
||||
"--no-wait" ,
|
||||
os windows? [ "--no-wait" , ] unless
|
||||
"+" swap number>string append ,
|
||||
,
|
||||
] { } make try-process ;
|
||||
|
|
|
@ -24,7 +24,7 @@ M: inference-error error-help error>> error-help ;
|
|||
+warning+ (inference-error) ; inline
|
||||
|
||||
M: inference-error error.
|
||||
[ "In word: " write word>> . ] [ error>> error. ] bi ;
|
||||
[ word>> [ "In word: " write . ] when* ] [ error>> error. ] bi ;
|
||||
|
||||
TUPLE: literal-expected ;
|
||||
|
||||
|
|
|
@ -4,9 +4,7 @@ USING: accessors arrays sequences kernel sequences assocs
|
|||
namespaces stack-checker.recursive-state.tree ;
|
||||
IN: stack-checker.recursive-state
|
||||
|
||||
TUPLE: recursive-state words word quotations inline-words ;
|
||||
|
||||
C: <recursive-state> recursive-state
|
||||
TUPLE: recursive-state word words quotations inline-words ;
|
||||
|
||||
: prepare-recursive-state ( word rstate -- rstate )
|
||||
swap >>word
|
||||
|
|
|
@ -11,7 +11,7 @@ ARTICLE: "vocabs.roots" "Vocabulary roots"
|
|||
{ { $snippet "extra" } " - additional contributed libraries." }
|
||||
{ { $snippet "work" } " - a root for vocabularies which are not intended to be contributed back to Factor." }
|
||||
}
|
||||
"Your own vocabularies should go into " { $snippet "extra" } " or " { $snippet "work" } ", depending on whether or not you intend to contribute them back to the Factor project. If you wish to work on vocabularies outside of the Factor source directory, create a " { $snippet "~/.factor-rc" } " file like the following,"
|
||||
"Your own vocabularies should go into " { $snippet "extra" } " or " { $snippet "work" } ", depending on whether or not you intend to contribute them back to the Factor project. If you wish to work on vocabularies outside of the Factor source directory, create a " { $link "factor-boot-rc" } " file like the following:"
|
||||
{ $code
|
||||
"USING: namespaces sequences vocabs.loader ;"
|
||||
"\"/home/jane/sources/\" vocab-roots get push"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
! Unit tests for vocabs.loader vocabulary
|
||||
IN: vocabs.loader.tests
|
||||
USING: vocabs.loader tools.test continuations vocabs math
|
||||
kernel arrays sequences namespaces io.streams.string
|
||||
parser source-files words assocs classes.tuple definitions
|
||||
debugger compiler.units tools.vocabs accessors eval ;
|
||||
debugger compiler.units tools.vocabs accessors eval
|
||||
combinators ;
|
||||
|
||||
! This vocab should not exist, but just in case...
|
||||
[ ] [
|
||||
|
@ -151,3 +151,8 @@ forget-junk
|
|||
[ "xabbabbja" forget-vocab ] with-compilation-unit
|
||||
|
||||
forget-junk
|
||||
|
||||
[ ] [ [ "vocabs.loader.test.e" forget-vocab ] with-compilation-unit ] unit-test
|
||||
|
||||
[ "vocabs.loader.test.e" require ]
|
||||
[ relative-overflow? ] must-fail-with
|
||||
|
|
|
@ -55,7 +55,7 @@ SYMBOL: load-help?
|
|||
f over set-vocab-source-loaded?
|
||||
[ vocab-source-path [ parse-file ] [ [ ] ] if* ] keep
|
||||
t swap set-vocab-source-loaded?
|
||||
[ % ] [ call ] if-bootstrapping ;
|
||||
[ % ] [ assert-depth ] if-bootstrapping ;
|
||||
|
||||
: load-docs ( vocab -- vocab )
|
||||
load-help? get [
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
1 2 3
|
|
@ -0,0 +1 @@
|
|||
unportable
|
|
@ -13,19 +13,19 @@ VAR: rule VAR: rule-number
|
|||
: init-rule ( -- ) 8 <hashtable> >rule ;
|
||||
|
||||
: rule-keys ( -- array )
|
||||
{ { 1 1 1 }
|
||||
{ 1 1 0 }
|
||||
{ 1 0 1 }
|
||||
{ 1 0 0 }
|
||||
{ 0 1 1 }
|
||||
{ 0 1 0 }
|
||||
{ 0 0 1 }
|
||||
{ 0 0 0 } } ;
|
||||
{ { 1 1 1 }
|
||||
{ 1 1 0 }
|
||||
{ 1 0 1 }
|
||||
{ 1 0 0 }
|
||||
{ 0 1 1 }
|
||||
{ 0 1 0 }
|
||||
{ 0 0 1 }
|
||||
{ 0 0 0 } } ;
|
||||
|
||||
: rule-values ( n -- seq ) >bin 8 CHAR: 0 pad-left string>digits ;
|
||||
|
||||
: set-rule ( n -- )
|
||||
dup >rule-number rule-values rule-keys [ rule> set-at ] 2each ;
|
||||
dup >rule-number rule-values rule-keys [ rule> set-at ] 2each ;
|
||||
|
||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
! step-capped-line
|
||||
|
@ -37,7 +37,7 @@ dup >rule-number rule-values rule-keys [ rule> set-at ] 2each ;
|
|||
: cap-line ( line -- 0-line-0 ) { 0 } prepend { 0 } append ;
|
||||
|
||||
: wrap-line ( a-line-z -- za-line-za )
|
||||
dup peek 1array swap dup first 1array append append ;
|
||||
dup peek 1array swap dup first 1array append append ;
|
||||
|
||||
: step-line ( line -- new-line ) 3 <clumps> [ pattern>state ] map ;
|
||||
|
||||
|
@ -61,8 +61,8 @@ VARS: width height ;
|
|||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
: interesting ( -- seq )
|
||||
{ 18 22 26 30 41 45 54 60 73 75 82 86 89 90 97 101 102 105 106 107 109
|
||||
110 120 121 122 124 126 129 137 146 147 149 150 151 153 154 161 165 } ;
|
||||
{ 18 22 26 30 41 45 54 60 73 75 82 86 89 90 97 101 102 105 106 107 109
|
||||
110 120 121 122 124 126 129 137 146 147 149 150 151 153 154 161 165 } ;
|
||||
|
||||
: mild ( -- seq ) { 6 9 11 57 62 74 118 } ;
|
||||
|
||||
|
@ -75,7 +75,7 @@ VAR: bitmap
|
|||
VAR: last-line
|
||||
|
||||
: run-rule ( -- )
|
||||
last-line> height> [ drop step-capped-line dup ] map >bitmap >last-line ;
|
||||
last-line> height> [ drop step-capped-line dup ] map >bitmap >last-line ;
|
||||
|
||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
|
|
|
@ -39,10 +39,10 @@ VAR: slate
|
|||
! Call a 'model' quotation with the current 'view'.
|
||||
|
||||
: with-view ( quot -- )
|
||||
slate> rect-dim first >width
|
||||
slate> rect-dim second >height
|
||||
call
|
||||
slate> relayout-1 ;
|
||||
slate> rect-dim first >width
|
||||
slate> rect-dim second >height
|
||||
call
|
||||
slate> relayout-1 ;
|
||||
|
||||
! Create a quotation that is appropriate for buttons and gesture handler.
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ VAR: separation-radius
|
|||
: constrain ( n a b -- n ) rot min max ;
|
||||
|
||||
: angle-between ( vec vec -- angle )
|
||||
2dup v. -rot norm swap norm * / -1 1 constrain acos rad>deg ;
|
||||
2dup v. -rot norm swap norm * / -1 1 constrain acos rad>deg ;
|
||||
|
||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
USING: kernel namespaces math opengl.gl opengl.glu ui ui.gadgets.slate
|
||||
mortar random-weighted cfdg ;
|
||||
random-weighted cfdg ;
|
||||
|
||||
IN: cfdg.models.game1-turn6
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
USING: kernel namespaces math opengl.gl opengl.glu ui ui.gadgets.slate
|
||||
mortar random-weighted cfdg ;
|
||||
random-weighted cfdg ;
|
||||
|
||||
IN: cfdg.models.sierpinski
|
||||
|
||||
|
|
Loading…
Reference in New Issue