X-Git-Url: http://sigaev.ru/git/gitweb.cgi?p=tedtools.git;a=blobdiff_plain;f=template.h;fp=template.h;h=7953de45dfe70fcff72275a5e0e3524ec8be0381;hp=6f8898947d7a279008f0772f238614c193e985fa;hb=60b6a26884b77fe6c6c37e714aa7a0c1b30e9fc7;hpb=a066d38b3fe615fc99dbe9eb3a0d0ad7f41135b6 diff --git a/template.h b/template.h index 6f88989..7953de4 100644 --- a/template.h +++ b/template.h @@ -38,7 +38,7 @@ * for all other. Currently, bool values have only "true"/"false" * string values * <@IF EXPRESSION @> - * <@ELSE@> + * [ <@ELSE@> ] * <@ENDIF@> * * Expression is classical with support following: @@ -63,7 +63,7 @@ * C-level. * * <@LOOP MARKNAME@> - * <@ SELF @> + * [ <@ SELF @> ] * <@ENDLOOP@> * Loop has predefined variables: * __FIRST - true for first iteration @@ -102,6 +102,12 @@ * setTemplateValueBool("outerLoop.var1"); * addTemplateRow("innerLoop"); * setTemplateValueBool("outerLoop.innerLoop.var2"); + * - addTemplateNestedLoop + * returnTemplateNestedLoop + * Manage self-nested loops ( ie tree-like structures ). + * Loop's template should contains one <@ SELF @> pointer. + * + * Examplaes of usage are in data/template.html used for test. * ****************************************************************************** * Memory management * @@ -109,8 +115,8 @@ * Unfortunatly, I'm too lazy to unify memory usage by several pieces * in library. So, library uses mixed plain malloc and memory context * concepts (tmalloc.h). - * To work with library it's needed to allocate persitent memory context - * for initTemplate() call and temprorary memory context for usual work. + * To work with library it's needed to allocate persistent memory context + * for initTemplate() call and provide temporary memory context for usual work. * after printTemplate is called it's needed to call resetTemplate() and * then resetMemoryContext() for second context. * @@ -251,7 +257,7 @@ typedef struct TemplateNodeData { struct { TemplateNode loop; LoopRow savedRowData; - GList *childrenLoopAfterSelf; + GList *childrenLoopAfterSelf; } nest; /* LoopNode */ @@ -259,7 +265,7 @@ typedef struct TemplateNodeData { char *varName; int varNameLength; TemplateNode bodyNode; - TemplateNode selfNode; + TemplateNode selfNode; /* pointer to self-nested plase to insert */ GList *childrenLoop; /* to reset loop's instance */ GList *listVarValues; /* list of loop variables */ GList *listInstance; @@ -268,7 +274,7 @@ typedef struct TemplateNodeData { +->row | | - +->row->nestedinstance + +->row->currentInstance */ LoopRow lastRow; LoopInstance currentInstance;