Moved loggin utilities to Yaz. Was implemented in file zlogs.c.
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 16 Nov 1998 16:03:41 +0000 (16:03 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 16 Nov 1998 16:03:41 +0000 (16:03 +0000)
index/Makefile.in
index/zlogs.c [deleted file]
index/zrpn.c
index/zserver.h
index/zsets.c

index b1c9157..25c9838 100644 (file)
@@ -1,7 +1,7 @@
 # Copyright (C) 1995-1998, Index Data
 # All rights reserved.
 # Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile.in,v 1.2 1998-10-28 15:20:47 adam Exp $
+# $Id: Makefile.in,v 1.3 1998-11-16 16:03:41 adam Exp $
 
 SHELL=/bin/sh
 
@@ -28,7 +28,7 @@ O1 = main.o dir.o dirs.o trav.o extract.o kinput.o kcompare.o \
  zinfo.o invstat.o sortidx.o
 O2 = kdump.o
 O3 = zserver.o kcompare.o zrpn.o zsets.o attribute.o recindex.o \
- zlogs.o lockutil.o locksrv.o zinfo.o trunc.o sortidx.o rank1.o zebraapi.o \
+ lockutil.o locksrv.o zinfo.o trunc.o sortidx.o rank1.o zebraapi.o \
  retrieve.o
 O4 = hlvl.o hlvltest.o kcompare.o
 O5 = apitest.o kcompare.o zrpn.o zsets.o attribute.o recindex.o \
diff --git a/index/zlogs.c b/index/zlogs.c
deleted file mode 100644 (file)
index 04b15d3..0000000
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * Copyright (C) 1995-1998, Index Data I/S 
- * All rights reserved.
- * Sebastian Hammer, Adam Dickmeiss
- *
- * $Log: zlogs.c,v $
- * Revision 1.9  1998-10-13 20:36:02  adam
- * Changed "indent" format string in log messages.
- *
- * Revision 1.8  1998/04/02 14:35:29  adam
- * First version of Zebra that works with compiled ASN.1.
- *
- * Revision 1.7  1998/01/29 13:40:11  adam
- * Better logging for scan service.
- *
- * Revision 1.6  1997/09/29 09:06:41  adam
- * Removed static var to make this module thread safe.
- *
- * Revision 1.5  1997/04/30 08:56:07  quinn
- * null
- *
- * Revision 1.4  1996/10/08  09:41:25  quinn
- * Fixed diagnostic.
- *
- * Revision 1.3  1996/03/20  09:36:40  adam
- * Function dict_lookup_grep got extra parameter, init_pos, which marks
- * from which position in pattern approximate pattern matching should occur.
- * Approximate pattern matching is used in relevance=re-2.
- *
- * Revision 1.2  1996/01/03  16:22:11  quinn
- * operator->roperator
- *
- * Revision 1.1  1995/11/16  17:00:55  adam
- * Better logging of rpn query.
- *
- */
-#include <stdio.h>
-#include <assert.h>
-
-#include "zserver.h"
-
-static void attrStr (int type, int value, enum oid_value ast, char *str)
-{
-    *str = '\0';
-    switch (ast)
-    {
-    case VAL_BIB1:
-    case VAL_EXP1:
-    case VAL_GILS:
-        switch (type)
-        {
-        case 1:
-            sprintf (str, "use");
-            break;
-        case 2:
-            switch (value)
-            {
-            case 1:
-                sprintf (str, "relation=Less than");
-                break;
-            case 2:
-                sprintf (str, "relation=Less than or equal");
-                break;
-            case 3:
-                sprintf (str, "relation=Equal");
-                break;
-            case 4:
-                sprintf (str, "relation=Greater or equal");
-                break;
-            case 5:
-                sprintf (str, "relation=Greater than");
-                break;
-            case 6:
-                sprintf (str, "relation=Not equal");
-                break;
-            case 100:
-                sprintf (str, "relation=Phonetic");
-                break;
-            case 101:
-                sprintf (str, "relation=Stem");
-                break;
-            case 102:
-                sprintf (str, "relation=Relevance");
-                break;
-            case 103:
-                sprintf (str, "relation=AlwaysMatches");
-                break;
-            default:
-                sprintf (str, "relation");
-            }
-            break;
-        case 3:
-            switch (value)
-            {
-            case 1:
-                sprintf (str, "position=First in field");
-                break;
-            case 2:
-                sprintf (str, "position=First in any subfield");
-                break;
-            case 3:
-                sprintf (str, "position=Any position in field");
-                break;
-            default:
-                sprintf (str, "position");
-            }
-            break;
-        case 4:
-            switch (value)
-            {
-            case 1:
-                sprintf (str, "structure=Phrase");
-                break;
-            case 2:
-                sprintf (str, "structure=Word");
-                break;
-            case 3:
-                sprintf (str, "structure=Key");
-                break;
-            case 4:
-                sprintf (str, "structure=Year");
-                break;
-            case 5:
-                sprintf (str, "structure=Date");
-                break;
-            case 6:
-                sprintf (str, "structure=Word list");
-                break;
-            case 100:
-                sprintf (str, "structure=Date (un)");
-                break;
-            case 101:
-                sprintf (str, "structure=Name (norm)");
-                break;
-            case 102:
-                sprintf (str, "structure=Name (un)");
-                break;
-            case 103:
-                sprintf (str, "structure=Structure");
-                break;
-            case 104:
-                sprintf (str, "structure=urx");
-                break;
-            case 105:
-                sprintf (str, "structure=free-form-text");
-                break;
-            case 106:
-                sprintf (str, "structure=document-text");
-                break;
-            case 107:
-                sprintf (str, "structure=local-number");
-                break;
-            case 108:
-                sprintf (str, "structure=string");
-                break;
-            case 109:
-                sprintf (str, "structure=numeric string");
-                break;
-            default:
-                sprintf (str, "structure");
-            }
-            break;
-        case 5:
-            switch (value)
-            {
-            case 1:
-                sprintf (str, "truncation=Right");
-                break;
-            case 2:
-                sprintf (str, "truncation=Left");
-                break;
-            case 3:
-                sprintf (str, "truncation=Left&right");
-                break;
-            case 100:
-                sprintf (str, "truncation=Do not truncate");
-                break;
-            case 101:
-                sprintf (str, "truncation=Process #");
-                break;
-            case 102:
-                sprintf (str, "truncation=re-1");
-                break;
-            case 103:
-                sprintf (str, "truncation=re-2");
-                break;
-            default:
-                sprintf (str, "truncation");
-            }
-            break;
-        case 6:
-            switch (value)
-            {
-            case 1:
-                sprintf (str, "completeness=Incomplete subfield");
-                break;
-            case 2:
-                sprintf (str, "completeness=Complete subfield");
-                break;
-            case 3:
-                sprintf (str, "completeness=Complete field");
-                break;
-            default:
-                sprintf (str, "completeness");
-            }
-            break;
-        }
-        break;
-    default:
-        break;
-    }
-    if (*str)
-        sprintf (str + strlen(str), " (%d=%d)", type, value);
-    else
-        sprintf (str, "%d=%d", type, value);
-}
-
-/*
- * zlog_attributes: print attributes of term
- */
-static void zlog_attributes (Z_AttributesPlusTerm *t, int level,
-                             enum oid_value ast)
-{
-    int of, i;
-    char str[80];
-#ifdef ASN_COMPILED
-    int num_attributes = t->attributes->num_attributes;
-#else
-    int num_attributes = t->num_attributes;
-#endif
-    
-    for (of = 0; of < num_attributes; of++)
-    {
-        Z_AttributeElement *element;
-#ifdef ASN_COMPILED
-       element = t->attributes->attributes[of];
-#else
-        element = t->attributeList[of];
-#endif
-
-        switch (element->which) 
-        {
-        case Z_AttributeValue_numeric:
-           attrStr (*element->attributeType,
-                    *element->value.numeric, ast, str);
-            logf (LOG_LOG, "%*.0s %s", level, "", str);
-            break;
-        case Z_AttributeValue_complex:
-            logf (LOG_LOG, "%*.0s attributeType=%d complex", level, "",
-                  *element->attributeType);
-            for (i = 0; i<element->value.complex->num_list; i++)
-            {
-                if (element->value.complex->list[i]->which ==
-                    Z_StringOrNumeric_string)
-                    logf (LOG_LOG, "%*.0s  string: '%s'", level, "",
-                          element->value.complex->list[i]->u.string);
-                else if (element->value.complex->list[i]->which ==
-                         Z_StringOrNumeric_numeric)
-                    logf (LOG_LOG, "%*.0s  numeric: '%d'", level, "",
-                          *element->value.complex->list[i]->u.numeric);
-            }
-            break;
-        default:
-            logf (LOG_LOG, "%.*s attribute unknown", level, "");
-        }
-    }
-}
-
-static void zlog_structure (Z_RPNStructure *zs, int level, enum oid_value ast)
-{
-    if (zs->which == Z_RPNStructure_complex)
-    {
-        switch (zs->u.complex->roperator->which)
-        {
-        case Z_Operator_and:
-            logf (LOG_LOG, "%*.0s and", level, "");
-            break;
-        case Z_Operator_or:
-            logf (LOG_LOG, "%*.0s or", level, "");
-            break;
-        case Z_Operator_and_not:
-            logf (LOG_LOG, "%*.0s and-not", level, "");
-            break;
-        default:
-            logf (LOG_LOG, "%*.0s unknown complex", level, "");
-            return;
-        }
-        zlog_structure (zs->u.complex->s1, level+2, ast);
-        zlog_structure (zs->u.complex->s2, level+2, ast);
-    }
-    else if (zs->which == Z_RPNStructure_simple)
-    {
-        if (zs->u.simple->which == Z_Operand_APT)
-        {
-            Z_AttributesPlusTerm *zapt = zs->u.simple->u.attributesPlusTerm;
-
-            if (zapt->term->which == Z_Term_general) 
-            {
-                logf (LOG_LOG, "%*.0s term '%.*s' (general)", level, "",
-                      zapt->term->u.general->len, zapt->term->u.general->buf);
-            }
-            else
-            {
-                logf (LOG_LOG, "%*.0s term (not general)", level, "");
-            }
-            zlog_attributes (zapt, level+2, ast);
-        }
-        else if (zs->u.simple->which == Z_Operand_resultSetId)
-        {
-            logf (LOG_LOG, "%*.0s set '%s'", level, "",
-                  zs->u.simple->u.resultSetId);
-        }
-        else
-            logf (LOG_LOG, "%*.0s unknown simple structure", level, "");
-    }
-    else
-        logf (LOG_LOG, "%*.0s unknown structure", level, "");
-}
-
-void zlog_rpn (Z_RPNQuery *rpn)
-{
-    oident *attrset;
-    enum oid_value ast;
-    
-    attrset = oid_getentbyoid (rpn->attributeSetId);
-    if (attrset)
-    {
-        ast = attrset->value;
-       logf (LOG_LOG, "RPN query. Type: %s", attrset->desc);
-    } 
-    else
-    {
-       ast = VAL_NONE;
-       logf (LOG_LOG, "RPN query. Unknown type");
-    }
-    zlog_structure (rpn->RPNStructure, 0, ast);
-}
-
-void zlog_scan (Z_AttributesPlusTerm *zapt, oid_value ast)
-{
-    int level = 0;
-    if (zapt->term->which == Z_Term_general) 
-    {
-       logf (LOG_LOG, "%*.0s term '%.*s' (general)", level, "",
-             zapt->term->u.general->len, zapt->term->u.general->buf);
-    }
-    else
-       logf (LOG_LOG, "%*.0s term (not general)", level, "");
-    zlog_attributes (zapt, level+2, ast);
-}
index 9c9067f..9dd7d2d 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: zrpn.c,v $
- * Revision 1.89  1998-11-16 10:11:55  adam
+ * Revision 1.90  1998-11-16 16:03:43  adam
+ * Moved loggin utilities to Yaz. Was implemented in file zlogs.c.
+ *
+ * Revision 1.89  1998/11/16 10:11:55  adam
  * Added addtional info for error 114 - unsupported use attribute.
  *
  * Revision 1.88  1998/10/18 07:54:52  adam
@@ -2216,7 +2219,6 @@ void rpn_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
     if (attributeset == VAL_NONE)
         attributeset = VAL_BIB1;
 
-    zlog_scan (zapt, attributeset);
     logf (LOG_DEBUG, "position = %d, num = %d", pos, num);
         
     attr_init (&use, zapt, 1);
index 43de5fe..0c2f050 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: zserver.h,v $
- * Revision 1.39  1998-10-16 08:14:35  adam
+ * Revision 1.40  1998-11-16 16:03:45  adam
+ * Moved loggin utilities to Yaz. Was implemented in file zlogs.c.
+ *
+ * Revision 1.39  1998/10/16 08:14:35  adam
  * Updated record control system.
  *
  * Revision 1.38  1998/09/22 10:03:44  adam
@@ -256,9 +259,6 @@ void zebra_sort (ZebraHandle zh, ODR stream,
                 const char *output_setname, Z_SortKeySpecList *sort_sequence,
                 int *sort_status);
 
-void zlog_rpn (Z_RPNQuery *rpn);
-void zlog_scan (Z_AttributesPlusTerm *zapt, oid_value ast);
-
 int zebra_server_lock_init (ZebraHandle zh);
 int zebra_server_lock_destroy (ZebraHandle zh);
 int zebra_server_lock (ZebraHandle zh, int lockCommit);
index ed5e1a6..b46f057 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: zsets.c,v $
- * Revision 1.20  1998-11-16 10:10:53  adam
+ * Revision 1.21  1998-11-16 16:03:46  adam
+ * Moved loggin utilities to Yaz. Was implemented in file zlogs.c.
+ *
+ * Revision 1.20  1998/11/16 10:10:53  adam
  * Fixed problem with zebraPosSetCreate that occurred when positions were
  * less than 1.
  *
@@ -122,8 +125,6 @@ ZebraSet resultSetAddRPN (ZebraHandle zh, ODR input, ODR output,
 {
     ZebraSet zebraSet;
 
-    zlog_rpn (rpn);
-
     zh->errCode = 0;
     zh->errString = NULL;
     zh->hits = 0;