]> mj.ucw.cz Git - libucw.git/blobdiff - lib/kmp.h
conf: parsing IP address fixed
[libucw.git] / lib / kmp.h
index f4d14049235081ab90cf1c5123e87db1a2384d0d..86a0f98f89740b2cd88232d85f6cd55fb5e6b2cc 100644 (file)
--- a/lib/kmp.h
+++ b/lib/kmp.h
  *
  *  This file contains only construction of the automaton. The search
  *  itself can be generated by inclusion of file lib/kmp-search.h.
- *  Separeted headers allows the user to define multiple search
+ *  Separeted headers allow the user to define multiple search
  *  routines for one common set of key strings.
  *
  *  Example:
  *
- *     #define KMP_PREFIX(x) GLUE_(kmp,x)
+ *     #define KMP_PREFIX(x) kmp_##x
  *     #define KMP_WANT_CLEANUP
  *     #define KMP_WANT_SEARCH // includes lib/kmp-search.h automatically
  *     #define KMPS_FOUND(kmp,src,s) printf("found\n")
@@ -51,7 +51,7 @@
  *    Basic parameters:
  *             KMP_PREFIX(x)           macro to add a name prefix (used on all global names
  *                             defined by the KMP generator); mandatory;
- *                             below we use P(x) alias
+ *                             we abbreviate this to P(x) below
  *
  *     KMP_CHAR                alphabet type, the default is u16
  *     
@@ -131,11 +131,11 @@ typedef struct {} P(node_t);
 struct P(struct);
 
 struct P(state) {
-  struct P(state) *from;       /* state with previous character (forms a tree with null state in the root) */
+  struct P(state) *from;       /* state with the previous character (forms a tree with null state in the root) */
   struct P(state) *back;       /* backwards edge to the longest shorter state with same suffix */
-  struct P(state) *next;       /* longest shorter match (or NULL) */
+  struct P(state) *next;       /* the longest of shorter matches (or NULL) */
   P(len_t) len;                        /* state depth if it represents a key string, zero otherwise */
-  P(char_t) c;                 /* last character of represented string */
+  P(char_t) c;                 /* last character of the represented string */
   struct {
 #   ifdef KMP_STATE_VARS
     KMP_STATE_VARS
@@ -224,7 +224,7 @@ P(hash_init_key) (struct P(hash_table) *t UNUSED, struct P(state) *s, struct P(s
 }
 
 #undef P
-#define HASH_PREFIX(x) KMP_PREFIX(GLUE(hash_,x))
+#define HASH_PREFIX(x) KMP_PREFIX(hash_##x)
 #define HASH_NODE struct KMP_PREFIX(state)
 #define HASH_KEY_COMPLEX(x) x from, x c
 #define HASH_KEY_DECL struct KMP_PREFIX(state) *from, KMP_PREFIX(char_t) c