| 1 |
(* RTdata.def provides a mechanism whereby devices can attach data. |
| 2 |
|
| 3 |
Copyright (C) 2008-2025 Free Software Foundation, Inc. |
| 4 |
Contributed by Gaius Mulley <[email protected]>. |
| 5 |
|
| 6 |
This file is part of GNU Modula-2. |
| 7 |
|
| 8 |
GNU Modula-2 is free software; you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation; either version 3, or (at your option) |
| 11 |
any later version. |
| 12 |
|
| 13 |
GNU Modula-2 is distributed in the hope that it will be useful, but |
| 14 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
General Public License for more details. |
| 17 |
|
| 18 |
Under Section 7 of GPL version 3, you are granted additional |
| 19 |
permissions described in the GCC Runtime Library Exception, version |
| 20 |
3.1, as published by the Free Software Foundation. |
| 21 |
|
| 22 |
You should have received a copy of the GNU General Public License and |
| 23 |
a copy of the GCC Runtime Library Exception along with this program; |
| 24 |
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 25 |
<http://www.gnu.org/licenses/>. *) |
| 26 |
|
| 27 |
DEFINITION MODULE RTdata ; |
| 28 |
|
| 29 |
(* |
| 30 |
Title : RTdata |
| 31 |
Author : Gaius Mulley |
| 32 |
System : GNU Modula-2 |
| 33 |
Date : Fri Sep 26 17:19:15 2008 |
| 34 |
Revision : $Version$ |
| 35 |
Description: provides a mechanism whereby devices can store |
| 36 |
data attached to a device. |
| 37 |
*) |
| 38 |
|
| 39 |
FROM SYSTEM IMPORT ADDRESS ; |
| 40 |
FROM IOLink IMPORT DeviceTablePtr ; |
| 41 |
|
| 42 |
TYPE |
| 43 |
ModuleId ; |
| 44 |
FreeProcedure = PROCEDURE (ADDRESS) ; |
| 45 |
|
| 46 |
|
| 47 |
(* |
| 48 |
MakeModuleId - creates a unique module Id. |
| 49 |
*) |
| 50 |
|
| 51 |
PROCEDURE MakeModuleId (VAR m: ModuleId) ; |
| 52 |
|
| 53 |
|
| 54 |
(* |
| 55 |
InitData - adds, datum, to the device, d. The datum |
| 56 |
is associated with ModuleID, m. |
| 57 |
*) |
| 58 |
|
| 59 |
PROCEDURE InitData (d: DeviceTablePtr; m: ModuleId; |
| 60 |
datum: ADDRESS; f: FreeProcedure) ; |
| 61 |
|
| 62 |
|
| 63 |
(* |
| 64 |
GetData - returns the datum assocated with ModuleId, m. |
| 65 |
*) |
| 66 |
|
| 67 |
PROCEDURE GetData (d: DeviceTablePtr; m: ModuleId) : ADDRESS ; |
| 68 |
|
| 69 |
|
| 70 |
(* |
| 71 |
KillData - destroys the datum associated with ModuleId, m, |
| 72 |
in device, d. It invokes the free procedure |
| 73 |
given during InitData. |
| 74 |
*) |
| 75 |
|
| 76 |
PROCEDURE KillData (d: DeviceTablePtr; m: ModuleId) ; |
| 77 |
|
| 78 |
|
| 79 |
END RTdata. |