]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/gm2-libs/Indexing.def
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / gm2-libs / Indexing.def
1 (* Indexing.def provides a dynamic indexing mechanism for CARDINAL.
2
3 Copyright (C) 2003-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 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
21
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. *)
26
27 DEFINITION MODULE Indexing ;
28
29 FROM SYSTEM IMPORT ADDRESS ;
30 EXPORT QUALIFIED Index, InitIndex, KillIndex, GetIndice, PutIndice,
31 HighIndice, LowIndice, InBounds, IsIndiceInIndex,
32 RemoveIndiceFromIndex, IncludeIndiceIntoIndex,
33 ForeachIndiceInIndexDo, DeleteIndice, DebugIndex ;
34
35 TYPE
36 Index ;
37 IndexProcedure = PROCEDURE (ADDRESS) ;
38
39
40 (*
41 InitIndex - creates and returns an Index.
42 *)
43
44 PROCEDURE InitIndex (low: CARDINAL) : Index ;
45
46
47 (*
48 KillIndex - returns Index to free storage.
49 *)
50
51 PROCEDURE KillIndex (i: Index) : Index ;
52
53
54 (*
55 DebugIndex - turns on debugging within an index.
56 *)
57
58 PROCEDURE 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
66 PROCEDURE InBounds (i: Index; n: CARDINAL) : BOOLEAN ;
67
68
69 (*
70 HighIndice - returns the last legally accessible indice of this array.
71 *)
72
73 PROCEDURE HighIndice (i: Index) : CARDINAL ;
74
75
76 (*
77 LowIndice - returns the first legally accessible indice of this array.
78 *)
79
80 PROCEDURE LowIndice (i: Index) : CARDINAL ;
81
82
83 (*
84 PutIndice - places, a, into the dynamic array at position i[n]
85 *)
86
87 PROCEDURE PutIndice (i: Index; n: CARDINAL; a: ADDRESS) ;
88
89
90 (*
91 GetIndice - retrieves, element i[n] from the dynamic array.
92 *)
93
94 PROCEDURE GetIndice (i: Index; n: CARDINAL) : ADDRESS ;
95
96
97 (*
98 IsIndiceInIndex - returns TRUE if, a, is in the index, i.
99 *)
100
101 PROCEDURE IsIndiceInIndex (i: Index; a: ADDRESS) : BOOLEAN ;
102
103
104 (*
105 RemoveIndiceFromIndex - removes, a, from Index, i.
106 *)
107
108 PROCEDURE RemoveIndiceFromIndex (i: Index; a: ADDRESS) ;
109
110
111 (*
112 DeleteIndice - delete i[j] from the array.
113 *)
114
115 PROCEDURE 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
123 PROCEDURE IncludeIndiceIntoIndex (i: Index; a: ADDRESS) ;
124
125
126 (*
127 ForeachIndiceInIndexDo - for each j indice of i, call procedure p(i[j])
128 *)
129
130 PROCEDURE ForeachIndiceInIndexDo (i: Index; p: IndexProcedure) ;
131
132
133 END Indexing.