Browse Source

moved db

experimental/newoperator
Stig Bakken 27 years ago
parent
commit
f582bec9db
  1. 2
      Makefile.in
  2. 6
      acconfig.h.in
  3. 19
      acinclude.m4
  4. 20
      configure.in.in
  5. 6
      ext/db/Makefile.am
  6. 5
      ext/db/config.h.stub
  7. 47
      ext/db/config.m4
  8. 1176
      ext/db/db.c
  9. 94
      ext/db/db.h
  10. 194
      ext/hyperwave/debug.h
  11. 2
      internal_functions.c

2
Makefile.in

@ -69,7 +69,7 @@ OBJS = main.o internal_functions.o snprintf.o php3_sprintf.o \
php_ini.o
FUNCTIONS_SOURCE = functions/fhttpd.c \
functions/crypt.c functions/db.c functions/dl.c \
functions/crypt.c functions/dl.c \
functions/head.c functions/imap.c functions/mime.c \
functions/pgsql.c functions/post.c functions/sybase.c \
functions/sybase-ct.c functions/xml.c \

6
acconfig.h.in

@ -54,12 +54,6 @@
/* in GET/POST/Cookie data */
#define MAGIC_QUOTES 1
/* Define if you have an ndbm compatible library (-ldbm). */
#define NDBM 0
/* Define if you have the gdbm library (-lgdbm). */
#define GDBM 0
/* Define both of these if you want the bundled REGEX library */
#define REGEX 0
#define HSREGEX 0

19
acinclude.m4

@ -16,25 +16,6 @@ AC_DEFUN(AC_MISSING_FCLOSE_DECL,[
])
])
# Checks for libraries.
# Prefer gdbm, Berkeley DB and ndbm/dbm, in that order
AC_DEFUN(AC_PREFERRED_DB_LIB,[
AC_CHECK_LIB(gdbm, gdbm_open,[AC_DEFINE(GDBM) DBM_TYPE=gdbm; DBM_LIB=-lgdbm],
[AC_CHECK_LIB(db, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=-ldb],
[AC_CHECK_LIB(c, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=],
[AC_CHECK_LIB(dbm, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=-ldbm],
[DBM_TYPE=""])])])])
AC_MSG_CHECKING([preferred dbm library])
if test "a$DBM_TYPE" = a; then
AC_MSG_RESULT(none found)
AC_MSG_WARN(No dbm library found - using built-in flatfile support)
else
AC_MSG_RESULT($DBM_TYPE chosen)
fi
AC_SUBST(DBM_LIB)
AC_SUBST(DBM_TYPE)
])
dnl
dnl Check for broken sprintf()
dnl

20
configure.in.in

@ -150,8 +150,6 @@ fi
INCLUDES=""
AC_SUBST(INCLUDES)
AC_PREFERRED_DB_LIB
AC_CHECK_LIB(nsl, gethostname, [
LIBS="-lnsl $LIBS"
AC_DEFINE(HAVE_LIBNSL) ], [])
@ -210,24 +208,6 @@ fi
AC_MISSING_FCLOSE_DECL
dnl QNX requires unix.h to allow functions in libunix to work properly
AC_CHECK_HEADERS(fcntl.h unistd.h crypt.h sys/file.h memory.h pwd.h grp.h sys/socket.h sys/wait.h syslog.h string.h sys/varargs.h stdarg.h sys/time.h signal.h netinet/in.h dlfcn.h limits.h sys/types.h unix.h arpa/inet.h)
if test "$DBM_LIB" = "-lgdbm"; then
AC_CHECK_HEADER(gdbm.h, [ GDBM_INCLUDE="" ], [
AC_MSG_RESULT("Try /usr/local/include/gdbm.h");
AC_CHECK_HEADER(/usr/local/include/gdbm.h, [ GDBM_INCLUDE="-I/usr/local/include" ],[
AC_MSG_RESULT("Try /opt/local/include/gdbm.h");
AC_CHECK_HEADER(/opt/local/include/gdbm.h, [ GDBM_INCLUDE="-I/opt/local/include" ],[
dnl if in /usr/pkg/include, do not add anything. See above.
AC_MSG_RESULT("Try /usr/pkg/include/gdbm.h");
AC_CHECK_HEADER(/usr/pkg/include/gdbm.h, [ GDBM_INCLUDE="" ],[
AC_MSG_RESULT("Giving up - You need to install gdbm.h somewhere");
exit
])
])
])
])
INCLUDES="$INCLUDES $GDBM_INCLUDES"
dnl## AC_SUBST(GDBM_INCLUDE)
fi
dnl Checks for typedefs, structures, and compiler characteristics.
AC_STRUCT_TM

6
ext/db/Makefile.am

@ -0,0 +1,6 @@
# $Id$
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
noinst_LIBRARIES=libphpext_db.a
libphpext_db_a_SOURCES=db.c

5
ext/db/config.h.stub

@ -0,0 +1,5 @@
/* Define if you have an ndbm compatible library (-ldbm). */
#define NDBM 0
/* Define if you have the gdbm library (-lgdbm). */
#define GDBM 0

47
ext/db/config.m4

@ -0,0 +1,47 @@
dnl $Id$
dnl config.m4 for extension db
dnl don't forget to call PHP_EXTENSION(db)
divert(1)
# Checks for libraries.
# Prefer gdbm, Berkeley DB and ndbm/dbm, in that order
AC_DEFUN(AC_PREFERRED_DB_LIB,[
AC_CHECK_LIB(gdbm, gdbm_open,[AC_DEFINE(GDBM) DBM_TYPE=gdbm; DBM_LIB=-lgdbm],
[AC_CHECK_LIB(db, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=-ldb],
[AC_CHECK_LIB(c, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=],
[AC_CHECK_LIB(dbm, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=-ldbm],
[DBM_TYPE=""])])])])
AC_MSG_CHECKING([preferred dbm library])
if test "a$DBM_TYPE" = a; then
AC_MSG_RESULT(none found)
AC_MSG_WARN(No dbm library found - using built-in flatfile support)
else
AC_MSG_RESULT($DBM_TYPE chosen)
fi
AC_SUBST(DBM_LIB)
AC_SUBST(DBM_TYPE)
])
AC_PREFERRED_DB_LIB
divert(3)
if test "$DBM_LIB" = "-lgdbm"; then
AC_CHECK_HEADER(gdbm.h, [ GDBM_INCLUDE="" ], [
AC_MSG_RESULT("Try /usr/local/include/gdbm.h");
AC_CHECK_HEADER(/usr/local/include/gdbm.h, [ GDBM_INCLUDE="-I/usr/local/include" ],[
AC_MSG_RESULT("Try /opt/local/include/gdbm.h");
AC_CHECK_HEADER(/opt/local/include/gdbm.h, [ GDBM_INCLUDE="-I/opt/local/include" ],[
dnl if in /usr/pkg/include, do not add anything. See above.
AC_MSG_RESULT("Try /usr/pkg/include/gdbm.h");
AC_CHECK_HEADER(/usr/pkg/include/gdbm.h, [ GDBM_INCLUDE="" ],[
AC_MSG_RESULT("Giving up - You need to install gdbm.h somewhere");
exit
])
])
])
])
INCLUDES="$INCLUDES $GDBM_INCLUDES"
dnl## AC_SUBST(GDBM_INCLUDE)
fi

1176
ext/db/db.c
File diff suppressed because it is too large
View File

94
ext/db/db.h

@ -0,0 +1,94 @@
/*
+----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
+----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of one of the following licenses: |
| |
| A) the GNU General Public License as published by the Free Software |
| Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
| Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef _PHP3_DB_H
#define _PHP3_DB_H
#ifndef DLEXPORT
#define DLEXPORT
#endif
extern php3_module_entry dbm_module_entry;
#define dbm_module_ptr &dbm_module_entry
typedef struct dbm_info {
char *filename;
char *lockfn;
int lockfd;
void *dbf;
} dbm_info;
/*
we're not going to bother with flatfile on win32
because the dbm module will be external, and we
do not want flatfile compiled staticly
*/
#if defined(MSVC5) && !defined(COMPILE_DL)
#undef dbm_module_ptr
#define dbm_module_ptr NULL
#endif
dbm_info *_php3_finddbm(pval *id,HashTable *list);
int _php3_dbmclose(dbm_info *info);
dbm_info *_php3_dbmopen(char *filename, char *mode);
int _php3_dbminsert(dbm_info *info, char *key, char *value);
char *_php3_dbmfetch(dbm_info *info, char *key);
int _php3_dbmreplace(dbm_info *info, char *key, char *value);
int _php3_dbmexists(dbm_info *info, char *key);
int _php3_dbmdelete(dbm_info *info, char *key);
char *_php3_dbmfirstkey(dbm_info *info);
char *_php3_dbmnextkey(dbm_info *info, char *key);
/* db file functions */
extern int php3_minit_db(INIT_FUNC_ARGS);
extern int php3_rinit_db(INIT_FUNC_ARGS);
extern void php3_info_db(void);
extern void php3_dblist(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_dbmopen(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_dbmclose(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_dbminsert(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_dbmfetch(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_dbmreplace(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_dbmexists(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_dbmdelete(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_dbmfirstkey(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_dbmnextkey(INTERNAL_FUNCTION_PARAMETERS);
#undef dbm_module_ptr
#define dbm_module_ptr NULL
#endif /* _PHP3_DB_H */

194
ext/hyperwave/debug.h

@ -0,0 +1,194 @@
/****************************************************************************
*
* Copyright (C) 1991 Kendall Bennett.
* All rights reserved.
*
* Filename: $RCSfile$
* Version: $Revision$
*
* Language: ANSI C
* Environment: any
*
* Description: General header file for portable code.
*
* $Id$
*
* Revision History:
* -----------------
*
* $Log$
* Revision 1.1.1.1 1999/04/07 21:03:29 zeev
* PHP 4.0
*
* Revision 1.1.1.1 1999/03/17 04:29:10 andi
* PHP4
*
* Revision 1.1.1.1 1998/12/21 07:56:22 andi
* Trying to start the zend CVS tree
*
* Revision 1.1 1998/08/12 09:29:16 steinm
* First version of Hyperwave module.
*
* Revision 1.6 92/03/15 12:51:48 kjb
* Added MK_FP macro and ushort typedef.
*
* Revision 1.5 91/10/28 03:17:33 kjb
* Ported to the Iris.
*
* Revision 1.4 91/09/26 15:29:02 kjb
* Added stuff for the SGI Iris 4D.
*
* Revision 1.3 91/09/26 10:07:04 kjb
* Added general typedef stuff.
*
* Revision 1.2 91/09/03 18:19:14 ROOT_DOS
* Added a few defines that are supplied by <dir.h> for UNIX compatibility.
*
* Revision 1.1 91/08/16 13:19:06 ROOT_DOS
* Initial revision
*
****************************************************************************/
#ifndef __DEBUG_H
#define __DEBUG_H
#ifdef DEBUG
# define D(x) x
#else
# define D(x)
#endif
#define PRIVATE static
#define PUBLIC
#ifdef __MSDOS__ /* Compiling for MSDOS */
# define MS(x) x
# define UX(x)
# define IR(x)
# define _8086 /* We know we have an 8086 type processor */
#if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
# define LDATA
# define NULL 0L
#else
# define NULL 0
#endif
#else __MSDOS__
#ifdef __IRIS4D__ /* Compiling for the SGI Iris 4D */
# define MS(x)
# define UX(x) x /* The Iris is a UNIX machine */
# define IR(x) x
# define O_BINARY 0 /* no binary input mode in UNIX open() */
# define MAXFILE 255 /* These are defined in <dir.h>, but */
# define MAXDIR 255 /* on UNIX machines, we just define */
# define MAXPATH 255 /* them all to be the same size */
# define far /* Near and far do not exist under */
# define near /* UNIX or the Iris. */
# define NULL ((void *)0)
#else __IRIS4D__ /* Assume UNIX compilation */
# define MS(x)
# define UX(x) x
# define IR(x)
# define O_BINARY 0 /* no binary input mode in UNIX open() */
# define MAXFILE 255 /* These are defined in <dir.h>, but */
# define MAXDIR 255 /* on UNIX machines, we just define */
# define MAXPATH 255 /* them all to be the same size */
# define far /* Near and far do not exist under */
# define near /* UNIX or the Iris. */
# ifndef NULL
# define NULL ((void *)0)
# endif
#endif __IRIS4D__
#endif __MSDOS__
/****************************************************************************
*
* SEG(p) Evaluates to the segment portion of an 8086 address.
* OFF(p) Evaluates to the offset portion of an 8086 address.
* FP(s,o) Creates a far pointer given a segment offset pair.
* PHYS(p) Evaluates to a long holding a physical address
*
****************************************************************************/
#ifdef _8086
# define SEG(p) ( ((unsigned *)&(void far *)(p))[1] )
# define OFF(p) ( (unsigned)(p) )
# define FP(s,o) ( (void far *)( ((unsigned long)s << 16) + \
(unsigned long)o ))
# define PHYS(p) ( (unsigned long)OFF(p) + \
((unsigned long)SEG(p) << 4))
#else
# define PHYS(p) (p)
#endif _8086
/****************************************************************************
*
* NUMELE(array) Evaluates to the array size in elements
* LASTELE(array) Evaluates to a pointer to the last element
* INBOUNDS(array,p) Evaluates to true if p points into the array
* RANGE(a,b,c) Evaluates to true if a <= b <= c
* max(a,b) Evaluates to a or b, whichever is larger
* min(a,b) Evaluates to a or b, whichever is smaller
* ABS(a) Evaluates to the absolute value of a
* NBITS(type) Returns the number of bits in a variable of the
* indicated type
* MAXINT Evaluates to the value of the largest signed integer
*
****************************************************************************/
#define NUMELE(a) (sizeof(a)/sizeof(*(a)))
#define LASTELE(a) ((a) + (NUMELE(a)-1))
#ifdef LDATA
#define TOOHIGH(a,p) ((long)PHYS(p) - (long)PHYS(a) > (long)(NUMELE(a)-1))
#define TOOLOW(a,p) ((long)PHYS(p) - (long)PHYS(a) < 0)
#else
#define TOOHIGH(a,p) ((long)(p) - (long)(a) > (long)(NUMELE(a)-1))
#define TOOLOW(a,p) ((long)(p) - (long)(a) < 0)
#endif
#define INBOUNDS(a,p) ( ! (TOOHIGH(a,p) || TOOLOW(a,p)) )
#define _IS(t,x) (((t)1 << (x)) != 0) /* Evaluates true if the width of */
/* variable of type t is < x. */
/* The != 0 assures that the */
/* answer is 1 or 0 */
#define NBITS(t) (4 * (1 + _IS(t,4) + _IS(t,8) + _IS(t,12) + _IS(t,16) \
+ _IS(t,20) + _IS(t,24) + _IS(t,28) + _IS(t,32)))
#define MAXINT (((unsigned)~0) >> 1)
#ifndef MAX
# define MAX(a,b) ( ((a) > (b)) ? (a) : (b))
#endif
#ifndef MIN
# define MIN(a,b) ( ((a) < (b)) ? (a) : (b))
#endif
#ifndef ABS
# define ABS(a) ((a) >= 0 ? (a) : -(a))
#endif
#define RANGE(a,b,c) ( (a) <= (b) && (b) <= (c) )
/* General typedefs */
#ifndef __GENDEFS
#define __GENDEFS
typedef void *ptr;
typedef void near *nearptr;
typedef void far *farptr;
/*typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;*/
typedef int bool;
#endif __GENDEFS
/* Boolean truth values */
#define false 0
#define true 1
#define FALSE 0
#define TRUE 1
#define NO 0
#define YES 1
#endif __DEBUG_H

2
internal_functions.c

@ -63,7 +63,7 @@
#include "functions/post.h"
#include "ext/hyperwave/hw.h"
#include "ext/filepro/filepro.h"
#include "functions/db.h"
#include "ext/db/db.h"
#include "dl/snmp/php3_snmp.h"
#include "functions/php3_zlib.h"
#include "ext/com/php3_COM.h"

Loading…
Cancel
Save