From: Adam Dickmeiss Date: Mon, 16 Oct 1995 09:31:24 +0000 (+0000) Subject: Bug fix. X-Git-Tag: ZEBRA.1.0~699 X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=commitdiff_plain;h=a825e22395e14761bcb2f88177d1a86f3da2843a Bug fix. --- diff --git a/dfa/agrep.c b/dfa/agrep.c index 81835d0..405104d 100644 --- a/dfa/agrep.c +++ b/dfa/agrep.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: agrep.c,v $ - * Revision 1.6 1995-09-28 09:18:51 adam + * Revision 1.7 1995-10-16 09:31:24 adam + * Bug fix. + * + * Revision 1.6 1995/09/28 09:18:51 adam * Removed various preprocessor defines. * * Revision 1.5 1995/09/04 12:33:25 adam @@ -274,7 +277,8 @@ char **argv; } if (!no) { - fprintf (stderr, "%s: no files specified\n", prog); + fprintf (stderr, "usage:\n " + " %s [-d] [-v] [-n] [-f] pattern file ..\n", prog); return 2; } fflush(stdout); diff --git a/dfa/dfa.c b/dfa/dfa.c index b2afb6f..45e2493 100644 --- a/dfa/dfa.c +++ b/dfa/dfa.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: dfa.c,v $ - * Revision 1.5 1995-10-02 15:17:58 adam + * Revision 1.6 1995-10-16 09:31:25 adam + * Bug fix. + * + * Revision 1.5 1995/10/02 15:17:58 adam * Bug fix in dfa_delete. * * Revision 1.4 1995/09/28 09:18:52 adam @@ -763,27 +766,28 @@ static void mk_dfa_tran (struct DFA_states *dfas) { char_0 = max_char+1; for (pos_i = pos; (i = *pos_i) != -1; ++pos_i) - if (posar[i]->u.ch[1] >= char_1) - if ((c=posar[i]->u.ch[0]) < char_0) - if (c < char_1) - char_0 = char_1; - else - char_0 = c; + if (posar[i]->u.ch[1] >= char_1 + && (c=posar[i]->u.ch[0]) < char_0) + if (c < char_1) + char_0 = char_1; + else + char_0 = c; - char_1 = max_char; if (char_0 > max_char) break; + + char_1 = max_char; + tran_set = mk_Set (poset); for (pos_i = pos; (i = *pos_i) != -1; ++pos_i) - if ((c=posar[i]->u.ch[1]) >= char_0) - if (posar[i]->u.ch[0] <= char_0) - { - if (c < char_1) - char_1 = c; - tran_set = union_Set (poset, tran_set, followpos[i]); - } - else if (c <= char_1) - char_1 = c-1; + { + if ((c=posar[i]->u.ch[0]) > char_0 && c <= char_1) + char_1 = c - 1; /* forward chunk */ + 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]); + } if (tran_set) { add_DFA_state (dfas, &tran_set, &dfa_to);