gm2-libs-iso/RTdata (The GNU Modula-2 Compiler)

#### 4.4.33 gm2-libs-iso/RTdata ¶

    DEFINITION MODULE RTdata ;

    (*
        Description: provides a mechanism whereby devices can store
                     data attached to a device.
    *)

    FROM SYSTEM IMPORT ADDRESS ;
    FROM IOLink IMPORT DeviceTablePtr ;

    TYPE
       ModuleId ;
       FreeProcedure = PROCEDURE (ADDRESS) ;

    (*
       MakeModuleId - creates a unique module Id.
    *)

    PROCEDURE MakeModuleId (VAR m: ModuleId) ;

    (*
       InitData - adds, datum, to the device, d.  The datum
                  is associated with ModuleID, m.
    *)

    PROCEDURE InitData (d: DeviceTablePtr; m: ModuleId;
                        datum: ADDRESS; f: FreeProcedure) ;

    (*
       GetData - returns the datum assocated with ModuleId, m.
    *)

    PROCEDURE GetData (d: DeviceTablePtr; m: ModuleId) : ADDRESS ;

    (*
       KillData - destroys the datum associated with ModuleId, m,
                  in device, d.  It invokes the free procedure
                  given during InitData.
    *)

    PROCEDURE KillData (d: DeviceTablePtr; m: ModuleId) ;

    END RTdata.