]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/mc-boot/GsymbolKey.h
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / mc-boot / GsymbolKey.h
1 /* do not edit automatically generated by mc from symbolKey. */
2 /* symbolKey.def provides binary tree operations for storing symbols.
3
4 Copyright (C) 2015-2024 Free Software Foundation, Inc.
5 Contributed by Gaius Mulley <gaius@glam.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 You should have received a copy of the GNU General Public License
20 along with GNU Modula-2; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
22
23
24 #if !defined (_symbolKey_H)
25 # define _symbolKey_H
26
27 #include "config.h"
28 #include "system.h"
29 # ifdef __cplusplus
30 extern "C" {
31 # endif
32 #include <stdbool.h>
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 #if defined(__cplusplus)
40 # undef NULL
41 # define NULL 0
42 #endif
43 # include "GSYSTEM.h"
44 # include "GnameKey.h"
45
46 # if defined (_symbolKey_C)
47 # define EXTERN
48 # else
49 # define EXTERN extern
50 # endif
51
52 # define symbolKey_NulKey NULL
53 #if !defined (symbolKey_symbolTree_D)
54 # define symbolKey_symbolTree_D
55 typedef void *symbolKey_symbolTree;
56 #endif
57
58 typedef struct symbolKey_isSymbol_p symbolKey_isSymbol;
59
60 typedef struct symbolKey_performOperation_p symbolKey_performOperation;
61
62 typedef bool (*symbolKey_isSymbol_t) (void *);
63 struct symbolKey_isSymbol_p { symbolKey_isSymbol_t proc; };
64
65 typedef void (*symbolKey_performOperation_t) (void *);
66 struct symbolKey_performOperation_p { symbolKey_performOperation_t proc; };
67
68
69 /*
70 initTree - initializes a symbolTree pointed to by t.
71 */
72
73 EXTERN symbolKey_symbolTree symbolKey_initTree (void);
74
75 /*
76 killTree - destroys the symbolTree pointed to by t.
77 */
78
79 EXTERN void symbolKey_killTree (symbolKey_symbolTree *t);
80
81 /*
82 getSymKey - searches the symbolTree t for an entry name. If
83 found then the key is returned otherwise NulKey
84 is returned.
85 */
86
87 EXTERN void * symbolKey_getSymKey (symbolKey_symbolTree t, nameKey_Name name);
88
89 /*
90 putSymKey - puts an symbol entry, name, in the symbolTree t.
91 SymKey is the value stored with name.
92 */
93
94 EXTERN void symbolKey_putSymKey (symbolKey_symbolTree t, nameKey_Name name, void * key);
95
96 /*
97 delSymKey - deletes a symbol entry name in the symbolTree, t.
98 */
99
100 EXTERN void symbolKey_delSymKey (symbolKey_symbolTree t, nameKey_Name name);
101
102 /*
103 isEmptyTree - returns true if symbolTree, t, is empty.
104 */
105
106 EXTERN bool symbolKey_isEmptyTree (symbolKey_symbolTree t);
107
108 /*
109 doesTreeContainAny - returns true if symbolTree, t, contains any
110 symbols which in turn return true when procedure,
111 p, is called with a symbol as its parameter.
112 */
113
114 EXTERN bool symbolKey_doesTreeContainAny (symbolKey_symbolTree t, symbolKey_isSymbol p);
115
116 /*
117 foreachNodeDo - for each node in symbolTree, t, a procedure, p,
118 is called with the node symbol as its parameter.
119 It traverse the tree in order.
120 */
121
122 EXTERN void symbolKey_foreachNodeDo (symbolKey_symbolTree t, symbolKey_performOperation p);
123 # ifdef __cplusplus
124 }
125 # endif
126
127 # undef EXTERN
128 #endif