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/src/compiler/CodeGen/main/code-string.sml
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 225 - (download) (annotate)
Sat Apr 17 17:09:01 1999 UTC (21 years, 1 month ago) by monnier
File size: 592 byte(s)
Initial revision
(* 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, NONE)
	  in
	    obj := SOME co;
	    arr := CodeObj.bytes co
	  end

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

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

  end;


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