* Sebastian Hammer, Adam Dickmeiss
*
* $Log: bfile.c,v $
- * Revision 1.28 1999-05-12 13:08:05 adam
+ * Revision 1.29 1999-05-26 07:49:12 adam
+ * C++ compilation.
+ *
+ * Revision 1.28 1999/05/12 13:08:05 adam
* First version of ISAMS.
*
* Revision 1.27 1999/02/02 14:50:01 adam
BFiles bfs_create (const char *spec)
{
- BFiles bfs = xmalloc (sizeof(*bfs));
+ BFiles bfs = (BFiles) xmalloc (sizeof(*bfs));
bfs->commit_area = NULL;
bfs->register_area = mf_init("register", spec);
bfs->lockDir = NULL;
if (lockDir == NULL)
lockDir = "";
len = strlen(lockDir);
- bfs->lockDir = xmalloc (len+2);
+ bfs->lockDir = (char *) xmalloc (len+2);
strcpy (bfs->lockDir, lockDir);
if (len > 0 && bfs->lockDir[len-1] != '/')
BFile bf_open (BFiles bfs, const char *name, int block_size, int wflag)
{
- BFile tmp = xmalloc(sizeof(BFile_struct));
+ BFile tmp = (BFile) xmalloc(sizeof(BFile_struct));
if (bfs->commit_area)
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: cfile.c,v $
- * Revision 1.24 1999-05-12 13:08:06 adam
+ * Revision 1.25 1999-05-26 07:49:12 adam
+ * C++ compilation.
+ *
+ * Revision 1.24 1999/05/12 13:08:06 adam
* First version of ISAMS.
*
* Revision 1.23 1998/10/15 13:09:29 adam
if (!tab)
return 0;
- while (left >= HASH_BSIZE)
+ while (left >= (int) HASH_BSIZE)
{
mf_write (cf->hash_mf, bno++, 0, 0, tab);
tab += HASH_BSIZE;
if (!tab)
return 0;
- while (left >= HASH_BSIZE)
+ while (left >= (int) HASH_BSIZE)
{
mf_read (cf->hash_mf, bno++, 0, 0, tab);
tab += HASH_BSIZE;
cf->head.next_block = 1;
if (wflag)
mf_write (cf->hash_mf, 0, 0, sizeof(cf->head), &cf->head);
- cf->array = xmalloc (hash_bytes);
+ cf->array = (int *) xmalloc (hash_bytes);
for (i = 0; i<cf->head.hash_size; i++)
cf->array[i] = 0;
if (wflag)
assert (cf->head.next_bucket > 0);
assert (cf->head.next_block > 0);
if (cf->head.state == 1)
- cf->array = xmalloc (hash_bytes);
+ cf->array = (int *) xmalloc (hash_bytes);
else
cf->array = NULL;
read_head (cf);
}
if (cf->head.state == 1)
{
- cf->parray = xmalloc (cf->head.hash_size * sizeof(*cf->parray));
+ cf->parray = (struct CFile_hash_bucket **)
+ xmalloc (cf->head.hash_size * sizeof(*cf->parray));
for (i = 0; i<cf->head.hash_size; i++)
cf->parray[i] = NULL;
}
cf->bucket_in_memory = 0;
cf->max_bucket_in_memory = 100;
cf->dirty = 0;
- cf->iobuf = xmalloc (cf->head.block_size);
+ cf->iobuf = (char *) xmalloc (cf->head.block_size);
memset (cf->iobuf, 0, cf->head.block_size);
cf->no_hits = 0;
cf->no_miss = 0;
flush_bucket (cf, 1);
assert (cf->bucket_in_memory < cf->max_bucket_in_memory);
++(cf->bucket_in_memory);
- p = xmalloc (sizeof(*p));
+ p = (struct CFile_hash_bucket *) xmalloc (sizeof(*p));
p->lru_next = NULL;
p->lru_prev = cf->bucket_lru_front;
assert (cf->head.state == 1);
flush_bucket (cf, -1);
assert (cf->bucket_in_memory == 0);
- p = xmalloc (sizeof(*p));
+ p = (struct CFile_hash_bucket *) xmalloc (sizeof(*p));
for (i = cf->head.first_bucket; i < cf->head.next_bucket; i++)
{
if (!mf_read (cf->hash_mf, i, 0, 0, &p->ph))
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: cfile.h,v 1.11 1999-05-12 13:08:06 adam Exp $
+ * $Id: cfile.h,v 1.12 1999-05-26 07:49:12 adam Exp $
*/
#ifndef CFILE_H
#define CFILE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define HASH_BUCKET 15
struct CFile_ph_bucket { /* structure on disc */
void cf_unlink (CFile cf);
void cf_commit (CFile cf);
+#ifdef __cplusplus
+}
+#endif
+
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: commit.c,v $
- * Revision 1.14 1998-08-07 15:07:16 adam
+ * Revision 1.15 1999-05-26 07:49:12 adam
+ * C++ compilation.
+ *
+ * Revision 1.14 1998/08/07 15:07:16 adam
* Fixed but in cf_commit_flat.
*
* Revision 1.13 1996/10/29 13:56:16 adam
m_p = map_cache_init (cf);
#endif
- p = xmalloc (sizeof(*p));
+ p = (struct CFile_ph_bucket *) xmalloc (sizeof(*p));
hash_bytes = cf->head.hash_size * sizeof(int);
bucket_no = cf->head.first_bucket;
for (; bucket_no < cf->head.next_bucket; bucket_no++)
#if CF_OPTIMIZE_COMMIT
m_p = map_cache_init (cf);
#endif
- fp = xmalloc (HASH_BSIZE);
+ fp = (int *) xmalloc (HASH_BSIZE);
for (hno = cf->head.next_bucket; hno < cf->head.flat_bucket; hno++)
{
- for (i = 0; i < (HASH_BSIZE/sizeof(int)); i++)
+ for (i = 0; i < (int) (HASH_BSIZE/sizeof(int)); i++)
fp[i] = 0;
if (!mf_read (cf->hash_mf, hno, 0, 0, fp) &&
hno != cf->head.flat_bucket-1)
logf (LOG_FATAL, "read index block hno=%d (%d-%d) commit",
hno, cf->head.next_bucket, cf->head.flat_bucket-1);
}
- for (i = 0; i < (HASH_BSIZE/sizeof(int)); i++)
+ for (i = 0; i < (int) (HASH_BSIZE/sizeof(int)); i++)
{
if (fp[i])
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: mfile.c,v $
- * Revision 1.33 1999-05-12 13:08:06 adam
+ * Revision 1.34 1999-05-26 07:49:12 adam
+ * C++ compilation.
+ *
+ * Revision 1.33 1999/05/12 13:08:06 adam
* First version of ISAMS.
*
* Revision 1.32 1999/04/28 14:53:07 adam
return -1;
}
ad++;
- *dp = dir = xmalloc(sizeof(mf_dir));
+ *dp = dir = (mf_dir *) xmalloc(sizeof(mf_dir));
dir->next = 0;
strcpy(dir->name, dirname);
dir->max_bytes = dir->avail_bytes = fact * size * multi;
*/
MFile_area mf_init(const char *name, const char *spec)
{
- MFile_area ma = xmalloc(sizeof(*ma));
+ MFile_area ma = (MFile_area) xmalloc(sizeof(*ma));
mf_dir *dirp;
meta_file *meta_f;
part_file *part_f = 0;
/* new metafile */
if (!meta_f)
{
- meta_f = xmalloc(sizeof(*meta_f));
+ meta_f = (meta_file *) xmalloc(sizeof(*meta_f));
meta_f->ma = ma;
meta_f->next = ma->mfiles;
meta_f->open = 0;
*/
MFile mf_open(MFile_area ma, const char *name, int block_size, int wflag)
{
- struct meta_file *mnew;
+ meta_file *mnew;
int i;
char tmp[FILENAME_MAX+1];
mf_dir *dp;
}
if (!mnew)
{
- mnew = xmalloc(sizeof(*mnew));
+ mnew = (meta_file *) xmalloc(sizeof(*mnew));
strcpy(mnew->name, name);
/* allocate one, empty file */
mnew->no_files = 1;
fi
-# ------ Substitutions
-#
-# ------ Checking programs
# 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:537: checking for $ac_word" >&5
+echo "configure:534: 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
# 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:567: checking for $ac_word" >&5
+echo "configure:564: 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
# 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:618: checking for $ac_word" >&5
+echo "configure:615: 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
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:650: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:647: 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.
cat > conftest.$ac_ext << EOF
-#line 661 "configure"
+#line 658 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:663: \"$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
{ 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:692: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:689: 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:697: checking whether we are using GNU C" >&5
+echo "configure:694: 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
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:706: \"$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:703: \"$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
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:725: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:722: 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
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:757: checking how to run the C preprocessor" >&5
+echo "configure:754: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 772 "configure"
+#line 769 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:778: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:775: \"$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*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 789 "configure"
+#line 786 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:795: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:792: \"$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*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 806 "configure"
+#line 803 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:812: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:809: \"$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
:
# 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:867: checking for a BSD compatible install" >&5
+echo "configure:864: 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
# 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:922: checking for $ac_word" >&5
+echo "configure:919: 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
echo "$ac_t""no" 1>&6
fi
-#
-# look for Tcl
TCL_LIB=""
TCL_INCLUDE=""
tclconfig=NONE
# 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:967: checking for $ac_word" >&5
+echo "configure:962: 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
fi
if test -r ${tclconfig}/tclConfig.sh; then
echo $ac_n "checking for Tcl""... $ac_c" 1>&6
-echo "configure:1009: checking for Tcl" >&5
+echo "configure:1004: checking for Tcl" >&5
. ${tclconfig}/tclConfig.sh
if test -r ${tclconfig}/../generic/tcl.h; then
TCL_INCLUDE=-I${tclconfig}/../generic
else
ODEFS="-DHAVE_TCL_H=0"
fi
-#
-# sockets
checkBoth=0
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:1031: checking for connect" >&5
+echo "configure:1024: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1036 "configure"
+#line 1029 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
; return 0; }
EOF
-if { (eval echo configure:1059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
if test "$ac_cv_func_connect" = "no"; then
echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:1080: checking for main in -lsocket" >&5
+echo "configure:1073: checking for main in -lsocket" >&5
ac_lib_var=`echo socket'_'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_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1088 "configure"
+#line 1081 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:1095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1088: \"$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
oldLibs=$LIBS
LIBS="$LIBS -lsocket -lnsl"
echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:1121: checking for accept" >&5
+echo "configure:1114: checking for accept" >&5
if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1126 "configure"
+#line 1119 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char accept(); below. */
; return 0; }
EOF
-if { (eval echo configure:1149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_accept=yes"
else
fi
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:1171: checking for gethostbyname" >&5
+echo "configure:1164: checking for gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1176 "configure"
+#line 1169 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
; return 0; }
EOF
-if { (eval echo configure:1199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:1217: checking for main in -lnsl" >&5
+echo "configure:1210: checking for main in -lnsl" >&5
ac_lib_var=`echo nsl'_'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_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1225 "configure"
+#line 1218 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:1232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1225: \"$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
fi
-#
-# tcpd wrapper
echo $ac_n "checking for main in -lwrap""... $ac_c" 1>&6
-echo "configure:1257: checking for main in -lwrap" >&5
+echo "configure:1248: 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_save_LIBS="$LIBS"
LIBS="-lwrap $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1265 "configure"
+#line 1256 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:1272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1263: \"$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
echo "$ac_t""no" 1>&6
fi
-#
-# headers
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1295: checking for ANSI C header files" >&5
+echo "configure:1284: 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
-#line 1300 "configure"
+#line 1289 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1308: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1297: \"$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*
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 1325 "configure"
+#line 1314 "configure"
#include "confdefs.h"
#include <string.h>
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 1343 "configure"
+#line 1332 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
:
else
cat > conftest.$ac_ext <<EOF
-#line 1364 "configure"
+#line 1353 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
exit (0); }
EOF
-if { (eval echo configure:1375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1364: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
if test "$ac_cv_header_stdc" = "no"; then
echo "configure: warning: Your system doesn't seem to support ANSI C" 1>&2
fi
-#
-# makefiles
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
-# Zebra, Index Data Aps, 1994-1999
-# $Id: configure.in,v 1.7 1999-05-21 12:00:17 adam Exp $
-# See the file LICENSE.2 for details.
-#
+dnl Zebra, Index Data Aps, 1994-1999
+dnl $Id: configure.in,v 1.8 1999-05-26 07:49:12 adam Exp $
+dnl See the file LICENSE.2 for details.
+dnl
AC_INIT(include/zebraver.h)
-# ------ Substitutions
+dnl ------ Substitutions
AC_SUBST(ODEFS)
AC_SUBST(DEFS)
AC_SUBST(TCL_INCLUDE)
AC_SUBST(TCL_LIB)
-#
-# ------ Checking programs
+dnl
+dnl ------ Checking programs
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_RANLIB
-#
-# look for Tcl
+dnl
+dnl ------ Look for Tcl
TCL_LIB=""
TCL_INCLUDE=""
tclconfig=NONE
else
ODEFS="-DHAVE_TCL_H=0"
fi
-#
-# sockets
+dnl
+dnl ------ Socket libraries
checkBoth=0
AC_CHECK_FUNC(connect)
if test "$ac_cv_func_connect" = "no"; then
AC_CHECK_FUNC(accept, , [LIBS=$oldLibs])
fi
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
-#
-# tcpd wrapper
+dnl
+dnl ------ TCP wrapper (for Linux)
AC_CHECK_LIB(wrap, main, [LIBS="$LIBS -lwrap"])
-#
-# headers
+dnl
+dnl ------ ANSI C Header files
AC_STDC_HEADERS
if test "$ac_cv_header_stdc" = "no"; then
AC_MSG_WARN(Your system doesn't seem to support ANSI C)
fi
-#
-# makefiles
+dnl
+dnl ------ Create Makefiles
AC_OUTPUT(Makefile util/Makefile bfile/Makefile dfa/Makefile dict/Makefile isam/Makefile isamc/Makefile recctrl/Makefile rset/Makefile index/Makefile)
-# Copyright (C) 1994-1996, Index Data ApS
+# Copyright (C) 1994-1999, Index Data ApS
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile.in,v 1.2 1998-10-28 15:20:45 adam Exp $
+# $Id: Makefile.in,v 1.3 1999-05-26 07:49:12 adam Exp $
SHELL=/bin/sh
-RANLIB=ranlib
+
+CC=@CC@
+CPP=@CPP@
+RANLIB=@RANLIB@
+CDEFS=@DEFS@ @ODEFS@
+LIBS=@LIBS@
YAZLIB=../../yaz/lib/libyaz.a
YAZINC=-I../../yaz/z39.50 -I../../yaz/include
TPROG1=agrep
TPROG2=lexer
TPROG3=grepper
-DEFS=$(INCLUDE)
+DEFS=$(CDEFS) $(INCLUDE)
LIB=../lib/dfa.a
PO = dfa.o imalloc.o states.o set.o bset.o
-CPP=$(CC) -E
all: $(LIB)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: agrep.c,v $
- * Revision 1.11 1999-02-02 14:50:03 adam
+ * Revision 1.12 1999-05-26 07:49:12 adam
+ * C++ compilation.
+ *
+ * Revision 1.11 1999/02/02 14:50:03 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.10 1997/09/09 13:37:57 adam
return i;
while (--argc > 0)
if (**++argv != '-' && **argv)
+ {
if (!pattern)
{
pattern = *argv;
if (i)
return i;
}
+ }
if (!no)
{
fprintf (stderr, "usage:\n "
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: dfa.c,v $
- * Revision 1.25 1999-02-02 14:50:05 adam
+ * Revision 1.26 1999-05-26 07:49:12 adam
+ * C++ compilation.
+ *
+ * Revision 1.25 1999/02/02 14:50:05 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.24 1998/10/28 10:48:55 adam
if (!dfa->charMap)
{
dfa->charMapSize = 7;
- dfa->charMap = imalloc (dfa->charMapSize * sizeof(*dfa->charMap));
+ dfa->charMap = (int *)
+ imalloc (dfa->charMapSize * sizeof(*dfa->charMap));
}
dfa->charMap[0] = 0;
}
if (dfa->charMap)
ifree (dfa->charMap);
dfa->charMapSize = size;
- dfa->charMap = imalloc (size * sizeof(*dfa->charMap));
+ dfa->charMap = (int *) imalloc (size * sizeof(*dfa->charMap));
}
memcpy (dfa->charMap, cmap, size * sizeof(*dfa->charMap));
}
size = dfa->charMapSize;
if (indx >= size)
{
- int *cn = imalloc ((size+16) * sizeof(*dfa->charMap));
+ int *cn = (int *) imalloc ((size+16) * sizeof(*dfa->charMap));
memcpy (cn, dfa->charMap, indx*sizeof(*dfa->charMap));
ifree (dfa->charMap);
dfa->charMap = cn;
if (debug_dfa_followpos)
pr_followpos(parse_info);
- init_DFA_states (&dfas, parse_info->poset, STATE_HASH);
+ init_DFA_states (&dfas, parse_info->poset, (int) (STATE_HASH));
mk_dfa_tran (parse_info, dfas);
if (debug_dfa_tran)
pr_tran (parse_info, dfas);
{
struct DFA *dfa;
- dfa = imalloc (sizeof(*dfa));
+ dfa = (struct DFA *) imalloc (sizeof(*dfa));
dfa->parse_info = dfa_parse_init ();
dfa->state_info = NULL;
dfa->states = NULL;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: dfap.h,v $
- * Revision 1.8 1999-02-02 14:50:06 adam
+ * Revision 1.9 1999-05-26 07:49:12 adam
+ * C++ compilation.
+ *
+ * Revision 1.8 1999/02/02 14:50:06 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.7 1997/09/29 09:05:17 adam
#include <dfa.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct DFA_parse {
struct Tnode *root; /* root of regular syntax tree */
int position; /* no of positions so far */
void add_DFA_tran (struct DFA_states *, struct DFA_state *,
int, int, int);
+#ifdef __cplusplus
+}
+#endif
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: imalloc.h,v $
- * Revision 1.4 1999-02-02 14:50:09 adam
+ * Revision 1.5 1999-05-26 07:49:12 adam
+ * C++ compilation.
+ *
+ * Revision 1.4 1999/02/02 14:50:09 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.3 1997/10/27 14:27:13 adam
*
*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void *imalloc (size_t);
void *icalloc (size_t);
void ifree (void *);
#endif
+#ifdef __cplusplus
+}
+#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: lexer.h,v $
- * Revision 1.3 1999-02-02 14:50:11 adam
+ * Revision 1.4 1999-05-26 07:49:12 adam
+ * C++ compilation.
+ *
+ * Revision 1.3 1999/02/02 14:50:11 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.2 1995/01/24 16:00:22 adam
*
*/
+#ifdef __cplusplus
+extern "C" {
+#endif
int read_file ( const char *, struct DFA * );
void error ( const char *, ... );
extern int ccluse;
+#ifdef __cplusplus
+}
+#endif
+
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: set.c,v $
- * Revision 1.6 1999-02-02 14:50:13 adam
+ * Revision 1.7 1999-05-26 07:49:12 adam
+ * C++ compilation.
+ *
+ * Revision 1.6 1999/02/02 14:50:13 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.5 1996/10/29 13:57:29 adam
Set add_Set (SetType st, Set s, int n)
{
SetElement dummy;
- Set p = &dummy, new;
+ Set p = &dummy, snew;
p->next = s;
while (p->next && p->next->value < n)
p = p->next;
assert (p);
if (!(p->next && p->next->value == n))
{
- new = mk_SetElement (st, n);
- new->next = p->next;
- p->next = new;
+ snew = mk_SetElement (st, n);
+ snew->next = p->next;
+ p->next = snew;
}
return dummy.next;
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: dcompact.c,v $
- * Revision 1.4 1999-05-15 14:36:37 adam
+ * Revision 1.5 1999-05-26 07:49:12 adam
+ * C++ compilation.
+ *
+ * Revision 1.4 1999/05/15 14:36:37 adam
* Updated dictionary. Implemented "compression" of dictionary.
*
* Revision 1.3 1999/05/12 13:08:06 adam
dict_from = dict_open (bfs, from_name, 0, 0, 0);
if (!dict_from)
return -1;
- map = xmalloc ((dict_from->head.last+1) * sizeof(*map));
+ map = (int *) xmalloc ((dict_from->head.last+1) * sizeof(*map));
for (i = 0; i <= (int) (dict_from->head.last); i++)
map[i] = -1;
dict_to = dict_open (bfs, to_name, 0, 1, 1);
DICT_backptr(new_p) = map[i-1];
DICT_bsize(new_p) = map[i+1] - map[i];
- dict_copy_page(dict_from, new_p, old_p, map);
+ dict_copy_page(dict_from, (char*) new_p, (char*) old_p, map);
}
dict_close (dict_from);
dict_close (dict_to);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: dopen.c,v $
- * Revision 1.7 1999-05-15 14:36:37 adam
+ * Revision 1.8 1999-05-26 07:49:12 adam
+ * C++ compilation.
+ *
+ * Revision 1.7 1999/05/15 14:36:37 adam
* Updated dictionary. Implemented "compression" of dictionary.
*
* Revision 1.6 1999/02/02 14:50:20 adam
bf->all_data = xmalloc (block_size * cache);
/* Allocate and initialize hash array (as empty) */
- bf->hash_array = xmalloc(sizeof(*bf->hash_array) * bf->hash_size);
+ bf->hash_array = (struct Dict_file_block **)
+ xmalloc(sizeof(*bf->hash_array) * bf->hash_size);
for (i=bf->hash_size; --i >= 0; )
bf->hash_array[i] = NULL;
/* Allocate all block descriptors in one chunk */
- bf->all_blocks = xmalloc (sizeof(*bf->all_blocks) * cache);
+ bf->all_blocks = (struct Dict_file_block *)
+ xmalloc (sizeof(*bf->all_blocks) * cache);
/* Initialize the free list */
bf->free_list = bf->all_blocks;
{
Dict_BFile dbf;
- dbf = xmalloc (sizeof(*dbf));
+ dbf = (Dict_BFile) xmalloc (sizeof(*dbf));
dbf->bf = bf_open (bfs, name, block_size, rw);
if (!dbf->bf)
return NULL;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: insert.c,v $
- * Revision 1.20 1999-05-15 14:36:37 adam
+ * Revision 1.21 1999-05-26 07:49:12 adam
+ * C++ compilation.
+ *
+ * Revision 1.20 1999/05/15 14:36:37 adam
* Updated dictionary. Implemented "compression" of dictionary.
*
* Revision 1.19 1999/02/02 14:50:22 adam
static void clean_page (Dict dict, Dict_ptr ptr, void *p, Dict_char *out,
Dict_ptr subptr, char *userinfo)
{
- char *np = xmalloc (dict->head.page_size);
+ char *np = (char *) xmalloc (dict->head.page_size);
int i, slen, no = 0;
short *indxp1, *indxp2;
char *info1, *info2;
--indxp;
slen = (dict_strlen(str)+1)*sizeof(Dict_char);
if (DICT_size(p)+slen+userlen >=
- DICT_bsize(p) - (1+DICT_nodir(p))*sizeof(short)) /* overflow? */
+ (int)(DICT_bsize(p) - (1+DICT_nodir(p))*sizeof(short)))/* overflow? */
{
if (DICT_type(p))
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: lookgrep.c,v $
- * Revision 1.23 1999-05-15 14:36:37 adam
+ * Revision 1.24 1999-05-26 07:49:12 adam
+ * C++ compilation.
+ *
+ * Revision 1.23 1999/05/15 14:36:37 adam
* Updated dictionary. Implemented "compression" of dictionary.
*
* Revision 1.22 1999/02/02 14:50:23 adam
static MatchContext *mk_MatchContext (struct DFA *dfa, int range)
{
- MatchContext *mc = xmalloc (sizeof(*mc));
+ MatchContext *mc = (MatchContext *) xmalloc (sizeof(*mc));
int s;
mc->n = (dfa->no_states+WORD_BITS) / WORD_BITS;
mc->range = range;
mc->fact = (range+1)*mc->n;
- mc->match_mask = xcalloc (mc->n, sizeof(*mc->match_mask));
+ mc->match_mask = (MatchWord *) xcalloc (mc->n, sizeof(*mc->match_mask));
for (s = 0; s<dfa->no_states; s++)
if (dfa->states[s]->rule_no)
mc = mk_MatchContext (dfa, range);
- Rj = xcalloc ((MAX_LENGTH+1) * mc->n, sizeof(*Rj));
+ Rj = (MatchWord *) xcalloc ((MAX_LENGTH+1) * mc->n, sizeof(*Rj));
set_bit (mc, Rj, 0, 0);
for (d = 1; d<=mc->range; d++)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: lookupec.c,v $
- * Revision 1.8 1999-05-15 14:36:37 adam
+ * Revision 1.9 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.8 1999/05/15 14:36:37 adam
* Updated dictionary. Implemented "compression" of dictionary.
*
* Revision 1.7 1999/02/02 14:50:26 adam
MatchWord *s;
MatchInfo *mi;
- mi = xmalloc (sizeof(*mi));
+ mi = (MatchInfo *) xmalloc (sizeof(*mi));
mi->m = dict_strlen (pattern);
- mi->s = s = xmalloc (sizeof(*s)*256); /* 256 !!! */
+ mi->s = s = (MatchWord *) xmalloc (sizeof(*s)*256); /* 256 !!! */
for (i=0; i<256; i++)
s[i] = 0;
for (i=0; pattern[i]; i++)
mi = prepare_match ((Dict_char*) pattern);
- ri = xmalloc ((dict_strlen((Dict_char*) pattern)+range+2)
- * (range+1)*sizeof(*ri));
+ ri = (MatchWord *) xmalloc ((dict_strlen((Dict_char*) pattern)+range+2)
+ * (range+1)*sizeof(*ri));
for (i=0; i<=range; i++)
ri[i] = (2<<i)-1;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: open.c,v $
- * Revision 1.15 1999-05-15 14:36:37 adam
+ * Revision 1.16 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.15 1999/05/15 14:36:37 adam
* Updated dictionary. Implemented "compression" of dictionary.
*
* Revision 1.14 1999/03/09 13:07:06 adam
char resource_str[80];
int page_size;
- dict = xmalloc (sizeof(*dict));
+ dict = (Dict) xmalloc (sizeof(*dict));
if (cache < 5)
cache = 5;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: direntz.h,v $
- * Revision 1.3 1999-02-02 14:50:33 adam
+ * Revision 1.4 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.3 1999/02/02 14:50:33 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.2 1997/09/17 12:19:09 adam
#ifdef WIN32
-/* make own version of dirent */
+/* make WIN32 version of dirent */
#include <windows.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct dirent {
char d_name[MAX_PATH];
};
DIR *opendir (const char *path);
struct dirent *readdir (DIR *dd);
void closedir (DIR *dd);
+
+#ifdef __cplusplus
+}
+#endif
+
#else
/* include UNIX version */
#include <dirent.h>
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: passwddb.h,v $
- * Revision 1.2 1998-06-25 09:55:47 adam
+ * Revision 1.3 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.2 1998/06/25 09:55:47 adam
* Minor changes - fixex headers.
*
*/
#ifndef PASSWDDB_H
#define PASSWDDB_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct passwd_db *Passwd_db;
Passwd_db passwd_db_open (void);
void passwd_db_close (Passwd_db db);
void passwd_db_show (Passwd_db db);
+#ifdef __cplusplus
+}
+#endif
+
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: dir.c,v $
- * Revision 1.20 1999-02-02 14:50:50 adam
+ * Revision 1.21 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.20 1999/02/02 14:50:50 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.19 1998/11/03 10:16:11 adam
exit (1);
return NULL;
}
- entry = xmalloc (sizeof(*entry) * entry_max);
+ entry = (struct dir_entry *) xmalloc (sizeof(*entry) * entry_max);
strcpy (path, rep);
pathpos = strlen(path);
if (!pathpos || path[pathpos-1] != '/')
{
struct dir_entry *entry_n;
- entry_n = xmalloc (sizeof(*entry) * (entry_max += 1000));
+ entry_n = (struct dir_entry *)
+ xmalloc (sizeof(*entry) * (entry_max += 1000));
memcpy (entry_n, entry, idx * sizeof(*entry));
xfree (entry);
entry = entry_n;
case S_IFREG:
entry[idx].kind = dirs_file;
entry[idx].mtime = finfo.st_mtime;
- entry[idx].name = xmalloc (strlen(dent->d_name)+1);
+ entry[idx].name = (char *) xmalloc (strlen(dent->d_name)+1);
strcpy (entry[idx].name, dent->d_name);
idx++;
break;
case S_IFDIR:
entry[idx].kind = dirs_dir;
entry[idx].mtime = finfo.st_mtime;
- entry[idx].name = xmalloc (strlen(dent->d_name)+2);
+ entry[idx].name = (char *) xmalloc (strlen(dent->d_name)+2);
strcpy (entry[idx].name, dent->d_name);
strcat (entry[idx].name, "/");
idx++;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: dirs.c,v $
- * Revision 1.15 1999-02-02 14:50:51 adam
+ * Revision 1.16 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.15 1999/02/02 14:50:51 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.14 1998/01/12 15:04:07 adam
static int dirs_client_proc (char *name, const char *info, int pos,
void *client)
{
- struct dirs_info *ci = client;
+ struct dirs_info *ci = (struct dirs_info *) client;
struct dirs_entry *entry;
if (memcmp (name, ci->prefix, ci->prelen))
int before = 0, after;
logf (LOG_DEBUG, "dirs_open %s", rep);
- p = xmalloc (sizeof (*p));
+ p = (struct dirs_info *) xmalloc (sizeof (*p));
p->dict = dict;
p->rw = rw;
strcpy (p->prefix, rep);
strcpy (p->nextpath, rep);
p->no_read = p->no_cur = 0;
after = p->no_max = 100;
- p->entries = xmalloc (sizeof(*p->entries) * (p->no_max));
+ p->entries = (struct dirs_entry *)
+ xmalloc (sizeof(*p->entries) * (p->no_max));
logf (LOG_DEBUG, "dirs_open first scan");
dict_scan (p->dict, p->nextpath, &before, &after, p, dirs_client_proc);
return p;
struct dirs_entry *entry;
char *info;
- p = xmalloc (sizeof(*p));
+ p = (struct dirs_info *) xmalloc (sizeof(*p));
p->dict = dict;
*p->prefix = '\0';
- p->entries = xmalloc (sizeof(*p->entries));
+ p->entries = (struct dirs_entry *) xmalloc (sizeof(*p->entries));
p->no_read = 0;
p->no_cur = 0;
p->no_max = 2;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: extract.c,v $
- * Revision 1.95 1999-05-21 12:00:17 adam
+ * Revision 1.96 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.95 1999/05/21 12:00:17 adam
* Better diagnostics for extraction process.
*
* Revision 1.94 1999/05/20 12:57:18 adam
mem = atoi(res_get_def (common_resource, "memMax", "4"))*1024*1024;
if (mem < 50000)
mem = 50000;
- key_buf = xmalloc (mem);
+ key_buf = (char **) xmalloc (mem);
ptr_top = mem/sizeof(char*);
ptr_i = 0;
{
char *b;
- b = xmalloc (reckeys.buf_max += 128000);
+ b = (char *) xmalloc (reckeys.buf_max += 128000);
if (reckeys.buf_used > 0)
memcpy (b, reckeys.buf, reckeys.buf_used);
xfree (reckeys.buf);
if (sk->attrSet == p->attrSet && sk->attrUse == p->attrUse)
return;
- sk = xmalloc (sizeof(*sk));
+ sk = (struct sortKey *) xmalloc (sizeof(*sk));
sk->next = sortKeys;
sortKeys = sk;
- sk->string = xmalloc (length);
+ sk->string = (char *) xmalloc (length);
sk->length = length;
memcpy (sk->string, string, length);
static struct file_read_info *file_read_start (int fd)
{
- struct file_read_info *fi = xmalloc (sizeof(*fi));
+ struct file_read_info *fi = (struct file_read_info *)
+ xmalloc (sizeof(*fi));
fi->fd = fd;
fi->file_max = 0;
static off_t file_seek (void *handle, off_t offset)
{
- struct file_read_info *p = handle;
+ struct file_read_info *p = (struct file_read_info *) handle;
p->file_offset = offset;
if (p->sdrbuf)
return offset;
static off_t file_tell (void *handle)
{
- struct file_read_info *p = handle;
+ struct file_read_info *p = (struct file_read_info *) handle;
return p->file_offset;
}
static int file_read (void *handle, char *buf, size_t count)
{
- struct file_read_info *p = handle;
+ struct file_read_info *p = (struct file_read_info *) handle;
int fd = p->fd;
int r;
if (p->sdrbuf)
static void file_begin (void *handle)
{
- struct file_read_info *p = handle;
+ struct file_read_info *p = (struct file_read_info *) handle;
p->file_offset = p->file_moffset;
if (!p->sdrbuf && p->file_moffset)
static void file_end (void *handle, off_t offset)
{
- struct file_read_info *p = handle;
+ struct file_read_info *p = (struct file_read_info *) handle;
assert (p->file_more == 0);
p->file_more = 1;
static void recordLogPreamble (int level, const char *msg, void *info)
{
- struct recordLogInfo *p = info;
+ struct recordLogInfo *p = (struct recordLogInfo *) info;
FILE *outf = log_file ();
if (level & LOG_LOG)
if (rGroup->flagStoreData == 1)
{
rec->size[recInfo_storeData] = recordAttr->recordSize;
- rec->info[recInfo_storeData] = xmalloc (recordAttr->recordSize);
+ rec->info[recInfo_storeData] = (char *)
+ xmalloc (recordAttr->recordSize);
if (lseek (fi->fd, recordOffset, SEEK_SET) < 0)
{
logf (LOG_ERRNO|LOG_FATAL, "seek to %ld in %s",
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: index.h,v $
- * Revision 1.62 1999-05-12 13:08:06 adam
+ * Revision 1.63 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.62 1999/05/12 13:08:06 adam
* First version of ISAMS.
*
* Revision 1.61 1999/03/09 16:27:49 adam
#include <data1.h>
#include <recctrl.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define IT_MAX_WORD 256
#define IT_KEY_HAVE_SEQNO 1
#define IT_KEY_HAVE_FIELD 0
void zebra_load_atts (data1_handle dh, Res res);
extern Res common_resource;
+
+#ifdef __cplusplus
+}
+#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: kcompare.c,v $
- * Revision 1.27 1999-05-12 13:08:06 adam
+ * Revision 1.28 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.27 1999/05/12 13:08:06 adam
* First version of ISAMS.
*
* Revision 1.26 1999/02/02 14:50:54 adam
static void *iscz1_code_start (int mode)
{
- struct iscz1_code_info *p = xmalloc (sizeof(*p));
+ struct iscz1_code_info *p = (struct iscz1_code_info *)
+ xmalloc (sizeof(*p));
p->key.sysno = 0;
p->key.seqno = 0;
return p;
static void iscz1_code_item (int mode, void *vp, char **dst, char **src)
{
- struct iscz1_code_info *p = vp;
+ struct iscz1_code_info *p = (struct iscz1_code_info *) vp;
struct it_key tkey;
int d;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: kinput.c,v $
- * Revision 1.33 1999-05-15 14:36:38 adam
+ * Revision 1.34 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.33 1999/05/15 14:36:38 adam
* Updated dictionary. Implemented "compression" of dictionary.
*
* Revision 1.32 1999/05/12 13:08:06 adam
{
struct key_file *f;
- f = xmalloc (sizeof(*f));
+ f = (struct key_file *) xmalloc (sizeof(*f));
f->sysno = 0;
f->seqno = 0;
f->no = no;
f->offset = 0;
f->length = 0;
f->readHandler = NULL;
- f->buf = xmalloc (f->chunk);
- f->prev_name = xmalloc (INP_NAME_MAX);
+ f->buf = (unsigned char *) xmalloc (f->chunk);
+ f->prev_name = (char *) xmalloc (INP_NAME_MAX);
*f->prev_name = '\0';
key_file_chunk_read (f);
return f;
struct heap_info *hi;
int i;
- hi = xmalloc (sizeof(*hi));
- hi->info.file = xmalloc (sizeof(*hi->info.file) * (1+nkeys));
- hi->info.buf = xmalloc (sizeof(*hi->info.buf) * (1+nkeys));
+ hi = (struct heap_info *) xmalloc (sizeof(*hi));
+ hi->info.file = (struct key_file **)
+ xmalloc (sizeof(*hi->info.file) * (1+nkeys));
+ hi->info.buf = (char **) xmalloc (sizeof(*hi->info.buf) * (1+nkeys));
hi->heapnum = 0;
- hi->ptr = xmalloc (sizeof(*hi->ptr) * (1+nkeys));
+ hi->ptr = (int *) xmalloc (sizeof(*hi->ptr) * (1+nkeys));
hi->cmp = cmp;
for (i = 0; i<= nkeys; i++)
{
hi->ptr[i] = i;
- hi->info.buf[i] = xmalloc (INP_NAME_MAX);
+ hi->info.buf[i] = (char *) xmalloc (INP_NAME_MAX);
}
return hi;
}
int heap_cread_item (void *vp, char **dst, int *insertMode)
{
- struct heap_cread_info *p = vp;
+ struct heap_cread_info *p = (struct heap_cread_info *) vp;
struct heap_info *hi = p->hi;
if (p->mode == 1)
int heap_inpc (struct heap_info *hi)
{
struct heap_cread_info hci;
- ISAMC_I isamc_i = xmalloc (sizeof(*isamc_i));
+ ISAMC_I isamc_i = (ISAMC_I) xmalloc (sizeof(*isamc_i));
- hci.key = xmalloc (KEY_SIZE);
+ hci.key = (char *) xmalloc (KEY_SIZE);
hci.mode = 1;
hci.hi = hi;
hci.more = heap_read_one (hi, hci.cur_name, hci.key);
int heap_inps (struct heap_info *hi)
{
struct heap_cread_info hci;
- ISAMS_I isams_i = xmalloc (sizeof(*isams_i));
+ ISAMS_I isams_i = (ISAMS_I) xmalloc (sizeof(*isams_i));
- hci.key = xmalloc (KEY_SIZE);
+ hci.key = (char *) xmalloc (KEY_SIZE);
hci.mode = 1;
hci.hi = hi;
hci.more = heap_read_one (hi, hci.cur_name, hci.key);
char *key_buf;
int more;
- next_key = xmalloc (KEY_SIZE);
- key_buf = xmalloc (key_buf_size);
+ next_key = (char *) xmalloc (KEY_SIZE);
+ key_buf = (char *) xmalloc (key_buf_size);
more = heap_read_one (hi, cur_name, key_buf);
while (more) /* EOF ? */
{
if (key_buf_ptr+(int) KEY_SIZE >= key_buf_size)
{
char *new_key_buf;
- new_key_buf = xmalloc (key_buf_size + INP_BUF_ADD);
+ new_key_buf = (char *) xmalloc (key_buf_size + INP_BUF_ADD);
memcpy (new_key_buf, key_buf, key_buf_size);
key_buf_size += INP_BUF_ADD;
xfree (key_buf);
void progressFunc (struct key_file *keyp, void *info)
{
- struct progressInfo *p = info;
+ struct progressInfo *p = (struct progressInfo *) info;
time_t now, remaining;
if (keyp->buf_size <= 0 || p->totalBytes <= 0)
exit (1);
}
}
- kf = xmalloc ((1+nkeys) * sizeof(*kf));
+ kf = (struct key_file **) xmalloc ((1+nkeys) * sizeof(*kf));
progressInfo.totalBytes = 0;
progressInfo.totalOffset = 0;
time (&progressInfo.startTime);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: locksrv.c,v $
- * Revision 1.12 1999-02-02 14:50:58 adam
+ * Revision 1.13 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.12 1999/02/02 14:50:58 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.11 1998/03/05 08:45:12 adam
zi->server_lock_org = NULL;
zebra_lock_prefix (zi->res, path_prefix);
- zi->server_path_prefix = xmalloc (strlen(path_prefix)+1);
+ zi->server_path_prefix = (char *) xmalloc (strlen(path_prefix)+1);
strcpy (zi->server_path_prefix, path_prefix);
logf (LOG_DEBUG, "Locking system initialized");
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: lockutil.c,v $
- * Revision 1.11 1999-02-02 14:50:59 adam
+ * Revision 1.12 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.11 1999/02/02 14:50:59 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.10 1997/09/29 09:08:36 adam
ZebraLockHandle zebra_lock_create (const char *name, int excl_flag)
{
- ZebraLockHandle h = xmalloc (sizeof(*h));
+ ZebraLockHandle h = (ZebraLockHandle) xmalloc (sizeof(*h));
h->excl_flag = excl_flag;
h->fd = -1;
#ifdef WIN32
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rank1.c,v $
- * Revision 1.4 1999-02-02 14:51:01 adam
+ * Revision 1.5 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.4 1999/02/02 14:51:01 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.3 1998/06/12 12:21:53 adam
*/
static void *create (ZebraHandle zh)
{
- struct rank_class_info *ci = xmalloc (sizeof(*ci));
+ struct rank_class_info *ci = (struct rank_class_info *)
+ xmalloc (sizeof(*ci));
logf (LOG_DEBUG, "rank-1 create");
return ci;
*/
static void destroy (ZebraHandle zh, void *class_handle)
{
- struct rank_class_info *ci = class_handle;
+ struct rank_class_info *ci = (struct rank_class_info *) class_handle;
logf (LOG_DEBUG, "rank-1 destroy");
xfree (ci);
*/
static void *begin (ZebraHandle zh, void *class_handle, RSET rset)
{
- struct rank_set_info *si = xmalloc (sizeof(*si));
+ struct rank_set_info *si = (struct rank_set_info *) xmalloc (sizeof(*si));
int i;
logf (LOG_DEBUG, "rank-1 begin");
si->no_entries = rset->no_rset_terms;
si->no_rank_entries = 0;
- si->entries = xmalloc (sizeof(*si->entries)*si->no_entries);
+ si->entries = (struct rank_term_info *)
+ xmalloc (sizeof(*si->entries)*si->no_entries);
for (i = 0; i < si->no_entries; i++)
{
int g = rset->rset_terms[i]->nn;
*/
static void end (ZebraHandle zh, void *set_handle)
{
- struct rank_set_info *si = set_handle;
+ struct rank_set_info *si = (struct rank_set_info *) set_handle;
logf (LOG_DEBUG, "rank-1 end");
xfree (si->entries);
xfree (si);
*/
static void add (void *set_handle, int seqno, int term_index)
{
- struct rank_set_info *si = set_handle;
+ struct rank_set_info *si = (struct rank_set_info *) set_handle;
logf (LOG_DEBUG, "rank-1 add seqno=%d term_index=%d", seqno, term_index);
si->last_pos = seqno;
si->entries[term_index].local_occur++;
static int calc (void *set_handle, int sysno)
{
int i, lo, divisor, score = 0;
- struct rank_set_info *si = set_handle;
+ struct rank_set_info *si = (struct rank_set_info *) set_handle;
logf (LOG_DEBUG, "rank-1 calc sysno=%d", sysno);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: recindex.c,v $
- * Revision 1.22 1999-02-18 12:49:34 adam
+ * Revision 1.23 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.22 1999/02/18 12:49:34 adam
* Changed file naming scheme for register files as well as record
* store/index files.
*
{
xfree (p->tmp_buf);
p->tmp_size = size + p->head.block_size[dst_type]*2 + 2048;
- p->tmp_buf = xmalloc (p->tmp_size);
+ p->tmp_buf = (char *) xmalloc (p->tmp_size);
}
}
Records p;
int i, r;
- p = xmalloc (sizeof(*p));
+ p = (Records) xmalloc (sizeof(*p));
p->rw = rw;
p->tmp_size = 1024;
- p->tmp_buf = xmalloc (p->tmp_size);
+ p->tmp_buf = (char *) xmalloc (p->tmp_size);
p->index_fname = "reci";
p->index_BFile = bf_open (bfs, p->index_fname, 128, rw);
if (p->index_BFile == NULL)
{
char str[80];
sprintf (str, "recd%c", i + 'A');
- p->data_fname[i] = xmalloc (strlen(str)+1);
+ p->data_fname[i] = (char *) xmalloc (strlen(str)+1);
strcpy (p->data_fname[i], str);
p->data_BFile[i] = NULL;
}
}
p->cache_max = 10;
p->cache_cur = 0;
- p->record_cache = xmalloc (sizeof(*p->record_cache)*p->cache_max);
+ p->record_cache = (struct record_cache_entry *)
+ xmalloc (sizeof(*p->record_cache)*p->cache_max);
return p;
}
assert (freeblock > 0);
- rec = xmalloc (sizeof(*rec));
+ rec = (Record) xmalloc (sizeof(*rec));
rec_tmp_expand (p, entry.size, dst_type);
cptr = p->tmp_buf;
nptr += sizeof(*rec->size);
if (rec->size[i])
{
- rec->info[i] = xmalloc (rec->size[i]);
+ rec->info[i] = (char *) xmalloc (rec->size[i]);
memcpy (rec->info[i], nptr, rec->size[i]);
nptr += rec->size[i];
}
Record rec;
assert (p);
- rec = xmalloc (sizeof(*rec));
+ rec = (Record) xmalloc (sizeof(*rec));
if (1 || p->head.index_free == 0)
sysno = (p->head.index_last)++;
else
Record n;
int i;
- n = xmalloc (sizeof(*n));
+ n = (Record) xmalloc (sizeof(*n));
n->sysno = rec->sysno;
for (i = 0; i < REC_NO_INFO; i++)
if (!rec->info[i])
else
{
n->size[i] = rec->size[i];
- n->info[i] = xmalloc (rec->size[i]);
+ n->info[i] = (char *) xmalloc (rec->size[i]);
memcpy (n->info[i], rec->info[i], rec->size[i]);
}
return n;
return NULL;
}
*len = strlen(s)+1;
- p = xmalloc (*len);
+ p = (char *) xmalloc (*len);
strcpy (p, s);
return p;
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: recindex.h,v $
- * Revision 1.14 1999-02-02 14:51:04 adam
+ * Revision 1.15 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.14 1999/02/02 14:51:04 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.13 1998/03/05 08:45:12 adam
#include <zebrautl.h>
#include <bfile.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define REC_NO_INFO 8
typedef struct record_info {
recInfo_attr
};
+#ifdef __cplusplus
+}
+#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: recindxp.h,v $
- * Revision 1.5 1999-02-02 14:51:05 adam
+ * Revision 1.6 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.5 1999/02/02 14:51:05 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.4 1998/03/05 08:45:12 adam
#include <bfile.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define REC_BLOCK_TYPES 2
#define REC_HEAD_MAGIC "recindx"
int size; /* size of record or 0 if free entry */
};
+#ifdef __cplusplus
+}
+#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: retrieve.c,v $
- * Revision 1.9 1999-05-20 12:57:18 adam
+ * Revision 1.10 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.9 1999/05/20 12:57:18 adam
* Implemented TCL filter. Updated recctrl system.
*
* Revision 1.8 1999/03/09 16:27:49 adam
static int record_ext_read (void *fh, char *buf, size_t count)
{
- struct fetch_control *fc = fh;
+ struct fetch_control *fc = (struct fetch_control *) fh;
return read (fc->fd, buf, count);
}
static off_t record_ext_seek (void *fh, off_t offset)
{
- struct fetch_control *fc = fh;
+ struct fetch_control *fc = (struct fetch_control *) fh;
return lseek (fc->fd, offset + fc->record_offset, SEEK_SET);
}
static off_t record_ext_tell (void *fh)
{
- struct fetch_control *fc = fh;
+ struct fetch_control *fc = (struct fetch_control *) fh;
return lseek (fc->fd, 0, SEEK_CUR) - fc->record_offset;
}
static off_t record_int_seek (void *fh, off_t offset)
{
- struct fetch_control *fc = fh;
+ struct fetch_control *fc = (struct fetch_control *) fh;
return (off_t) (fc->record_int_pos = offset);
}
static off_t record_int_tell (void *fh)
{
- struct fetch_control *fc = fh;
+ struct fetch_control *fc = (struct fetch_control *) fh;
return (off_t) fc->record_int_pos;
}
static int record_int_read (void *fh, char *buf, size_t count)
{
- struct fetch_control *fc = fh;
+ struct fetch_control *fc = (struct fetch_control *) fh;
int l = fc->record_int_len - fc->record_int_pos;
if (l <= 0)
return 0;
file_type = rec->info[recInfo_fileType];
fname = rec->info[recInfo_filename];
basename = rec->info[recInfo_databaseName];
- *basenamep = odr_malloc (stream, strlen(basename)+1);
+ *basenamep = (char *) odr_malloc (stream, strlen(basename)+1);
strcpy (*basenamep, basename);
if (!(rt = recType_byName (zh->recTypes, file_type, subType, &clientData)))
retrieveCtrl.res = zh->res;
(*rt->retrieve)(clientData, &retrieveCtrl);
*output_format = retrieveCtrl.output_format;
- *rec_bufp = retrieveCtrl.rec_buf;
+ *rec_bufp = (char *) retrieveCtrl.rec_buf;
*rec_lenp = retrieveCtrl.rec_len;
if (fc.fd != -1)
close (fc.fd);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: sortidx.c,v $
- * Revision 1.2 1998-06-25 09:55:50 adam
+ * Revision 1.3 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.2 1998/06/25 09:55:50 adam
* Minor changes - fixex headers.
*
*/
SortIdx sortIdx_open (BFiles bfs, int write_flag)
{
- SortIdx si = xmalloc (sizeof(*si));
+ SortIdx si = (SortIdx) xmalloc (sizeof(*si));
si->bfs = bfs;
si->write_flag = write_flag;
si->current_file = NULL;
si->files = NULL;
- si->entry_buf = xmalloc (SORT_IDX_ENTRYSIZE);
+ si->entry_buf = (char *) xmalloc (SORT_IDX_ENTRYSIZE);
return si;
}
si->current_file = sf;
return 0;
}
- sf = xmalloc (sizeof(*sf));
+ sf = (struct sortFile *) xmalloc (sizeof(*sf));
sf->type = type;
sf->bf = NULL;
sf->next = si->files;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: symtab.c,v $
- * Revision 1.5 1999-02-02 14:51:08 adam
+ * Revision 1.6 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.5 1999/02/02 14:51:08 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.4 1997/09/09 13:38:09 adam
struct strtab *strtab_mk (void)
{
int i;
- struct strtab *p = xmalloc (sizeof (*p));
+ struct strtab *p = (struct strtab *) xmalloc (sizeof (*p));
for (i=0; i<STR_HASH; i++)
p->ar[i] = NULL;
return p;
*infop = &e->info;
return 1;
}
- e = xmalloc (sizeof(*e));
- e->name = xmalloc (strlen(name)+1);
+ e = (struct strentry *) xmalloc (sizeof(*e));
+ e->name = (char *) xmalloc (strlen(name)+1);
strcpy (e->name, name);
e->next = t->ar[hash];
t->ar[hash] = e;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: trunc.c,v $
- * Revision 1.13 1999-05-12 13:08:06 adam
+ * Revision 1.14 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.13 1999/05/12 13:08:06 adam
* First version of ISAMS.
*
* Revision 1.12 1999/02/02 14:51:10 adam
int (*cmp)(const void *p1,
const void *p2))
{
- struct trunc_info *ti = xmalloc (sizeof(*ti));
+ struct trunc_info *ti = (struct trunc_info *) xmalloc (sizeof(*ti));
int i;
++size;
ti->heapnum = 0;
ti->keysize = key_size;
ti->cmp = cmp;
- ti->indx = xmalloc (size * sizeof(*ti->indx));
- ti->heap = xmalloc (size * sizeof(*ti->heap));
- ti->ptr = xmalloc (size * sizeof(*ti->ptr));
- ti->swapbuf = xmalloc (ti->keysize);
- ti->tmpbuf = xmalloc (ti->keysize);
- ti->buf = xmalloc (size * ti->keysize);
+ ti->indx = (int *) xmalloc (size * sizeof(*ti->indx));
+ ti->heap = (char **) xmalloc (size * sizeof(*ti->heap));
+ ti->ptr = (int *) xmalloc (size * sizeof(*ti->ptr));
+ ti->swapbuf = (char *) xmalloc (ti->keysize);
+ ti->tmpbuf = (char *) xmalloc (ti->keysize);
+ ti->buf = (char *) xmalloc (size * ti->keysize);
for (i = size; --i >= 0; )
{
ti->ptr[i] = i;
int rscur = 0;
int rsmax = (to-from)/i_add + 1;
- rset = xmalloc (sizeof(*rset) * rsmax);
- rsfd = xmalloc (sizeof(*rsfd) * rsmax);
+ rset = (RSET *) xmalloc (sizeof(*rset) * rsmax);
+ rsfd = (RSFD *) xmalloc (sizeof(*rsfd) * rsmax);
for (i = from; i < to; i += i_add)
{
int i;
struct trunc_info *ti;
- ispt = xmalloc (sizeof(*ispt) * (to-from));
+ ispt = (ISPT *) xmalloc (sizeof(*ispt) * (to-from));
ti = heap_init (to-from, sizeof(struct it_key),
key_compare_it);
int i;
struct trunc_info *ti;
- ispt = xmalloc (sizeof(*ispt) * (to-from));
+ ispt = (ISAMC_PP *) xmalloc (sizeof(*ispt) * (to-from));
ti = heap_init (to-from, sizeof(struct it_key),
key_compare_it);
int i;
struct trunc_info *ti;
- ispt = xmalloc (sizeof(*ispt) * (to-from));
+ ispt = (ISAMS_PP *) xmalloc (sizeof(*ispt) * (to-from));
ti = heap_init (to-from, sizeof(struct it_key),
key_compare_it);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zebraapi.c,v $
- * Revision 1.18 1999-05-15 14:36:38 adam
+ * Revision 1.19 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.18 1999/05/15 14:36:38 adam
* Updated dictionary. Implemented "compression" of dictionary.
*
* Revision 1.17 1999/05/12 13:08:06 adam
ZebraHandle zebra_open (const char *configName)
{
- ZebraHandle zh = xmalloc (sizeof(*zh));
+ ZebraHandle zh = (ZebraHandle) xmalloc (sizeof(*zh));
if (!(zh->res = res_open (configName)))
{
void map_basenames_func (void *vp, const char *name, const char *value)
{
- struct map_baseinfo *p = vp;
+ struct map_baseinfo *p = (struct map_baseinfo *) vp;
int i, no;
char fromdb[128], todb[8][128];
zh->errCode = 0;
zh->errString = NULL;
- pos_array = xmalloc (num_recs * sizeof(*pos_array));
+ pos_array = (int *) xmalloc (num_recs * sizeof(*pos_array));
for (i = 0; i<num_recs; i++)
pos_array[i] = recs[i].position;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zinfo.c,v $
- * Revision 1.15 1999-01-25 13:47:54 adam
+ * Revision 1.16 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.15 1999/01/25 13:47:54 adam
* Fixed bug.
*
* Revision 1.14 1998/11/04 16:31:32 adam
}
if (!ao)
{
- ao = nmem_malloc (zei->nmem, sizeof(*ao));
+ ao = (zebAccessObject) nmem_malloc (zei->nmem, sizeof(*ao));
ao->handle = NULL;
ao->sysno = 1;
ao->oid = oid;
if (!n)
{
- *accessInfo = nmem_malloc (zei->nmem, sizeof(**accessInfo));
+ *accessInfo = (zebAccessInfo)
+ nmem_malloc (zei->nmem, sizeof(**accessInfo));
(*accessInfo)->attributeSetIds = NULL;
(*accessInfo)->schemas = NULL;
}
struct tm *tm;
logf (LOG_DEBUG, "zebraExplain_open wr=%d", writeFlag);
- zei = xmalloc (sizeof(*zei));
+ zei = (ZebraExplainInfo) xmalloc (sizeof(*zei));
zei->updateHandle = updateHandle;
zei->updateFunc = updateFunc;
zei->dirty = 0;
zei->dh = dh;
zei->attsets = NULL;
zei->res = res;
- zei->categoryList = nmem_malloc (zei->nmem,
- sizeof(*zei->categoryList));
+ zei->categoryList = (struct zebraCategoryListInfo *)
+ nmem_malloc (zei->nmem, sizeof(*zei->categoryList));
zei->categoryList->sysno = 0;
zei->categoryList->dirty = 0;
zei->categoryList->data1_categoryList = NULL;
}
assert (node_id && node_name && node_aid);
- *zdip = nmem_malloc (zei->nmem, sizeof(**zdip));
-
+ *zdip = (struct zebDatabaseInfoB *)
+ nmem_malloc (zei->nmem, sizeof(**zdip));
(*zdip)->readFlag = 1;
(*zdip)->dirty = 0;
(*zdip)->data1_database = NULL;
(*zdip)->recordBytes = 0;
zebraExplain_mergeAccessInfo (zei, 0, &(*zdip)->accessInfo);
- (*zdip)->databaseName = nmem_malloc (zei->nmem,
- 1+node_name->u.data.len);
+ (*zdip)->databaseName = (char *)
+ nmem_malloc (zei->nmem, 1+node_name->u.data.len);
memcpy ((*zdip)->databaseName, node_name->u.data.data,
node_name->u.data.len);
(*zdip)->databaseName[node_name->u.data.len] = '\0';
(*zdip)->sysno = atoi_n (node_id->u.data.data,
node_id->u.data.len);
- (*zdip)->attributeDetails =
+ (*zdip)->attributeDetails = (zebAttributeDetails)
nmem_malloc (zei->nmem, sizeof(*(*zdip)->attributeDetails));
(*zdip)->attributeDetails->sysno = atoi_n (node_aid->u.data.data,
node_aid->u.data.len);
rec_strdup ("IR-Explain-1", &trec->size[recInfo_databaseName]);
sgml_buf = data1_nodetoidsgml(dh, zei->data1_target, 0, &sgml_len);
- trec->info[recInfo_storeData] = xmalloc (sgml_len);
+ trec->info[recInfo_storeData] = (char *) xmalloc (sgml_len);
memcpy (trec->info[recInfo_storeData], sgml_buf, sgml_len);
trec->size[recInfo_storeData] = sgml_len;
assert (node_set && node_use && node_ordinal);
oid_str_len = node_set->u.data.len;
- if (oid_str_len >= sizeof(oid_str))
+ if (oid_str_len >= (int) sizeof(oid_str))
oid_str_len = sizeof(oid_str)-1;
memcpy (oid_str, node_set->u.data.data, oid_str_len);
oid_str[oid_str_len] = '\0';
-
- *zsuip = nmem_malloc (zei->nmem, sizeof(**zsuip));
+
+ *zsuip = (struct zebSUInfoB *)
+ nmem_malloc (zei->nmem, sizeof(**zsuip));
(*zsuip)->info.set = oid_getvalbyname (oid_str);
(*zsuip)->info.use = atoi_n (node_use->u.data.data,
if (zdi)
return -1;
/* it's new really. make it */
- zdi = nmem_malloc (zei->nmem, sizeof(*zdi));
+ zdi = (struct zebDatabaseInfoB *) nmem_malloc (zei->nmem, sizeof(*zdi));
zdi->next = zei->databaseInfo;
zei->databaseInfo = zdi;
zdi->sysno = 0;
zei->dirty = 1;
zei->curDatabaseInfo = zdi;
- zdi->attributeDetails =
+ zdi->attributeDetails = (zebAttributeDetails)
nmem_malloc (zei->nmem, sizeof(*zdi->attributeDetails));
zdi->attributeDetails->readFlag = 0;
zdi->attributeDetails->sysno = 0;
#if ZINFO_DEBUG
data1_pr_tree (zei->dh, node_categoryList, stderr);
#endif
- sgml_buf = data1_nodetoidsgml(zei->dh, node_categoryList,
- 0, &sgml_len);
- drec->info[recInfo_storeData] = xmalloc (sgml_len);
+ sgml_buf = data1_nodetoidsgml(zei->dh, node_categoryList, 0, &sgml_len);
+ drec->info[recInfo_storeData] = (char *) xmalloc (sgml_len);
memcpy (drec->info[recInfo_storeData], sgml_buf, sgml_len);
drec->size[recInfo_storeData] = sgml_len;
oe.proto = PROTO_Z3950;
oe.oclass = CLASS_ATTSET;
- oe.value = set_ordinal;
+ oe.value = (enum oid_value) set_ordinal;
if (oid_ent_to_oid (&oe, oid))
{
oident.proto = PROTO_Z3950;
oident.oclass = CLASS_ATTSET;
- oident.value = zsui->info.set;
+ oident.value = (enum oid_value) zsui->info.set;
oid_ent_to_oid (&oident, oid);
data1_add_tagdata_text (zei->dh, node_attr, "set",
#endif
sgml_buf = data1_nodetoidsgml(zei->dh, zad->data1_tree,
0, &sgml_len);
- drec->info[recInfo_storeData] = xmalloc (sgml_len);
+ drec->info[recInfo_storeData] = (char *) xmalloc (sgml_len);
memcpy (drec->info[recInfo_storeData], sgml_buf, sgml_len);
drec->size[recInfo_storeData] = sgml_len;
#endif
sgml_buf = data1_nodetoidsgml(zei->dh, zdi->data1_database,
0, &sgml_len);
- drec->info[recInfo_storeData] = xmalloc (sgml_len);
+ drec->info[recInfo_storeData] = (char *) xmalloc (sgml_len);
memcpy (drec->info[recInfo_storeData], sgml_buf, sgml_len);
drec->size[recInfo_storeData] = sgml_len;
data1_pr_tree (zei->dh, node_root, stderr);
#endif
sgml_buf = data1_nodetoidsgml(zei->dh, node_root, 0, &sgml_len);
- drec->info[recInfo_storeData] = xmalloc (sgml_len);
+ drec->info[recInfo_storeData] = (char *) xmalloc (sgml_len);
memcpy (drec->info[recInfo_storeData], sgml_buf, sgml_len);
drec->size[recInfo_storeData] = sgml_len;
#endif
sgml_buf = data1_nodetoidsgml(zei->dh, zei->data1_target,
0, &sgml_len);
- trec->info[recInfo_storeData] = xmalloc (sgml_len);
+ trec->info[recInfo_storeData] = (char *) xmalloc (sgml_len);
memcpy (trec->info[recInfo_storeData], sgml_buf, sgml_len);
trec->size[recInfo_storeData] = sgml_len;
break;
if (!ao)
{
- ao = nmem_malloc (zei->nmem, sizeof(*ao));
+ ao = (zebAccessObject) nmem_malloc (zei->nmem, sizeof(*ao));
ao->handle = NULL;
ao->sysno = 0;
ao->oid = odr_oiddup_nmem (zei->nmem, oid);
oe.proto = PROTO_Z3950;
oe.oclass = CLASS_ATTSET;
- oe.value = set;
+ oe.value = (enum oid_value) set;
if (oid_ent_to_oid (&oe, oid))
{
if (zsui->info.use == use && zsui->info.set == set)
return -1;
zebraExplain_addAttributeSet (zei, set);
- zsui = nmem_malloc (zei->nmem, sizeof(*zsui));
+ zsui = (struct zebSUInfoB *) nmem_malloc (zei->nmem, sizeof(*zsui));
zsui->next = zei->curDatabaseInfo->attributeDetails->SUInfo;
zei->curDatabaseInfo->attributeDetails->SUInfo = zsui;
zei->curDatabaseInfo->attributeDetails->dirty = 1;
if (rec->info[recInfo_attr])
return (RecordAttr *) rec->info[recInfo_attr];
- recordAttr = xmalloc (sizeof(*recordAttr));
+ recordAttr = (RecordAttr *) xmalloc (sizeof(*recordAttr));
rec->info[recInfo_attr] = (char *) recordAttr;
rec->size[recInfo_attr] = sizeof(*recordAttr);
static void att_loadset(void *p, const char *n, const char *name)
{
- data1_handle dh = p;
+ data1_handle dh = (data1_handle) p;
if (!data1_get_attset (dh, name))
logf (LOG_WARN, "Couldn't load attribute set %s", name);
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zinfo.h,v $
- * Revision 1.6 1999-02-02 14:51:12 adam
+ * Revision 1.7 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.6 1999/02/02 14:51:12 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.5 1998/06/08 14:43:16 adam
#include <data1.h>
#include "recindex.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct zebraExplainInfo *ZebraExplainInfo;
typedef struct zebDatabaseInfo ZebDatabaseInfo;
ZebraExplainInfo zebraExplain_open (Records records, data1_handle dh,
} RecordAttr;
RecordAttr *rec_init_attr (ZebraExplainInfo zei, Record rec);
+#ifdef __cplusplus
+}
+#endif
+
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zrpn.c,v $
- * Revision 1.91 1999-02-02 14:51:13 adam
+ * Revision 1.92 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.91 1999/02/02 14:51:13 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.90 1998/11/16 16:03:43 adam
static const char **rpn_char_map_handler (void *vp, const char **from, int len)
{
- struct rpn_char_map_info *p = vp;
+ struct rpn_char_map_info *p = (struct rpn_char_map_info *) vp;
return zebra_maps_input (p->zm, p->reg_type, from, len);
}
int *new_term_no;
#endif
p->isam_p_size = 2*p->isam_p_size + 100;
- new_isam_p_buf = xmalloc (sizeof(*new_isam_p_buf) *
- p->isam_p_size);
+ new_isam_p_buf = (ISAM_P *) xmalloc (sizeof(*new_isam_p_buf) *
+ p->isam_p_size);
if (p->isam_p_buf)
{
memcpy (new_isam_p_buf, p->isam_p_buf,
p->isam_p_buf = new_isam_p_buf;
#ifdef TERM_COUNT
- new_term_no = xmalloc (sizeof(*new_term_no) *
- p->isam_p_size);
+ new_term_no = (int *) xmalloc (sizeof(*new_term_no) *
+ p->isam_p_size);
if (p->term_no)
{
memcpy (new_term_no, p->isam_p_buf,
static int grep_handle (char *name, const char *info, void *p)
{
- add_isam_p (name, info, p);
+ add_isam_p (name, info, (struct grep_info *) p);
return 0;
}
int term_index;
const char *flags = NULL;
- rsfd = xmalloc (sizeof(*rsfd)*rset_no);
- more = xmalloc (sizeof(*more)*rset_no);
- buf = xmalloc (sizeof(*buf)*rset_no);
+ rsfd = (RSFD *) xmalloc (sizeof(*rsfd)*rset_no);
+ more = (int *) xmalloc (sizeof(*more)*rset_no);
+ buf = (struct it_key **) xmalloc (sizeof(*buf)*rset_no);
for (i = 0; i<rset_no; i++)
{
int j;
- buf[i] = xmalloc (sizeof(**buf));
+ buf[i] = (struct it_key *) xmalloc (sizeof(**buf));
rsfd[i] = rset_open (rset[i], RSETF_READ);
if (!(more[i] = rset_read (rset[i], rsfd[i], buf[i], &term_index)))
break;
grep_info.isam_p_indx, term_dst,
strlen(term_dst), rank_type);
assert (rset[rset_no]);
- if (++rset_no >= sizeof(rset)/sizeof(*rset))
+ if (++rset_no >= (int) (sizeof(rset)/sizeof(*rset)))
break;
}
#ifdef TERM_COUNT
grep_info.isam_p_indx, term_dst,
strlen(term_dst), rank_type);
assert (rset[rset_no]);
- if (++rset_no >= sizeof(rset)/sizeof(*rset))
+ if (++rset_no >= (int) (sizeof(rset)/sizeof(*rset)))
break;
}
#ifdef TERM_COUNT
grep_info.isam_p_indx, term_dst,
strlen(term_dst), rank_type);
assert (rset[rset_no]);
- if (++rset_no >= sizeof(rset)/sizeof(*rset))
+ if (++rset_no >= (int) (sizeof(rset)/sizeof(*rset)))
break;
}
#ifdef TERM_COUNT
grep_info.isam_p_indx, term_dst,
strlen(term_dst), rank_type);
assert (rset[rset_no]);
- if (++rset_no >= sizeof(rset)/sizeof(*rset))
+ if (++rset_no >= (int) (sizeof(rset)/sizeof(*rset)))
break;
}
#ifdef TERM_COUNT
if (!sort_sequence->specs)
{
sort_sequence->num_specs = 10;
- sort_sequence->specs = nmem_malloc (stream, sort_sequence->num_specs *
- sizeof(*sort_sequence->specs));
+ sort_sequence->specs = (Z_SortKeySpec **)
+ nmem_malloc (stream, sort_sequence->num_specs *
+ sizeof(*sort_sequence->specs));
for (i = 0; i<sort_sequence->num_specs; i++)
sort_sequence->specs[i] = 0;
}
if (zapt->term->which != Z_Term_general)
i = 0;
else
- i = atoi_n (zapt->term->u.general->buf, zapt->term->u.general->len);
+ i = atoi_n ((char *) zapt->term->u.general->buf,
+ zapt->term->u.general->len);
if (i >= sort_sequence->num_specs)
i = 0;
if (!oid_ent_to_oid (&oe, oid))
return 0;
- sks = nmem_malloc (stream, sizeof(*sks));
- sks->sortElement = nmem_malloc (stream, sizeof(*sks->sortElement));
+ sks = (Z_SortKeySpec *) nmem_malloc (stream, sizeof(*sks));
+ sks->sortElement = (Z_SortElement *)
+ nmem_malloc (stream, sizeof(*sks->sortElement));
sks->sortElement->which = Z_SortElement_generic;
- sk = sks->sortElement->u.generic = nmem_malloc (stream, sizeof(*sk));
+ sk = sks->sortElement->u.generic = (Z_SortKey *)
+ nmem_malloc (stream, sizeof(*sk));
sk->which = Z_SortKey_sortAttributes;
- sk->u.sortAttributes = nmem_malloc (stream, sizeof(*sk->u.sortAttributes));
+ sk->u.sortAttributes = (Z_SortAttributes *)
+ nmem_malloc (stream, sizeof(*sk->u.sortAttributes));
sk->u.sortAttributes->id = oid;
- sk->u.sortAttributes->list =
+ sk->u.sortAttributes->list = (Z_AttributeList *)
nmem_malloc (stream, sizeof(*sk->u.sortAttributes->list));
sk->u.sortAttributes->list->num_attributes = 1;
- sk->u.sortAttributes->list->attributes =
+ sk->u.sortAttributes->list->attributes = (Z_AttributeElement **)
nmem_malloc (stream, sizeof(*sk->u.sortAttributes->list->attributes));
- ae = *sk->u.sortAttributes->list->attributes =
+ ae = *sk->u.sortAttributes->list->attributes = (Z_AttributeElement *)
nmem_malloc (stream, sizeof(**sk->u.sortAttributes->list->attributes));
ae->attributeSet = 0;
- ae->attributeType = nmem_malloc (stream, sizeof(*ae->attributeType));
+ ae->attributeType = (int *)
+ nmem_malloc (stream, sizeof(*ae->attributeType));
*ae->attributeType = 1;
ae->which = Z_AttributeValue_numeric;
- ae->value.numeric = nmem_malloc (stream, sizeof(*ae->value.numeric));
+ ae->value.numeric = (int *)
+ nmem_malloc (stream, sizeof(*ae->value.numeric));
*ae->value.numeric = use_value;
- sks->sortRelation = nmem_malloc (stream, sizeof(*sks->sortRelation));
+ sks->sortRelation = (int *)
+ nmem_malloc (stream, sizeof(*sks->sortRelation));
if (sort_relation_value == 1)
*sks->sortRelation = Z_SortRelation_ascending;
else if (sort_relation_value == 2)
else
*sks->sortRelation = Z_SortRelation_ascending;
- sks->caseSensitivity = nmem_malloc (stream, sizeof(*sks->caseSensitivity));
+ sks->caseSensitivity = (int *)
+ nmem_malloc (stream, sizeof(*sks->caseSensitivity));
*sks->caseSensitivity = 0;
#ifdef ASN_COMPILED
#ifdef ASN_COMPILED
if (*zop->u.prox->u.known != Z_ProxUnit_word)
{
- char *val = nmem_malloc (stream, 16);
+ char *val = (char *) nmem_malloc (stream, 16);
zh->errCode = 132;
zh->errString = val;
sprintf (val, "%d", *zop->u.prox->u.known);
#else
if (*zop->u.prox->proximityUnitCode != Z_ProxUnit_word)
{
- char *val = nmem_malloc (stream, 16);
+ char *val = (char *) nmem_malloc (stream, 16);
zh->errCode = 132;
zh->errString = val;
sprintf (val, "%d", *zop->u.prox->proximityUnitCode);
zh->errString = NULL;
zh->hits = 0;
- sort_sequence = nmem_malloc (nmem, sizeof(*sort_sequence));
+ sort_sequence = (Z_SortKeySpecList *)
+ nmem_malloc (nmem, sizeof(*sort_sequence));
sort_sequence->num_specs = 10;
- sort_sequence->specs = nmem_malloc (nmem, sort_sequence->num_specs *
- sizeof(*sort_sequence->specs));
+ sort_sequence->specs = (Z_SortKeySpec **)
+ nmem_malloc (nmem, sort_sequence->num_specs *
+ sizeof(*sort_sequence->specs));
for (i = 0; i<sort_sequence->num_specs; i++)
sort_sequence->specs[i] = 0;
static int scan_handle (char *name, const char *info, int pos, void *client)
{
int len_prefix, idx;
- struct scan_info *scan_info = client;
+ struct scan_info *scan_info = (struct scan_info *) client;
len_prefix = strlen(scan_info->prefix);
if (memcmp (name, scan_info->prefix, len_prefix))
idx = scan_info->after - pos + scan_info->before;
else
idx = - pos - 1;
- scan_info->list[idx].term = odr_malloc (scan_info->odr,
- strlen(name + len_prefix)+1);
+ scan_info->list[idx].term = (char *)
+ odr_malloc (scan_info->odr, strlen(name + len_prefix)+1);
strcpy (scan_info->list[idx].term, name + len_prefix);
assert (*info == sizeof(ISAM_P));
memcpy (&scan_info->list[idx].isam_p, info+1, sizeof(ISAM_P));
term_untrans (zh, reg_type, term_dst, src);
- *dst = nmem_malloc (stream, strlen(term_dst)+1);
+ *dst = (char *) nmem_malloc (stream, strlen(term_dst)+1);
strcpy (*dst, term_dst);
}
/* prepare dictionary scanning */
before = pos-1;
after = 1+num-pos;
- scan_info_array = odr_malloc (stream, ord_no * sizeof(*scan_info_array));
+ scan_info_array = (struct scan_info *)
+ odr_malloc (stream, ord_no * sizeof(*scan_info_array));
for (i = 0; i < ord_no; i++)
{
int j, prefix_len = 0;
scan_info->after = after;
scan_info->odr = stream;
- scan_info->list = odr_malloc (stream, (before+after)*
- sizeof(*scan_info->list));
+ scan_info->list = (struct scan_info_entry *)
+ odr_malloc (stream, (before+after) * sizeof(*scan_info->list));
for (j = 0; j<before+after; j++)
scan_info->list[j].term = NULL;
dict_scan (zh->dict, termz, &before_tmp, &after_tmp, scan_info,
scan_handle);
}
- glist = odr_malloc (stream, (before+after)*sizeof(*glist));
+ glist = (ZebraScanEntry *)
+ odr_malloc (stream, (before+after)*sizeof(*glist));
/* consider terms after main term */
for (i = 0; i < ord_no; i++)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.c,v $
- * Revision 1.67 1999-02-02 14:51:14 adam
+ * Revision 1.68 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.67 1999/02/02 14:51:14 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.66 1998/10/28 10:54:41 adam
bend_initresult *bend_init (bend_initrequest *q)
{
- bend_initresult *r = odr_malloc (q->stream, sizeof(*r));
+ bend_initresult *r = (bend_initresult *)
+ odr_malloc (q->stream, sizeof(*r));
ZebraHandle zh;
struct statserv_options_block *sob;
char *user = NULL;
bend_searchresult *bend_search (void *handle, bend_searchrequest *q, int *fd)
{
- ZebraHandle zh = handle;
- bend_searchresult *r = odr_malloc (q->stream, sizeof(*r));
+ ZebraHandle zh = (ZebraHandle) handle;
+ bend_searchresult *r = (bend_searchresult *)
+ odr_malloc (q->stream, sizeof(*r));
r->hits = 0;
r->errcode = 0;
bend_fetchresult *bend_fetch (void *handle, bend_fetchrequest *q, int *num)
{
- ZebraHandle zh = handle;
- bend_fetchresult *r = odr_malloc (q->stream, sizeof(*r));
+ ZebraHandle zh = (ZebraHandle) handle;
+ bend_fetchresult *r = (bend_fetchresult *)
+ odr_malloc (q->stream, sizeof(*r));
ZebraRetrievalRecord retrievalRecord;
retrievalRecord.position = q->number;
bend_scanresult *bend_scan (void *handle, bend_scanrequest *q, int *num)
{
ZebraScanEntry *entries;
- ZebraHandle zh = handle;
- bend_scanresult *r = odr_malloc (q->stream, sizeof(*r));
+ ZebraHandle zh = (ZebraHandle) handle;
+ bend_scanresult *r = (bend_scanresult *)
+ odr_malloc (q->stream, sizeof(*r));
int is_partial, i;
r->term_position = q->term_position;
r->num_entries = q->num_entries;
- r->entries = odr_malloc (q->stream, sizeof(*r->entries) * q->num_entries);
+ r->entries = (struct scan_entry *)
+ odr_malloc (q->stream, sizeof(*r->entries) * q->num_entries);
zebra_scan (zh, q->stream, q->term,
q->attributeset,
q->num_bases, q->basenames,
int bend_sort (void *handle, bend_sort_rr *rr)
{
- ZebraHandle zh = handle;
+ ZebraHandle zh = (ZebraHandle) handle;
zebra_sort (zh, rr->stream,
rr->num_input_setnames, (const char **) rr->input_setnames,
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zserver.h,v $
- * Revision 1.41 1999-05-12 13:08:06 adam
+ * Revision 1.42 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.41 1999/05/12 13:08:06 adam
* First version of ISAMS.
*
* Revision 1.40 1998/11/16 16:03:45 adam
#include "zebraapi.h"
#include "zinfo.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct {
int sysno;
int score;
oid_value *output_format, char **rec_bufp,
int *rec_lenp, char **basenamep);
+#ifdef __cplusplus
+}
+#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zsets.c,v $
- * Revision 1.22 1999-02-02 14:51:15 adam
+ * Revision 1.23 1999-05-26 07:49:13 adam
+ * C++ compilation.
+ *
+ * Revision 1.22 1999/02/02 14:51:15 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.21 1998/11/16 16:03:46 adam
else
{
logf (LOG_DEBUG, "adding result set %s", name);
- s = xmalloc (sizeof(*s));
+ s = (ZebraSet) xmalloc (sizeof(*s));
s->next = zh->sets;
zh->sets = s;
- s->name = xmalloc (strlen(name)+1);
+ s->name = (char *) xmalloc (strlen(name)+1);
strcpy (s->name, name);
- s->sort_info = xmalloc (sizeof(*s->sort_info));
+ s->sort_info = (struct zset_sort_info *)
+ xmalloc (sizeof(*s->sort_info));
s->sort_info->max_entries = 1000;
- s->sort_info->entries =
+ s->sort_info->entries = (struct zset_sort_entry **)
xmalloc (sizeof(*s->sort_info->entries) *
s->sort_info->max_entries);
- s->sort_info->all_entries =
+ s->sort_info->all_entries = (struct zset_sort_entry *)
xmalloc (sizeof(*s->sort_info->all_entries) *
s->sort_info->max_entries);
for (i = 0; i < s->sort_info->max_entries; i++)
return NULL;
if (!(rset = sset->rset))
return NULL;
- sr = xmalloc (sizeof(*sr) * num);
+ sr = (ZebraPosSet) xmalloc (sizeof(*sr) * num);
for (i = 0; i<num; i++)
{
sr[i].sysno = 0;
void zebraRankInstall (ZebraHandle zh, struct rank_control *ctrl)
{
- ZebraRankClass p = xmalloc (sizeof(*p));
- p->control = xmalloc (sizeof(*p->control));
+ ZebraRankClass p = (ZebraRankClass) xmalloc (sizeof(*p));
+ p->control = (struct rank_control *) xmalloc (sizeof(*p->control));
memcpy (p->control, ctrl, sizeof(*p->control));
p->control->name = xstrdup (ctrl->name);
p->init_flag = 0;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: isam.c,v $
- * Revision 1.25 1999-02-02 14:51:16 adam
+ * Revision 1.26 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.25 1999/02/02 14:51:16 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.24 1997/10/27 14:25:39 adam
int skipped_inserts;
int delete_insert_noop;
int delete_replace;
- int delete;
+ int deletes;
int remaps;
int block_jumps;
int tab_deletes;
ispt_freelist = ispt_freelist->next;
}
else
- p = xmalloc(sizeof(ispt_struct));
+ p = (ISPT) xmalloc(sizeof(ispt_struct));
return p;
}
int (*cmp)(const void *p1, const void *p2),
int writeflag, int keysize, Res res)
{
- ISAM new;
+ ISAM inew;
char *nm, *r, *pp[IS_MAX_BLOCKTYPES+1], m[2];
int num, size, rs, tmp, i;
is_type_header th;
statistics.skipped_inserts = 0;
statistics.delete_insert_noop = 0;
statistics.delete_replace = 0;
- statistics.delete = 0;
+ statistics.deletes = 0;
statistics.remaps = 0;
statistics.new_tables = 0;
statistics.block_jumps = 0;
statistics.tab_deletes = 0;
}
- new = xmalloc(sizeof(*new));
- new->writeflag = writeflag;
+ inew = (ISAM) xmalloc(sizeof(*inew));
+ inew->writeflag = writeflag;
for (i = 0; i < IS_MAX_BLOCKTYPES; i++)
- new->types[i].index = 0; /* dummy */
+ inew->types[i].index = 0; /* dummy */
/* determine number and size of blocktypes */
if (!(r = res_get_def(res,
logf (LOG_FATAL, "Failed to locate resource %s", nm);
return 0;
}
- new->num_types = num;
+ inew->num_types = num;
for (i = 0; i < num; i++)
{
if ((rs = sscanf(pp[i], "%d%1[bBkKmM]", &size, m)) < 1)
switch (*m)
{
case 'b': case 'B':
- new->types[i].blocksize = size; break;
+ inew->types[i].blocksize = size; break;
case 'k': case 'K':
- new->types[i].blocksize = size * 1024; break;
+ inew->types[i].blocksize = size * 1024; break;
case 'm': case 'M':
- new->types[i].blocksize = size * 1048576; break;
+ inew->types[i].blocksize = size * 1048576; break;
default:
logf (LOG_FATAL, "Illegal size suffix: %c", *m);
return 0;
}
- new->types[i].dbuf = xmalloc(new->types[i].blocksize);
+ inew->types[i].dbuf = (char *) xmalloc(inew->types[i].blocksize);
m[0] = 'A' + i;
m[1] = '\0';
- if (!(new->types[i].bf = bf_open(bfs, strconcat(name, m, 0),
- new->types[i].blocksize, writeflag)))
+ if (!(inew->types[i].bf = bf_open(bfs, strconcat(name, m, 0),
+ inew->types[i].blocksize, writeflag)))
{
logf (LOG_FATAL, "bf_open failed");
return 0;
}
- if ((rs = is_rb_read(&new->types[i], &th)) > 0)
+ if ((rs = is_rb_read(&inew->types[i], &th)) > 0)
{
- if (th.blocksize != new->types[i].blocksize)
+ if (th.blocksize != inew->types[i].blocksize)
{
logf (LOG_FATAL, "File blocksize mismatch in %s", name);
exit(1);
}
- new->types[i].freelist = th.freelist;
- new->types[i].top = th.top;
+ inew->types[i].freelist = th.freelist;
+ inew->types[i].top = th.top;
}
else if (writeflag) /* write dummy superblock to determine top */
{
- if ((rs = is_rb_write(&new->types[i], &th)) <=0) /* dummy */
+ if ((rs = is_rb_write(&inew->types[i], &th)) <=0) /* dummy */
{
logf (LOG_FATAL, "Failed to write initial superblock.");
exit(1);
}
- new->types[i].freelist = -1;
- new->types[i].top = rs;
+ inew->types[i].freelist = -1;
+ inew->types[i].top = rs;
}
/* ELSE: this is an empty file opened in read-only mode. */
}
if (keysize > 0)
- new->keysize = keysize;
+ inew->keysize = keysize;
else
{
if (!(r = res_get_def(res, nm = strconcat(name, ".",
logf (LOG_FATAL, "Failed to locate resource %s", nm);
return 0;
}
- if ((new->keysize = atoi(r)) <= 0)
+ if ((inew->keysize = atoi(r)) <= 0)
{
logf (LOG_FATAL, "Must specify positive keysize.");
return 0;
logf (LOG_FATAL, "Failed to locate resource %s", nm);
return 0;
}
- new->repack = atoi(r);
+ inew->repack = atoi(r);
/* determine max keys/blocksize */
if (!(r = res_get_def(res,
logf (LOG_FATAL, "Failed to locate resource %s", nm);
return 0;
}
- if (num < new->num_types -1)
+ if (num < inew->num_types -1)
{
logf (LOG_FATAL, "Not enough elements in %s", nm);
return 0;
logf (LOG_FATAL, "Error in resource %s: %s", r, pp[i]);
return 0;
}
- new->types[i].max_keys = tmp;
+ inew->types[i].max_keys = tmp;
}
/* determine max keys/block */
- for (i = 0; i < new->num_types; i++)
+ for (i = 0; i < inew->num_types; i++)
{
- if (!new->types[i].index)
+ if (!inew->types[i].index)
{
- new->types[i].max_keys_block = (new->types[i].blocksize - 2 *
- sizeof(int)) / new->keysize;
- new->types[i].max_keys_block0 = (new->types[i].blocksize - 3 *
- sizeof(int)) / new->keysize;
+ inew->types[i].max_keys_block = (inew->types[i].blocksize - 2 *
+ sizeof(int)) / inew->keysize;
+ inew->types[i].max_keys_block0 = (inew->types[i].blocksize - 3 *
+ sizeof(int)) / inew->keysize;
}
else
- new->types[i].max_keys_block = new->types[i].max_keys_block0 /
- new->keysize;
- if (new->types[i].max_keys_block0 < 1)
+ inew->types[i].max_keys_block = inew->types[i].max_keys_block0 /
+ inew->keysize;
+ if (inew->types[i].max_keys_block0 < 1)
{
logf (LOG_FATAL, "Blocksize too small in %s", name);
exit(1);
logf (LOG_FATAL, "Failed to locate resource %s", nm);
return 0;
}
- if (num < new->num_types)
+ if (num < inew->num_types)
{
logf (LOG_FATAL, "Not enough elements in %s", nm);
return 0;
logf (LOG_FATAL, "Error in resource %s: %s", r, pp[i]);
return 0;
}
- new->types[i].nice_keys_block = (new->types[i].max_keys_block0 * tmp) /
+ inew->types[i].nice_keys_block = (inew->types[i].max_keys_block0 * tmp) /
100;
- if (new->types[i].nice_keys_block < 1)
- new->types[i].nice_keys_block = 1;
+ if (inew->types[i].nice_keys_block < 1)
+ inew->types[i].nice_keys_block = 1;
}
- new->cmp = cmp ? cmp : is_default_cmp;
- return new;
+ inew->cmp = cmp ? cmp : is_default_cmp;
+ return inew;
}
/*
statistics.delete_insert_noop);
logf(LOG_LOG, "delete_replace %d",
statistics.delete_replace);
- logf(LOG_LOG, "delete %d", statistics.delete);
+ logf(LOG_LOG, "delete %d", statistics.deletes);
logf(LOG_LOG, "remaps %d", statistics.remaps);
logf(LOG_LOG, "block_jumps %d", statistics.block_jumps);
logf(LOG_LOG, "tab_deletes %d", statistics.tab_deletes);
}
logf (LOG_DEBUG, "Deleting record.");
is_m_delete_record(&tab);
- statistics.delete++;
+ statistics.deletes++;
}
}
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: isutil.h,v $
- * Revision 1.2 1999-02-02 14:51:18 adam
+ * Revision 1.3 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.2 1999/02/02 14:51:18 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.1 1994/09/12 08:02:14 quinn
#ifndef ISUTIL_H
#define ISUTIL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
char *strconcat(const char *s1, ...);
int is_default_cmp(const void *k1, const void *k2); /* compare function */
+#ifdef __cplusplus
+}
+#endif
+
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: memory.c,v $
- * Revision 1.16 1999-02-02 14:51:20 adam
+ * Revision 1.17 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.16 1999/02/02 14:51:20 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.15 1997/09/09 13:38:11 adam
if (!mblock_freelist)
{
- mblock_freelist = xmalloc(sizeof(is_mblock) * MALLOC_CHUNK);
+ mblock_freelist = (is_mblock *)
+ xmalloc(sizeof(is_mblock) * MALLOC_CHUNK);
for (i = 0; i < MALLOC_CHUNK - 1; i++)
mblock_freelist[i].next = &mblock_freelist[i+1];
mblock_freelist[i].next = 0;
}
else
{
- tmp = xmalloc(sizeof(is_mbuf) + is_mbuf_size[type]);
+ tmp = (is_mbuf*) xmalloc(sizeof(is_mbuf) + is_mbuf_size[type]);
tmp->type = type;
}
tmp->refcount = type ? 1 : 0;
*/
void is_m_delete_record(is_mtable *tab)
{
- is_mbuf *mbuf, *new;
+ is_mbuf *mbuf, *inew;
mbuf = tab->cur_mblock->cur_mbuf;
if (mbuf->cur_record >= mbuf->num) /* top of mbuf */
else /* middle of mbuf */
{
/* insert block after current one */
- new = xmalloc_mbuf(IS_MBUF_TYPE_SMALL);
- new->next = mbuf->next;
- mbuf->next = new;
+ inew = xmalloc_mbuf(IS_MBUF_TYPE_SMALL);
+ inew->next = mbuf->next;
+ mbuf->next = inew;
/* virtually transfer everything after current record to new one. */
- new->data = mbuf->data;
+ inew->data = mbuf->data;
mbuf->refcount++;
- new->offset = mbuf->offset + mbuf->cur_record * is_keysize(tab->is);
- new->num = mbuf->num - mbuf->cur_record;
+ inew->offset = mbuf->offset + mbuf->cur_record * is_keysize(tab->is);
+ inew->num = mbuf->num - mbuf->cur_record;
/* old buf now only contains stuff before current record */
mbuf->num = mbuf->cur_record -1;
- tab->cur_mblock->cur_mbuf = new;
+ tab->cur_mblock->cur_mbuf = inew;
}
tab->num_records--;
tab->cur_mblock->num_records--;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: physical.c,v $
- * Revision 1.15 1999-02-02 14:51:22 adam
+ * Revision 1.16 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.15 1999/02/02 14:51:22 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.14 1997/09/09 13:38:12 adam
static is_mbuf *mbuf_takehead(is_mbuf **mb, int *num, int keysize)
{
- is_mbuf *p = 0, **pp = &p, *new;
+ is_mbuf *p = 0, **pp = &p, *inew;
int toget = *num;
if (!toget)
}
if (toget > 0 && *mb)
{
- new = xmalloc_mbuf(IS_MBUF_TYPE_SMALL);
- new->next = (*mb)->next;
- (*mb)->next = new;
- new->data = (*mb)->data;
+ inew = xmalloc_mbuf(IS_MBUF_TYPE_SMALL);
+ inew->next = (*mb)->next;
+ (*mb)->next = inew;
+ inew->data = (*mb)->data;
(*mb)->refcount++;
- new->offset = (*mb)->offset + toget * keysize;
- new->num = (*mb)->num - toget;
+ inew->offset = (*mb)->offset + toget * keysize;
+ inew->num = (*mb)->num - toget;
(*mb)->num = toget;
*pp = *mb;
*mb = (*mb)->next;
*/
void is_p_align(is_mtable *tab)
{
- is_mblock *mblock, *new, *last = 0, *next;
+ is_mblock *mblock, *inew, *last = 0, *next;
is_mbuf *mbufs, *mbp;
int blocks, recsblock;
{
if (mbufs)
{
- new = xmalloc_mblock();
- new->diskpos = -1;
- new->state = IS_MBSTATE_DIRTY;
- new->next = mblock->next;
- mblock->next = new;
+ inew = xmalloc_mblock();
+ inew->diskpos = -1;
+ inew->state = IS_MBSTATE_DIRTY;
+ inew->next = mblock->next;
+ mblock->next = inew;
}
mblock->data = mbp;
mblock->num_records = recsblock;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rootblk.h,v $
- * Revision 1.2 1999-02-02 14:51:25 adam
+ * Revision 1.3 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.2 1999/02/02 14:51:25 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.1 1994/09/26 16:08:00 quinn
#include <isam.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct is_type_header
{
int blocksize; /* for sanity-checking */
int top; /* first unused block */
} is_type_header;
-
-
int is_rb_write(isam_blocktype *ib, is_type_header *hd);
int is_rb_read(isam_blocktype *ib, is_type_header *hd);
+#ifdef __cplusplus
+}
+#endif
+
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: isamc-p.h,v $
- * Revision 1.6 1998-03-18 09:23:55 adam
+ * Revision 1.7 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.6 1998/03/18 09:23:55 adam
* Blocks are stored in chunks on free list - up to factor 2 in speed.
* Fixed bug that could occur in block category rearrangemen.
*
#include <bfile.h>
#include <isamc.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct {
int lastblock;
int freelist;
void isc_release_block (ISAMC is, int cat, int pos);
int isc_read_block (ISAMC is, int cat, int pos, char *dst);
int isc_write_block (ISAMC is, int cat, int pos, char *src);
+
+#ifdef __cplusplus
+}
+#endif
+
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: isamc.c,v $
- * Revision 1.16 1998-05-27 14:32:03 adam
+ * Revision 1.17 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.16 1998/05/27 14:32:03 adam
* Changed default block category layout.
*
* Revision 1.15 1998/05/20 10:12:25 adam
{ 32768, 32000, 31000, 0 },
#endif
};
- ISAMC_M m = xmalloc (sizeof(*m));
+ ISAMC_M m = (ISAMC_M) xmalloc (sizeof(*m));
m->filecat = def_cat;
m->code_start = NULL;
int i = 0;
int max_buf_size = 0;
- is = xmalloc (sizeof(*is));
+ is = (ISAMC) xmalloc (sizeof(*is));
- is->method = xmalloc (sizeof(*is->method));
+ is->method = (ISAMC_M) xmalloc (sizeof(*is->method));
memcpy (is->method, method, sizeof(*method));
filecat = is->method->filecat;
assert (filecat);
logf (LOG_LOG, "isc: max_buf_size %d", max_buf_size);
assert (is->no_files > 0);
- is->files = xmalloc (sizeof(*is->files)*is->no_files);
+ is->files = (ISAMC_file) xmalloc (sizeof(*is->files)*is->no_files);
if (writeflag)
{
- is->merge_buf = xmalloc (max_buf_size+256);
+ is->merge_buf = (char *) xmalloc (max_buf_size+256);
memset (is->merge_buf, 0, max_buf_size+256);
}
else
is->files[i].alloc_entries_num = 0;
is->files[i].alloc_entries_max =
is->method->filecat[i].bsize / sizeof(int) - 1;
- is->files[i].alloc_buf = xmalloc (is->method->filecat[i].bsize);
+ is->files[i].alloc_buf = (char *)
+ xmalloc (is->method->filecat[i].bsize);
is->files[i].no_writes = 0;
is->files[i].no_reads = 0;
is->files[i].no_skip_writes = 0;
int j = 100;
is->files[cat].fc_max = j;
- is->files[cat].fc_list = xmalloc (sizeof(*is->files[0].fc_list) * j);
+ is->files[cat].fc_list = (int *)
+ xmalloc (sizeof(*is->files[0].fc_list) * j);
while (--j >= 0)
is->files[cat].fc_list[j] = 0;
}
ISAMC_PP isc_pp_open (ISAMC is, ISAMC_P ipos)
{
- ISAMC_PP pp = xmalloc (sizeof(*pp));
+ ISAMC_PP pp = (ISAMC_PP) xmalloc (sizeof(*pp));
char *src;
pp->cat = isc_type(ipos);
pp->pos = isc_block(ipos);
- src = pp->buf = xmalloc (is->method->filecat[pp->cat].bsize);
+ src = pp->buf = (char *) xmalloc (is->method->filecat[pp->cat].bsize);
pp->next = 0;
pp->size = 0;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: isams.c,v $
- * Revision 1.3 1999-05-20 12:57:18 adam
+ * Revision 1.4 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.3 1999/05/20 12:57:18 adam
* Implemented TCL filter. Updated recctrl system.
*
* Revision 1.2 1999/05/15 14:35:48 adam
ISAMS_M isams_getmethod (void)
{
- ISAMS_M m = xmalloc (sizeof(*m));
+ ISAMS_M m = (ISAMS_M) xmalloc (sizeof(*m));
m->code_start = NULL;
m->code_item = NULL;
ISAMS isams_open (BFiles bfs, const char *name, int writeflag,
ISAMS_M method)
{
- ISAMS is = xmalloc (sizeof(*is));
+ ISAMS is = (ISAMS) xmalloc (sizeof(*is));
- is->method = xmalloc (sizeof(*is->method));
+ is->method = (ISAMS_M) xmalloc (sizeof(*is->method));
memcpy (is->method, method, sizeof(*method));
is->block_size = is->method->block_size;
is->debug = is->method->debug;
is->head.last_offset = 0;
}
memcpy (&is->head_old, &is->head, sizeof(is->head));
- is->merge_buf = xmalloc(2*is->block_size);
+ is->merge_buf = (char *) xmalloc(2*is->block_size);
memset(is->merge_buf, 0, 2*is->block_size);
return is;
}
assert (gap <= (int) sizeof(int));
if (gap > 0)
{
- if (gap < sizeof(int))
+ if (gap < (int) sizeof(int))
bf_write(is->bf, first_block, first_offset, sizeof(int)-gap,
&count);
memcpy (is->merge_buf, ((char*)&count)+(sizeof(int)-gap), gap);
ISAMS_PP isams_pp_open (ISAMS is, ISAMS_P pos)
{
- ISAMS_PP pp = xmalloc (sizeof(*pp));
+ ISAMS_PP pp = (ISAMS_PP) xmalloc (sizeof(*pp));
if (is->debug > 1)
logf (LOG_LOG, "isams: isams_pp_open pos=%ld", (long) pos);
pp->decodeClientData = (*is->method->code_start)(ISAMC_DECODE);
pp->numKeys = 0;
pp->numRead = 0;
- pp->buf = xmalloc(is->block_size*2);
+ pp->buf = (char *) xmalloc(is->block_size*2);
pp->block_no = pos/is->block_size;
pp->block_offset = pos - pp->block_no * is->block_size;
logf (LOG_LOG, "isams: isams_pp_open off=%d no=%d",
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: merge.c,v $
- * Revision 1.10 1998-03-19 12:22:09 adam
+ * Revision 1.11 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.10 1998/03/19 12:22:09 adam
* Minor change.
*
* Revision 1.9 1998/03/19 10:04:38 adam
int dirty; /* block is different from that on file */
};
-static void opt_blocks (ISAMC is, struct isc_merge_block *mb, int ptr, int last)
+static void opt_blocks (ISAMC is, struct isc_merge_block *mb, int ptr,
+ int last)
{
int i, no_dirty = 0;
for (i = 0; i<ptr; i++)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: grsread.h,v $
- * Revision 1.6 1999-05-20 12:57:18 adam
+ * Revision 1.7 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.6 1999/05/20 12:57:18 adam
* Implemented TCL filter. Updated recctrl system.
*
* Revision 1.5 1999/02/02 14:51:26 adam
#define GRSREAD_H
#include <data1.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct grs_read_info {
void *clientData;
int (*readf)(void *, char *, size_t);
extern RecTypeGrs recTypeGrs_regx;
extern RecTypeGrs recTypeGrs_tcl;
extern RecTypeGrs recTypeGrs_marc;
+
+#ifdef __cplusplus
+}
+#endif
+
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: marcread.c,v $
- * Revision 1.7 1999-05-20 12:57:18 adam
+ * Revision 1.8 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.7 1999/05/20 12:57:18 adam
* Implemented TCL filter. Updated recctrl system.
*
* Revision 1.6 1999/02/02 14:51:27 adam
res->u.data.what = DATA1I_text;
res->u.data.len = len;
if (res->u.data.len > DATA1_LOCALDATA) {
- res->u.data.data = xmalloc (res->u.data.len);
+ res->u.data.data = (char *) xmalloc (res->u.data.len);
res->destroy = destroy_data;
}
else
}
res_root = data1_mk_node_wp (p->dh, p->mem, NULL);
res_root->which = DATA1N_root;
- res_root->u.root.type = nmem_malloc (p->mem, strlen(absynName)+1);
+ res_root->u.root.type = (char *) nmem_malloc (p->mem, strlen(absynName)+1);
strcpy (res_root->u.root.type, absynName);
res_root->u.root.absyn = absyn;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: recctrl.c,v $
- * Revision 1.4 1999-05-20 12:57:18 adam
+ * Revision 1.5 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.4 1999/05/20 12:57:18 adam
* Implemented TCL filter. Updated recctrl system.
*
* Revision 1.3 1998/10/16 08:14:36 adam
{
struct recTypeEntry *rte;
- rte = nmem_malloc (data1_nmem_get (rts->dh), sizeof(*rte));
+ rte = (struct recTypeEntry *)
+ nmem_malloc (data1_nmem_get (rts->dh), sizeof(*rte));
rte->recType = rt;
rte->init_flag = 0;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: recgrs.c,v $
- * Revision 1.28 1999-05-21 12:00:17 adam
+ * Revision 1.29 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.28 1999/05/21 12:00:17 adam
* Better diagnostics for extraction process.
*
* Revision 1.27 1999/05/20 12:57:18 adam
static void grs_add_handler (struct grs_handlers *h, RecTypeGrs t)
{
- struct grs_handler *gh = malloc (sizeof(*gh));
+ struct grs_handler *gh = (struct grs_handler *) malloc (sizeof(*gh));
gh->next = h->handlers;
h->handlers = gh;
gh->initFlag = 0;
static void *grs_init(RecType recType)
{
- struct grs_handlers *h = malloc (sizeof(*h));
+ struct grs_handlers *h = (struct grs_handlers *) malloc (sizeof(*h));
h->handlers = 0;
grs_add_handler (h, recTypeGrs_sgml);
static void grs_destroy(void *clientData)
{
- struct grs_handlers *h = clientData;
+ struct grs_handlers *h = (struct grs_handlers *) clientData;
struct grs_handler *gh = h->handlers, *gh_next;
while (gh)
{
struct grs_read_info gri;
oident oe;
int oidtmp[OID_SIZE];
- struct grs_handlers *h = clientData;
+ struct grs_handlers *h = (struct grs_handlers *) clientData;
mem = nmem_create ();
gri.readf = p->readf;
NMEM mem;
struct grs_read_info gri;
char *tagname;
- struct grs_handlers *h = clientData;
+ struct grs_handlers *h = (struct grs_handlers *) clientData;
mem = nmem_create();
gri.readf = p->readf;
"schemaIdentifier", mem)))
{
dnew->u.data.what = DATA1I_oid;
- dnew->u.data.data = nmem_malloc(mem, p - tmp);
+ dnew->u.data.data = (char *) nmem_malloc(mem, p - tmp);
memcpy(dnew->u.data.data, tmp, p - tmp);
dnew->u.data.len = p - tmp;
}
p->odr, &dummy)))
p->diagnostic = 238; /* not available in requested syntax */
else
- p->rec_len = -1;
+ p->rec_len = (size_t) (-1);
break;
case VAL_EXPLAIN:
if (!(p->rec_buf = data1_nodetoexplain(p->dh, node, selected,
p->odr)))
p->diagnostic = 238;
else
- p->rec_len = -1;
+ p->rec_len = (size_t) (-1);
break;
case VAL_SUMMARY:
if (!(p->rec_buf = data1_nodetosummary(p->dh, node, selected,
p->odr)))
p->diagnostic = 238;
else
- p->rec_len = -1;
+ p->rec_len = (size_t) (-1);
break;
case VAL_SUTRS:
if (!(p->rec_buf = data1_nodetobuf(p->dh, node, selected,
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: recgrs.h,v $
- * Revision 1.3 1999-02-02 14:51:29 adam
+ * Revision 1.4 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.3 1999/02/02 14:51:29 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.2 1997/04/30 08:56:08 quinn
#include <recctrl.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern RecType recTypeGrs;
+
+#ifdef __cplusplus
+}
+#endif
+
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rectext.c,v $
- * Revision 1.11 1999-05-21 12:00:17 adam
+ * Revision 1.12 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.11 1999/05/21 12:00:17 adam
* Better diagnostics for extraction process.
*
* Revision 1.10 1999/05/20 12:57:18 adam
struct buf_info *buf_open (struct recExtractCtrl *p)
{
- struct buf_info *fi = xmalloc (sizeof(*fi));
+ struct buf_info *fi = (struct buf_info *) xmalloc (sizeof(*fi));
fi->p = p;
- fi->buf = xmalloc (4096);
+ fi->buf = (char *) xmalloc (4096);
fi->offset = 1;
fi->max = 1;
return fi;
char *nb;
text_size = 2*text_size + 8192;
- nb = xmalloc (text_size);
+ nb = (char *) xmalloc (text_size);
if (text_buf)
{
memcpy (nb, text_buf, text_ptr);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rectext.h,v $
- * Revision 1.3 1999-02-02 14:51:30 adam
+ * Revision 1.4 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.3 1999/02/02 14:51:30 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.2 1997/04/30 08:56:08 quinn
#include <recctrl.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern RecType recTypeText;
+
+#ifdef __cplusplus
+}
+#endif
+
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: regxread.c,v $
- * Revision 1.25 1999-05-25 12:33:32 adam
+ * Revision 1.26 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.25 1999/05/25 12:33:32 adam
* Fixed bug in Tcl filter.
*
* Revision 1.24 1999/05/21 11:08:46 adam
spec->f_win_start = start_pos;
if (!spec->f_win_buf)
- spec->f_win_buf = xmalloc (spec->f_win_size);
+ spec->f_win_buf = (char *) xmalloc (spec->f_win_size);
*size = (*spec->f_win_rf)(spec->f_win_fh, spec->f_win_buf,
spec->f_win_size);
spec->f_win_end = spec->f_win_start + *size;
{
struct regxCode *p;
- p = xmalloc (sizeof(*p));
- p->str = xmalloc (len+1);
+ p = (struct regxCode *) xmalloc (sizeof(*p));
+ p->str = (char *) xmalloc (len+1);
memcpy (p->str, buf, len);
p->str[len] = '\0';
*pp = p;
static struct lexContext *lexContextCreate (const char *name)
{
- struct lexContext *p = xmalloc (sizeof(*p));
+ struct lexContext *p = (struct lexContext *) xmalloc (sizeof(*p));
p->name = xstrdup (name);
p->ruleNo = 1;
struct lexSpec *p;
int i;
- p = xmalloc (sizeof(*p));
- p->name = xmalloc (strlen(name)+1);
+ p = (struct lexSpec *) xmalloc (sizeof(*p));
+ p->name = (char *) xmalloc (strlen(name)+1);
strcpy (p->name, name);
#if HAVE_TCL_H
p->dh = dh;
p->context = NULL;
p->context_stack_size = 100;
- p->context_stack = xmalloc (sizeof(*p->context_stack) *
- p->context_stack_size);
+ p->context_stack = (struct lexContext **)
+ xmalloc (sizeof(*p->context_stack) * p->context_stack_size);
p->f_win_buf = NULL;
p->maxLevel = 128;
- p->concatBuf = xmalloc (sizeof(*p->concatBuf) * p->maxLevel);
+ p->concatBuf = (struct lexConcatBuf **)
+ xmalloc (sizeof(*p->concatBuf) * p->maxLevel);
for (i = 0; i < p->maxLevel; i++)
{
- p->concatBuf[i] = xmalloc (sizeof(**p->concatBuf));
+ p->concatBuf[i] = (struct lexConcatBuf *)
+ xmalloc (sizeof(**p->concatBuf));
p->concatBuf[i]->len = p->concatBuf[i]->max = 0;
p->concatBuf[i]->buf = 0;
}
- p->d1_stack = xmalloc (sizeof(*p->d1_stack) * p->maxLevel);
+ p->d1_stack = (data1_node **) xmalloc (sizeof(*p->d1_stack) * p->maxLevel);
p->d1_level = 0;
return p;
}
cmd[i] = *cp + 'a' - 'A';
else
break;
- if (i < sizeof(cmd)-2)
+ if (i < (int) sizeof(cmd)-2)
i++;
cp++;
}
bodyMark = 1;
continue;
case REGX_CODE:
- *ap = xmalloc (sizeof(**ap));
+ *ap = (struct lexRuleAction *) xmalloc (sizeof(**ap));
(*ap)->which = tok;
regxCodeMk (&(*ap)->u.code, s, len);
s += len+1;
break;
case REGX_PATTERN:
- *ap = xmalloc (sizeof(**ap));
+ *ap = (struct lexRuleAction *) xmalloc (sizeof(**ap));
(*ap)->which = tok;
(*ap)->u.pattern.body = bodyMark;
bodyMark = 0;
logf (LOG_WARN, "cannot use INIT here");
continue;
case REGX_END:
- *ap = xmalloc (sizeof(**ap));
+ *ap = (struct lexRuleAction *) xmalloc (sizeof(**ap));
(*ap)->which = tok;
break;
}
return -1;
}
s++;
- rp = xmalloc (sizeof(*rp));
+ rp = (struct lexRule *) xmalloc (sizeof(*rp));
rp->info.no = spec->context->ruleNo++;
rp->next = spec->context->rules;
spec->context->rules = rp;
int c, i, errors = 0;
FILE *spec_inf = 0;
- lineBuf = xmalloc (1+lineSize);
+ lineBuf = (char *) xmalloc (1+lineSize);
#if HAVE_TCL_H
if (spec->tcl_interp)
{
for (lc = spec->context; lc; lc = lc->next)
{
struct lexRule *rp;
- lc->fastRule = xmalloc (sizeof(*lc->fastRule) * lc->ruleNo);
+ lc->fastRule = (struct lexRuleInfo **)
+ xmalloc (sizeof(*lc->fastRule) * lc->ruleNo);
for (i = 0; i < lc->ruleNo; i++)
lc->fastRule[i] = NULL;
for (rp = lc->rules; rp; rp = rp->next)
char *old_buf, *new_buf;
spec->concatBuf[spec->d1_level]->max = org_len + elen + 256;
- new_buf = xmalloc (spec->concatBuf[spec->d1_level]->max);
+ new_buf = (char *) xmalloc (spec->concatBuf[spec->d1_level]->max);
if ((old_buf = spec->concatBuf[spec->d1_level]->buf))
{
memcpy (new_buf, old_buf, org_len);
assert (!res->u.data.data);
assert (res->u.data.len > 0);
if (res->u.data.len > DATA1_LOCALDATA)
- res->u.data.data = nmem_malloc (spec->m, res->u.data.len);
+ res->u.data.data = (char *) nmem_malloc (spec->m, res->u.data.len);
else
res->u.data.data = res->lbuf;
memcpy (res->u.data.data, spec->concatBuf[spec->d1_level]->buf,
res->u.tag.get_bytes = -1;
if (len >= DATA1_LOCALDATA)
- res->u.tag.tag = nmem_malloc (spec->m, len+1);
+ res->u.tag.tag = (char *) nmem_malloc (spec->m, len+1);
else
res->u.tag.tag = res->lbuf;
static int cmd_tcl_begin (ClientData clientData, Tcl_Interp *interp,
int argc, char **argv)
{
- struct lexSpec *spec = clientData;
+ struct lexSpec *spec = (struct lexSpec *) clientData;
if (argc < 2)
return TCL_ERROR;
if (!strcmp(argv[1], "record") && argc == 3)
static int cmd_tcl_end (ClientData clientData, Tcl_Interp *interp,
int argc, char **argv)
{
- struct lexSpec *spec = clientData;
+ struct lexSpec *spec = (struct lexSpec *) clientData;
if (argc < 2)
return TCL_ERROR;
int argi = 1;
int textFlag = 0;
const char *element = 0;
- struct lexSpec *spec = clientData;
+ struct lexSpec *spec = (struct lexSpec *) clientData;
while (argi < argc)
{
static int cmd_tcl_unread (ClientData clientData, Tcl_Interp *interp,
int argc, char **argv)
{
- struct lexSpec *spec = clientData;
+ struct lexSpec *spec = (struct lexSpec *) clientData;
int argi = 1;
int offset = 0;
int no;
void grs_destroy(void *clientData)
{
- struct lexSpecs *specs = clientData;
+ struct lexSpecs *specs = (struct lexSpecs *) clientData;
if (specs->spec)
{
lexSpecDestroy(&specs->spec);
void *grs_init(void)
{
- struct lexSpecs *specs = xmalloc (sizeof(*specs));
+ struct lexSpecs *specs = (struct lexSpecs *) xmalloc (sizeof(*specs));
specs->spec = 0;
return specs;
}
data1_node *grs_read_regx (struct grs_read_info *p)
{
int res;
- struct lexSpecs *specs = p->clientData;
+ struct lexSpecs *specs = (struct lexSpecs *) p->clientData;
struct lexSpec **curLexSpec = &specs->spec;
#if REGX_DEBUG
data1_node *grs_read_tcl (struct grs_read_info *p)
{
int res;
- struct lexSpecs *specs = p->clientData;
+ struct lexSpecs *specs = (struct lexSpecs *) p->clientData;
struct lexSpec **curLexSpec = &specs->spec;
#if REGX_DEBUG
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rsbool.c,v $
- * Revision 1.15 1999-02-02 14:51:32 adam
+ * Revision 1.16 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.15 1999/02/02 14:51:32 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.14 1998/03/05 08:36:27 adam
static void *r_create (RSET ct, const struct rset_control *sel, void *parms)
{
- rset_bool_parms *bool_parms = parms;
+ rset_bool_parms *bool_parms = (rset_bool_parms *) parms;
struct rset_bool_info *info;
- info = xmalloc (sizeof(*info));
+ info = (struct rset_bool_info *) xmalloc (sizeof(*info));
info->key_size = bool_parms->key_size;
info->rset_l = bool_parms->rset_l;
info->rset_r = bool_parms->rset_r;
info->term_index_s = info->rset_l->no_rset_terms;
ct->no_rset_terms =
info->rset_l->no_rset_terms + info->rset_r->no_rset_terms;
- ct->rset_terms = xmalloc (sizeof (*ct->rset_terms) * ct->no_rset_terms);
+ ct->rset_terms = (RSET_TERM *)
+ xmalloc (sizeof (*ct->rset_terms) * ct->no_rset_terms);
memcpy (ct->rset_terms, info->rset_l->rset_terms,
info->rset_l->no_rset_terms * sizeof(*ct->rset_terms));
static RSFD r_open (RSET ct, int flag)
{
- struct rset_bool_info *info = ct->buf;
+ struct rset_bool_info *info = (struct rset_bool_info *) ct->buf;
struct rset_bool_rfd *rfd;
if (flag & RSETF_WRITE)
logf (LOG_FATAL, "bool set type is read-only");
return NULL;
}
- rfd = xmalloc (sizeof(*rfd));
+ rfd = (struct rset_bool_rfd *) xmalloc (sizeof(*rfd));
rfd->next = info->rfd_list;
info->rfd_list = rfd;
rfd->info = info;
static void r_delete (RSET ct)
{
- struct rset_bool_info *info = ct->buf;
+ struct rset_bool_info *info = (struct rset_bool_info *) ct->buf;
assert (info->rfd_list == NULL);
xfree (ct->rset_terms);
static void r_rewind (RSFD rfd)
{
struct rset_bool_info *info = ((struct rset_bool_rfd*)rfd)->info;
- struct rset_bool_rfd *p = rfd;
+ struct rset_bool_rfd *p = (struct rset_bool_rfd *) rfd;
logf (LOG_DEBUG, "rsbool_rewind");
rset_rewind (info->rset_l, p->rfd_l);
static int r_read_and (RSFD rfd, void *buf, int *term_index)
{
- struct rset_bool_rfd *p = rfd;
+ struct rset_bool_rfd *p = (struct rset_bool_rfd *) rfd;
struct rset_bool_info *info = p->info;
while (p->more_l && p->more_r)
static int r_read_or (RSFD rfd, void *buf, int *term_index)
{
- struct rset_bool_rfd *p = rfd;
+ struct rset_bool_rfd *p = (struct rset_bool_rfd *) rfd;
struct rset_bool_info *info = p->info;
while (p->more_l || p->more_r)
static int r_read_not (RSFD rfd, void *buf, int *term_index)
{
- struct rset_bool_rfd *p = rfd;
+ struct rset_bool_rfd *p = (struct rset_bool_rfd *) rfd;
struct rset_bool_info *info = p->info;
while (p->more_l || p->more_r)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rset.c,v $
- * Revision 1.13 1999-02-02 14:51:33 adam
+ * Revision 1.14 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.13 1999/02/02 14:51:33 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.12 1998/04/26 10:56:57 adam
int i;
logf (LOG_DEBUG, "rs_create(%s)", sel->desc);
- rnew = xmalloc(sizeof(*rnew));
+ rnew = (RSET) xmalloc(sizeof(*rnew));
rnew->control = sel;
rnew->flags = 0;
rnew->count = 1;
RSET_TERM rset_term_create (const char *name, int length, const char *flags)
{
- RSET_TERM t = xmalloc (sizeof(*t));
+ RSET_TERM t = (RSET_TERM) xmalloc (sizeof(*t));
if (!name)
t->name = NULL;
else if (length == -1)
t->name = xstrdup (name);
else
{
- t->name = xmalloc (length+1);
+ t->name = (char*) xmalloc (length+1);
memcpy (t->name, name, length);
t->name[length] = '\0';
}
RSET_TERM rset_term_dup (RSET_TERM t)
{
- RSET_TERM nt = xmalloc (sizeof(*nt));
+ RSET_TERM nt = (RSET_TERM) xmalloc (sizeof(*nt));
if (t->name)
nt->name = xstrdup (t->name);
else
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rsisam.c,v $
- * Revision 1.19 1999-02-02 14:51:34 adam
+ * Revision 1.20 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.19 1999/02/02 14:51:34 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.18 1998/03/05 08:36:28 adam
static void *r_create(RSET ct, const struct rset_control *sel, void *parms)
{
- rset_isam_parms *pt = parms;
+ rset_isam_parms *pt = (rset_isam_parms *) parms;
struct rset_isam_info *info;
ct->flags |= RSET_FLAG_VOLATILE;
- info = xmalloc (sizeof(struct rset_isam_info));
+ info = (struct rset_isam_info *) xmalloc (sizeof(struct rset_isam_info));
info->is = pt->is;
info->pos = pt->pos;
info->ispt_list = NULL;
ct->no_rset_terms = 1;
- ct->rset_terms = xmalloc (sizeof(*ct->rset_terms));
+ ct->rset_terms = (RSET_TERM *) xmalloc (sizeof(*ct->rset_terms));
ct->rset_terms[0] = pt->rset_term;
return info;
}
RSFD r_open (RSET ct, int flag)
{
- struct rset_isam_info *info = ct->buf;
+ struct rset_isam_info *info = (struct rset_isam_info *) ct->buf;
struct rset_ispt_info *ptinfo;
logf (LOG_DEBUG, "risam_open");
logf (LOG_FATAL, "ISAM set type is read-only");
return NULL;
}
- ptinfo = xmalloc (sizeof(*ptinfo));
+ ptinfo = (struct rset_ispt_info *) xmalloc (sizeof(*ptinfo));
ptinfo->next = info->ispt_list;
info->ispt_list = ptinfo;
ptinfo->pt = is_position (info->is, info->pos);
static void r_delete (RSET ct)
{
- struct rset_isam_info *info = ct->buf;
+ struct rset_isam_info *info = (struct rset_isam_info *) ct->buf;
logf (LOG_DEBUG, "rsisam_delete");
assert (info->ispt_list == NULL);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rsisamc.c,v $
- * Revision 1.6 1999-02-02 14:51:35 adam
+ * Revision 1.7 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.6 1999/02/02 14:51:35 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.5 1998/03/05 08:36:28 adam
static void *r_create(RSET ct, const struct rset_control *sel, void *parms)
{
- rset_isamc_parms *pt = parms;
+ rset_isamc_parms *pt = (rset_isamc_parms *) parms;
struct rset_isamc_info *info;
ct->flags |= RSET_FLAG_VOLATILE;
- info = xmalloc (sizeof(*info));
+ info = (struct rset_isamc_info *) xmalloc (sizeof(*info));
info->is = pt->is;
info->pos = pt->pos;
info->ispt_list = NULL;
ct->no_rset_terms = 1;
- ct->rset_terms = xmalloc (sizeof(*ct->rset_terms));
+ ct->rset_terms = (RSET_TERM *) xmalloc (sizeof(*ct->rset_terms));
ct->rset_terms[0] = pt->rset_term;
return info;
}
RSFD r_open (RSET ct, int flag)
{
- struct rset_isamc_info *info = ct->buf;
+ struct rset_isamc_info *info = (struct rset_isamc_info *) ct->buf;
struct rset_pp_info *ptinfo;
logf (LOG_DEBUG, "risamc_open");
logf (LOG_FATAL, "ISAMC set type is read-only");
return NULL;
}
- ptinfo = xmalloc (sizeof(*ptinfo));
+ ptinfo = (struct rset_pp_info *) xmalloc (sizeof(*ptinfo));
ptinfo->next = info->ispt_list;
info->ispt_list = ptinfo;
ptinfo->pt = isc_pp_open (info->is, info->pos);
static void r_delete (RSET ct)
{
- struct rset_isamc_info *info = ct->buf;
+ struct rset_isamc_info *info = (struct rset_isamc_info *) ct->buf;
logf (LOG_DEBUG, "rsisamc_delete");
assert (info->ispt_list == NULL);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rsisams.c,v $
- * Revision 1.1 1999-05-12 15:24:25 adam
+ * Revision 1.2 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.1 1999/05/12 15:24:25 adam
* First version of ISAMS.
*
*/
static void *r_create(RSET ct, const struct rset_control *sel, void *parms)
{
- rset_isams_parms *pt = parms;
+ rset_isams_parms *pt = (struct rset_isams_parms *) parms;
struct rset_isams_info *info;
ct->flags |= RSET_FLAG_VOLATILE;
- info = xmalloc (sizeof(*info));
+ info = (struct rset_isams_info *) xmalloc (sizeof(*info));
info->is = pt->is;
info->pos = pt->pos;
info->ispt_list = NULL;
ct->no_rset_terms = 1;
- ct->rset_terms = xmalloc (sizeof(*ct->rset_terms));
+ ct->rset_terms = (RSET_TERM *) xmalloc (sizeof(*ct->rset_terms));
ct->rset_terms[0] = pt->rset_term;
return info;
}
RSFD r_open (RSET ct, int flag)
{
- struct rset_isams_info *info = ct->buf;
+ struct rset_isams_info *info = (struct rset_isams_info *) ct->buf;
struct rset_pp_info *ptinfo;
logf (LOG_DEBUG, "risams_open");
logf (LOG_FATAL, "ISAMS set type is read-only");
return NULL;
}
- ptinfo = xmalloc (sizeof(*ptinfo));
+ ptinfo = (struct rset_pp_info *) xmalloc (sizeof(*ptinfo));
ptinfo->next = info->ispt_list;
info->ispt_list = ptinfo;
ptinfo->pt = isams_pp_open (info->is, info->pos);
static void r_delete (RSET ct)
{
- struct rset_isams_info *info = ct->buf;
+ struct rset_isams_info *info = (struct rset_isams_info *) ct->buf;
logf (LOG_DEBUG, "rsisams_delete");
assert (info->ispt_list == NULL);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rsm_or.c,v $
- * Revision 1.7 1998-09-22 10:03:46 adam
+ * Revision 1.8 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.7 1998/09/22 10:03:46 adam
* Changed result sets to be persistent in the sense that they can
* be re-searched if needed.
* Fixed memory leak in rsm_or.
struct trunc_info *heap_init (int size, int key_size,
int (*cmp)(const void *p1, const void *p2))
{
- struct trunc_info *ti = xmalloc (sizeof(*ti));
+ struct trunc_info *ti = (struct trunc_info *) xmalloc (sizeof(*ti));
int i;
++size;
ti->heapnum = 0;
ti->keysize = key_size;
ti->cmp = cmp;
- ti->indx = xmalloc (size * sizeof(*ti->indx));
- ti->heap = xmalloc (size * sizeof(*ti->heap));
- ti->ptr = xmalloc (size * sizeof(*ti->ptr));
- ti->swapbuf = xmalloc (ti->keysize);
- ti->tmpbuf = xmalloc (ti->keysize);
- ti->buf = xmalloc (size * ti->keysize);
+ ti->indx = (int *) xmalloc (size * sizeof(*ti->indx));
+ ti->heap = (char **) xmalloc (size * sizeof(*ti->heap));
+ ti->ptr = (int *) xmalloc (size * sizeof(*ti->ptr));
+ ti->swapbuf = (char *) xmalloc (ti->keysize);
+ ti->tmpbuf = (char *) xmalloc (ti->keysize);
+ ti->buf = (char *) xmalloc (size * ti->keysize);
for (i = size; --i >= 0; )
{
ti->ptr[i] = i;
static void *r_create (RSET ct, const struct rset_control *sel, void *parms)
{
- rset_m_or_parms *r_parms = parms;
+ rset_m_or_parms *r_parms = (rset_m_or_parms *) parms;
struct rset_mor_info *info;
ct->flags |= RSET_FLAG_VOLATILE;
- info = xmalloc (sizeof(*info));
+ info = (struct rset_mor_info *) xmalloc (sizeof(*info));
info->key_size = r_parms->key_size;
assert (info->key_size > 1);
info->cmp = r_parms->cmp;
info->isc = r_parms->isc;
info->no_isam_positions = r_parms->no_isam_positions;
- info->isam_positions = xmalloc (sizeof(*info->isam_positions) *
- info->no_isam_positions);
+ info->isam_positions = (ISAM_P *)
+ xmalloc (sizeof(*info->isam_positions) * info->no_isam_positions);
memcpy (info->isam_positions, r_parms->isam_positions,
sizeof(*info->isam_positions) * info->no_isam_positions);
info->rfd_list = NULL;
ct->no_rset_terms = 1;
- ct->rset_terms = xmalloc (sizeof(*ct->rset_terms));
+ ct->rset_terms = (RSET_TERM *) xmalloc (sizeof(*ct->rset_terms));
ct->rset_terms[0] = r_parms->rset_term;
return info;
}
static RSFD r_open (RSET ct, int flag)
{
struct rset_mor_rfd *rfd;
- struct rset_mor_info *info = ct->buf;
+ struct rset_mor_info *info = (struct rset_mor_info *) ct->buf;
int i;
if (flag & RSETF_WRITE)
logf (LOG_FATAL, "m_or set type is read-only");
return NULL;
}
- rfd = xmalloc (sizeof(*rfd));
+ rfd = (struct rset_mor_rfd *) xmalloc (sizeof(*rfd));
rfd->flag = flag;
rfd->next = info->rfd_list;
rfd->info = info;
info->rfd_list = rfd;
- rfd->ispt = xmalloc (sizeof(*rfd->ispt) * info->no_isam_positions);
+ rfd->ispt = (ISAMC_PP *)
+ xmalloc (sizeof(*rfd->ispt) * info->no_isam_positions);
rfd->ti = heap_init (info->no_isam_positions, info->key_size, info->cmp);
static void r_delete (RSET ct)
{
- struct rset_mor_info *info = ct->buf;
+ struct rset_mor_info *info = (struct rset_mor_info *) ct->buf;
int i;
assert (info->rfd_list == NULL);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rsnull.c,v $
- * Revision 1.11 1999-02-02 14:51:36 adam
+ * Revision 1.12 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.11 1999/02/02 14:51:36 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.10 1998/03/05 08:36:28 adam
static void *r_create(RSET ct, const struct rset_control *sel, void *parms)
{
- rset_null_parms *null_parms = parms;
+ rset_null_parms *null_parms = (rset_null_parms *) parms;
ct->no_rset_terms = 1;
- ct->rset_terms = xmalloc (sizeof(*ct->rset_terms));
+ ct->rset_terms = (RSET_TERM *) xmalloc (sizeof(*ct->rset_terms));
if (parms)
ct->rset_terms[0] = null_parms->rset_term;
else
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rstemp.c,v $
- * Revision 1.25 1999-02-02 14:51:37 adam
+ * Revision 1.26 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.25 1999/02/02 14:51:37 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.24 1998/03/05 08:36:28 adam
static void *r_create(RSET ct, const struct rset_control *sel, void *parms)
{
- rset_temp_parms *temp_parms = parms;
+ rset_temp_parms *temp_parms = (rset_temp_parms *) parms;
struct rset_temp_info *info;
- info = xmalloc (sizeof(struct rset_temp_info));
+ info = (struct rset_temp_info *) xmalloc (sizeof(struct rset_temp_info));
info->fd = -1;
info->fname = NULL;
info->key_size = temp_parms->key_size;
info->buf_size = 4096;
- info->buf_mem = xmalloc (info->buf_size);
+ info->buf_mem = (char *) xmalloc (info->buf_size);
info->pos_cur = 0;
info->pos_end = 0;
info->pos_buf = 0;
info->temp_path = NULL;
else
{
- info->temp_path = xmalloc (strlen(temp_parms->temp_path)+1);
+ info->temp_path = (char *) xmalloc (strlen(temp_parms->temp_path)+1);
strcpy (info->temp_path, temp_parms->temp_path);
}
ct->no_rset_terms = 1;
- ct->rset_terms = xmalloc (sizeof(*ct->rset_terms));
+ ct->rset_terms = (RSET_TERM *) xmalloc (sizeof(*ct->rset_terms));
ct->rset_terms[0] = temp_parms->rset_term;
return info;
}
static RSFD r_open (RSET ct, int flag)
{
- struct rset_temp_info *info = ct->buf;
+ struct rset_temp_info *info = (struct rset_temp_info *) ct->buf;
struct rset_temp_rfd *rfd;
assert (info->fd == -1);
exit (1);
}
}
- rfd = xmalloc (sizeof(*rfd));
+ rfd = (struct rset_temp_rfd *) xmalloc (sizeof(*rfd));
rfd->info = info;
r_rewind (rfd);
return rfd;
{
char *s = (char*) tempnam (info->temp_path, "zrs");
- info->fname = xmalloc (strlen(s)+1);
+ info->fname = (char *) xmalloc (strlen(s)+1);
strcpy (info->fname, s);
logf (LOG_DEBUG, "creating tempfile %s", info->fname);
}
if (info->fname && info->fd != -1 && info->dirty)
{
- size_t r, count;
+ size_t count;
+ int r;
if (lseek (info->fd, info->pos_buf, SEEK_SET) == -1)
{
count = info->buf_size;
if (count > info->pos_end - info->pos_buf)
count = info->pos_end - info->pos_buf;
- if ((r = write (info->fd, info->buf_mem, count)) < count)
+ if ((r = write (info->fd, info->buf_mem, count)) < (int) count)
{
if (r == -1)
logf (LOG_FATAL|LOG_ERRNO, "read %s", info->fname);
static void r_delete (RSET ct)
{
- struct rset_temp_info *info = ct->buf;
+ struct rset_temp_info *info = (struct rset_temp_info*) ct->buf;
if (info->fname)
unlink (info->fname);
if (info->fname)
{
- size_t r, count;
+ size_t count;
+ int r;
info->pos_border = info->pos_cur + info->buf_size;
if (info->pos_border > info->pos_end)
logf (LOG_FATAL|LOG_ERRNO, "lseek %s", info->fname);
exit (1);
}
- if ((r = read (info->fd, info->buf_mem, count)) < count)
+ if ((r = read (info->fd, info->buf_mem, count)) < (int) count)
{
if (r == -1)
logf (LOG_FATAL|LOG_ERRNO, "read %s", info->fname);
static int r_count (RSET ct)
{
- struct rset_temp_info *info = ct->buf;
+ struct rset_temp_info *info = (struct rset_temp_info *) ct->buf;
return info->pos_end / info->key_size;
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: charmap.c,v $
- * Revision 1.14 1998-10-13 20:09:18 adam
+ * Revision 1.15 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.14 1998/10/13 20:09:18 adam
* Changed call to readconf_line.
*
* Revision 1.13 1997/10/27 14:33:06 adam
{
if (!root)
{
- root = nmem_malloc(nmem, sizeof(*root));
+ root = (chr_t_entry *) nmem_malloc(nmem, sizeof(*root));
root->children = 0;
root->target = 0;
}
{
int i;
- root->children = nmem_malloc(nmem, sizeof(chr_t_entry*) * 256);
+ root->children = (chr_t_entry **)
+ nmem_malloc(nmem, sizeof(chr_t_entry*) * 256);
for (i = 0; i < 256; i++)
root->children[i] = 0;
}
*/
static void fun_addentry(const char *s, void *data, int num)
{
- chrmaptab tab = data;
+ chrmaptab tab = (chrmaptab) data;
char tmp[2];
tmp[0] = num; tmp[1] = '\0';
*/
static void fun_addspace(const char *s, void *data, int num)
{
- chrmaptab tab = data;
+ chrmaptab tab = (chrmaptab) data;
tab->input = set_map_string(tab->input, tab->nmem, s, strlen(s),
(char*) CHR_SPACE);
}
*/
static void fun_mkstring(const char *s, void *data, int num)
{
- chrwork *arg = data;
+ chrwork *arg = (chrwork *) data;
const char **res, *p = s;
res = chr_map_input(arg->map, &s, strlen(s));
*/
static void fun_addmap(const char *s, void *data, int num)
{
- chrwork *arg = data;
+ chrwork *arg = (chrwork *) data;
assert(arg->map->input);
set_map_string(arg->map->input, arg->map->nmem, s, strlen(s), arg->string);
}
-static int scan_string(char *s, void (*fun)(const char *c, void *data, int num),
- void *data, int *num)
+static int scan_string(char *s,
+ void (*fun)(const char *c, void *data, int num),
+ void *data, int *num)
{
unsigned char c, str[1024], begin, end, *p;
logf(LOG_WARN|LOG_ERRNO, "%s", name);
return 0;
}
- res = xmalloc(sizeof(*res));
+ res = (chrmaptab) xmalloc(sizeof(*res));
res->nmem = nmem_create ();
- res->tmp_buf = nmem_malloc (res->nmem, sizeof(*res->tmp_buf) * 100);
- res->input = nmem_malloc(res->nmem, sizeof(*res->input));
+ res->tmp_buf = (char **)
+ nmem_malloc (res->nmem, sizeof(*res->tmp_buf) * 100);
+ res->input = (chr_t_entry *) nmem_malloc(res->nmem, sizeof(*res->input));
res->input->target = (unsigned char*) CHR_UNKNOWN;
res->input->equiv = 0;
- res->input->children = nmem_malloc(res->nmem, sizeof(res->input) * 256);
+ res->input->children = (chr_t_entry **)
+ nmem_malloc(res->nmem, sizeof(res->input) * 256);
for (i = 0; i < 256; i++)
{
- res->input->children[i] = nmem_malloc(res->nmem, sizeof(*res->input));
+ res->input->children[i] = (chr_t_entry *)
+ nmem_malloc(res->nmem, sizeof(*res->input));
res->input->children[i]->children = 0;
if (map_only)
{
- res->input->children[i]->target = nmem_malloc (res->nmem,
- 2 * sizeof(char));
+ res->input->children[i]->target = (unsigned char *)
+ nmem_malloc (res->nmem, 2 * sizeof(char));
res->input->children[i]->target[0] = i;
res->input->children[i]->target[1] = 0;
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: passwddb.c,v $
- * Revision 1.4 1999-02-02 14:51:39 adam
+ * Revision 1.5 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.4 1999/02/02 14:51:39 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.3 1998/06/25 19:16:32 adam
Passwd_db passwd_db_open (void)
{
- struct passwd_db *p = xmalloc (sizeof(*p));
+ struct passwd_db *p = (struct passwd_db *) xmalloc (sizeof(*p));
p->entries = 0;
return p;
}
get_entry (&cp, name, 128);
get_entry (&cp, des, 128);
- pe = xmalloc (sizeof(*pe));
+ pe = (struct passwd_entry *) xmalloc (sizeof(*pe));
pe->name = xstrdup (name);
pe->des = xstrdup (des);
pe->next = db->entries;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: res.c,v $
- * Revision 1.24 1999-02-02 14:51:42 adam
+ * Revision 1.25 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.24 1999/02/02 14:51:42 adam
* Updated WIN32 code specific sections. Changed header.
*
* Revision 1.23 1998/10/28 15:18:55 adam
struct res_entry *resp;
if (!r->first)
- resp = r->last = r->first = xmalloc (sizeof(*resp));
+ resp = r->last = r->first =
+ (struct res_entry *) xmalloc (sizeof(*resp));
else
{
- resp = xmalloc (sizeof(*resp));
+ resp = (struct res_entry *) xmalloc (sizeof(*resp));
r->last->next = resp;
r->last = resp;
}
assert (r);
r->init = 1;
- val_buf = xmalloc (val_max);
+ val_buf = (char*) xmalloc (val_max);
fr = fopen (r->name, "r");
if (!fr)
fr_buf[no] = '\0';
resp = add_entry (r);
- resp->name = xmalloc (no+1);
+ resp->name = (char*) xmalloc (no+1);
resp->value = NULL;
strcpy (resp->name, fr_buf);
}
continue;
fr_buf[no++] = '\0';
resp = add_entry (r);
- resp->name = xmalloc (no);
+ resp->name = (char*) xmalloc (no);
strcpy (resp->name, fr_buf);
while (strchr (" \t", fr_buf[no]))
val_buf[val_size-1] == '\t'))
val_size--;
val_buf[val_size++] = '\0';
- resp->value = xmalloc (val_size);
+ resp->value = (char*) xmalloc (val_size);
strcpy (resp->value, val_buf);
logf (LOG_DEBUG, "(name=%s,value=%s)",
resp->name, resp->value);
line = fgets (fr_buf, sizeof(fr_buf)-1, fr);
if (!line)
{
- resp->value = xmalloc (val_size);
+ resp->value = (char*) xmalloc (val_size);
strcpy (resp->value, val_buf);
break;
}
{
char *nb;
- nb = xmalloc (val_max+=1024);
+ nb = (char*) xmalloc (val_max+=1024);
memcpy (nb, val_buf, val_size);
xfree (val_buf);
val_buf = nb;
logf (LOG_LOG|LOG_ERRNO, "Cannot access resource file `%s'", name);
return NULL;
}
- r = xmalloc (sizeof(*r));
+ r = (Res) xmalloc (sizeof(*r));
r->init = 0;
r->first = r->last = NULL;
r->name = xstrdup (name);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zebramap.c,v $
- * Revision 1.14 1999-02-19 10:37:40 adam
+ * Revision 1.15 1999-05-26 07:49:14 adam
+ * C++ compilation.
+ *
+ * Revision 1.14 1999/02/19 10:37:40 adam
* Minor fix.
*
* Revision 1.13 1999/02/18 15:01:04 adam
zm = &zms->map_list;
else
zm = &(*zm)->next;
- *zm = nmem_malloc (zms->nmem, sizeof(**zm));
+ *zm = (struct zebra_map *) nmem_malloc (zms->nmem, sizeof(**zm));
(*zm)->reg_id = argv[1][0];
(*zm)->maptab_name = NULL;
(*zm)->maptab = NULL;
zm = &zms->map_list;
else
zm = &(*zm)->next;
- *zm = nmem_malloc (zms->nmem, sizeof(**zm));
+ *zm = (struct zebra_map *) nmem_malloc (zms->nmem, sizeof(**zm));
(*zm)->reg_id = argv[1][0];
(*zm)->maptab_name = NULL;
(*zm)->type = ZEBRA_MAP_TYPE_SORT;
static void zms_map_handle (void *p, const char *name, const char *value)
{
- ZebraMaps zms = p;
+ ZebraMaps zms = (ZebraMaps) p;
zebra_map_read (zms, value);
}
ZebraMaps zebra_maps_open (Res res)
{
- ZebraMaps zms = xmalloc (sizeof(*zms));
+ ZebraMaps zms = (ZebraMaps) xmalloc (sizeof(*zms));
int i;
zms->nmem = nmem_create ();
zms->temp_map_ptr[0] = zms->temp_map_str;
zms->temp_map_ptr[1] = NULL;
- zms->lookup_array =
+ zms->lookup_array = (struct zebra_map**)
nmem_malloc (zms->nmem, sizeof(*zms->lookup_array)*256);
for (i = 0; i<256; i++)
zms->lookup_array[i] = 0;
struct zebra_map *zm = zebra_map_get (zms, reg_id);
if (!zm)
{
- zm = nmem_malloc (zms->nmem, sizeof(*zm));
+ zm = (struct zebra_map *) nmem_malloc (zms->nmem, sizeof(*zm));
logf (LOG_WARN, "Unknown register type: %c", reg_id);
zm->reg_id = reg_id;