diff --git a/basis/json/reader/reader.factor b/basis/json/reader/reader.factor index 4171abca09..8eca1995a2 100644 --- a/basis/json/reader/reader.factor +++ b/basis/json/reader/reader.factor @@ -1,18 +1,13 @@ ! Copyright (C) 2008 Peter Burns, 2009 Philipp Winkler ! See http://factorcode.org/license.txt for BSD license. USING: arrays assocs combinators io io.streams.string json -kernel math math.floats.parser math.parser prettyprint sequences -strings vectors ; +kernel math math.parser prettyprint sequences strings vectors ; IN: json.reader float ] - [ [ "eE." index ] any? [ >integer ] unless ] bi - ] dip ; + [ append string>number ] dip ; DEFER: j-string diff --git a/basis/math/floats/parser/authors.txt b/basis/math/floats/parser/authors.txt deleted file mode 100644 index d4f5d6b3ae..0000000000 --- a/basis/math/floats/parser/authors.txt +++ /dev/null @@ -1 +0,0 @@ -Slava Pestov \ No newline at end of file diff --git a/basis/math/floats/parser/parser.factor b/basis/math/floats/parser/parser.factor deleted file mode 100644 index 2bff867056..0000000000 --- a/basis/math/floats/parser/parser.factor +++ /dev/null @@ -1,14 +0,0 @@ -! Copyright (C) 2010 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: alien.c-types alien.syntax ; -IN: math.floats.parser - - - -: string>float ( str -- n/f ) f strtod ; - diff --git a/extra/game/models/collada/collada.factor b/extra/game/models/collada/collada.factor index 953e420562..ef1c55049b 100644 --- a/extra/game/models/collada/collada.factor +++ b/extra/game/models/collada/collada.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2010 Erik Charlebois ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs grouping hashtables kernel locals -math math.floats.parser math.parser sequences sequences.deep +math math.parser sequences sequences.deep specialized-arrays.instances.alien.c-types.float specialized-arrays.instances.alien.c-types.uint splitting xml xml.data xml.traversal math.order namespaces combinators images @@ -23,7 +23,7 @@ SYMBOLS: up-axis unit-ratio ; " \t\n" split harvest [ string>number ] map ; : string>floats ( string -- float-seq ) - " \t\n" split harvest [ string>float ] map ; + " \t\n" split harvest [ string>number ] map ; : x/ ( tag child-name -- child-tag ) [ tag-named ] diff --git a/extra/game/models/obj/obj-docs.factor b/extra/game/models/obj/obj-docs.factor index adea0ef34b..ceb61dbb17 100644 --- a/extra/game/models/obj/obj-docs.factor +++ b/extra/game/models/obj/obj-docs.factor @@ -22,9 +22,9 @@ HELP: md { $values { "material-dictionary" assoc } } { $description "Convenience word for accessing the material dictionary while parsing primitives. " } ; -HELP: strings>floats -{ $values { "strings" sequence } { "floats" sequence } } -{ $description "Convert a sequence of strings to a sequence of floats." } ; +HELP: strings>numbers +{ $values { "strings" sequence } { "numbers" sequence } } +{ $description "Convert a sequence of strings to a sequence of numbers." } ; HELP: strings>faces { $values { "strings" sequence } { "faces" sequence } } diff --git a/extra/game/models/obj/obj.factor b/extra/game/models/obj/obj.factor index e331c415e5..9ac59444db 100644 --- a/extra/game/models/obj/obj.factor +++ b/extra/game/models/obj/obj.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2010 Erik Charlebois ! See http://factorcode.org/license.txt for BSD license. -USING: io io.encodings.ascii math.parser math.floats.parser -sequences splitting kernel assocs io.files combinators -math.order math namespaces arrays sequences.deep accessors +USING: io io.encodings.ascii math.parser sequences splitting +kernel assocs io.files combinators math.order math namespaces +arrays sequences.deep accessors specialized-arrays.instances.alien.c-types.float specialized-arrays.instances.alien.c-types.uint game.models game.models.util gpu.shaders images game.models.loader @@ -36,8 +36,8 @@ TUPLE: material : cm ( -- current-material ) current-material get ; inline : md ( -- material-dictionary ) material-dictionary get ; inline -: strings>floats ( strings -- floats ) - [ string>float ] map ; +: strings>numbers ( strings -- numbers ) + [ string>number ] map ; : strings>faces ( strings -- faces ) [ "/" split [ string>number ] map ] map ; @@ -54,22 +54,22 @@ TUPLE: material [ material new swap >>name current-material set ] [ cm swap md set-at ] bi ] } - { "Ka" [ 3 head [ string>float ] map cm (>>ambient-reflectivity) ] } - { "Kd" [ 3 head [ string>float ] map cm (>>diffuse-reflectivity) ] } - { "Ks" [ 3 head [ string>float ] map cm (>>specular-reflectivity) ] } - { "Tf" [ 3 head [ string>float ] map cm (>>transmission-filter) ] } - { "d" [ first string>float cm (>>dissolve) ] } - { "Ns" [ first string>float cm (>>specular-exponent) ] } - { "Ni" [ first string>float cm (>>refraction-index) ] } - { "map_Ka" [ first cm (>>ambient-map) ] } - { "map_Kd" [ first cm (>>diffuse-map) ] } - { "map_Ks" [ first cm (>>specular-map) ] } - { "map_Ns" [ first cm (>>specular-exponent-map) ] } - { "map_d" [ first cm (>>dissolve-map) ] } - { "map_bump" [ first cm (>>bump-map) ] } - { "bump" [ first cm (>>bump-map) ] } - { "disp" [ first cm (>>displacement-map) ] } - { "refl" [ first cm (>>reflection-map) ] } + { "Ka" [ 3 head strings>numbers cm (>>ambient-reflectivity) ] } + { "Kd" [ 3 head strings>numbers cm (>>diffuse-reflectivity) ] } + { "Ks" [ 3 head strings>numbers cm (>>specular-reflectivity) ] } + { "Tf" [ 3 head strings>numbers cm (>>transmission-filter) ] } + { "d" [ first string>number cm (>>dissolve) ] } + { "Ns" [ first string>number cm (>>specular-exponent) ] } + { "Ni" [ first string>number cm (>>refraction-index) ] } + { "map_Ka" [ first cm (>>ambient-map) ] } + { "map_Kd" [ first cm (>>diffuse-map) ] } + { "map_Ks" [ first cm (>>specular-map) ] } + { "map_Ns" [ first cm (>>specular-exponent-map) ] } + { "map_d" [ first cm (>>dissolve-map) ] } + { "map_bump" [ first cm (>>bump-map) ] } + { "bump" [ first cm (>>bump-map) ] } + { "disp" [ first cm (>>displacement-map) ] } + { "refl" [ first cm (>>reflection-map) ] } [ 2drop ] } case ] unless-empty ; @@ -137,9 +137,9 @@ VERTEX-FORMAT: obj-vertex-format [ rest ] [ first ] bi { { "mtllib" [ first read-mtl material-dictionary set ] } - { "v" [ strings>floats 3 head vp [ push* ] change ] } - { "vt" [ strings>floats 2 head vt [ push* ] change ] } - { "vn" [ strings>floats 3 head vn [ push* ] change ] } + { "v" [ strings>numbers 3 head vp [ push* ] change ] } + { "vt" [ strings>numbers 2 head vt [ push* ] change ] } + { "vn" [ strings>numbers 3 head vn [ push* ] change ] } { "usemtl" [ push-current-model first md at current-material set ] } { "f" [ strings>faces face>aos [ [ current-model [ push* ] change ] each ] each ] } [ 2drop ]