From 5328af8090fea446a3e4df44d9a3eeae55ebf569 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 16 Oct 2009 23:43:44 -0500 Subject: [PATCH 1/6] terrain: make it deploy --- extra/grid-meshes/grid-meshes.factor | 5 +---- extra/terrain/deploy.factor | 16 ++++++++-------- extra/terrain/generation/generation.factor | 6 +++--- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/extra/grid-meshes/grid-meshes.factor b/extra/grid-meshes/grid-meshes.factor index b63b3d791c..ebde0b2641 100644 --- a/extra/grid-meshes/grid-meshes.factor +++ b/extra/grid-meshes/grid-meshes.factor @@ -35,12 +35,9 @@ PRIVATE> dup dim>> second iota [ draw-vertex-buffer-row ] with each ] with-gl-buffer ; -USE: tools.time : ( dim -- grid-mesh ) - [ [ ] [ vertex-array >vertex-buffer ] [ first 1 + 2 * ] tri - grid-mesh boa - ] time ; + grid-mesh boa ; M: grid-mesh dispose [ [ delete-gl-buffer ] when* f ] change-buffer diff --git a/extra/terrain/deploy.factor b/extra/terrain/deploy.factor index b51873a5ad..c27e7b3c84 100644 --- a/extra/terrain/deploy.factor +++ b/extra/terrain/deploy.factor @@ -1,14 +1,14 @@ USING: tools.deploy.config ; H{ - { deploy-ui? t } - { deploy-reflection 1 } - { deploy-unicode? f } - { deploy-math? t } - { deploy-io 2 } - { deploy-c-types? f } { deploy-name "Terrain" } - { deploy-word-props? f } - { deploy-word-defs? f } + { deploy-ui? t } + { deploy-c-types? f } + { deploy-unicode? f } + { deploy-io 2 } + { deploy-reflection 2 } { "stop-after-last-window?" t } + { deploy-word-props? f } + { deploy-math? t } { deploy-threads? t } + { deploy-word-defs? f } } diff --git a/extra/terrain/generation/generation.factor b/extra/terrain/generation/generation.factor index e41d107871..86f532bada 100644 --- a/extra/terrain/generation/generation.factor +++ b/extra/terrain/generation/generation.factor @@ -1,13 +1,13 @@ USING: accessors alien.data.map arrays byte-arrays combinators combinators.smart fry grouping images kernel math math.matrices.simd math.order math.vectors noise random -sequences math.vectors.simd ; +sequences math.vectors.simd typed ; FROM: alien.c-types => float uchar ; SIMDS: float uchar ; IN: terrain.generation CONSTANT: terrain-segment-size { 512 512 } -CONSTANT: terrain-segment-size-vector { 512.0 512.0 1.0 1.0 } +CONSTANT: terrain-segment-size-vector float-4{ 512.0 512.0 1.0 1.0 } CONSTANT: terrain-big-noise-scale float-4{ 0.002 0.002 0.002 0.002 } CONSTANT: terrain-small-noise-scale float-4{ 0.05 0.05 0.05 0.05 } @@ -51,7 +51,7 @@ TUPLE: segment image ; ubyte-components >>component-type terrain-segment-size >>dim ; -: terrain-segment ( terrain at -- image ) +TYPED: terrain-segment ( terrain: terrain at: float-4 -- image ) { [ big-noise-segment ] [ small-noise-segment ] From 4ed91ff5ee21259edaaeb5bab99aa9a89d08341d Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 16 Oct 2009 23:45:10 -0500 Subject: [PATCH 2/6] syntax: fix docs for : --- basis/math/vectors/simd/functor/functor.factor | 2 +- core/syntax/syntax-docs.factor | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/basis/math/vectors/simd/functor/functor.factor b/basis/math/vectors/simd/functor/functor.factor index 2ddaf2b8a5..514c2f62aa 100644 --- a/basis/math/vectors/simd/functor/functor.factor +++ b/basis/math/vectors/simd/functor/functor.factor @@ -325,7 +325,7 @@ FUNCTOR: define-simd-256 ( T -- ) N [ 32 T c:heap-size /i ] -N/2 [ N 2 / ] +N/2 [ N 2 /i ] A/2 IS ${T}-${N/2} A/2-boa IS ${A/2}-boa A/2-with IS ${A/2}-with diff --git a/core/syntax/syntax-docs.factor b/core/syntax/syntax-docs.factor index df78083f30..2a8bf53e64 100644 --- a/core/syntax/syntax-docs.factor +++ b/core/syntax/syntax-docs.factor @@ -371,7 +371,7 @@ HELP: POSTPONE: HELP: : { $syntax ": word ( stack -- effect ) definition... ;" } { $values { "word" "a new word to define" } { "definition" "a word definition" } } -{ $description "Defines a word with the given stack effect in the current vocabulary. The stack effect is optional for words which only push literals on the stack." } +{ $description "Defines a word with the given stack effect in the current vocabulary." } { $examples { $code ": ask-name ( -- name )\n \"What is your name? \" write readln ;\n: greet ( name -- )\n \"Greetings, \" write print ;\n: friend ( -- )\n ask-name greet ;" } } ; { POSTPONE: : POSTPONE: ; define } related-words From 5afce2cc9e61d76134ce0328e215afb59930a0d5 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 16 Oct 2009 23:50:17 -0500 Subject: [PATCH 3/6] alien.c-types: c-type no longer calls parser at runtime, tools.deploy.shaker now strips out runtime specialized array code generation --- basis/alien/c-types/c-types.factor | 6 +++++- basis/alien/parser/parser.factor | 4 ++++ basis/tools/deploy/shaker/shaker.factor | 8 ++++++++ basis/tools/deploy/shaker/strip-specialized-arrays.factor | 5 +++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 basis/tools/deploy/shaker/strip-specialized-arrays.factor diff --git a/basis/alien/c-types/c-types.factor b/basis/alien/c-types/c-types.factor index 8196f46263..d622a42c9d 100755 --- a/basis/alien/c-types/c-types.factor +++ b/basis/alien/c-types/c-types.factor @@ -81,9 +81,13 @@ M: string resolve-pointer-type dup void? [ no-c-type ] when dup c-type-name? [ c-type ] when ; +number ] map ] dip ; + +PRIVATE> M: string c-type ( name -- c-type ) CHAR: ] over member? [ diff --git a/basis/alien/parser/parser.factor b/basis/alien/parser/parser.factor index cc0d774ccf..4b83739efe 100644 --- a/basis/alien/parser/parser.factor +++ b/basis/alien/parser/parser.factor @@ -10,6 +10,10 @@ IN: alien.parser : parse-c-type-name ( name -- word ) dup search [ ] [ no-word ] ?if ; +: parse-array-type ( name -- dims c-type ) + "[" split unclip + [ [ "]" ?tail drop parse-word ] map ] dip ; + : (parse-c-type) ( string -- type ) { { [ dup "void" = ] [ drop void ] } diff --git a/basis/tools/deploy/shaker/shaker.factor b/basis/tools/deploy/shaker/shaker.factor index 994073b149..d9b9a5dbd5 100755 --- a/basis/tools/deploy/shaker/shaker.factor +++ b/basis/tools/deploy/shaker/shaker.factor @@ -85,6 +85,13 @@ IN: tools.deploy.shaker run-file ] when ; +: strip-specialized-arrays ( -- ) + strip-dictionary? "specialized-arrays" vocab and [ + "Stripping specialized arrays" show + "vocab:tools/deploy/shaker/strip-specialized-arrays.factor" + run-file + ] when ; + : strip-word-names ( words -- ) "Stripping word names" show [ f >>name f >>vocabulary drop ] each ; @@ -503,6 +510,7 @@ SYMBOL: deploy-vocab strip-call strip-cocoa strip-debugger + strip-specialized-arrays compute-next-methods strip-init-hooks add-command-line-hook diff --git a/basis/tools/deploy/shaker/strip-specialized-arrays.factor b/basis/tools/deploy/shaker/strip-specialized-arrays.factor new file mode 100644 index 0000000000..195a3db976 --- /dev/null +++ b/basis/tools/deploy/shaker/strip-specialized-arrays.factor @@ -0,0 +1,5 @@ +IN: specialized-arrays + +ERROR: cannot-define-array-in-deployed-app type ; + +: define-array-vocab ( type -- ) cannot-define-array-in-deployed-app ; From 63ca8ee5cc72908a5c20f7a1da9dbb39293ea88e Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 16 Oct 2009 23:59:45 -0500 Subject: [PATCH 4/6] tools.deploy.shaker: strip out typed word props --- basis/tools/deploy/shaker/shaker.factor | 2 ++ 1 file changed, 2 insertions(+) diff --git a/basis/tools/deploy/shaker/shaker.factor b/basis/tools/deploy/shaker/shaker.factor index d9b9a5dbd5..0c703cae13 100755 --- a/basis/tools/deploy/shaker/shaker.factor +++ b/basis/tools/deploy/shaker/shaker.factor @@ -187,6 +187,8 @@ IN: tools.deploy.shaker "transform-n" "transform-quot" "type" + "typed-def" + "typed-word" "writer" "writing" } % From 26d8690ec25c3228dd9ec813e5f3c5753dafdb28 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 17 Oct 2009 00:09:01 -0500 Subject: [PATCH 5/6] fix cmwc on 32 bit factor --- extra/random/cmwc/cmwc.factor | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extra/random/cmwc/cmwc.factor b/extra/random/cmwc/cmwc.factor index 1be58d489f..941840f23a 100644 --- a/extra/random/cmwc/cmwc.factor +++ b/extra/random/cmwc/cmwc.factor @@ -9,11 +9,11 @@ IN: random.cmwc TUPLE: cmwc { Q uint-array } - { a fixnum } - { b fixnum } - { c fixnum } - { i fixnum } - { r fixnum } + { a integer } + { b integer } + { c integer } + { i integer } + { r integer } { mod fixnum } ; TUPLE: cmwc-seed { Q uint-array read-only } { c read-only } ; From 4e8a2a26381bb4621d4ec61aec607320307ed755 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 17 Oct 2009 00:09:57 -0500 Subject: [PATCH 6/6] io.backend/pathnames: fix help lint --- core/io/backend/backend.factor | 4 ++-- core/io/pathnames/pathnames-docs.factor | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/io/backend/backend.factor b/core/io/backend/backend.factor index 84d1f52b9c..494ccbff22 100644 --- a/core/io/backend/backend.factor +++ b/core/io/backend/backend.factor @@ -21,9 +21,9 @@ HOOK: init-stdio io-backend ( -- ) HOOK: io-multiplex io-backend ( us -- ) -HOOK: normalize-directory io-backend ( str -- newstr ) +HOOK: normalize-directory io-backend ( path -- path' ) -HOOK: normalize-path io-backend ( str -- newstr ) +HOOK: normalize-path io-backend ( path -- path' ) M: object normalize-directory normalize-path ; diff --git a/core/io/pathnames/pathnames-docs.factor b/core/io/pathnames/pathnames-docs.factor index 8b293da3cc..889f2262a8 100644 --- a/core/io/pathnames/pathnames-docs.factor +++ b/core/io/pathnames/pathnames-docs.factor @@ -89,7 +89,7 @@ HELP: pathname { $class-description "Class of path name objects. Path name objects can be created by calling " { $link } "." } ; HELP: normalize-path -{ $values { "string" "a pathname string" } { "string'" "a new pathname string" } } +{ $values { "path" "a pathname string" } { "path'" "a new pathname string" } } { $description "Prepends the " { $link current-directory } " to the pathname, resolves a " { $snippet "resource:" } " or " { $snippet "voacb:" } " prefix, if present, and performs any platform-specific pathname normalization." } { $notes "High-level words, such as " { $link } " and " { $link delete-file } " call this word for you. It only needs to be called directly when passing pathnames to C functions or external processes. This is because Factor does not use the operating system's notion of a current directory, and instead maintains its own dynamically-scoped " { $link current-directory } " variable." } { $notes "On Windows NT platforms, this word does prepends the Unicode path prefix." }