diff --git a/core/alien/c-types/c-types.factor b/core/alien/c-types/c-types.factor index 234e6ef65b..f35981ce77 100644 --- a/core/alien/c-types/c-types.factor +++ b/core/alien/c-types/c-types.factor @@ -29,7 +29,7 @@ TUPLE: no-c-type name ; dup string? [ (c-type) ] when ] when ; -GENERIC: c-type ( name -- type ) +GENERIC: c-type ( name -- type ) foldable : resolve-pointer-type ( name -- name ) c-types get at dup string? diff --git a/extra/automata/ui/deploy.factor b/extra/automata/ui/deploy.factor index eb261ed93f..1aa5a2883a 100644 --- a/extra/automata/ui/deploy.factor +++ b/extra/automata/ui/deploy.factor @@ -1,16 +1,12 @@ USING: tools.deploy.config ; V{ - { strip-prettyprint? t } - { strip-globals? t } - { strip-word-props? t } - { strip-word-names? t } - { strip-dictionary? t } - { strip-debugger? t } - { strip-c-types? t } - { deploy-math? t } - { deploy-compiled? t } - { deploy-io? f } { deploy-ui? t } + { deploy-io 1 } + { deploy-reflection 1 } + { deploy-compiler? t } + { deploy-math? t } + { deploy-word-props? f } + { deploy-c-types? f } { "stop-after-last-window?" t } { "bundle-name" "Cellular Automata.app" } } diff --git a/extra/boids/ui/deploy.factor b/extra/boids/ui/deploy.factor index 0b22fa5200..e272a277e4 100644 --- a/extra/boids/ui/deploy.factor +++ b/extra/boids/ui/deploy.factor @@ -1,13 +1,12 @@ USING: tools.deploy.config ; V{ - { strip-word-props? t } - { strip-word-names? t } - { strip-dictionary? t } - { strip-debugger? t } - { strip-c-types? t } - { deploy-math? t } - { deploy-compiled? t } - { deploy-io? f } { deploy-ui? t } + { deploy-io 1 } + { deploy-reflection 1 } + { deploy-compiler? t } + { deploy-math? t } + { deploy-word-props? f } + { deploy-c-types? f } + { "stop-after-last-window?" t } { "bundle-name" "Boids.app" } } diff --git a/extra/bunny/deploy.factor b/extra/bunny/deploy.factor index 889bae3d12..d2c84582a5 100644 --- a/extra/bunny/deploy.factor +++ b/extra/bunny/deploy.factor @@ -1,12 +1,12 @@ USING: tools.deploy.config ; V{ - { strip-word-props? t } - { strip-word-names? t } - { strip-dictionary? t } - { strip-debugger? t } - { deploy-math? t } - { deploy-compiled? t } - { deploy-io? t } { deploy-ui? t } + { deploy-io 3 } + { deploy-reflection 1 } + { deploy-compiler? t } + { deploy-math? t } + { deploy-word-props? f } + { deploy-c-types? f } + { "stop-after-last-window?" t } { "bundle-name" "Bunny.app" } } diff --git a/extra/catalyst-talk/deploy.factor b/extra/catalyst-talk/deploy.factor new file mode 100644 index 0000000000..506270fa55 --- /dev/null +++ b/extra/catalyst-talk/deploy.factor @@ -0,0 +1,12 @@ +USING: tools.deploy.config ; +V{ + { deploy-ui? t } + { deploy-io 1 } + { deploy-reflection 1 } + { deploy-compiler? t } + { deploy-math? t } + { deploy-word-props? f } + { deploy-c-types? f } + { "stop-after-last-window?" t } + { "bundle-name" "catalyst-talk.app" } +} diff --git a/extra/color-picker/deploy.factor b/extra/color-picker/deploy.factor index ebce45177b..d16b74d076 100644 --- a/extra/color-picker/deploy.factor +++ b/extra/color-picker/deploy.factor @@ -1,12 +1,12 @@ USING: tools.deploy.config ; V{ - { strip-word-props? t } - { strip-word-names? t } - { strip-dictionary? t } - { strip-debugger? t } - { deploy-math? t } - { deploy-compiled? t } - { deploy-io? f } { deploy-ui? t } - { "bundle-name" "Color Picker.app" } + { deploy-io 1 } + { deploy-reflection 1 } + { deploy-compiler? t } + { deploy-math? t } + { deploy-word-props? f } + { deploy-c-types? f } + { "stop-after-last-window?" t } + { "bundle-name" "color-picker.app" } } diff --git a/extra/gesture-logger/deploy.factor b/extra/gesture-logger/deploy.factor index 5e412987f0..782b996895 100644 --- a/extra/gesture-logger/deploy.factor +++ b/extra/gesture-logger/deploy.factor @@ -1,13 +1,12 @@ USING: tools.deploy.config ; V{ - { strip-word-props? t } - { strip-word-names? f } - { strip-dictionary? t } - { strip-debugger? t } - { deploy-math? t } - { deploy-compiled? t } - { deploy-io? f } { deploy-ui? t } - { strip-prettyprint? f } + { deploy-io 1 } + { deploy-reflection 3 } + { deploy-compiler? t } + { deploy-math? t } + { deploy-word-props? f } + { deploy-c-types? f } + { "stop-after-last-window?" t } { "bundle-name" "Gesture Logger.app" } } diff --git a/extra/golden-section/deploy.factor b/extra/golden-section/deploy.factor index 3923d258f0..a41d1b33c6 100644 --- a/extra/golden-section/deploy.factor +++ b/extra/golden-section/deploy.factor @@ -1,17 +1,12 @@ USING: tools.deploy.config ; V{ - { strip-io? t } - { strip-prettyprint? t } - { strip-globals? t } - { strip-word-props? t } - { strip-word-names? t } - { strip-dictionary? t } - { strip-debugger? t } - { strip-c-types? t } - { deploy-math? t } - { deploy-compiled? t } - { deploy-io? f } { deploy-ui? t } + { deploy-io 1 } + { deploy-reflection 1 } + { deploy-compiler? t } + { deploy-math? t } + { deploy-word-props? f } + { deploy-c-types? f } { "stop-after-last-window?" t } { "bundle-name" "Golden Section.app" } } diff --git a/extra/hello-ui/deploy.factor b/extra/hello-ui/deploy.factor index 2f346e94c6..bb819f5ce2 100644 --- a/extra/hello-ui/deploy.factor +++ b/extra/hello-ui/deploy.factor @@ -1,16 +1,12 @@ USING: tools.deploy.config ; V{ - { strip-prettyprint? t } - { strip-globals? t } - { strip-word-props? t } - { strip-word-names? f } - { strip-dictionary? t } - { strip-debugger? t } - { strip-c-types? t } - { deploy-math? t } - { deploy-compiled? t } - { deploy-io? f } { deploy-ui? t } + { deploy-io 1 } + { deploy-reflection 2 } + { deploy-compiler? t } + { deploy-math? t } + { deploy-word-props? f } + { deploy-c-types? f } { "stop-after-last-window?" t } - { "bundle-name" "Hello World.app" } + { "bundle-name" "Hello world.app" } } diff --git a/extra/hello-world/deploy.factor b/extra/hello-world/deploy.factor index 145f7ecea7..7af1913d93 100644 --- a/extra/hello-world/deploy.factor +++ b/extra/hello-world/deploy.factor @@ -1,15 +1,12 @@ USING: tools.deploy.config ; V{ - { strip-prettyprint? t } - { strip-globals? t } - { strip-word-props? t } - { strip-word-names? t } - { strip-dictionary? t } - { strip-debugger? t } - { strip-c-types? t } - { deploy-math? f } - { deploy-compiled? f } - { deploy-io? f } { deploy-ui? f } + { deploy-io 3 } + { deploy-reflection 1 } + { deploy-compiler? t } + { deploy-math? f } + { deploy-word-props? f } + { deploy-c-types? f } { "stop-after-last-window?" t } + { "bundle-name" "Hello world (console).app" } } diff --git a/extra/icfp/2006/2006.factor b/extra/icfp/2006/2006.factor index 2b42cddc6a..90ac9dc03e 100644 --- a/extra/icfp/2006/2006.factor +++ b/extra/icfp/2006/2006.factor @@ -4,7 +4,7 @@ USING: kernel math sequences kernel.private namespaces arrays io io.files splitting io.binary math.functions vectors quotations combinators.private ; -IN: universal-machine +IN: icfp.2006 SYMBOL: regs SYMBOL: arrays diff --git a/extra/lint/tags.txt b/extra/lint/tags.txt deleted file mode 100644 index 90cd671f56..0000000000 --- a/extra/lint/tags.txt +++ /dev/null @@ -1 +0,0 @@ -lint refactor diff --git a/extra/lsys/summary.txt b/extra/lsys/summary.txt index bce1465e98..2615e85329 100644 --- a/extra/lsys/summary.txt +++ b/extra/lsys/summary.txt @@ -1 +1 @@ -L-system explorer +Lindenmayer system explorer diff --git a/extra/lsys/ui/deploy.factor b/extra/lsys/ui/deploy.factor index 22b6d0e4a3..de5076cac0 100644 --- a/extra/lsys/ui/deploy.factor +++ b/extra/lsys/ui/deploy.factor @@ -1,13 +1,13 @@ -USING: tools.deploy ; +USING: tools.deploy.config ; V{ - { strip-word-props? t } - { strip-word-names? t } - { strip-dictionary? t } - { strip-debugger? t } - { strip-c-types? t } - { deploy-math? t } - { deploy-compiled? t } - { deploy-io? f } { deploy-ui? t } - { "bundle-name" "Lindenmayer Systems.app" } + { deploy-io 1 } + { deploy-reflection 2 } + { deploy-compiler? t } + { deploy-math? t } + { deploy-word-props? t } + { deploy-word-defs? t } + { deploy-c-types? f } + { "stop-after-last-window?" t } + { "bundle-name" "Lindenmayer System Explorer.app" } } diff --git a/extra/math/quadratic/quadratic.factor b/extra/math/quadratic/quadratic.factor index 979e20599b..2253582623 100644 --- a/extra/math/quadratic/quadratic.factor +++ b/extra/math/quadratic/quadratic.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel math math.functions ; -IN: quadratic +IN: math.quadratic : monic ( c b a -- c' b' ) tuck / >r / r> ; diff --git a/extra/maze/deploy.factor b/extra/maze/deploy.factor index 31818c30c3..123412f4a3 100644 --- a/extra/maze/deploy.factor +++ b/extra/maze/deploy.factor @@ -1,13 +1,12 @@ USING: tools.deploy.config ; V{ - { strip-word-props? t } - { strip-word-names? f } - { strip-dictionary? t } - { strip-debugger? t } - { strip-c-types? t } - { deploy-math? t } - { deploy-compiled? t } - { deploy-io? f } { deploy-ui? t } + { deploy-io 1 } + { deploy-reflection 1 } + { deploy-compiler? t } + { deploy-math? t } + { deploy-word-props? f } + { deploy-c-types? f } + { "stop-after-last-window?" t } { "bundle-name" "Maze.app" } } diff --git a/extra/nehe/deploy.factor b/extra/nehe/deploy.factor index b464d735ce..cbd31d67b1 100644 --- a/extra/nehe/deploy.factor +++ b/extra/nehe/deploy.factor @@ -1,13 +1,12 @@ USING: tools.deploy.config ; V{ - { strip-word-props? t } - { strip-word-names? t } - { strip-dictionary? t } - { strip-debugger? t } - { strip-c-types? t } - { deploy-math? t } - { deploy-compiled? t } - { deploy-io? f } { deploy-ui? t } - { "bundle-name" "NeHe Demos.app" } + { deploy-io 1 } + { deploy-reflection 1 } + { deploy-compiler? t } + { deploy-math? t } + { deploy-word-props? f } + { deploy-c-types? f } + { "stop-after-last-window?" t } + { "bundle-name" "NeHe OpenGL demos.app" } } diff --git a/extra/tetris/deploy.factor b/extra/tetris/deploy.factor index 61fd0a545c..c00b7041db 100644 --- a/extra/tetris/deploy.factor +++ b/extra/tetris/deploy.factor @@ -1,13 +1,12 @@ USING: tools.deploy.config ; V{ - { strip-word-props? t } - { strip-word-names? t } - { strip-dictionary? t } - { strip-debugger? t } - { strip-c-types? t } - { deploy-math? t } - { deploy-compiled? t } - { deploy-io? f } { deploy-ui? t } + { deploy-io 1 } + { deploy-reflection 1 } + { deploy-compiler? t } + { deploy-math? t } + { deploy-word-props? f } + { deploy-c-types? f } + { "stop-after-last-window?" t } { "bundle-name" "Tetris.app" } } diff --git a/extra/tools/deploy/config/config-docs.factor b/extra/tools/deploy/config/config-docs.factor index 1528fe0015..31f4883cf8 100644 --- a/extra/tools/deploy/config/config-docs.factor +++ b/extra/tools/deploy/config/config-docs.factor @@ -9,10 +9,11 @@ ARTICLE: "deploy-config" "Deployment configuration" { $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 } ; +{ $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 types of 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-compiler? } { $subsection deploy-ui? } @@ -34,10 +35,26 @@ HELP: deploy-word-props? $nl "Off by default. Enable this if the heuristics strip out required word properties." } ; -HELP: deploy-c-types? -{ $description "Deploy flag. If set, the deploy tool retains the " { $link c-types } " table." +HELP: deploy-word-defs? +{ $description "Deploy flag. If set, the deploy tool retains word definition quotations for words compiled with the optimizing compiler. Otherwise, word definitions are stripped from words compiled with the optimizing compiler." $nl -"Off by default. Disable this if your program calls " { $link c-type } ", " { $link heap-size } ", " { $link } ", " { $link } ", " { $link malloc-object } ", or " { $link malloc-array } " with a C type name which is not a literal pushed directly at the call site. In this situation, the compiler is unable to fold away the C type lookup, and thus must use the global table at runtime." } ; +"Off by default. During normal execution, the word definition quotation of a word compiled with the optimizing compiler is not used, so disabling this flag can save space. However, some libraries introspect word definitions dynamically (for example, " { $link "inverse" } ") and so programs using these libraries must retain word definition quotations." } ; + +HELP: deploy-c-types? +{ $description "Deploy flag. If set, the deploy tool retains the " { $link c-types } " table, otherwise this table is stripped out, saving space." +$nl +"Off by default." +$nl +"The optimizing compiler is able to fold away calls to various words which take a C type as an input if the C type is a literal string:" +{ $list + { $link c-type } + { $link heap-size } + { $link } + { $link } + { $link malloc-object } + { $link malloc-array } +} +"If your program looks up C types dynamically or from words which do not have a stack effect, you must enable this flag, because in these situations the C type lookup is not folded away and the global table must be consulted at runtime." } ; HELP: deploy-math? { $description "Deploy flag. If set, the deployed image will contain support for " { $link ratio } " and " { $link complex } " types." @@ -45,7 +62,7 @@ $nl "On by default. Often the programmer will use rationals without realizing it. A small amount of space can be saved by stripping these features out, but some code may require changes to work properly." } ; HELP: deploy-compiler? -{ $description "Deploy flag. If set, words in the deployed image will be compiled when possible." +{ $description "Deploy flag. If set, words in the deployed image will be compiled with the optimizing compiler when possible." $nl "On by default. Most programs should be compiled, not only for performance but because features which depend on the C library interface only function after compilation." } ; @@ -55,10 +72,27 @@ $nl "Off by default. Programs wishing to use the UI must be deployed with this flag on." } ; HELP: deploy-io -{ $description "The level of I/O support required by the deployed image." } ; +{ $description "The level of I/O support required by the deployed image:" + { $table + { "Value" "Description" } + { "1" "No input/output" } + { "2" "Basic ANSI C streams" } + { "3" "Non-blocking streams and networking" } + } +"The default value is 1, basic ANSI C streams. This enables basic console and file I/O, however more advanced features such are not available." } ; HELP: deploy-reflection -{ $description "The level of reflection support required by the deployed image." } ; +{ $description "The level of reflection support required by the deployed image." + { $table + { "Value" "Description" } + { "1" "No reflection" } + { "2" "Retain word names" } + { "3" "Prettyprinter" } + { "4" "Debugger" } + { "5" "Parser" } + { "6" "Full environment" } + } +"The defalut value is 1, no reflection. Programs which use the above features will need to be deployed with a higher level of reflection support." } ; HELP: default-config { $values { "assoc" assoc } } diff --git a/extra/tools/deploy/config/config.factor b/extra/tools/deploy/config/config.factor index da3daa91f1..694eb36e0b 100644 --- a/extra/tools/deploy/config/config.factor +++ b/extra/tools/deploy/config/config.factor @@ -40,6 +40,7 @@ SYMBOL: deploy-reflection : strip-globals? deploy-reflection get 6 < ; SYMBOL: deploy-word-props? +SYMBOL: deploy-word-defs? SYMBOL: deploy-c-types? SYMBOL: deploy-vm @@ -53,6 +54,7 @@ SYMBOL: deploy-image { deploy-compiler? t } { deploy-math? t } { deploy-word-props? f } + { deploy-word-defs? f } { deploy-c-types? f } ! default value for deploy.app { "stop-after-last-window?" t } diff --git a/extra/tools/deploy/shaker/shaker.factor b/extra/tools/deploy/shaker/shaker.factor index 4b20c3f0ee..52e1486199 100644 --- a/extra/tools/deploy/shaker/shaker.factor +++ b/extra/tools/deploy/shaker/shaker.factor @@ -16,6 +16,7 @@ IN: tools.deploy.shaker : strip-init-hooks ( -- ) "Stripping startup hooks" show "command-line" init-hooks get delete-at + "mallocs" init-hooks get delete-at strip-io? [ "io.backend" init-hooks get delete-at ] when ; : strip-debugger ( -- ) @@ -75,9 +76,10 @@ IN: tools.deploy.shaker : strip-words ( props -- ) [ word? ] instances - deploy-word-props? get [ nip ] [ tuck strip-word-props ] if + deploy-word-props? get [ 2dup strip-word-props ] unless + deploy-word-defs? get [ dup strip-word-defs ] unless strip-word-names? [ dup strip-word-names ] when - strip-word-defs ; + 2drop ; : strip-environment ( retain-globals -- ) strip-globals? [ diff --git a/extra/tools/deploy/shaker/strip-libc.factor b/extra/tools/deploy/shaker/strip-libc.factor index f62b4b5935..898399b092 100644 --- a/extra/tools/deploy/shaker/strip-libc.factor +++ b/extra/tools/deploy/shaker/strip-libc.factor @@ -6,3 +6,5 @@ IN: libc : free (free) ; : realloc (realloc) ; + +: calloc (calloc) ; diff --git a/extra/ui/gadgets/canvas/canvas.factor b/extra/ui/gadgets/canvas/canvas.factor index 5a013113b8..a1fb95cdbf 100644 --- a/extra/ui/gadgets/canvas/canvas.factor +++ b/extra/ui/gadgets/canvas/canvas.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: ui.backend ui.gadgets ui.gadgets.theme ui.gadgets.worlds -ui.render opengl opengl.gl kernel namespaces tuples colors ; +USING: ui.backend ui.gadgets ui.gadgets.theme ui.gadgets.lib +ui.gadgets.worlds ui.render opengl opengl.gl kernel namespaces +tuples colors ; IN: ui.gadgets.canvas TUPLE: canvas dlist ; @@ -10,9 +11,6 @@ TUPLE: canvas dlist ; canvas construct-gadget dup black solid-interior ; -: find-gl-context ( gadget -- ) - find-world world-handle select-gl-context ; - : delete-canvas-dlist ( canvas -- ) dup find-gl-context dup canvas-dlist [ delete-dlist ] when* diff --git a/extra/ui/tools/deploy/deploy.factor b/extra/ui/tools/deploy/deploy.factor index 5a1851d1b3..297d9e0614 100644 --- a/extra/ui/tools/deploy/deploy.factor +++ b/extra/ui/tools/deploy/deploy.factor @@ -35,6 +35,7 @@ TUPLE: deploy-gadget vocab settings ; deploy-compiler? get "Use optimizing compiler" gadget, deploy-math? get "Rational and complex number support" gadget, deploy-word-props? get "Include word properties" gadget, + deploy-word-defs? get "Include word definitions" gadget, deploy-c-types? get "Include C types" gadget, ; : deploy-settings-theme