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 2030 - (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 1718 fun qualifyName name (tgt : TargetUtil.target_desc) = #namespace tgt ^ name
15 : jhr 1815 fun qualifyName' fixed (tgt : TargetUtil.target_desc, name) =
16 :     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 :    
23 :     (* generate names for input and output variables *)
24 :     val inputDesc = qualifyName' "InVarDesc"
25 :     val inputGet = qualifyName' "InVarGet"
26 :     val inputSet = qualifyName' "InVarSet"
27 :     val inputSetByName = qualifyName' "InVarSetByName"
28 :     val outputGet = qualifyName' "OutputGet"
29 : jhr 1912 val snapshotGet = qualifyName' "Snapshot"
30 : jhr 1815
31 : jhr 1373 (* names of generated types, functions, and globals *)
32 : jhr 1718 val initGlobals = "InitGlobals" (* function for initializing program globals *)
33 : nseltzer 1870 val freeGlobals = "FreeGlobals" (* function for freeing program globals *)
34 : jhr 1727 val initDefaults = "InitDefaults" (* function for initializing input defaults *)
35 :     val registerOpts = "RegisterGlobalOpts" (* function for registering command-line options *)
36 : jhr 1718 val shutdown = qualifyName "Shutdown" (* function that gets called at the end *)
37 :     val initially = qualifyName "Initially" (* function for creating initial strands *)
38 : jhr 1115 fun strandInit strand = strand ^ "_InitState"
39 :     fun strandTy strand = concat["Strand_", strand, "_t"]
40 :     fun strandDesc strand = concat["Strand_", strand]
41 :     val numStrands = "Diderot_NumStrands"
42 :     val strands = "Diderot_Strands"
43 :    
44 :     (* Diderot runtime system hooks *)
45 :     val statusTy = "Status_t"
46 : jhr 1807 fun setImage dim = concat["Diderot_SetImage", Int.toString dim, "D"]
47 : jhr 1115 fun loadImage dim = concat["Diderot_LoadImage", Int.toString dim, "D"]
48 : nseltzer 1870 fun freeImage dim = concat["Diderot_FreeImage", Int.toString dim, "D"]
49 : jhr 1999 fun loadDynSeq ty = (case ty
50 :     of Ty.BoolTy => "Diderot_DynSeqLoadBool"
51 :     | Ty.IntTy => "Diderot_DynSeqLoadInt"
52 :     | Ty.TensorTy _ => "Diderot_DynSeqLoadReal"
53 :     | ty => raise Fail("unsupported sequence type " ^ Ty.toString ty)
54 :     (* end case *))
55 : jhr 2029 fun loadDynSeqFromFile ty = (case ty
56 :     of Ty.BoolTy => "Diderot_DynSeqLoadBoolFromFile"
57 :     | Ty.IntTy => "Diderot_DynSeqLoadIntFromFile"
58 :     | Ty.TensorTy _ => "Diderot_DynSeqLoadRealFromFile"
59 :     | ty => raise Fail("unsupported sequence type " ^ Ty.toString ty)
60 :     (* end case *))
61 : jhr 1115 val strandDescTy = "Strand_t"
62 : jhr 1718 val worldTy = qualifyName "World_t"
63 : jhr 1806 val globalTy = qualifyName "Globals_t"
64 : jhr 1301 val optionsTy = "Diderot_Options_t"
65 : jhr 1718 val allocInitially = "AllocInitially"
66 : jhr 1115 val inState = "Diderot_InState"
67 :    
68 : jhr 1640 (* Math utility functions *)
69 :     val evecs2x2 = "Diderot_evecs2x2"
70 :     val evecs3x3 = "Diderot_evecs3x3"
71 :     val evals2x2 = "Diderot_evals2x2"
72 :     val evals3x3 = "Diderot_evals3x3"
73 :    
74 : jhr 1373 (* functions for defining program inputs *)
75 : jhr 1115 fun input ty = (case ty
76 : jhr 1373 of Ty.StringTy => "Diderot_OptAddString"
77 :     | Ty.BoolTy => "Diderot_OptAddBool"
78 : jhr 1640 | Ty.IntTy => "Diderot_OptAddInt"
79 : jhr 1373 | Ty.TensorTy[] => "Diderot_OptAddReal"
80 :     | Ty.TensorTy[2] => "Diderot_OptAddReal2"
81 :     | Ty.TensorTy[3] => "Diderot_OptAddReal3"
82 :     | Ty.TensorTy[4] => "Diderot_OptAddReal4"
83 : jhr 2030 | Ty.DynSeqTy _ => raise Fail "FIXME"
84 :     | Ty.ImageTy _ => raise Fail "FIXME"
85 :     | ty => raise Fail("unsupported input type " ^ Ty.toString ty)
86 : jhr 1115 (* end case *))
87 :    
88 :     end (* local *)
89 :     end

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