rename structures and functions
[protos/libecoli.git] / include / ecoli_node.h
index 894e64f..0557dea 100644 (file)
  */
 #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
 
  /** @} */