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