X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=include%2Fdfa.h;h=345109d1ae6e25ff8df8be6d5cbefba43234e494;hb=9eebf93dc2525854867cbc43920ea8ba4a199ab5;hp=be348080fd251d97e5132da7cc2e99a5c71d2dee;hpb=1500f5fe8c94909acf30d8a698636079b123e39a;p=idzebra-moved-to-github.git diff --git a/include/dfa.h b/include/dfa.h index be34808..345109d 100644 --- a/include/dfa.h +++ b/include/dfa.h @@ -1,29 +1,34 @@ -/* - * Copyright (C) 1994, Index Data I/S - * All rights reserved. - * Sebastian Hammer, Adam Dickmeiss - * - * $Log: dfa.h,v $ - * Revision 1.4 1995-01-25 11:31:04 adam - * Simple error reporting when parsing regular expressions. - * - * Revision 1.3 1995/01/24 16:01:30 adam - * Added -ansi to CFLAGS. - * New functions and change of data structures. - * - * Revision 1.2 1994/09/26 16:31:23 adam - * Minor changes. xmalloc declares xcalloc now. - * - * Revision 1.1 1994/09/26 10:17:43 adam - * Dfa-module header files. - * - */ +/* $Id: dfa.h,v 1.12 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 DFA_H #define DFA_H #include -#include +#include + +#include + +YAZ_BEGIN_CDECL struct DFA_tran { unsigned char ch[2]; /* transition on ch[0] <= c <= ch[1] to */ @@ -41,10 +46,11 @@ 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 */ + short rule_nno; /* accept rule no - except start rules */ }; struct DFA { @@ -55,10 +61,17 @@ struct DFA { }; struct DFA *dfa_init (void); -int dfa_parse (struct DFA *, char **); +void dfa_set_cmap (struct DFA *dfa, void *vp, + const char **(*cmap)(void *vp, const char **from, int len)); +int dfa_parse (struct DFA *, const char **); void dfa_mkstate (struct DFA *); void dfa_delete (struct DFA **); +void dfa_parse_cmap_clean (struct DFA *d); +void dfa_parse_cmap_new (struct DFA *d, const int *cmap); +void dfa_parse_cmap_del (struct DFA *d, int from); +void dfa_parse_cmap_add (struct DFA *d, int from, int to); + extern int debug_dfa_trav; extern int debug_dfa_tran; extern int debug_dfa_followpos; @@ -68,7 +81,24 @@ extern unsigned short dfa_thompson_chars[], dfa_ccl_chars[]; +#define L_LP 1 +#define L_RP 2 +#define L_CHAR 3 +#define L_CHARS 4 +#define L_ANY 5 +#define L_ALT 6 +#define L_ANYZ 7 +#define L_WILD 8 +#define L_QUEST 9 +#define L_CLOS1 10 +#define L_CLOS0 11 +#define L_END 12 +#define L_START 13 + #define DFA_ERR_SYNTAX 1 #define DFA_ERR_LP 2 #define DFA_ERR_RP 3 + +YAZ_END_CDECL + #endif