Mercurial > hg > index.cgi
comparison lwcc/tree.h @ 495:5b8871fd7503
Merged previous lwcc development branch into mainline.
author | William Astle <lost@l-w.ca> |
---|---|
date | Mon, 05 Aug 2019 21:27:09 -0600 |
parents | a3e277c58df9 |
children | 1bd2d590d734 |
comparison
equal
deleted
inserted
replaced
493:6073f4a33475 | 495:5b8871fd7503 |
---|---|
1 /* | |
2 lwcc/tree.h | |
3 | |
4 Copyright © 2013 William Astle | |
5 | |
6 This file is part of LWTOOLS. | |
7 | |
8 LWTOOLS is free software: you can redistribute it and/or modify it under the | |
9 terms of the GNU General Public License as published by the Free Software | |
10 Foundation, either version 3 of the License, or (at your option) any later | |
11 version. | |
12 | |
13 This program is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
16 more details. | |
17 | |
18 You should have received a copy of the GNU General Public License along with | |
19 this program. If not, see <http://www.gnu.org/licenses/>. | |
20 */ | |
21 | |
22 #ifndef tree_h_seen___ | |
23 #define tree_h_seen___ | |
24 | |
25 #include <stdio.h> | |
26 | |
27 /* the various node types */ | |
28 #define NODE_NONE 0 // a node with no type | |
29 #define NODE_PROGRAM 1 // the whole program | |
30 #define NODE_DECL 2 // a declaration | |
31 #define NODE_TYPE_CHAR 3 // a character type | |
32 #define NODE_TYPE_SHORT 4 // short int | |
33 #define NODE_TYPE_INT 5 // integer | |
34 #define NODE_TYPE_LONG 6 // long int | |
35 #define NODE_TYPE_LONGLONG 7 // long long | |
36 #define NODE_IDENT 8 // an identifier of some kind | |
37 #define NODE_TYPE_PTR 9 // a pointer | |
38 #define NODE_TYPE_SCHAR 10 // signed char | |
39 #define NODE_TYPE_UCHAR 11 // unsigned char | |
40 #define NODE_TYPE_USHORT 12 // unsigned short | |
41 #define NODE_TYPE_UINT 13 // unsigned int | |
42 #define NODE_TYPE_ULONG 14 // unsigned long | |
43 #define NODE_TYPE_ULONGLONG 15 // unsigned long long | |
44 #define NODE_TYPE_VOID 16 // void | |
45 #define NODE_TYPE_FLOAT 17 // float | |
46 #define NODE_TYPE_DOUBLE 18 // double | |
47 #define NODE_TYPE_LDOUBLE 19 // long double | |
48 #define NODE_FUNDEF 20 // function definition | |
49 #define NODE_FUNDECL 21 // function declaration | |
50 #define NODE_FUNARGS 22 // list of function args | |
51 #define NODE_BLOCK 23 // statement block | |
52 #define NODE_NUMTYPES 24 // the number of node types | |
53 | |
54 typedef struct node_s node_t; | |
55 | |
56 struct node_s | |
57 { | |
58 int type; // node type | |
59 char *strval; // any string value associated with the node | |
60 unsigned char ival[8]; // any 64 bit integer value associated with the node, signed or unsigned | |
61 node_t *children; // pointer to list of child nodes | |
62 node_t *next_child; // pointer to next child in the list | |
63 node_t *parent; // pointer to parent node | |
64 }; | |
65 | |
66 extern node_t *node_create(int, ...); | |
67 extern void node_destroy(node_t *); | |
68 extern void node_addchild(node_t *, node_t *); | |
69 extern void node_removechild(node_t *, node_t *); | |
70 extern void node_display(node_t *, FILE *); | |
71 extern void node_removechild_destroy(node_t *, node_t *); | |
72 | |
73 #endif // tree_h_seen___ |