Tenncor
def.h
Go to the documentation of this file.
1 
9 #include <stdio.h>
10 
11 #include "opt/parse/list.h"
12 
13 #ifndef PARSE_DEF_H
14 #define PARSE_DEF_H
15 
17 struct Branch
18 {
19  int is_group_;
20  struct PtrList* args_;
21  char label_[32];
22  char variadic_[32];
23 };
24 
27 {
29  SCALAR = 0,
31  ANY,
34 };
35 
37 struct Subgraph
38 {
42  union
43  {
44  double scalar_;
45  char* any_;
46  struct Branch* branch_;
47  } val_;
48 };
49 
51 void subgraph_recursive_free (struct Subgraph* sg);
52 
54 struct Arg
55 {
58 
60  struct NumList* shaper_;
61 
63  struct NumList* coorder_;
64 };
65 
67 void arg_recursive_free (struct Arg* arg);
68 
70 struct Conversion
71 {
73  struct Subgraph* source_;
74 
76  struct Subgraph* dest_;
77 };
78 
80 void conversion_recursive_free (struct Conversion* conv);
81 
84 struct Property
85 {
87  char label_[32];
88 
90  char property_[32];
91 
93  int is_group_;
94 };
95 
98 {
105 };
106 
108 struct Statement
109 {
112 
116  void* val_;
117 };
118 
121 {
124 };
125 
130 void statement_recursive_free (void* ptr);
131 
132 #ifdef __cplusplus
133 extern "C" {
134 #endif
135 
137 extern void statements_free (struct PtrList* stmts);
138 
140 extern int parse_str (struct PtrList** stmts, const char* str);
141 
143 extern int parse_file (struct PtrList** stmts, FILE* file);
144 
145 #ifdef __cplusplus
146 }
147 #endif
148 
149 #endif // PARSE_DEF_H
void subgraph_recursive_free(struct Subgraph *sg)
Recursively free the subgraph and all of its descendants.
STMT_TYPE
Statement type enum.
Definition: def.h:97
Pointer linked list.
Definition: list.h:59
Definition: def.h:123
char label_[32]
Functor/group label as it appears in rule tree.
Definition: def.h:87
struct Branch * branch_
Definition: def.h:46
Symbol definition (declaration of ANY nodes)
Definition: def.h:100
struct Subgraph * dest_
Rule tree to convert to given the source tree&#39;s identified ANY children.
Definition: def.h:76
int is_group_
Is 1 if the label refers to a group, otherwise it&#39;s functor.
Definition: def.h:93
Rule tree conversion statement.
Definition: def.h:104
Argument for a branching node.
Definition: def.h:54
int parse_str(struct PtrList **stmts, const char *str)
Return 0 if successfully populate statements from parsed string.
enum SUBGRAPH_TYPE type_
Type of the node.
Definition: def.h:40
int is_group_
Definition: def.h:19
Represent a conversion between two rule trees.
Definition: def.h:70
void * val_
Definition: def.h:116
enum STMT_TYPE type_
Statement type.
Definition: def.h:111
Decimal linked list.
Definition: list.h:26
Branching node.
Definition: def.h:33
void arg_recursive_free(struct Arg *arg)
Recursively free the argument and all it&#39;s contents.
struct NumList * shaper_
Shape mapping meta-data.
Definition: def.h:60
struct PtrList * args_
Definition: def.h:20
Branching (Functor or Group) node.
Definition: def.h:17
struct NumList * coorder_
Coordinate mapping meta-data.
Definition: def.h:63
void conversion_recursive_free(struct Conversion *conv)
Recursively free the conversion and its subgraphs.
Rule tree leaf that represents any real node.
Definition: def.h:31
Rule tree node.
Definition: def.h:37
char variadic_[32]
Definition: def.h:22
void statements_free(struct PtrList *stmts)
Recursively free all statements and their contents.
Definition: def.h:122
SUBGRAPH_TYPE
Rule tree node type.
Definition: def.h:26
PTR_TYPE
Pointer enumeration to store in PtrList.
Definition: def.h:120
struct Subgraph * source_
Rule tree to target for conversion.
Definition: def.h:73
union Subgraph::@0 val_
Node instance according to type.
char property_[32]
Property of the group/functor.
Definition: def.h:90
char label_[32]
Definition: def.h:21
Property association statement.
Definition: def.h:102
struct Subgraph * subgraph_
Subgraph node.
Definition: def.h:57
double scalar_
Definition: def.h:44
Definition: def.h:84
Generic statement representation.
Definition: def.h:108
void statement_recursive_free(void *ptr)
Definitive scalar constant.
Definition: def.h:29
int parse_file(struct PtrList **stmts, FILE *file)
Return 0 if successfully populate statements from parsed file.
char * any_
Definition: def.h:45