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
 [smlnj] / sml / trunk / src / ml-nlffi-lib / c.sig

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

revision 1015, Tue Jan 15 21:46:00 2002 UTC revision 1021, Wed Jan 16 20:33:57 2002 UTC
# Line 384  Line 384
384      (* alt *)      (* alt *)
385      val copy' : 't S.size -> { from: ('t, 'c) obj', to: ('t, rw) obj' } -> unit      val copy' : 't S.size -> { from: ('t, 'c) obj', to: ('t, rw) obj' } -> unit
386
387        (* manipulating object constness
388         * rw -> ro:  this direction just accounts for the fact that
389         *            rw is conceptually a subtype of ro
390         * ro -> rw:  this is not safe, but C makes it so easy that we
391         *            might as well directly support it;
392         * Concretely, we make both operations polymorphic in the argument
393         * constness.  Moreover, the second (unsafe) direction is also
394         * polymorphic in the result.  This can be used to effectively
395         * implement a conversion to "whatever the context wants":
396         *)
397        val ro : ('t, 'c) obj  -> ('t, ro) obj
398        val rw : ('t, 'sc) obj -> ('t, 'tc) obj
399
400        (* alt *)
401        val ro' : ('t, 'c) obj'  -> ('t, ro) obj'
402        val rw' : ('t, 'sc) obj' -> ('t, 'tc) obj'
403
404      (* operations on (mostly) pointers *)      (* operations on (mostly) pointers *)
405      structure Ptr : sig      structure Ptr : sig
406
# Line 447  Line 464
464
465          (* alt; needs explicit size (for element) *)          (* alt; needs explicit size (for element) *)
466          val sub' : 't S.size -> ('t, 'c) ptr' * int -> ('t, 'c) obj'          val sub' : 't S.size -> ('t, 'c) ptr' * int -> ('t, 'c) obj'
end
467
468      (* manipulating object constness          (* constness manipulation for pointers *)
469       * rw -> ro:  this direction just accounts for the fact that          val ro : ('t, 'c) ptr    -> ('t, ro) ptr
470       *            rw is conceptually a subtype of ro          val rw : ('t, 'sc) ptr   -> ('t, 'tc) ptr
471       * ro -> rw:  this is not safe, but C makes it so easy that we          val ro' : ('t, 'c) ptr'  -> ('t, ro) ptr'
472       *            might as well directly support it *)          val rw' : ('t, 'sc) ptr' -> ('t, 'tc) ptr'
473      val ro : ('t, 'c) obj -> ('t, ro) obj      end
val rw : ('t, 'c) obj -> ('t, rw) obj

(* alt *)
val ro' : ('t, 'c) obj' -> ('t, ro) obj'
val rw' : ('t, 'c) obj' -> ('t, rw) obj'
474
475      (* operations on (mostly) arrays *)      (* operations on (mostly) arrays *)
476      structure Arr : sig      structure Arr : sig
# Line 491  Line 502
502      end      end
503
504      (* allocating new objects *)      (* allocating new objects *)
505      val new : 't T.typ -> ('t, rw) obj      val new : 't T.typ -> ('t, 'c) obj
506
507      (* alt *)      (* alt *)
508      val new' : 't S.size -> ('t, rw) obj'      val new' : 't S.size -> ('t, 'c) obj'
509
510      (* freeing objects that were allocated earlier *)      (* freeing objects that were allocated earlier *)
511      val discard : ('t, 'c) obj -> unit      val discard : ('t, 'c) obj -> unit
# Line 503  Line 514
514      val discard' : ('t, 'c) obj' -> unit      val discard' : ('t, 'c) obj' -> unit
515
516      (* allocating a dynamically-sized array *)      (* allocating a dynamically-sized array *)
517      val alloc : 't T.typ -> word -> ('t, rw) ptr      val alloc : 't T.typ -> word -> ('t, 'c) ptr
518
519      (* alt *)      (* alt *)
520      val alloc' : 't S.size -> word -> ('t, rw) ptr'      val alloc' : 't S.size -> word -> ('t, 'c) ptr'
521
522      (* freeing through pointers *)      (* freeing through pointers *)
523      val free : ('t, 'c) ptr -> unit      val free : ('t, 'c) ptr -> unit

Legend:
 Removed from v.1015 changed lines Added in v.1021