# Copyright (C) 1994, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.1 1994-09-26 10:16:52 adam Exp $
+# $Id: Makefile,v 1.2 1994-09-26 16:30:55 adam Exp $
SHELL=/bin/sh
INCLUDE=-I../include
LIB=../lib/dfa.a
PO = regexp.o imalloc.o states.o set.o bset.o
CPP=cc -E
+YACC=yacc
all: $(LIB)
mv Makefile Makefile.tmp
$(YACC) $(YFLAGS) regexp.y
sed '/^#Depend/q' <Makefile.tmp >Makefile
- $(CPP) -M $(DEFS) *.c |sed 's/y\.tab\.o/regexp.o/g' >>Makefile
+ $(CPP) -M $(DEFS) *.c |sed 's/y\.tab\.o/regexp.o/g'|sed 's/y\.tab\.c/regexp.y/g' >>Makefile
-rm Makefile.tmp
depend2:
$(YACC) $(YFLAGS) regexp.y
- $(CPP) -M $(DEFS) *.c |sed 's/y\.tab\.o/regexp.o/g' >.depend
+ $(CPP) -M $(DEFS) *.c |sed 's/y\.tab\.o/regexp.o/g'|sed 's/y\.tab\.c/regexp.y/g' >.depend
ifeq (.depend,$(wildcard .depend))
include .depend
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: agrep.c,v $
- * Revision 1.1 1994-09-26 10:16:52 adam
+ * Revision 1.2 1994-09-26 16:30:56 adam
+ * Minor changes. imalloc uses xmalloc now.
+ *
+ * Revision 1.1 1994/09/26 10:16:52 adam
* First version of dfa module in alex. This version uses yacc to parse
* regular expressions. This should be hand-made instead.
*
#include <util.h>
+#include <dfa.h>
#include "imalloc.h"
-#include "dfa.h"
#ifndef O_BINARY
#define O_BINARY 0
{
switch( **argv )
{
-#ifdef __STDC__
case 'V':
fprintf( stderr, "%s: %s %s\n", prog, __DATE__, __TIME__ );
continue;
-#endif
case 'v':
dfa_verbose = 1;
continue;
if( !pattern )
{
pattern = *argv;
- i = parse_dfa( dfa, &pattern, grep_chars );
+ i = parse_dfa( dfa, &pattern, dfa_thompson_chars );
if( i || *pattern )
{
fprintf( stderr, "%s: illegal pattern\n", prog );
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: imalloc.c,v $
- * Revision 1.1 1994-09-26 10:16:54 adam
+ * Revision 1.2 1994-09-26 16:30:56 adam
+ * Minor changes. imalloc uses xmalloc now.
+ *
+ * Revision 1.1 1994/09/26 10:16:54 adam
* First version of dfa module in alex. This version uses yacc to parse
* regular expressions. This should be hand-made instead.
*
{
#ifdef MEMDEBUG
size_t words = (4*sizeof(unsigned) -1 + size)/sizeof(unsigned);
- char *p = (char *)malloc( words*sizeof(unsigned) );
+ char *p = (char *)xmalloc( words*sizeof(unsigned) );
if( !p )
log (LOG_FATAL, "No memory: imalloc(%u); c/f %d/%d; %ld/%ld",
size, alloc_calls, free_calls, alloc, max_alloc );
++alloc_calls;
return (void *) p;
#else
- void *p = (void *)malloc( size );
+ void *p = (void *)xmalloc( size );
if( !p )
log (LOG_FATAL, "Out of memory (imalloc)" );
return p;
{
#ifdef MEMDEBUG
unsigned words = (4*sizeof(unsigned) -1 + size)/sizeof(unsigned);
- char *p = (char *) calloc( words*sizeof(unsigned), 1 );
+ char *p = (char *) xcalloc( words*sizeof(unsigned), 1 );
if( !p )
log (LOG_FATAL, "No memory: icalloc(%u); c/f %d/%d; %ld/%ld",
size, alloc_calls, free_calls, alloc, max_alloc );
++alloc_calls;
return (void *)p;
#else
- void p = (void) calloc( size, 1 );
+ void p = (void) xcalloc( size, 1 );
if( !p )
log (LOG_FATAL, "Out of memory (icalloc)" );
return p;
alloc -= size;
if( alloc < 0L )
log (LOG_FATAL,"Internal: ifree(%u) negative alloc.", size );
- free( (unsigned *) p-2 );
+ xfree( (unsigned *) p-2 );
}
#else
#ifndef ANSI
void i_free (void *p)
{
if (p)
- free( p );
+ xfree( p );
}
#endif
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: readfile.c,v $
- * Revision 1.1 1994-09-26 10:16:56 adam
+ * Revision 1.2 1994-09-26 16:30:57 adam
+ * Minor changes. imalloc uses xmalloc now.
+ *
+ * Revision 1.1 1994/09/26 10:16:56 adam
* First version of dfa module in alex. This version uses yacc to parse
* regular expressions. This should be hand-made instead.
*
read_tail (void);
static char
- *read_line ();
+ *read_line (void);
static void prep (char **s)
{
prep( &s );
/* now parse regular expression */
if (ccluse)
- i = parse_dfa( dfa, &s, ccl_chars );
+ i = parse_dfa( dfa, &s, dfa_ccl_chars );
else
- i = parse_dfa( dfa, &s, thompson_chars );
+ i = parse_dfa( dfa, &s, dfa_thompson_chars );
if( dfa->rule > 1 )
fputs( "\t\tYY_BREAK\n", outf );