]>
Commit | Line | Data |
---|---|---|
1eee94d3 GM |
1 | /* do not edit automatically generated by mc from Indexing. */ |
2 | /* Indexing.def provides a dynamic indexing mechanism for CARDINAL. | |
3 | ||
83ffe9cd | 4 | Copyright (C) 2003-2023 Free Software Foundation, Inc. |
1eee94d3 GM |
5 | Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>. |
6 | ||
7 | This file is part of GNU Modula-2. | |
8 | ||
9 | GNU Modula-2 is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
11 | the Free Software Foundation; either version 3, or (at your option) | |
12 | any later version. | |
13 | ||
14 | GNU Modula-2 is distributed in the hope that it will be useful, but | |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | General Public License for more details. | |
18 | ||
19 | Under Section 7 of GPL version 3, you are granted additional | |
20 | permissions described in the GCC Runtime Library Exception, version | |
21 | 3.1, as published by the Free Software Foundation. | |
22 | ||
23 | You should have received a copy of the GNU General Public License and | |
24 | a copy of the GCC Runtime Library Exception along with this program; | |
25 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
26 | <http://www.gnu.org/licenses/>. */ | |
27 | ||
28 | ||
29 | #if !defined (_Indexing_H) | |
30 | # define _Indexing_H | |
31 | ||
32 | #include "config.h" | |
33 | #include "system.h" | |
34 | # ifdef __cplusplus | |
35 | extern "C" { | |
36 | # endif | |
37 | # if !defined (PROC_D) | |
38 | # define PROC_D | |
39 | typedef void (*PROC_t) (void); | |
40 | typedef struct { PROC_t proc; } PROC; | |
41 | # endif | |
42 | ||
43 | # include "GSYSTEM.h" | |
44 | ||
45 | # if defined (_Indexing_C) | |
46 | # define EXTERN | |
47 | # else | |
48 | # define EXTERN extern | |
49 | # endif | |
50 | ||
51 | #if !defined (Indexing_Index_D) | |
52 | # define Indexing_Index_D | |
53 | typedef void *Indexing_Index; | |
54 | #endif | |
55 | ||
56 | typedef struct Indexing_IndexProcedure_p Indexing_IndexProcedure; | |
57 | ||
58 | typedef void (*Indexing_IndexProcedure_t) (void *); | |
59 | struct Indexing_IndexProcedure_p { Indexing_IndexProcedure_t proc; }; | |
60 | ||
61 | ||
62 | /* | |
63 | InitIndex - creates and returns an Index. | |
64 | */ | |
65 | ||
66 | EXTERN Indexing_Index Indexing_InitIndex (unsigned int low); | |
67 | ||
68 | /* | |
69 | KillIndex - returns Index to free storage. | |
70 | */ | |
71 | ||
72 | EXTERN Indexing_Index Indexing_KillIndex (Indexing_Index i); | |
73 | ||
74 | /* | |
75 | DebugIndex - turns on debugging within an index. | |
76 | */ | |
77 | ||
78 | EXTERN Indexing_Index Indexing_DebugIndex (Indexing_Index i); | |
79 | ||
80 | /* | |
81 | InBounds - returns TRUE if indice, n, is within the bounds | |
82 | of the dynamic array. | |
83 | */ | |
84 | ||
85 | EXTERN unsigned int Indexing_InBounds (Indexing_Index i, unsigned int n); | |
86 | ||
87 | /* | |
88 | HighIndice - returns the last legally accessible indice of this array. | |
89 | */ | |
90 | ||
91 | EXTERN unsigned int Indexing_HighIndice (Indexing_Index i); | |
92 | ||
93 | /* | |
94 | LowIndice - returns the first legally accessible indice of this array. | |
95 | */ | |
96 | ||
97 | EXTERN unsigned int Indexing_LowIndice (Indexing_Index i); | |
98 | ||
99 | /* | |
100 | PutIndice - places, a, into the dynamic array at position i[n] | |
101 | */ | |
102 | ||
103 | EXTERN void Indexing_PutIndice (Indexing_Index i, unsigned int n, void * a); | |
104 | ||
105 | /* | |
106 | GetIndice - retrieves, element i[n] from the dynamic array. | |
107 | */ | |
108 | ||
109 | EXTERN void * Indexing_GetIndice (Indexing_Index i, unsigned int n); | |
110 | ||
111 | /* | |
112 | IsIndiceInIndex - returns TRUE if, a, is in the index, i. | |
113 | */ | |
114 | ||
115 | EXTERN unsigned int Indexing_IsIndiceInIndex (Indexing_Index i, void * a); | |
116 | ||
117 | /* | |
118 | RemoveIndiceFromIndex - removes, a, from Index, i. | |
119 | */ | |
120 | ||
121 | EXTERN void Indexing_RemoveIndiceFromIndex (Indexing_Index i, void * a); | |
122 | ||
123 | /* | |
124 | DeleteIndice - delete i[j] from the array. | |
125 | */ | |
126 | ||
127 | EXTERN void Indexing_DeleteIndice (Indexing_Index i, unsigned int j); | |
128 | ||
129 | /* | |
130 | IncludeIndiceIntoIndex - if the indice is not in the index, then | |
131 | add it at the end. | |
132 | */ | |
133 | ||
134 | EXTERN void Indexing_IncludeIndiceIntoIndex (Indexing_Index i, void * a); | |
135 | ||
136 | /* | |
137 | ForeachIndiceInIndexDo - for each j indice of i, call procedure p(i[j]) | |
138 | */ | |
139 | ||
140 | EXTERN void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_IndexProcedure p); | |
141 | # ifdef __cplusplus | |
142 | } | |
143 | # endif | |
144 | ||
145 | # undef EXTERN | |
146 | #endif |