Remove math.floats.parser now that its no longer needed

db4
Slava Pestov 2010-02-08 16:52:29 +13:00
parent 243a97e8dd
commit 48373a6c4c
6 changed files with 31 additions and 51 deletions

View File

@ -1,18 +1,13 @@
! Copyright (C) 2008 Peter Burns, 2009 Philipp Winkler ! Copyright (C) 2008 Peter Burns, 2009 Philipp Winkler
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays assocs combinators io io.streams.string json USING: arrays assocs combinators io io.streams.string json
kernel math math.floats.parser math.parser prettyprint sequences kernel math math.parser prettyprint sequences strings vectors ;
strings vectors ;
IN: json.reader IN: json.reader
<PRIVATE <PRIVATE
: value ( char -- num char ) : value ( char -- num char )
1string " \t\r\n,:}]" read-until 1string " \t\r\n,:}]" read-until
[ [ append string>number ] dip ;
append
[ string>float ]
[ [ "eE." index ] any? [ >integer ] unless ] bi
] dip ;
DEFER: j-string DEFER: j-string

View File

@ -1 +0,0 @@
Slava Pestov

View File

@ -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
<PRIVATE
LIBRARY: libc
FUNCTION: double strtod ( char* nptr, char** endptr ) ;
PRIVATE>
: string>float ( str -- n/f ) f <void*> strtod ;

View File

@ -1,7 +1,7 @@
! Copyright (C) 2010 Erik Charlebois ! Copyright (C) 2010 Erik Charlebois
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs grouping hashtables kernel locals 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.float
specialized-arrays.instances.alien.c-types.uint splitting xml specialized-arrays.instances.alien.c-types.uint splitting xml
xml.data xml.traversal math.order namespaces combinators images 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 ; " \t\n" split harvest [ string>number ] map ;
: string>floats ( string -- float-seq ) : 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 ) : x/ ( tag child-name -- child-tag )
[ tag-named ] [ tag-named ]

View File

@ -22,9 +22,9 @@ HELP: md
{ $values { "material-dictionary" assoc } } { $values { "material-dictionary" assoc } }
{ $description "Convenience word for accessing the material dictionary while parsing primitives. " } ; { $description "Convenience word for accessing the material dictionary while parsing primitives. " } ;
HELP: strings>floats HELP: strings>numbers
{ $values { "strings" sequence } { "floats" sequence } } { $values { "strings" sequence } { "numbers" sequence } }
{ $description "Convert a sequence of strings to a sequence of floats." } ; { $description "Convert a sequence of strings to a sequence of numbers." } ;
HELP: strings>faces HELP: strings>faces
{ $values { "strings" sequence } { "faces" sequence } } { $values { "strings" sequence } { "faces" sequence } }

View File

@ -1,8 +1,8 @@
! Copyright (C) 2010 Erik Charlebois ! Copyright (C) 2010 Erik Charlebois
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: io io.encodings.ascii math.parser math.floats.parser USING: io io.encodings.ascii math.parser sequences splitting
sequences splitting kernel assocs io.files combinators kernel assocs io.files combinators math.order math namespaces
math.order math namespaces arrays sequences.deep accessors arrays sequences.deep accessors
specialized-arrays.instances.alien.c-types.float specialized-arrays.instances.alien.c-types.float
specialized-arrays.instances.alien.c-types.uint game.models specialized-arrays.instances.alien.c-types.uint game.models
game.models.util gpu.shaders images game.models.loader game.models.util gpu.shaders images game.models.loader
@ -36,8 +36,8 @@ TUPLE: material
: cm ( -- current-material ) current-material get ; inline : cm ( -- current-material ) current-material get ; inline
: md ( -- material-dictionary ) material-dictionary get ; inline : md ( -- material-dictionary ) material-dictionary get ; inline
: strings>floats ( strings -- floats ) : strings>numbers ( strings -- numbers )
[ string>float ] map ; [ string>number ] map ;
: strings>faces ( strings -- faces ) : strings>faces ( strings -- faces )
[ "/" split [ string>number ] map ] map ; [ "/" split [ string>number ] map ] map ;
@ -54,13 +54,13 @@ TUPLE: material
[ material new swap >>name current-material set ] [ material new swap >>name current-material set ]
[ cm swap md set-at ] bi [ cm swap md set-at ] bi
] } ] }
{ "Ka" [ 3 head [ string>float ] map cm (>>ambient-reflectivity) ] } { "Ka" [ 3 head strings>numbers cm (>>ambient-reflectivity) ] }
{ "Kd" [ 3 head [ string>float ] map cm (>>diffuse-reflectivity) ] } { "Kd" [ 3 head strings>numbers cm (>>diffuse-reflectivity) ] }
{ "Ks" [ 3 head [ string>float ] map cm (>>specular-reflectivity) ] } { "Ks" [ 3 head strings>numbers cm (>>specular-reflectivity) ] }
{ "Tf" [ 3 head [ string>float ] map cm (>>transmission-filter) ] } { "Tf" [ 3 head strings>numbers cm (>>transmission-filter) ] }
{ "d" [ first string>float cm (>>dissolve) ] } { "d" [ first string>number cm (>>dissolve) ] }
{ "Ns" [ first string>float cm (>>specular-exponent) ] } { "Ns" [ first string>number cm (>>specular-exponent) ] }
{ "Ni" [ first string>float cm (>>refraction-index) ] } { "Ni" [ first string>number cm (>>refraction-index) ] }
{ "map_Ka" [ first cm (>>ambient-map) ] } { "map_Ka" [ first cm (>>ambient-map) ] }
{ "map_Kd" [ first cm (>>diffuse-map) ] } { "map_Kd" [ first cm (>>diffuse-map) ] }
{ "map_Ks" [ first cm (>>specular-map) ] } { "map_Ks" [ first cm (>>specular-map) ] }
@ -137,9 +137,9 @@ VERTEX-FORMAT: obj-vertex-format
[ rest ] [ first ] bi [ rest ] [ first ] bi
{ {
{ "mtllib" [ first read-mtl material-dictionary set ] } { "mtllib" [ first read-mtl material-dictionary set ] }
{ "v" [ strings>floats 3 head vp [ push* ] change ] } { "v" [ strings>numbers 3 head vp [ push* ] change ] }
{ "vt" [ strings>floats 2 head vt [ push* ] change ] } { "vt" [ strings>numbers 2 head vt [ push* ] change ] }
{ "vn" [ strings>floats 3 head vn [ push* ] change ] } { "vn" [ strings>numbers 3 head vn [ push* ] change ] }
{ "usemtl" [ push-current-model first md at current-material set ] } { "usemtl" [ push-current-model first md at current-material set ] }
{ "f" [ strings>faces face>aos [ [ current-model [ push* ] change ] each ] each ] } { "f" [ strings>faces face>aos [ [ current-model [ push* ] change ] each ] each ] }
[ 2drop ] [ 2drop ]