Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /trunk/src/compiler/fields/image-info.sml
ViewVC logotype

Diff of /trunk/src/compiler/fields/image-info.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 510, Tue Feb 8 16:12:38 2011 UTC revision 511, Tue Feb 8 17:01:43 2011 UTC
# Line 59  Line 59 
59      fun getInfo fileName = let      fun getInfo fileName = let
60  (* FIXME: check that file exists! *)  (* FIXME: check that file exists! *)
61            val {version, header} = RunDNorm.run fileName            val {version, header} = RunDNorm.run fileName
62              fun fields s = String.tokens Char.isSpace s
63            fun set (r, v) = (r := SOME v)            fun set (r, v) = (r := SOME v)
64            fun get (tag, r) = (case !r of NONE => raise Fail("missing "^tag) | SOME v => v)            fun get (tag, r) = (case !r of NONE => raise Fail("missing "^tag) | SOME v => v)
65            val ty = ref NONE            val ty = ref NONE
66            val totalDim = ref NONE            val totalDim = ref NONE
67            val dim = ref NONE            val dim = ref NONE
68              val sizes = ref NONE
69            fun doValue ("type", v) = set(ty, RawTypes.fromString v)            fun doValue ("type", v) = set(ty, RawTypes.fromString v)
70              | doValue ("dimension", v) = set (totalDim, valOf(Int.fromString v))              | doValue ("dimension", v) = set (totalDim, valOf(Int.fromString v))
71              | doValue ("space dimension", v) = set (dim, valOf(Int.fromString v))              | doValue ("space dimension", v) = set (dim, valOf(Int.fromString v))
72              | doValue ("sizes", v) = ()              | doValue ("sizes", v) = let
73                    fun atoi s = (case Int.fromString s
74                           of SOME i => i
75                            | NONE => raise Fail(concat[
76                                  "bogus dnorm output: \"", "sizes: ", String.toString v, "\n"
77                                ])
78                          (* end case *))
79                    in
80                      set (sizes, List.map atoi (fields v))
81                    end
82              | doValue ("space directions", v) = ()              | doValue ("space directions", v) = ()
83              | doValue ("kinds", v) = ()              | doValue ("kinds", v) = ()
84              | doValue ("endian", v) = ()              | doValue ("endian", v) = ()
# Line 84  Line 95 
95  (* FIXME: in general, the type is a tensor of raw values *)  (* FIXME: in general, the type is a tensor of raw values *)
96                  ty = ([], get ("type", ty)),                  ty = ([], get ("type", ty)),
97                  origin = [],    (* FIXME *)                  origin = [],    (* FIXME *)
98                  sizes = []      (* FIXME *)                  sizes = get ("sizes", sizes)
99                }                }
100            end            end
101    

Legend:
Removed from v.510  
changed lines
  Added in v.511

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0