-/* $Id: grepper.c,v 1.14 2005-04-15 10:47:47 adam Exp $
- Copyright (C) 1995-2005
- Index Data ApS
-
-This file is part of the Zebra server.
+/* This file is part of the Zebra server.
+ Copyright (C) 2004-2013 Index Data
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
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.
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#define INFBUF_SIZE 16384
-#define INLINE
+#define INLINE
static INLINE void set_bit (MatchContext *mc, MatchWord *m, int ch, int state)
{
mc->n = (dfa->no_states+WORD_BITS) / WORD_BITS;
mc->range = range;
mc->Sc = icalloc (sizeof(*mc->Sc) * 256 * mc->n);
-
+
for (i=0; i<dfa->no_states; i++)
{
int j;
int ch0 = state->trans[j].ch[0];
int ch1 = state->trans[j].ch[1];
assert (ch0 >= 0 && ch1 >= 0);
-
+
for (ch = ch0; ch <= ch1; ch++)
set_bit (mc, mc->Sc, ch, i);
}
while ((ch = getc (inf)) != EOF)
{
MatchWord *Rj_t;
-
+
infbuf[inf_ptr] = ch;
if (ch == '\n')
{
}
else
inf = stdin;
-
+
mc = mk_MatchContext (dfa, range);
go (mc, dfa, inf);
dfa_delete (&dfa);
return 0;
}
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+