Debian Codegraph @

doc/guide/src/MLtonPointer.adoc

raw
1 = MLtonPointer
2
3 [source,sml]
4 ----
5 signature MLTON_POINTER =
6 sig
7 eqtype t
8
9 val add: t * word -> t
10 val compare: t * t -> order
11 val diff: t * t -> word
12 val getInt8: t * int -> Int8.int
13 val getInt16: t * int -> Int16.int
14 val getInt32: t * int -> Int32.int
15 val getInt64: t * int -> Int64.int
16 val getPointer: t * int -> t
17 val getReal32: t * int -> Real32.real
18 val getReal64: t * int -> Real64.real
19 val getWord8: t * int -> Word8.word
20 val getWord16: t * int -> Word16.word
21 val getWord32: t * int -> Word32.word
22 val getWord64: t * int -> Word64.word
23 val null: t
24 val setInt8: t * int * Int8.int -> unit
25 val setInt16: t * int * Int16.int -> unit
26 val setInt32: t * int * Int32.int -> unit
27 val setInt64: t * int * Int64.int -> unit
28 val setPointer: t * int * t -> unit
29 val setReal32: t * int * Real32.real -> unit
30 val setReal64: t * int * Real64.real -> unit
31 val setWord8: t * int * Word8.word -> unit
32 val setWord16: t * int * Word16.word -> unit
33 val setWord32: t * int * Word32.word -> unit
34 val setWord64: t * int * Word64.word -> unit
35 val sizeofPointer: word
36 val sub: t * word -> t
37 end
38 ----
39
40 * `eqtype t`
41 +
42 the type of pointers, i.e. machine addresses.
43
44 * `add (p, w)`
45 +
46 returns the pointer `w` bytes after than `p`. Does not check for
47 overflow.
48
49 * `compare (p1, p2)`
50 +
51 compares the pointer `p1` to the pointer `p2` (as addresses).
52
53 * `diff (p1, p2)`
54 +
55 returns the number of bytes `w` such that `add (p2, w) = p1`. Does
56 not check for overflow.
57
58 * ``get__<X>__ (p, i)``
59 +
60 returns the object stored at index i of the array of _X_ objects
61 pointed to by `p`. For example, `getWord32 (p, 7)` returns the 32-bit
62 word stored 28 bytes beyond `p`.
63
64 * `null`
65 +
66 the null pointer, i.e. 0.
67
68 * ``set__<X>__ (p, i, v)``
69 +
70 assigns `v` to the object stored at index i of the array of _X_
71 objects pointed to by `p`. For example, `setWord32 (p, 7, w)` stores
72 the 32-bit word `w` at the address 28 bytes beyond `p`.
73
74 * `sizeofPointer`
75 +
76 size, in bytes, of a pointer.
77
78 * `sub (p, w)`
79 +
80 returns the pointer `w` bytes before `p`. Does not check for
81 overflow.