aboutsummaryrefslogtreecommitdiff
path: root/src/grecs.h
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-03 21:06:47 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-05-03 21:23:25 +0300
commited838ca0467f7cc9745b042099b568cdf0f2b835 (patch)
tree1ffa754e73507d31ece0151e68db25a4ecb81592 /src/grecs.h
parent3d679b3df641f59fb81ca1651799f4e2965ed67e (diff)
downloadgrecs-ed838ca0467f7cc9745b042099b568cdf0f2b835.tar.gz
grecs-ed838ca0467f7cc9745b042099b568cdf0f2b835.tar.bz2
Various impovements.
* am/grecs.m4 (GRECS_SETUP): New flags: getopt and git2chg. * src/format.c (grecs_format_locus): Ignore NULL loci. (grecs_format_node_ident): Rename to grecs_format_node_path. Change semantics of the second argument. (grecs_format_value): Change signature (take flags). Correctly quote string values. * src/grecs.h: Protect the contents with #ifndef _GRECS_H. (GRECS_AGGR): New flag (for future use). (grecs_node) <prev>: New member. (grecs_format_value): Change signature. (grecs_format_node_ident): Rename to grecs_format_node_path. (GRECS_NODE_FLAG_PATH,GRECS_NODE_FLAG_VALUE) (GRECS_NODE_FLAG_QUOTE,GRECS_NODE_FLAG_QUOTE_HEX) (GRECS_NODE_FLAG_DEFAULT): New flags. (grecs_node_from_path): New proto. * src/lookup.c (grecs_node_from_path): New function. * src/tree.c (grecs_node_bind): Keep track of node->prev.
Diffstat (limited to 'src/grecs.h')
-rw-r--r--src/grecs.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/grecs.h b/src/grecs.h
index e0f0fa5..c408aa0 100644
--- a/src/grecs.h
+++ b/src/grecs.h
@@ -14,6 +14,9 @@
You should have received a copy of the GNU General Public License along
with Grecs. If not, see <http://www.gnu.org/licenses/>. */
+#ifndef _GRECS_H
+#define _GRECS_H
+
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
@@ -61,6 +64,7 @@ enum grecs_data_type {
grecs_type_section
};
+#define GRECS_AGGR 0x1000
#define GRECS_LIST 0x8000
#define GRECS_TYPE_MASK 0x00ff
#define GRECS_TYPE(c) ((c) & GRECS_TYPE_MASK)
@@ -115,6 +119,7 @@ typedef struct grecs_node {
struct grecs_node *up;
struct grecs_node *down;
struct grecs_node *next;
+ struct grecs_node *prev;
char *ident;
struct grecs_value value;
} grecs_node_t;
@@ -224,10 +229,16 @@ void grecs_format_statement_array(struct grecs_keyword *kwp,
unsigned level, FILE *stream);
void grecs_format_locus(grecs_locus_t *locus, FILE *fp);
-void grecs_format_node_ident(struct grecs_node *node, int delim, FILE *fp);
-void grecs_format_value(struct grecs_value *val, FILE *fp);
-
-#define GRECS_NODE_FLAG_LOCUS 0x0100
+void grecs_format_node_path(struct grecs_node *node, int flag, FILE *fp);
+void grecs_format_value(struct grecs_value *val, int flags, FILE *fp);
+
+#define GRECS_NODE_FLAG_LOCUS 0x0100
+#define GRECS_NODE_FLAG_PATH 0x0200
+#define GRECS_NODE_FLAG_VALUE 0x0400
+#define GRECS_NODE_FLAG_QUOTE 0x0800
+#define GRECS_NODE_FLAG_QUOTE_HEX 0x1000
+#define GRECS_NODE_FLAG_DEFAULT \
+ (GRECS_NODE_FLAG_PATH|GRECS_NODE_FLAG_VALUE|GRECS_NODE_FLAG_QUOTE)
void grecs_format_node(struct grecs_node *node, int flags, FILE *fp);
struct grecs_list *grecs_list_create(void);
@@ -301,4 +312,6 @@ int grecs_tree_process(struct grecs_node *node, struct grecs_keyword *kwd);
int grecs_value_eq(struct grecs_value *a, struct grecs_value *b);
struct grecs_node *grecs_find_node(struct grecs_node *node, const char *path);
+struct grecs_node *grecs_node_from_path(const char *path, const char *value);
+#endif

Return to:

Send suggestions and report system problems to the System administrator.