* C-level.
*
* <@LOOP MARKNAME@>
+ * <@ SELF @>
* <@ENDLOOP@>
* Loop has predefined variables:
* __FIRST - true for first iteration
ExpressionNode,
PrintNode,
ConstNode,
+ NestNode,
/* value's types of variables */
valueInt = 200, /* smallest of any values type */
} 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;
- GList *rowValues;
+ LoopInstance upperInstance;
+ GList *rowValues; /*list of LoopRow */
} LoopInstanceData;
typedef struct TemplateNodeData {
/* IncludeNode */
char *includeFile;
+ /* NestNode */
+ struct {
+ TemplateNode loop;
+ LoopRow savedRowData;
+ GList *childrenLoopAfterSelf;
+ } nest;
+
/* 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;
+ /* listInstace -+
+ +->instance-+
+ +->row
+ |
+ |
+ +->row->nestedinstance
+ */
+ LoopRow lastRow;
+ LoopInstance currentInstance;
} loop;
/* ConditionNode */
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