summaryrefslogtreecommitdiff
path: root/ext/dbm
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dbm')
-rw-r--r--ext/dbm/ODBM_File.xs2
-rwxr-xr-xext/dbm/SDBM_File.sobin0 -> 73728 bytes
l---------ext/dbm/perl1
-rwxr-xr-xext/dbm/sdbm/Makefile47
-rw-r--r--ext/dbm/sdbm/Makefile.SH80
-rw-r--r--ext/dbm/sdbm/README.too6
-rw-r--r--ext/dbm/sdbm/dbm.h4
-rw-r--r--ext/dbm/sdbm/hash.c1
-rw-r--r--ext/dbm/sdbm/libsdbm.abin0 -> 35114 bytes
-rw-r--r--ext/dbm/sdbm/libsdbm_pure_q552_110.abin0 -> 11826 bytes
-rw-r--r--ext/dbm/sdbm/makefile.sdbm55
-rw-r--r--ext/dbm/sdbm/pair.c7
-rw-r--r--ext/dbm/sdbm/sdbm.c28
-rw-r--r--ext/dbm/sdbm/sdbm.h150
-rw-r--r--ext/dbm/sdbm/tune.h11
15 files changed, 359 insertions, 33 deletions
diff --git a/ext/dbm/ODBM_File.xs b/ext/dbm/ODBM_File.xs
index 74554c71e6..04d7b9e7cf 100644
--- a/ext/dbm/ODBM_File.xs
+++ b/ext/dbm/ODBM_File.xs
@@ -19,7 +19,9 @@ typedef void* ODBM_File;
static int dbmrefcnt;
+#ifndef DBM_REPLACE
#define DBM_REPLACE 0
+#endif
MODULE = ODBM_File PACKAGE = ODBM_File PREFIX = odbm_
diff --git a/ext/dbm/SDBM_File.so b/ext/dbm/SDBM_File.so
new file mode 100755
index 0000000000..87f4749b2c
--- /dev/null
+++ b/ext/dbm/SDBM_File.so
Binary files differ
diff --git a/ext/dbm/perl b/ext/dbm/perl
new file mode 120000
index 0000000000..899dc46edb
--- /dev/null
+++ b/ext/dbm/perl
@@ -0,0 +1 @@
+../../perl \ No newline at end of file
diff --git a/ext/dbm/sdbm/Makefile b/ext/dbm/sdbm/Makefile
new file mode 100755
index 0000000000..80b09cd37b
--- /dev/null
+++ b/ext/dbm/sdbm/Makefile
@@ -0,0 +1,47 @@
+#
+# This Makefile is for the library part of sdbm. For the
+# Full package, see makefile.sdbm.
+#
+# Makefile for public domain ndbm-clone: sdbm
+# DUFF: use duff's device (loop unroll) in parts of the code
+#
+#
+CC = cc
+ranlib = /usr/bin/ranlib
+TOP = ../../..
+LDFLAGS =
+CLDFLAGS =
+SMALL =
+LARGE =
+
+# To use an alternate make, set in config.sh.
+MAKE = make
+
+SHELL = /bin/sh
+CCCMD = `sh $(shellflags) $(TOP)/cflags $@`
+
+.c.o:
+ $(CCCMD) -I$(TOP) -DSDBM -DDUFF $*.c
+
+LIBOBJS = sdbm.o pair.o hash.o
+LIBSRCS = sdbm.c pair.c hash.c
+HDRS = tune.h sdbm.h pair.h $(TOP)/config.h
+
+libsdbm.a: $(LIBOBJS)
+ ar cr libsdbm.a $(LIBOBJS)
+ $(ranlib) libsdbm.a
+
+$(LIBOBJS): $(HDRS)
+
+lint:
+ lint -abchx $(LIBSRCS)
+
+clean:
+ rm -f *.o *.a mon.out core
+
+realclean: clean
+ rm -f dbu libsdbm.a dbd dba dbe x-dbu *.dir *.pag
+ rm -f makefile Makefile
+
+purge: realclean
+
diff --git a/ext/dbm/sdbm/Makefile.SH b/ext/dbm/sdbm/Makefile.SH
new file mode 100644
index 0000000000..9a19fa2ed5
--- /dev/null
+++ b/ext/dbm/sdbm/Makefile.SH
@@ -0,0 +1,80 @@
+if test -f config.sh; then TOP=.;
+elif test -f ../config.sh; then TOP=..;
+elif test -f ../../config.sh; then TOP=../..;
+elif test -f ../../../config.sh; then TOP=../../..;
+elif test -f ../../../../config.sh; then TOP=../../../..;
+else
+ echo "Can't find config.sh."; exit 1
+fi
+case $CONFIG in
+'')
+ . $TOP/config.sh
+ ;;
+esac
+: This forces SH files to create target in same directory as SH file.
+: This is so that make depend always knows where to find SH derivatives.
+
+case "$0" in
+*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
+esac
+
+echo "Extracting ext/dbm/sdbm/Makefile (with variable substitutions)"
+: This section of the file will have variable substitutions done on it.
+: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
+: Protect any dollar signs and backticks that you do not want interpreted
+: by putting a backslash in front. You may delete these comments.
+$spitshell >Makefile <<!GROK!THIS!
+#
+# This Makefile is for the library part of sdbm. For the
+# Full package, see makefile.sdbm.
+#
+# Makefile for public domain ndbm-clone: sdbm
+# DUFF: use duff's device (loop unroll) in parts of the code
+#
+#
+CC = $cc
+ranlib = $ranlib
+TOP = $TOP
+LDFLAGS = $ldflags
+CLDFLAGS = $ldflags
+SMALL = $small
+LARGE = $large $split
+
+# To use an alternate make, set $altmake in config.sh.
+MAKE = ${altmake-make}
+
+!GROK!THIS!
+
+: In the following dollars and backticks do not need the extra backslash.
+$spitshell >>Makefile <<'!NO!SUBS!'
+SHELL = /bin/sh
+CCCMD = `sh $(shellflags) $(TOP)/cflags $@`
+
+.c.o:
+ $(CCCMD) -I$(TOP) -DSDBM -DDUFF $*.c
+
+LIBOBJS = sdbm.o pair.o hash.o
+LIBSRCS = sdbm.c pair.c hash.c
+HDRS = tune.h sdbm.h pair.h $(TOP)/config.h
+
+libsdbm.a: $(LIBOBJS)
+ ar cr libsdbm.a $(LIBOBJS)
+ $(ranlib) libsdbm.a
+
+$(LIBOBJS): $(HDRS)
+
+lint:
+ lint -abchx $(LIBSRCS)
+
+clean:
+ rm -f *.o *.a mon.out core
+
+realclean: clean
+ rm -f dbu libsdbm.a dbd dba dbe x-dbu *.dir *.pag
+ rm -f makefile Makefile
+
+purge: realclean
+
+!NO!SUBS!
+chmod 755 Makefile
+$eunicefix Makefile
diff --git a/ext/dbm/sdbm/README.too b/ext/dbm/sdbm/README.too
index d60ccf0f4b..c2d095944d 100644
--- a/ext/dbm/sdbm/README.too
+++ b/ext/dbm/sdbm/README.too
@@ -1,3 +1,9 @@
This version of sdbm merely has all the dbm_* names translated to sdbm_*
so that we can link ndbm and sdbm into the same executable. (It also has
the bad() macro redefined to allow a zero-length key.)
+
+
+Fri Apr 15 10:15:30 EDT 1994.
+
+Additional portability/configuration changes for libsdbm by Andy Dougherty
+doughera@lafcol.lafayette.edu.
diff --git a/ext/dbm/sdbm/dbm.h b/ext/dbm/sdbm/dbm.h
index dce48fed07..1196953d96 100644
--- a/ext/dbm/sdbm/dbm.h
+++ b/ext/dbm/sdbm/dbm.h
@@ -26,7 +26,9 @@
#define NULL ((char *) 0)
#endif
-#include <ndbm.h>
+#ifdef I_NDBM
+# include <ndbm.h>
+#endif
datum fetch();
datum firstkey();
diff --git a/ext/dbm/sdbm/hash.c b/ext/dbm/sdbm/hash.c
index 9b55a7f571..eb585ac102 100644
--- a/ext/dbm/sdbm/hash.c
+++ b/ext/dbm/sdbm/hash.c
@@ -7,6 +7,7 @@
* hashing routine
*/
+#include "config.h"
#include "sdbm.h"
/*
* polynomial conversion ignoring overflows
diff --git a/ext/dbm/sdbm/libsdbm.a b/ext/dbm/sdbm/libsdbm.a
new file mode 100644
index 0000000000..baf4b73942
--- /dev/null
+++ b/ext/dbm/sdbm/libsdbm.a
Binary files differ
diff --git a/ext/dbm/sdbm/libsdbm_pure_q552_110.a b/ext/dbm/sdbm/libsdbm_pure_q552_110.a
new file mode 100644
index 0000000000..3b426e8154
--- /dev/null
+++ b/ext/dbm/sdbm/libsdbm_pure_q552_110.a
Binary files differ
diff --git a/ext/dbm/sdbm/makefile.sdbm b/ext/dbm/sdbm/makefile.sdbm
new file mode 100644
index 0000000000..c959c1fab5
--- /dev/null
+++ b/ext/dbm/sdbm/makefile.sdbm
@@ -0,0 +1,55 @@
+#
+# makefile for public domain ndbm-clone: sdbm
+# DUFF: use duff's device (loop unroll) in parts of the code
+#
+CFLAGS = -O -DSDBM -DDUFF -DBSD42 -pic
+#LDFLAGS = -p
+
+OBJS = sdbm.o pair.o hash.o
+SRCS = sdbm.c pair.c hash.c dbu.c dba.c dbd.c util.c
+HDRS = tune.h sdbm.h pair.h
+MISC = README CHANGES COMPARE sdbm.3 dbe.c dbe.1 dbm.c dbm.h biblio \
+ readme.ms readme.ps
+
+all: dbu dba dbd dbe
+
+dbu: dbu.o sdbm util.o
+ cc $(LDFLAGS) -o dbu dbu.o util.o libsdbm.a
+
+dba: dba.o util.o
+ cc $(LDFLAGS) -o dba dba.o util.o
+dbd: dbd.o util.o
+ cc $(LDFLAGS) -o dbd dbd.o util.o
+dbe: dbe.o sdbm
+ cc $(LDFLAGS) -o dbe dbe.o libsdbm.a
+
+sdbm: $(OBJS)
+ ar cr libsdbm.a $(OBJS)
+ ranlib libsdbm.a
+### cp libsdbm.a /usr/lib/libsdbm.a
+
+dba.o: sdbm.h
+dbu.o: sdbm.h
+util.o:sdbm.h
+
+$(OBJS): sdbm.h tune.h pair.h
+
+#
+# dbu using berkelezoid ndbm routines [if you have them] for testing
+#
+#x-dbu: dbu.o util.o
+# cc $(CFLAGS) -o x-dbu dbu.o util.o
+lint:
+ lint -abchx $(SRCS)
+
+clean:
+ rm -f *.o mon.out core
+
+purge: clean
+ rm -f dbu libsdbm.a dbd dba dbe x-dbu *.dir *.pag
+
+shar:
+ shar $(MISC) makefile $(SRCS) $(HDRS) >SDBM.SHAR
+
+readme:
+ nroff -ms readme.ms | col -b >README
diff --git a/ext/dbm/sdbm/pair.c b/ext/dbm/sdbm/pair.c
index a3941716d9..575b34c6c1 100644
--- a/ext/dbm/sdbm/pair.c
+++ b/ext/dbm/sdbm/pair.c
@@ -11,14 +11,11 @@
static char rcsid[] = "$Id: pair.c,v 1.10 90/12/13 13:00:35 oz Exp $";
#endif
+#include "config.h"
#include "sdbm.h"
#include "tune.h"
#include "pair.h"
-#ifndef BSD42
-#include <memory.h>
-#endif
-
#define exhash(item) sdbm_hash((item).dptr, (item).dsize)
/*
@@ -195,7 +192,7 @@ datum key;
}
}
#else
-#ifdef MEMMOVE
+#ifdef HAS_MEMMOVE
memmove(dst, src, m);
#else
while (m--)
diff --git a/ext/dbm/sdbm/sdbm.c b/ext/dbm/sdbm/sdbm.c
index d4ecdceb07..d09adccdd3 100644
--- a/ext/dbm/sdbm/sdbm.c
+++ b/ext/dbm/sdbm/sdbm.c
@@ -11,27 +11,22 @@
static char rcsid[] = "$Id: sdbm.c,v 1.16 90/12/13 13:01:31 oz Exp $";
#endif
+#include "config.h"
#include "sdbm.h"
#include "tune.h"
#include "pair.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef BSD42
-#include <sys/file.h>
-#else
-#include <fcntl.h>
-#include <memory.h>
+#ifdef I_FCNTL
+# include <fcntl.h>
#endif
-#include <errno.h>
-#include <string.h>
-
-#ifdef __STDC__
-#include <stddef.h>
+#ifdef I_SYS_FILE
+# include <sys/file.h>
#endif
-#ifndef NULL
-#define NULL 0
+#ifdef I_STRING
+# include <string.h>
+#else
+# include <strings.h>
#endif
/*
@@ -41,9 +36,9 @@ static char rcsid[] = "$Id: sdbm.c,v 1.16 90/12/13 13:01:31 oz Exp $";
extern int errno;
#endif
-extern char *malloc proto((unsigned int));
+extern Malloc_t malloc proto((MEM_SIZE));
extern void free proto((void *));
-extern long lseek();
+extern Off_t lseek();
/*
* forward
@@ -522,3 +517,4 @@ register DBM *db;
return ioerr(db), nullitem;
}
+
diff --git a/ext/dbm/sdbm/sdbm.h b/ext/dbm/sdbm/sdbm.h
index e2fc762aab..f94b054999 100644
--- a/ext/dbm/sdbm/sdbm.h
+++ b/ext/dbm/sdbm/sdbm.h
@@ -89,3 +89,153 @@ extern long sdbm_hash proto((char *, int));
#define dbm_error sdbm_error;
#define dbm_clearerr sdbm_clearerr;
#endif
+
+/* Most of the following is stolen from perl.h. */
+#ifndef H_PERL /* Include guard */
+
+/*
+ * The following contortions are brought to you on behalf of all the
+ * standards, semi-standards, de facto standards, not-so-de-facto standards
+ * of the world, as well as all the other botches anyone ever thought of.
+ * The basic theory is that if we work hard enough here, the rest of the
+ * code can be a lot prettier. Well, so much for theory. Sorry, Henry...
+ */
+
+#include <errno.h>
+#ifdef HAS_SOCKET
+# ifdef I_NET_ERRNO
+# include <net/errno.h>
+# endif
+#endif
+
+#ifdef MYMALLOC
+# ifdef HIDEMYMALLOC
+# define malloc Mymalloc
+# define realloc Myremalloc
+# define free Myfree
+# endif
+# define safemalloc malloc
+# define saferealloc realloc
+# define safefree free
+#endif
+
+#if defined(__STDC__) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus)
+# define STANDARD_C 1
+#endif
+
+#if defined(STANDARD_C)
+# define P(args) args
+#else
+# define P(args) ()
+#endif
+
+#include <stdio.h>
+#include <ctype.h>
+#include <setjmp.h>
+
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+
+#ifndef MSDOS
+# ifdef PARAM_NEEDS_TYPES
+# include <sys/types.h>
+# endif
+# include <sys/param.h>
+#endif
+
+#ifndef _TYPES_ /* If types.h defines this it's easy. */
+# ifndef major /* Does everyone's types.h define this? */
+# include <sys/types.h>
+# endif
+#endif
+
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+
+#include <sys/stat.h>
+
+#ifndef SEEK_SET
+# ifdef L_SET
+# define SEEK_SET L_SET
+# else
+# define SEEK_SET 0 /* Wild guess. */
+# endif
+#endif
+
+/* Use all the "standard" definitions? */
+#ifdef STANDARD_C
+# include <stdlib.h>
+# ifdef I_STRING
+# include <string.h>
+# endif
+# define MEM_SIZE size_t
+#else
+# ifdef I_MEMORY
+# include <memory.h>
+# endif
+ typedef unsigned int MEM_SIZE;
+#endif /* STANDARD_C */
+
+#if defined(HAS_MEMCMP) && defined(mips) && defined(ultrix)
+# undef HAS_MEMCMP
+#endif
+
+#ifdef HAS_MEMCPY
+# if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
+# ifndef memcpy
+ extern char * memcpy P((char*, char*, int));
+# endif
+# endif
+#else
+# ifndef memcpy
+# ifdef HAS_BCOPY
+# define memcpy(d,s,l) bcopy(s,d,l)
+# else
+# define memcpy(d,s,l) my_bcopy(s,d,l)
+# endif
+# endif
+#endif /* HAS_MEMCPY */
+
+#ifdef HAS_MEMSET
+# if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
+# ifndef memset
+ extern char *memset P((char*, int, int));
+# endif
+# endif
+# define memzero(d,l) memset(d,0,l)
+#else
+# ifndef memzero
+# ifdef HAS_BZERO
+# define memzero(d,l) bzero(d,l)
+# else
+# define memzero(d,l) my_bzero(d,l)
+# endif
+# endif
+#endif /* HAS_MEMSET */
+
+#ifdef HAS_MEMCMP
+# if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
+# ifndef memcmp
+ extern int memcmp P((char*, char*, int));
+# endif
+# endif
+#else
+# ifndef memcmp
+# define memcmp(s1,s2,l) my_memcmp(s1,s2,l)
+# endif
+#endif /* HAS_MEMCMP */
+
+/* we prefer bcmp slightly for comparisons that don't care about ordering */
+#ifndef HAS_BCMP
+# ifndef bcmp
+# define bcmp(s1,s2,l) memcmp(s1,s2,l)
+# endif
+#endif /* HAS_BCMP */
+
+#ifdef I_NETINET_IN
+# include <netinet/in.h>
+#endif
+
+#endif /* Include guard */
diff --git a/ext/dbm/sdbm/tune.h b/ext/dbm/sdbm/tune.h
index 9d8a35b90b..b95c8c8634 100644
--- a/ext/dbm/sdbm/tune.h
+++ b/ext/dbm/sdbm/tune.h
@@ -6,17 +6,6 @@
#define BYTESIZ 8
-#ifdef SVID
-#include <unistd.h>
-#endif
-
-#ifdef BSD42
-#define SEEK_SET L_SET
-#define memset(s,c,n) bzero(s, n) /* only when c is zero */
-#define memcpy(s1,s2,n) bcopy(s2, s1, n)
-#define memcmp(s1,s2,n) bcmp(s1,s2,n)
-#endif
-
/*
* important tuning parms (hah)
*/