From 9765f689118107e45f5fba7261363980d378f7b3 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 8 Sep 1995 14:52:26 +0000 Subject: [PATCH] Minor changes. Dictionary is lower case now. --- index/dir.c | 9 ++++++--- index/extract.c | 9 ++++++--- index/index.h | 8 ++++++-- index/kcompare.c | 19 +++++++------------ index/kdump.c | 10 +++++++--- index/zrpn.c | 17 +++++++++++------ 6 files changed, 43 insertions(+), 29 deletions(-) diff --git a/index/dir.c b/index/dir.c index 867f2b4..74c93aa 100644 --- a/index/dir.c +++ b/index/dir.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: dir.c,v $ - * Revision 1.5 1995-09-06 16:11:16 adam + * Revision 1.6 1995-09-08 14:52:26 adam + * Minor changes. Dictionary is lower case now. + * + * Revision 1.5 1995/09/06 16:11:16 adam * Option: only one word key per file. * * Revision 1.4 1995/09/04 12:33:41 adam @@ -36,7 +39,7 @@ struct dir_entry *dir_open (const char *rep) { DIR *dir; struct dirent *dent; - size_t entry_max = 20; + size_t entry_max = 50; size_t idx = 0; struct dir_entry *entry; @@ -62,7 +65,7 @@ struct dir_entry *dir_open (const char *rep) { struct dir_entry *entry_n; - if (!(entry_n = malloc (sizeof(*entry) * (entry_max + 100)))) + if (!(entry_n = malloc (sizeof(*entry) * (entry_max + 400)))) { logf (LOG_FATAL|LOG_ERRNO, "malloc"); exit (1); diff --git a/index/extract.c b/index/extract.c index 15e0873..2050980 100644 --- a/index/extract.c +++ b/index/extract.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: extract.c,v $ - * Revision 1.5 1995-09-06 16:11:16 adam + * Revision 1.6 1995-09-08 14:52:27 adam + * Minor changes. Dictionary is lower case now. + * + * Revision 1.5 1995/09/06 16:11:16 adam * Option: only one word key per file. * * Revision 1.4 1995/09/05 15:28:39 adam @@ -152,7 +155,7 @@ void text_extract (struct strtab *t, SYSNO sysno, int cmd, const char *fname) struct it_key k; int seqno = 1; int c; - char w[256]; + char w[IT_MAX_WORD]; logf (LOG_DEBUG, "Text extract of %d", sysno); k.sysno = sysno; @@ -167,7 +170,7 @@ void text_extract (struct strtab *t, SYSNO sysno, int cmd, const char *fname) int i = 0; while (i < 254 && c != EOF && isalnum(c)) { - w[i++] = c; + w[i++] = index_char_cvt (c); c = getc (inf); } if (i) diff --git a/index/index.h b/index/index.h index 4a95800..805abde 100644 --- a/index/index.h +++ b/index/index.h @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: index.h,v $ - * Revision 1.7 1995-09-06 16:11:16 adam + * Revision 1.8 1995-09-08 14:52:27 adam + * Minor changes. Dictionary is lower case now. + * + * Revision 1.7 1995/09/06 16:11:16 adam * Option: only one word key per file. * * Revision 1.6 1995/09/05 15:28:39 adam @@ -33,6 +36,7 @@ #include #include +#define IT_MAX_WORD 256 #define IT_KEY_HAVE_FIELD 0 struct it_key { @@ -59,7 +63,6 @@ int key_close (void); void key_flush (void); void key_write (int cmd, struct it_key *k, const char *str); int key_compare (const void *p1, const void *p2); -int key_compare_x (const struct it_key *i1, const struct it_key *i2); void key_input (const char *dict_fname, const char *isam_fname, const char *key_fname, int cache); int key_sort (const char *key_fname, size_t mem); @@ -75,3 +78,4 @@ int strtab_src (struct strtab *t, const char *name, void ***infop); void strtab_del (struct strtab *t, void (*func)(const char *name, void *info, void *data), void *data); +int index_char_cvt (int c); diff --git a/index/kcompare.c b/index/kcompare.c index fa407ec..6f9bbfd 100644 --- a/index/kcompare.c +++ b/index/kcompare.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: kcompare.c,v $ - * Revision 1.3 1995-09-07 13:58:36 adam + * Revision 1.4 1995-09-08 14:52:27 adam + * Minor changes. Dictionary is lower case now. + * + * Revision 1.3 1995/09/07 13:58:36 adam * New parameter: result-set file descriptor (RSFD) to support multiple * positions within the same result-set. * Boolean operators: and, or, not implemented. @@ -23,6 +26,7 @@ #include #include #include +#include #include #include "index.h" @@ -58,16 +62,7 @@ int key_compare (const void *p1, const void *p2) return 0; } -int key_compare_x (const struct it_key *i1, const struct it_key *i2) +int index_char_cvt (int c) { - if ( i1->sysno != i2->sysno) - return i1->sysno - i2->sysno; -#if IT_KEY_HAVE_FIELD - if ( i1->seqno != i2->seqno) - return i1->seqno - i2->seqno; - return i1->field - i2->field; -#else - return i1->seqno - i2->seqno; -#endif + return tolower (c); } - diff --git a/index/kdump.c b/index/kdump.c index a37d379..d6f2555 100644 --- a/index/kdump.c +++ b/index/kdump.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: kdump.c,v $ - * Revision 1.3 1995-09-06 16:11:17 adam + * Revision 1.4 1995-09-08 14:52:27 adam + * Minor changes. Dictionary is lower case now. + * + * Revision 1.3 1995/09/06 16:11:17 adam * Option: only one word key per file. * * Revision 1.2 1995/09/04 12:33:42 adam @@ -46,7 +49,7 @@ int main (int argc, char **argv) int ret; char *arg; char *key_fname = NULL; - char key_string[1000]; + char key_string[IT_MAX_WORD]; char key_info[256]; FILE *inf; @@ -82,7 +85,8 @@ int main (int argc, char **argv) struct it_key k; memcpy (&k, key_info+1, sizeof(k)); - printf ("%s sysno=%d op=%d\n", key_string, k.sysno, *key_info); + printf ("%7d op=%d s=%-3d %s\n", k.sysno, *key_info, k.seqno, + key_string); } if (fclose (inf)) { diff --git a/index/zrpn.c b/index/zrpn.c index 384aa1c..6a30f80 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zrpn.c,v $ - * Revision 1.7 1995-09-07 13:58:36 adam + * Revision 1.8 1995-09-08 14:52:27 adam + * Minor changes. Dictionary is lower case now. + * + * Revision 1.7 1995/09/07 13:58:36 adam * New parameter: result-set file descriptor (RSFD) to support multiple * positions within the same result-set. * Boolean operators: and, or, not implemented. @@ -44,19 +47,21 @@ static RSET rpn_search_APT (ZServerInfo *zi, Z_AttributesPlusTerm *zapt) { - char termz[256]; + char termz[IT_MAX_WORD+1]; size_t sizez; struct rset_isam_parms parms; const char *info; + int i; Z_Term *term = zapt->term; if (term->which != Z_Term_general) return NULL; sizez = term->u.general->len; - if (sizez > 255) - sizez = 255; - memcpy (termz, term->u.general->buf, sizez); - termz[sizez] = '\0'; + if (sizez > IT_MAX_WORD) + sizez = IT_MAX_WORD; + for (i = 0; iu.general->buf[i]); + termz[i] = '\0'; logf (LOG_DEBUG, "dict_lookup: %s", termz); if (!(info = dict_lookup (zi->wordDict, termz))) return rset_create (rset_kind_null, NULL); -- 1.7.10.4