summaryrefslogtreecommitdiff
path: root/old-lib/c/gfcc-term.h
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2009-06-22 15:39:08 +0000
committeraarne <aarne@chalmers.se>2009-06-22 15:39:08 +0000
commite89fdae2fa1626348d8025824a7469252fa85e42 (patch)
treec7d46bbd0494043b4bd6f917a25a7687517d0547 /old-lib/c/gfcc-term.h
parent3049b59b35b25381a7c6787444165c200d66e08b (diff)
next-lib renamed to lib, lib to old-lib
Diffstat (limited to 'old-lib/c/gfcc-term.h')
-rw-r--r--old-lib/c/gfcc-term.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/old-lib/c/gfcc-term.h b/old-lib/c/gfcc-term.h
new file mode 100644
index 000000000..d1307259d
--- /dev/null
+++ b/old-lib/c/gfcc-term.h
@@ -0,0 +1,65 @@
+#ifndef GFCC_TERM_H
+#define GFCC_TERM_H
+
+#include <stdio.h>
+
+typedef enum {
+ /* size = variable */
+ TERM_ARRAY,
+ TERM_SEQUENCE,
+ TERM_VARIANTS,
+ TERM_GLUE,
+ /* size = 2 */
+ TERM_RECORD_PARAM,
+ TERM_SUFFIX_TABLE,
+ /* size = 0 */
+ TERM_META,
+ TERM_STRING,
+ TERM_INTEGER
+} TermType;
+
+struct Term_ {
+ TermType type;
+ union {
+ const char *string_value;
+ int integer_value;
+ int size;
+ } value;
+ struct Term_ *args[0];
+};
+
+typedef struct Term_ Term;
+
+
+
+static inline Term *term_get_child(Term *t, int n) {
+ return t->args[n];
+}
+
+static inline void term_set_child(Term *t, int n, Term *c) {
+ t->args[n] = c;
+}
+
+extern void term_alloc_pool(size_t size);
+extern void term_free_pool();
+extern void *term_alloc(size_t size);
+
+
+extern Term *term_array(int n, ...);
+extern Term *term_seq(int n, ...);
+extern Term *term_variants(int n, ...);
+extern Term *term_glue(int n, ...);
+
+extern Term *term_rp(Term *t1, Term *t2);
+extern Term *term_suffix(const char *pref, Term *suf);
+extern Term *term_str(const char *s);
+extern Term *term_int(int i);
+extern Term *term_meta();
+
+extern Term *term_sel_int(Term *t, int i);
+extern Term *term_sel(Term *t1, Term *t2);
+
+
+extern void term_print(FILE *stream, Term *t);
+
+#endif