From 289af445bf7c8042b46200f9f2af18049ae049fb Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 17 Oct 2000 12:37:09 +0000 Subject: [PATCH] Fixed notification of live-updates. Fixed minor problem with mf_init where it didn't handle shadow area file names correctly. --- Makefile.in | 1 - bfile/Makefile.in | 1 - bfile/mfile.c | 22 +++++--- configure | 134 ++++++++++++++++++++++------------------------- configure.in | 17 +----- dfa/Makefile.in | 1 - dict/Makefile.in | 1 - doc/Makefile.in | 1 - include/Makefile.in | 1 - include/isamb.h | 16 ++++++ index/Makefile.am | 15 +++++- index/Makefile.in | 56 +++++++++++++++++--- index/main.c | 10 +++- index/zebraapi.c | 93 ++++++++++++++++++++++++-------- isam/Makefile.in | 1 - isamb/Makefile.in | 1 - isamb/isamb.c | 127 +++++++++++++++++++++++++++++++------------- isamc/Makefile.in | 1 - isams/Makefile.in | 1 - recctrl/Makefile.in | 1 - rset/Makefile.in | 1 - tab/Makefile.in | 1 - test/Makefile.in | 1 - test/gils/Makefile.in | 1 - test/usmarc/Makefile.in | 1 - util/Makefile.in | 1 - 26 files changed, 326 insertions(+), 181 deletions(-) create mode 100644 include/isamb.h diff --git a/Makefile.in b/Makefile.in index a3df7db..1554d63 100644 --- a/Makefile.in +++ b/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/bfile/Makefile.in b/bfile/Makefile.in index 8c71031..46e7a18 100644 --- a/bfile/Makefile.in +++ b/bfile/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/bfile/mfile.c b/bfile/mfile.c index 6afd611..0d37fde 100644 --- a/bfile/mfile.c +++ b/bfile/mfile.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: mfile.c,v $ - * Revision 1.39 2000-05-05 13:48:03 adam + * Revision 1.40 2000-10-17 12:37:09 adam + * Fixed notification of live-updates. Fixed minor problem with mf_init + * where it didn't handle shadow area file names correctly. + * + * Revision 1.39 2000/05/05 13:48:03 adam * Fixed locking for metafiles. * * Revision 1.38 2000/03/20 19:08:35 adam @@ -307,13 +311,19 @@ MFile_area mf_init(const char *name, const char *spec) /* look at each file */ while ((dent = readdir(dd))) { - if (*dent->d_name == '.') - continue; - if (sscanf(dent->d_name, "%[^-]-%d.mf", metaname, &number) != 2) + int len = strlen(dent->d_name); + const char *cp = strrchr (dent->d_name, '-'); + if (strchr (".-", *dent->d_name)) + continue; + if (len < 5 || !cp || strcmp (dent->d_name + len - 3, ".mf")) { - logf (LOG_DEBUG, "bf: %s is not a part-file.", dent->d_name); - continue; + logf (LOG_WARN, "bf: %s is not a part-file.", dent->d_name); + continue; } + number = atoi(cp+1); + memcpy (metaname, dent->d_name, cp - dent->d_name); + metaname[ cp - dent->d_name] = '\0'; + for (meta_f = ma->mfiles; meta_f; meta_f = meta_f->next) { /* known metafile */ diff --git a/configure b/configure index e52a21b..c8dd444 100755 --- a/configure +++ b/configure @@ -788,16 +788,6 @@ else fi - SUBLIBS="../rset/librset.a \ - ../dict/libdict.a \ - ../isamb/libisamb.a \ - ../isams/libisams.a \ - ../isam/libisam.a \ - ../isamc/libisamc.a \ - ../recctrl/librecctrl.a \ - ../bfile/libbfile.a \ - ../dfa/libdfa.a \ - ../util/libutil.a" else echo "$ac_t""Zebra" 1>&6 PROGPREFIX=zebra @@ -825,7 +815,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:829: checking for working aclocal" >&5 +echo "configure:819: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -838,7 +828,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:842: checking for working autoconf" >&5 +echo "configure:832: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -851,7 +841,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:855: checking for working automake" >&5 +echo "configure:845: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -864,7 +854,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:868: checking for working autoheader" >&5 +echo "configure:858: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -877,7 +867,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:881: checking for working makeinfo" >&5 +echo "configure:871: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -890,10 +880,6 @@ else fi - SUBLIBS="../rset/librset.a ../dict/libdict.a ../isams/libisams.a \ - ../recctrl/librecctrl.a \ - ../bfile/libbfile.a ../dfa/libdfa.a \ - ../util/libutil.a" if test ! -r ${srcdir}/isam; then mkdir ${srcdir}/isam touch ${srcdir}/isam/Makefile.in @@ -920,11 +906,10 @@ fi - # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:928: checking for $ac_word" >&5 +echo "configure:913: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -954,7 +939,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:958: checking for $ac_word" >&5 +echo "configure:943: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1005,7 +990,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1009: checking for $ac_word" >&5 +echo "configure:994: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1037,7 +1022,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1041: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1026: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1048,12 +1033,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1052 "configure" +#line 1037 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1079,12 +1064,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1083: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1068: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1088: checking whether we are using GNU C" >&5 +echo "configure:1073: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1093,7 +1078,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1097: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1082: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1112,7 +1097,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1116: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1101: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1144,7 +1129,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1148: checking how to run the C preprocessor" >&5 +echo "configure:1133: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1159,13 +1144,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1169: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1154: \"$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 : @@ -1176,13 +1161,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1186: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1171: \"$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 : @@ -1193,13 +1178,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1203: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1188: \"$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 : @@ -1235,7 +1220,7 @@ echo "$ac_t""$CPP" 1>&6 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1239: checking for a BSD compatible install" >&5 +echo "configure:1224: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1290,7 +1275,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1294: checking for $ac_word" >&5 +echo "configure:1279: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1345,7 +1330,7 @@ fi # Extract the first word of "yaz-config", so it can be a program name with args. set dummy yaz-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1349: checking for $ac_word" >&5 +echo "configure:1334: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_yazconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1381,12 +1366,18 @@ fi fi fi echo $ac_n "checking for YAZ""... $ac_c" 1>&6 -echo "configure:1385: checking for YAZ" >&5 +echo "configure:1370: checking for YAZ" >&5 if $yazconfig --version >/dev/null 2>&1; then YAZLIB=`$yazconfig --libs` - YAZLALIB=`$yazconfig --lalibs` - YAZINC=`$yazconfig --cflags` - YAZVERSION=`$yazconfig --version` + # if this is empty, it's a simple version YAZ 1.6 script + # so we have to source it instead... + if test "X$YAZLIB" = "X"; then + . $yazconfig + else + YAZLALIB=`$yazconfig --lalibs` + YAZINC=`$yazconfig --cflags` + YAZVERSION=`$yazconfig --version` + fi echo "$ac_t""$yazconfig" 1>&6 else echo "$ac_t""Not found" 1>&6 @@ -1404,7 +1395,7 @@ fi if test "$enable_threads" = "yes"; then echo $ac_n "checking for main in -lpthread""... $ac_c" 1>&6 -echo "configure:1408: checking for main in -lpthread" >&5 +echo "configure:1399: checking for main in -lpthread" >&5 ac_lib_var=`echo pthread'_'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 @@ -1412,14 +1403,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1414: \"$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 @@ -1447,9 +1438,9 @@ else fi echo $ac_n "checking for working POSIX Threads""... $ac_c" 1>&6 -echo "configure:1451: checking for working POSIX Threads" >&5 +echo "configure:1442: checking for working POSIX Threads" >&5 cat > conftest.$ac_ext < int func(void *p) { return 0; } @@ -1460,7 +1451,7 @@ int main() { int r = pthread_create (&pthread_id, 0, func, 0); ; return 0; } EOF -if { (eval echo configure:1464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* thread_ok=yes else @@ -1500,7 +1491,7 @@ echo $ac_n "checking for prefix by $ac_c" 1>&6 # Extract the first word of "tclsh", so it can be a program name with args. set dummy tclsh; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1504: checking for $ac_word" >&5 +echo "configure:1495: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_TCLSH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1541,7 +1532,7 @@ fi prefix=${saveprefix} fi echo $ac_n "checking for Tcl""... $ac_c" 1>&6 -echo "configure:1545: checking for Tcl" >&5 +echo "configure:1536: checking for Tcl" >&5 if test -r ${tclconfig}/tclConfig.sh; then . ${tclconfig}/tclConfig.sh if test -r ${tclconfig}/../generic/tcl.h; then @@ -1571,17 +1562,17 @@ 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:1575: checking for $ac_hdr" >&5 +echo "configure:1566: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1585: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1576: \"$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* @@ -1608,7 +1599,7 @@ fi done echo $ac_n "checking for bzCompressInit in -lbz2""... $ac_c" 1>&6 -echo "configure:1612: checking for bzCompressInit in -lbz2" >&5 +echo "configure:1603: 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 @@ -1616,7 +1607,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lbz2 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1622: \"$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 @@ -1659,17 +1650,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 -echo "configure:1663: checking for $ac_hdr" >&5 +echo "configure:1654: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1673: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1664: \"$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* @@ -1697,12 +1688,12 @@ done fi echo $ac_n "checking for LFS""... $ac_c" 1>&6 -echo "configure:1701: checking for LFS" >&5 +echo "configure:1692: checking for LFS" >&5 if test "$cross_compiling" = yes; then bits=32 else cat > conftest.$ac_ext < @@ -1722,7 +1713,7 @@ int main(int argc, char **argv) } EOF -if { (eval echo configure:1726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then bits=64 else @@ -1744,12 +1735,12 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1748: checking for ANSI C header files" >&5 +echo "configure:1739: 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 < #include @@ -1757,7 +1748,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1761: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1752: \"$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* @@ -1774,7 +1765,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 @@ -1792,7 +1783,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 @@ -1813,7 +1804,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1824,7 +1815,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2025,7 +2016,6 @@ s%@MAKEINFO@%$MAKEINFO%g s%@SET_MAKE@%$SET_MAKE%g s%@ISZMBOL_TRUE@%$ISZMBOL_TRUE%g s%@ISZMBOL_FALSE@%$ISZMBOL_FALSE%g -s%@SUBLIBS@%$SUBLIBS%g s%@TCL_INCLUDE@%$TCL_INCLUDE%g s%@TCL_LIB@%$TCL_LIB%g s%@PROGPREFIX@%$PROGPREFIX%g diff --git a/configure.in b/configure.in index 6100f90..208e133 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Zebra, Index Data Aps, 1994-2000 -dnl $Id: configure.in,v 1.23 2000-10-11 12:31:27 adam Exp $ +dnl $Id: configure.in,v 1.24 2000-10-17 12:37:09 adam Exp $ dnl AC_INIT(include/zebraver.h) AC_MSG_CHECKING(for package) @@ -8,25 +8,11 @@ if test -r ${srcdir}/LICENSE.zmbol; then PROGPREFIX=zmbol AC_DEFINE(ZMBOL,1) AM_INIT_AUTOMAKE(zmbol,1.1) - SUBLIBS="../rset/librset.a \ - ../dict/libdict.a \ - ../isamb/libisamb.a \ - ../isams/libisams.a \ - ../isam/libisam.a \ - ../isamc/libisamc.a \ - ../recctrl/librecctrl.a \ - ../bfile/libbfile.a \ - ../dfa/libdfa.a \ - ../util/libutil.a" else AC_MSG_RESULT([Zebra]) PROGPREFIX=zebra AC_DEFINE(ZMBOL,0) AM_INIT_AUTOMAKE(zebra,1.1) - SUBLIBS="../rset/librset.a ../dict/libdict.a ../isams/libisams.a \ - ../recctrl/librecctrl.a \ - ../bfile/libbfile.a ../dfa/libdfa.a \ - ../util/libutil.a" if test ! -r ${srcdir}/isam; then mkdir ${srcdir}/isam touch ${srcdir}/isam/Makefile.in @@ -42,7 +28,6 @@ else fi AM_CONDITIONAL(ISZMBOL,test $PACKAGE = zmbol) dnl ------ Substitutions -AC_SUBST(SUBLIBS) AC_SUBST(DEFS) AC_SUBST(TCL_INCLUDE) AC_SUBST(TCL_LIB) diff --git a/dfa/Makefile.in b/dfa/Makefile.in index 3bc5d21..d4d273d 100644 --- a/dfa/Makefile.in +++ b/dfa/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/dict/Makefile.in b/dict/Makefile.in index a3d6889..bc69537 100644 --- a/dict/Makefile.in +++ b/dict/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/doc/Makefile.in b/doc/Makefile.in index 6c43454..b89ac9a 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/include/Makefile.in b/include/Makefile.in index ff8862f..f556da0 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/include/isamb.h b/include/isamb.h new file mode 100644 index 0000000..355c7a4 --- /dev/null +++ b/include/isamb.h @@ -0,0 +1,16 @@ +/* + * $Id: isamb.h,v 1.1 2000-10-17 12:37:09 adam Exp $ + */ + +#ifndef ISAMB_H +#define ISAMB_H + +#include +#include + +typedef struct ISAMB_s *ISAMB; + +ISAMB isamb_open (BFiles bfs, const char *name, ISAMC_M method); +void isamb_close (ISAMB isamb); + +#endif diff --git a/index/Makefile.am b/index/Makefile.am index 182f3ac..cc2ddfc 100644 --- a/index/Makefile.am +++ b/index/Makefile.am @@ -1,4 +1,4 @@ -## $Id: Makefile.am,v 1.3 2000-05-02 11:26:13 adam Exp $ +## $Id: Makefile.am,v 1.4 2000-10-17 12:37:09 adam Exp $ noinst_PROGRAMS = apitest @@ -33,4 +33,15 @@ apitest_SOURCES = apitest.c kcompare.c zrpn.c zsets.c attribute.c recindex.c \ INCLUDES = -I$(srcdir)/../include $(YAZINC) $(TCL_INCLUDE) -LDADD = @SUBLIBS@ $(YAZLIB) $(TCL_LIB) +if ISZMBOL +zmbol_libs = ../isam/libisam.a ../isamc/libisamc.a ../isamb/libisamb.a +else +zmbol_libs = +endif + +LDADD = \ + ../rset/librset.a ../dict/libdict.a ../isams/libisams.a \ + $(zmbol_libs) \ + ../recctrl/librecctrl.a ../bfile/libbfile.a ../dfa/libdfa.a \ + ../util/libutil.a \ + $(YAZLIB) $(TCL_LIB) diff --git a/index/Makefile.in b/index/Makefile.in index 3500d9c..61c95d5 100644 --- a/index/Makefile.in +++ b/index/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ @@ -88,8 +87,11 @@ apitest_SOURCES = apitest.c kcompare.c zrpn.c zsets.c attribute.c recindex.c lo INCLUDES = -I$(srcdir)/../include $(YAZINC) $(TCL_INCLUDE) +@ISZMBOL_TRUE@zmbol_libs = ../isam/libisam.a ../isamc/libisamc.a ../isamb/libisamb.a +@ISZMBOL_FALSE@zmbol_libs = + +LDADD = ../rset/librset.a ../dict/libdict.a ../isams/libisams.a $(zmbol_libs) ../recctrl/librecctrl.a ../bfile/libbfile.a ../dfa/libdfa.a ../util/libutil.a $(YAZLIB) $(TCL_LIB) -LDADD = @SUBLIBS@ $(YAZLIB) $(TCL_LIB) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) @@ -102,32 +104,72 @@ LIBS = @LIBS@ @ISZMBOL_TRUE@lockutil.o lockidx.o zinfo.o invstat.o sortidx.o \ @ISZMBOL_TRUE@compact.o zmbolidx_LDADD = $(LDADD) -zmbolidx_DEPENDENCIES = +@ISZMBOL_FALSE@zmbolidx_DEPENDENCIES = ../rset/librset.a \ +@ISZMBOL_FALSE@../dict/libdict.a ../isams/libisams.a \ +@ISZMBOL_FALSE@../recctrl/librecctrl.a ../bfile/libbfile.a \ +@ISZMBOL_FALSE@../dfa/libdfa.a ../util/libutil.a +@ISZMBOL_TRUE@zmbolidx_DEPENDENCIES = ../rset/librset.a \ +@ISZMBOL_TRUE@../dict/libdict.a ../isams/libisams.a ../isam/libisam.a \ +@ISZMBOL_TRUE@../isamc/libisamc.a ../isamb/libisamb.a \ +@ISZMBOL_TRUE@../recctrl/librecctrl.a ../bfile/libbfile.a \ +@ISZMBOL_TRUE@../dfa/libdfa.a ../util/libutil.a zmbolidx_LDFLAGS = @ISZMBOL_TRUE@zmbolsrv_OBJECTS = zserver.o kcompare.o zrpn.o zsets.o \ @ISZMBOL_TRUE@attribute.o recindex.o lockutil.o locksrv.o zinfo.o \ @ISZMBOL_TRUE@trunc.o sortidx.o rank1.o zebraapi.o retrieve.o kinput.o zmbolsrv_LDADD = $(LDADD) -zmbolsrv_DEPENDENCIES = +@ISZMBOL_FALSE@zmbolsrv_DEPENDENCIES = ../rset/librset.a \ +@ISZMBOL_FALSE@../dict/libdict.a ../isams/libisams.a \ +@ISZMBOL_FALSE@../recctrl/librecctrl.a ../bfile/libbfile.a \ +@ISZMBOL_FALSE@../dfa/libdfa.a ../util/libutil.a +@ISZMBOL_TRUE@zmbolsrv_DEPENDENCIES = ../rset/librset.a \ +@ISZMBOL_TRUE@../dict/libdict.a ../isams/libisams.a ../isam/libisam.a \ +@ISZMBOL_TRUE@../isamc/libisamc.a ../isamb/libisamb.a \ +@ISZMBOL_TRUE@../recctrl/librecctrl.a ../bfile/libbfile.a \ +@ISZMBOL_TRUE@../dfa/libdfa.a ../util/libutil.a zmbolsrv_LDFLAGS = @ISZMBOL_FALSE@zebraidx_OBJECTS = main.o dir.o dirs.o trav.o extract.o \ @ISZMBOL_FALSE@kinput.o kcompare.o symtab.o recindex.o recstat.o \ @ISZMBOL_FALSE@lockutil.o lockidx.o zinfo.o invstat.o sortidx.o \ @ISZMBOL_FALSE@compact.o zebraidx_LDADD = $(LDADD) -zebraidx_DEPENDENCIES = +@ISZMBOL_FALSE@zebraidx_DEPENDENCIES = ../rset/librset.a \ +@ISZMBOL_FALSE@../dict/libdict.a ../isams/libisams.a \ +@ISZMBOL_FALSE@../recctrl/librecctrl.a ../bfile/libbfile.a \ +@ISZMBOL_FALSE@../dfa/libdfa.a ../util/libutil.a +@ISZMBOL_TRUE@zebraidx_DEPENDENCIES = ../rset/librset.a \ +@ISZMBOL_TRUE@../dict/libdict.a ../isams/libisams.a ../isam/libisam.a \ +@ISZMBOL_TRUE@../isamc/libisamc.a ../isamb/libisamb.a \ +@ISZMBOL_TRUE@../recctrl/librecctrl.a ../bfile/libbfile.a \ +@ISZMBOL_TRUE@../dfa/libdfa.a ../util/libutil.a zebraidx_LDFLAGS = @ISZMBOL_FALSE@zebrasrv_OBJECTS = zserver.o kcompare.o zrpn.o zsets.o \ @ISZMBOL_FALSE@attribute.o recindex.o lockutil.o locksrv.o zinfo.o \ @ISZMBOL_FALSE@trunc.o sortidx.o rank1.o zebraapi.o retrieve.o kinput.o zebrasrv_LDADD = $(LDADD) -zebrasrv_DEPENDENCIES = +@ISZMBOL_FALSE@zebrasrv_DEPENDENCIES = ../rset/librset.a \ +@ISZMBOL_FALSE@../dict/libdict.a ../isams/libisams.a \ +@ISZMBOL_FALSE@../recctrl/librecctrl.a ../bfile/libbfile.a \ +@ISZMBOL_FALSE@../dfa/libdfa.a ../util/libutil.a +@ISZMBOL_TRUE@zebrasrv_DEPENDENCIES = ../rset/librset.a \ +@ISZMBOL_TRUE@../dict/libdict.a ../isams/libisams.a ../isam/libisam.a \ +@ISZMBOL_TRUE@../isamc/libisamc.a ../isamb/libisamb.a \ +@ISZMBOL_TRUE@../recctrl/librecctrl.a ../bfile/libbfile.a \ +@ISZMBOL_TRUE@../dfa/libdfa.a ../util/libutil.a zebrasrv_LDFLAGS = apitest_OBJECTS = apitest.o kcompare.o zrpn.o zsets.o attribute.o \ recindex.o lockutil.o locksrv.o zinfo.o trunc.o sortidx.o rank1.o \ zebraapi.o retrieve.o kinput.o apitest_LDADD = $(LDADD) -apitest_DEPENDENCIES = +@ISZMBOL_FALSE@apitest_DEPENDENCIES = ../rset/librset.a \ +@ISZMBOL_FALSE@../dict/libdict.a ../isams/libisams.a \ +@ISZMBOL_FALSE@../recctrl/librecctrl.a ../bfile/libbfile.a \ +@ISZMBOL_FALSE@../dfa/libdfa.a ../util/libutil.a +@ISZMBOL_TRUE@apitest_DEPENDENCIES = ../rset/librset.a \ +@ISZMBOL_TRUE@../dict/libdict.a ../isams/libisams.a ../isam/libisam.a \ +@ISZMBOL_TRUE@../isamc/libisamc.a ../isamb/libisamb.a \ +@ISZMBOL_TRUE@../recctrl/librecctrl.a ../bfile/libbfile.a \ +@ISZMBOL_TRUE@../dfa/libdfa.a ../util/libutil.a apitest_LDFLAGS = CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) diff --git a/index/main.c b/index/main.c index b6e99d9..c2b16c1 100644 --- a/index/main.c +++ b/index/main.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: main.c,v $ - * Revision 1.77 2000-09-05 14:04:05 adam + * Revision 1.78 2000-10-17 12:37:09 adam + * Fixed notification of live-updates. Fixed minor problem with mf_init + * where it didn't handle shadow area file names correctly. + * + * Revision 1.77 2000/09/05 14:04:05 adam * Updates for prefix 'yaz_' for YAZ log functions. * * Revision 1.76 2000/03/20 19:08:36 adam @@ -423,6 +427,8 @@ int main (int argc, char **argv) zebraIndexUnlock(); rval = res_get (common_resource, "shadow"); zebraIndexLock (rGroupDef.bfs, 0, rval); + if (rval && *rval) + bf_cache (rGroupDef.bfs, rval); zebraIndexLockMsg ("w"); bf_reset (rGroupDef.bfs); } @@ -454,7 +460,7 @@ int main (int argc, char **argv) bf_commitClean (rGroupDef.bfs, rval); } else - logf (LOG_LOG, "cothing to commit"); + logf (LOG_LOG, "nothing to commit"); } else if (!strcmp (arg, "clean")) { diff --git a/index/zebraapi.c b/index/zebraapi.c index 6e2461b..90fe482 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -3,7 +3,11 @@ * All rights reserved. * * $Log: zebraapi.c,v $ - * Revision 1.36 2000-09-06 08:59:36 adam + * Revision 1.37 2000-10-17 12:37:09 adam + * Fixed notification of live-updates. Fixed minor problem with mf_init + * where it didn't handle shadow area file names correctly. + * + * Revision 1.36 2000/09/06 08:59:36 adam * Using read-only (for now) for server. * * Revision 1.35 2000/07/07 12:49:20 adam @@ -162,8 +166,13 @@ static void extract_index (ZebraHandle zh); static void zebra_register_unlock (ZebraHandle zh); +static int zebra_register_activate (ZebraService zh, int rw); +static int zebra_register_deactivate (ZebraService zh); + static int zebra_register_lock (ZebraHandle zh) { + time_t lastChange; + int state; zh->errCode = 0; zh->errString = 0; if (!zh->service->active) @@ -171,14 +180,50 @@ static int zebra_register_lock (ZebraHandle zh) zh->errCode = 1019; return 1; } + #if HAVE_SYS_TIMES_H times (&zh->tms1); #endif + + state = zebra_server_lock_get_state(zh->service, &lastChange); + + zebra_server_lock (zh->service, state); + + switch (state) + { + case 'c': + state = 1; + break; + default: + state = 0; + } + if (zh->service->registerState == state) + { + if (zh->service->registerChange >= lastChange) + return 0; + logf (LOG_LOG, "Register completely updated since last access"); + } + else if (zh->service->registerState == -1) + logf (LOG_LOG, "Reading register using state %d pid=%ld", state, + (long) getpid()); + else + logf (LOG_LOG, "Register has changed state from %d to %d", + zh->service->registerState, state); + zh->service->registerChange = lastChange; + + zebra_register_deactivate (zh->service); + + zh->service->registerState = state; + + zebra_register_activate (zh->service, 0); return 0; } + static void zebra_register_unlock (ZebraHandle zh) { + if (zh->service->registerState != -1) + zebra_server_unlock (zh->service, zh->service->registerState); #if HAVE_SYS_TIMES_H times (&zh->tms2); logf (LOG_LOG, "user/system: %ld/%ld", @@ -214,13 +259,9 @@ ZebraHandle zebra_open (ZebraService zs) zebra_mutex_cond_unlock (&zs->session_lock); - logf(LOG_APP,"CONNECT:"); - return zh; } -static int zebra_register_activate (ZebraService zh, int rw); -static int zebra_register_deactivate (ZebraService zh); ZebraService zebra_start (const char *configName) { @@ -231,23 +272,29 @@ ZebraService zebra_start (const char *configName) zh->configName = xstrdup(configName); zh->sessions = 0; zh->stop_flag = 0; - zh->active = 0; + zh->active = 1; + + zh->registerState = -1; + zh->registerChange = 0; + + if (!(zh->res = res_open (zh->configName))) + { + logf (LOG_WARN, "Failed to read resources `%s'", zh->configName); + return zh; + } + zebra_chdir (zh); + zebra_server_lock_init (zh); zebra_mutex_cond_init (&zh->session_lock); - zebra_register_activate (zh, 0); return zh; } static int zebra_register_activate (ZebraService zh, int rw) { - if (zh->active) + if (zh->active > 1) return 0; - yaz_log (LOG_LOG, "zebra_register_activate"); - if (!(zh->res = res_open (zh->configName))) - { - logf (LOG_WARN, "Failed to read resources `%s'", zh->configName); - return -1; - } - zebra_chdir (zh); + yaz_log (LOG_LOG, "zebra_register_activate shadow=%s", + zh->registerState ? "yes" : "no"); + zh->dh = data1_create (); if (!zh->dh) return -1; @@ -258,9 +305,8 @@ static int zebra_register_activate (ZebraService zh, int rw) return -1; } bf_lockDir (zh->bfs, res_get (zh->res, "lockDir")); + bf_cache (zh->bfs, zh->registerState ? res_get (zh->res, "shadow") : NULL); data1_set_tabpath (zh->dh, res_get(zh->res, "profilePath")); - zh->registerState = -1; /* trigger open of registers! */ - zh->registerChange = 0; zh->recTypes = recTypes_init (zh->dh); recTypes_default_handlers (zh->recTypes); @@ -357,20 +403,23 @@ static int zebra_register_activate (ZebraService zh, int rw) logf (LOG_WARN, "Cannot obtain EXPLAIN information"); return -1; } - zh->active = 1; + zh->active = 2; yaz_log (LOG_LOG, "zebra_register_activate ok"); return 0; } void zebra_admin_shutdown (ZebraHandle zh) { + zebra_register_lock (zh); zebraExplain_flush (zh->service->zei, 1, zh); extract_index (zh); + zebra_register_unlock (zh); zebra_mutex_cond_lock (&zh->service->session_lock); zh->service->stop_flag = 1; if (!zh->service->sessions) zebra_register_deactivate(zh->service); + zh->service->active = 0; zebra_mutex_cond_unlock (&zh->service->session_lock); } @@ -380,14 +429,14 @@ void zebra_admin_start (ZebraHandle zh) zh->errCode = 0; zebra_mutex_cond_lock (&zs->session_lock); if (!zs->stop_flag) - zebra_register_activate(zs, 0); + zh->service->active = 1; zebra_mutex_cond_unlock (&zs->session_lock); } static int zebra_register_deactivate (ZebraService zh) { zh->stop_flag = 0; - if (!zh->active) + if (zh->active <= 1) return 0; yaz_log(LOG_LOG, "zebra_register_deactivate"); zebra_chdir (zh); @@ -416,8 +465,7 @@ static int zebra_register_deactivate (ZebraService zh) if (zh->passwd_db) passwd_db_close (zh->passwd_db); - res_close (zh->res); - zh->active = 0; + zh->active = 1; return 0; } @@ -432,6 +480,7 @@ void zebra_stop(ZebraService zh) zebra_mutex_cond_destroy (&zh->session_lock); zebra_register_deactivate(zh); + res_close (zh->res); xfree (zh->configName); xfree (zh); } diff --git a/isam/Makefile.in b/isam/Makefile.in index d324003..4598336 100644 --- a/isam/Makefile.in +++ b/isam/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/isamb/Makefile.in b/isamb/Makefile.in index 1d9de55..f413e56 100644 --- a/isamb/Makefile.in +++ b/isamb/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/isamb/isamb.c b/isamb/isamb.c index c887032..15a825e 100644 --- a/isamb/isamb.c +++ b/isamb/isamb.c @@ -1,54 +1,89 @@ -#if 0 + +#include #include -ISAMB isamb_open (const char *name, ISAMC_M method) +struct ISAMB_s { + BFiles bfs; + ISAMC_M method; +}; + +typedef unsigned char *Bpage; + +ISAMB isamb_open (BFiles bfs, const char *name, ISAMC_M method) { ISAMB isamb = xmalloc (sizeof(*isamb)); + + isamb->bfs = bfs; + isamb->method = (ISAMC_M) xmalloc (sizeof(*method)); + memcpy (isamb->method, method, sizeof(*method)); return isamb; } -int isamb_insert (ISAMB is, ISAMB_pos *pos, const void *data) +void isamb_close (ISAMB isamb) { - void *decodeClientData; + xfree (isamb->method); + xfree (isamb); +} - void *page; - if (*pos == 0) - { - *pos = isamb_alloc_block (is, isamb->block_size[0], &page); - isamb_page_set_leaf (page); - isamb_page_set_no (page, 0); - } - else /* find leaf ... */ +#if 0 +/* read page at pos */ +void isamb_get_block (ISAMB is, ISAMB_pos pos, Bpage *page) +{ +} + +/* alloc page */ +ISAMB_pos isamb_alloc_block (ISAMB is, int block_size, Bpage *page) +{ +} + +#define isamb_page_set_leaf (p) 0[p] = 1 +#define isamb_page_set_noleaf (p) 0[p] = 0 +#define isamb_page_datalist (4+p) + +static void isamb_page_set_no(Bpage page, int no) +{ + page[1] = no & 255; + page[2] = (no >> 8) & 255; + page[3] = (no >> 16) & 255; +} + +static int isamb_page_get_no(Bpage page) +{ + return page[1] + 256*page[2] + 65536*page[3]; +} + +void isamb_insert_sub(ISAMB is, ISAMB_pos *pos, const void *data) +{ + const char *src; + char dst[200]; + int no, i; + + isamb_get_block (is, *pos, &page); + if (!isamb_page_isleaf (page)) { - const char *src; - char dst[200]; - int no, i; - while (1) + ISAMB_pos subptr; + src = isamb_page_datalist (page); + no = isamb_page_get_no (page); + decodeClientData = (*is->method->code_start)(ISAMC_DECODE); + + isamb_read_subptr (&subptr, &src); + for (i = 0; imethod->code_item)(ISAMC_DECODE, decodeClientData, + dst, &src); + if ((*is->method->compare_item)(data, dst) < 0) break; - src = isamb_page_datalist (page); - no = isamb_page_get_no (page); - decodeClientData = (*is->method->code_start)(ISAMC_DECODE); - - isamb_read_subptr (&subptr, &src); - for (i = 0; imethod->code_item)(ISAMC_DECODE, decodeClientData, - dst, &src); - if ((*is->method->compare_item)(data, dst) < 0) - break; - - isamb_read_subptr (&subptr, src); - } - *pos = subptr; - (*is->method->code_stop)(ISAMC_DECODE, decodeClientData); + + isamb_read_subptr (&subptr, src); } + isamb_insert_sub (is, subptr, data); + *pos = subptr; + (*is->method->code_stop)(ISAMC_DECODE, decodeClientData); + } + else + { src = isamb_page_datalist (page); no = isamb_page_get_no (page); decodeClientData = (*is->method->code_start)(ISAMC_DECODE); @@ -86,4 +121,22 @@ int isamb_insert (ISAMB is, ISAMB_pos *pos, const void *data) } } } +/* insert data(input) in table is(input) at pos(input/output) */ +int isamb_insert (ISAMB is, ISAMB_pos *pos, const void *data) +{ + void *decodeClientData; + + Bpage page; + if (*pos == 0) + { + *pos = isamb_alloc_block (is, 1024, &page); + isamb_page_set_leaf (page); + isamb_page_set_no (page, 0); + } + else /* find leaf ... */ + { + isamb_insert_sub (is, pos, const void *data); + + } +} #endif diff --git a/isamc/Makefile.in b/isamc/Makefile.in index cb527e4..61b1967 100644 --- a/isamc/Makefile.in +++ b/isamc/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/isams/Makefile.in b/isams/Makefile.in index 5c6d1ca..54fb0a6 100644 --- a/isams/Makefile.in +++ b/isams/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/recctrl/Makefile.in b/recctrl/Makefile.in index 46dd90a..71a777d 100644 --- a/recctrl/Makefile.in +++ b/recctrl/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/rset/Makefile.in b/rset/Makefile.in index 4ca7c3a..b4cff96 100644 --- a/rset/Makefile.in +++ b/rset/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/tab/Makefile.in b/tab/Makefile.in index c9f18c6..49dc241 100644 --- a/tab/Makefile.in +++ b/tab/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/test/Makefile.in b/test/Makefile.in index 59c6f3f..881e449 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/test/gils/Makefile.in b/test/gils/Makefile.in index d4fc3eb..51706e4 100644 --- a/test/gils/Makefile.in +++ b/test/gils/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/test/usmarc/Makefile.in b/test/usmarc/Makefile.in index d6e3e42..6c63ac8 100644 --- a/test/usmarc/Makefile.in +++ b/test/usmarc/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ diff --git a/util/Makefile.in b/util/Makefile.in index b766363..20b5c74 100644 --- a/util/Makefile.in +++ b/util/Makefile.in @@ -64,7 +64,6 @@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ PROGPREFIX = @PROGPREFIX@ RANLIB = @RANLIB@ -SUBLIBS = @SUBLIBS@ TCL_INCLUDE = @TCL_INCLUDE@ TCL_LIB = @TCL_LIB@ VERSION = @VERSION@ -- 1.7.10.4