1 (* M2StackAddress.def provides a generic stack for ADDRESS sized objects.
3 Copyright (C) 2001-2025 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 This file is part of GNU Modula-2.
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)
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.
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/>. *)
22 DEFINITION MODULE M2StackAddress ;
25 Title : M2StackAddress
27 System : UNIX (GNU Modula-2)
28 Date : Fri Oct 12 17:26:50 2001
30 Description: provides a generic stack for ADDRESS sized objects.
33 FROM SYSTEM IMPORT ADDRESS ;
34 EXPORT QUALIFIED StackOfAddress, InitStackAddress, KillStackAddress,
35 PushAddress, PopAddress, PeepAddress,
36 IsEmptyAddress, NoOfItemsInStackAddress ;
43 InitStackAddress - creates and returns a new stack.
46 PROCEDURE InitStackAddress () : StackOfAddress ;
50 KillStackAddress - destroys a stack, returning NIL.
53 PROCEDURE KillStackAddress (s: StackOfAddress) : StackOfAddress ;
57 PushAddress - pushes a word, w, onto, s.
60 PROCEDURE PushAddress (s: StackOfAddress; w: ADDRESS) ;
64 PopAddress - pops an element from stack, s.
67 PROCEDURE PopAddress (s: StackOfAddress) : ADDRESS ;
71 IsEmptyAddress - returns TRUE if stack, s, is empty.
74 PROCEDURE IsEmptyAddress (s: StackOfAddress) : BOOLEAN ;
78 PeepAddress - returns the element at, n, items below in the stack.
79 Top of stack can be seen via Peep(s, 1)
82 PROCEDURE PeepAddress (s: StackOfAddress; n: CARDINAL) : ADDRESS ;
86 ReduceAddress - reduce the stack by n elements.
89 PROCEDURE ReduceAddress (s: StackOfAddress; n: CARDINAL) ;
93 NoOfItemsInStack - returns the number of items held in the stack, s.
96 PROCEDURE NoOfItemsInStackAddress (s: StackOfAddress) : CARDINAL ;