X-Git-Url: http://sigaev.ru/git/gitweb.cgi?p=tedtools.git;a=blobdiff_plain;f=template.h;fp=template.h;h=6f8898947d7a279008f0772f238614c193e985fa;hp=9061e30da980e7cfbf5cd582bfee402754362e89;hb=a066d38b3fe615fc99dbe9eb3a0d0ad7f41135b6;hpb=1562fc9176be457277437d8154279957fe1e394e diff --git a/template.h b/template.h index 9061e30..6f88989 100644 --- a/template.h +++ b/template.h @@ -63,6 +63,7 @@ * C-level. * * <@LOOP MARKNAME@> + * <@ SELF @> * <@ENDLOOP@> * Loop has predefined variables: * __FIRST - true for first iteration @@ -135,6 +136,7 @@ typedef enum TemplateNodeType { ExpressionNode, PrintNode, ConstNode, + NestNode, /* value's types of variables */ valueInt = 200, /* smallest of any values type */ @@ -188,9 +190,20 @@ typedef struct executeFunctionDescData { } 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 { @@ -234,14 +247,31 @@ 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 */ @@ -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 addTemplateNestedLoop( Template tmpl, char * key); +int returnTemplateNestedLoop( Template tmpl, char * key); void dumpTemplate( Template tmpl ); #endif