From: Adam Dickmeiss Date: Mon, 26 Sep 1994 10:17:23 +0000 (+0000) Subject: Minor changes. X-Git-Tag: ZEBRA.1.0~850 X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=commitdiff_plain;h=c0e2fc3945dfd829a689f7da49e172c34511b0d0 Minor changes. --- diff --git a/dict/Makefile b/dict/Makefile index d94ad4b..48b276d 100644 --- a/dict/Makefile +++ b/dict/Makefile @@ -1,13 +1,13 @@ # Copyright (C) 1994, Index Data I/S # All rights reserved. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile,v 1.10 1994-09-22 10:43:43 adam Exp $ +# $Id: Makefile,v 1.11 1994-09-26 10:17:23 adam Exp $ SHELL=/bin/sh INCLUDE=-I../include TPROG1=dicttest TPROG2=dictext -CFLAGS=-g -Wall -pedantic +CFLAGS=-g -Wall -pedantic DEFS=$(INCLUDE) LIB=../lib/dict.a PO = dopen.o dclose.o drdwr.o open.o close.o insert.o lookup.o lookupec.o @@ -16,7 +16,7 @@ CPP=cc -E all: $(LIB) $(TPROG1): $(TPROG1).o $(LIB) - $(CC) $(CFLAGS) -o $(TPROG1) $(TPROG1).o $(LIB) ../lib/bfile.a ../lib/util.a + $(CC) $(CFLAGS) -o $(TPROG1) $(TPROG1).o $(LIB) ../lib/bfile.a ../lib/dfa.a ../lib/util.a $(TPROG2): $(TPROG2).o $(LIB) $(CC) $(CFLAGS) -o $(TPROG2) $(TPROG2).o ../lib/util.a diff --git a/dict/dicttest.c b/dict/dicttest.c index b74b795..6b6ff00 100644 --- a/dict/dicttest.c +++ b/dict/dicttest.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: dicttest.c,v $ - * Revision 1.9 1994-09-22 14:43:56 adam + * Revision 1.10 1994-09-26 10:17:24 adam + * Minor changes. + * + * Revision 1.9 1994/09/22 14:43:56 adam * First functional version of lookup with error correction. A 'range' * specified the maximum number of insertions+deletions+substitutions. * @@ -46,10 +49,13 @@ #include char *prog; -Dict dict; +static Dict dict; + +static int look_hits; static int lookup_handle (Dict_char *name) { + look_hits++; printf ("%s\n", name); return 0; } @@ -64,11 +70,12 @@ int main (int argc, char **argv) int infosize = 4; int cache = 10; int ret; + int unique = 0; + char *arg; int no_of_iterations = 0; int no_of_new = 0, no_of_same = 0, no_of_change = 0; int no_of_hits = 0, no_of_misses = 0; - int unique = 0; - char *arg; + prog = argv[0]; if (argc < 2) @@ -202,7 +209,12 @@ int main (int argc, char **argv) } else { + look_hits = 0; dict_lookup_ec (dict, ipf_ptr, range, lookup_handle); + if (look_hits) + no_of_hits++; + else + no_of_misses++; } ++no_of_iterations; ipf_ptr += (i-1); diff --git a/dict/lookup.c b/dict/lookup.c index 3673e24..9f2a21e 100644 --- a/dict/lookup.c +++ b/dict/lookup.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: lookup.c,v $ - * Revision 1.2 1994-09-16 15:39:14 adam + * Revision 1.3 1994-09-26 10:17:25 adam + * Minor changes. + * + * Revision 1.2 1994/09/16 15:39:14 adam * Initial code of lookup - not tested yet. * * Revision 1.1 1994/08/16 16:26:48 adam @@ -61,7 +64,11 @@ static char *dict_look (Dict dict, Dict_char *str) { memcpy (&subptr, info, sizeof(Dict_ptr)); if (*++str == DICT_EOS) - return info+sizeof(Dict_ptr)+sizeof(Dict_char); + { + if (info[sizeof(Dict_ptr)+sizeof(Dict_char)]) + return info+sizeof(Dict_ptr)+sizeof(Dict_char); + return NULL; + } else { if (subptr == 0)