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

SCM Repository

[smlnj] Diff of /sml/trunk/src/ml-nlffi-lib/internals/c-iptr-fn.sml
ViewVC logotype

Diff of /sml/trunk/src/ml-nlffi-lib/internals/c-iptr-fn.sml

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

revision 1077, Tue Feb 19 15:48:50 2002 UTC revision 1078, Tue Feb 19 21:26:48 2002 UTC
# Line 1  Line 1 
1  (*  (*
2   * c-iptr-fn.sml   Generate the "completion" of an "incomplete" C type.   * c-iptr-fn.sml   Generate the "completion" of an "incomplete" C type.
3   *   *
4   *   The code generated from a C interface (call it <A>) containing an   *   See ../iptr.sig for details.
  *   "incomplete" type (i.e., a pointer to a named but otherwise undefined  
  *   struct or union, call it <foo>) will be a functor that takes a structure  
  *   argument representing this incomplete (pointer-)type.  
5   *   *
6   *   If (struct or union) <foo> has a known definition in some other   *   (C) 2002, Lucent Technologies, Bell Labs
  *   participating C interface (call it <B>), then one must  
  *   propagate the definition from <B> trough <A> to clients of <A> as  
  *   follows:  
  *  
  *   <A>.<A>Fn (...  
  *              structure I_S_<foo> = PointerToCompleteType (<B>.S_<foo>)  
  *              ...)  
  *  
  *   If no definition for <foo> is available, then one must use a brand-new  
  *   I_S_<foo>.  See i-iptr-fn.sml.  
  *  
  *   (C) 2001, Lucent Technologies, Bell Labs  
7   *   *
8   * author: Matthias Blume (blume@research.bell-labs.com)   * author: Matthias Blume (blume@research.bell-labs.com)
9   *)   *)
10  functor PointerToCompleteType (type tag val typ : tag C.su C.T.typ) :>  functor PointerToCompleteType (type tag val typ : tag C.su C.T.typ) :>
11          POINTER_TO_INCOMPLETE_TYPE          POINTER_TO_INCOMPLETE_TYPE
12          where type 'c iptr = (tag C.su, 'c) C.ptr          where type 'c iobj = (tag C.su, 'c) C.obj =
         where type 'c iptr' = (tag C.su, 'c) C.ptr' =  
13  struct  struct
14      type 'c iptr = (tag C.su, 'c) C.ptr      type 'c iobj = (tag C.su, 'c) C.obj
     type 'c iptr' = (tag C.su, 'c) C.ptr'  
15    
16      val typ'rw = C.T.pointer typ      val typ'rw = C.T.pointer typ
17      val typ'ro = C.T.ro typ'rw      val typ'ro = C.T.ro typ'rw
   
     val light = C.Light.ptr  
     fun heavy p = C.Heavy.ptr typ p  
   
     val get = C.Get.ptr  
     val get' = C.Get.ptr'  
   
     val set = C.Set.ptr  
     val set' = C.Set.ptr'  
   
     val set_voidptr = C.Set.ptr_voidptr  
     val set_voidptr' = C.Set.ptr_voidptr'  
   
     val compare = C.Ptr.compare  
     val compare' = C.Ptr.compare'  
   
     val inject = C.Ptr.inject  
     val inject' = C.Ptr.inject'  
   
     val cast = C.Ptr.cast  
     val cast' = C.Ptr.cast'  
   
     val null = C.Ptr.null  
     val null' = C.Ptr.null'  
18  end  end

Legend:
Removed from v.1077  
changed lines
  Added in v.1078

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