## memaccess.api
## Author: Matthias Blume (blume@tti-c.org)
# Compiled by:
#
src/lib/c-glue-lib/ram/memory.lib# Primitives for "raw" memory access.
api Cmemaccess {
eqtype Addr;
null: Addr;
is_null: Addr -> Bool;
+++ : (Addr, Int) -> Addr;
--- : (Addr, Addr) -> Int;
compare: (Addr, Addr) -> Order;
bcopy: { from: Addr, to: Addr, bytes: Unt } -> Void;
# Actual sizes of C types (not their ML representations) in bytes
addr_size: Unt;
char_size: Unt;
short_size: Unt;
int_size: Unt;
long_size: Unt;
longlong_size: Unt;
float_size: Unt;
double_size: Unt;
# Fetching from memory:
load_addr: Addr -> Addr;
load_schar: Addr -> mlrep::signed::Int;
load_uchar: Addr -> mlrep::unsigned::Unt;
load_sshort: Addr -> mlrep::signed::Int;
load_ushort: Addr -> mlrep::unsigned::Unt;
load_sint: Addr -> mlrep::signed::Int;
load_uint: Addr -> mlrep::unsigned::Unt;
load_slong: Addr -> mlrep::signed::Int;
load_ulong: Addr -> mlrep::unsigned::Unt;
load_slonglong: Addr -> mlrep::long_long_signed::Int;
load_ulonglong: Addr -> mlrep::long_long_unsigned::Unt;
load_float: Addr -> mlrep::float::Float;
load_double: Addr -> mlrep::float::Float;
# Storing into memory:
store_addr: (Addr, Addr) -> Void;
store_schar: (Addr, mlrep::signed::Int ) -> Void;
store_uchar: (Addr, mlrep::unsigned::Unt) -> Void;
store_sshort: (Addr, mlrep::signed::Int ) -> Void;
store_ushort: (Addr, mlrep::unsigned::Unt) -> Void;
store_sint: (Addr, mlrep::signed::Int ) -> Void;
store_uint: (Addr, mlrep::unsigned::Unt) -> Void;
store_slong: (Addr, mlrep::signed::Int ) -> Void;
store_ulong: (Addr, mlrep::unsigned::Unt) -> Void;
store_slonglong: (Addr, mlrep::long_long_signed::Int ) -> Void;
store_ulonglong: (Addr, mlrep::long_long_unsigned::Unt) -> Void;
store_float: (Addr, mlrep::float::Float) -> Void;
store_double: (Addr, mlrep::float::Float) -> Void;
int_bits: Unt;
# Types used in C calling convention:
Cc_Addr;
Cc_Schar;
Cc_Uchar;
Cc_Sint;
Cc_Uint;
Cc_Sshort;
Cc_Ushort;
Cc_Slong;
Cc_Ulong;
Cc_Slonglong;
Cc_Ulonglong;
Cc_Float;
Cc_Double;
# Wrapping and unwrapping of cc types:
wrap_addr: Addr -> Cc_Addr;
wrap_schar: mlrep::signed::Int -> Cc_Schar;
wrap_uchar: mlrep::unsigned::Unt -> Cc_Uchar;
wrap_sint: mlrep::signed::Int -> Cc_Sint;
wrap_uint: mlrep::unsigned::Unt -> Cc_Uint;
wrap_sshort: mlrep::signed::Int -> Cc_Sshort;
wrap_ushort: mlrep::unsigned::Unt -> Cc_Ushort;
wrap_slong: mlrep::signed::Int -> Cc_Slong;
wrap_ulong: mlrep::unsigned::Unt -> Cc_Ulong;
wrap_slonglong: mlrep::long_long_signed::Int -> Cc_Slonglong;
wrap_ulonglong: mlrep::long_long_unsigned::Unt -> Cc_Ulonglong;
wrap_float: mlrep::float::Float -> Cc_Float;
wrap_double: mlrep::float::Float -> Cc_Double;
unwrap_addr: Cc_Addr -> Addr;
unwrap_schar: Cc_Schar -> mlrep::signed::Int;
unwrap_uchar: Cc_Uchar -> mlrep::unsigned::Unt;
unwrap_sint: Cc_Sint -> mlrep::signed::Int;
unwrap_uint: Cc_Uint -> mlrep::unsigned::Unt;
unwrap_sshort: Cc_Sshort -> mlrep::signed::Int;
unwrap_ushort: Cc_Ushort -> mlrep::unsigned::Unt;
unwrap_slong: Cc_Slong -> mlrep::signed::Int;
unwrap_ulong: Cc_Ulong -> mlrep::unsigned::Unt;
unwrap_slonglong: Cc_Slonglong -> mlrep::long_long_signed::Int;
unwrap_ulonglong: Cc_Ulonglong -> mlrep::long_long_unsigned::Unt;
unwrap_float: Cc_Float -> mlrep::float::Float;
unwrap_double: Cc_Double -> mlrep::float::Float;
# Unsafe pointer <-> int conversion:
p2i: Addr -> mlrep::unsigned::Unt;
i2p: mlrep::unsigned::Unt -> Addr;
};
## Copyright (c) 2004 by The Fellowship of SML/NJ
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.