CVS update: php3/functions

From: Date: Mon, 12 Apr 1999 04:41:17 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-5021@lists.php.net to get a copy of this message
Date: Monday April 12, 1999 @ 0:41 Author: sas Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv21868/functions Modified Files: dba.c dba_cdb.c dba_dbm.c dba_gdbm.c dba_ndbm.c php3_cdb.h php3_dba.h php3_dbm.h php3_gdbm.h php3_ndbm.h Log Message: - add --disable-dba - change DBA C API, so it is more flexible - move PHP functions from db_* to dba_* - more cleanup Index: php3/functions/dba.c diff -c php3/functions/dba.c:1.4 php3/functions/dba.c:1.5 *** php3/functions/dba.c:1.4 Sat Apr 10 06:06:38 1999 --- php3/functions/dba.c Mon Apr 12 00:41:16 1999 *************** *** 27,35 **** +----------------------------------------------------------------------+ */ ! /* $Id: dba.c,v 1.4 1999/04/10 10:06:38 sas Exp $ */ #include "php.h" #include "php3_list.h" #include "php3_dba.h" --- 27,38 ---- +----------------------------------------------------------------------+ */ ! /* $Id: dba.c,v 1.5 1999/04/12 04:41:16 sas Exp $ */ #include "php.h" + + #if HAVE_DBA + #include "php3_list.h" #include "php3_dba.h" *************** *** 39,55 **** #include "php3_cdb.h" function_entry dba_functions[] = { ! PHP_FE(db_open, NULL) ! PHP_FE(db_popen, NULL) ! PHP_FE(db_close, NULL) ! PHP_FE(db_delete, NULL) ! PHP_FE(db_exists, NULL) ! PHP_FE(db_fetch, NULL) ! PHP_FE(db_insert, NULL) ! PHP_FE(db_replace, NULL) ! PHP_FE(db_firstkey, NULL) ! PHP_FE(db_nextkey, NULL) ! PHP_FE(db_optimize, NULL) {NULL,NULL,NULL} }; --- 42,58 ---- #include "php3_cdb.h" function_entry dba_functions[] = { ! PHP_FE(dba_open, NULL) ! PHP_FE(dba_popen, NULL) ! PHP_FE(dba_close, NULL) ! PHP_FE(dba_delete, NULL) ! PHP_FE(dba_exists, NULL) ! PHP_FE(dba_fetch, NULL) ! PHP_FE(dba_insert, NULL) ! PHP_FE(dba_replace, NULL) ! PHP_FE(dba_firstkey, NULL) ! PHP_FE(dba_nextkey, NULL) ! PHP_FE(dba_optimize, NULL) {NULL,NULL,NULL} }; *************** *** 68,82 **** typedef struct dba_handler { char *name; ! int (*open)(const dba_info *); ! void (*close)(const dba_info *); ! char* (*fetch)(const dba_info *, const char *, int *); ! int (*update)(const dba_info *, const char *, const char *, const int, const int); ! int (*exists)(const dba_info *, const char *); ! int (*delete)(const dba_info *, const char *); ! char* (*firstkey)(const dba_info *); ! char* (*nextkey)(const dba_info *, const char *); ! void (*optimize)(const dba_info *); } dba_handler; /* {{{ macromania */ --- 71,85 ---- typedef struct dba_handler { char *name; ! int (*open)(dba_info *); ! void (*close)(dba_info *); ! char* (*fetch)(dba_info *, char *, int *); ! int (*update)(dba_info *, char *, char *, int, int); ! int (*exists)(dba_info *, char *); ! int (*delete)(dba_info *, char *); ! char* (*firstkey)(dba_info *); ! char* (*nextkey)(dba_info *, char *); ! void (*optimize)(dba_info *); } dba_handler; /* {{{ macromania */ *************** *** 111,122 **** #define DBA_ID_GET1 DBA_ID_PARS; DBA_GET1; DBA_ID_GET #define DBA_ID_GET2 DBA_ID_PARS; DBA_GET2; DBA_ID_GET ! /* a dba handler should have specific routines */ ! ! #define DB_HND(a) { #a, _php3_##a##_open,_php3_##a##_close,_php3_##a##_fetch, \ ! _php3_##a##_update,_php3_##a##_exists,_php3_##a##_delete, \ ! _php3_##a##_firstkey,_php3_##a##_nextkey,_php3_##a##_optimize }, #define GLOBAL(a) a /* }}} */ --- 114,128 ---- #define DBA_ID_GET1 DBA_ID_PARS; DBA_GET1; DBA_ID_GET #define DBA_ID_GET2 DBA_ID_PARS; DBA_GET2; DBA_ID_GET ! /* a dba handler must have specific routines */ + #define DBA_HND(x) \ + {\ + #x, dba_open_##x, dba_close_##x, dba_fetch_##x, dba_update_##x, \ + dba_exists_##x, dba_delete_##x, dba_firstkey_##x, dba_nextkey_##x, \ + dba_optimize_##x \ + }, + #define GLOBAL(a) a /* }}} */ *************** *** 125,140 **** static dba_handler handler[] = { #if DBA_GDBM ! DB_HND(gdbm) #endif #if DBA_DBM ! DB_HND(dbm) #endif #if DBA_NDBM ! DB_HND(ndbm) #endif #if DBA_CDB ! DB_HND(cdb) #endif { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } }; --- 131,146 ---- static dba_handler handler[] = { #if DBA_GDBM ! DBA_HND(gdbm) #endif #if DBA_DBM ! DBA_HND(dbm) #endif #if DBA_NDBM ! DBA_HND(ndbm) #endif #if DBA_CDB ! DBA_HND(cdb) #endif { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } }; *************** *** 178,184 **** { dba_handler *hptr; ! PUTS("V1 ($Id: dba.c,v 1.4 1999/04/10 10:06:38 sas Exp $)"); for(hptr = handler; hptr->name; hptr++) { PUTS(" "); PUTS(hptr->name); --- 184,190 ---- { dba_handler *hptr; ! PUTS("V1 ($Id: dba.c,v 1.5 1999/04/12 04:41:16 sas Exp $)"); for(hptr = handler; hptr->name; hptr++) { PUTS(" "); PUTS(hptr->name); *************** *** 306,330 **** /* }}} */ /* }}} */ ! /* {{{ proto int db_popen(string path, string mode, string handlername, ...) opens path using the specified handler in mode persistently */ ! PHP_FUNCTION(db_popen) { _php3_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ ! /* {{{ proto int db_open(string path, string mode, string handlername, ...) opens path using the specified handler in mode*/ ! PHP_FUNCTION(db_open) { _php3_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ ! /* {{{ proto void db_close(int handle) closes database */ ! PHP_FUNCTION(db_close) { DBA_ID_GET1; --- 312,336 ---- /* }}} */ /* }}} */ ! /* {{{ proto int dba_popen(string path, string mode, string handlername, ...) opens path using the specified handler in mode persistently */ ! PHP_FUNCTION(dba_popen) { _php3_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ ! /* {{{ proto int dba_open(string path, string mode, string handlername, ...) opens path using the specified handler in mode*/ ! PHP_FUNCTION(dba_open) { _php3_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ ! /* {{{ proto void dba_close(int handle) closes database */ ! PHP_FUNCTION(dba_close) { DBA_ID_GET1; *************** *** 332,340 **** } /* }}} */ ! /* {{{ proto bool db_exists(int handle, string key) checks, if the specified key exists */ ! PHP_FUNCTION(db_exists) { DBA_ID_GET2; --- 338,346 ---- } /* }}} */ ! /* {{{ proto bool dba_exists(int handle, string key) checks, if the specified key exists */ ! PHP_FUNCTION(dba_exists) { DBA_ID_GET2; *************** *** 345,353 **** } /* }}} */ ! /* {{{ proto string db_fetch(int handle, string key) fetches the data associated with key */ ! PHP_FUNCTION(db_fetch) { char *val; int len = 0; --- 351,359 ---- } /* }}} */ ! /* {{{ proto string dba_fetch(int handle, string key) fetches the data associated with key */ ! PHP_FUNCTION(dba_fetch) { char *val; int len = 0; *************** *** 361,369 **** } /* }}} */ ! /* {{{ proto string db_firstkey(int handle) resets the internal key pointer and returns the first key */ ! PHP_FUNCTION(db_firstkey) { char *fkey; DBA_ID_GET1; --- 367,375 ---- } /* }}} */ ! /* {{{ proto string dba_firstkey(int handle) resets the internal key pointer and returns the first key */ ! PHP_FUNCTION(dba_firstkey) { char *fkey; DBA_ID_GET1; *************** *** 375,383 **** } /* }}} */ ! /* {{{ proto string db_nextkey(int handle, string key) returns the next key */ ! PHP_FUNCTION(db_nextkey) { char *nkey; DBA_ID_GET2; --- 381,389 ---- } /* }}} */ ! /* {{{ proto string dba_nextkey(int handle, string key) returns the next key */ ! PHP_FUNCTION(dba_nextkey) { char *nkey; DBA_ID_GET2; *************** *** 389,397 **** } /* }}} */ ! /* {{{ proto bool db_delete(int handle, string key) deletes the entry associated with key */ ! PHP_FUNCTION(db_delete) { DBA_ID_GET2; --- 395,403 ---- } /* }}} */ ! /* {{{ proto bool dba_delete(int handle, string key) deletes the entry associated with key */ ! PHP_FUNCTION(dba_delete) { DBA_ID_GET2; *************** *** 401,428 **** } /* }}} */ ! /* {{{ proto bool db_insert(int handle, string key, string value) inserts value as key, returns false, if key exists already */ ! PHP_FUNCTION(db_insert) { _php3_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ ! /* {{{ proto bool db_replace(int handle, string key, string value) inserts value as key, replaces key, if key exists already */ ! PHP_FUNCTION(db_replace) { _php3_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ ! /* {{{ proto void db_optimize(int handle) optimizes (e.g. clean up, vacuum) database */ ! PHP_FUNCTION(db_optimize) { DBA_ID_GET1; info->hnd->optimize(info); } /* }}} */ --- 407,436 ---- } /* }}} */ ! /* {{{ proto bool dba_insert(int handle, string key, string value) inserts value as key, returns false, if key exists already */ ! PHP_FUNCTION(dba_insert) { _php3_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ ! /* {{{ proto bool dba_replace(int handle, string key, string value) inserts value as key, replaces key, if key exists already */ ! PHP_FUNCTION(dba_replace) { _php3_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ ! /* {{{ proto void dba_optimize(int handle) optimizes (e.g. clean up, vacuum) database */ ! PHP_FUNCTION(dba_optimize) { DBA_ID_GET1; info->hnd->optimize(info); } /* }}} */ + + #endif Index: php3/functions/dba_cdb.c diff -c php3/functions/dba_cdb.c:1.5 php3/functions/dba_cdb.c:1.6 *** php3/functions/dba_cdb.c:1.5 Sat Apr 10 06:06:38 1999 --- php3/functions/dba_cdb.c Mon Apr 12 00:41:16 1999 *************** *** 27,33 **** +----------------------------------------------------------------------+ */ ! /* $Id: dba_cdb.c,v 1.5 1999/04/10 10:06:38 sas Exp $ */ #include "php.h" --- 27,33 ---- +----------------------------------------------------------------------+ */ ! /* $Id: dba_cdb.c,v 1.6 1999/04/12 04:41:16 sas Exp $ */ #include "php.h" *************** *** 50,56 **** uint32 pos; /* current position for traversing */ } dba_cdb; ! int CDB_FNCT(open) { int gmode = 0; dba_cdb *cdb; --- 50,56 ---- uint32 pos; /* current position for traversing */ } dba_cdb; ! DBA_OPEN_FUNC(cdb) { int gmode = 0; dba_cdb *cdb; *************** *** 75,81 **** return SUCCESS; } ! void CDB_FNCT(close) { CDB_INFO; --- 75,81 ---- return SUCCESS; } ! DBA_CLOSE_FUNC(cdb) { CDB_INFO; *************** *** 83,89 **** free(cdb); } ! char *CDB_FNCT(fetch,, const char *key, int *newlen) { CDB_INFO; int len; --- 83,89 ---- free(cdb); } ! DBA_FETCH_FUNC(cdb) { CDB_INFO; int len; *************** *** 98,110 **** return new; } ! int CDB_FNCT(update,, const char *key, const char *val, const int vallen, const int mode) { /* if anyone figures out cdbmake.c, let me know */ return FAILURE; } ! int CDB_FNCT(exists,, const char *key) { CDB_INFO; int len; --- 98,110 ---- return new; } ! DBA_UPDATE_FUNC(cdb) { /* if anyone figures out cdbmake.c, let me know */ return FAILURE; } ! DBA_EXISTS_FUNC(cdb) { CDB_INFO; int len; *************** *** 114,120 **** return 0; } ! int CDB_FNCT(delete,, const char *key) { return FAILURE; } --- 114,120 ---- return 0; } ! DBA_DELETE_FUNC(cdb) { return FAILURE; } *************** *** 125,131 **** if(n >= cdb->eod) return NULL; \ if(lseek(cdb->fd, (off_t)n, SEEK_SET) != (off_t) n) return NULL ! char *CDB_FNCT(firstkey) { CDB_INFO; uint32 len; --- 125,131 ---- if(n >= cdb->eod) return NULL; \ if(lseek(cdb->fd, (off_t)n, SEEK_SET) != (off_t) n) return NULL ! DBA_FIRSTKEY_FUNC(cdb) { CDB_INFO; uint32 len; *************** *** 153,159 **** return key; } ! char *CDB_FNCT(nextkey,, const char *key) { /* this would be much faster: */ #if 0 --- 153,159 ---- return key; } ! DBA_NEXTKEY_FUNC(cdb) { /* this would be much faster: */ #if 0 *************** *** 200,206 **** #endif } ! void CDB_FNCT(optimize) { } #endif --- 200,206 ---- #endif } ! DBA_OPTIMIZE_FUNC(cdb) { } #endif Index: php3/functions/dba_dbm.c diff -c php3/functions/dba_dbm.c:1.4 php3/functions/dba_dbm.c:1.5 *** php3/functions/dba_dbm.c:1.4 Fri Apr 9 05:50:52 1999 --- php3/functions/dba_dbm.c Mon Apr 12 00:41:16 1999 *************** *** 27,33 **** +----------------------------------------------------------------------+ */ ! /* $Id: dba_dbm.c,v 1.4 1999/04/09 09:50:52 sas Exp $ */ #include "php.h" --- 27,33 ---- +----------------------------------------------------------------------+ */ ! /* $Id: dba_dbm.c,v 1.5 1999/04/12 04:41:16 sas Exp $ */ #include "php.h" *************** *** 43,59 **** #define DBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = strlen(key) ! int DBM_FNCT(open) { return (dbminit((char *) info->path) ? FAILURE : SUCCESS); } ! void DBM_FNCT(close) { /* dbm sucks :) */ } ! char *DBM_FNCT(fetch,, const char *key, int *newlen) { datum gval; char *new = NULL; --- 43,60 ---- #define DBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = strlen(key) ! ! DBA_OPEN_FUNC(dbm) { return (dbminit((char *) info->path) ? FAILURE : SUCCESS); } ! DBA_CLOSE_FUNC(dbm) { /* dbm sucks :) */ } ! DBA_FETCH_FUNC(dbm) { datum gval; char *new = NULL; *************** *** 68,74 **** return new; } ! int DBM_FNCT(update,, const char *key, const char *val, const int vallen, const int mode) { datum gval; --- 69,75 ---- return new; } ! DBA_UPDATE_FUNC(dbm) { datum gval; *************** *** 79,85 **** return store(gkey, gval) ? 1 : 0; } ! int DBM_FNCT(exists,, const char *key) { datum gval; DBM_GKEY; --- 80,86 ---- return store(gkey, gval) ? 1 : 0; } ! DBA_EXISTS_FUNC(dbm) { datum gval; DBM_GKEY; *************** *** 92,104 **** return 0; } ! int DBM_FNCT(delete,, const char *key) { DBM_GKEY; return delete(gkey); } ! char *DBM_FNCT(firstkey) { datum gkey; char *key = NULL; --- 93,105 ---- return 0; } ! DBA_DELETE_FUNC(dbm) { DBM_GKEY; return delete(gkey); } ! DBA_FIRSTKEY_FUNC(dbm) { datum gkey; char *key = NULL; *************** *** 111,117 **** return key; } ! char *DBM_FNCT(nextkey,, const char *key) { char *nkey = NULL; DBM_GKEY; --- 112,118 ---- return key; } ! DBA_NEXTKEY_FUNC(dbm) { char *nkey = NULL; DBM_GKEY; *************** *** 124,130 **** return nkey; } ! void DBM_FNCT(optimize) { /* dummy */ } --- 125,131 ---- return nkey; } ! DBA_OPTIMIZE_FUNC(dbm) { /* dummy */ } Index: php3/functions/dba_gdbm.c diff -c php3/functions/dba_gdbm.c:1.2 php3/functions/dba_gdbm.c:1.3 *** php3/functions/dba_gdbm.c:1.2 Fri Apr 9 05:50:52 1999 --- php3/functions/dba_gdbm.c Mon Apr 12 00:41:16 1999 *************** *** 27,33 **** +----------------------------------------------------------------------+ */ ! /* $Id: dba_gdbm.c,v 1.2 1999/04/09 09:50:52 sas Exp $ */ #include "php.h" --- 27,33 ---- +----------------------------------------------------------------------+ */ ! /* $Id: dba_gdbm.c,v 1.3 1999/04/12 04:41:16 sas Exp $ */ #include "php.h" *************** *** 38,44 **** #define GDBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = strlen(key) ! int GDBM_FNCT(open) { GDBM_FILE dbf; int gmode = 0; --- 38,45 ---- #define GDBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = strlen(key) ! ! DBA_OPEN_FUNC(gdbm) { GDBM_FILE dbf; int gmode = 0; *************** *** 65,76 **** return FAILURE; } ! void GDBM_FNCT(close) { gdbm_close(info->dbf); } ! char *GDBM_FNCT(fetch,, const char *key, int *newlen) { datum gval; char *new = NULL; --- 66,77 ---- return FAILURE; } ! DBA_CLOSE_FUNC(gdbm) { gdbm_close(info->dbf); } ! DBA_FETCH_FUNC(gdbm) { datum gval; char *new = NULL; *************** *** 85,91 **** return new; } ! int GDBM_FNCT(update,, const char *key, const char *val, const int vallen, const int mode) { datum gval; --- 86,92 ---- return new; } ! DBA_UPDATE_FUNC(gdbm) { datum gval; *************** *** 98,117 **** return 0; } ! int GDBM_FNCT(exists,, const char *key) { GDBM_GKEY; return gdbm_exists(info->dbf, gkey); } ! int GDBM_FNCT(delete,, const char *key) { GDBM_GKEY; return gdbm_delete(info->dbf, gkey); } ! char *GDBM_FNCT(firstkey) { datum gkey; char *key = NULL; --- 99,118 ---- return 0; } ! DBA_EXISTS_FUNC(gdbm) { GDBM_GKEY; return gdbm_exists(info->dbf, gkey); } ! DBA_DELETE_FUNC(gdbm) { GDBM_GKEY; return gdbm_delete(info->dbf, gkey); } ! DBA_FIRSTKEY_FUNC(gdbm) { datum gkey; char *key = NULL; *************** *** 124,130 **** return key; } ! char *GDBM_FNCT(nextkey,, const char *key) { char *nkey = NULL; --- 125,131 ---- return key; } ! DBA_NEXTKEY_FUNC(gdbm) { char *nkey = NULL; *************** *** 138,144 **** return nkey; } ! void GDBM_FNCT(optimize) { gdbm_reorganize(info->dbf); } --- 139,145 ---- return nkey; } ! DBA_OPTIMIZE_FUNC(gdbm) { gdbm_reorganize(info->dbf); } Index: php3/functions/dba_ndbm.c diff -c php3/functions/dba_ndbm.c:1.2 php3/functions/dba_ndbm.c:1.3 *** php3/functions/dba_ndbm.c:1.2 Fri Apr 9 05:50:52 1999 --- php3/functions/dba_ndbm.c Mon Apr 12 00:41:16 1999 *************** *** 27,33 **** +----------------------------------------------------------------------+ */ ! /* $Id: dba_ndbm.c,v 1.2 1999/04/09 09:50:52 sas Exp $ */ #include "php.h" --- 27,33 ---- +----------------------------------------------------------------------+ */ ! /* $Id: dba_ndbm.c,v 1.3 1999/04/12 04:41:16 sas Exp $ */ #include "php.h" *************** *** 45,51 **** #define NDBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = strlen(key) ! int NDBM_FNCT(open) { DBM *dbf; int gmode = 0; --- 45,51 ---- #define NDBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = strlen(key) ! DBA_OPEN_FUNC(ndbm) { DBM *dbf; int gmode = 0; *************** *** 72,83 **** return FAILURE; } ! void NDBM_FNCT(close) { dbm_close(info->dbf); } ! char *NDBM_FNCT(fetch,, const char *key, int *newlen) { datum gval; char *new = NULL; --- 72,83 ---- return FAILURE; } ! DBA_CLOSE_FUNC(ndbm) { dbm_close(info->dbf); } ! DBA_FETCH_FUNC(ndbm) { datum gval; char *new = NULL; *************** *** 92,98 **** return new; } ! int NDBM_FNCT(update,, const char *key, const char *val, const int vallen, const int mode) { datum gval; --- 92,98 ---- return new; } ! DBA_UPDATE_FUNC(ndbm) { datum gval; *************** *** 105,111 **** return 0; } ! int NDBM_FNCT(exists,, const char *key) { datum gval; NDBM_GKEY; --- 105,111 ---- return 0; } ! DBA_EXISTS_FUNC(ndbm) { datum gval; NDBM_GKEY; *************** *** 117,129 **** return 0; } ! int NDBM_FNCT(delete,, const char *key) { NDBM_GKEY; return dbm_delete(info->dbf, gkey); } ! char *NDBM_FNCT(firstkey) { datum gkey; char *key = NULL; --- 117,129 ---- return 0; } ! DBA_DELETE_FUNC(ndbm) { NDBM_GKEY; return dbm_delete(info->dbf, gkey); } ! DBA_FIRSTKEY_FUNC(ndbm) { datum gkey; char *key = NULL; *************** *** 136,142 **** return key; } ! char *NDBM_FNCT(nextkey,, const char *key) { char *nkey = NULL; NDBM_GKEY; --- 136,142 ---- return key; } ! DBA_NEXTKEY_FUNC(ndbm) { char *nkey = NULL; NDBM_GKEY; *************** *** 149,156 **** return nkey; } ! void NDBM_FNCT(optimize) { - /* dummy */ } #endif --- 149,155 ---- return nkey; } ! DBA_OPTIMIZE_FUNC(ndbm) { } #endif Index: php3/functions/php3_cdb.h diff -c php3/functions/php3_cdb.h:1.2 php3/functions/php3_cdb.h:1.3 *** php3/functions/php3_cdb.h:1.2 Fri Apr 9 05:50:52 1999 --- php3/functions/php3_cdb.h Mon Apr 12 00:41:16 1999 *************** *** 5,21 **** #include "php3_dba.h" ! #define CDB_FNCT(a,b...) _php3_cdb_##a(const dba_info *info b) ! ! int CDB_FNCT(open); ! void CDB_FNCT(close); ! char *CDB_FNCT(fetch,, const char *key, int *newlen); ! int CDB_FNCT(update,, const char *key, const char *val, const int vallen, const int mode); ! int CDB_FNCT(exists,, const char *key); ! char* CDB_FNCT(firstkey); ! char* CDB_FNCT(nextkey,, const char *key); ! int CDB_FNCT(delete,, const char *key); ! void CDB_FNCT(optimize); #endif --- 5,11 ---- #include "php3_dba.h" ! DBA_FUNCS(cdb); #endif Index: php3/functions/php3_dba.h diff -c php3/functions/php3_dba.h:1.3 php3/functions/php3_dba.h:1.4 *** php3/functions/php3_dba.h:1.3 Sat Apr 10 06:06:38 1999 --- php3/functions/php3_dba.h Mon Apr 12 00:41:16 1999 *************** *** 27,37 **** +----------------------------------------------------------------------+ */ ! /* $Id: php3_dba.h,v 1.3 1999/04/10 10:06:38 sas Exp $ */ #ifndef _DBA_H #define _DBA_H #include "internal_functions.h" typedef enum { --- 27,39 ---- +----------------------------------------------------------------------+ */ ! /* $Id: php3_dba.h,v 1.4 1999/04/12 04:41:16 sas Exp $ */ #ifndef _DBA_H #define _DBA_H + #if HAVE_DBA + #include "internal_functions.h" typedef enum { *************** *** 53,69 **** extern php3_module_entry dba_module_entry; #define dba_module_ptr &dba_module_entry ! extern PHP_FUNCTION(db_open); ! extern PHP_FUNCTION(db_popen); ! extern PHP_FUNCTION(db_close); ! extern PHP_FUNCTION(db_firstkey); ! extern PHP_FUNCTION(db_nextkey); ! extern PHP_FUNCTION(db_replace); ! extern PHP_FUNCTION(db_insert); ! extern PHP_FUNCTION(db_delete); ! extern PHP_FUNCTION(db_exists); ! extern PHP_FUNCTION(db_fetch); ! extern PHP_FUNCTION(db_optimize); #endif --- 55,107 ---- extern php3_module_entry dba_module_entry; #define dba_module_ptr &dba_module_entry + + /* common declarations+prototypes which must be used by modules */ ! #define DBA_OPEN_FUNC(x) \ ! extern int dba_open_##x(dba_info *info) ! #define DBA_CLOSE_FUNC(x) \ ! extern void dba_close_##x(dba_info *info) ! #define DBA_FETCH_FUNC(x) \ ! extern char *dba_fetch_##x(dba_info *info, char *key, int *newlen) ! #define DBA_UPDATE_FUNC(x) \ ! extern int dba_update_##x(dba_info *info, char *key, char *val, int vallen, int mode) ! #define DBA_EXISTS_FUNC(x) \ ! extern int dba_exists_##x(dba_info *info, char *key) ! #define DBA_DELETE_FUNC(x) \ ! extern int dba_delete_##x(dba_info *info, char *key) ! #define DBA_FIRSTKEY_FUNC(x) \ ! extern char *dba_firstkey_##x(dba_info *info, char *key) ! #define DBA_NEXTKEY_FUNC(x) \ ! extern char *dba_nextkey_##x(dba_info *info, char *key) ! #define DBA_OPTIMIZE_FUNC(x) \ ! extern void dba_optimize_##x(dba_info *info) ! ! #define DBA_FUNCS(x) \ ! DBA_OPEN_FUNC(x); \ ! DBA_CLOSE_FUNC(x); \ ! DBA_FETCH_FUNC(x); \ ! DBA_UPDATE_FUNC(x); \ ! DBA_DELETE_FUNC(x); \ ! DBA_EXISTS_FUNC(x); \ ! DBA_FIRSTKEY_FUNC(x); \ ! DBA_NEXTKEY_FUNC(x); \ ! DBA_OPTIMIZE_FUNC(x) ! ! extern PHP_FUNCTION(dba_open); ! extern PHP_FUNCTION(dba_popen); ! extern PHP_FUNCTION(dba_close); ! extern PHP_FUNCTION(dba_firstkey); ! extern PHP_FUNCTION(dba_nextkey); ! extern PHP_FUNCTION(dba_replace); ! extern PHP_FUNCTION(dba_insert); ! extern PHP_FUNCTION(dba_delete); ! extern PHP_FUNCTION(dba_exists); ! extern PHP_FUNCTION(dba_fetch); ! extern PHP_FUNCTION(dba_optimize); ! ! #else ! #define dba_module_ptr NULL ! #endif #endif Index: php3/functions/php3_dbm.h diff -c php3/functions/php3_dbm.h:1.2 php3/functions/php3_dbm.h:1.3 *** php3/functions/php3_dbm.h:1.2 Fri Apr 9 05:50:52 1999 --- php3/functions/php3_dbm.h Mon Apr 12 00:41:16 1999 *************** *** 5,21 **** #include "php3_dba.h" ! #define DBM_FNCT(a,b...) _php3_dbm_##a(const dba_info *info b) ! ! int DBM_FNCT(open); ! void DBM_FNCT(close); ! char *DBM_FNCT(fetch,, const char *key, int *newlen); ! int DBM_FNCT(update,, const char *key, const char *val, const int vallen, const int mode); ! int DBM_FNCT(exists,, const char *key); ! char* DBM_FNCT(firstkey); ! char* DBM_FNCT(nextkey,, const char *key); ! int DBM_FNCT(delete,, const char *key); ! void DBM_FNCT(optimize); #endif --- 5,11 ---- #include "php3_dba.h" ! DBA_FUNCS(dbm); #endif Index: php3/functions/php3_gdbm.h diff -c php3/functions/php3_gdbm.h:1.2 php3/functions/php3_gdbm.h:1.3 *** php3/functions/php3_gdbm.h:1.2 Fri Apr 9 05:50:52 1999 --- php3/functions/php3_gdbm.h Mon Apr 12 00:41:17 1999 *************** *** 5,21 **** #include "php3_dba.h" ! #define GDBM_FNCT(a,b...) _php3_gdbm_##a(const dba_info *info b) ! ! int GDBM_FNCT(open); ! void GDBM_FNCT(close); ! char *GDBM_FNCT(fetch,, const char *key, int *newlen); ! int GDBM_FNCT(update,, const char *key, const char *val, const int vallen, const int mode); ! int GDBM_FNCT(exists,, const char *key); ! char* GDBM_FNCT(firstkey); ! char* GDBM_FNCT(nextkey,, const char *key); ! int GDBM_FNCT(delete,, const char *key); ! void GDBM_FNCT(optimize); #endif --- 5,11 ---- #include "php3_dba.h" ! DBA_FUNCS(gdbm); #endif Index: php3/functions/php3_ndbm.h diff -c php3/functions/php3_ndbm.h:1.2 php3/functions/php3_ndbm.h:1.3 *** php3/functions/php3_ndbm.h:1.2 Fri Apr 9 05:50:52 1999 --- php3/functions/php3_ndbm.h Mon Apr 12 00:41:17 1999 *************** *** 5,21 **** #include "php3_dba.h" ! #define NDBM_FNCT(a,b...) _php3_ndbm_##a(const dba_info *info b) ! ! int NDBM_FNCT(open); ! void NDBM_FNCT(close); ! char *NDBM_FNCT(fetch,, const char *key, int *newlen); ! int NDBM_FNCT(update,, const char *key, const char *val, const int vallen, const int mode); ! int NDBM_FNCT(exists,, const char *key); ! char* NDBM_FNCT(firstkey); ! char* NDBM_FNCT(nextkey,, const char *key); ! int NDBM_FNCT(delete,, const char *key); ! void NDBM_FNCT(optimize); #endif --- 5,11 ---- #include "php3_dba.h" ! DBA_FUNCS(ndbm); #endif -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5021) next »