WCHandlerFunc HandlerFunc;
}HashHandler;
-void *load_template(StrBuf *filename, StrBuf *Key, HashList *PutThere);
+void *load_template(WCTemplate *NewTemplate);
int EvaluateConditional(StrBuf *Target, int Neg, int state, WCTemplputParams *TP);
"Context MIME_ATACH",
"Context FILELIST",
"Context STRBUF",
+ "Context STRBUFARR",
"Context LONGVECTOR",
"Context ROOMS",
"Context FLOORS",
void LogTemplateError (StrBuf *Target, const char *Type, int ErrorPos, WCTemplputParams *TP, const char *Format, ...)
{
wcsession *WCC;
- StrBuf *Header;
StrBuf *Error;
StrBuf *Info;
va_list arg_ptr;
va_end(arg_ptr);
switch (ErrorPos) {
- default:
case ERR_NAME: /* the main token name... */
Err = (TP->Tokens!= NULL)? TP->Tokens->pName:"";
break;
- case ERR_PARM1:
- Err = ((TP->Tokens!= NULL) &&
- (TP->Tokens->nParameters > 0))?
- TP->Tokens->Params[0]->Start : "";
- break;
- case ERR_PARM2:
+ default:
Err = ((TP->Tokens!= NULL) &&
- (TP->Tokens->nParameters > 1))?
- TP->Tokens->Params[1]->Start : "";
+ (TP->Tokens->nParameters > ErrorPos - 1))?
+ TP->Tokens->Params[ErrorPos - 1]->Start : "";
break;
}
if (TP->Tokens != NULL)
return;
}
- Header = NewStrBuf();
+ if (WCC->WFBuf == NULL) WCC->WFBuf = NewStrBuf();
if (TP->Tokens != NULL)
{
/* deprecated:
ChrPtr(TP->Tokens->FlatToken));
- SerializeJson(Header, WildFireException(SKEY(TP->Tokens->FileName),
+ SerializeJson(WCC->WFBuf, WildFireException(SKEY(TP->Tokens->FileName),
TP->Tokens->Line,
Info,
1), 1);
Error,
eERROR), 1);
*/
- WildFireSerializePayload(Header, WCC->HBuf, &WCC->Hdr->nWildfireHeaders, NULL);
+
}
else
{
Err,
ChrPtr(Error),
ChrPtr(TP->Tokens->FlatToken));
- SerializeJson(Header, WildFireException(HKEY(__FILE__), __LINE__, Info, 1), 1);
- WildFireSerializePayload(Header, WCC->HBuf, &WCC->Hdr->nWildfireHeaders, NULL);
+ SerializeJson(WCC->WFBuf, WildFireException(HKEY(__FILE__), __LINE__, Info, 1), 1);
}
- FreeStrBuf(&Header);
FreeStrBuf(&Info);
FreeStrBuf(&Error);
/*
void LogError (StrBuf *Target, const char *Type, const char *Format, ...)
{
wcsession *WCC;
- StrBuf *Header;
StrBuf *Error;
StrBuf *Info;
va_list arg_ptr;
lprintf(1, ChrPtr(Error));
WCC = WC;
- Header = NewStrBuf();
+ if (WCC->WFBuf == NULL) WCC->WFBuf = NewStrBuf();
+ SerializeJson(WCC->WFBuf, WildFireException(Type, strlen(Type),
+ 0,
+ Info,
+ 1), 1);
- SerializeJson(Header, WildFireException(Type, strlen(Type),
- 0,
- Info,
- 1), 1);
- WildFireSerializePayload(Header, WCC->HBuf, &WCC->Hdr->nWildfireHeaders, NULL);
-
- FreeStrBuf(&Header);
FreeStrBuf(&Info);
FreeStrBuf(&Error);
/*
clear_substs (WC);
}
-int NeedNewBuf(type)
+int NeedNewBuf(int type)
{
switch(type) {
case WCS_STRING:
}
}
+int HaveTemplateTokenString(StrBuf *Target,
+ WCTemplputParams *TP,
+ int N,
+ const char **Value,
+ long *len)
+{
+ if (N >= TP->Tokens->nParameters) {
+ return 0;
+ }
+
+ switch (TP->Tokens->Params[N]->Type) {
+ case TYPE_INTDEFINE:
+ case TYPE_STR:
+ case TYPE_BSTR:
+ case TYPE_PREFSTR:
+ case TYPE_GETTEXT:
+ case TYPE_SUBTEMPLATE:
+ return 1;
+ case TYPE_LONG:
+ case TYPE_PREFINT:
+ default:
+ return 0;
+ }
+}
+
void GetTemplateTokenString(StrBuf *Target,
WCTemplputParams *TP,
int N,
if (Template->TokenSpace <= 0) {
Template->Tokens = (WCTemplateToken**)malloc(
sizeof(WCTemplateToken*) * 10);
- memset(Template->Tokens, 0, sizeof(WCTemplateToken*));
+ memset(Template->Tokens, 0, sizeof(WCTemplateToken*) * 10);
Template->TokenSpace = 10;
}
else {
WCTemplateToken **NewTokens;
- NewTokens= (WCTemplateToken**)malloc(
- sizeof(WCTemplateToken*) *
- Template->TokenSpace * 2);
- memcpy(NewTokens, Template->Tokens,
+
+ NewTokens= (WCTemplateToken**) malloc(
+ sizeof(WCTemplateToken*) * Template->TokenSpace * 2);
+
+ memset(NewTokens,
+ 0, sizeof(WCTemplateToken*) * Template->TokenSpace * 2);
+
+ memcpy(NewTokens,
+ Template->Tokens,
sizeof(WCTemplateToken*) * Template->nTokensUsed);
+
free(Template->Tokens);
Template->TokenSpace *= 2;
Template->Tokens = NewTokens;
Template->Tokens[(Template->nTokensUsed)++] = NewToken;
}
-TemplateParam *GetNextParameter(StrBuf *Buf,
- const char **pCh,
- const char *pe,
- WCTemplateToken *Tokens,
- WCTemplate *pTmpl,
- WCTemplputParams *TP)
+int GetNextParameter(StrBuf *Buf,
+ const char **pCh,
+ const char *pe,
+ WCTemplateToken *Tokens,
+ WCTemplate *pTmpl,
+ WCTemplputParams *TP,
+ TemplateParam **pParm)
{
const char *pch = *pCh;
const char *pchs, *pche;
char quote = '\0';
int ParamBrace = 0;
- Parm = (TemplateParam *) malloc(sizeof(TemplateParam));
+ *pParm = Parm = (TemplateParam *) malloc(sizeof(TemplateParam));
memset(Parm, 0, sizeof(TemplateParam));
Parm->Type = TYPE_STR;
*pCh);
pch ++;
free(Parm);
- return NULL;
+ *pParm = NULL;
+ return 0;
}
else {
StrBufPeek(Buf, pch, -1, '\0');
*pCh);
*/
free(Parm);
- return NULL;
+ *pParm = NULL;
+ return 0;
}
}
while ((*pch == ' ' )||
(*pch == ',' )||
(*pch == '\n')) pch ++;
- if (DumpTemplateI18NStrings && (Parm->Type == TYPE_GETTEXT)) {
- StrBufAppendPrintf(I18nDump, "_(\"%s\");\n", Parm->Start);
- }
- if (Parm->Type == TYPE_INTDEFINE)
+ switch (Parm->Type)
{
+ case TYPE_GETTEXT:
+ if (DumpTemplateI18NStrings) {
+ StrBufAppendPrintf(I18nDump, "_(\"%s\");\n", Parm->Start);
+ }
+ break;
+ case TYPE_INTDEFINE: {
void *vPVal;
-
+
if (GetHash(Defines, Parm->Start, Parm->len, &vPVal) &&
(vPVal != NULL))
{
}
else
{
- LogTemplateError(NULL, "Define", ERR_PARM1, TP,
+ LogTemplateError(NULL, "Define",
+ Tokens->nParameters,
+ TP,
"%s isn't known!!",
Parm->Start);
- }
+ }}
+ break;
+ case TYPE_SUBTEMPLATE:{
+ void *vTmpl;
+ /* well, we don't check the mobile stuff here... */
+ if (!GetHash(LocalTemplateCache, Parm->Start, Parm->len, &vTmpl) &&
+ !GetHash(TemplateCache, Parm->Start, Parm->len, &vTmpl)) {
+ LogTemplateError(NULL,
+ "SubTemplate",
+ Tokens->nParameters,
+ TP,
+ "referenced here doesn't exist");
+ }}
+ break;
}
*pCh = pch;
- return Parm;
+ return 1;
}
WCTemplateToken *NewTemplateSubstitute(StrBuf *Buf,
const char *pStart,
- const char *pTmplStart,
- const char *pTmplEnd,
+ const char *pTokenStart,
+ const char *pTokenEnd,
long Line,
WCTemplate *pTmpl)
{
void *vVar;
const char *pch;
- TemplateParam *Param;
WCTemplateToken *NewToken;
WCTemplputParams TP;
NewToken->FileName = pTmpl->FileName; /* to print meaningfull log messages... */
NewToken->Flags = 0;
NewToken->Line = Line + 1;
- NewToken->pTokenStart = pTmplStart;
- NewToken->TokenStart = pTmplStart - pStart;
- NewToken->TokenEnd = (pTmplEnd - pStart) - NewToken->TokenStart;
- NewToken->pTokenEnd = pTmplEnd;
+ NewToken->pTokenStart = pTokenStart;
+ NewToken->TokenStart = pTokenStart - pStart;
+ NewToken->TokenEnd = (pTokenEnd - pStart) - NewToken->TokenStart;
+ NewToken->pTokenEnd = pTokenEnd;
NewToken->NameEnd = NewToken->TokenEnd - 2;
NewToken->PreEval = NULL;
- NewToken->FlatToken = NewStrBufPlain(pTmplStart + 2, pTmplEnd - pTmplStart - 2);
+ NewToken->FlatToken = NewStrBufPlain(pTokenStart + 2, pTokenEnd - pTokenStart - 2);
StrBufShrinkToFit(NewToken->FlatToken, 1);
- StrBufPeek(Buf, pTmplStart, + 1, '\0');
- StrBufPeek(Buf, pTmplEnd, -1, '\0');
- pch = NewToken->pName = pTmplStart + 2;
+ StrBufPeek(Buf, pTokenStart, + 1, '\0');
+ StrBufPeek(Buf, pTokenEnd, -1, '\0');
+ pch = NewToken->pName = pTokenStart + 2;
NewToken->HaveParameters = 0;;
NewToken->nParameters = 0;
- while (pch < pTmplEnd - 1) {
+ while (pch < pTokenEnd - 1) {
if (*pch == '(') {
StrBufPeek(Buf, pch, -1, '\0');
NewToken->NameEnd = pch - NewToken->pName;
pch ++;
- if (*(pTmplEnd - 1) != ')') {
+ if (*(pTokenEnd - 1) != ')') {
LogTemplateError(
NULL, "Parseerror", ERR_NAME, &TP,
"Warning, Non welformed Token; missing right parenthesis");
}
- while (pch < pTmplEnd - 1) {
- Param = GetNextParameter(Buf, &pch, pTmplEnd - 1, NewToken, pTmpl, &TP);
- if (Param != NULL) {
+ while (pch < pTokenEnd - 1) {
+ NewToken->nParameters++;
+ if (GetNextParameter(Buf,
+ &pch,
+ pTokenEnd - 1,
+ NewToken,
+ pTmpl,
+ &TP,
+ &NewToken->Params[NewToken->nParameters - 1]))
+ {
NewToken->HaveParameters = 1;
if (NewToken->nParameters > MAXPARAM) {
LogTemplateError(
"only [%d] Params allowed in Tokens",
MAXPARAM);
- free(Param);
FreeToken(&NewToken);
return NULL;
}
- NewToken->Params[NewToken->nParameters++] = Param;
}
else break;
}
NewToken->nParameters);
break;
}
+ else {
+ void *vTmpl;
+ /* well, we don't check the mobile stuff here... */
+ if (!GetHash(LocalTemplateCache,
+ NewToken->Params[0]->Start,
+ NewToken->Params[0]->len,
+ &vTmpl) &&
+ !GetHash(TemplateCache,
+ NewToken->Params[0]->Start,
+ NewToken->Params[0]->len,
+ &vTmpl)) {
+ LogTemplateError(
+ NULL, "SubTemplate", ERR_PARM1, &TP,
+ "doesn't exist");
+ }
+ }
break;
case SV_CUST_STR_CONDITIONAL:
case SV_CONDITIONAL:
StrBufAppendBufPlain(NewTemplate->MimeType, HKEY("; charset=utf-8"), 0);
}
+ if (strstr(ChrPtr(NewTemplate->MimeType), "text") != NULL) {
+ StrBufAppendBufPlain(NewTemplate->MimeType, HKEY("; charset=utf-8"), 0);
+ }
+
Put(PutThere, ChrPtr(Key), StrLength(Key), NewTemplate, FreeWCTemplate);
return NewTemplate;
}
* \brief Display a variable-substituted template
* \param templatename template file to load
*/
-void *load_template(StrBuf *filename, StrBuf *Key, HashList *PutThere)
+void *duplicate_template(WCTemplate *OldTemplate)
+{
+ WCTemplate *NewTemplate;
+
+ NewTemplate = (WCTemplate *) malloc(sizeof(WCTemplate));
+ memset(NewTemplate, 0, sizeof(WCTemplate));
+ NewTemplate->Data = NULL;
+ NewTemplate->FileName = NewStrBufDup(OldTemplate->FileName);
+ StrBufShrinkToFit(NewTemplate->FileName, 1);
+ NewTemplate->nTokensUsed = 0;
+ NewTemplate->TokenSpace = 0;
+ NewTemplate->Tokens = NULL;
+ NewTemplate->MimeType = NewStrBufDup(OldTemplate->MimeType);
+ return NewTemplate;
+}
+
+/**
+ * \brief Display a variable-substituted template
+ * \param templatename template file to load
+ */
+void *load_template(WCTemplate *NewTemplate)
{
int fd;
struct stat statbuf;
const char *pS, *pE, *pch, *Err;
long Line;
int pos;
- WCTemplate *NewTemplate;
- fd = open(ChrPtr(filename), O_RDONLY);
+ fd = open(ChrPtr(NewTemplate->FileName), O_RDONLY);
if (fd <= 0) {
lprintf(1, "ERROR: could not open template '%s' - %s\n",
- ChrPtr(filename), strerror(errno));
+ ChrPtr(NewTemplate->FileName), strerror(errno));
return NULL;
}
if (fstat(fd, &statbuf) == -1) {
lprintf(1, "ERROR: could not stat template '%s' - %s\n",
- ChrPtr(filename), strerror(errno));
+ ChrPtr(NewTemplate->FileName), strerror(errno));
return NULL;
}
- NewTemplate = (WCTemplate *) malloc(sizeof(WCTemplate));
- memset(NewTemplate, 0, sizeof(WCTemplate));
- NewTemplate->Data = NewStrBufPlain(NULL, statbuf.st_size);
- NewTemplate->FileName = NewStrBufDup(filename);
- NewTemplate->nTokensUsed = 0;
- NewTemplate->TokenSpace = 0;
- NewTemplate->Tokens = NULL;
- NewTemplate->MimeType = NewStrBufPlain(GuessMimeByFilename (SKEY(NewTemplate->FileName)), -1);
- if (strstr(ChrPtr(NewTemplate->MimeType), "text") != NULL) {
- StrBufAppendBufPlain(NewTemplate->MimeType, HKEY("; charset=utf-8"), 0);
- }
-
+ NewTemplate->Data = NewStrBufPlain(NULL, statbuf.st_size + 1);
if (StrBufReadBLOB(NewTemplate->Data, &fd, 1, statbuf.st_size, &Err) < 0) {
close(fd);
- FreeWCTemplate(NewTemplate);
lprintf(1, "ERROR: reading template '%s' - %s<br />\n",
- ChrPtr(filename), strerror(errno));
+ ChrPtr(NewTemplate->FileName), strerror(errno));
+ //FreeWCTemplate(NewTemplate);/////tODO
return NULL;
}
close(fd);
NewTemplateSubstitute(NewTemplate->Data, pS, pts, pte, Line, NewTemplate));
pch ++;
}
- if (LoadTemplates == 0)
- Put(PutThere, ChrPtr(Key), StrLength(Key), NewTemplate, FreeWCTemplate);
return NewTemplate;
}
(strcmp(&filedir_entry->d_name[d_without_ext], ".swp") == 0))
continue; /* Ignore backup files... */
/* .m.xxx is for mobile useragents! */
+ IsMobile = 0;
if (d_without_ext > 2)
IsMobile = (filedir_entry->d_name[d_without_ext - 1] == 'm') &&
(filedir_entry->d_name[d_without_ext - 2] == '.');
if (LoadTemplates >= 1)
lprintf(1, "%s %d %s\n", ChrPtr(FileName), IsMobile, ChrPtr(Key));
- if (LoadTemplates == 0)
- load_template(FileName, Key, (IsMobile)?wireless:big);
- else
- prepare_template(FileName, Key, (IsMobile)?wireless:big);
+ prepare_template(FileName, Key, (IsMobile)?wireless:big);
default:
break;
}
void InitTemplateCache(void)
{
+ int i;
StrBuf *Key;
StrBuf *Dir;
+ HashList *Templates[4];
Dir = NewStrBuf();
Key = NewStrBuf();
WirelessTemplateCache,
TemplateCache,
Key);
+ Templates[0] = WirelessTemplateCache;
+ Templates[1] = TemplateCache;
+ Templates[2] = WirelessLocalTemplateCache;
+ Templates[3] = LocalTemplateCache;
+
+
+ if (LoadTemplates == 0)
+ for (i=0; i < 4; i++) {
+ const char *Key;
+ long KLen;
+ HashPos *At;
+ void *vTemplate;
+
+ At = GetNewHashPos(Templates[i], 0);
+ while (GetNextHashPos(Templates[i],
+ At,
+ &KLen,
+ &Key,
+ &vTemplate) &&
+ (vTemplate != NULL))
+ {
+ load_template((WCTemplate *)vTemplate);
+ }
+ DeleteHashPos(&At);
+ }
FreeStrBuf(&Dir);
if (LoadTemplates > 1)
lprintf(1, "DBG: ----- loading: [%s] ------ \n",
ChrPtr(Tmpl->FileName));
-
- pTmpl = load_template(Tmpl->FileName, NULL, NULL);
- if(pTmpl == NULL) {
+ pTmpl = duplicate_template(Tmpl);
+ if(load_template(pTmpl) == NULL) {
StrBufAppendPrintf(
Target,
"<pre>\nError loading Template [%s]\n See Logfile for details\n</pre>\n",
ChrPtr(Tmpl->FileName));
+ FreeWCTemplate(pTmpl);
return NULL;
}
{
WCTemplputParams TPP;
WCTemplputParams *TP;
+ void *vTmpl;
void *vIt;
memset(&TPP, 0, sizeof(WCTemplputParams));
"not found");
return 0;
}
+ if (TP->Tokens->Params[1]->Type != TYPE_SUBTEMPLATE) {
+ LogTemplateError(NULL, "Iterator", ERR_PARM1, TP,
+ "Need token with type Subtemplate as param 1, have %s",
+ TP->Tokens->Params[1]->Start);
+ }
+
+ /* well, we don't check the mobile stuff here... */
+ if (!GetHash(LocalTemplateCache, TKEY(1), &vTmpl) &&
+ !GetHash(TemplateCache, TKEY(1), &vTmpl)) {
+ LogTemplateError(NULL, "SubTemplate", ERR_PARM1, TP,
+ "referenced here doesn't exist");
+ }
Token->Preeval2 = vIt;
return 1;
}
Put(Defines, Name, len, PVal, NULL);
}
+long GetTokenDefine(const char *Name, long len,
+ long DefValue)
+{
+ void *vPVal;
+
+ if (GetHash(Defines, Name, len, &vPVal) &&
+ (vPVal != NULL))
+ {
+ return *(long*) vPVal;
+ }
+ else
+ {
+ return DefValue;
+ }
+}
+
+void tmplput_DefStr(StrBuf *Target, WCTemplputParams *TP)
+{
+ const char *Str;
+ long len;
+ GetTemplateTokenString(Target, TP, 2, &Str, &len);
+
+ StrBufAppendBufPlain(Target, Str, len, 0);
+}
+
+void tmplput_DefVal(StrBuf *Target, WCTemplputParams *TP)
+{
+ int val;
+
+ val = GetTemplateTokenNumber(Target, TP, 0, 0);
+ StrBufAppendPrintf(Target, "%d", val);
+}
+
HashList *Defines;
/*-----------------------------------------------------------------------------
return strcmp(ChrPtr(TokenText), CompareToken) == 0;
}
+void tmplput_ContextStringArray(StrBuf *Target, WCTemplputParams *TP)
+{
+ HashList *Arr = (HashList*) CTX;
+ void *pV;
+ int val;
+
+ val = GetTemplateTokenNumber(Target, TP, 0, 0);
+ if (GetHash(Arr, IKEY(val), &pV) &&
+ (pV != NULL)) {
+ StrBufAppendTemplate(Target, TP, (StrBuf*)pV, 1);
+ }
+}
+int ConditionalContextStrinArray(StrBuf *Target, WCTemplputParams *TP)
+{
+ HashList *Arr = (HashList*) CTX;
+ void *pV;
+ int val;
+ const char *CompareToken;
+ long len;
+
+ GetTemplateTokenString(Target, TP, 2, &CompareToken, &len);
+ val = GetTemplateTokenNumber(Target, TP, 0, 0);
+ if (GetHash(Arr, IKEY(val), &pV) &&
+ (pV != NULL)) {
+ return strcmp(ChrPtr((StrBuf*)pV), CompareToken) == 0;
+ }
+ else
+ return 0;
+}
+
/*-----------------------------------------------------------------------------
* Boxed-API
*/
/*-----------------------------------------------------------------------------
* Tabbed-API
*/
+int preeval_do_tabbed(WCTemplateToken *Token)
+{
+ WCTemplputParams TPP;
+ WCTemplputParams *TP;
+ const char *Ch;
+ long len;
+ int i, nTabs;
+
+
+ memset(&TPP, 0, sizeof(WCTemplputParams));
+ TP = &TPP;
+ TP->Tokens = Token;
+ nTabs = TP->Tokens->nParameters / 2 - 1;
+ if (TP->Tokens->nParameters % 2 != 0)
+ {
+ LogTemplateError(NULL, "TabbedApi", ERR_PARM1, TP,
+ "need even number of arguments");
+ return 0;
+
+ }
+ else for (i = 0; i < nTabs; i++) {
+ if (!HaveTemplateTokenString(NULL,
+ TP,
+ i * 2,
+ &Ch,
+ &len) ||
+ (TP->Tokens->Params[i * 2]->len == 0))
+ {
+ LogTemplateError(NULL, "TabbedApi", ERR_PARM1, TP,
+ "Tab-Subject %d needs to be able to produce a string, have %s",
+ i, TP->Tokens->Params[i * 2]->Start);
+ return 0;
+ }
+ if (!HaveTemplateTokenString(NULL,
+ TP,
+ i * 2 + 1,
+ &Ch,
+ &len) ||
+ (TP->Tokens->Params[i * 2 + 1]->len == 0))
+ {
+ LogTemplateError(NULL, "TabbedApi", ERR_PARM1, TP,
+ "Tab-Content %d needs to be able to produce a string, have %s",
+ i, TP->Tokens->Params[i * 2 + 1]->Start);
+ return 0;
+ }
+ }
+
+ if (!HaveTemplateTokenString(NULL,
+ TP,
+ i * 2 + 1,
+ &Ch,
+ &len) ||
+ (TP->Tokens->Params[i * 2 + 1]->len == 0))
+ {
+ LogTemplateError(NULL, "TabbedApi", ERR_PARM1, TP,
+ "Tab-Content %d needs to be able to produce a string, have %s",
+ i, TP->Tokens->Params[i * 2 + 1]->Start);
+ return 0;
+ }
+ return 1;
+}
+
void tmpl_do_tabbed(StrBuf *Target, WCTemplputParams *TP)
{
DoTemplate(TKEY(i * 2 + 1), Target, TP);
StrEndTab(Target, i, nTabs);
}
+ for (i = 0; i < ntabs; i++)
+ FreeStrBuf(&TabNames[i]);
}
RegisterNamespace("SORT:ORDER", 1, 2, tmplput_SORT_ORDER, NULL, CTX_NONE);
RegisterNamespace("SORT:NEXT", 1, 2, tmplput_SORT_NEXT, NULL, CTX_NONE);
RegisterNamespace("CONTEXTSTR", 0, 1, tmplput_ContextString, NULL, CTX_STRBUF);
+ RegisterNamespace("CONTEXTSTRARR", 1, 2, tmplput_ContextStringArray, NULL, CTX_STRBUF);
RegisterNamespace("ITERATE", 2, 100, tmpl_iterate_subtmpl, preeval_iterate, CTX_NONE);
RegisterNamespace("DOBOXED", 1, 2, tmpl_do_boxed, NULL, CTX_NONE);
- RegisterNamespace("DOTABBED", 2, 100, tmpl_do_tabbed, NULL, CTX_NONE);
+ RegisterNamespace("DOTABBED", 2, 100, tmpl_do_tabbed, preeval_do_tabbed, CTX_NONE);
RegisterNamespace("LONGVECTOR", 1, 1, tmplput_long_vector, NULL, CTX_LONGVECTOR);
+
+
RegisterConditional(HKEY("COND:SUBST"), 3, ConditionalVar, CTX_NONE);
RegisterConditional(HKEY("COND:CONTEXTSTR"), 3, ConditionalContextStr, CTX_STRBUF);
+ RegisterConditional(HKEY("COND:CONTEXTSTRARR"), 4, ConditionalContextStrinArray, CTX_STRBUFARR);
RegisterConditional(HKEY("COND:LONGVECTOR"), 4, ConditionalLongVector, CTX_LONGVECTOR);
RegisterControlConditional(HKEY("COND:ITERATE:ISGROUPCHANGE"), 2,
RegisterControlNS(HKEY("ITERATE:KEY"), 0, 0, tmplput_ITERATE_KEY, CTX_ITERATE);
RegisterControlNS(HKEY("ITERATE:N"), 0, 0, tmplput_ITERATE_LASTN, CTX_ITERATE);
RegisterNamespace("CURRENTFILE", 0, 1, tmplput_CURRENT_FILE, NULL, CTX_NONE);
+ RegisterNamespace("DEF:STR", 1, 1, tmplput_DefStr, NULL, CTX_NONE);
+ RegisterNamespace("DEF:VAL", 1, 1, tmplput_DefVal, NULL, CTX_NONE);
+
+
}
(wcsession *sess)
{
DeleteHash(&sess->vars);
+ FreeStrBuf(&sess->WFBuf);
}
void