From aebdede4bcc1dfe05728dac36b51a1cda85cc70e Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 27 Sep 1995 12:22:27 +0000 Subject: [PATCH] More work on extract in record control. Field name is not in isam keys but in prefix in dictionary words. --- index/Makefile | 19 ++++++++++++------- index/extract.c | 18 +++++++++++------- index/index.h | 12 +++++++----- index/kcompare.c | 23 ++++++----------------- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/index/Makefile b/index/Makefile index d7c5d00..da767fa 100644 --- a/index/Makefile +++ b/index/Makefile @@ -1,7 +1,7 @@ # Copyright (C) 1995, Index Data I/S # All rights reserved. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile,v 1.10 1995-09-14 11:53:27 adam Exp $ +# $Id: Makefile,v 1.11 1995-09-27 12:22:27 adam Exp $ SHELL=/bin/sh RANLIB=ranlib @@ -13,27 +13,32 @@ TPROG1=index TPROG2=kdump TPROG3=zserver DEFS=$(INCLUDE) -O1 = main.o dir.o trav.o extract.o kinput.o kcompare.o ksort.o symtab.o text.o +O1 = main.o dir.o trav.o extract.o kinput.o kcompare.o ksort.o\ + symtab.o text.o recctrl.o O2 = kdump.o -O3 = zserver.o kcompare.o zrpn.o zsets.o text.o +O3 = zserver.o kcompare.o zrpn.o zsets.o text.o recctrl.o CPP=cc -E all: $(TPROG1) $(TPROG2) $(TPROG3) $(TPROG1): $(O1) ../lib/dict.a \ - ../lib/isam.a ../lib/bfile.a ../lib/alexutil.a $(YAZLIB) + ../lib/isam.a ../lib/bfile.a ../lib/alexutil.a ../lib/data1.a \ + $(YAZLIB) $(CC) $(CFLAGS) -o $(TPROG1) $(O1) ../lib/dict.a \ - ../lib/isam.a ../lib/bfile.a ../lib/alexutil.a $(YAZLIB) $(OSILIB) + ../lib/isam.a ../lib/bfile.a ../lib/alexutil.a ../lib/data1.a \ + $(YAZLIB) $(OSILIB) $(TPROG2): $(O2) $(YAZLIB) $(CC) $(CFLAGS) -o $(TPROG2) $(O2) $(YAZLIB) $(TPROG3): $(O3) \ ../lib/rset.a ../lib/dict.a ../lib/isam.a ../lib/bfile.a \ - ../lib/dfa.a ../lib/alexutil.a $(YAZLIB) + ../lib/dfa.a ../lib/alexutil.a ../lib/data1.a \ + $(YAZLIB) $(CC) $(CFLAGS) -o $(TPROG3) $(O3) \ ../lib/rset.a ../lib/dict.a ../lib/isam.a ../lib/bfile.a \ - ../lib/dfa.a ../lib/alexutil.a $(YAZLIB) $(OSILIB) -lm + ../lib/dfa.a ../lib/alexutil.a ../lib/data1.a \ + $(YAZLIB) $(OSILIB) -lm .c.o: $(CC) -c $(DEFS) $(CFLAGS) $< diff --git a/index/extract.c b/index/extract.c index 4808868..dac9820 100644 --- a/index/extract.c +++ b/index/extract.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: extract.c,v $ - * Revision 1.8 1995-09-14 07:48:22 adam + * Revision 1.9 1995-09-27 12:22:28 adam + * More work on extract in record control. + * Field name is not in isam keys but in prefix in dictionary words. + * + * Revision 1.8 1995/09/14 07:48:22 adam * Record control management. * * Revision 1.7 1995/09/11 13:09:32 adam @@ -38,7 +42,7 @@ #include #include -#include +#include #include "index.h" static Dict file_idx; @@ -129,6 +133,7 @@ static void wordAdd (const RecWord *p) struct it_key key; char x; size_t i; + char wordPrefix[8]; if (key_offset + 1000 > key_buf_size) { @@ -140,6 +145,9 @@ static void wordAdd (const RecWord *p) xfree (key_buf); key_buf = new_key_buf; } + sprintf (wordPrefix, "%c%04d", p->attrSet + '0', p->attrUse); + strcpy (key_buf + key_offset, wordPrefix); + key_offset += strlen (wordPrefix); switch (p->which) { case Word_String: @@ -155,8 +163,6 @@ static void wordAdd (const RecWord *p) key_offset++; key.sysno = key_sysno; - key.attrSet = p->attrSet; - key.attrUse = p->attrUse; key.seqno = p->seqno; memcpy (key_buf + key_offset, &key, sizeof(key)); key_offset += sizeof(key); @@ -206,9 +212,7 @@ void file_extract (int cmd, const char *fname, const char *kname) logf (LOG_WARN|LOG_ERRNO, "open %s", fname); return; } - if (!strcmp (file_type, "text")) - rt = recTypeText; - else + if (!(rt = recType_byName (file_type))) return; extractCtrl.inf = inf; extractCtrl.subType = ""; diff --git a/index/index.h b/index/index.h index f3acfd5..2ebdb61 100644 --- a/index/index.h +++ b/index/index.h @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: index.h,v $ - * Revision 1.10 1995-09-14 07:48:23 adam + * Revision 1.11 1995-09-27 12:22:28 adam + * More work on extract in record control. + * Field name is not in isam keys but in prefix in dictionary words. + * + * Revision 1.10 1995/09/14 07:48:23 adam * Record control management. * * Revision 1.9 1995/09/11 13:09:33 adam @@ -47,10 +51,8 @@ #define IT_KEY_HAVE_FIELD 0 struct it_key { - int sysno; - int seqno; - unsigned attrSet : 3; - unsigned attrUse : 13; + int sysno; + short seqno; }; struct dir_entry { diff --git a/index/kcompare.c b/index/kcompare.c index fc633e1..b39535d 100644 --- a/index/kcompare.c +++ b/index/kcompare.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: kcompare.c,v $ - * Revision 1.6 1995-09-14 07:48:23 adam + * Revision 1.7 1995-09-27 12:22:28 adam + * More work on extract in record control. + * Field name is not in isam keys but in prefix in dictionary words. + * + * Revision 1.6 1995/09/14 07:48:23 adam * Record control management. * * Revision 1.5 1995/09/11 13:09:34 adam @@ -42,8 +46,7 @@ void key_logdump (int logmask, const void *p) struct it_key key; memcpy (&key, p, sizeof(key)); - logf (logmask, "%7d s=%-4d f=%d,%d", key.sysno, key.seqno, - key.attrSet, key.attrUse); + logf (logmask, "%7d s=%-4d", key.sysno, key.seqno); } int key_compare (const void *p1, const void *p2) @@ -75,20 +78,6 @@ int key_compare (const void *p1, const void *p2) return -1; } #endif - if (i1.attrSet != i2.attrSet) - { - if (i1.attrSet > i2.attrSet) - return 1; - else - return -1; - } - if (i1.attrUse != i2.attrUse) - { - if (i1.attrUse > i2.attrUse) - return 1; - else - return -1; - } return 0; } -- 1.7.10.4