with
Invalid_argument _ -> invalid_arg "get_bytes"
+let get_int32 t addr =
+ let e = get_endian t in
+ let str = get_bytes t addr 4 in
+ let bs = Bitmatch.bitstring_of_string str in
+ bitmatch bs with
+ | { addr : 32 : endian (e) } -> addr
+ | { _ } -> invalid_arg "follow_pointer"
+
+let get_int64 t addr =
+ let e = get_endian t in
+ let str = get_bytes t addr 8 in
+ let bs = Bitmatch.bitstring_of_string str in
+ bitmatch bs with
+ | { addr : 64 : endian (e) } -> addr
+ | { _ } -> invalid_arg "follow_pointer"
+
+let get_C_int = get_int32
+
+let get_C_long t addr =
+ let ws = get_wordsize t in
+ match ws with
+ | W32 -> Int64.of_int32 (get_int32 t addr)
+ | W64 -> get_int64 t addr
+
let get_string t addr =
let chars = ref [] in
try
This may raise [Invalid_argument "get_bytes"] if the address range
is not fully mapped. *)
+val get_int32 : ('a, [`Endian]) t -> addr -> int32
+(** Return the 32-bit int at [addr]. *)
+
+val get_int64 : ('a, [`Endian]) t -> addr -> int64
+(** Return the 64-bit int at [addr]. *)
+
+val get_C_int : ([`Wordsize], [`Endian]) t -> addr -> int32
+(** Return the C 32-bit int at [addr]. *)
+
+val get_C_long : ([`Wordsize], [`Endian]) t -> addr -> int64
+(** Return the C 32 or 64-bit long at [addr]. *)
+
val get_string : ('a, 'b) t -> addr -> string
(** Return the sequence of bytes starting at [addr] up to (but not
including) the first ASCII NUL character. In other words, this