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/c.sig
ViewVC logotype

Diff of /sml/trunk/src/ml-nlffi-lib/c.sig

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

revision 840, Fri Jun 15 19:05:19 2001 UTC revision 975, Wed Oct 31 20:22:44 2001 UTC
# Line 24  Line 24 
24       * types -- even in the "light" case.) *)       * types -- even in the "light" case.) *)
25      type ('t, 'c) obj      type ('t, 'c) obj
26    
27      (* an alternative "light-weight" version that does not carry RTI at      (* an alternative "light-weight" version that does not carry RTTI at
28       * the cost of requiring explicit passing of RTI for certain operations *)       * the cost of requiring explicit passing of RTTI for certain operations *)
29      type ('t, 'c) obj'      type ('t, 'c) obj'
30    
31      (* constness property, to be substituted for 'c *)      (* constness property, to be substituted for 'c *)
# Line 231  Line 231 
231      (* sub-structure for dealing with run-time type info *)      (* sub-structure for dealing with run-time type info *)
232      structure T : sig      structure T : sig
233    
234          (* Our RTI itself is statically typed!          (* Our RTTI itself is statically typed!
235           * The RTI for a value stored in ('t, 'c) obj has           * The RTTI for a value stored in ('t, 'c) obj has
236           * the following type: *)           * the following type: *)
237          type 't typ          type 't typ
238    
239          (* get the RTI from an actual object *)          (* get the RTTI from an actual object *)
240          val typeof : ('t, 'c) obj -> 't typ          val typeof : ('t, 'c) obj -> 't typ
241    
242          (* constructing new RTI from existing RTI *)          (* constructing new RTTI from existing RTTI *)
243          val pointer : 't typ -> ('t, rw) ptr typ          val pointer : 't typ -> ('t, rw) ptr typ
244          val target  : ('t, 'c) ptr typ -> 't typ          val target  : ('t, 'c) ptr typ -> 't typ
245          val arr     : 't typ * 'n Dim.dim -> ('t, 'n) arr typ          val arr     : 't typ * 'n Dim.dim -> ('t, 'n) arr typ
246          val elem    : ('t, 'n) arr typ -> 't typ          val elem    : ('t, 'n) arr typ -> 't typ
247          val ro      : ('t, 'c) ptr typ -> ('t, ro) ptr typ          val ro      : ('t, 'c) ptr typ -> ('t, ro) ptr typ
248    
249          (* calculating the size of an object given its RTI *)          (* calculating the size of an object given its RTTI *)
250          val sizeof : 't typ -> 't S.size          val sizeof : 't typ -> 't S.size
251    
252          (* dimension of array type *)          (* dimension of array type *)
253          val dim : ('t, 'n) arr typ -> 'n Dim.dim          val dim : ('t, 'n) arr typ -> 'n Dim.dim
254    
255          (* RTI for simple things *)          (* RTTI for simple things *)
256          val schar  : schar typ          val schar  : schar typ
257          val uchar  : uchar typ          val uchar  : uchar typ
258          val sint   : sint typ          val sint   : sint typ
# Line 364  Line 364 
364          val voidptr' : rw voidptr_obj' * voidptr -> unit          val voidptr' : rw voidptr_obj' * voidptr -> unit
365    
366          (* When storing, voidptr is compatible with any ptr type          (* When storing, voidptr is compatible with any ptr type
367           * (just like in C).  This should eliminate most need for RTI in           * (just like in C).  This should eliminate most need for RTTI in
368           * practice. *)           * practice. *)
369          val ptr_voidptr : (('t, 'pc) ptr, rw) obj * voidptr -> unit          val ptr_voidptr : (('t, 'pc) ptr, rw) obj * voidptr -> unit
370    
# Line 407  Line 407 
407          val inject' : ('t, 'c) ptr' -> voidptr          val inject' : ('t, 'c) ptr' -> voidptr
408    
409          (* the opposite is not safe, but C makes it not only easy but also          (* the opposite is not safe, but C makes it not only easy but also
410           * almost necessary; we use our RTI interface to specify the pointer           * almost necessary; we use our RTTI interface to specify the pointer
411           * type (not the element type!) *)           * type (not the element type!) *)
412          val cast : ('t, 'c) ptr T.typ -> voidptr -> ('t, 'c) ptr          val cast : ('t, 'c) ptr T.typ -> voidptr -> ('t, 'c) ptr
413    
# Line 463  Line 463 
463      structure Arr : sig      structure Arr : sig
464    
465          (* array subscript;          (* array subscript;
466           * since we have RTI, we can actually make this safe:  we raise           * since we have RTTI, we can actually make this safe:  we raise
467           * General.Subscript for out-of-bounds access;           * General.Subscript for out-of-bounds access;
468           * for unchecked access, go through arr_decay and ptr_sub *)           * for unchecked access, go through arr_decay and ptr_sub *)
469          val sub : (('t, 'n) arr, 'c) obj * int -> ('t, 'c) obj          val sub : (('t, 'n) arr, 'c) obj * int -> ('t, 'c) obj

Legend:
Removed from v.840  
changed lines
  Added in v.975

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