X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=include%2Fecoli_node.h;h=0557dea7f1c6eb4759dd1fb5673cce3ad40b6c5d;hb=984760622f2c8472fd2667e24bcceb543bdb1aff;hp=894e64f8fbe146cf64ae9d8142b0f7110e99f47d;hpb=e18710da81b4c53b357dde2ca55005344edc314f;p=protos%2Flibecoli.git diff --git a/include/ecoli_node.h b/include/ecoli_node.h index 894e64f..0557dea 100644 --- a/include/ecoli_node.h +++ b/include/ecoli_node.h @@ -54,10 +54,8 @@ */ #define EC_NO_ID "no-id" -#define EC_NODE_ENDLIST ((void *)1) - struct ec_node; -struct ec_parse; +struct ec_pnode; struct ec_comp; struct ec_strvec; struct ec_dict; @@ -79,10 +77,10 @@ TAILQ_HEAD(ec_node_type_list, ec_node_type); typedef int (*ec_node_set_config_t)(struct ec_node *node, const struct ec_config *config); -typedef int (*ec_node_parse_t)(const struct ec_node *node, - struct ec_parse *state, +typedef int (*ec_parse_t)(const struct ec_node *node, + struct ec_pnode *state, const struct ec_strvec *strvec); -typedef int (*ec_node_complete_t)(const struct ec_node *node, +typedef int (*ec_complete_t)(const struct ec_node *node, struct ec_comp *comp_state, const struct ec_strvec *strvec); typedef const char * (*ec_node_desc_t)(const struct ec_node *); @@ -102,8 +100,8 @@ struct ec_node_type { * (.type = EC_CONFIG_TYPE_NONE). */ const struct ec_config_schema *schema; ec_node_set_config_t set_config; /* validate/ack a config change */ - ec_node_parse_t parse; - ec_node_complete_t complete; + ec_parse_t parse; + ec_complete_t complete; ec_node_desc_t desc; size_t size; ec_node_init_priv_t init_priv; @@ -158,20 +156,6 @@ enum ec_node_free_state { EC_NODE_FREE_STATE_FREEING, }; -struct ec_node { - const struct ec_node_type *type; - struct ec_config *config; /**< Generic configuration. */ - char *id; - char *desc; - struct ec_dict *attrs; - unsigned int refcnt; - struct { - enum ec_node_free_state state; /**< State of loop detection */ - unsigned int refcnt; /**< Number of reachable references - * starting from node beeing freed */ - } free; /**< Freeing state: used for loop detection */ -}; - /* create a new node when the type is known, typically called from the node * code */ struct ec_node *ec_node_from_type(const struct ec_node_type *type, const char *id); @@ -209,6 +193,18 @@ struct ec_node *ec_node_find(struct ec_node *node, const char *id); int ec_node_check_type(const struct ec_node *node, const struct ec_node_type *type); +const char *ec_node_get_type_name(const struct ec_node *node); + +/** + * Get the pointer to the node private area. + * + * @param node + * The grammar node. + * @return + * The pointer to the node private area. + */ +void *ec_node_priv(const struct ec_node *node); + #endif /** @} */