diff options
Diffstat (limited to 'include/argot/node.h')
-rw-r--r-- | include/argot/node.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/include/argot/node.h b/include/argot/node.h new file mode 100644 index 0000000..fcf542e --- /dev/null +++ b/include/argot/node.h @@ -0,0 +1,62 @@ +/* argot - Gray's Extensible Configuration System -*- c -*- + Copyright (C) 2007-2016 Sergey Poznyakoff + + Grecs is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + Grecs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with Grecs. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef _ARGOT_NODE_H +#define _ARGOT_NODE_H + +#include <argot/locus.h> +#include <argot/symtab.h> +#include <argot/value.h> + +enum argot_node_type { + argot_node_root, + argot_node_stmt, + argot_node_block +}; + +typedef struct argot_node { + enum argot_node_type type; + argot_locus_t locus; + struct argot_node *up; + struct argot_node *down; + struct argot_node *next; + struct argot_node *prev; + char *ident; + argot_locus_t idloc; + union { + argot_value_t *value; + argot_symtab_ptr_t texttab; + } v; +} argot_node_t; + +void argot_node_free(struct argot_node *node); +struct argot_node *argot_node_create(enum argot_node_type type, + argot_locus_t *loc); +struct argot_node *argot_node_create_points(enum argot_node_type type, + struct argot_locus_point beg, + struct argot_locus_point end); +void argot_node_bind(struct argot_node *master, struct argot_node *node, + int dn); +int argot_node_eq(struct argot_node *a, struct argot_node *b); +int argot_node_unlink(struct argot_node *node); + +struct argot_node *argot_node_from_path(const char *path, const char *value); +struct argot_node *argot_node_from_path_locus(const char *path, + const char *value, + argot_locus_t *locus, + argot_locus_t *vallocus); + +#endif |