]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/m2/gm2-libs/Indexing.def
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / gm2-libs / Indexing.def
CommitLineData
1eee94d3
GM
1(* Indexing.def provides a dynamic indexing mechanism for CARDINAL.
2
a945c346 3Copyright (C) 2003-2024 Free Software Foundation, Inc.
1eee94d3
GM
4Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
5
6This file is part of GNU Modula-2.
7
8GNU Modula-2 is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 3, or (at your option)
11any later version.
12
13GNU Modula-2 is distributed in the hope that it will be useful, but
14WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16General Public License for more details.
17
18Under Section 7 of GPL version 3, you are granted additional
19permissions described in the GCC Runtime Library Exception, version
203.1, as published by the Free Software Foundation.
21
22You should have received a copy of the GNU General Public License and
23a copy of the GCC Runtime Library Exception along with this program;
24see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25<http://www.gnu.org/licenses/>. *)
26
27DEFINITION MODULE Indexing ;
28
29FROM SYSTEM IMPORT ADDRESS ;
30EXPORT QUALIFIED Index, InitIndex, KillIndex, GetIndice, PutIndice,
31 HighIndice, LowIndice, InBounds, IsIndiceInIndex,
32 RemoveIndiceFromIndex, IncludeIndiceIntoIndex,
33 ForeachIndiceInIndexDo, DeleteIndice, DebugIndex ;
34
35TYPE
36 Index ;
37 IndexProcedure = PROCEDURE (ADDRESS) ;
38
39
40(*
41 InitIndex - creates and returns an Index.
42*)
43
44PROCEDURE InitIndex (low: CARDINAL) : Index ;
45
46
47(*
48 KillIndex - returns Index to free storage.
49*)
50
51PROCEDURE KillIndex (i: Index) : Index ;
52
53
54(*
55 DebugIndex - turns on debugging within an index.
56*)
57
58PROCEDURE DebugIndex (i: Index) : Index ;
59
60
61(*
62 InBounds - returns TRUE if indice, n, is within the bounds
63 of the dynamic array.
64*)
65
66PROCEDURE InBounds (i: Index; n: CARDINAL) : BOOLEAN ;
67
68
69(*
70 HighIndice - returns the last legally accessible indice of this array.
71*)
72
73PROCEDURE HighIndice (i: Index) : CARDINAL ;
74
75
76(*
77 LowIndice - returns the first legally accessible indice of this array.
78*)
79
80PROCEDURE LowIndice (i: Index) : CARDINAL ;
81
82
83(*
84 PutIndice - places, a, into the dynamic array at position i[n]
85*)
86
87PROCEDURE PutIndice (i: Index; n: CARDINAL; a: ADDRESS) ;
88
89
90(*
91 GetIndice - retrieves, element i[n] from the dynamic array.
92*)
93
94PROCEDURE GetIndice (i: Index; n: CARDINAL) : ADDRESS ;
95
96
97(*
98 IsIndiceInIndex - returns TRUE if, a, is in the index, i.
99*)
100
101PROCEDURE IsIndiceInIndex (i: Index; a: ADDRESS) : BOOLEAN ;
102
103
104(*
105 RemoveIndiceFromIndex - removes, a, from Index, i.
106*)
107
108PROCEDURE RemoveIndiceFromIndex (i: Index; a: ADDRESS) ;
109
110
111(*
112 DeleteIndice - delete i[j] from the array.
113*)
114
115PROCEDURE DeleteIndice (i: Index; j: CARDINAL) ;
116
117
118(*
119 IncludeIndiceIntoIndex - if the indice is not in the index, then
120 add it at the end.
121*)
122
123PROCEDURE IncludeIndiceIntoIndex (i: Index; a: ADDRESS) ;
124
125
126(*
127 ForeachIndiceInIndexDo - for each j indice of i, call procedure p(i[j])
128*)
129
130PROCEDURE ForeachIndiceInIndexDo (i: Index; p: IndexProcedure) ;
131
132
133END Indexing.