SCM Repository
View of /branches/vis12/src/compiler/inputs/inputs.sml
Parent Directory
|
Revision Log
Revision 3291 -
(download)
(annotate)
Wed Oct 14 21:25:00 2015 UTC (6 years, 7 months ago) by jhr
File size: 2451 byte(s)
Wed Oct 14 21:25:00 2015 UTC (6 years, 7 months ago) by jhr
File size: 2451 byte(s)
code is copyright University of Chicago
(* inputs.sml * * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu) * * COPYRIGHT (c) 2015 The University of Chicago * All rights reserved. * * Common representation for tracking inputs through the passes of the compiler. *) structure Inputs : sig datatype init_from_nrrd = DynSeq of string | Proxy of string * ImageInfo.info (* input image specified by proxy *) | Image of ImageInfo.info (* input image w/o proxy *) datatype 'ty input = INP of { ty : 'ty, name : string, desc : string option, init : init_from_nrrd option } val same : 'a input * 'a input -> bool val hash : 'a input -> word val initToString : init_from_nrrd -> string val toString : 'ty input -> string val imageInfo : 'ty input -> ImageInfo.info option (* type conversion *) val map : ('a -> 'b) -> 'a input -> 'b input end = struct datatype init_from_nrrd = DynSeq of string | Proxy of string * ImageInfo.info (* input image specified by proxy *) | Image of ImageInfo.info (* input image w/o proxy *) datatype 'ty input = INP of { ty : 'ty, name : string, desc : string option, init : init_from_nrrd option } fun same (INP{name=n1, ...}, INP{name=n2, ...}) = (n1 = n2) fun hash (INP{name, ...}) = HashString.hashString name fun initToString (DynSeq name) = String.concat["load(\"", name, "\")"] | initToString (Proxy(name, _)) = String.concat["image(\"", name, "\")"] | initToString (Image info) = ImageInfo.toString info fun toString (INP{name, desc=NONE, init=NONE, ...}) = name | toString (INP{name, desc=SOME desc, init=NONE, ...}) = String.concat[name, "(\"", String.toString desc, "\""] | toString (INP{name, desc=NONE, init=SOME v, ...}) = String.concat[name, " = ", initToString v] | toString (INP{name, desc=SOME desc, init=SOME v, ...}) = String.concat[name, "(\"", String.toString desc, "\") = ", initToString v] fun imageInfo (INP{init=SOME(Proxy(_, info)), ...}) = SOME info | imageInfo (INP{init=SOME(Image info), ...}) = SOME info | imageInfo _ = NONE (* type conversion *) fun map f (INP{ty, name, desc, init}) = INP{ty = f ty, name = name, desc = desc, init = init} end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |