Libecoli 0.11.1
Extensible COmmand LIne library
Loading...
Searching...
No Matches
Sequence node

A node that matches a sequence of child nodes in order. More...

Macros

#define EC_NODE_SEQ(args...)

Functions

struct ec_nodeec_node_seq (const char *id)
int ec_node_seq_add (struct ec_node *node, struct ec_node *child)

Detailed Description

A node that matches a sequence of child nodes in order.

Configuration Schema

schema seq {
list children {
description "The list of children nodes, to be parsed in sequence.";
node {
description "A child node which is part of the sequence.";
}
}
}

Macro Definition Documentation

◆ EC_NODE_SEQ

#define EC_NODE_SEQ ( args...)
Value:
__ec_node_seq(args, EC_VA_END)
#define EC_VA_END
Definition utils.h:26

Create a sequence node from a list of child nodes.

All child nodes passed as arguments are consumed and will be freed when the sequence node is freed, or immediately on error.

Example:

EC_NODE_SEQ("myseq", child1, child2, child3)
#define EC_NODE_SEQ(args...)
Definition node_seq.h:29
Examples
extension-editline/main.c, pool-editline/main.c, readline/main.c, and simple-editline/main.c.

Definition at line 29 of file node_seq.h.

Function Documentation

◆ ec_node_seq()

struct ec_node * ec_node_seq ( const char * id)

Create an empty sequence node.

Use ec_node_seq_add() to add children.

Parameters
idThe node identifier.
Returns
The node, or NULL on error (errno is set).

◆ ec_node_seq_add()

int ec_node_seq_add ( struct ec_node * node,
struct ec_node * child )

Add a child to a sequence node.

Parameters
nodeThe sequence node.
childThe child node to add. It is consumed and will be freed when the parent is freed, or immediately on error.
Returns
0 on success, -1 on error (errno is set).