51 struct Buffer *buf,
int max_cols,
void *data,
60 int rc_cond = node_cond->
render(node_cond, erc, buf_cond, max_cols,
data, flags);
68 rc =
node_render(node_true, erc, buf_cond, max_cols, data, flags);
73 rc =
node_render(node_false, erc, buf_cond, max_cols, data, flags);
87 min_cols =
MIN(min_cols, max_cols);
142 const char **parsed_until,
145 if (!str || (str[0] !=
'%'))
163 if ((str[0] !=
'<') && (str[0] !=
'?'))
166 const bool old_style = (str[0] ==
'?');
188 _(
"Conditional expando is missing '%c'"),
'?');
224 const char terminator = old_style ?
'?' :
'>';
226 if (str[0] != terminator)
232 _(
"Conditional expando is missing '%c'"),
'?');
236 *parsed_until = str + 1;
#define ARRAY_SET(head, idx, elem)
Set an element in the array.
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Define an Expando format string.
#define EP_CONDITIONAL
Expando is being used as a condition.
void buf_lower_special(struct Buffer *buf)
Convert to lowercase, excluding special characters.
bool node_parse_many(struct ExpandoNode *node_cont, const char *str, NodeTextTermFlags term_chars, const struct ExpandoDefinition *defs, const char **parsed_until, struct ExpandoParseError *err)
Parse a format string.
static int node_condition_render(const struct ExpandoNode *node, const struct ExpandoRenderCallback *erc, struct Buffer *buf, int max_cols, void *data, MuttFormatFlags flags)
Render a Conditional Node - Implements ExpandoNode::render() -.
int node_condbool_render(const struct ExpandoNode *node, const struct ExpandoRenderCallback *erc, struct Buffer *buf, int max_cols, void *data, MuttFormatFlags flags)
Callback for every bool node - Implements ExpandoNode::render() -.
Convenience wrapper for the library headers.
struct ExpandoNode * node_new(void)
Create a new empty ExpandoNode.
struct ExpandoNode * node_get_child(const struct ExpandoNode *node, int index)
Get a child of an ExpandoNode.
void node_free(struct ExpandoNode **ptr)
Free an ExpandoNode and its private data.
@ ENT_EXPANDO
Expando, e.g. 'n'.
@ ENT_CONDITION
True/False condition.
@ ENT_CONDBOOL
True/False boolean condition.
Expando Node for a Conditional Boolean.
struct ExpandoNode * node_condition_new(struct ExpandoNode *node_cond, struct ExpandoNode *node_true, struct ExpandoNode *node_false, struct ExpandoFormat *fmt)
Create a new Condition Expando Node.
struct ExpandoNode * node_condition_parse(const char *str, NodeTextTermFlags term_chars, const struct ExpandoDefinition *defs, const char **parsed_until, struct ExpandoParseError *err)
Parse a conditional Expando.
Expando Node for a Condition.
@ ENC_CONDITION
Index of Condition Node.
@ ENC_FALSE
Index of False Node.
@ ENC_TRUE
Index of True Node.
struct ExpandoNode * node_container_new(void)
Create a new Container ExpandoNode.
Expando Node for a Container.
struct ExpandoNode * parse_short_name(const char *str, const struct ExpandoDefinition *defs, ExpandoParserFlags flags, struct ExpandoFormat *fmt, const char **parsed_until, struct ExpandoParseError *err)
Create an expando by its short name.
struct ExpandoFormat * parse_format(const char *str, const char **parsed_until, struct ExpandoParseError *err)
Parse a format string.
Expando Node for an Expando.
#define NTE_QUESTION
'?' Question mark
#define NTE_GREATER
'>' Greater than
uint8_t NodeTextTermFlags
Special characters that end a text string.
#define NTE_AMPERSAND
'&' Ampersand
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
int node_render(const struct ExpandoNode *node, const struct ExpandoRenderCallback *erc, struct Buffer *buf, int max_cols, void *data, MuttFormatFlags flags)
Render a tree of ExpandoNodes into a string.
Render Expandos using Data.
uint8_t MuttFormatFlags
Flags for expando_render(), e.g. MUTT_FORMAT_FORCESUBJ.
String manipulation buffer.
char * data
Pointer to data.
Definition of a format string.
struct ExpandoFormat * format
Formatting info.
int(* render)(const struct ExpandoNode *node, const struct ExpandoRenderCallback *erc, struct Buffer *buf, int max_cols, void *data, MuttFormatFlags flags)
enum ExpandoNodeType type
Type of Node, e.g. ENT_EXPANDO.
struct ExpandoNodeArray children
Children nodes.
Buffer for parsing errors.
char message[1024]
Error message.
const char * position
Position of error in original string.