Debian Codegraph @

gcc/m2/mc/alists.def

raw
1 (* alists.def address lists module.
2
3 Copyright (C) 2015-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 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 alists ;
23
24 FROM SYSTEM IMPORT ADDRESS ;
25
26 TYPE
27 alist ;
28 performOperation = PROCEDURE (ADDRESS) ;
29
30
31 (*
32 initList - creates a new alist, l.
33 *)
34
35 PROCEDURE initList () : alist ;
36
37
38 (*
39 killList - deletes the complete alist, l.
40 *)
41
42 PROCEDURE killList (VAR l: alist) ;
43
44
45 (*
46 putItemIntoList - places an ADDRESS, c, into alist, l.
47 *)
48
49 PROCEDURE putItemIntoList (l: alist; c: ADDRESS) ;
50
51
52 (*
53 getItemFromList - retrieves the nth ADDRESS from alist, l.
54 *)
55
56 PROCEDURE getItemFromList (l: alist; n: CARDINAL) : ADDRESS ;
57
58
59 (*
60 getIndexOfList - returns the index for ADDRESS, c, in alist, l.
61 If more than one CARDINAL, c, exists the index
62 for the first is returned.
63 *)
64
65 PROCEDURE getIndexOfList (l: alist; c: ADDRESS) : CARDINAL ;
66
67
68 (*
69 noOfItemsInList - returns the number of items in alist, l.
70 *)
71
72 PROCEDURE noOfItemsInList (l: alist) : CARDINAL ;
73
74
75 (*
76 includeItemIntoList - adds an ADDRESS, c, into a alist providing
77 the value does not already exist.
78 *)
79
80 PROCEDURE includeItemIntoList (l: alist; c: ADDRESS) ;
81
82
83 (*
84 removeItemFromList - removes an ADDRESS, c, from a alist.
85 It assumes that this value only appears once.
86 *)
87
88 PROCEDURE removeItemFromList (l: alist; c: ADDRESS) ;
89
90
91 (*
92 isItemInList - returns true if a ADDRESS, c, was found in alist, l.
93 *)
94
95 PROCEDURE isItemInList (l: alist; c: ADDRESS) : BOOLEAN ;
96
97
98 (*
99 foreachItemInListDo - calls procedure, P, foreach item in alist, l.
100 *)
101
102 PROCEDURE foreachItemInListDo (l: alist; p: performOperation) ;
103
104
105 (*
106 duplicateList - returns a duplicate alist derived from, l.
107 *)
108
109 PROCEDURE duplicateList (l: alist) : alist ;
110
111
112 (*
113 equalList - returns TRUE if left contains the same information as right.
114 *)
115
116 PROCEDURE equalList (left, right: alist) : BOOLEAN ;
117
118
119 END alists.