GCCPY:
[official-gcc.git] / gcc / python / dot-dot.h
blobb1f59f022f5c6bd28f6f80e6a63b6ff42560e257
1 /* This file is part of GCC.
3 GCC is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 3, or (at your option)
6 any later version.
8 GCC is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with GCC; see the file COPYING3. If not see
15 <http://www.gnu.org/licenses/>. */
17 #ifndef __GCC_PY_DOTIL_H_
18 #define __GCC_PY_DOTIL_H__
20 /* DOT tree codes... */
21 typedef enum {
22 D_PRINT_STMT = 0,
23 D_IDENTIFIER,
25 D_MODIFY_EXPR,
26 D_MULT_EXPR,
27 D_DIVD_EXPR,
28 D_ADD_EXPR,
29 D_MINUS_EXPR,
31 D_SLICE,
33 D_T_INTEGER,
34 D_T_FLOAT,
35 D_T_STRING,
36 D_T_LIST,
38 D_CALL_EXPR,
39 D_ATTRIB_REF,
41 D_STRUCT_CLASS,
42 D_STRUCT_METHOD,
43 D_STRUCT_WHILE,
44 D_STRUCT_FOR,
46 D_D_EXPR,
47 D_TD_COM,
48 D_TD_DOT,
49 D_TD_NULL,
51 D_PRIMITIVE,
53 D_STRUCT_IF,
54 D_STRUCT_ELIF,
55 D_STRUCT_ELSE,
56 D_STRUCT_CONDITIONAL,
58 D_KEY_RETURN,
59 D_KEY_IMPORT,
61 D_EQ_EQ_EXPR,
62 D_LESS_EXPR,
63 D_LESS_EQ_EXPR,
64 D_GREATER_EXPR,
65 D_GREATER_EQ_EXPR,
66 D_NOT_EQ_EXPR
67 } opcode_t ;
69 typedef struct GTY(()) gpy_tree_common_dot_t {
70 opcode_t T;
71 union {
72 int integer;
73 unsigned char c;
74 const char * string;
75 } o;
76 } gpy_dot_tree_common ;
78 typedef struct GTY(()) gpy_tree_dot_t {
79 opcode_t T, FT, opaT, opbT;
80 /* location_t loc; */
81 struct gpy_tree_dot_t * field;
82 union {
83 struct gpy_tree_dot_t * t;
84 gpy_dot_tree_common * tc;
85 } opa;
86 union {
87 struct gpy_tree_dot_t * t;
88 gpy_dot_tree_common * tc;
89 } opb;
90 struct gpy_tree_dot_t * next;
91 } gpy_dot_tree_t ;
92 typedef gpy_dot_tree_t * gpydot;
94 #define DOT_TYPE(x) x->T
95 #define DOT_CHAIN(x) x->next
96 #define DOT_T_FIELD(x) x->FT
97 #define DOT_FIELD(x) x->field
99 #define DOT_lhs_T(x) x->opaT
100 #define DOT_rhs_T(x) x->opbT
102 #define DOT_lhs_TT(x) x->opa.t
103 #define DOT_rhs_TT(x) x->opb.t
104 #define DOT_lhs_TC(x) x->opa.tc
105 #define DOT_rhs_TC(x) x->opb.tc
107 #define NULL_DOT (gpy_dot_tree_t *)0
108 #define DOT_alloc (gpy_dot_tree_t *)xmalloc (sizeof (gpy_dot_tree_t))
109 #define DOT_CM_alloc (gpy_dot_tree_common *)xmalloc (sizeof (gpy_dot_tree_common))
111 #define DOT_IDENTIFIER_POINTER(x) \
112 DOT_lhs_TC(x)->o.string
114 extern gpy_dot_tree_t * dot_build_class_decl (gpy_dot_tree_t *, gpy_dot_tree_t *);
115 extern gpy_dot_tree_t * dot_build_func_decl (gpy_dot_tree_t *, gpy_dot_tree_t *,
116 gpy_dot_tree_t *);
117 extern gpy_dot_tree_t * dot_build_conditional_struct (gpy_dot_tree_t *, gpy_dot_tree_t *,
118 gpy_dot_tree_t *);
120 extern gpy_dot_tree_t * dot_build_decl1 (opcode_t, gpy_dot_tree_t *);
121 extern gpy_dot_tree_t * dot_build_decl2 (opcode_t, gpy_dot_tree_t *, gpy_dot_tree_t *);
123 extern gpy_dot_tree_t * dot_build_integer (int);
124 extern gpy_dot_tree_t * dot_build_string (char *);
125 extern gpy_dot_tree_t * dot_build_identifier (const char *);
126 extern gpy_dot_tree_t * dot_build_for (gpy_dot_tree_t *, gpy_dot_tree_t *, gpy_dot_tree_t *);
128 #endif /* __GCC_PY_DOTIL_H_ */