X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=webcit%2Fsubst.h;fp=webcit%2Fsubst.h;h=30c3a6b66ff743379595473b03c1c7ae81ea891e;hp=86b76d69070cb39638c9da72b9ba6506b200587f;hb=b39d860713ddd390339211be8d398c4d4b6680ba;hpb=2439b9cc9db4404cc04400ef337a9b37c7aae581 diff --git a/webcit/subst.h b/webcit/subst.h index 86b76d690..30c3a6b66 100644 --- a/webcit/subst.h +++ b/webcit/subst.h @@ -153,6 +153,8 @@ struct WCTemplputParams { int nArgs; WCTemplateToken *Tokens; WCTemplputParams *Sub, *Super; + WCConditionalFunc ExitCtx; + long ExitCTXID; }; @@ -161,6 +163,7 @@ typedef struct _ConditionalStruct { ContextFilter Filter; const char *PlainName; WCConditionalFunc CondF; + WCConditionalFunc CondExitCtx; } ConditionalStruct; @@ -302,12 +305,21 @@ void RegisterNS(const char *NSName, long len, * @param len the token length so we don't have to measure it. * @param nParams how many parameters does your conditional need on top of the default conditional parameters * @param CondF your Callback to be called when the template is evaluated at runtime; return 0 or 1 to us please. + * @param ExitCtxCond if non-NULL, will be called after the area of the conditional is left behind. * @param ContextRequired if your token requires a specific context, else say CTX_NONE here. */ -void RegisterConditional(const char *Name, long len, - int nParams, - WCConditionalFunc CondF, - int ContextRequired); +void RegisterContextConditional(const char *Name, long len, + int nParams, + WCConditionalFunc CondF, + WCConditionalFunc ExitCtxCond, + int ContextRequired); + +#define RegisterCtxConditional(Name, nParams, CondF, ExitCtxCond, ContextRequired) \ + RegisterContextConditional(Name, sizeof(Name) -1, nParams, CondF, ExitCtxCond, ContextRequired) + +#define RegisterConditional(Name, nParams, CondF, ContextRequired) \ + RegisterContextConditional(Name, sizeof(Name) -1, nParams, CondF, NULL, ContextRequired) + /** * @ingroup subst @@ -353,12 +365,18 @@ void RegisterITERATOR(const char *Name, long len, /* Our identifier */ -void StackContext(WCTemplputParams *Super, - WCTemplputParams *Sub, - void *Context, - CtxType ContextType, - int nArgs, - WCTemplateToken *Tokens); +void StackDynamicContext(WCTemplputParams *Super, + WCTemplputParams *Sub, + void *Context, + CtxType ContextType, + int nArgs, + WCTemplateToken *Tokens, + WCConditionalFunc ExitCtx, + long ExitCTXID); + +#define StackContext(Super, Sub, Context, ContextType, nArgs, Tokens) \ + StackDynamicContext(Super, Sub, Context, ContextType, nArgs, Tokens, NULL, 0) + void UnStackContext(WCTemplputParams *Sub);