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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download)

1 : monnier 245 (* code-string.sml
2 :     *
3 :     * COPYRIGHT (c) 1998 Bell Labs, Lucent Technologies.
4 :     *)
5 :    
6 :     structure CodeString : CODE_STRING =
7 :     struct
8 :    
9 :     type code_string = CodeObj.code_object
10 :    
11 :     val obj = ref (NONE : CodeObj.code_object option)
12 :     val arr = ref (Word8Array.array(0, 0w0))
13 :    
14 :     fun init sz = let
15 :     val co = CodeObj.alloc (sz, NONE)
16 :     in
17 :     obj := SOME co;
18 :     arr := CodeObj.bytes co
19 :     end
20 :    
21 :     fun update (i, b) = Word8Array.update (!arr, i, b)
22 :    
23 :     fun getCodeString () = let
24 :     val co = valOf(!obj)
25 :     in
26 :     arr := Word8Array.array(0, 0w0);
27 :     obj := NONE;
28 :     co
29 :     end
30 :    
31 :     end;
32 :    

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