Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/compiler/CodeGen/main/code-string.sml
ViewVC logotype

View of /sml/trunk/compiler/CodeGen/main/code-string.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2162 - (download) (annotate)
Thu Nov 2 21:20:47 2006 UTC (13 years, 11 months ago) by blume
File size: 622 byte(s)
eliminated src dir
(* code-string.sml
 *
 * COPYRIGHT (c) 1998 Bell Labs, Lucent Technologies.
 *)

structure CodeString : CODE_STRING =
  struct

    type code_string = CodeObj.code_object

    val obj = ref (NONE : CodeObj.code_object option)
    val arr = ref (Word8Array.array(0, 0w0))

    fun init sz = let
	  val co = CodeObj.alloc sz
	  in
	    obj := SOME co;
	    arr := CodeObj.bytes co
	  end

    fun update (i, b) = Word8Array.update (!arr, i, b)

    fun getCodeString ep = let
	  val co = valOf(!obj)
	  in
	    CodeObj.set_entrypoint (co, ep);
	    arr := Word8Array.array(0, 0w0);
	    obj := NONE;
	    co
	  end

  end;


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