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/i-iptr-fn.sml
ViewVC logotype

Diff of /sml/trunk/src/ml-nlffi-lib/internals/i-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   * i-iptr-fn.sml   Leave an "incomplete" C type "incomplete".   * i-iptr-fn.sml   Leave an "incomplete" C type "incomplete".
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 no known definition in any other   *   (C) 2002, Lucent Technologies, Bell Labs
  *   participating C interface (i.e., when it is abstract), then  
  *   one must generate a new structure (containing brand-new, abstract types)  
  *   to be supplied as the functor's argument:  
  *  
  *   <A>.<A>Fn (...  
  *          structure I_S_<foo> = PointerToIncompleteType ()  
  *          ...)  
  *  
  *   If a definition for <foo> is available, then one must use that  
  *   instead. See c-iptr-fn.sml.  
  *  
  *   If the same abstract type is being used abstractly in several  
  *   different participating C interfaces, then one must pass the same  
  *   structure to all relevant functors:  
  *  
  *   structure I_S_<foo> = PointerToIncompleteType ()  
  *   <A>.<A>Fn (... structure I_I_<foo> = I_S_<foo> ...)  
  *   <B>.<B>Fn (... structure I_I_<foo> = I_S_<foo> ...)  
  *   ...  
  *  
  *   (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 PointerToIncompleteType () :> POINTER_TO_INCOMPLETE_TYPE = struct  functor PointerToIncompleteType () :> POINTER_TO_INCOMPLETE_TYPE = struct
11    
12      type 'c iptr = (C.uchar, 'c) C.ptr      type 'c iobj = (C.uchar, 'c) C.obj
     type 'c iptr' = (C.uchar, 'c) C.ptr'  
13    
14      val typ'rw = C.T.pointer C.T.uchar      val typ'rw = C.T.pointer C.T.uchar
15      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 C.T.uchar 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'  
16  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