Home My Page Projects Code Snippets Project Openings 3D graphics for Standard ML
Summary Activity SCM

SCM Repository

[sml3d] Diff of /trunk/sml3d/src/raw-data/data-buffer-sig.sml
ViewVC logotype

Diff of /trunk/sml3d/src/raw-data/data-buffer-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 776, Sun Mar 7 19:55:00 2010 UTC revision 777, Mon Mar 8 14:26:56 2010 UTC
# Line 56  Line 56 
56      val ty3d  : (double * double * double) ty      val ty3d  : (double * double * double) ty
57      val ty4d  : (double * double * double * double) ty      val ty4d  : (double * double * double * double) ty
58    
59      (* a "cstruct" element type is a C struct type of some size and alignment; it is up to the
60       * user to get these right!.  The only way to get/set values in a cstruct buffer is by using
61       * the C pointers.  Note that the alignment must be a power of two!
62       *)
63        type cstruct
64        val tyStruct : {szb : C_Size.word, align : C_Size.word} -> cstruct ty
65    
66      val sizeOf : 'a ty -> C_Size.word           (* element size in bytes *)      val sizeOf : 'a ty -> C_Size.word           (* element size in bytes *)
67    
68      val make : {      val make : {
69              alloc : C_Size.word -> MLton.Pointer.t,              alloc : C_Size.word -> C_Pointer.t,
70              free : MLton.Pointer.t -> unit              free : C_Pointer.t -> unit
71            } -> ('a ty * int) -> 'a buffer            } -> ('a ty * int) -> 'a buffer
72    
73      val new : ('a ty * int) -> 'a buffer      val new : ('a ty * int) -> 'a buffer
# Line 69  Line 76 
76     * function and the second argument is the element type/number of elements/     * function and the second argument is the element type/number of elements/
77     * data pointer triple.     * data pointer triple.
78     *)     *)
79      val wrapCData : (MLton.Pointer.t -> unit) -> ('a ty * int * MLton.Pointer.t) -> 'a buffer      val wrapCData : (C_Pointer.t -> unit) -> ('a ty * int * C_Pointer.t) -> 'a buffer
80    
81      val delete : 'a buffer -> unit      val delete : 'a buffer -> unit
82      val valid  : 'a buffer -> bool      val valid  : 'a buffer -> bool
# Line 205  Line 212 
212    (* support for passing buffers to C code.  Note that it is the responsibility of client code to    (* support for passing buffers to C code.  Note that it is the responsibility of client code to
213     * make sure that data that is visibile to C is also retained by the SML heap.     * make sure that data that is visibile to C is also retained by the SML heap.
214     *)     *)
215      val withPtr : ('a buffer * ({data : MLton.Pointer.t, szb :  C_Size.word, elemSzb : C_Size.word} -> 'b)) -> 'b      val withPtr : ('a buffer * ({data : C_Pointer.t, szb :  C_Size.word, elemSzb : C_Size.word} -> 'b)) -> 'b
216      val touch : 'a buffer -> unit      val touch : 'a buffer -> unit
217    
218      (* apply an operation to a given element in a cstruct buffer *)
219        val withCStruct : (cstruct buffer * (C_Pointer.t -> 'a)) -> int -> 'a
220    
221    end    end

Legend:
Removed from v.776  
changed lines
  Added in v.777

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