diff anagram/agcore/dict.h @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/anagram/agcore/dict.h	Sat Dec 22 17:52:45 2007 -0500
@@ -0,0 +1,82 @@
+/*
+ * AnaGram, A System for Syntax Directed Programming
+ * Copyright 1993 Parsifal Software. All Rights Reserved.
+ * See the file COPYING for license and usage terms.
+ *
+ * dict.h - old dictionary module
+ */
+
+#ifndef DICT_H
+#define DICT_H
+
+struct string_dict {
+  unsigned *ndx;                        /* index array */
+  unsigned  nsx;                        /* number of strings */
+  unsigned  nxs;                        /* number of indices allocated */
+  char *text;                           /* text */
+  unsigned  ntc;                        /* number of text characters */
+  unsigned  nts;                        /* length of test storage */
+  //unsigned short *ht;                 /* pointer to hash table */
+  unsigned *ht;                         /* pointer to hash table */
+  unsigned  nhs;                        /* number of hash table slots */
+  unsigned *st;                         /* sort table */
+  unsigned  nss;                        /* number of entries sorted */
+  unsigned *pt;                         /* permutation table */
+  unsigned ignore_case : 1;             /* ignore case flag */
+};
+
+struct list_dict {
+  unsigned *ndx;                        /* index array */
+  unsigned  nsx;                        /* number of lists */
+  unsigned  nxs;                        /* number of indices allocated */
+  int  *text;                           /* text */
+  unsigned  ntc;                        /* number of text characters */
+  unsigned  nts;                        /* length of test storage */
+  //unsigned short *ht;                 /* pointer to hash table */
+  unsigned *ht;                         /* pointer to hash table */
+  unsigned  nhs;                        /* number of hash table slots */
+  unsigned *st;                         /* sort table */
+  unsigned  nss;                        /* number of entries sorted */
+  unsigned *pt;                         /* permutation table */
+};
+
+struct tuple_dict {
+  unsigned *ndx;                        /* index array */
+  unsigned  nsx;                        /* number of lists */
+  unsigned  nxs;                        /* number of indices allocated */
+  int  *text;                           /* text */
+  unsigned  ntc;                        /* number of text characters */
+  unsigned  nts;                        /* length of test storage */
+  //unsigned short *ht;                 /* pointer to hash table */
+  unsigned *ht;                         /* pointer to hash table */
+  unsigned  nhs;                        /* number of hash table slots */
+  unsigned *st;                         /* sort table */
+  unsigned  nss;                        /* number of entries sorted */
+  unsigned *pt;                         /* permutation table */
+  unsigned  tw;                         /* tuple width */
+};
+
+#define dict_str(d,n) ((d)->text+(d)->ndx[n])
+
+int           add_list_dict(const int *s, int n, list_dict *d);
+int           add_string_dict(const char *s, string_dict *d);
+int           add_tuple_dict_new(tuple_dict *d, ...);
+list_dict    *delete_list_dict(list_dict *da);
+string_dict  *delete_string_dict(string_dict *da);
+tuple_dict   *delete_tuple_dict(tuple_dict *da);
+void          empty_tuple_dict(tuple_dict *);
+void          extract_tuple_dict(tuple_dict *d, unsigned k, ...);
+int           identify_string(const char *, string_dict *d);
+int           insert_tuple_dict(tuple_dict *d, ...);
+int           list_in_dict(int*, int, list_dict *);
+list_dict    *reset_list_dict(list_dict *d);
+tuple_dict   *reset_tuple_dict(tuple_dict *d);
+list_dict    *null_list_dict(void);
+string_dict  *null_str_dict(void);
+tuple_dict   *null_tuple_dict(int tw);
+
+//string_dict *restore_string_dict(char *text, int ntc, int ne, int ic,
+//				   int byte_swap_required);
+//void         sort_string_dict(string_dict *d);
+
+#endif /* DICT_H */