]>
Commit | Line | Data |
---|---|---|
1eee94d3 GM |
1 | (* M2StackAddress.def provides a generic stack for ADDRESS sized objects. |
2 | ||
83ffe9cd | 3 | Copyright (C) 2001-2023 Free Software Foundation, Inc. |
1eee94d3 GM |
4 | Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>. |
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 | You should have received a copy of the GNU General Public License | |
19 | along with GNU Modula-2; see the file COPYING3. If not see | |
20 | <http://www.gnu.org/licenses/>. *) | |
21 | ||
22 | DEFINITION MODULE M2StackAddress ; | |
23 | ||
24 | (* | |
25 | Title : M2StackAddress | |
26 | Author : Gaius Mulley | |
27 | System : UNIX (GNU Modula-2) | |
28 | Date : Fri Oct 12 17:26:50 2001 | |
29 | Revision : $Version$ | |
30 | Description: provides a generic stack for ADDRESS sized objects. | |
31 | *) | |
32 | ||
33 | FROM SYSTEM IMPORT ADDRESS ; | |
34 | EXPORT QUALIFIED StackOfAddress, InitStackAddress, KillStackAddress, | |
35 | PushAddress, PopAddress, PeepAddress, | |
36 | IsEmptyAddress, NoOfItemsInStackAddress ; | |
37 | ||
38 | TYPE | |
39 | StackOfAddress ; | |
40 | ||
41 | ||
42 | (* | |
43 | InitStackAddress - creates and returns a new stack. | |
44 | *) | |
45 | ||
46 | PROCEDURE InitStackAddress () : StackOfAddress ; | |
47 | ||
48 | ||
49 | (* | |
50 | KillStackAddress - destroys a stack, returning NIL. | |
51 | *) | |
52 | ||
53 | PROCEDURE KillStackAddress (s: StackOfAddress) : StackOfAddress ; | |
54 | ||
55 | ||
56 | (* | |
57 | PushAddress - pushes a word, w, onto, s. | |
58 | *) | |
59 | ||
60 | PROCEDURE PushAddress (s: StackOfAddress; w: ADDRESS) ; | |
61 | ||
62 | ||
63 | (* | |
64 | PopAddress - pops an element from stack, s. | |
65 | *) | |
66 | ||
67 | PROCEDURE PopAddress (s: StackOfAddress) : ADDRESS ; | |
68 | ||
69 | ||
70 | (* | |
71 | IsEmptyAddress - returns TRUE if stack, s, is empty. | |
72 | *) | |
73 | ||
74 | PROCEDURE IsEmptyAddress (s: StackOfAddress) : BOOLEAN ; | |
75 | ||
76 | ||
77 | (* | |
78 | PeepAddress - returns the element at, n, items below in the stack. | |
79 | Top of stack can be seen via Peep(s, 1) | |
80 | *) | |
81 | ||
82 | PROCEDURE PeepAddress (s: StackOfAddress; n: CARDINAL) : ADDRESS ; | |
83 | ||
84 | ||
85 | (* | |
86 | ReduceAddress - reduce the stack by n elements. | |
87 | *) | |
88 | ||
89 | PROCEDURE ReduceAddress (s: StackOfAddress; n: CARDINAL) ; | |
90 | ||
91 | ||
92 | (* | |
93 | NoOfItemsInStack - returns the number of items held in the stack, s. | |
94 | *) | |
95 | ||
96 | PROCEDURE NoOfItemsInStackAddress (s: StackOfAddress) : CARDINAL ; | |
97 | ||
98 | ||
99 | END M2StackAddress. |