PreviousUpNext

15.3.567  src/lib/std/src/unsafe/unsafe.api

## unsafe.api

# Compiled by:
#     src/lib/std/src/standard-core.sublib



# Unsafe operations on Mythryl values.


###                      "If you believe the doctors, nothing is wholesome;
###                       if you believe the theologians, nothing is innocent;
###                       if you believe the military, nothing is safe."
###
###                                               -- Lord Salisbury

api Unsafe {

    package mythryl_callable_c_library_interface
        :
        Mythryl_Callable_C_Library_Interface;                   # Mythryl_Callable_C_Library_Interface  is from   src/lib/std/src/unsafe/mythryl-callable-c-library-interface.api

    package unsafe_chunk: Unsafe_Chunk;                         # Unsafe_Chunk                          is from   src/lib/std/src/unsafe/unsafe-chunk.api

    package software_generated_periodic_events
        :
        Software_Generated_Periodic_Events;                     # Software_Generated_Periodic_Events    is from   src/lib/std/src/unsafe/software-generated-periodic-events.api

    package vector:      Unsafe_Vector;                         # Unsafe_Vector                         is from   src/lib/std/src/unsafe/unsafe-vector.api
    package rw_vector:   Unsafe_Rw_Vector;                      # Unsafe_Rw_Vector                      is from   src/lib/std/src/unsafe/unsafe-rw-vector.api

    package vector_of_chars:  Unsafe_Typelocked_Vector          # Unsafe_Typelocked_Vector              is from   src/lib/std/src/unsafe/unsafe-typelocked-vector.api
      where  Vector == vector_of_chars::Vector
      where  Element == vector_of_chars::Element;

    package rw_vector_of_chars: Unsafe_Typelocked_Rw_Vector     # Unsafe_Typelocked_Rw_Vector           is from   src/lib/std/src/unsafe/unsafe-typelocked-rw-vector.api
        where  Rw_Vector == rw_vector_of_chars::Rw_Vector
        where  Element == rw_vector_of_chars::Element;

    package vector_of_one_byte_unts:  Unsafe_Typelocked_Vector          # Unsafe_Typelocked_Vector              is from   src/lib/std/src/unsafe/unsafe-typelocked-vector.api
      where  Vector == vector_of_one_byte_unts::Vector
      where  Element == vector_of_one_byte_unts::Element;

    package rw_vector_of_one_byte_unts: Unsafe_Typelocked_Rw_Vector     # Unsafe_Typelocked_Rw_Vector           is from   src/lib/std/src/unsafe/unsafe-typelocked-rw-vector.api
      where  Rw_Vector == rw_vector_of_one_byte_unts::Rw_Vector
      where  Element == rw_vector_of_one_byte_unts::Element;


/** once we have flat float vectors, we can include this subpackage
    package vector_of_eight_byte_floats:  Unsafe_Typelocked_Vector
      where Vector = vector_of_eight_byte_floats::Vector
      where Element = vector_of_eight_byte_floats::Element
**/
    package rw_vector_of_eight_byte_floats:  Unsafe_Typelocked_Rw_Vector        # Unsafe_Typelocked_Rw_Vector           is from   src/lib/std/src/unsafe/unsafe-typelocked-rw-vector.api
      where  Rw_Vector == rw_vector_of_eight_byte_floats::Rw_Vector
      where  Element == rw_vector_of_eight_byte_floats::Element;

    get_handler:  Void -> fate::Fate(X);
    set_handler:  fate::Fate(X) -> Void;

    # The reserved 'current_thread' register is used by
    # threadkit to hold the currently executing thread.
    # This is a real register on RISC architectures but
    # a memory location on the register-starved intel32
    # architecture -- see   src/lib/compiler/back/low/main/intel32/backend-lowhalf-intel32-g.pkg
    #
    get_current_microthread_register:  Void -> X;
    set_current_microthread_register:  X -> Void;

    get_pseudo:  Int -> X;
    set_pseudo:  (X, Int) -> Void;

    # See src/A.DATASTRUCTURE-PICKLING.OVERVIEW:
    #
    unpickle_datastructure:  vector_of_one_byte_unts::Vector -> X;
    pickle_datastructure:    X -> vector_of_one_byte_unts::Vector;

    boxed:  X -> Bool;

    cast:  X -> Y;

    # Actual representation of pervasive_package_pickle_list__global,
    # a C global used to communicate with the C runtime.
    # It contains a linklist of picklehash-pickle pairs:
    # see (e.g.)
    #     src/c/main/construct-runtime-package.c
    #     src/c/main/load-compiledfiles.c 
    #
    package p:  api {   Pervasive_Package_Pickle_List
                          #
                          = NIL                                                                 # NIL and CONS are traditional LISP terms for final and nonfinal (respectively) linklist nodes.
                          | CONS  ( vector_of_one_byte_unts::Vector,                            # 16-byte hash of chunk.
                                    unsafe_chunk::Chunk,                                        # Arbitrary ram-chunk on Mythryl heap.
                                    Pervasive_Package_Pickle_List                               # 'next' pointer in linklist.
                                  )
                          ;
                    };
    #
    pervasive_package_pickle_list__global:      Ref(  p::Pervasive_Package_Pickle_List );

    sigint_fate:        Ref(  fate::Fate(Void) );                                               # Set only in   src/lib/compiler/toplevel/interact/read-eval-print-loop-g.pkg

    posix_interprocess_signal_handler_refcell__global
        :
        Ref( (Int, Int, fate::Fate(Void)) ->  fate::Fate (Void) );                              # (signal_id, signal_count, fate) -> fate
                                                                                                # signal_id is SIGALARM or whatever.
                                                                                                # signal_count is the number of times it has occurred since last being handled.
};




## Copyright (c) 1997 Bell Labs, Lucent Technologies.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext