projects
/
tedtools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add recursive loop to support tree-like structures
[tedtools.git]
/
template.h
diff --git
a/template.h
b/template.h
index
9061e30
..
6f88989
100644
(file)
--- a/
template.h
+++ b/
template.h
@@
-63,6
+63,7
@@
* C-level.
*
* <@LOOP MARKNAME@>
* C-level.
*
* <@LOOP MARKNAME@>
+ * <@ SELF @>
* <@ENDLOOP@>
* Loop has predefined variables:
* __FIRST - true for first iteration
* <@ENDLOOP@>
* Loop has predefined variables:
* __FIRST - true for first iteration
@@
-135,6
+136,7
@@
typedef enum TemplateNodeType {
ExpressionNode,
PrintNode,
ConstNode,
ExpressionNode,
PrintNode,
ConstNode,
+ NestNode,
/* value's types of variables */
valueInt = 200, /* smallest of any values type */
/* value's types of variables */
valueInt = 200, /* smallest of any values type */
@@
-188,9
+190,20
@@
typedef struct executeFunctionDescData {
} executeFunctionDescData;
typedef struct LoopInstanceData * LoopInstance;
} executeFunctionDescData;
typedef struct LoopInstanceData * LoopInstance;
+
+typedef struct LoopRowData *LoopRow;
+
+typedef struct LoopRowData {
+ TemplateNode loop;
+ LoopInstance nestedInstance;
+ VariableValueData varvals[1];
+} LoopRowData;
+#define LRDHDRSZ (offsetof(LoopRowData, varvals))
+
typedef struct LoopInstanceData {
int nrow;
typedef struct LoopInstanceData {
int nrow;
- GList *rowValues;
+ LoopInstance upperInstance;
+ GList *rowValues; /*list of LoopRow */
} LoopInstanceData;
typedef struct TemplateNodeData {
} LoopInstanceData;
typedef struct TemplateNodeData {
@@
-234,14
+247,31
@@
typedef struct TemplateNodeData {
/* IncludeNode */
char *includeFile;
/* IncludeNode */
char *includeFile;
+ /* NestNode */
+ struct {
+ TemplateNode loop;
+ LoopRow savedRowData;
+ GList *childrenLoopAfterSelf;
+ } nest;
+
/* LoopNode */
struct {
char *varName;
int varNameLength;
TemplateNode bodyNode;
/* LoopNode */
struct {
char *varName;
int varNameLength;
TemplateNode bodyNode;
+ TemplateNode selfNode;
GList *childrenLoop; /* to reset loop's instance */
GList *listVarValues; /* list of loop variables */
GList *listInstance;
GList *childrenLoop; /* to reset loop's instance */
GList *listVarValues; /* list of loop variables */
GList *listInstance;
+ /* listInstace -+
+ +->instance-+
+ +->row
+ |
+ |
+ +->row->nestedinstance
+ */
+ LoopRow lastRow;
+ LoopInstance currentInstance;
} loop;
/* ConditionNode */
} loop;
/* ConditionNode */
@@
-292,6
+322,7
@@
int setTemplateValueBool( Template tmpl, char * key, int val );
int setTemplateValueUndefined( Template tmpl, char * key );
int setTemplateValueDouble( Template tmpl, char * key, double val );
int addTemplateRow( Template tmpl, char * key );
int setTemplateValueUndefined( Template tmpl, char * key );
int setTemplateValueDouble( Template tmpl, char * key, double val );
int addTemplateRow( Template tmpl, char * key );
-
+int addTemplateNestedLoop( Template tmpl, char * key);
+int returnTemplateNestedLoop( Template tmpl, char * key);
void dumpTemplate( Template tmpl );
#endif
void dumpTemplate( Template tmpl );
#endif