1 #ifndef _ASMITREE_H
2 #define _ASMITREE_H
3 /* asmitree.h */
4 /*****************************************************************************/
5 /* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only                     */
6 /*                                                                           */
7 /* AS-Portierung                                                             */
8 /*                                                                           */
9 /* Opcode-Abfrage als Binaerbaum                                             */
10 /*                                                                           */
11 /* Historie: 30.10.1996 Grundsteinlegung                                     */
12 /*            6.12.1998 dynamische Variante                                  */
13 /*                                                                           */
14 /*****************************************************************************/
15 
16 typedef void (*InstProc)(
17 #ifdef __PROTOS__
18 Word Index
19 #endif
20 );
21 
22 typedef struct _TInstTreeNode
23 {
24   struct _TInstTreeNode *Left,*Right;
25   InstProc Proc;
26   char *Name;
27   Word Index;
28   ShortInt Balance;
29 } TInstTreeNode,*PInstTreeNode;
30 
31 typedef struct _TInstTableEntry
32 {
33   InstProc Proc;
34   char *Name;
35   Word Index;
36   int Coll;
37 }
38 TInstTableEntry,*PInstTableEntry;
39 
40 struct sInstTable
41 {
42   int Fill,Size;
43   Boolean Dynamic;
44   PInstTableEntry Entries;
45 };
46 typedef struct sInstTable TInstTable;
47 typedef struct sInstTable *PInstTable;
48 
49 extern void AddInstTree(PInstTreeNode *Root, char *NName, InstProc NProc, Word NIndex);
50 
51 extern void ClearInstTree(PInstTreeNode *Root);
52 
53 extern Boolean SearchInstTree(PInstTreeNode Root, char *OpPart);
54 
55 extern void PrintInstTree(PInstTreeNode Root);
56 
57 
58 extern PInstTable CreateInstTable(int TableSize);
59 
60 extern void SetDynamicInstTable(PInstTable Table);
61 
62 extern void DestroyInstTable(PInstTable tab);
63 
64 extern void AddInstTable(PInstTable tab, const char *Name, Word Index, InstProc Proc);
65 
66 extern void RemoveInstTable(PInstTable tab, const char *Name);
67 
68 extern Boolean LookupInstTable(PInstTable tab, const char *Name);
69 
70 extern void PrintInstTable(FILE *stream, PInstTable tab);
71 
72 extern void asmitree_init(void);
73 
74 #endif /* _ASMITREE_H */
75