DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦22a10bb24⟧ TextFile

    Length: 3561 (0xde9)
    Types: TextFile
    Notes: R1k Text-file segment

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦9913edc7f⟧ 
            └─⟦this⟧ 

TextFile

with System;
package Callback is
    -- This package allows Ada subprograms to be "called" from C.
    -- This is not supported by the AIX Ada/6000 compiler. Use at your own
    -- risk. Interfaces may change (without notice) and render this mechanism
    -- unusable.
    ------------------------------------------------------------------------
    -- IBM disclaims all warranties with regard to this software, including
    -- all implied warranties of merchantability and fitness for a particular
    -- purpose. In no event shall IBM be liable for any special, indirect
    -- or consequential damages or any damages whatsoever resulting from loss
    -- of use, data or profits, whether in an action of contract, negligence
    -- or other tortious action, arising out of or in connection with the use
    -- or performance of this software.
    ------------------------------------------------------------------------
    --
    --  For example. if C_routine is a C function that must call the Ada
    --  subprogram Ada_subprogram, then the function descriptor for
    --  Ada_subprogram should be passed to C_routine:
    --
    --     Ada_subprogram_description: Call_back.Function_descriptor_type;
    --   Begin
    --     Ada_subprogram_description :=
    --             Call_back.Ada_to_C( Ada_subprogram'subprogram_value);
    --     C_routine(Ada_subprogram_descriptor'address);
    --
    ------------------------------------------------------------------------
    -- Restrictions and notes:
    ------------------------------------------------------------------------
    -- (The "Ada subprogram" refers to the subprogram that is being called
    -- from the C routine.)
    -- 1. The Ada subprogram may be a function or a procedure.
    -- 2. The Ada suprogram may have up to a maximum of 4 parameters,
    --    none of which may be floating point types or composite types.
    --    For a function, the return type may not be a floating point type
    --    or a composite type.
    -- 3. The mapping of Ada objects to C objects follows the same
    --    restrictions as documented in the user's guide for Ada interfacing
    --    to C.
    -- 4. The Ada subprogram should not be nested in another Ada subprogram.
    -- 5. The Ada subprogram should not use tasking operations.
    -- 6. The Ada subprogram should not raise an exception that would
    --    propagate out of the subprogram.
    -- 7. The object of type Function_descriptor_type should be declared so
    --    that it is sure to exist when the C routine calls the Ada subprogram.
    --    This is most easily ensured by declaring that object neither inside
    --    a subprogram nor inside a block statement.

    type Function_Descriptor_Type is private;

    --------------------------------------------------------------------------
    -- The function below returns a function descriptor whose address may be
    -- passed to a C routine to be used as a function parameter. When this
    -- descriptor is called from a C routine, the Ada subprogram will be
    -- invoked.
    --------------------------------------------------------------------------
    function Ada_To_C (S : System.Subprogram_Value)
                      return Function_Descriptor_Type;
    -- The System.Subprogram_value parameter can be obtained by using
    -- the UNSUPPORTED implementation-dependent attribute 'Subprogram_value
    -- (applied to an Ada subprogram).

private
    type Function_Descriptor_Type is array (0 .. 2) of Integer;
    pragma Interface (C, Ada_To_C);
end Callback