From 40e64fc6d452f02389a00e5c8004f895342099c2 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Sat, 15 Jan 2005 21:45:42 +0000 Subject: [PATCH] Renamed Set utility to DFASet, since this is tied to the DFA module. Renamed include/set.h to include/dfaset.h. Using YAZ_BEGIN_CDECL for public headers. Removed str.h . It is not used anywhere. --- Makefile.am | 4 +-- dfa/dfa.c | 90 ++++++++++++++++++++++++------------------------- dfa/dfap.h | 12 +++---- dfa/set.c | 79 +++++++++++++++++++++---------------------- dfa/states.c | 12 +++---- include/Makefile.am | 4 +-- include/bset.h | 13 +++---- include/dfa.h | 18 ++++------ include/dfaset.h | 57 +++++++++++++++++++++++++++++++ include/direntz.h | 15 +++------ include/idzebra/api.h | 14 ++++---- include/passwddb.h | 14 +++----- include/set.h | 61 --------------------------------- include/sortidx.h | 11 +++--- include/str.h | 54 ----------------------------- index/zinfo.h | 9 ++++- 16 files changed, 197 insertions(+), 270 deletions(-) create mode 100644 include/dfaset.h delete mode 100644 include/set.h delete mode 100644 include/str.h diff --git a/Makefile.am b/Makefile.am index 0d65ba9..fecd704 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -## $Id: Makefile.am,v 1.19 2004-09-30 06:59:44 adam Exp $ +## $Id: Makefile.am,v 1.20 2005-01-15 21:45:42 adam Exp $ AUTOMAKE_OPTIONS=foreign @@ -11,7 +11,7 @@ aclocal_DATA = idzebra.m4 SPEC_FILE=$(PACKAGE).spec EXTRA_DIST= README NEWS $(SPEC_FILE) idzebra.spec.in \ - idzebra-config.in idzebra.m4 + idzebra-config.in idzebra.m4 Doxyfile.in dist-hook: cp $(srcdir)/LICENSE* $(distdir) diff --git a/dfa/dfa.c b/dfa/dfa.c index 310bd58..d58b303 100644 --- a/dfa/dfa.c +++ b/dfa/dfa.c @@ -1,4 +1,4 @@ -/* $Id: dfa.c,v 1.32 2005-01-15 19:38:18 adam Exp $ +/* $Id: dfa.c,v 1.33 2005-01-15 21:45:42 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -50,8 +50,8 @@ struct Tnode { } u; unsigned pos : 15; /* CAT/OR/STAR/EPSILON or non-neg. position */ unsigned nullable : 1; - Set firstpos; /* first positions */ - Set lastpos; /* last positions */ + DFASet firstpos; /* first positions */ + DFASet lastpos; /* last positions */ }; struct Tblock { /* Tnode bucket (block) */ @@ -78,7 +78,7 @@ static void init_pos (struct DFA_parse *parse_info), del_pos (struct DFA_parse *parse_info), mk_dfa_tran (struct DFA_parse *parse_info, struct DFA_states *dfas), - add_follow (struct DFA_parse *parse_info, Set lastpos, Set firstpos), + add_follow (struct DFA_parse *parse_info, DFASet lastpos, DFASet firstpos), dfa_trav (struct DFA_parse *parse_info, struct Tnode *n), init_followpos (struct DFA_parse *parse_info), pr_tran (struct DFA_parse *parse_info, struct DFA_states *dfas), @@ -628,12 +628,12 @@ static void del_pos (struct DFA_parse *parse_info) } static void add_follow (struct DFA_parse *parse_info, - Set lastpos, Set firstpos) + DFASet lastpos, DFASet firstpos) { while (lastpos) { parse_info->followpos[lastpos->value] = - union_Set (parse_info->poset, + union_DFASet (parse_info->poset, parse_info->followpos[lastpos->value], firstpos); lastpos = lastpos->next; } @@ -642,7 +642,7 @@ static void add_follow (struct DFA_parse *parse_info, static void dfa_trav (struct DFA_parse *parse_info, struct Tnode *n) { struct Tnode **posar = parse_info->posar; - SetType poset = parse_info->poset; + DFASetType poset = parse_info->poset; switch (n->pos) { @@ -650,21 +650,21 @@ static void dfa_trav (struct DFA_parse *parse_info, struct Tnode *n) dfa_trav (parse_info, n->u.p[0]); dfa_trav (parse_info, n->u.p[1]); n->nullable = n->u.p[0]->nullable & n->u.p[1]->nullable; - n->firstpos = mk_Set (poset); - n->firstpos = union_Set (poset, n->firstpos, n->u.p[0]->firstpos); + n->firstpos = mk_DFASet (poset); + n->firstpos = union_DFASet (poset, n->firstpos, n->u.p[0]->firstpos); if (n->u.p[0]->nullable) - n->firstpos = union_Set (poset, n->firstpos, n->u.p[1]->firstpos); - n->lastpos = mk_Set (poset); - n->lastpos = union_Set (poset, n->lastpos, n->u.p[1]->lastpos); + n->firstpos = union_DFASet (poset, n->firstpos, n->u.p[1]->firstpos); + n->lastpos = mk_DFASet (poset); + n->lastpos = union_DFASet (poset, n->lastpos, n->u.p[1]->lastpos); if (n->u.p[1]->nullable) - n->lastpos = union_Set (poset, n->lastpos, n->u.p[0]->lastpos); + n->lastpos = union_DFASet (poset, n->lastpos, n->u.p[0]->lastpos); add_follow (parse_info, n->u.p[0]->lastpos, n->u.p[1]->firstpos); - n->u.p[0]->firstpos = rm_Set (poset, n->u.p[0]->firstpos); - n->u.p[0]->lastpos = rm_Set (poset, n->u.p[0]->lastpos); - n->u.p[1]->firstpos = rm_Set (poset, n->u.p[1]->firstpos); - n->u.p[1]->lastpos = rm_Set (poset, n->u.p[1]->lastpos); + n->u.p[0]->firstpos = rm_DFASet (poset, n->u.p[0]->firstpos); + n->u.p[0]->lastpos = rm_DFASet (poset, n->u.p[0]->lastpos); + n->u.p[1]->firstpos = rm_DFASet (poset, n->u.p[1]->firstpos); + n->u.p[1]->lastpos = rm_DFASet (poset, n->u.p[1]->lastpos); if (debug_dfa_trav) printf ("CAT"); break; @@ -673,14 +673,14 @@ static void dfa_trav (struct DFA_parse *parse_info, struct Tnode *n) dfa_trav (parse_info, n->u.p[1]); n->nullable = n->u.p[0]->nullable | n->u.p[1]->nullable; - n->firstpos = merge_Set (poset, n->u.p[0]->firstpos, + n->firstpos = merge_DFASet (poset, n->u.p[0]->firstpos, n->u.p[1]->firstpos); - n->lastpos = merge_Set (poset, n->u.p[0]->lastpos, + n->lastpos = merge_DFASet (poset, n->u.p[0]->lastpos, n->u.p[1]->lastpos); - n->u.p[0]->firstpos = rm_Set (poset, n->u.p[0]->firstpos); - n->u.p[0]->lastpos = rm_Set (poset, n->u.p[0]->lastpos); - n->u.p[1]->firstpos = rm_Set (poset, n->u.p[1]->firstpos); - n->u.p[1]->lastpos = rm_Set (poset, n->u.p[1]->lastpos); + n->u.p[0]->firstpos = rm_DFASet (poset, n->u.p[0]->firstpos); + n->u.p[0]->lastpos = rm_DFASet (poset, n->u.p[0]->lastpos); + n->u.p[1]->firstpos = rm_DFASet (poset, n->u.p[1]->firstpos); + n->u.p[1]->lastpos = rm_DFASet (poset, n->u.p[1]->lastpos); if (debug_dfa_trav) printf ("OR"); break; @@ -704,18 +704,18 @@ static void dfa_trav (struct DFA_parse *parse_info, struct Tnode *n) break; case EPSILON: n->nullable = 1; - n->lastpos = mk_Set (poset); - n->firstpos = mk_Set (poset); + n->lastpos = mk_DFASet (poset); + n->firstpos = mk_DFASet (poset); if (debug_dfa_trav) printf ("EPSILON"); break; default: posar[n->pos] = n; n->nullable = 0; - n->firstpos = mk_Set (poset); - n->firstpos = add_Set (poset, n->firstpos, n->pos); - n->lastpos = mk_Set (poset); - n->lastpos = add_Set (poset, n->lastpos, n->pos); + n->firstpos = mk_DFASet (poset); + n->firstpos = add_DFASet (poset, n->firstpos, n->pos); + n->lastpos = mk_DFASet (poset); + n->lastpos = add_DFASet (poset, n->lastpos, n->pos); if (debug_dfa_trav) { if (n->u.ch[0] < 0) @@ -737,20 +737,20 @@ static void dfa_trav (struct DFA_parse *parse_info, struct Tnode *n) { printf ("\n nullable : %c\n", n->nullable ? '1' : '0'); printf (" firstpos :"); - pr_Set (poset, n->firstpos); + pr_DFASet (poset, n->firstpos); printf (" lastpos :"); - pr_Set (poset, n->lastpos); + pr_DFASet (poset, n->lastpos); } } static void init_followpos (struct DFA_parse *parse_info) { - Set *fa; + DFASet *fa; int i; parse_info->followpos = fa = - (Set *) imalloc (sizeof(Set) * (1+parse_info->position)); + (DFASet *) imalloc (sizeof(DFASet) * (1+parse_info->position)); for (i = parse_info->position+1; --i >= 0; fa++) - *fa = mk_Set (parse_info->poset); + *fa = mk_DFASet (parse_info->poset); } static void mk_dfa_tran (struct DFA_parse *parse_info, struct DFA_states *dfas) @@ -758,12 +758,12 @@ static void mk_dfa_tran (struct DFA_parse *parse_info, struct DFA_states *dfas) int i, j, c; int max_char; short *pos, *pos_i; - Set tran_set; + DFASet tran_set; int char_0, char_1; struct DFA_state *dfa_from, *dfa_to; struct Tnode **posar; - SetType poset; - Set *followpos; + DFASetType poset; + DFASet *followpos; assert (parse_info); @@ -771,7 +771,7 @@ static void mk_dfa_tran (struct DFA_parse *parse_info, struct DFA_states *dfas) max_char = parse_info->charset->size; pos = (short *) imalloc (sizeof(*pos) * (parse_info->position+1)); - tran_set = cp_Set (parse_info->poset, parse_info->root->firstpos); + tran_set = cp_DFASet (parse_info->poset, parse_info->root->firstpos); i = add_DFA_state (dfas, &tran_set, &dfa_from); assert (i); dfa_from->rule_no = 0; @@ -814,7 +814,7 @@ static void mk_dfa_tran (struct DFA_parse *parse_info, struct DFA_states *dfas) char_1 = max_char; - tran_set = mk_Set (poset); + tran_set = mk_DFASet (poset); for (pos_i = pos; (i = *pos_i) != -1; ++pos_i) { if ((c=posar[i]->u.ch[0]) > char_0 && c <= char_1) @@ -822,7 +822,7 @@ static void mk_dfa_tran (struct DFA_parse *parse_info, struct DFA_states *dfas) else if ((c=posar[i]->u.ch[1]) >= char_0 && c < char_1) char_1 = c; /* backward chunk */ if (posar[i]->u.ch[1] >= char_0 && posar[i]->u.ch[0] <= char_0) - tran_set = union_Set (poset, tran_set, followpos[i]); + tran_set = union_DFASet (poset, tran_set, followpos[i]); } if (tran_set) { @@ -852,7 +852,7 @@ static void pr_tran (struct DFA_parse *parse_info, struct DFA_states *dfas) printf (" #%d", s->rule_nno); putchar (':'); - pr_Set (parse_info->poset, s->set); + pr_DFASet (parse_info->poset, s->set); prev_no = -1; for (i=s->tran_no, tran=s->trans; --i >= 0; tran++) { @@ -881,7 +881,7 @@ static void pr_verbose (struct DFA_parse *parse_info, struct DFA_states *dfas) k = inf_BSetHandle (parse_info->charset, &i, &j); printf ("%ld/%ld character sets, %d bytes each\n", i/k, j/k, k*sizeof(BSetWord)); - k = inf_SetType (parse_info->poset, &i, &j); + k = inf_DFASetType (parse_info->poset, &i, &j); printf ("%ld/%ld poset items, %d bytes each\n", i, j, k); printf ("%d DFA states\n", dfas->no); } @@ -894,7 +894,7 @@ static void pr_followpos (struct DFA_parse *parse_info) for (i=1; i <= parse_info->position; i++) { printf ("%3d:", i); - pr_Set (parse_info->poset, parse_info->followpos[i]); + pr_DFASet (parse_info->poset, parse_info->followpos[i]); putchar ('\t'); if (posar[i]->u.ch[0] < 0) @@ -1056,7 +1056,7 @@ static struct DFA_states *mk_dfas (struct DFA_parse *dfap, int poset_chunk) assert (poset_chunk > 10); assert (dfap); - parse_info->poset = mk_SetType (poset_chunk); + parse_info->poset = mk_DFASetType (poset_chunk); init_pos(parse_info); init_followpos(parse_info); assert (parse_info->root); @@ -1074,7 +1074,7 @@ static struct DFA_states *mk_dfas (struct DFA_parse *dfap, int poset_chunk) pr_verbose (parse_info, dfas); del_pos(parse_info); del_followpos(parse_info); - rm_SetType (parse_info->poset); + rm_DFASetType (parse_info->poset); return dfas; } diff --git a/dfa/dfap.h b/dfa/dfap.h index 5d3c914..b37aa21 100644 --- a/dfa/dfap.h +++ b/dfa/dfap.h @@ -1,4 +1,4 @@ -/* $Id: dfap.h,v 1.11 2005-01-15 19:38:18 adam Exp $ +/* $Id: dfap.h,v 1.12 2005-01-15 21:45:42 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -54,8 +54,8 @@ struct DFA_parse { struct Tnode **posar; - SetType poset; - Set *followpos; + DFASetType poset; + DFASet *followpos; const char **(*cmap)(void *vp, const char **from, int len); }; @@ -71,16 +71,16 @@ struct DFA_states { struct DFA_state *marked; /* chain of marked DFA states */ DFA_stateb *statemem; /* state memory */ int no; /* no of states (unmarked+marked) */ - SetType st; /* Position set type */ + DFASetType st; /* Position set type */ int hash; /* no hash entries in hasharray */ struct DFA_state **hasharray; /* hash pointers */ struct DFA_state **sortarray; /* sorted DFA states */ struct DFA_trans *transmem; /* transition memory */ }; -int init_DFA_states (struct DFA_states **dfasp, SetType st, int hash); +int init_DFA_states (struct DFA_states **dfasp, DFASetType st, int hash); int rm_DFA_states (struct DFA_states **dfasp); -int add_DFA_state (struct DFA_states *dfas, Set *s, +int add_DFA_state (struct DFA_states *dfas, DFASet *s, struct DFA_state **sp); struct DFA_state *get_DFA_state (struct DFA_states *dfas); void sort_DFA_states (struct DFA_states *dfas); diff --git a/dfa/set.c b/dfa/set.c index 81ef050..f13e307 100644 --- a/dfa/set.c +++ b/dfa/set.c @@ -1,4 +1,4 @@ -/* $Id: set.c,v 1.9 2005-01-15 19:38:19 adam Exp $ +/* $Id: set.c,v 1.10 2005-01-15 21:45:42 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -27,19 +27,18 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include +#include #include "imalloc.h" +static DFASet mk_DFASetElement (DFASetType st, int n); -static Set mk_SetElement (SetType st, int n); - -SetType mk_SetType (int chunk) +DFASetType mk_DFASetType (int chunk) { - SetType st; + DFASetType st; assert (chunk > 8 && chunk < 8000); - st = (SetType) imalloc (sizeof(*st)); + st = (DFASetType) imalloc (sizeof(*st)); assert (st); st->alloclist = st->freelist = NULL; @@ -48,20 +47,20 @@ SetType mk_SetType (int chunk) return st; } -int inf_SetType (SetType st, long *used, long *allocated) +int inf_DFASetType (DFASetType st, long *used, long *allocated) { - Set s; + DFASet s; assert (st); *used = st->used; *allocated = 0; for (s = st->alloclist; s; s = s->next) *allocated += st->chunk; - return sizeof (SetElement); + return sizeof (DFASetElement); } -SetType rm_SetType (SetType st) +DFASetType rm_DFASetType (DFASetType st) { - Set s, s1; + DFASet s, s1; for (s = st->alloclist; (s1 = s);) { s = s->next; @@ -71,22 +70,22 @@ SetType rm_SetType (SetType st) return NULL; } -Set mk_Set (SetType st) +DFASet mk_DFASet (DFASetType st) { assert (st); return NULL; } -static Set mk_SetElement (SetType st, int n) +static DFASet mk_DFASetElement (DFASetType st, int n) { - Set s; + DFASet s; int i; assert (st); assert (st->chunk > 8); if (! st->freelist) { - s = (Set) imalloc (sizeof(*s) * (1+st->chunk)); + s = (DFASet) imalloc (sizeof(*s) * (1+st->chunk)); assert (s); s->next = st->alloclist; st->alloclist = s; @@ -103,7 +102,7 @@ static Set mk_SetElement (SetType st, int n) } #if 0 -static void rm_SetElement (SetType st, SetElement *p) +static void rm_DFASetElement (DFASetType st, DFASetElement *p) { assert (st); assert (st->used > 0); @@ -113,9 +112,9 @@ static void rm_SetElement (SetType st, SetElement *p) } #endif -Set rm_Set (SetType st, Set s) +DFASet rm_DFASet (DFASetType st, DFASet s) { - Set s1 = s; + DFASet s1 = s; int i = 1; if (s) @@ -133,27 +132,27 @@ Set rm_Set (SetType st, Set s) return NULL; } -Set add_Set (SetType st, Set s, int n) +DFASet add_DFASet (DFASetType st, DFASet s, int n) { - SetElement dummy; - Set p = &dummy, snew; + DFASetElement dummy; + DFASet p = &dummy, snew; p->next = s; while (p->next && p->next->value < n) p = p->next; assert (p); if (!(p->next && p->next->value == n)) { - snew = mk_SetElement (st, n); + snew = mk_DFASetElement (st, n); snew->next = p->next; p->next = snew; } return dummy.next; } -Set union_Set (SetType st, Set s1, Set s2) +DFASet union_DFASet (DFASetType st, DFASet s1, DFASet s2) { - SetElement dummy; - Set p; + DFASetElement dummy; + DFASet p; assert (st); for (p = &dummy; s1 && s2;) @@ -164,7 +163,7 @@ Set union_Set (SetType st, Set s1, Set s2) } else if (s1->value > s2->value) { - p = p->next = mk_SetElement (st, s2->value); + p = p->next = mk_DFASetElement (st, s2->value); s2 = s2->next; } else @@ -179,7 +178,7 @@ Set union_Set (SetType st, Set s1, Set s2) { while (s2) { - p = p->next = mk_SetElement (st, s2->value); + p = p->next = mk_DFASetElement (st, s2->value); s2 = s2->next; } p->next = NULL; @@ -187,30 +186,30 @@ Set union_Set (SetType st, Set s1, Set s2) return dummy.next; } -Set cp_Set (SetType st, Set s) +DFASet cp_DFASet (DFASetType st, DFASet s) { - return merge_Set (st, s, NULL); + return merge_DFASet (st, s, NULL); } -Set merge_Set (SetType st, Set s1, Set s2) +DFASet merge_DFASet (DFASetType st, DFASet s1, DFASet s2) { - SetElement dummy; - Set p; + DFASetElement dummy; + DFASet p; assert (st); for (p = &dummy; s1 && s2; p = p->next) if (s1->value < s2->value) { - p->next = mk_SetElement (st, s1->value); + p->next = mk_DFASetElement (st, s1->value); s1 = s1->next; } else if (s1->value > s2->value) { - p->next = mk_SetElement (st, s2->value); + p->next = mk_DFASetElement (st, s2->value); s2 = s2->next; } else { - p->next = mk_SetElement (st, s1->value); + p->next = mk_DFASetElement (st, s1->value); s1 = s1->next; s2 = s2->next; } @@ -218,14 +217,14 @@ Set merge_Set (SetType st, Set s1, Set s2) s1 = s2; while (s1) { - p = p->next = mk_SetElement (st, s1->value); + p = p->next = mk_DFASetElement (st, s1->value); s1 = s1->next; } p->next = NULL; return dummy.next; } -void pr_Set (SetType st, Set s) +void pr_DFASet (DFASetType st, DFASet s) { assert (st); while (s) @@ -236,7 +235,7 @@ void pr_Set (SetType st, Set s) putchar ('\n'); } -unsigned hash_Set (SetType st, Set s) +unsigned hash_DFASet (DFASetType st, DFASet s) { unsigned n = 0; while (s) @@ -247,7 +246,7 @@ unsigned hash_Set (SetType st, Set s) return n; } -int eq_Set (SetType st, Set s1, Set s2) +int eq_DFASet (DFASetType st, DFASet s1, DFASet s2) { for (; s1 && s2; s1=s1->next, s2=s2->next) if (s1->value != s2->value) diff --git a/dfa/states.c b/dfa/states.c index 3e4542e..76cf6cf 100644 --- a/dfa/states.c +++ b/dfa/states.c @@ -1,4 +1,4 @@ -/* $Id: states.c,v 1.8 2005-01-15 19:38:19 adam Exp $ +/* $Id: states.c,v 1.9 2005-01-15 21:45:42 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -33,7 +33,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define DFA_CHUNK 40 #define TRAN_CHUNK 100 -int init_DFA_states (struct DFA_states **dfasp, SetType st, int hash) +int init_DFA_states (struct DFA_states **dfasp, DFASetType st, int hash) { struct DFA_states *dfas; struct DFA_trans *tm; @@ -95,7 +95,7 @@ int rm_DFA_states (struct DFA_states **dfasp) return 0; } -int add_DFA_state (struct DFA_states *dfas, Set *s, struct DFA_state **sp) +int add_DFA_state (struct DFA_states *dfas, DFASet *s, struct DFA_state **sp) { int i; struct DFA_state *si, **sip; @@ -104,12 +104,12 @@ int add_DFA_state (struct DFA_states *dfas, Set *s, struct DFA_state **sp) assert (dfas); assert (*s); assert (dfas->hasharray); - sip = dfas->hasharray + (hash_Set (dfas->st, *s) % dfas->hash); + sip = dfas->hasharray + (hash_DFASet (dfas->st, *s) % dfas->hash); for (si = *sip; si; si=si->link) - if (eq_Set (dfas->st, si->set, *s)) + if (eq_DFASet (dfas->st, si->set, *s)) { *sp = si; - *s = rm_Set (dfas->st, *s); + *s = rm_DFASet (dfas->st, *s); return 0; } if (!dfas->freelist) diff --git a/include/Makefile.am b/include/Makefile.am index c6d653a..f06e009 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,6 +1,6 @@ -# $Id: Makefile.am,v 1.20 2004-12-08 14:02:36 adam Exp $ +# $Id: Makefile.am,v 1.21 2005-01-15 21:45:42 adam Exp $ noinst_HEADERS = bset.h charmap.h \ direntz.h passwddb.h dfa.h zebra_xpath.h d1_absyn.h \ -rset.h set.h sortidx.h str.h zebra-lock.h zebrautl.h +rset.h dfaset.h sortidx.h zebra-lock.h zebrautl.h SUBDIRS = idzebra diff --git a/include/bset.h b/include/bset.h index bcf928d..de9eea7 100644 --- a/include/bset.h +++ b/include/bset.h @@ -1,4 +1,4 @@ -/* $Id: bset.h,v 1.5 2005-01-15 19:38:24 adam Exp $ +/* $Id: bset.h,v 1.6 2005-01-15 21:45:42 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -20,13 +20,12 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - #ifndef BSET_H #define BSET_H -#ifdef __cplusplus -extern "C" { -#endif +#include + +YAZ_BEGIN_CDECL typedef unsigned short BSetWord; typedef BSetWord *BSet; @@ -58,8 +57,6 @@ unsigned hash_BSet (BSetHandle *sh, BSet src); int eq_BSet (BSetHandle *sh, BSet dst, BSet src); void pr_charBSet (BSetHandle *sh, BSet src, void (*f)(int)); -#ifdef __cplusplus -} -#endif +YAZ_END_CDECL #endif diff --git a/include/dfa.h b/include/dfa.h index 11cba99..345109d 100644 --- a/include/dfa.h +++ b/include/dfa.h @@ -1,4 +1,4 @@ -/* $Id: dfa.h,v 1.11 2005-01-15 19:38:24 adam Exp $ +/* $Id: dfa.h,v 1.12 2005-01-15 21:45:42 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -20,17 +20,15 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - - #ifndef DFA_H #define DFA_H #include -#include +#include -#ifdef __cplusplus -extern "C" { -#endif +#include + +YAZ_BEGIN_CDECL struct DFA_tran { unsigned char ch[2]; /* transition on ch[0] <= c <= ch[1] to */ @@ -48,7 +46,7 @@ struct DFA_state { struct DFA_state *next; /* next entry in free/unmarked/marked list */ struct DFA_state *link; /* link to next entry in hash chain */ struct DFA_tran *trans; /* transition list */ - Set set; /* set of positions (important nfa states) */ + DFASet set; /* set of positions (important nfa states) */ short no; /* no of this state */ short tran_no; /* no of transitions to other states */ short rule_no; /* if non-zero, this holds accept rule no */ @@ -101,8 +99,6 @@ extern unsigned short #define DFA_ERR_LP 2 #define DFA_ERR_RP 3 -#ifdef __cplusplus -} -#endif +YAZ_END_CDECL #endif diff --git a/include/dfaset.h b/include/dfaset.h new file mode 100644 index 0000000..1f52be7 --- /dev/null +++ b/include/dfaset.h @@ -0,0 +1,57 @@ +/* $Id: dfaset.h,v 1.1 2005-01-15 21:45:42 adam Exp $ + Copyright (C) 1995-2005 + Index Data ApS + +This file is part of the Zebra server. + +Zebra is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Zebra is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Zebra; see the file LICENSE.zebra. If not, write to the +Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. +*/ + +#ifndef DFASET_H +#define DFASET_H + +#include + +YAZ_BEGIN_CDECL + +typedef struct DFASetElement_ { + struct DFASetElement_ *next; + int value; +} DFASetElement, *DFASet; + +typedef struct { + DFASet alloclist; + DFASet freelist; + long used; + int chunk; +} *DFASetType; + +DFASetType mk_DFASetType (int chunk); +int inf_DFASetType(DFASetType st, long *used, long *allocated); +DFASetType rm_DFASetType (DFASetType st); +DFASet mk_DFASet (DFASetType st); +DFASet add_DFASet (DFASetType st, DFASet s, int value); +DFASet merge_DFASet (DFASetType st, DFASet s1, DFASet s2); +DFASet union_DFASet (DFASetType st, DFASet s1, DFASet s2); +DFASet rm_DFASet (DFASetType st, DFASet s); +DFASet cp_DFASet (DFASetType st, DFASet s); +void pr_DFASet (DFASetType st, DFASet s); +unsigned hash_DFASet (DFASetType st, DFASet s); +int eq_DFASet (DFASetType s, DFASet s1, DFASet s2); + +YAZ_END_CDECL +#endif + diff --git a/include/direntz.h b/include/direntz.h index d09cd2a..655d336 100644 --- a/include/direntz.h +++ b/include/direntz.h @@ -1,4 +1,4 @@ -/* $Id: direntz.h,v 1.9 2005-01-15 19:38:24 adam Exp $ +/* $Id: direntz.h,v 1.10 2005-01-15 21:45:42 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -20,16 +20,13 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - - - #ifdef WIN32 /* make WIN32 version of dirent */ #include -#ifdef __cplusplus -extern "C" { -#endif +#include + +YAZ_BEGIN_CDECL struct dirent { char d_name[MAX_PATH]; @@ -41,9 +38,7 @@ DIR *opendir (const char *path); struct dirent *readdir (DIR *dd); void closedir (DIR *dd); -#ifdef __cplusplus -} -#endif +YAZ_ENC_CDECL #else /* include UNIX version */ diff --git a/include/idzebra/api.h b/include/idzebra/api.h index 132f4dd..3336ca2 100644 --- a/include/idzebra/api.h +++ b/include/idzebra/api.h @@ -1,4 +1,4 @@ -/* $Id: api.h,v 1.6 2005-01-15 19:38:24 adam Exp $ +/* $Id: api.h,v 1.7 2005-01-15 21:45:43 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -20,6 +20,11 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/** + * \file api.h + * \brief Zebra API + */ + /* Return codes: * Most functions return an int. Unix-like, 0 means OK, * non-zero means an error. The error info should be available @@ -35,13 +40,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -/* Fixme! Compare string (ignore case) */ -#ifdef WIN32 -#define STRCASECMP stricmp -#else -#define STRCASECMP strcasecmp -#endif - YAZ_BEGIN_CDECL typedef struct { diff --git a/include/passwddb.h b/include/passwddb.h index 5e0bc26..d3e750d 100644 --- a/include/passwddb.h +++ b/include/passwddb.h @@ -1,4 +1,4 @@ -/* $Id: passwddb.h,v 1.5 2005-01-15 19:38:24 adam Exp $ +/* $Id: passwddb.h,v 1.6 2005-01-15 21:45:42 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -20,14 +20,12 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - - #ifndef PASSWDDB_H #define PASSWDDB_H -#ifdef __cplusplus -extern "C" { -#endif +#include + +YAZ_BEGIN_CDECL typedef struct passwd_db *Passwd_db; @@ -37,9 +35,7 @@ int passwd_db_file (Passwd_db db, const char *fname); void passwd_db_close (Passwd_db db); void passwd_db_show (Passwd_db db); -#ifdef __cplusplus -} -#endif +YAZ_END_CDECL #endif diff --git a/include/set.h b/include/set.h deleted file mode 100644 index c397886..0000000 --- a/include/set.h +++ /dev/null @@ -1,61 +0,0 @@ -/* $Id: set.h,v 1.5 2005-01-15 19:38:24 adam Exp $ - Copyright (C) 1995-2005 - Index Data ApS - -This file is part of the Zebra server. - -Zebra is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. - -Zebra is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with Zebra; see the file LICENSE.zebra. If not, write to the -Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. -*/ - - -#ifndef SET_H -#define SET_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct SetElement_ { - struct SetElement_ *next; - int value; -} SetElement, *Set; - -typedef struct { - Set alloclist; - Set freelist; - long used; - int chunk; -} *SetType; - -SetType mk_SetType (int chunk); -int inf_SetType (SetType st, long *used, long *allocated); -SetType rm_SetType (SetType st); -Set mk_Set (SetType st); -Set add_Set (SetType st, Set s, int value); -Set merge_Set (SetType st, Set s1, Set s2); -Set union_Set (SetType st, Set s1, Set s2); -Set rm_Set (SetType st, Set s); -Set cp_Set (SetType st, Set s); -void pr_Set (SetType st, Set s); -unsigned hash_Set (SetType st, Set s); -int eq_Set (SetType s, Set s1, Set s2); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/include/sortidx.h b/include/sortidx.h index 8ad0054..d77ca12 100644 --- a/include/sortidx.h +++ b/include/sortidx.h @@ -1,4 +1,4 @@ -/* $Id: sortidx.h,v 1.7 2005-01-15 19:38:24 adam Exp $ +/* $Id: sortidx.h,v 1.8 2005-01-15 21:45:42 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -23,12 +23,11 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #ifndef SORTIDX_H #define SORTIDX_H +#include #include #include -#ifdef __cplusplus -extern "C" { -#endif +YAZ_BEGIN_CDECL #define SORT_IDX_ENTRYSIZE 64 @@ -41,8 +40,6 @@ void sortIdx_sysno (SortIdx si, SYSNO sysno); void sortIdx_add (SortIdx si, const char *buf, int len); void sortIdx_read (SortIdx si, char *buf); -#ifdef __cplusplus -} -#endif +YAZ_END_CDECL #endif diff --git a/include/str.h b/include/str.h deleted file mode 100644 index c7df294..0000000 --- a/include/str.h +++ /dev/null @@ -1,54 +0,0 @@ -/* $Id: str.h,v 1.6 2005-01-15 19:38:24 adam Exp $ - Copyright (C) 1995-2005 - Index Data ApS - -This file is part of the Zebra server. - -Zebra is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. - -Zebra is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with Zebra; see the file LICENSE.zebra. If not, write to the -Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. -*/ - - - -#ifndef STR_H -#define STR_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct str_index -{ - int size; - char *data; -} str_index; - -typedef struct strings_data -{ - str_index *index; - int num_index; - char *bulk; -} strings_data, *STRINGS; - -STRINGS str_open(char *lang, char *name); -void str_close(STRINGS st); -char *str(STRINGS st, int num); -char *strf(STRINGS st, int num, ...); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/index/zinfo.h b/index/zinfo.h index dccdcec..de8e015 100644 --- a/index/zinfo.h +++ b/index/zinfo.h @@ -1,4 +1,4 @@ -/* $Id: zinfo.h,v 1.20 2005-01-15 19:38:29 adam Exp $ +/* $Id: zinfo.h,v 1.21 2005-01-15 21:45:43 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -28,6 +28,13 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include "recindex.h" +/* Compare string (ignore case) */ +#ifdef WIN32 +#define STRCASECMP stricmp +#else +#define STRCASECMP strcasecmp +#endif + YAZ_BEGIN_CDECL typedef struct zebraExplainInfo *ZebraExplainInfo; -- 1.7.10.4