aboutsummaryrefslogtreecommitdiff
path: root/src/grecs.h
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-04-30 12:06:47 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-04-30 12:06:47 +0300
commitbd4a203ab453d78e87e29d11017b35248c9babca (patch)
tree739ddb735fdfb6aaf668ca1b2ff994004e63d6a0 /src/grecs.h
parent3f02a6139ea4ed7635453cbcdd600e815a5c2208 (diff)
downloadgrecs-bd4a203ab453d78e87e29d11017b35248c9babca.tar.gz
grecs-bd4a203ab453d78e87e29d11017b35248c9babca.tar.bz2
Remove dependency on xlists.
* gnulib.modules (linked-list, xlist): Remove. * src/list.c: New file. * src/Makefile.am (libgrecs_a_SOURCES): Add list.c * src/grecs-gram.y: Use grecs_list functions. * src/preproc.c: Likewise. * src/grecs.h (grecs_list_entry, grecs_list): New structs. (grecs_value): use struct grecs_list* for the v.list member. (grecs_log_to_stderr): Change type to int. (grecs_list_create, grecs_list_size, grecs_list_push) (grecs_list_pop, grecs_list_locate, grecs_list_index) (grecs_list_remove_tail): New protos.
Diffstat (limited to 'src/grecs.h')
-rw-r--r--src/grecs.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/grecs.h b/src/grecs.h
index 3fc01f2..42ef01e 100644
--- a/src/grecs.h
+++ b/src/grecs.h
@@ -18,8 +18,6 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
-#include <gl_xlist.h>
-#include <gl_linked_list.h>
typedef struct {
char *file;
@@ -65,10 +63,22 @@ enum grecs_callback_command {
#define GRECS_TYPE_LIST 1
#define GRECS_TYPE_ARRAY 2
+struct grecs_list_entry {
+ struct grecs_list_entry *next;
+ void *data;
+};
+
+struct grecs_list {
+ struct grecs_list_entry *head, *tail;
+ size_t count;
+ int (*cmp)(const void *, const void *);
+ void (*free_entry)(void *);
+};
+
typedef struct grecs_value {
int type;
union {
- gl_list_t list;
+ struct grecs_list *list;
const char *string;
struct {
size_t c;
@@ -134,7 +144,7 @@ extern int grecs_error_count;
extern int grecs_default_port;
extern const char *grecs_preprocessor;
-extern bool grecs_log_to_stderr;
+extern int grecs_log_to_stderr;
extern void (*grecs_log_setup_hook) ();
size_t grecs_preproc_fill_buffer (char *buf, size_t size);
@@ -164,4 +174,12 @@ void grecs_format_statement_array (FILE *stream, struct grecs_keyword *kwp,
unsigned level);
+struct grecs_list *grecs_list_create (void);
+size_t grecs_list_size (struct grecs_list *lp);
+void grecs_list_append (struct grecs_list *lp, void *val);
+void grecs_list_push (struct grecs_list *lp, void *val);
+void *grecs_list_pop (struct grecs_list *lp);
+void *grecs_list_locate (struct grecs_list *lp, void *data);
+void *grecs_list_index (struct grecs_list *lp, size_t idx);
+void *grecs_list_remove_tail (struct grecs_list *lp);

Return to:

Send suggestions and report system problems to the System administrator.