Merge branch 'master' of git://factorcode.org/git/factor

db4
Joe Groff 2009-10-17 00:14:14 -05:00
commit 0ce6b3a12a
12 changed files with 46 additions and 26 deletions

View File

@ -81,9 +81,13 @@ M: string resolve-pointer-type
dup void? [ no-c-type ] when
dup c-type-name? [ c-type ] when ;
<PRIVATE
: parse-array-type ( name -- dims c-type )
"[" split unclip
[ [ "]" ?tail drop parse-word ] map ] dip ;
[ [ "]" ?tail drop string>number ] map ] dip ;
PRIVATE>
M: string c-type ( name -- c-type )
CHAR: ] over member? [

View File

@ -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 ] }

View File

@ -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

View File

@ -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 ;
@ -180,6 +187,8 @@ IN: tools.deploy.shaker
"transform-n"
"transform-quot"
"type"
"typed-def"
"typed-word"
"writer"
"writing"
} %
@ -503,6 +512,7 @@ SYMBOL: deploy-vocab
strip-call
strip-cocoa
strip-debugger
strip-specialized-arrays
compute-next-methods
strip-init-hooks
add-command-line-hook

View File

@ -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 ;

View File

@ -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 ;

View File

@ -89,7 +89,7 @@ HELP: pathname
{ $class-description "Class of path name objects. Path name objects can be created by calling " { $link <pathname> } "." } ;
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 <file-reader> } " 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." }

View File

@ -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

View File

@ -35,12 +35,9 @@ PRIVATE>
dup dim>> second iota [ draw-vertex-buffer-row ] with each
] with-gl-buffer ;
USE: tools.time
: <grid-mesh> ( 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

View File

@ -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 } ;

View File

@ -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 }
}

View File

@ -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 ]