* #define KMP_WANT_CLEANUP
* #define KMP_WANT_SEARCH // includes ucw/kmp-search.h automatically
* #define KMPS_FOUND(kmp,src,s) printf("found\n")
- * #include "ucw/kmp.h"
+ * #include <ucw/kmp.h>
*
* [...]
*
* Brief description of all parameters:
*
* Basic parameters:
- * KMP_PREFIX(x) macro to add a name prefix (used on all global names
+ * KMP_PREFIX(x) macro to add a name prefix (used on all global names
* defined by the KMP generator); mandatory;
* we abbreviate this to P(x) below
*
* KMP_ONLYALPHA converts non-alphas to KMP_CONTROL_CHAR (see below)
*
* Parameters controlling add(kmp, src):
- * KMP_ADD_EXTRA_ARGS extra arguments, should be used carefully because of possible collisions
- * KMP_ADD_INIT(kmp,src) called in the beginning of add(), src is the first
+ * KMP_ADD_EXTRA_ARGS extra arguments, should be used carefully because of possible collisions
+ * KMP_ADD_INIT(kmp,src) called in the beginning of add(), src is the first
* KMP_INIT_STATE(kmp,s) initialization of a new state s (called before KMP_ADD_{NEW,DUP});
- * null state is not included and should be handled after init() if necessary;
- * all user-defined data are filled by zeros before call to KMP_INIT_STATE
- * KMP_ADD_NEW(kmp,src,s) initialize last state of every new key string (called after KMP_INIT_STATE);
- * the string must be parsed before so src is after the last string's character
- * KMP_ADD_DUP(kmp,src,s) analogy of KMP_ADD_NEW called for duplicates
+ * null state is not included and should be handled after init() if necessary;
+ * all user-defined data are filled by zeros before call to KMP_INIT_STATE
+ * KMP_ADD_NEW(kmp,src,s) initialize last state of every new key string (called after KMP_INIT_STATE);
+ * the string must be parsed before so src is after the last string's character
+ * KMP_ADD_DUP(kmp,src,s) analogy of KMP_ADD_NEW called for duplicates
*
* Parameters to build():
* KMP_BUILD_STATE(kmp,s) called for all states (including null) in order of non-decreasing tree depth
#error Missing KMP_PREFIX
#endif
-#include "ucw/mempool.h"
+#include <ucw/mempool.h>
#include <alloca.h>
#include <string.h>
#define HASH_GIVE_HASHFN
#ifdef KMP_GIVE_HASHFN
-static inline uns
+static inline uint
P(hash_hash) (struct P(hash_table) *t, struct P(state) *f, P(char_t) c)
{
return P(hash) ((struct P(struct) *) t, f, c);
}
#else
-static inline uns
+static inline uint
P(hash_hash) (struct P(hash_table) *t UNUSED, struct P(state) *f, P(char_t) c)
{
- return (((uns)c) << 16) + (uns)(uintptr_t)f;
+ return (((uint)c) << 16) + (uint)(uintptr_t)f;
}
#endif
#ifdef KMP_GIVE_ALLOC
#define HASH_GIVE_ALLOC
static inline void *
-P(hash_alloc) (struct P(hash_table) *t, uns size)
+P(hash_alloc) (struct P(hash_table) *t, uint size)
{
return P(alloc) ((struct P(struct) *) t, size);
}
#endif
#define HASH_CONSERVE_SPACE
#define HASH_TABLE_DYNAMIC
-#include "ucw/hashtable.h"
+#include <ucw/hashtable.h>
#define P(x) KMP_PREFIX(x)
struct P(struct) {
}
#else
# if defined(KMP_USE_UTF8)
-# include "ucw/unicode.h"
+# include <ucw/unicode.h>
# if defined(KMP_ONLYALPHA) || defined(KMP_TOLOWER) || defined(KMP_UNACCENT)
-# include "charset/unicat.h"
+# include <charset/unicat.h>
# endif
# elif defined(KMP_USE_ASCII)
# if defined(KMP_ONLYALPHA) || defined(KMP_TOLOWER)
-# include "ucw/chartype.h"
+# include <ucw/chartype.h>
# endif
# endif
static inline int
P(get_char) (struct P(struct) *kmp UNUSED, P(source_t) *src, P(char_t) *c)
{
# ifdef KMP_USE_UTF8
- uns cc;
+ uint cc;
*src = utf8_get(*src, &cc);
# ifdef KMP_ONLYALPHA
if (!cc) {}
# endif
}
# else
- uns cc = *(*src)++;
+ uint cc = *(*src)++;
# ifdef KMP_ONLYALPHA
if (!cc) {}
else if (!Calpha(cc))
if (!P(get_char)(kmp, &src, &c))
return NULL;
struct P(state) *p = &kmp->null, *s;
- uns len = 0;
+ uint len = 0;
do
{
s = P(hash_find)(&kmp->hash, p, c);
{
if (P(empty)(kmp))
return;
- uns read = 0, write = 0;
+ uint read = 0, write = 0;
struct P(state) *fifo[kmp->hash.hash_count], *null = &kmp->null;
for (struct P(state) *s = null->back; s; s = s->next)
fifo[write++] = s;
# undef KMP_WANT_SEARCH
# define KMPS_PREFIX(x) KMP_PREFIX(x)
# define KMPS_KMP_PREFIX(x) KMP_PREFIX(x)
-# include "ucw/kmp-search.h"
+# include <ucw/kmp-search.h>
#endif
#undef KMP_PREFIX