Changed functions isc_getmethod, isams_getmethod.
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 14 Jul 1999 10:59:26 +0000 (10:59 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 14 Jul 1999 10:59:26 +0000 (10:59 +0000)
Improved fatal error handling (such as missing EXPLAIN schema).

15 files changed:
CHANGELOG
configure
configure.in
include/isamc.h
include/isams.h
index/index.h
index/invstat.c
index/kcompare.c
index/kinput.c
index/main.c
index/zebraapi.c
index/zserver.c
index/zserver.h
isamc/isamc.c
isamc/isams.c

index f8d2922..b151131 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,5 @@
+Added support for multiple records in one file for filter grs.sgml.
+
 Changed record index structure. New layout is incompatible with
 previous releases. Added setting "recordcompression" to control
 compression of records. Possible values are "none" (no
 Changed record index structure. New layout is incompatible with
 previous releases. Added setting "recordcompression" to control
 compression of records. Possible values are "none" (no
index 5c85f88..b83c502 100755 (executable)
--- a/configure
+++ b/configure
@@ -1243,8 +1243,48 @@ fi
 
 fi
 
 
 fi
 
+for ac_hdr in sys/times.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1251: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1256 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1261: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
 echo $ac_n "checking for main in -lwrap""... $ac_c" 1>&6
 echo $ac_n "checking for main in -lwrap""... $ac_c" 1>&6
-echo "configure:1248: checking for main in -lwrap" >&5
+echo "configure:1288: checking for main in -lwrap" >&5
 ac_lib_var=`echo wrap'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 ac_lib_var=`echo wrap'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1252,14 +1292,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lwrap  $LIBS"
 cat > conftest.$ac_ext <<EOF
   ac_save_LIBS="$LIBS"
 LIBS="-lwrap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1256 "configure"
+#line 1296 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:1263: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1280,7 +1320,7 @@ else
 fi
 
 echo $ac_n "checking for bzCompressInit in -lbz2""... $ac_c" 1>&6
 fi
 
 echo $ac_n "checking for bzCompressInit in -lbz2""... $ac_c" 1>&6
-echo "configure:1284: checking for bzCompressInit in -lbz2" >&5
+echo "configure:1324: checking for bzCompressInit in -lbz2" >&5
 ac_lib_var=`echo bz2'_'bzCompressInit | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 ac_lib_var=`echo bz2'_'bzCompressInit | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1288,7 +1328,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lbz2  $LIBS"
 cat > conftest.$ac_ext <<EOF
   ac_save_LIBS="$LIBS"
 LIBS="-lbz2  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1292 "configure"
+#line 1332 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1299,7 +1339,7 @@ int main() {
 bzCompressInit()
 ; return 0; }
 EOF
 bzCompressInit()
 ; return 0; }
 EOF
-if { (eval echo configure:1303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1331,17 +1371,17 @@ if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1335: checking for $ac_hdr" >&5
+echo "configure:1375: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1340 "configure"
+#line 1380 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1345: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1385: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1369,12 +1409,12 @@ done
 
 fi
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
 
 fi
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1373: checking for ANSI C header files" >&5
+echo "configure:1413: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1378 "configure"
+#line 1418 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1382,7 +1422,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1386: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1426: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1399,7 +1439,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1403 "configure"
+#line 1443 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1417,7 +1457,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1421 "configure"
+#line 1461 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1438,7 +1478,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1442 "configure"
+#line 1482 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1449,7 +1489,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
 exit (0); }
 
 EOF
-if { (eval echo configure:1453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
 then
   :
 else
index 61bf5ea..cdb3f48 100644 (file)
@@ -1,5 +1,5 @@
 dnl Zebra, Index Data Aps, 1994-1999
 dnl Zebra, Index Data Aps, 1994-1999
-dnl $Id: configure.in,v 1.9 1999-06-25 13:48:02 adam Exp $
+dnl $Id: configure.in,v 1.10 1999-07-14 10:59:26 adam Exp $
 dnl See the file LICENSE.2 for details.
 dnl
 AC_INIT(include/zebraver.h)
 dnl See the file LICENSE.2 for details.
 dnl
 AC_INIT(include/zebraver.h)
@@ -59,6 +59,9 @@ if test "$checkBoth" = "1"; then
 fi
 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
 dnl
 fi
 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
 dnl
+dnl ------ times
+AC_CHECK_HEADERS(sys/times.h)
+dnl
 dnl ------ TCP wrapper (for Linux)
 AC_CHECK_LIB(wrap, main, [LIBS="$LIBS -lwrap"])
 dnl 
 dnl ------ TCP wrapper (for Linux)
 AC_CHECK_LIB(wrap, main, [LIBS="$LIBS -lwrap"])
 dnl 
index 37af9d2..6b80198 100644 (file)
@@ -4,7 +4,11 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: isamc.h,v $
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: isamc.h,v $
- * Revision 1.8  1999-06-30 09:08:23  adam
+ * Revision 1.9  1999-07-14 10:59:26  adam
+ * Changed functions isc_getmethod, isams_getmethod.
+ * Improved fatal error handling (such as missing EXPLAIN schema).
+ *
+ * Revision 1.8  1999/06/30 09:08:23  adam
  * Added coder to reset.
  *
  * Revision 1.7  1998/03/13 15:30:50  adam
  * Added coder to reset.
  *
  * Revision 1.7  1998/03/13 15:30:50  adam
@@ -75,7 +79,7 @@ typedef struct ISAMC_I_s {
     void *clientData;
 } *ISAMC_I;
 
     void *clientData;
 } *ISAMC_I;
 
-ISAMC_M isc_getmethod (void);
+void isc_getmethod (ISAMC_M m);
 
 ISAMC isc_open (BFiles bfs, const char *name, int writeflag, ISAMC_M method);
 int isc_close (ISAMC is);
 
 ISAMC isc_open (BFiles bfs, const char *name, int writeflag, ISAMC_M method);
 int isc_close (ISAMC is);
index a853b57..bcde9d8 100644 (file)
@@ -3,7 +3,7 @@
  * See the file LICENSE for details.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * See the file LICENSE for details.
  * Sebastian Hammer, Adam Dickmeiss
  *
- * $Id: isams.h,v 1.1 1999-05-12 13:08:06 adam Exp $
+ * $Id: isams.h,v 1.2 1999-07-14 10:59:26 adam Exp $
  */
 #ifndef ISAMS_H
 #define ISAMS_H
  */
 #ifndef ISAMS_H
 #define ISAMS_H
@@ -36,7 +36,7 @@ typedef struct ISAMS_I_s {
     void *clientData;
 } *ISAMS_I;
 
     void *clientData;
 } *ISAMS_I;
 
-ISAMS_M isams_getmethod (void);
+void isams_getmethod (ISAMS_M me);
 
 ISAMS isams_open (BFiles bfs, const char *name, int writeflag,
                  ISAMS_M method);
 
 ISAMS isams_open (BFiles bfs, const char *name, int writeflag,
                  ISAMS_M method);
index dd7166e..b3f906d 100644 (file)
@@ -99,8 +99,8 @@ void key_logdump (int mask, const void *p);
 void inv_prstat (BFiles bfs);
 void inv_compact (BFiles bfs);
 void key_input (BFiles bfs, int nkeys, int cache);
 void inv_prstat (BFiles bfs);
 void inv_compact (BFiles bfs);
 void key_input (BFiles bfs, int nkeys, int cache);
-ISAMC_M key_isamc_m (Res res);
-ISAMS_M key_isams_m (Res res);
+ISAMC_M key_isamc_m (Res res, ISAMC_M me);
+ISAMS_M key_isams_m (Res res, ISAMS_M me);
 ISAMH_M key_isamh_m (Res res);
 int merge_sort (char **buf, int from, int to);
 int key_SU_code (int ch, char *out);
 ISAMH_M key_isamh_m (Res res);
 int merge_sort (char **buf, int from, int to);
 int key_SU_code (int ch, char *out);
@@ -158,7 +158,11 @@ extern Res common_resource;
 
 /*
  * $Log: index.h,v $
 
 /*
  * $Log: index.h,v $
- * Revision 1.64  1999-06-30 15:07:23  heikki
+ * Revision 1.65  1999-07-14 10:59:26  adam
+ * Changed functions isc_getmethod, isams_getmethod.
+ * Improved fatal error handling (such as missing EXPLAIN schema).
+ *
+ * Revision 1.64  1999/06/30 15:07:23  heikki
  * Adding isamh stuff
  *
  * Revision 1.63  1999/05/26 07:49:13  adam
  * Adding isamh stuff
  *
  * Revision 1.63  1999/05/26 07:49:13  adam
index fdab6ba..5c9779d 100644 (file)
@@ -150,7 +150,9 @@ void inv_prstat (BFiles bfs)
     }
     else if (res_get_match (common_resource, "isam", "s", NULL))
     {
     }
     else if (res_get_match (common_resource, "isam", "s", NULL))
     {
-        isams = isams_open (bfs, FNAME_ISAMS, 0, key_isams_m(common_resource));
+       struct ISAMS_M_s isams_m;
+        isams = isams_open (bfs, FNAME_ISAMS, 0,
+                           key_isams_m(common_resource, &isams_m));
         if (!isams)
         {
             logf (LOG_FATAL, "isams_open fail");
         if (!isams)
         {
             logf (LOG_FATAL, "isams_open fail");
@@ -168,7 +170,9 @@ void inv_prstat (BFiles bfs)
     }
     else
     {
     }
     else
     {
-        isamc = isc_open (bfs, FNAME_ISAMC, 0, key_isamc_m (common_resource));
+       struct ISAMC_M_s isamc_m;
+        isamc = isc_open (bfs, FNAME_ISAMC, 0,
+                         key_isamc_m (common_resource, &isamc_m));
         if (!isamc)
         {
             logf (LOG_FATAL, "isc_open fail");
         if (!isamc)
         {
             logf (LOG_FATAL, "isc_open fail");
@@ -261,7 +265,11 @@ void inv_prstat (BFiles bfs)
 /*
  *
  * $Log: invstat.c,v $
 /*
  *
  * $Log: invstat.c,v $
- * Revision 1.13  1999-07-08 14:23:27  heikki
+ * Revision 1.14  1999-07-14 10:59:26  adam
+ * Changed functions isc_getmethod, isams_getmethod.
+ * Improved fatal error handling (such as missing EXPLAIN schema).
+ *
+ * Revision 1.13  1999/07/08 14:23:27  heikki
  * Fixed a bug in isamh_pp_read and cleaned up a bit
  *
  * Revision 1.12  1999/07/06 12:28:04  adam
  * Fixed a bug in isamh_pp_read and cleaned up a bit
  *
  * Revision 1.12  1999/07/06 12:28:04  adam
index cb4ffc7..ec85430 100644 (file)
@@ -4,7 +4,11 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: kcompare.c,v $
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: kcompare.c,v $
- * Revision 1.32  1999-07-13 13:21:15  heikki
+ * Revision 1.33  1999-07-14 10:59:26  adam
+ * Changed functions isc_getmethod, isams_getmethod.
+ * Improved fatal error handling (such as missing EXPLAIN schema).
+ *
+ * Revision 1.32  1999/07/13 13:21:15  heikki
  * Managing negative deltas
  *
  * Revision 1.31  1999/07/06 09:37:04  heikki
  * Managing negative deltas
  *
  * Revision 1.31  1999/07/06 09:37:04  heikki
@@ -307,14 +311,9 @@ static void iscz1_code_item (int mode, void *vp, char **dst, char **src)
     }
 }
 
     }
 }
 
-ISAMC_M key_isamc_m (Res res)
+ISAMC_M key_isamc_m (Res res, ISAMC_M me)
 {
 {
-    static ISAMC_M me = NULL;
-
-    if (me)
-        return me;
-
-    me = isc_getmethod ();
+    isc_getmethod (me);
 
     me->compare_item = key_compare;
 
 
     me->compare_item = key_compare;
 
@@ -328,14 +327,9 @@ ISAMC_M key_isamc_m (Res res)
     return me;
 }
 
     return me;
 }
 
-ISAMS_M key_isams_m (Res res)
+ISAMS_M key_isams_m (Res res, ISAMS_M me)
 {
 {
-    static ISAMS_M me = NULL;
-
-    if (me)
-        return me;
-
-    me = isams_getmethod ();
+    isams_getmethod (me);
 
     me->compare_item = key_compare;
 
 
     me->compare_item = key_compare;
 
index 4a635c0..b2cf034 100644 (file)
@@ -619,8 +619,9 @@ void key_input (BFiles bfs, int nkeys, int cache)
     }
     if (res_get_match (common_resource, "isam", "s", NULL))
     {
     }
     if (res_get_match (common_resource, "isam", "s", NULL))
     {
+       struct ISAMS_M_s isams_m;
         isams = isams_open (bfs, FNAME_ISAMS, 1,
         isams = isams_open (bfs, FNAME_ISAMS, 1,
-                           key_isams_m (common_resource));
+                           key_isams_m (common_resource, &isams_m));
         if (!isams)
         {
             logf (LOG_FATAL, "isams_open fail");
         if (!isams)
         {
             logf (LOG_FATAL, "isams_open fail");
@@ -649,8 +650,9 @@ void key_input (BFiles bfs, int nkeys, int cache)
     }
     else
     {
     }
     else
     {
+       struct ISAMC_M_s isamc_m;
         isamc = isc_open (bfs, FNAME_ISAMC, 1,
         isamc = isc_open (bfs, FNAME_ISAMC, 1,
-                         key_isamc_m (common_resource));
+                         key_isamc_m (common_resource, &isamc_m));
         if (!isamc)
         {
             logf (LOG_FATAL, "isc_open fail");
         if (!isamc)
         {
             logf (LOG_FATAL, "isc_open fail");
@@ -715,7 +717,11 @@ void key_input (BFiles bfs, int nkeys, int cache)
 
 /*
  * $Log: kinput.c,v $
 
 /*
  * $Log: kinput.c,v $
- * Revision 1.35  1999-06-30 15:07:23  heikki
+ * Revision 1.36  1999-07-14 10:59:26  adam
+ * Changed functions isc_getmethod, isams_getmethod.
+ * Improved fatal error handling (such as missing EXPLAIN schema).
+ *
+ * Revision 1.35  1999/06/30 15:07:23  heikki
  * Adding isamh stuff
  *
  * Revision 1.34  1999/05/26 07:49:13  adam
  * Adding isamh stuff
  *
  * Revision 1.34  1999/05/26 07:49:13  adam
index 04f332b..6ca0946 100644 (file)
@@ -4,7 +4,11 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: main.c,v $
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: main.c,v $
- * Revision 1.67  1999-07-06 12:28:04  adam
+ * Revision 1.68  1999-07-14 10:59:26  adam
+ * Changed functions isc_getmethod, isams_getmethod.
+ * Improved fatal error handling (such as missing EXPLAIN schema).
+ *
+ * Revision 1.67  1999/07/06 12:28:04  adam
  * Updated record index structure. Format includes version ID. Compression
  * algorithm ID is stored for each record block.
  *
  * Updated record index structure. Format includes version ID. Compression
  * algorithm ID is stored for each record block.
  *
@@ -276,7 +280,7 @@ int main (int argc, char **argv)
     int cmd = 0;
     char *arg;
     char *configName = NULL;
     int cmd = 0;
     char *arg;
     char *configName = NULL;
-    int nsections;
+    int nsections = 0;
     int disableCommit = 0;
     size_t mem_max = 0;
 
     int disableCommit = 0;
     size_t mem_max = 0;
 
index 74400fb..0d9d815 100644 (file)
@@ -4,7 +4,11 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: zebraapi.c,v $
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: zebraapi.c,v $
- * Revision 1.20  1999-07-06 12:28:04  adam
+ * Revision 1.21  1999-07-14 10:59:26  adam
+ * Changed functions isc_getmethod, isams_getmethod.
+ * Improved fatal error handling (such as missing EXPLAIN schema).
+ *
+ * Revision 1.20  1999/07/06 12:28:04  adam
  * Updated record index structure. Format includes version ID. Compression
  * algorithm ID is stored for each record block.
  *
  * Updated record index structure. Format includes version ID. Compression
  * algorithm ID is stored for each record block.
  *
@@ -98,11 +102,18 @@ static void zebra_chdir (ZebraHandle zh)
     chdir (dir);
 #endif
 }
     chdir (dir);
 #endif
 }
+
+static void zebra_register_unlock (ZebraHandle zh);
+
 static int zebra_register_lock (ZebraHandle zh)
 {
     time_t lastChange;
     int state;
 
 static int zebra_register_lock (ZebraHandle zh)
 {
     time_t lastChange;
     int state;
 
+    zh->errCode = 0;
+    zh->errString = 0;
+    zh->hits = 0;
+
     zebra_chdir (zh);
 
     state = zebra_server_lock_get_state(zh, &lastChange);
     zebra_chdir (zh);
 
     state = zebra_server_lock_get_state(zh, &lastChange);
@@ -116,7 +127,7 @@ static int zebra_register_lock (ZebraHandle zh)
         state = 0;
     }
     zebra_server_lock (zh, state);
         state = 0;
     }
     zebra_server_lock (zh, state);
-#if USE_TIMES
+#if HAVE_SYS_TIMES_H
     times (&zh->tms1);
 #endif
     if (zh->registerState == state)
     times (&zh->tms1);
 #endif
     if (zh->registerState == state)
@@ -135,59 +146,87 @@ static int zebra_register_lock (ZebraHandle zh)
     if (zh->records)
     {
         zebraExplain_close (zh->zei, 0, 0);
     if (zh->records)
     {
         zebraExplain_close (zh->zei, 0, 0);
-        dict_close (zh->dict);
-       sortIdx_close (zh->sortIdx);
+       if (zh->dict)
+           dict_close (zh->dict);
+       if (zh->sortIdx)
+           sortIdx_close (zh->sortIdx);
         if (zh->isam)
             is_close (zh->isam);
         if (zh->isamc)
             isc_close (zh->isamc);
         if (zh->isam)
             is_close (zh->isam);
         if (zh->isamc)
             isc_close (zh->isamc);
+        if (zh->isams)
+            isams_close (zh->isams);
         rec_close (&zh->records);
     }
     bf_cache (zh->bfs, state ? res_get (zh->res, "shadow") : NULL);
     zh->registerState = state;
         rec_close (&zh->records);
     }
     bf_cache (zh->bfs, state ? res_get (zh->res, "shadow") : NULL);
     zh->registerState = state;
-    zh->records = rec_open (zh->bfs, 0, 0);
-    if (!(zh->dict = dict_open (zh->bfs, FNAME_DICT, 40, 0, 0)))
-    {
-       logf (LOG_WARN, "dict_open");
-        return -1;
-    }
-    if (!(zh->sortIdx = sortIdx_open (zh->bfs, 0)))
-    {
-       logf (LOG_WARN, "sortIdx_open");
-       return -1;
-    }
+
     zh->isam = NULL;
     zh->isamc = NULL;
     zh->isams = NULL;
     zh->isam = NULL;
     zh->isamc = NULL;
     zh->isams = NULL;
-    if (res_get_match (zh->res, "isam", "i", NULL))
+    zh->dict = NULL;
+    zh->sortIdx = NULL;
+    zh->zei = NULL;
+
+    if (!(zh->records = rec_open (zh->bfs, 0, 0)))
     {
     {
-        if (!(zh->isam = is_open (zh->bfs, FNAME_ISAM, key_compare, 0,
-                                  sizeof (struct it_key), zh->res)))
-       {
-           logf (LOG_WARN, "is_open");
-            return -1;
-       }
+       logf (LOG_WARN, "rec_open");
+       zh->errCode = 2;
     }
     }
-    else if (res_get_match (zh->res, "isam", "s", NULL))
+    else
     {
     {
-        if (!(zh->isams = isams_open (zh->bfs, FNAME_ISAMS, 0,
-                                     key_isams_m(zh->res))))
+       if (!(zh->dict = dict_open (zh->bfs, FNAME_DICT, 40, 0, 0)))
        {
        {
-           logf (LOG_WARN, "isams_open");
-            return -1;
+           logf (LOG_WARN, "dict_open");
+           zh->errCode = 2;
        }
        }
-    }
-    else
-    {
-        if (!(zh->isamc = isc_open (zh->bfs, FNAME_ISAMC,
-                                   0, key_isamc_m(zh->res))))
+       if (!(zh->sortIdx = sortIdx_open (zh->bfs, 0)))
+       {
+           logf (LOG_WARN, "sortIdx_open");
+           zh->errCode = 2;
+       }
+       if (res_get_match (zh->res, "isam", "i", NULL))
+       {
+           if (!(zh->isam = is_open (zh->bfs, FNAME_ISAM, key_compare, 0,
+                                     sizeof (struct it_key), zh->res)))
+           {
+               logf (LOG_WARN, "is_open");
+               zh->errCode = 2;
+           }
+       }
+       else if (res_get_match (zh->res, "isam", "s", NULL))
        {
        {
-           logf (LOG_WARN, "isc_open");
-            return -1;
+           struct ISAMS_M_s isams_m;
+           if (!(zh->isams = isams_open (zh->bfs, FNAME_ISAMS, 0,
+                                         key_isams_m(zh->res, &isams_m))))
+           {
+               logf (LOG_WARN, "isams_open");
+               zh->errCode = 2;
+           }
+       }
+       else
+       {
+           struct ISAMC_M_s isamc_m;
+           if (!(zh->isamc = isc_open (zh->bfs, FNAME_ISAMC,
+                                       0, key_isamc_m(zh->res, &isamc_m))))
+           {
+               logf (LOG_WARN, "isc_open");
+               zh->errCode = 2;
+           }
+       }
+       zh->zei = zebraExplain_open (zh->records, zh->dh, zh->res, 0, 0, 0);
+       if (!zh->zei)
+       {
+           logf (LOG_WARN, "Cannot obtain EXPLAIN information");
+           zh->errCode = 2;
        }
     }
        }
     }
-    zh->zei = zebraExplain_open (zh->records, zh->dh, zh->res, 0, 0, 0);
-
+    if (zh->errCode)
+    {
+       zebra_register_unlock (zh);
+       zh->registerState = -1;
+       return -1;
+    }
     return 0;
 }
 
     return 0;
 }
 
@@ -195,7 +234,7 @@ static void zebra_register_unlock (ZebraHandle zh)
 {
     static int waitSec = -1;
 
 {
     static int waitSec = -1;
 
-#if USE_TIMES
+#if HAVE_SYS_TIMES_H
     times (&zh->tms2);
     logf (LOG_LOG, "user/system: %ld/%ld",
                        (long) (zh->tms2.tms_utime - zh->tms1.tms_utime),
     times (&zh->tms2);
     logf (LOG_LOG, "user/system: %ld/%ld",
                        (long) (zh->tms2.tms_utime - zh->tms1.tms_utime),
@@ -220,8 +259,9 @@ static void zebra_register_unlock (ZebraHandle zh)
 
 ZebraHandle zebra_open (const char *configName)
 {
 
 ZebraHandle zebra_open (const char *configName)
 {
-    ZebraHandle zh = (ZebraHandle) xmalloc (sizeof(*zh));
+    ZebraHandle zh;
 
 
+    zh = (ZebraHandle) xmalloc (sizeof(*zh));
     if (!(zh->res = res_open (configName)))
     {
        logf (LOG_WARN, "Failed to read resources `%s'", configName);
     if (!(zh->res = res_open (configName)))
     {
        logf (LOG_WARN, "Failed to read resources `%s'", configName);
@@ -291,6 +331,7 @@ void zebra_close (ZebraHandle zh)
        passwd_db_close (zh->passwd_db);
     res_close (zh->res);
     xfree (zh);
        passwd_db_close (zh->passwd_db);
     res_close (zh->res);
     xfree (zh);
+    xmalloc_trav("x");
 }
 
 struct map_baseinfo {
 }
 
 struct map_baseinfo {
@@ -365,11 +406,8 @@ void zebra_search_rpn (ZebraHandle zh, ODR stream, ODR decode,
                       Z_RPNQuery *query, int num_bases, char **basenames, 
                       const char *setname)
 {
                       Z_RPNQuery *query, int num_bases, char **basenames, 
                       const char *setname)
 {
-    zebra_register_lock (zh);
-    zh->errCode = 0;
-    zh->errString = NULL;
-    zh->hits = 0;
-
+    if (zebra_register_lock (zh))
+       return;
     map_basenames (zh, stream, &num_bases, &basenames);
     resultSetAddRPN (zh, stream, decode, query, num_bases, basenames, setname);
 
     map_basenames (zh, stream, &num_bases, &basenames);
     resultSetAddRPN (zh, stream, decode, query, num_bases, basenames, setname);
 
@@ -384,14 +422,11 @@ void zebra_records_retrieve (ZebraHandle zh, ODR stream,
     ZebraPosSet poset;
     int i, *pos_array;
 
     ZebraPosSet poset;
     int i, *pos_array;
 
-    zh->errCode = 0;
-    zh->errString = NULL;
+    if (zebra_register_lock (zh))
+       return;
     pos_array = (int *) xmalloc (num_recs * sizeof(*pos_array));
     for (i = 0; i<num_recs; i++)
        pos_array[i] = recs[i].position;
     pos_array = (int *) xmalloc (num_recs * sizeof(*pos_array));
     for (i = 0; i<num_recs; i++)
        pos_array[i] = recs[i].position;
-
-    zebra_register_lock (zh);
-
     poset = zebraPosSetCreate (zh, setname, num_recs, pos_array);
     if (!poset)
     {
     poset = zebraPosSetCreate (zh, setname, num_recs, pos_array);
     if (!poset)
     {
@@ -435,9 +470,12 @@ void zebra_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
                 int *position, int *num_entries, ZebraScanEntry **entries,
                 int *is_partial)
 {
                 int *position, int *num_entries, ZebraScanEntry **entries,
                 int *is_partial)
 {
-    zh->errCode = 0;
-    zh->errString = NULL;
-    zebra_register_lock (zh);
+    if (zebra_register_lock (zh))
+    {
+       *entries = 0;
+       *num_entries = 0;
+       return;
+    }
     map_basenames (zh, stream, &num_bases, &basenames);
     rpn_scan (zh, stream, zapt, attributeset,
              num_bases, basenames, position,
     map_basenames (zh, stream, &num_bases, &basenames);
     rpn_scan (zh, stream, zapt, attributeset,
              num_bases, basenames, position,
@@ -450,9 +488,8 @@ void zebra_sort (ZebraHandle zh, ODR stream,
                 const char *output_setname, Z_SortKeySpecList *sort_sequence,
                 int *sort_status)
 {
                 const char *output_setname, Z_SortKeySpecList *sort_sequence,
                 int *sort_status)
 {
-    zh->errCode = 0;
-    zh->errString = NULL;
-    zebra_register_lock (zh);
+    if (zebra_register_lock (zh))
+       return;
     resultSetSort (zh, stream->mem, num_input_setnames, input_setnames,
                   output_setname, sort_sequence, sort_status);
     zebra_register_unlock (zh);
     resultSetSort (zh, stream->mem, num_input_setnames, input_setnames,
                   output_setname, sort_sequence, sort_status);
     zebra_register_unlock (zh);
index 61c3881..e78e871 100644 (file)
@@ -4,7 +4,11 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: zserver.c,v $
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: zserver.c,v $
- * Revision 1.70  1999-06-10 12:14:56  adam
+ * Revision 1.71  1999-07-14 10:59:26  adam
+ * Changed functions isc_getmethod, isams_getmethod.
+ * Improved fatal error handling (such as missing EXPLAIN schema).
+ *
+ * Revision 1.70  1999/06/10 12:14:56  adam
  * Fixed to use bend_start instead of pre_init.
  *
  * Revision 1.69  1999/06/10 09:20:03  adam
  * Fixed to use bend_start instead of pre_init.
  *
  * Revision 1.69  1999/06/10 09:20:03  adam
 #endif
 
 #include <data1.h>
 #endif
 
 #include <data1.h>
-#include <dmalloc.h>
 
 #include "zserver.h"
 
 
 #include "zserver.h"
 
index e8f7905..18bde7d 100644 (file)
@@ -4,7 +4,11 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: zserver.h,v $
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: zserver.h,v $
- * Revision 1.42  1999-05-26 07:49:13  adam
+ * Revision 1.43  1999-07-14 10:59:27  adam
+ * Changed functions isc_getmethod, isams_getmethod.
+ * Improved fatal error handling (such as missing EXPLAIN schema).
+ *
+ * Revision 1.42  1999/05/26 07:49:13  adam
  * C++ compilation.
  *
  * Revision 1.41  1999/05/12 13:08:06  adam
  * C++ compilation.
  *
  * Revision 1.41  1999/05/12 13:08:06  adam
  *
  */
 
  *
  */
 
-
-#ifndef USE_TIMES
-#ifdef __linux__
-#define USE_TIMES 1
-#else
-#define USE_TIMES 0
-#endif
-#endif
-
-#if USE_TIMES
+#if HAVE_SYS_TIMES_H
 #include <sys/times.h>
 #endif
 
 #include <sys/times.h>
 #endif
 
@@ -210,7 +205,7 @@ struct zebra_info {
     ZebraLockHandle server_lock_cmt;
     ZebraLockHandle server_lock_org;
     char *server_path_prefix;
     ZebraLockHandle server_lock_cmt;
     ZebraLockHandle server_lock_org;
     char *server_path_prefix;
-#if USE_TIMES
+#if HAVE_SYS_TIMES_H
     struct tms tms1;
     struct tms tms2;    
 #endif
     struct tms tms1;
     struct tms tms2;    
 #endif
@@ -220,7 +215,6 @@ struct zebra_info {
     Passwd_db passwd_db;
 };
 
     Passwd_db passwd_db;
 };
 
-
 struct rank_control {
     char *name;
     void *(*create)(ZebraHandle zh);
 struct rank_control {
     char *name;
     void *(*create)(ZebraHandle zh);
index 842befa..d5a1bd1 100644 (file)
@@ -4,7 +4,11 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: isamc.c,v $
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: isamc.c,v $
- * Revision 1.18  1999-06-30 09:08:23  adam
+ * Revision 1.19  1999-07-14 10:59:27  adam
+ * Changed functions isc_getmethod, isams_getmethod.
+ * Improved fatal error handling (such as missing EXPLAIN schema).
+ *
+ * Revision 1.18  1999/06/30 09:08:23  adam
  * Added coder to reset.
  *
  * Revision 1.17  1999/05/26 07:49:14  adam
  * Added coder to reset.
  *
  * Revision 1.17  1999/05/26 07:49:14  adam
@@ -91,8 +95,9 @@ static void init_fc (ISAMC is, int cat);
 
 #define SMALL_TEST 0
 
 
 #define SMALL_TEST 0
 
-ISAMC_M isc_getmethod (void)
+void isc_getmethod (ISAMC_M m)
 {
 {
+
     static struct ISAMC_filecat_s def_cat[] = {
 #if SMALL_TEST
         {    32,     28,      0,  3 },
     static struct ISAMC_filecat_s def_cat[] = {
 #if SMALL_TEST
         {    32,     28,      0,  3 },
@@ -106,7 +111,6 @@ ISAMC_M isc_getmethod (void)
         { 32768,  32000,  31000,  0 },
 #endif
     };
         { 32768,  32000,  31000,  0 },
 #endif
     };
-    ISAMC_M m = (ISAMC_M) xmalloc (sizeof(*m));
     m->filecat = def_cat;
 
     m->code_start = NULL;
     m->filecat = def_cat;
 
     m->code_start = NULL;
@@ -119,11 +123,8 @@ ISAMC_M isc_getmethod (void)
     m->debug = 1;
 
     m->max_blocks_mem = 10;
     m->debug = 1;
 
     m->max_blocks_mem = 10;
-
-    return m;
 }
 
 }
 
-
 ISAMC isc_open (BFiles bfs, const char *name, int writeflag, ISAMC_M method)
 {
     ISAMC is;
 ISAMC isc_open (BFiles bfs, const char *name, int writeflag, ISAMC_M method)
 {
     ISAMC is;
index 7135685..f9b5dbe 100644 (file)
@@ -4,7 +4,11 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: isams.c,v $
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: isams.c,v $
- * Revision 1.4  1999-05-26 07:49:14  adam
+ * Revision 1.5  1999-07-14 10:59:27  adam
+ * Changed functions isc_getmethod, isams_getmethod.
+ * Improved fatal error handling (such as missing EXPLAIN schema).
+ *
+ * Revision 1.4  1999/05/26 07:49:14  adam
  * C++ compilation.
  *
  * Revision 1.3  1999/05/20 12:57:18  adam
  * C++ compilation.
  *
  * Revision 1.3  1999/05/20 12:57:18  adam
@@ -53,10 +57,8 @@ struct ISAMS_PP_s {
     int numRead;
 };
 
     int numRead;
 };
 
-ISAMS_M isams_getmethod (void)
+void isams_getmethod (ISAMS_M m)
 {
 {
-    ISAMS_M m = (ISAMS_M) xmalloc (sizeof(*m));
-
     m->code_start = NULL;
     m->code_item = NULL;
     m->code_stop = NULL;
     m->code_start = NULL;
     m->code_item = NULL;
     m->code_stop = NULL;
@@ -65,8 +67,6 @@ ISAMS_M isams_getmethod (void)
 
     m->debug = 1;
     m->block_size = 128;
 
     m->debug = 1;
     m->block_size = 128;
-
-    return m;
 }
 
 ISAMS isams_open (BFiles bfs, const char *name, int writeflag,
 }
 
 ISAMS isams_open (BFiles bfs, const char *name, int writeflag,