X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fsubst.h;h=4bf5728edf4096e9e92120a99d0dcf738df4826a;hb=8217ed8772edbc04987f10ee2d93ace9c4932317;hp=7053a4936f921a9c3431ed4d48ac65ae5bfaf73c;hpb=7fbd86fc19de89f25410012d5b7578df7f01c13a;p=citadel.git diff --git a/webcit/subst.h b/webcit/subst.h index 7053a4936..4bf5728ed 100644 --- a/webcit/subst.h +++ b/webcit/subst.h @@ -18,6 +18,7 @@ extern HashList *LocalTemplateCache; #define TYPE_INTDEFINE 8 #define MAXPARAM 20 +#define IS_NUMBER(a) ((a == TYPE_LONG) || (a == TYPE_PREFINT) || (a == TYPE_INTDEFINE)) /* * \brief Values for wcs_type @@ -47,14 +48,16 @@ enum { #define CTX_MIME_ATACH 10 #define CTX_FILELIST 11 #define CTX_STRBUF 12 -#define CTX_LONGVECTOR 13 -#define CTX_ROOMS 14 -#define CTX_FLOORS 15 -#define CTX_ITERATE 16 -#define CTX_ICAL 17 -#define CTX_DAVNS 18 +#define CTX_STRBUFARR 13 +#define CTX_LONGVECTOR 14 +#define CTX_ROOMS 15 +#define CTX_FLOORS 16 +#define CTX_ITERATE 17 +#define CTX_ICAL 18 +#define CTX_DAVNS 19 +#define CTX_TAB 20 -#define CTX_UNKNOWN 19 +#define CTX_UNKNOWN 21 /** @@ -90,6 +93,11 @@ typedef int (*WCPreevalFunc)(WCTemplateToken *Token); */ typedef int (*WCConditionalFunc)(StrBuf *Target, WCTemplputParams *TP); +typedef enum _eBitMask { + eNO = 0, + eOR, + eAND +}eBitMask; typedef struct _TemplateParam { /* are we a string or a number? */ @@ -99,6 +107,7 @@ typedef struct _TemplateParam { long len; /* if we're a number: */ long lvalue; + eBitMask MaskBy; } TemplateParam; @@ -211,6 +220,14 @@ void GetTemplateTokenString(StrBuf *Target, int N, const char **Value, long *len); +/** + * @return whether @ref GetTemplateTokenString would be able to give you a string + */ +int HaveTemplateTokenString(StrBuf *Target, + WCTemplputParams *TP, + int N, + const char **Value, + long *len); @@ -299,6 +316,17 @@ void RegisterTokenParamDefine(const char *Name, long len, */ #define REGISTERTokenParamDefine(a) RegisterTokenParamDefine(#a, sizeof(#a) - 1, a); +/** + * @brief retrieve the long value of a registered string define + * @param Name The name of the define + * @param len length of Name + * @param Value the value to return if not found + */ +long GetTokenDefine(const char *Name, + long len, + long DefValue); + + #define IT_NOFLAG 0 #define IT_FLAG_DETECT_GROUPCHANGE (1<<0) #define RegisterIterator(a, b, c, d, e, f, g, h, i) RegisterITERATOR(a, sizeof(a)-1, b, c, d, e, f, g, h, i) @@ -337,7 +365,7 @@ void dbg_print_longvector(long *LongVector); -#define do_template(a, b) DoTemplate(a, sizeof(a) -1, NULL, &NoCtx); +#define do_template(a, b) DoTemplate(a, sizeof(a) -1, NULL, &NoCtx) const StrBuf *DoTemplate(const char *templatename, long len, StrBuf *Target, WCTemplputParams *TP); void url_do_template(void);