 : read-multipoint-z ( -- multipoint-z )
     read-box read-int
     [ read-points read-range ]
-    [ read-double-array read-range ]
-    [ read-double-array ] tri multipoint-z boa ;
+    [ read-doubles read-range ]
+    [ read-doubles ] tri multipoint-z boa ;
 
 TUPLE: polyline-z box parts points z-range z-array m-range
 m-array ;
 
 : read-polyline-z ( -- polyline-z )
-    read-box read-int read-int [ read-int-array ] dip
+    read-box read-int read-int [ read-ints ] dip
     [ read-points read-range ]
-    [ read-double-array read-range ]
-    [ read-double-array ] tri polyline-z boa ;
+    [ read-doubles read-range ]
+    [ read-doubles ] tri polyline-z boa ;
 
 TUPLE: polygon-z box parts points z-range z-array m-range
 m-array ;
 
 : read-polygon-z ( -- polyline-z )
-    read-box read-int read-int [ read-int-array ] dip
+    read-box read-int read-int [ read-ints ] dip
     [ read-points read-range ]
-    [ read-double-array read-range ]
-    [ read-double-array ] tri polygon-z boa ;
+    [ read-doubles read-range ]
+    [ read-doubles ] tri polygon-z boa ;
 
 TUPLE: multipatch box parts points part-types z-range z-array
 m-range m-array ;
 
 : read-multipatch ( -- multipatch )
     read-box read-int read-int
-    [ [ read-int-array ] [ read-int-array ] bi ] dip
+    [ [ read-ints ] [ read-ints ] bi ] dip
     [ read-points read-range ]
-    [ read-double-array read-range ]
-    [ read-double-array ] tri multipatch boa ;
+    [ read-doubles read-range ]
+    [ read-doubles ] tri multipatch boa ;
 
 : read-shape ( -- shape )
     4 read le> {

TUPLE: multipoint box points ;

: read-multipoint ( -- multipoint )
    read-box read-int [ read-point ] replicate multipoint boa ;

TUPLE: polyline box parts points ;

: read-polyline ( -- polyline )
    read-box read-int read-int
    [ [ read-int ] replicate ]
    [ [ read-point ] replicate ] bi*
    polyline boa ;

TUPLE: polygon box parts points ;

: read-polygon ( -- polygon )
    read-box read-int read-int
    [ read-int-array ] [ read-points ] bi*
    polygon boa ;

TUPLE: point-m x y m ;


y-min x-max y-max z-min z-max m-min m-max ;

: read-header ( -- header )
    4 read be> dup 9994 assert=
    20 read drop ! unused
    4 read be>
    read-int dup 1000 assert=
    read-int
    read-double
    read-double
    read-double
    read-double
    read-double
    read-double
    read-double
    read-double
    header boa ;

TUPLE: point x y ;
