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