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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1815 - (download) (annotate)
Tue Apr 10 11:52:06 2012 UTC (7 years, 6 months ago) by jhr
File size: 2770 byte(s)
  factor out input/output names into RuntimeNames module and change
  naming scheme
(* runtime-names.sml
 *
 * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 *
 * These are names that are used in the common parts of the runtime system.
 *)

structure RuntimeNames =
  struct

    local
      structure Ty = TreeIL.Ty
      fun qualifyName name (tgt : TargetUtil.target_desc) = #namespace tgt ^ name
      fun qualifyName' fixed (tgt : TargetUtil.target_desc, name) =
            concat[#namespace tgt, fixed, "_", name]
    in

  (* generated types *)
    val worldTy = qualifyName "World_t"
    val globalsTy = qualifyName "Globals_t"

  (* generate names for input and output variables *)
    val inputDesc = qualifyName' "InVarDesc"
    val inputGet = qualifyName' "InVarGet"
    val inputSet = qualifyName' "InVarSet"
    val inputSetByName = qualifyName' "InVarSetByName"
    val outputGet = qualifyName' "OutputGet"

  (* names of generated types, functions, and globals *)
    val initGlobals = "InitGlobals"		(* function for initializing program globals *)
    val initDefaults = "InitDefaults"		(* function for initializing input defaults *)
    val registerOpts = "RegisterGlobalOpts"	(* function for registering command-line options *)
    val shutdown = qualifyName "Shutdown"	(* function that gets called at the end *)
    val initially = qualifyName "Initially"	(* function for creating initial strands *)
    fun strandInit strand = strand ^ "_InitState"
    fun strandTy strand = concat["Strand_", strand, "_t"]
    fun strandDesc strand = concat["Strand_", strand]
    val numStrands = "Diderot_NumStrands"
    val strands = "Diderot_Strands"

  (* Diderot runtime system hooks *)
    val statusTy = "Status_t"
    fun setImage dim = concat["Diderot_SetImage", Int.toString dim, "D"]
    fun loadImage dim = concat["Diderot_LoadImage", Int.toString dim, "D"]
    val strandDescTy = "Strand_t"
    val worldTy = qualifyName "World_t"
    val globalTy = qualifyName "Globals_t"
    val optionsTy = "Diderot_Options_t"
    val allocInitially = "AllocInitially"
    val inState = "Diderot_InState"

  (* Math utility functions *)
    val evecs2x2 = "Diderot_evecs2x2"
    val evecs3x3 = "Diderot_evecs3x3"
    val evals2x2 = "Diderot_evals2x2"
    val evals3x3 = "Diderot_evals3x3"

  (* functions for defining program inputs *)
    fun input ty = (case ty
	   of Ty.StringTy => "Diderot_OptAddString"
	    | Ty.BoolTy => "Diderot_OptAddBool"
	    | Ty.IntTy => "Diderot_OptAddInt"
	    | Ty.TensorTy[] => "Diderot_OptAddReal"
	    | Ty.TensorTy[2] => "Diderot_OptAddReal2"
	    | Ty.TensorTy[3] => "Diderot_OptAddReal3"
	    | Ty.TensorTy[4] => "Diderot_OptAddReal4"
	    | ty => raise Fail("unsupported input type " ^ Ty.toString ty)
	  (* end case *))

    end (* local *)
  end

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