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

SCM Repository

[diderot] Annotation of /branches/vis12/src/compiler/c-util/runtime-names.sml
ViewVC logotype

Annotation of /branches/vis12/src/compiler/c-util/runtime-names.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2719 - (view) (download)

1 : jhr 1115 (* runtime-names.sml
2 :     *
3 :     * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     * All rights reserved.
5 : jhr 1373 *
6 :     * These are names that are used in the common parts of the runtime system.
7 : jhr 1115 *)
8 :    
9 :     structure RuntimeNames =
10 :     struct
11 :    
12 :     local
13 :     structure Ty = TreeIL.Ty
14 : jhr 2082 fun qualifyName name (tgt : Properties.props) = #namespace tgt ^ name
15 :     fun qualifyName' fixed (tgt : Properties.props, name) =
16 : jhr 1815 concat[#namespace tgt, fixed, "_", name]
17 : jhr 1115 in
18 :    
19 : jhr 1815 (* generated types *)
20 :     val worldTy = qualifyName "World_t"
21 :     val globalsTy = qualifyName "Globals_t"
22 : jhr 2041 val inputsTy = qualifyName "Inputs_t" (* type of struct used to hold command-line *)
23 :     (* inputs. *)
24 : jhr 2048 val definedInpTy = qualifyName "DefinedInputs_t"
25 :     (* type of struct used to hold command-line *)
26 :     (* inputs. *)
27 : jhr 1815
28 :     (* generate names for input and output variables *)
29 :     val inputDesc = qualifyName' "InVarDesc"
30 :     val inputGet = qualifyName' "InVarGet"
31 :     val inputSet = qualifyName' "InVarSet"
32 :     val inputSetByName = qualifyName' "InVarSetByName"
33 :     val outputGet = qualifyName' "OutputGet"
34 : jhr 1912 val snapshotGet = qualifyName' "Snapshot"
35 : jhr 1815
36 : jhr 1373 (* names of generated types, functions, and globals *)
37 : jhr 1718 val initGlobals = "InitGlobals" (* function for initializing program globals *)
38 : nseltzer 1870 val freeGlobals = "FreeGlobals" (* function for freeing program globals *)
39 : jhr 1727 val initDefaults = "InitDefaults" (* function for initializing input defaults *)
40 :     val registerOpts = "RegisterGlobalOpts" (* function for registering command-line options *)
41 : jhr 2041 val initInputs = "InitInputs" (* function for initializing global inputs *)
42 : jhr 2049 val initDefined = qualifyName "InitDefined" (* function for initializing input-defined flags *)
43 :     val checkDefined = qualifyName "ChkDefined" (* function for initializing input-defined flags *)
44 : jhr 1718 val shutdown = qualifyName "Shutdown" (* function that gets called at the end *)
45 :     val initially = qualifyName "Initially" (* function for creating initial strands *)
46 : jhr 1115 fun strandInit strand = strand ^ "_InitState"
47 :     fun strandTy strand = concat["Strand_", strand, "_t"]
48 :     fun strandDesc strand = concat["Strand_", strand]
49 :     val numStrands = "Diderot_NumStrands"
50 :     val strands = "Diderot_Strands"
51 :    
52 :     (* Diderot runtime system hooks *)
53 : jhr 1807 fun setImage dim = concat["Diderot_SetImage", Int.toString dim, "D"]
54 : jhr 1115 fun loadImage dim = concat["Diderot_LoadImage", Int.toString dim, "D"]
55 : nseltzer 1870 fun freeImage dim = concat["Diderot_FreeImage", Int.toString dim, "D"]
56 : jhr 1999 fun loadDynSeq ty = (case ty
57 :     of Ty.BoolTy => "Diderot_DynSeqLoadBool"
58 :     | Ty.IntTy => "Diderot_DynSeqLoadInt"
59 :     | Ty.TensorTy _ => "Diderot_DynSeqLoadReal"
60 :     | ty => raise Fail("unsupported sequence type " ^ Ty.toString ty)
61 :     (* end case *))
62 : jhr 2029 fun loadDynSeqFromFile ty = (case ty
63 :     of Ty.BoolTy => "Diderot_DynSeqLoadBoolFromFile"
64 :     | Ty.IntTy => "Diderot_DynSeqLoadIntFromFile"
65 :     | Ty.TensorTy _ => "Diderot_DynSeqLoadRealFromFile"
66 :     | ty => raise Fail("unsupported sequence type " ^ Ty.toString ty)
67 :     (* end case *))
68 : jhr 1115 val strandDescTy = "Strand_t"
69 : jhr 1718 val worldTy = qualifyName "World_t"
70 : jhr 1806 val globalTy = qualifyName "Globals_t"
71 : jhr 1301 val optionsTy = "Diderot_Options_t"
72 : jhr 1718 val allocInitially = "AllocInitially"
73 : jhr 1115 val inState = "Diderot_InState"
74 :    
75 : jhr 1640 (* Math utility functions *)
76 :     val evecs2x2 = "Diderot_evecs2x2"
77 :     val evecs3x3 = "Diderot_evecs3x3"
78 :     val evals2x2 = "Diderot_evals2x2"
79 :     val evals3x3 = "Diderot_evals3x3"
80 :    
81 : jhr 2041 (* functions for defining program inputs; note that sequences and images come from
82 :     * nrrd files, which are specified by their filenames.
83 :     *)
84 : jhr 1115 fun input ty = (case ty
85 : jhr 1373 of Ty.StringTy => "Diderot_OptAddString"
86 :     | Ty.BoolTy => "Diderot_OptAddBool"
87 : jhr 1640 | Ty.IntTy => "Diderot_OptAddInt"
88 : jhr 1373 | Ty.TensorTy[] => "Diderot_OptAddReal"
89 :     | Ty.TensorTy[2] => "Diderot_OptAddReal2"
90 :     | Ty.TensorTy[3] => "Diderot_OptAddReal3"
91 :     | Ty.TensorTy[4] => "Diderot_OptAddReal4"
92 : jhr 2041 | Ty.DynSeqTy _ => "Diderot_OptAddString"
93 :     | Ty.ImageTy _ => "Diderot_OptAddString"
94 : jhr 2030 | ty => raise Fail("unsupported input type " ^ Ty.toString ty)
95 : jhr 1115 (* end case *))
96 :    
97 :     end (* local *)
98 :     end

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