diff options
Diffstat (limited to 'contrib/perl5/ext/ODBM_File')
-rw-r--r-- | contrib/perl5/ext/ODBM_File/Makefile.PL | 8 | ||||
-rw-r--r-- | contrib/perl5/ext/ODBM_File/ODBM_File.pm | 113 | ||||
-rw-r--r-- | contrib/perl5/ext/ODBM_File/ODBM_File.xs | 207 | ||||
-rw-r--r-- | contrib/perl5/ext/ODBM_File/hints/cygwin.pl | 2 | ||||
-rw-r--r-- | contrib/perl5/ext/ODBM_File/hints/dec_osf.pl | 9 | ||||
-rw-r--r-- | contrib/perl5/ext/ODBM_File/hints/hpux.pl | 4 | ||||
-rw-r--r-- | contrib/perl5/ext/ODBM_File/hints/sco.pl | 4 | ||||
-rw-r--r-- | contrib/perl5/ext/ODBM_File/hints/solaris.pl | 3 | ||||
-rw-r--r-- | contrib/perl5/ext/ODBM_File/hints/svr4.pl | 4 | ||||
-rw-r--r-- | contrib/perl5/ext/ODBM_File/hints/ultrix.pl | 4 | ||||
-rw-r--r-- | contrib/perl5/ext/ODBM_File/typemap | 41 |
11 files changed, 0 insertions, 399 deletions
diff --git a/contrib/perl5/ext/ODBM_File/Makefile.PL b/contrib/perl5/ext/ODBM_File/Makefile.PL deleted file mode 100644 index 2732a32ac348..000000000000 --- a/contrib/perl5/ext/ODBM_File/Makefile.PL +++ /dev/null @@ -1,8 +0,0 @@ -use ExtUtils::MakeMaker; -WriteMakefile( - NAME => 'ODBM_File', - LIBS => ["-ldbm -lucb"], - MAN3PODS => {}, # Pods will be built by installman. - XSPROTOARG => '-noprototypes', # XXX remove later? - VERSION_FROM => 'ODBM_File.pm', -); diff --git a/contrib/perl5/ext/ODBM_File/ODBM_File.pm b/contrib/perl5/ext/ODBM_File/ODBM_File.pm deleted file mode 100644 index 9e8e008e0243..000000000000 --- a/contrib/perl5/ext/ODBM_File/ODBM_File.pm +++ /dev/null @@ -1,113 +0,0 @@ -package ODBM_File; - -use strict; -use warnings; - -require Tie::Hash; -use XSLoader (); - -our @ISA = qw(Tie::Hash); -our $VERSION = "1.03"; - -XSLoader::load 'ODBM_File', $VERSION; - -1; - -__END__ - -=head1 NAME - -ODBM_File - Tied access to odbm files - -=head1 SYNOPSIS - - use Fcntl; # For O_RDWR, O_CREAT, etc. - use ODBM_File; - - # Now read and change the hash - $h{newkey} = newvalue; - print $h{oldkey}; - ... - - untie %h; - -=head1 DESCRIPTION - -C<ODBM_File> establishes a connection between a Perl hash variable and -a file in ODBM_File format;. You can manipulate the data in the file -just as if it were in a Perl hash, but when your program exits, the -data will remain in the file, to be used the next time your program -runs. - -Use C<ODBM_File> with the Perl built-in C<tie> function to establish -the connection between the variable and the file. The arguments to -C<tie> should be: - -=over 4 - -=item 1. - -The hash variable you want to tie. - -=item 2. - -The string C<"ODBM_File">. (Ths tells Perl to use the C<ODBM_File> -package to perform the functions of the hash.) - -=item 3. - -The name of the file you want to tie to the hash. - -=item 4. - -Flags. Use one of: - -=over 2 - -=item C<O_RDONLY> - -Read-only access to the data in the file. - -=item C<O_WRONLY> - -Write-only access to the data in the file. - -=item C<O_RDWR> - -Both read and write access. - -=back - -If you want to create the file if it does not exist, add C<O_CREAT> to -any of these, as in the example. If you omit C<O_CREAT> and the file -does not already exist, the C<tie> call will fail. - -=item 5. - -The default permissions to use if a new file is created. The actual -permissions will be modified by the user's umask, so you should -probably use 0666 here. (See L<perlfunc/umask>.) - -=back - -=head1 DIAGNOSTICS - -On failure, the C<tie> call returns an undefined value and probably -sets C<$!> to contain the reason the file could not be tied. - -=head2 C<odbm store returned -1, errno 22, key "..." at ...> - -This warning is emmitted when you try to store a key or a value that -is too long. It means that the change was not recorded in the -database. See BUGS AND WARNINGS below. - -=head1 BUGS AND WARNINGS - -There are a number of limits on the size of the data that you can -store in the ODBM file. The most important is that the length of a -key, plus the length of its associated value, may not exceed 1008 -bytes. - -See L<perlfunc/tie>, L<perldbmfilter>, L<Fcntl> - -=cut diff --git a/contrib/perl5/ext/ODBM_File/ODBM_File.xs b/contrib/perl5/ext/ODBM_File/ODBM_File.xs deleted file mode 100644 index 27174ef062b7..000000000000 --- a/contrib/perl5/ext/ODBM_File/ODBM_File.xs +++ /dev/null @@ -1,207 +0,0 @@ -#include "EXTERN.h" -#include "perl.h" -#include "XSUB.h" - -#ifdef I_DBM -/* If using the DB3 emulation, ENTER is defined both - * by DB3 and Perl. We drop the Perl definition now. - * See also INSTALL section on DB3. - * -- Stanislav Brabec <utx@penguin.cz> */ -# undef ENTER -# include <dbm.h> -#else -# ifdef I_RPCSVC_DBM -# include <rpcsvc/dbm.h> -# endif -#endif - -#ifdef DBM_BUG_DUPLICATE_FREE -/* - * DBM on at least Ultrix and HPUX call dbmclose() from dbminit(), - * resulting in duplicate free() because dbmclose() does *not* - * check if it has already been called for this DBM. - * If some malloc/free calls have been done between dbmclose() and - * the next dbminit(), the memory might be used for something else when - * it is freed. - * Verified to work on ultrix4.3. Probably will work on HP/UX. - * Set DBM_BUG_DUPLICATE_FREE in the extension hint file. - */ -/* Close the previous dbm, and fail to open a new dbm */ -#define dbmclose() ((void) dbminit("/tmp/x/y/z/z/y")) -#endif - -#include <fcntl.h> - -typedef struct { - void * dbp ; - SV * filter_fetch_key ; - SV * filter_store_key ; - SV * filter_fetch_value ; - SV * filter_store_value ; - int filtering ; - } ODBM_File_type; - -typedef ODBM_File_type * ODBM_File ; -typedef datum datum_key ; -typedef datum datum_value ; - -#define ckFilter(arg,type,name) \ - if (db->type) { \ - SV * save_defsv ; \ - /* printf("filtering %s\n", name) ;*/ \ - if (db->filtering) \ - croak("recursion detected in %s", name) ; \ - db->filtering = TRUE ; \ - save_defsv = newSVsv(DEFSV) ; \ - sv_setsv(DEFSV, arg) ; \ - PUSHMARK(sp) ; \ - (void) perl_call_sv(db->type, G_DISCARD|G_NOARGS); \ - sv_setsv(arg, DEFSV) ; \ - sv_setsv(DEFSV, save_defsv) ; \ - SvREFCNT_dec(save_defsv) ; \ - db->filtering = FALSE ; \ - /*printf("end of filtering %s\n", name) ;*/ \ - } - - -#define odbm_FETCH(db,key) fetch(key) -#define odbm_STORE(db,key,value,flags) store(key,value) -#define odbm_DELETE(db,key) delete(key) -#define odbm_FIRSTKEY(db) firstkey() -#define odbm_NEXTKEY(db,key) nextkey(key) - -static int dbmrefcnt; - -#ifndef DBM_REPLACE -#define DBM_REPLACE 0 -#endif - -MODULE = ODBM_File PACKAGE = ODBM_File PREFIX = odbm_ - -ODBM_File -odbm_TIEHASH(dbtype, filename, flags, mode) - char * dbtype - char * filename - int flags - int mode - CODE: - { - char *tmpbuf; - void * dbp ; - if (dbmrefcnt++) - croak("Old dbm can only open one database"); - New(0, tmpbuf, strlen(filename) + 5, char); - SAVEFREEPV(tmpbuf); - sprintf(tmpbuf,"%s.dir",filename); - if (stat(tmpbuf, &PL_statbuf) < 0) { - if (flags & O_CREAT) { - if (mode < 0 || close(creat(tmpbuf,mode)) < 0) - croak("ODBM_File: Can't create %s", filename); - sprintf(tmpbuf,"%s.pag",filename); - if (close(creat(tmpbuf,mode)) < 0) - croak("ODBM_File: Can't create %s", filename); - } - else - croak("ODBM_FILE: Can't open %s", filename); - } - dbp = (void*)(dbminit(filename) >= 0 ? &dbmrefcnt : 0); - RETVAL = (ODBM_File)safemalloc(sizeof(ODBM_File_type)) ; - Zero(RETVAL, 1, ODBM_File_type) ; - RETVAL->dbp = dbp ; - ST(0) = sv_mortalcopy(&PL_sv_undef); - sv_setptrobj(ST(0), RETVAL, dbtype); - } - -void -DESTROY(db) - ODBM_File db - CODE: - dbmrefcnt--; - dbmclose(); - safefree(db); - -datum_value -odbm_FETCH(db, key) - ODBM_File db - datum_key key - -int -odbm_STORE(db, key, value, flags = DBM_REPLACE) - ODBM_File db - datum_key key - datum_value value - int flags - CLEANUP: - if (RETVAL) { - if (RETVAL < 0 && errno == EPERM) - croak("No write permission to odbm file"); - croak("odbm store returned %d, errno %d, key \"%s\"", - RETVAL,errno,key.dptr); - } - -int -odbm_DELETE(db, key) - ODBM_File db - datum_key key - -datum_key -odbm_FIRSTKEY(db) - ODBM_File db - -datum_key -odbm_NEXTKEY(db, key) - ODBM_File db - datum_key key - - -#define setFilter(type) \ - { \ - if (db->type) \ - RETVAL = sv_mortalcopy(db->type) ; \ - ST(0) = RETVAL ; \ - if (db->type && (code == &PL_sv_undef)) { \ - SvREFCNT_dec(db->type) ; \ - db->type = Nullsv ; \ - } \ - else if (code) { \ - if (db->type) \ - sv_setsv(db->type, code) ; \ - else \ - db->type = newSVsv(code) ; \ - } \ - } - - - -SV * -filter_fetch_key(db, code) - ODBM_File db - SV * code - SV * RETVAL = &PL_sv_undef ; - CODE: - setFilter(filter_fetch_key) ; - -SV * -filter_store_key(db, code) - ODBM_File db - SV * code - SV * RETVAL = &PL_sv_undef ; - CODE: - setFilter(filter_store_key) ; - -SV * -filter_fetch_value(db, code) - ODBM_File db - SV * code - SV * RETVAL = &PL_sv_undef ; - CODE: - setFilter(filter_fetch_value) ; - -SV * -filter_store_value(db, code) - ODBM_File db - SV * code - SV * RETVAL = &PL_sv_undef ; - CODE: - setFilter(filter_store_value) ; - diff --git a/contrib/perl5/ext/ODBM_File/hints/cygwin.pl b/contrib/perl5/ext/ODBM_File/hints/cygwin.pl deleted file mode 100644 index a0d33c880767..000000000000 --- a/contrib/perl5/ext/ODBM_File/hints/cygwin.pl +++ /dev/null @@ -1,2 +0,0 @@ -# uses GDBM dbm compatibility feature -$self->{LIBS} = ['-lgdbm']; diff --git a/contrib/perl5/ext/ODBM_File/hints/dec_osf.pl b/contrib/perl5/ext/ODBM_File/hints/dec_osf.pl deleted file mode 100644 index febb7cdb21a3..000000000000 --- a/contrib/perl5/ext/ODBM_File/hints/dec_osf.pl +++ /dev/null @@ -1,9 +0,0 @@ -# The -hidden option causes compilation to fail on Digital Unix. -# Andy Dougherty <doughera@lafcol.lafayette.edu> -# Sat Jan 13 16:29:52 EST 1996 -$self->{LDDLFLAGS} = $Config{lddlflags}; -$self->{LDDLFLAGS} =~ s/-hidden//; -# As long as we're hinting, note the known location of the dbm routines. -# Spider Boardman <spider@Orb.Nashua.NH.US> -# Fri Feb 21 14:50:31 EST 1997 -$self->{LIBS} = ['-ldbm']; diff --git a/contrib/perl5/ext/ODBM_File/hints/hpux.pl b/contrib/perl5/ext/ODBM_File/hints/hpux.pl deleted file mode 100644 index 31f9d24bcae0..000000000000 --- a/contrib/perl5/ext/ODBM_File/hints/hpux.pl +++ /dev/null @@ -1,4 +0,0 @@ -# Try to work around "bad free" messages. See note in ODBM_File.xs. -# Andy Dougherty <doughera@lafcol.lafayette.edu> -# Sun Sep 8 12:57:52 EDT 1996 -$self->{CCFLAGS} = $Config{ccflags} . ' -DDBM_BUG_DUPLICATE_FREE' ; diff --git a/contrib/perl5/ext/ODBM_File/hints/sco.pl b/contrib/perl5/ext/ODBM_File/hints/sco.pl deleted file mode 100644 index f551578197d2..000000000000 --- a/contrib/perl5/ext/ODBM_File/hints/sco.pl +++ /dev/null @@ -1,4 +0,0 @@ -# SCO ODT 3.2v4.2 has a -ldbm library that is missing dbmclose. -# This system should have a complete library installed as -ldbm.nfs which -# should be used instead (Probably need the networking product add-on) -$self->{LIBS} = ['-lndbm',-e "/usr/lib/libdbm.nfs.a"?'-ldbm.nfs':'-ldbm']; diff --git a/contrib/perl5/ext/ODBM_File/hints/solaris.pl b/contrib/perl5/ext/ODBM_File/hints/solaris.pl deleted file mode 100644 index ac573932cced..000000000000 --- a/contrib/perl5/ext/ODBM_File/hints/solaris.pl +++ /dev/null @@ -1,3 +0,0 @@ -# -lucb has been reported to be fatal for perl5 on Solaris. -# Thus we deliberately don't include it here. -$self->{LIBS} = ['-ldbm']; diff --git a/contrib/perl5/ext/ODBM_File/hints/svr4.pl b/contrib/perl5/ext/ODBM_File/hints/svr4.pl deleted file mode 100644 index 3285d9a685fb..000000000000 --- a/contrib/perl5/ext/ODBM_File/hints/svr4.pl +++ /dev/null @@ -1,4 +0,0 @@ -# Some SVR4 systems may need to link against routines in -lucb for -# odbm. Some may also need to link against -lc to pick up things like -# ecvt. -$self->{LIBS} = ['-ldbm -lucb -lc']; diff --git a/contrib/perl5/ext/ODBM_File/hints/ultrix.pl b/contrib/perl5/ext/ODBM_File/hints/ultrix.pl deleted file mode 100644 index 31f9d24bcae0..000000000000 --- a/contrib/perl5/ext/ODBM_File/hints/ultrix.pl +++ /dev/null @@ -1,4 +0,0 @@ -# Try to work around "bad free" messages. See note in ODBM_File.xs. -# Andy Dougherty <doughera@lafcol.lafayette.edu> -# Sun Sep 8 12:57:52 EDT 1996 -$self->{CCFLAGS} = $Config{ccflags} . ' -DDBM_BUG_DUPLICATE_FREE' ; diff --git a/contrib/perl5/ext/ODBM_File/typemap b/contrib/perl5/ext/ODBM_File/typemap deleted file mode 100644 index 096427ea7f3a..000000000000 --- a/contrib/perl5/ext/ODBM_File/typemap +++ /dev/null @@ -1,41 +0,0 @@ -# -#################################### DBM SECTION -# - -datum_key T_DATUM_K -datum_value T_DATUM_V -gdatum T_GDATUM -NDBM_File T_PTROBJ -GDBM_File T_PTROBJ -SDBM_File T_PTROBJ -ODBM_File T_PTROBJ -DB_File T_PTROBJ -DBZ_File T_PTROBJ -FATALFUNC T_OPAQUEPTR - -INPUT -T_DATUM_K - ckFilter($arg, filter_store_key, \"filter_store_key\"); - $var.dptr = SvPV($arg, PL_na); - $var.dsize = (int)PL_na; -T_DATUM_V - ckFilter($arg, filter_store_value, \"filter_store_value\"); - if (SvOK($arg)) { - $var.dptr = SvPV($arg, PL_na); - $var.dsize = (int)PL_na; - } - else { - $var.dptr = \"\"; - $var.dsize = 0; - } -T_GDATUM - UNIMPLEMENTED -OUTPUT -T_DATUM_K - sv_setpvn($arg, $var.dptr, $var.dsize); - ckFilter($arg, filter_fetch_key,\"filter_fetch_key\"); -T_DATUM_V - sv_setpvn($arg, $var.dptr, $var.dsize); - ckFilter($arg, filter_fetch_value,\"filter_fetch_value\"); -T_GDATUM - sv_usepvn($arg, $var.dptr, $var.dsize); |