Debian Codegraph @

gcc/m2/gm2-compiler/Sets.def

raw
1 (* Sets.def provides a dynamic set module.
2
3 Copyright (C) 2009-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 Sets ;
23
24 (*
25 Title : Sets
26 Author : Gaius Mulley
27 System : GNU Modula-2
28 Date : Wed May 6 22:48:19 2009
29 Revision : $Version$
30 Description: provides a dynamic set module which allows
31 sets to contain the elements in the range:
32 min..SymbolTable.FinalSymbol()
33 *)
34
35 FROM SymbolKey IMPORT PerformOperation ;
36
37
38 TYPE
39 Set ;
40
41
42 (*
43 InitSet - initializes and returns a set. The set will
44 never contain an element less than, low.
45 *)
46
47 PROCEDURE InitSet (low: CARDINAL) : Set ;
48
49
50 (*
51 KillSet - deallocates Set, s.
52 *)
53
54 PROCEDURE KillSet (s: Set) : Set ;
55
56
57 (*
58 DuplicateSet - returns a new duplicated set.
59 *)
60
61 PROCEDURE DuplicateSet (s: Set) : Set ;
62
63
64 (*
65 ForeachElementInSetDo - for each element e in, s, call, p(e).
66 *)
67
68 PROCEDURE ForeachElementInSetDo (s: Set; p: PerformOperation) ;
69
70
71 (*
72 IsElementInSet - returns TRUE if element, i, is in set, s.
73 *)
74
75 PROCEDURE IsElementInSet (s: Set; i: CARDINAL) : BOOLEAN ;
76
77
78 (*
79 NoOfElementsInSet - returns the number of elements in a set, s.
80 *)
81
82 PROCEDURE NoOfElementsInSet (s: Set) : CARDINAL ;
83
84
85 (*
86 ExcludeElementFromSet - excludes element, i, from set, s.
87 *)
88
89 PROCEDURE ExcludeElementFromSet (s: Set; i: CARDINAL) ;
90
91
92 (*
93 IncludeElementIntoSet - includes element, i, into set, s.
94 *)
95
96 PROCEDURE IncludeElementIntoSet (s: Set; i: CARDINAL) ;
97
98
99 (*
100 EqualSet - return TRUE if left = right.
101 *)
102
103 PROCEDURE EqualSet (left, right: Set) : BOOLEAN ;
104
105
106 END Sets.