DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ C T

⟦5f48ff45c⟧ TextFile

    Length: 3562 (0xdea)
    Types: TextFile
    Names: »CALLBACK_ADA«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦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;