PreviousUpNext

14.4.71  Unsafe_Chunk

The standard library Unsafe_Chunk api defines access to various functions coercing raw memory pointers to various types. This provides the equivalent of C pointer type casts for low-level code which needs it. Caveat Hacker! This also allows you to corrupt the heap arbitarily. Here be monsters.

The Unsafe_Chunk api is implemented by the unsafe_chunk package from src/lib/std/src/unsafe/unsafe-chunk.pkg.

The Unsafe_Chunk api source code is in src/lib/std/src/unsafe/unsafe-chunk.api.

The above information is manually maintained and may contain errors.

api {    Chunk ;
    Representation 
      = BYTE_ARRAY
      | BYTE_VECTOR
      | FLOAT_ARRAY
      | PAIR
      | POLY_ARRAY
      | POLY_VECTOR
      | REAL
      | RECORD
      | REF
      | SUSP
      | UNBOXED
      | WEAK_PTR
      | WORD32;
    to_chunk : X -> Chunk;
    make_tuple : List(Chunk ) -> Chunk;
    boxed : Chunk -> Bool;
    unboxed : Chunk -> Bool;
    rep : Chunk -> Representation;
    length : Chunk -> Int;
    exception REPRESENTATION;
    to_tuple : Chunk -> List(Chunk );
    to_string : Chunk -> String;
    to_ref : Chunk -> Ref(Chunk );
    to_array : Chunk -> Rw_Vector(Chunk );
    to_real_array : Chunk -> rw_float64_vector::Rw_Vector;
    to_byte_array : Chunk -> rw_unt8_vector::Rw_Vector;
    to_vector : Chunk -> ?.Vector(Chunk );
    to_byte_vector : Chunk -> unt8_vector::Vector;
    to_exn : Chunk -> Exception;
    to_float : Chunk -> Float;
    to_int : Chunk -> Int;
    to_int32 : Chunk -> int32::Int;
    to_word : Chunk -> Unt;
    to_word8 : Chunk -> unt8::Unt;
    to_word32 : Chunk -> unt32::Unt;
    nth : (Chunk , Int) -> Chunk;
};


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext