Implemented auto-generation of CategoryList records.
[idzebra-moved-to-github.git] / dfa / dfa.c
index 7b14ec6..5da189a 100644 (file)
--- a/dfa/dfa.c
+++ b/dfa/dfa.c
@@ -1,10 +1,16 @@
 /*
- * Copyright (C) 1994-1997, Index Data I/S 
+ * Copyright (C) 1994-1998, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: dfa.c,v $
- * Revision 1.18  1997-09-29 09:05:17  adam
+ * Revision 1.20  1998-06-08 14:40:44  adam
+ * Fixed problem with signed character(s) in regular expressions.
+ *
+ * Revision 1.19  1998/01/12 14:39:39  adam
+ * Fixed bug in term_Tnode.
+ *
+ * Revision 1.18  1997/09/29 09:05:17  adam
  * Thread safe DFA module. We simply had to put a few static vars to
  * the DFA_parse structure.
  *
@@ -481,7 +487,7 @@ static int map_l_char (struct DFA_parse *parse_info)
     if (cp0[0] == 1 && cp0[1])
     {
         parse_info->expr_ptr++;
-        parse_info->look_ch = cp0[1];
+        parse_info->look_ch = cp0[1] & 255;
         return L_CHAR;
     }
     if (!parse_info->cmap)
@@ -491,7 +497,7 @@ static int map_l_char (struct DFA_parse *parse_info)
     assert (mapto);
     
     parse_info->expr_ptr = (const unsigned char *) cp0;
-    parse_info->look_ch = mapto[i][0];
+    parse_info->look_ch = mapto[i][0] & 255;
     logf (LOG_DEBUG, "map from %c to %d", parse_info->expr_ptr[-1], parse_info->look_ch);
     return L_CHAR;
 }
@@ -534,7 +540,7 @@ static const char *str_char (unsigned c)
 {
     static char s[6];
     s[0] = '\\';
-    if (c < 32)
+    if (c < 32 || c >= 127)
         switch (c)
         {
         case '\r':
@@ -1059,6 +1065,7 @@ static struct DFA_parse *dfa_parse_init (void)
     add_BSet (parse_info->charset, parse_info->anyset, '\n');
     com_BSet (parse_info->charset, parse_info->anyset);
     parse_info->use_Tnode = parse_info->max_Tnode = 0;
+    parse_info->start = parse_info->end = NULL;
     parse_info->charMap = NULL;
     parse_info->charMapSize = 0;
     parse_info->cmap = NULL;