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/world.sml
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2805 - (download) (annotate)
Sat Nov 8 17:34:20 2014 UTC (5 years, 9 months ago) by jhr
File size: 1582 byte(s)
  detabbing; some changes from vis12-cl branch
(* world.sml
 *
 * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 *)

structure World : sig

  (* WorldPrefix_t pointer type *)
    val prefixTy : CLang.ty

  (* create the declaration for the world type *)
    val genStruct : Properties.props * (CLang.ty * string) list -> CLang.decl

  (* generate code to register an error message *)
    val errorMsgAdd : CLang.exp -> CLang.stm

  end = struct

    structure CL = CLang

    val prefixTy = CL.T_Ptr(CL.T_Named "WorldPrefix_t")

  (* WORLD_STRUCT_PREFIX componenets (see Diderot/world.h) *)
    val prefix = [
            (CL.T_Ptr(CL.T_Named "const char"), "name"),
            (CL.T_Ptr(CL.T_Named "biffMsg"),    "errors"),
            (CL.boolTy,                         "verboseFlg"),
            (CL.boolTy,                         "isArray"),
            (CL.uint32,                         "nStrandTys"),
            (CL.T_Ptr(CL.T_Named "Strand_t"),   "strandDesc"),
            (CL.uint32,                         "nAxes"),
            (CL.T_Ptr CL.uint32,                "base"),
            (CL.T_Ptr CL.uint32,                "size"),
            (CL.uint32,                         "numStrands"),
            (CL.double,                         "runTime")
          ]

    fun genStruct (props : Properties.props, tgtFields) = CL.D_StructDef(
          SOME(#namespace props ^ "struct_world"),
          prefix @ tgtFields,
          NONE)

    fun errorMsgAdd msg =
          CL.mkCall("biffMsgAdd", [CL.mkIndirect(CL.mkVar "wrld", "errors"), msg])

  end

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