]> granicus.if.org Git - php/commitdiff
- moved to pecl
authorPierre Joye <pajoye@php.net>
Thu, 7 Aug 2008 23:48:40 +0000 (23:48 +0000)
committerPierre Joye <pajoye@php.net>
Thu, 7 Aug 2008 23:48:40 +0000 (23:48 +0000)
19 files changed:
ext/dbase/CREDITS [deleted file]
ext/dbase/config.m4 [deleted file]
ext/dbase/config.w32 [deleted file]
ext/dbase/dbase.c [deleted file]
ext/dbase/dbase.dsp [deleted file]
ext/dbase/dbf.h [deleted file]
ext/dbase/dbf_head.c [deleted file]
ext/dbase/dbf_head.h [deleted file]
ext/dbase/dbf_misc.c [deleted file]
ext/dbase/dbf_misc.h [deleted file]
ext/dbase/dbf_ndx.c [deleted file]
ext/dbase/dbf_ndx.h [deleted file]
ext/dbase/dbf_rec.c [deleted file]
ext/dbase/dbf_rec.h [deleted file]
ext/dbase/package.xml [deleted file]
ext/dbase/php_dbase.h [deleted file]
ext/dbase/tests/001.phpt [deleted file]
ext/dbase/tests/002.phpt [deleted file]
ext/dbase/tests/bug31754.phpt [deleted file]

diff --git a/ext/dbase/CREDITS b/ext/dbase/CREDITS
deleted file mode 100644 (file)
index ea6adca..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-dBase
-Jim Winstead
diff --git a/ext/dbase/config.m4 b/ext/dbase/config.m4
deleted file mode 100644 (file)
index 84202b3..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_ENABLE(dbase,whether to enable dbase support,
-[  --enable-dbase          Enable the bundled dbase library])
-
-if test "$PHP_DBASE" = "yes"; then
-  AC_DEFINE(DBASE,1,[ ])
-  PHP_NEW_EXTENSION(dbase, dbf_head.c dbf_rec.c dbf_misc.c dbf_ndx.c dbase.c, $ext_shared)
-fi
diff --git a/ext/dbase/config.w32 b/ext/dbase/config.w32
deleted file mode 100644 (file)
index 4a424a9..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// $Id$
-// vim:ft=javascript
-
-ARG_ENABLE("dbase", "Enable the bundled dbase library", "no");
-
-if (PHP_DBASE != "no") {
-       EXTENSION("dbase", "dbase.c dbf_head.c dbf_misc.c dbf_ndx.c dbf_rec.c");
-       AC_DEFINE('HAVE_DBASE', 1, 'dbase support');
-       ADD_FLAG("CFLAGS_DBASE", "/D DBASE=1");
-}
diff --git a/ext/dbase/dbase.c b/ext/dbase/dbase.c
deleted file mode 100644 (file)
index ad8be03..0000000
+++ /dev/null
@@ -1,932 +0,0 @@
-/*
-   +----------------------------------------------------------------------+
-   | PHP Version 5                                                        |
-   +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2008 The PHP Group                                |
-   +----------------------------------------------------------------------+
-   | This source file is subject to version 3.01 of the PHP license,      |
-   | that is bundled with this package in the file LICENSE, and is        |
-   | available through the world-wide-web at the following url:           |
-   | http://www.php.net/license/3_01.txt                                  |
-   | If you did not receive a copy of the PHP license and are unable to   |
-   | obtain it through the world-wide-web, please send a note to          |
-   | license@php.net so we can mail you a copy immediately.               |
-   +----------------------------------------------------------------------+
-   | Author: Jim Winstead <jimw@php.net>                                  |
-   +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "fopen_wrappers.h"
-#include "php_globals.h"
-
-#include <stdlib.h>
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#if DBASE
-#include "php_dbase.h"
-#include "dbf.h"
-#if defined(THREAD_SAFE)
-DWORD DbaseTls;
-static int numthreads=0;
-void *dbase_mutex;
-
-typedef struct dbase_global_struct{
-       int le_dbhead;
-}dbase_global_struct;
-
-#define DBase_GLOBAL(a) dbase_globals->a
-
-#define DBase_TLS_VARS \
-       dbase_global_struct *dbase_globals; \
-       dbase_globals=TlsGetValue(DbaseTls); 
-
-#else
-static int le_dbhead;
-#define DBase_GLOBAL(a) a
-#define DBase_TLS_VARS
-#endif
-
-#include <fcntl.h>
-#include <errno.h>
-
-
-static void _close_dbase(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
-       dbhead_t *dbhead = (dbhead_t *)rsrc->ptr;
-
-       close(dbhead->db_fd);
-       free_dbf_head(dbhead);
-}
-
-
-PHP_MINIT_FUNCTION(dbase)
-{
-#if defined(THREAD_SAFE)
-       dbase_global_struct *dbase_globals;
-#ifdef COMPILE_DL_DBASE
-       CREATE_MUTEX(dbase_mutex, "DBase_TLS");
-       SET_MUTEX(dbase_mutex);
-       numthreads++;
-       if (numthreads==1){
-       if ((DbaseTls=TlsAlloc())==0xFFFFFFFF){
-               FREE_MUTEX(dbase_mutex);
-               return 0;
-       }}
-       FREE_MUTEX(dbase_mutex);
-#endif
-       dbase_globals = (dbase_global_struct *) LocalAlloc(LPTR, sizeof(dbase_global_struct)); 
-       TlsSetValue(DbaseTls, (void *) dbase_globals);
-#endif
-       DBase_GLOBAL(le_dbhead) =
-               zend_register_list_destructors_ex(_close_dbase, NULL, "dbase", module_number);
-       return SUCCESS;
-}
-
-static PHP_MSHUTDOWN_FUNCTION(dbase)
-{
-#if defined(THREAD_SAFE)
-       dbase_global_struct *dbase_globals;
-       dbase_globals = TlsGetValue(DbaseTls); 
-       if (dbase_globals != 0) 
-               LocalFree((HLOCAL) dbase_globals); 
-#ifdef COMPILE_DL_DBASE
-       SET_MUTEX(dbase_mutex);
-       numthreads--;
-       if (!numthreads){
-       if (!TlsFree(DbaseTls)){
-               FREE_MUTEX(dbase_mutex);
-               return 0;
-       }}
-       FREE_MUTEX(dbase_mutex);
-#endif
-#endif
-       return SUCCESS;
-}
-
-/* {{{ proto int dbase_open(string name, int mode)
-   Opens a dBase-format database file */
-PHP_FUNCTION(dbase_open)
-{
-       zval **dbf_name, **options;
-       dbhead_t *dbh;
-       int handle;
-       DBase_TLS_VARS;
-
-       if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &dbf_name, &options) == FAILURE) {
-               WRONG_PARAM_COUNT;
-       }
-       convert_to_string_ex(dbf_name);
-       convert_to_long_ex(options);
-
-       if (!Z_STRLEN_PP(dbf_name)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "The filename cannot be empty.");
-               RETURN_FALSE;
-       }
-
-       if (Z_LVAL_PP(options) == 1) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot open %s in write-only mode", Z_STRVAL_PP(dbf_name));
-               RETURN_FALSE;
-       } else if (Z_LVAL_PP(options) < 0 || Z_LVAL_PP(options) > 3) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid access mode %ld", Z_LVAL_PP(options));
-               RETURN_FALSE;
-       }
-
-       if (php_check_open_basedir(Z_STRVAL_PP(dbf_name) TSRMLS_CC)) {
-               RETURN_FALSE;
-       }
-
-       dbh = dbf_open(Z_STRVAL_PP(dbf_name), Z_LVAL_PP(options) TSRMLS_CC);
-       if (dbh == NULL) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to open database %s", Z_STRVAL_PP(dbf_name));
-               RETURN_FALSE;
-       }
-
-       handle = zend_list_insert(dbh, DBase_GLOBAL(le_dbhead));
-       RETURN_LONG(handle);
-}
-/* }}} */
-
-/* {{{ proto bool dbase_close(int identifier)
-   Closes an open dBase-format database file */
-PHP_FUNCTION(dbase_close)
-{
-       zval **dbh_id;
-       dbhead_t *dbh;
-       int dbh_type;
-       DBase_TLS_VARS;
-
-       if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &dbh_id) == FAILURE)) {
-               WRONG_PARAM_COUNT;
-       }
-       convert_to_long_ex(dbh_id);
-       dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
-       if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %ld", Z_LVAL_PP(dbh_id));
-               RETURN_FALSE;
-       }
-
-       zend_list_delete(Z_LVAL_PP(dbh_id));
-       RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int dbase_numrecords(int identifier)
-   Returns the number of records in the database */
-PHP_FUNCTION(dbase_numrecords)
-{
-       zval **dbh_id;
-       dbhead_t *dbh;
-       int dbh_type;
-       DBase_TLS_VARS;
-
-       if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &dbh_id) == FAILURE)) {
-               WRONG_PARAM_COUNT;
-       }
-       convert_to_long_ex(dbh_id);
-       dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
-       if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %ld", Z_LVAL_PP(dbh_id));
-               RETURN_FALSE;
-       }
-
-       RETURN_LONG(dbh->db_records);
-}
-/* }}} */
-
-/* {{{ proto int dbase_numfields(int identifier)
-   Returns the number of fields (columns) in the database */
-PHP_FUNCTION(dbase_numfields)
-{
-       zval **dbh_id;
-       dbhead_t *dbh;
-       int dbh_type;
-       DBase_TLS_VARS;
-
-       if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &dbh_id) == FAILURE) {
-               WRONG_PARAM_COUNT;
-       }
-       convert_to_long_ex(dbh_id);
-       dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
-       if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %ld", Z_LVAL_PP(dbh_id));
-               RETURN_FALSE;
-       }
-
-       RETURN_LONG(dbh->db_nfields);
-}
-/* }}} */
-
-/* {{{ proto bool dbase_pack(int identifier)
-   Packs the database (deletes records marked for deletion) */
-PHP_FUNCTION(dbase_pack)
-{
-       zval **dbh_id;
-       dbhead_t *dbh;
-       int dbh_type;
-       DBase_TLS_VARS;
-
-       if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &dbh_id) == FAILURE) {
-               WRONG_PARAM_COUNT;
-       }
-       convert_to_long_ex(dbh_id);
-       dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
-       if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %ld", Z_LVAL_PP(dbh_id));
-               RETURN_FALSE;
-       }
-
-        pack_dbf(dbh);
-        put_dbf_info(dbh);
-       RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool dbase_add_record(int identifier, array data)
-   Adds a record to the database */
-PHP_FUNCTION(dbase_add_record)
-{
-       zval **dbh_id, **fields, **field;
-       dbhead_t *dbh;
-       int dbh_type;
-
-       int num_fields;
-       dbfield_t *dbf, *cur_f;
-       char *cp, *t_cp;
-       int i;
-       DBase_TLS_VARS;
-
-       if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &dbh_id, &fields) == FAILURE) {
-               WRONG_PARAM_COUNT;
-       }
-       convert_to_long_ex(dbh_id);
-
-       if (Z_TYPE_PP(fields) != IS_ARRAY) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument two must be of type 'Array'");
-               RETURN_FALSE;
-       }
-
-       dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
-       if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %ld", Z_LVAL_PP(dbh_id));
-               RETURN_FALSE;
-       }
-
-       num_fields = zend_hash_num_elements(Z_ARRVAL_PP(fields));
-
-       if (num_fields != dbh->db_nfields) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong number of fields specified");
-               RETURN_FALSE;
-       }
-
-       cp = t_cp = (char *)emalloc(dbh->db_rlen + 1);
-       *t_cp++ = VALID_RECORD;
-
-       dbf = dbh->db_fields;
-       for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) {
-               zval tmp;
-               if (zend_hash_index_find(Z_ARRVAL_PP(fields), i, (void **)&field) == FAILURE) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "unexpected error");
-                       efree(cp);
-                       RETURN_FALSE;
-               }
-               
-               tmp = **field;
-               zval_copy_ctor(&tmp);
-               convert_to_string(&tmp);
-               snprintf(t_cp, cur_f->db_flen+1, cur_f->db_format, Z_STRVAL(tmp));
-               zval_dtor(&tmp); 
-               t_cp += cur_f->db_flen;
-       }
-
-       dbh->db_records++;
-       if (put_dbf_record(dbh, dbh->db_records, cp) < 0) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to put record at %ld", dbh->db_records);
-               efree(cp);
-               RETURN_FALSE;
-       }
-
-       put_dbf_info(dbh);
-       efree(cp);
-
-       RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool dbase_replace_record(int identifier, array data, int recnum)
-   Replaces a record to the database */
-PHP_FUNCTION(dbase_replace_record)
-{
-       zval **dbh_id, **fields, **field, **recnum;
-       dbhead_t *dbh;
-       int dbh_type;
-
-       int num_fields;
-       dbfield_t *dbf, *cur_f;
-       char *cp, *t_cp;
-       int i;
-       DBase_TLS_VARS;
-
-       if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &dbh_id, &fields, &recnum) == FAILURE) {
-               WRONG_PARAM_COUNT;
-       }
-       convert_to_long_ex(dbh_id);
-       convert_to_long_ex(recnum);
-
-       if (Z_TYPE_PP(fields) != IS_ARRAY) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument two must be of type 'Array'");
-               RETURN_FALSE;
-       }
-
-       dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
-       if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %ld", Z_LVAL_PP(dbh_id));
-               RETURN_FALSE;
-       }
-
-       num_fields = zend_hash_num_elements(Z_ARRVAL_PP(fields));
-
-       if (num_fields != dbh->db_nfields) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong number of fields specified");
-               RETURN_FALSE;
-       }
-
-       cp = t_cp = (char *)emalloc(dbh->db_rlen + 1);
-       *t_cp++ = VALID_RECORD;
-
-       dbf = dbh->db_fields;
-       for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) {
-               if (zend_hash_index_find(Z_ARRVAL_PP(fields), i, (void **)&field) == FAILURE) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "unexpected error");
-                       efree(cp);
-                       RETURN_FALSE;
-               }
-               convert_to_string_ex(field);
-               snprintf(t_cp, cur_f->db_flen+1, cur_f->db_format, Z_STRVAL_PP(field)); 
-               t_cp += cur_f->db_flen;
-       }
-
-       if (put_dbf_record(dbh, Z_LVAL_PP(recnum), cp) < 0) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to put record at %ld", dbh->db_records);
-               efree(cp);
-               RETURN_FALSE;
-       }
-
-        put_dbf_info(dbh);
-       efree(cp);
-
-       RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool dbase_delete_record(int identifier, int record)
-   Marks a record to be deleted */
-PHP_FUNCTION(dbase_delete_record)
-{
-       zval **dbh_id, **record;
-       dbhead_t *dbh;
-       int dbh_type;
-       DBase_TLS_VARS;
-
-       if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &dbh_id, &record) == FAILURE)) {
-               WRONG_PARAM_COUNT;
-       }
-       convert_to_long_ex(dbh_id);
-       convert_to_long_ex(record);
-
-       dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
-       if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %ld", Z_LVAL_PP(dbh_id));
-               RETURN_FALSE;
-       }
-
-       if (del_dbf_record(dbh, Z_LVAL_PP(record)) < 0) {
-               if (Z_LVAL_PP(record) > dbh->db_records) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "record %ld out of bounds", Z_LVAL_PP(record));
-               } else {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to delete record %ld", Z_LVAL_PP(record));
-               }
-               RETURN_FALSE;
-       }
-
-        put_dbf_info(dbh);
-       RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ php_dbase_get_record
- */  
-static void php_dbase_get_record(INTERNAL_FUNCTION_PARAMETERS, int assoc)
-{
-       zval **dbh_id, **record;
-       dbhead_t *dbh;
-       int dbh_type;
-       dbfield_t *dbf, *cur_f;
-       char *data, *fnp, *str_value;
-       size_t cursize = 0;
-       long overflow_test;
-       int errno_save;
-       DBase_TLS_VARS;
-
-       if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &dbh_id, &record) == FAILURE)) {
-               WRONG_PARAM_COUNT;
-       }
-       convert_to_long_ex(dbh_id);
-       convert_to_long_ex(record);
-
-       dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
-       if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %ld", Z_LVAL_PP(dbh_id));
-               RETURN_FALSE;
-       }
-
-       if ((data = get_dbf_record(dbh, Z_LVAL_PP(record))) == NULL) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to read bad record %ld", Z_LVAL_PP(record));
-               RETURN_FALSE;
-       }
-
-       dbf = dbh->db_fields;
-
-       array_init(return_value);
-
-       fnp = NULL;
-       for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) {
-               /* get the value */
-               str_value = (char *)emalloc(cur_f->db_flen + 1);
-
-               if(cursize <= (unsigned)cur_f->db_flen) {
-                       cursize = cur_f->db_flen + 1;
-                       fnp = erealloc(fnp, cursize);
-               }
-               snprintf(str_value, cursize, cur_f->db_format, get_field_val(data, cur_f, fnp));
-
-               /* now convert it to the right php internal type */
-               switch (cur_f->db_type) {
-                       case 'C':
-                       case 'D':
-                               if (!assoc) {
-                                       add_next_index_string(return_value, str_value, 1);
-                               } else {
-                                       add_assoc_string(return_value, cur_f->db_fname, str_value, 1);
-                               }
-                               break;
-                       case 'I':       /* FALLS THROUGH */
-                       case 'N':
-                               if (cur_f->db_fdc == 0) {
-                                       /* Large integers in dbase can be larger than long */
-                                       errno_save = errno;
-                                       overflow_test = strtol(str_value, NULL, 10);
-                                       if (errno == ERANGE) {
-                                           /* If the integer is too large, keep it as string */
-                                               if (!assoc) {
-                                                   add_next_index_string(return_value, str_value, 1);
-                                               } else {
-                                                   add_assoc_string(return_value, cur_f->db_fname, str_value, 1);
-                                               }
-                                       } else {
-                                               if (!assoc) {
-                                                   add_next_index_long(return_value, overflow_test);
-                                               } else {
-                                                   add_assoc_long(return_value, cur_f->db_fname, overflow_test);
-                                               }
-                                       }
-                                       errno = errno_save;
-                               } else {
-                                       if (!assoc) {
-                                               add_next_index_double(return_value, atof(str_value));
-                                       } else {
-                                               add_assoc_double(return_value, cur_f->db_fname, atof(str_value));
-                                       }
-                               }
-                               break;
-                       case 'F':
-                               if (!assoc) {
-                                       add_next_index_double(return_value, atof(str_value));
-                               } else {
-                                       add_assoc_double(return_value, cur_f->db_fname, atof(str_value));
-                               }
-                               break;
-                       case 'L':       /* we used to FALL THROUGH, but now we check for T/Y and F/N
-                                                  and insert 1 or 0, respectively.  db_fdc is the number of
-                                                  decimals, which we don't care about.      3/14/2001 LEW */
-                               if ((*str_value == 'T') || (*str_value == 'Y')) {
-                                       if (!assoc) {
-                                               add_next_index_long(return_value, strtol("1", NULL, 10));
-                                       } else {
-                                               add_assoc_long(return_value, cur_f->db_fname,strtol("1", NULL, 10));
-                                       }
-                               } else {
-                                       if ((*str_value == 'F') || (*str_value == 'N')) {
-                                               if (!assoc) {
-                                                       add_next_index_long(return_value, strtol("0", NULL, 10));
-                                               } else {
-                                                       add_assoc_long(return_value, cur_f->db_fname,strtol("0", NULL, 10));
-                                               }
-                                       } else {
-                                               if (!assoc) {
-                                                       add_next_index_long(return_value, strtol(" ", NULL, 10));
-                                               } else {
-                                                       add_assoc_long(return_value, cur_f->db_fname,strtol(" ", NULL, 10));
-                                               }
-                                       }
-                               }
-                               break;
-                       case 'M':
-                               /* this is a memo field. don't know how to deal with this yet */
-                               break;
-                       default:
-                               /* should deal with this in some way */
-                               break;
-               }
-               efree(str_value);
-       }
-
-       efree(fnp);
-
-       /* mark whether this record was deleted */
-       if (data[0] == '*') {
-               add_assoc_long(return_value, "deleted", 1);
-       } else {
-               add_assoc_long(return_value, "deleted", 0);
-       }
-
-       free(data);
-}
-/* }}} */
-/* {{{ proto array dbase_get_record(int identifier, int record)
-   Returns an array representing a record from the database */
-PHP_FUNCTION(dbase_get_record)
-{
-       php_dbase_get_record(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* From Martin Kuba <makub@aida.inet.cz> */
-/* {{{ proto array dbase_get_record_with_names(int identifier, int record)
-   Returns an associative array representing a record from the database */
-PHP_FUNCTION(dbase_get_record_with_names)
-{
-       php_dbase_get_record(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto bool dbase_create(string filename, array fields)
-   Creates a new dBase-format database file */
-PHP_FUNCTION(dbase_create)
-{
-       zval **filename, **fields, **field, **value;
-       int fd;
-       dbhead_t *dbh;
-
-       int num_fields;
-       dbfield_t *dbf, *cur_f;
-       int i, rlen, handle;
-       DBase_TLS_VARS;
-
-       if (ZEND_NUM_ARGS() != 2 || (zend_get_parameters_ex(2, &filename, &fields) == FAILURE)) {
-               WRONG_PARAM_COUNT;
-       }
-       convert_to_string_ex(filename);
-
-       if (Z_TYPE_PP(fields) != IS_ARRAY) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array as second parameter");
-               RETURN_FALSE;
-       }
-
-       if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
-               RETURN_FALSE;
-       }
-
-       if ((fd = VCWD_OPEN_MODE(Z_STRVAL_PP(filename), O_BINARY|O_RDWR|O_CREAT, 0644)) < 0) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create database (%d): %s", errno, strerror(errno));
-               RETURN_FALSE;
-       }
-
-       num_fields = zend_hash_num_elements(Z_ARRVAL_PP(fields));
-
-       if (num_fields <= 0) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create database without fields");
-               RETURN_FALSE;
-       }
-
-       /* have to use regular malloc() because this gets free()d by
-          code in the dbase library */
-       dbh = (dbhead_t *)malloc(sizeof(dbhead_t));
-       dbf = (dbfield_t *)malloc(sizeof(dbfield_t) * num_fields);
-       if (!dbh || !dbf) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate memory for header info");
-               RETURN_FALSE;
-       }
-       
-       /* initialize the header structure */
-       dbh->db_fields = dbf;
-       dbh->db_fd = fd;
-       dbh->db_dbt = DBH_TYPE_NORMAL;
-       strcpy(dbh->db_date, "19930818");
-       dbh->db_records = 0;
-       dbh->db_nfields = num_fields;
-       dbh->db_hlen = sizeof(struct dbf_dhead) + 1 + num_fields * sizeof(struct dbf_dfield);
-
-       rlen = 1;
-       /**
-        * Patch by greg@darkphoton.com
-        **/
-       /* make sure that the db_format entries for all fields are set to NULL to ensure we
-       don't seg fault if there's an error and we need to call free_dbf_head() before all
-       fields have been defined. */
-       for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) {
-               cur_f->db_format = NULL;
-       }
-       /**
-        * end patch
-        */
-
-
-       for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) {
-               /* look up the first field */
-               if (zend_hash_index_find(Z_ARRVAL_PP(fields), i, (void **)&field) == FAILURE) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to find field %d", i);
-                       free_dbf_head(dbh);
-                       RETURN_FALSE;
-               }
-
-               /* field name */
-               if (zend_hash_index_find(Z_ARRVAL_PP(field), 0, (void **)&value) == FAILURE) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "expected field name as first element of list in field %d", i);
-                       free_dbf_head(dbh);
-                       RETURN_FALSE;
-               }
-               convert_to_string_ex(value);
-               if (Z_STRLEN_PP(value) > 10 || Z_STRLEN_PP(value) == 0) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid field name '%s' (must be non-empty and less than or equal to 10 characters)", Z_STRVAL_PP(value));
-                       free_dbf_head(dbh);
-                       RETURN_FALSE;
-               }
-               copy_crimp(cur_f->db_fname, Z_STRVAL_PP(value), Z_STRLEN_PP(value));
-
-               /* field type */
-               if (zend_hash_index_find(Z_ARRVAL_PP (field), 1, (void **)&value) == FAILURE) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "expected field type as second element of list in field %d", i);
-                       RETURN_FALSE;
-               }
-               convert_to_string_ex(value);
-               cur_f->db_type = toupper(*Z_STRVAL_PP(value));
-
-               cur_f->db_fdc = 0;
-
-               /* verify the field length */
-               switch (cur_f->db_type) {
-               case 'L':
-                       cur_f->db_flen = 1;
-                       break;
-               case 'M':
-                       cur_f->db_flen = 10;
-                       dbh->db_dbt = DBH_TYPE_MEMO;
-                       /* should create the memo file here, probably */
-                       break;
-               case 'D':
-                       cur_f->db_flen = 8;
-                       break;
-               case 'F':
-                       cur_f->db_flen = 20;
-                       break;
-               case 'N':
-               case 'C':
-                       /* field length */
-                       if (zend_hash_index_find(Z_ARRVAL_PP (field), 2, (void **)&value) == FAILURE) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "expected field length as third element of list in field %d", i);
-                               free_dbf_head(dbh);
-                               RETURN_FALSE;
-                       }
-                       convert_to_long_ex(value);
-                       cur_f->db_flen = Z_LVAL_PP(value);
-
-                       if (cur_f->db_type == 'N') {
-                               if (zend_hash_index_find(Z_ARRVAL_PP (field), 3, (void **)&value) == FAILURE) {
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "expected field precision as fourth element of list in field %d", i);
-                                       free_dbf_head(dbh);
-                                       RETURN_FALSE;
-                               }
-                               convert_to_long_ex(value);
-                               cur_f->db_fdc = Z_LVAL_PP(value);
-                       }
-                       break;
-               default:
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "unknown field type '%c'", cur_f->db_type);
-                       free_dbf_head(dbh);
-                       RETURN_FALSE;
-               }
-               cur_f->db_foffset = rlen;
-               rlen += cur_f->db_flen;
-       
-               cur_f->db_format = get_dbf_f_fmt(cur_f);
-       }
-
-       dbh->db_rlen = rlen;
-       put_dbf_info(dbh);
-
-       handle = zend_list_insert(dbh, DBase_GLOBAL(le_dbhead));
-       RETURN_LONG(handle);
-}
-/* }}} */
-
-/* {{{ arginfo */
-static
-ZEND_BEGIN_ARG_INFO(arginfo_dbase_open, 0)
-       ZEND_ARG_INFO(0, name)
-       ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_dbase_close, 0)
-       ZEND_ARG_INFO(0, identifier)
-ZEND_END_ARG_INFO()
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_dbase_numrecords, 0)
-       ZEND_ARG_INFO(0, identifier)
-ZEND_END_ARG_INFO()
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_dbase_numfields, 0)
-       ZEND_ARG_INFO(0, identifier)
-ZEND_END_ARG_INFO()
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_dbase_pack, 0)
-       ZEND_ARG_INFO(0, identifier)
-ZEND_END_ARG_INFO()
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_dbase_add_record, 0)
-       ZEND_ARG_INFO(0, identifier)
-       ZEND_ARG_ARRAY_INFO(0, data, 0)
-ZEND_END_ARG_INFO()
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_dbase_replace_record, 0)
-       ZEND_ARG_INFO(0, identifier)
-       ZEND_ARG_ARRAY_INFO(0, data, 0)
-       ZEND_ARG_INFO(0, recnum)
-ZEND_END_ARG_INFO()
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_dbase_delete_record, 0)
-       ZEND_ARG_INFO(0, identifier)
-       ZEND_ARG_INFO(0, record)
-ZEND_END_ARG_INFO()
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_dbase_get_record, 0)
-       ZEND_ARG_INFO(0, identifier)
-       ZEND_ARG_INFO(0, record)
-ZEND_END_ARG_INFO()
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_dbase_get_record_with_names, 0)
-       ZEND_ARG_INFO(0, identifier)
-       ZEND_ARG_INFO(0, record)
-ZEND_END_ARG_INFO()
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_dbase_create, 0)
-       ZEND_ARG_INFO(0, filename)
-       ZEND_ARG_ARRAY_INFO(0, fields, 0)
-ZEND_END_ARG_INFO()
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_dbase_get_header_info, 0)
-       ZEND_ARG_INFO(0, database_handle)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
-/* {{{ dbase_functions[]
- */
-const zend_function_entry dbase_functions[] = {
-       PHP_FE(dbase_open,                                                              arginfo_dbase_open)
-       PHP_FE(dbase_create,                                                    arginfo_dbase_create)
-       PHP_FE(dbase_close,                                                             arginfo_dbase_close)
-       PHP_FE(dbase_numrecords,                                                arginfo_dbase_numrecords)
-       PHP_FE(dbase_numfields,                                                 arginfo_dbase_numfields)
-       PHP_FE(dbase_add_record,                                                arginfo_dbase_add_record)
-       PHP_FE(dbase_replace_record,                                    arginfo_dbase_replace_record)
-       PHP_FE(dbase_get_record,                                                arginfo_dbase_get_record)
-       PHP_FE(dbase_get_record_with_names,                             arginfo_dbase_get_record_with_names)
-       PHP_FE(dbase_delete_record,                                             arginfo_dbase_delete_record)
-       PHP_FE(dbase_pack,                                                              arginfo_dbase_pack)
-       PHP_FE(dbase_get_header_info,                                   arginfo_dbase_get_header_info)
-       {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* Added by Zak Greant <zak@php.net> */
-/* {{{ proto array dbase_get_header_info(int database_handle)
- */
-PHP_FUNCTION(dbase_get_header_info)
-{
-       zval            **dbh_id, *row;
-       dbfield_t       *dbf, *cur_f;
-       dbhead_t        *dbh;
-       int             dbh_type;
-       DBase_TLS_VARS; 
-
-       if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &dbh_id) == FAILURE)) {
-               WRONG_PARAM_COUNT;
-       }
-       convert_to_long_ex(dbh_id);
-
-       dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
-       if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %ld", Z_LVAL_PP(dbh_id));
-               RETURN_FALSE;
-       }
-
-       array_init(return_value);
-
-       dbf = dbh->db_fields;
-       for (cur_f = dbf; cur_f < &dbh->db_fields[dbh->db_nfields]; ++cur_f) {
-               MAKE_STD_ZVAL(row);
-               array_init(row);
-               
-               add_next_index_zval(return_value, row);
-               
-               /* field name */
-               add_assoc_string(row, "name", cur_f->db_fname, 1);
-               
-               /* field type */
-               switch (cur_f->db_type) {
-                       case 'C': add_assoc_string(row, "type", "character", 1);        break;
-                       case 'D': add_assoc_string(row, "type", "date", 1);             break;
-                       case 'I': add_assoc_string(row, "type", "integer", 1);          break;
-                       case 'N': add_assoc_string(row, "type", "number", 1);           break;
-                       case 'L': add_assoc_string(row, "type", "boolean", 1);          break;
-                       case 'M': add_assoc_string(row, "type", "memo", 1);                     break;
-                       case 'F': add_assoc_string(row, "type", "float", 1);     break;
-                       default:  add_assoc_string(row, "type", "unknown", 1);          break;
-               }
-               
-               /* length of field */
-               add_assoc_long(row, "length", cur_f->db_flen);
-               
-               /* number of decimals in field */
-               switch (cur_f->db_type) {
-                       case 'N':
-                       case 'I':
-                               add_assoc_long(row, "precision", cur_f->db_fdc);
-                               break;
-                       default:
-                               add_assoc_long(row, "precision", 0);
-               }
-
-               /* format for printing %s etc */
-               add_assoc_string(row, "format", cur_f->db_format, 1);
-               
-               /* offset within record */
-               add_assoc_long(row, "offset", cur_f->db_foffset);
-       }
-}
-/* }}} */
-
-zend_module_entry dbase_module_entry = {
-       STANDARD_MODULE_HEADER,
-       "dbase", dbase_functions, PHP_MINIT(dbase), PHP_MSHUTDOWN(dbase), NULL, NULL, NULL, NO_VERSION_YET, STANDARD_MODULE_PROPERTIES
-};
-
-
-#ifdef COMPILE_DL_DBASE
-ZEND_GET_MODULE(dbase)
-
-#if defined(PHP_WIN32) && defined(THREAD_SAFE)
-
-/*NOTE: You should have an odbc.def file where you
-export DllMain*/
-BOOL WINAPI DllMain(HANDLE hModule, 
-                      DWORD  ul_reason_for_call, 
-                      LPVOID lpReserved)
-{
-    return 1;
-}
-#endif
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dbase/dbase.dsp b/ext/dbase/dbase.dsp
deleted file mode 100644 (file)
index 7c75304..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-# Microsoft Developer Studio Project File - Name="dbase" - Package Owner=<4>\r
-# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
-# ** DO NOT EDIT **\r
-\r
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102\r
-\r
-CFG=dbase - Win32 Release_TS\r
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
-!MESSAGE use the Export Makefile command and run\r
-!MESSAGE \r
-!MESSAGE NMAKE /f "dbase.mak".\r
-!MESSAGE \r
-!MESSAGE You can specify a configuration when running NMAKE\r
-!MESSAGE by defining the macro CFG on the command line. For example:\r
-!MESSAGE \r
-!MESSAGE NMAKE /f "dbase.mak" CFG="dbase - Win32 Release_TS"\r
-!MESSAGE \r
-!MESSAGE Possible choices for configuration are:\r
-!MESSAGE \r
-!MESSAGE "dbase - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")\r
-!MESSAGE "dbase - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")\r
-!MESSAGE \r
-\r
-# Begin Project\r
-# PROP AllowPerConfigDependencies 0\r
-# PROP Scc_ProjName ""\r
-# PROP Scc_LocalPath ""\r
-CPP=cl.exe\r
-MTL=midl.exe\r
-RSC=rc.exe\r
-\r
-!IF  "$(CFG)" == "dbase - Win32 Release_TS"\r
-\r
-# PROP BASE Use_MFC 0\r
-# PROP BASE Use_Debug_Libraries 0\r
-# PROP BASE Output_Dir "Release_TS"\r
-# PROP BASE Intermediate_Dir "Release_TS"\r
-# PROP BASE Ignore_Export_Lib 0\r
-# PROP BASE Target_Dir ""\r
-# PROP Use_MFC 0\r
-# PROP Use_Debug_Libraries 0\r
-# PROP Output_Dir "Release_TS"\r
-# PROP Intermediate_Dir "Release_TS"\r
-# PROP Ignore_Export_Lib 0\r
-# PROP Target_Dir ""\r
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DBASE" /D ZTS=1 /YX /FD /c\r
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "DBASE_EXPORTS" /D "COMPILE_DL_DBASE" /D ZTS=1 /D HAVE_DBASE=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D DBASE=1 /YX /FD /c\r
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
-# ADD BASE RSC /l 0x406 /d "NDEBUG"\r
-# ADD RSC /l 0x406 /d "NDEBUG"\r
-BSC32=bscmake.exe\r
-# ADD BASE BSC32 /nologo\r
-# ADD BSC32 /nologo\r
-LINK32=link.exe\r
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386\r
-# ADD LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dbase.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"\r
-# SUBTRACT LINK32 /pdb:none\r
-\r
-!ELSEIF  "$(CFG)" == "dbase - Win32 Debug_TS"\r
-\r
-# PROP BASE Use_MFC 0\r
-# PROP BASE Use_Debug_Libraries 0\r
-# PROP BASE Output_Dir "Debug_TS"\r
-# PROP BASE Intermediate_Dir "Debug_TS"\r
-# PROP BASE Ignore_Export_Lib 0\r
-# PROP BASE Target_Dir ""\r
-# PROP Use_MFC 0\r
-# PROP Use_Debug_Libraries 0\r
-# PROP Output_Dir "Debug_TS"\r
-# PROP Intermediate_Dir "Debug_TS"\r
-# PROP Ignore_Export_Lib 0\r
-# PROP Target_Dir ""\r
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DBASE" /D ZTS=1 /YX /FD /c\r
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DBASE_EXPORTS" /D "COMPILE_DL_DBASE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBASE=1 /D DBASE=1 /FR /YX /FD /c\r
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
-# ADD BASE RSC /l 0x406 /d "NDEBUG"\r
-# ADD RSC /l 0x406 /d "NDEBUG"\r
-BSC32=bscmake.exe\r
-# ADD BASE BSC32 /nologo\r
-# ADD BSC32 /nologo\r
-LINK32=link.exe\r
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386\r
-# ADD LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_dbase.dll" /libpath:"..\..\Debug_TS"\r
-# SUBTRACT LINK32 /pdb:none\r
-\r
-!ENDIF \r
-\r
-# Begin Target\r
-\r
-# Name "dbase - Win32 Release_TS"\r
-# Name "dbase - Win32 Debug_TS"\r
-# Begin Group "Source Files"\r
-\r
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
-# Begin Source File\r
-\r
-SOURCE=.\dbase.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\dbf_head.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\dbf_misc.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\dbf_ndx.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\dbf_rec.c\r
-# End Source File\r
-# End Group\r
-# Begin Group "Header Files"\r
-\r
-# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
-# Begin Source File\r
-\r
-SOURCE=.\dbf.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\dbf_head.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\dbf_misc.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\dbf_ndx.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\dbf_rec.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\php_dbase.h\r
-# End Source File\r
-# End Group\r
-# Begin Group "Resource Files"\r
-\r
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
-# End Group\r
-# End Target\r
-# End Project\r
diff --git a/ext/dbase/dbf.h b/ext/dbase/dbf.h
deleted file mode 100644 (file)
index c7ee8fd..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 1991, 1992, 1993 Brad Eacker,
- *              (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-
-/*
- * dbf header structure on disk (pc dbase III)
- *
- *  Basic info taken from:
- *     "File Formats for Popular PC Software"
- *     Jeff Walden
- *     (c) 1986 John Wiley & Sons, Inc.
- */
-
-#ifndef        DBF_H_
-#define        DBF_H_
-
-#include <stdlib.h>
-#include <string.h>
-#ifdef WIN32
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-/* So we can use O_BINARY on non-Win32 systems. */
-#if !defined(O_BINARY) && !defined(WIN32)
-#define O_BINARY (0)
-#endif
-
-struct dbf_dhead {
-       char    dbh_dbt;                /* memo (dbt) file present */
-       char    dbh_date[3];            /* last update YY, MM, DD */
-       char    dbh_records[4];         /* number of records LE */
-       char    dbh_hlen[2];            /* header length LE */
-       char    dbh_rlen[2];            /* record length LE */
-       char    dbh_res[20];            /* padding */
-};
-#define        DBH_DATE_YEAR   0               /* byte offset for year in dbh_date */
-#define        DBH_DATE_MONTH  1
-#define        DBH_DATE_DAY    2
-
-/*
- * field description on disk
- */
-
-#define        DBF_NAMELEN     11
-
-struct dbf_dfield {
-       char    dbf_name[DBF_NAMELEN];  /* name of field */
-       char    dbf_type;               /* type of field */
-       char    dbf_fda[4];             /* something for dbase III */
-       char    dbf_flen[2];            /* field length [and decimal if N] */
-       char    dbf_res[14];            /* padding */
-};
-
-struct db_field {
-       char    db_fname[DBF_NAMELEN+1];        /* 0 terminated */
-       char    db_type;                /* type of field */
-       int     db_flen;                /* length of field */
-       int     db_fdc;                 /* number of decimals in field */
-
-       char    *db_format;             /* format for printing %s etc */
-       int     db_foffset;             /* offset within record */
-};
-typedef struct db_field        dbfield_t;
-
-struct db_head {
-       int     db_fd;
-       unsigned char   db_dbt;                 /* dbt present */
-       char    db_date[9];             /* date of last update in db format */
-       long    db_records;             /* number of records */
-       int     db_hlen;                /* header length */
-       int     db_rlen;                /* record length */
-
-       int     db_nfields;             /* number of fields */
-       dbfield_t       *db_fields;     /* field info */
-       char    *db_name;               /* name of dbf file */
-       int     db_cur_rec;             /* current record */
-};
-typedef struct db_head dbhead_t;
-
-#define        DBH_TYPE_NORMAL 0x03
-#define        DBH_TYPE_MEMO   0x83
-
-#define        VALID_RECORD    ' '
-#define        DELETED_RECORD  '*'
-
-#include "dbf_head.h"
-#include "dbf_misc.h"
-#include "dbf_rec.h"
-
-#endif /* DBF_H_ */
diff --git a/ext/dbase/dbf_head.c b/ext/dbase/dbf_head.c
deleted file mode 100644 (file)
index d3a7d1d..0000000
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Copyright (c) 1991, 1992, 1993 Brad Eacker,
- *              (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "php.h"
-#include "dbf.h"
-
-void free_dbf_head(dbhead_t *dbh);
-int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf);
-
-/*
- * get the header info from the file
- *     basic header info & field descriptions
- */
-dbhead_t *get_dbf_head(int fd)
-{
-       dbhead_t *dbh;
-       struct dbf_dhead  dbhead;
-       dbfield_t *dbf, *cur_f, *tdbf;
-       int ret, nfields, offset, gf_retval;
-
-       if ((dbh = (dbhead_t *)calloc(1, sizeof(dbhead_t))) == NULL)
-               return NULL;
-       if (lseek(fd, 0, 0) < 0) {
-               free(dbh);
-               return NULL;
-       }
-       if ((ret = read(fd, &dbhead, sizeof(dbhead))) <= 0) {
-               free(dbh);
-               return NULL;
-       }
-
-       /* build in core info */
-       dbh->db_fd = fd;
-       dbh->db_dbt = dbhead.dbh_dbt;
-       dbh->db_records = get_long(dbhead.dbh_records);
-       dbh->db_hlen = get_short(dbhead.dbh_hlen);
-       dbh->db_rlen = get_short(dbhead.dbh_rlen);
-
-       db_set_date(dbh->db_date, dbhead.dbh_date[DBH_DATE_YEAR] + 1900,
-               dbhead.dbh_date[DBH_DATE_MONTH],
-               dbhead.dbh_date[DBH_DATE_DAY]);
-
-       /* malloc enough memory for the maximum number of fields:
-          32 * 1024 = 32K dBase5 (for Win) seems to allow that many */
-       tdbf = (dbfield_t *)calloc(1, sizeof(dbfield_t)*1024);
-       
-       offset = 1;
-       nfields = 0;
-       gf_retval = 0;
-       for (cur_f = tdbf; gf_retval < 2 && nfields < 1024; cur_f++) {
-               gf_retval = get_dbf_field(dbh, cur_f);
-
-               if (gf_retval < 0) {
-                       free_dbf_head(dbh);
-                       free(tdbf);
-                       return NULL;
-               }
-               if (gf_retval != 2 ) {
-                       cur_f->db_foffset = offset;
-                       offset += cur_f->db_flen;
-                       nfields++;
-               }
-       }
-       dbh->db_nfields = nfields;
-       
-       /* malloc the right amount of space for records, copy and destroy old */
-       dbf = (dbfield_t *)malloc(sizeof(dbfield_t)*nfields);
-       memcpy(dbf, tdbf, sizeof(dbfield_t)*nfields);
-       free(tdbf);
-
-       dbh->db_fields = dbf;
-
-       return dbh;
-}
-
-/*
- * free up the header info built above
- */
-void free_dbf_head(dbhead_t *dbh)
-{
-       dbfield_t *dbf, *cur_f;
-       int nfields;
-
-       dbf = dbh->db_fields;
-       nfields = dbh->db_nfields;
-       for (cur_f = dbf; cur_f < &dbf[nfields]; cur_f++) {
-               if (cur_f->db_format) {
-                       free(cur_f->db_format);
-               }
-       }
-       
-       free(dbf);
-       free(dbh);
-}
-
-/*
- * put out the header info
- */
-int put_dbf_head(dbhead_t *dbh)
-{
-       int fd = dbh->db_fd;
-       struct dbf_dhead  dbhead;
-       int     ret;
-
-       memset (&dbhead, 0, sizeof(dbhead));
-
-       /* build on disk info */
-       dbhead.dbh_dbt = dbh->db_dbt;
-       put_long(dbhead.dbh_records, dbh->db_records);
-       put_short(dbhead.dbh_hlen, dbh->db_hlen);
-       put_short(dbhead.dbh_rlen, dbh->db_rlen);
-
-       /* put the date spec'd into the on disk header */
-       dbhead.dbh_date[DBH_DATE_YEAR] =(char)(db_date_year(dbh->db_date) -
-                                               1900);
-       dbhead.dbh_date[DBH_DATE_MONTH]=(char)(db_date_month(dbh->db_date));
-       dbhead.dbh_date[DBH_DATE_DAY] =(char)(db_date_day(dbh->db_date));
-
-       if (lseek(fd, 0, 0) < 0)
-               return -1;
-       if ((ret = write(fd, &dbhead, sizeof(dbhead))) <= 0)
-               return -1;
-       return ret;
-}
-
-/*
- * get a field off the disk from the current file offset
- */
-int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
-{
-       struct dbf_dfield       dbfield;
-       int ret;
-
-       if ((ret = read(dbh->db_fd, &dbfield, sizeof(dbfield))) <= 0) {
-               return ret;
-       }
-
-       /* Check for the '0Dh' field terminator , if found return '2'
-          which will tell the loop we are at the end of fields */
-       if (dbfield.dbf_name[0]==0x0d) {
-               return 2;
-       }
-
-       /* build the field name */
-       copy_crimp(dbf->db_fname, dbfield.dbf_name, DBF_NAMELEN);
-
-       dbf->db_type = dbfield.dbf_type;
-       switch (dbf->db_type) {
-           case 'N':
-           case 'F':
-                       dbf->db_flen = dbfield.dbf_flen[0];
-                       dbf->db_fdc = dbfield.dbf_flen[1];
-                       break;
-           case 'L':
-                       dbf->db_flen = 1;
-                       break;
-           case 'D':
-                       dbf->db_flen = 8;
-                       break;
-           default:
-               dbf->db_flen = get_short(dbfield.dbf_flen);
-                       break;
-       }
-
-       if ((dbf->db_format = get_dbf_f_fmt(dbf)) == NULL) {
-               /* something went wrong, most likely this fieldtype is not supported */
-               return -1;
-       }
-
-       return 0;
-}
-
-/*
- * put a field out on the disk at the current file offset
- */
-int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
-{
-       struct dbf_dfield       dbfield;
-       char                    *scp, *dcp;
-       int                     ret;
-
-       memset (&dbfield, 0, sizeof(dbfield));
-
-       /* build the on disk field info */
-       scp = dbf->db_fname; dcp = dbfield.dbf_name;
-
-       strlcpy(dbfield.dbf_name, dbf->db_fname, DBF_NAMELEN + 1);
-
-       dbfield.dbf_type = dbf->db_type;
-       switch (dbf->db_type) {
-           case 'N':           
-               dbfield.dbf_flen[0] = dbf->db_flen;
-               dbfield.dbf_flen[1] = dbf->db_fdc;
-               break;
-           case 'D':
-               dbf->db_flen = 8;
-               break;
-           case 'L':
-               dbf->db_flen = 1;
-               break;
-           default:
-               put_short(dbfield.dbf_flen, dbf->db_flen);
-       }
-
-       /* now write it out to disk */
-       if ((ret = write(dbh->db_fd, &dbfield, sizeof(dbfield))) <= 0) {
-               return ret;
-       }
-       return 1;
-}
-
-/*
- * put out all the info at the top of the file...
- */
-static char end_stuff[2] = {0x0d, 0};
-
-void put_dbf_info(dbhead_t *dbh)
-{
-       dbfield_t       *dbf;
-       char            *cp;
-       int             fcnt;
-
-       if ((cp = db_cur_date(NULL))) {
-               strlcpy(dbh->db_date, cp, 9);
-               free(cp);
-       }
-       put_dbf_head(dbh);
-       dbf = dbh->db_fields;
-       for (fcnt = dbh->db_nfields; fcnt > 0; fcnt--, dbf++)
-               put_dbf_field(dbh, dbf);
-       write(dbh->db_fd, end_stuff, 1);
-}
-
-char *get_dbf_f_fmt(dbfield_t *dbf)
-{
-       char format[100];
-
-       /* build the field format for printf */
-       switch (dbf->db_type) {
-          case 'C':
-               snprintf(format, sizeof(format), "%%-%ds", dbf->db_flen);
-               break;
-          case 'N':
-          case 'L':
-          case 'D':
-          case 'F':
-               snprintf(format, sizeof(format), "%%%ds", dbf->db_flen);
-               break;
-          case 'M':
-               strlcpy(format, "%s", sizeof(format));
-               break;
-          default:
-               return NULL;
-       }
-       return (char *)strdup(format);
-}
-
-dbhead_t *dbf_open(char *dp, int o_flags TSRMLS_DC)
-{
-       int fd;
-       char *cp;
-       dbhead_t *dbh;
-
-       cp = dp;
-       if ((fd = VCWD_OPEN(cp, o_flags|O_BINARY)) < 0) {
-               return NULL;
-       }
-
-       if ((dbh = get_dbf_head(fd)) == NULL) {
-               return NULL;
-       }
-
-       dbh->db_cur_rec = 0;
-       return dbh;
-}
-
-void dbf_head_info(dbhead_t *dbh)
-{
-       int     nfields;
-       dbfield_t *dbf, *cur_f;
-
-       nfields = dbh->db_nfields;
-       printf("# fields: %d, record len: %d, total records %ld\n",
-               nfields, dbh->db_rlen, dbh->db_records);
-       dbf = dbh->db_fields;
-       for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) {
-               printf("# %s, %c, %d, %d\n", cur_f->db_fname,
-                       cur_f->db_type, cur_f->db_flen, cur_f->db_fdc);
-       }
-}
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dbase/dbf_head.h b/ext/dbase/dbf_head.h
deleted file mode 100644 (file)
index 9a17a3a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "php.h"
-
-extern dbhead_t *get_dbf_head(int fd);
-void free_dbf_head(dbhead_t *dbh);
-extern int put_dbf_head(dbhead_t *dbh);
-extern int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf);
-extern int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf);
-void put_dbf_info(dbhead_t *dbh);
-extern char *get_dbf_f_fmt(dbfield_t *dbf);
-extern dbhead_t *dbf_open(char *dp, int o_flags TSRMLS_DC);
-void dbf_head_info(dbhead_t *dbh);
diff --git a/ext/dbase/dbf_misc.c b/ext/dbase/dbf_misc.c
deleted file mode 100644 (file)
index d572783..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 1991, 1992, 1993 Brad Eacker,
- *              (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-
-#include "dbf_misc.h"
-
-#include "php_reentrancy.h"
-
-/*
- * routine to change little endian long to host long
- */
-long get_long(char *cp)
-{
-       int ret;
-       unsigned char *source = (unsigned char *)cp;
-
-       ret = *source++;
-       ret += ((*source++)<<8);
-       ret += ((*source++)<<16);
-       ret += ((*source++)<<24);
-
-       return ret;
-}
-
-void put_long(char *cp, long lval)
-{
-       *cp++ = lval & 0xff;
-       *cp++ = (lval >> 8) & 0xff;
-       *cp++ = (lval >> 16) & 0xff;
-       *cp++ = (lval >> 24) & 0xff;
-}
-
-/*
- * routine to change little endian short to host short
- */
-int get_short(char *cp)
-{
-       int ret;
-       unsigned char *source = (unsigned char *)cp;
-
-       ret = *source++;
-       ret += ((*source++)<<8);
-
-       return ret;
-}
-
-void put_short(char *cp, int sval)
-{
-       *cp++ = sval & 0xff;
-       *cp++ = (sval >> 8) & 0xff;
-}
-
-double get_double(char *cp)
-{
-       double ret;
-       unsigned char *dp = (unsigned char *)&ret;
-
-       dp[7] = *cp++;
-       dp[6] = *cp++;
-       dp[5] = *cp++;
-       dp[4] = *cp++;
-       dp[3] = *cp++;
-       dp[2] = *cp++;
-       dp[1] = *cp++;
-       dp[0] = *cp++;
-
-       return ret;
-}
-
-void put_double(char *cp, double fval)
-{
-       unsigned char *dp = (unsigned char *)&fval;
-
-       cp[7] = *dp++;
-       cp[6] = *dp++;
-       cp[5] = *dp++;
-       cp[4] = *dp++;
-       cp[3] = *dp++;
-       cp[2] = *dp++;
-       cp[1] = *dp++;
-       cp[0] = *dp++;
-}
-
-void copy_fill(char *dp, char *sp, int len)
-{
-       while (*sp && len > 0) {
-               *dp++ = *sp++;
-               len--;
-       }
-       while (len-- > 0)
-               *dp++ = ' ';
-}
-
-void copy_crimp(char *dp, char *sp, int len)
-{
-       while (len-- > 0) {
-               *dp++ = *sp++;
-       }
-       *dp = 0;
-       for (dp-- ; *dp == ' '; dp--) {
-               *dp = 0;
-       }
-
-}
-
-void db_set_date(char *cp, int year, int month, int day)
-{
-       if (month > 12)
-               month = 0;
-       if (day > 31)
-               day = 0;
-       snprintf(cp, 9, "%04d%02d%02d", year, month, day);
-}
-
-int db_date_year(char *cp)
-{
-       int     year, i;
-
-       for (year = 0, i = 0; i < 4; i++)
-               year = year * 10 + (cp[i] - '0');
-       return year;
-}
-
-int db_date_month(char *cp)
-{
-       int     month, i;
-
-       for (month = 0, i = 4; i < 6; i++)
-               month = month * 10 + (cp[i] - '0');
-       return month;
-}
-
-int db_date_day(char *cp)
-{
-       int     day, i;
-
-       for (day = 0, i = 6; i < 8; i++)
-               day = day * 10 + (cp[i] - '0');
-       return day;
-}
-
-#include <time.h>
-
-char *db_cur_date(char *cp)
-{
-       struct tm *ctm, tmbuf;
-       time_t    c_time;
-
-       c_time = time((time_t *)NULL);
-       ctm = php_localtime_r(&c_time, &tmbuf);
-       if (cp == NULL)
-               cp = (char *)malloc(9);
-
-       if (ctm == NULL || cp == NULL)
-               return NULL;
-
-       db_set_date(cp, ctm->tm_year + 1900, ctm->tm_mon + 1, ctm->tm_mday);
-
-       return cp;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dbase/dbf_misc.h b/ext/dbase/dbf_misc.h
deleted file mode 100644 (file)
index 37fe8b0..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-void put_long(char *cp, long lval);
-extern long get_long(char *cp);
-extern int get_short(char *cp);
-void put_short(char *cp, int sval);
-void put_double(char *cp, double fval);
-extern double get_double(char *cp);
-void copy_fill(char *dp, char *sp, int len);
-void copy_crimp(char *dp, char *sp, int len);
-void db_set_date(char *cp, int year, int month, int day);
-extern int db_date_year(char *cp);
-extern int db_date_month(char *cp);
-extern int db_date_day(char *cp);
-extern char *db_cur_date(char *cp);
diff --git a/ext/dbase/dbf_ndx.c b/ext/dbase/dbf_ndx.c
deleted file mode 100644 (file)
index 121a0e8..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 1991, 1992, 1993 Brad Eacker,
- *              (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "dbf.h"
-#include "dbf_ndx.h"
-
-/*
- * get the ndx header for this file
- */
-ndx_header_t *ndx_get_header(int fd)
-{
-       dndx_header_t   *dp;
-       ndx_header_t    *np;
-
-       if ((dp = (dndx_header_t *)malloc(NDX_PAGE_SZ)) == NULL)
-               return NULL;
-       if ((np = (ndx_header_t *)malloc(sizeof(ndx_header_t))) == NULL) {
-               free(dp);
-               return NULL;
-       }
-       if ((lseek(fd, 0, 0) < 0) || (read(fd, dp, NDX_PAGE_SZ) < 0)) {
-               free(dp); free(np);
-               return NULL;
-       }
-       np->ndx_hpage = dp;
-       np->ndx_fd = fd;
-       np->ndx_start_pg = get_long(dp->dndx_st_pg);
-       np->ndx_total_pgs = get_long(dp->dndx_tot_pg);
-       np->ndx_key_len = get_short(dp->dndx_key_len);
-       np->ndx_keys_ppg = get_short(dp->dndx_keys_ppg);
-       np->ndx_key_type = get_short(dp->dndx_key_type);
-       np->ndx_key_size = get_long(dp->dndx_size_key);
-       np->ndx_key_name = dp->dndx_key_name;
-       np->ndx_unique = dp->dndx_unique;
-
-       np->ndx_fp = NULL;
-
-       return np;
-}
-
-static ndx_page_t *ndx_get_page(ndx_header_t *hp, int pageno)
-{
-       ndx_page_t      *fp;
-       dndx_page_t     *dp;
-       ndx_record_t    *rp;
-
-#if PHP_DEBUG
-       printf("getting page %d", pageno);
-#endif
-       if ((fp = (ndx_page_t *)malloc(sizeof(ndx_page_t))) == NULL)
-               return NULL;
-       if ((dp = (dndx_page_t *)malloc(NDX_PAGE_SZ)) == NULL) {
-               free(fp);
-               return NULL;
-       }
-       if ((rp = (ndx_record_t *)malloc(sizeof(ndx_record_t) * hp->ndx_keys_ppg)) == NULL) {
-               free(dp); free(fp);
-               return NULL;
-       }
-       fp->ndxp_page_data = dp;
-       if ((lseek(hp->ndx_fd, pageno * NDX_PAGE_SZ, 0) < 0) ||
-               (read(hp->ndx_fd, dp, NDX_PAGE_SZ) < 0)) {
-               free(fp); free(dp);
-               return NULL;
-       }
-       fp->ndxp_parent = NULL;
-       fp->ndxp_page_no = pageno;
-       fp->ndxp_num_keys = get_long(dp->dndxp_num_keys);
-       memset(rp, 0, sizeof(ndx_record_t) * hp->ndx_keys_ppg);
-       fp->ndxp_records = rp;
-       fp->ndxp_header_p = hp;
-#if PHP_DEBUG
-       printf(", n_keys %ld\n", fp->ndxp_num_keys);
-#endif
-       return fp;
-}
-
-/*
- * get the first entry for this ndx
- */
-static ndx_page_t *ndx_get_first_pg(ndx_header_t *hp)
-{
-       ndx_page_t      *fp;
-
-       if (hp->ndx_fp)
-               return hp->ndx_fp;
-       if ((fp = ndx_get_page(hp, hp->ndx_start_pg))) {
-               hp->ndx_fp = fp;
-       }
-       return fp;
-}
-
-static ndx_record_t *ndx_get_record(ndx_page_t *fp, int rec_no)
-{
-       ndx_record_t            *rp;
-       ndx_header_t            *hp = fp->ndxp_header_p;
-       struct dndx_record      *drp;
-
-#if PHP_DEBUG
-       printf("page %ld, rec %d: ", fp->ndxp_page_no, rec_no);
-#endif
-       if (rec_no >= fp->ndxp_num_keys)
-               return NULL;
-       rp = &(fp->ndxp_records[rec_no]);
-       if (!rp->ndxr_page) {
-               rp->ndxr_page = fp;
-               drp = (dndx_record_t *)((char *)&fp->ndxp_page_data->dndx_rp
-                               + rec_no * hp->ndx_key_size);
-               rp->ndxr_left = get_long(drp->dndx_left_pg);
-               rp->ndxr_rec = get_long(drp->dndx_dbf_rec);
-               rp->ndxr_key_data = &drp->dndx_key_data;
-               rp->ndxr_p_nrec = rec_no;
-       }
-#if PHP_DEBUG
-       printf("left %ld, dbf_rec %ld, data '%s'\n", rp->ndxr_left,
-               rp->ndxr_rec, rp->ndxr_key_data);
-#endif
-       return rp;
-}
-
-static ndx_record_t *ndx_scan_down(ndx_header_t *hp, ndx_page_t *fp, int recno)
-{
-       ndx_page_t      *np;
-       ndx_record_t    *rp;
-
-       while ((rp = ndx_get_record(fp, recno)) && (rp->ndxr_rec == 0)) {
-               np = ndx_get_page(hp, rp->ndxr_left);
-               np->ndxp_parent = fp;
-               np->ndxp_par_rno = recno;
-               fp = np;
-               recno = 0;
-       }
-       return rp;
-}
-
-static ndx_record_t *ndx_scan_up(ndx_header_t *hp, ndx_page_t *fp, int recno)
-{
-       ndx_record_t    *rp;
-
-       if (fp == NULL)
-               rp = NULL;
-       else if (recno < fp->ndxp_num_keys) {
-               rp = ndx_scan_down(hp, fp, recno);
-       } else {
-               rp = ndx_scan_up(hp, fp->ndxp_parent, fp->ndxp_par_rno + 1);
-       }
-       return rp;
-}
-
-ndx_record_t *ndx_get_first_rec(ndx_header_t *hp)
-{
-       ndx_page_t      *fp;
-       ndx_record_t    *rp = NULL;
-
-       if ((fp = ndx_get_first_pg(hp))) {
-               fp->ndxp_last_key = 0;
-               rp = ndx_scan_down(hp, fp, 0);
-       }
-       hp->ndx_cur_rec = rp;
-       return rp;
-}
-
-ndx_record_t *ndx_get_next_rec(ndx_header_t *hp, ndx_record_t *rp)
-{
-       ndx_page_t      *fp;
-       int             rec_no;
-
-       fp = rp->ndxr_page;
-       rec_no = rp->ndxr_p_nrec + 1;
-       if (rec_no < fp->ndxp_num_keys) {
-               rp = ndx_scan_down(hp, fp, rec_no);
-       } else {
-               rp = ndx_scan_up(hp, fp->ndxp_parent, fp->ndxp_par_rno + 1);
-       }
-       return rp;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dbase/dbf_ndx.h b/ext/dbase/dbf_ndx.h
deleted file mode 100644 (file)
index 4bc3d29..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 1993 Brad Eacker,
- *              (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-
-/*
- * dbf .ndx header structure on disk and in memory
- *
- *  Basic info taken from:
- *     "Clipper Programming Guide, 3rd Edition, Version 5.01"
- *     by Rick Spence
- */
-
-#ifndef DBF_NDX_H_
-#define         DBF_NDX_H_
-
-#include "dbf.h"
-
-#define        NDX_PAGE_SZ     512
-
-/* on disk ndx header */
-struct dndx_header {
-       char    dndx_st_pg[4];          /* starting page number */
-       char    dndx_tot_pg[4];         /* total number of pages */
-       char    dndx_filler1[4];        /* space */
-       char    dndx_key_len[2];        /* key length */
-       char    dndx_keys_ppg[2];       /* number of keys per page */
-       char    dndx_key_type[2];       /* key type */
-       char    dndx_size_key[4];       /* size of the key record */
-       char    dndx_filler2;           /* space */
-       char    dndx_unique;            /* whether or not done with unique */
-       char    dndx_key_name[488];     /* string defining the key */
-};
-typedef struct dndx_header dndx_header_t;
-
-/* in memory ndx header */
-struct ndx_header {
-       long    ndx_start_pg;
-       long    ndx_total_pgs;
-       unsigned short  ndx_key_len;
-       unsigned short  ndx_keys_ppg;
-       unsigned short  ndx_key_type;
-       char    ndx_unique;
-       long    ndx_key_size;
-       char    *ndx_key_name;
-       int     ndx_fd;
-       struct ndx_page *ndx_fp;
-       dndx_header_t *ndx_hpage;
-       struct ndx_record *ndx_cur_rec;
-};
-typedef struct ndx_header ndx_header_t;
-
-/* these are the possible values in the key type field */
-#define        NDX_CHAR_TYPE   00
-#define        NDX_NUM_TYPE    01
-
-/* on disk key record */
-struct dndx_record {
-       char    dndx_left_pg[4];        /* number of left page */
-       char    dndx_dbf_rec[4];        /* dbf record number */
-       char    dndx_key_data;          /* key data */
-};
-typedef struct dndx_record dndx_record_t;
-
-struct ndx_record {
-       long    ndxr_left;
-       long    ndxr_rec;
-       char    *ndxr_key_data;
-       struct ndx_page *ndxr_page;     /* page pointer to where we are from*/
-       int     ndxr_p_nrec;            /* number of the record within page */
-};
-typedef struct ndx_record ndx_record_t;
-
-struct dndx_page {
-       char    dndxp_num_keys[4];      /* number of keys on this page */
-       struct dndx_record dndx_rp;
-};
-typedef struct dndx_page dndx_page_t;
-
-struct ndx_page {
-       long            ndxp_page_no;
-       long            ndxp_num_keys;
-       dndx_page_t     *ndxp_page_data;
-       ndx_header_t    *ndxp_header_p;
-       long            ndxp_last_key;
-       struct ndx_page *ndxp_parent;   /* parent page */
-       int             ndxp_par_rno;   /* record number within parent */
-       struct ndx_record *ndxp_records;
-};
-typedef struct ndx_page ndx_page_t;
-
-extern ndx_header_t *ndx_get_header(int);
-
-extern ndx_record_t *ndx_get_first_rec(ndx_header_t *);
-extern ndx_record_t *ndx_get_next_rec(ndx_header_t *, ndx_record_t *);
-
-#endif /* DBF_NDX_H_ */
diff --git a/ext/dbase/dbf_rec.c b/ext/dbase/dbf_rec.c
deleted file mode 100644 (file)
index cc12985..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright (c) 1993 Brad Eacker,
- *              (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#include "ext/standard/flock_compat.h" 
-
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "dbf.h"
-int get_piece(dbhead_t *dbh, long offset, char *cp, int len);
-int put_piece(dbhead_t *dbh, long offset, char *cp, int len);
-
-/*
- * get a record off the database
- */
-char *get_dbf_record(dbhead_t *dbh, long rec_num)
-{
-       long    offset;
-       char    *cp;
-
-       if (rec_num > dbh->db_records) {
-               return NULL;
-       }
-       if ((cp = (char *)malloc(dbh->db_rlen)) == NULL) {
-               return NULL;
-       }
-
-       /* go to the correct spot on the file */
-       offset = dbh->db_hlen + (rec_num - 1) * dbh->db_rlen;
-       if (get_piece(dbh, offset, cp, dbh->db_rlen) != dbh->db_rlen) {
-               free(cp);
-               cp = NULL;
-       }
-       if (cp)
-               dbh->db_cur_rec = rec_num;
-       return cp;
-}
-
-int
-get_piece(dbhead_t *dbh, long offset, char *cp, int len)
-{
-       /* go to the correct spot on the file */
-       if ( lseek(dbh->db_fd, offset, 0) < 0 ) {
-               return -1;
-       }
-
-       /* read the record into the allocated space */
-       return read(dbh->db_fd, cp, len);
-}
-
-/*
- * put a record to the database
- */
-long put_dbf_record(dbhead_t *dbh, long rec_num, char *cp)
-{
-       long    offset;
-
-       if (rec_num == 0) {
-               rec_num = dbh->db_records;
-       }
-       if (rec_num > dbh->db_records) {
-               return 0L;
-       }
-       /* go to the correct spot on the file */
-       offset = dbh->db_hlen + (rec_num - 1) * dbh->db_rlen;
-       if (put_piece(dbh, offset, cp, dbh->db_rlen) != dbh->db_rlen) {
-               rec_num = -1;
-       }
-       return rec_num;
-}
-
-int put_piece(dbhead_t *dbh, long offset, char *cp, int len)
-{
-       /* go to the correct spot on the file */
-       if ( lseek(dbh->db_fd, offset, 0) < 0 ) {
-               return -1;
-       }
-
-       /* write the record into the file */
-       return write(dbh->db_fd, cp, len);
-}
-
-int del_dbf_record(dbhead_t *dbh, long rec_num)
-{
-       int ret = 0;
-       char *cp;
-
-       if (rec_num > dbh->db_records)
-               return -1;
-       if ((cp = get_dbf_record(dbh, rec_num))) {
-               *cp = DELETED_RECORD;
-               ret = put_dbf_record(dbh, rec_num, cp);
-               free(cp);
-       }
-       return ret;
-}
-
-void pack_dbf(dbhead_t *dbh)
-{
-       long    out_off, in_off;
-       int     rec_cnt, new_cnt;
-       char    *cp;
-
-       if ((cp = (char *)malloc(dbh->db_rlen)) == NULL) {
-               return;
-       }
-       in_off = out_off = dbh->db_hlen;
-
-       new_cnt = 0;
-       rec_cnt = dbh->db_records;
-       while (rec_cnt > 0) {
-               if (get_piece(dbh, in_off, cp, dbh->db_rlen) < 0)
-                       break;
-
-               if (*cp != DELETED_RECORD) {
-                       /* write the record into the file */
-                       if (put_piece(dbh, out_off, cp, dbh->db_rlen) < 0)
-                               break;
-                       out_off += dbh->db_rlen;
-                       new_cnt++;
-               }
-               in_off += dbh->db_rlen;
-               rec_cnt--;
-       }
-       free(cp);
-
-       /* Try to truncate the file to the right size. */
-       if (ftruncate(dbh->db_fd, out_off) != 0) {
-           TSRMLS_FETCH();
-           php_error_docref(NULL TSRMLS_CC, E_WARNING, "dbase_pack() couldn't truncate the file to the right size. Some deleted records may still be left in there");
-       }
-
-       if (rec_cnt == 0)
-               dbh->db_records = new_cnt;
-}
-
-/* routine to get a field from a record */
-char *get_field_val(char *rp, dbfield_t *fldp, char *cp)
-{
-       int flen = fldp->db_flen;
-
-       if ( !cp )
-               cp = (char *)malloc(flen + 1);
-       if ( cp ) {
-               strlcpy(cp, &rp[fldp->db_foffset], flen + 1);
-       }
-       return cp;
-}
-
-void put_field_val(char *rp, dbfield_t *fldp, char *cp)
-{
-       strncpy(&rp[fldp->db_foffset], cp, fldp->db_flen);
-}
-
-/*
- * output a record
- */
-void out_rec(dbhead_t *dbh, dbfield_t *dbf, char *cp)
-{
-       dbfield_t       *cur_f;
-       int     nfields = dbh->db_nfields;
-       char    *fnp = (char *)malloc(dbh->db_rlen);
-
-       printf("%c", *cp);
-       for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) {
-               printf(" ");
-               printf(cur_f->db_format, get_field_val(cp, cur_f, fnp));
-       }
-       printf("\n");
-       free(fnp);
-}
-
-/* check for record validity */
-int is_valid_rec(char *cp)
-{
-       if (cp && (*cp == VALID_RECORD))
-               return 1;
-       else
-               return 0;
-}
-
-/* get the next record */
-char *dbf_get_next(dbhead_t *dbh)
-{
-       return get_dbf_record(dbh, dbh->db_cur_rec + 1);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
diff --git a/ext/dbase/dbf_rec.h b/ext/dbase/dbf_rec.h
deleted file mode 100644 (file)
index 6407c70..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-extern char *get_dbf_record(dbhead_t *dbh, long rec_num);
-extern long put_dbf_record(dbhead_t *dbh, long rec_num, char *cp);
-extern int put_piece(dbhead_t *dbh, long offset, char *cp, int len);
-extern int del_dbf_record(dbhead_t *dbh, long rec_num);
-void pack_dbf(dbhead_t *dbh);
-extern char *get_field_val(char *rp, dbfield_t *fldp, char *cp);
-void put_field_val(char *rp, dbfield_t *fldp, char *cp);
-void out_rec(dbhead_t *dbh, dbfield_t *dbf, char *cp);
-extern int is_valid_rec(char *cp);
-extern char *dbf_get_next(dbhead_t *dbh);
diff --git a/ext/dbase/package.xml b/ext/dbase/package.xml
deleted file mode 100644 (file)
index a1c576f..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE package SYSTEM "../pear/package.dtd">
-<package>
- <name>dbase</name>
- <summary>dBase database file access functions</summary>
- <maintainers>
-  <maintainer>
-   <user>jimw</user>
-   <name>Jim Winstead</name>
-   <email>jimw@php.net</email>
-   <role>lead</role>
-  </maintainer>
- </maintainers>
- <description>
-These functions allow you to access records stored 
-in dBase-format (dbf) databases.
-
-There is no support for indexes or memo fields. 
-There is no support for locking, too. 
-Two concurrent webserver processes modifying the 
-same dBase file will very likely ruin your database.
-
-dBase files are simple sequential files of fixed length records. 
-Records are appended to the end of the file and delete records 
-are kept until you call dbase_pack().  
-</description>
- <license>PHP</license>
- <release>
-  <state>beta</state>
-  <version>5.0rc1</version>
-  <date>2004-03-19</date>
-  <notes>
-package.xml added to support installation using pear installer
-  </notes>
-  <filelist>
-   <file role="doc" name="CREDITS"/>
-   <file role="src" name="config.m4"/>
-   <file role="src" name="dbase.c"/>
-   <file role="src" name="dbf.h"/>
-   <file role="src" name="dbf_head.c"/>
-   <file role="src" name="dbf_head.h"/>
-   <file role="src" name="dbf_misc.c"/>
-   <file role="src" name="dbf_misc.h"/>
-   <file role="src" name="dbf_ndx.c"/>
-   <file role="src" name="dbf_ndx.h"/>
-   <file role="src" name="dbf_rec.c"/>
-   <file role="src" name="dbf_rec.h"/>
-   <file role="src" name="php_dbase.h"/>
-  </filelist>
-  <deps>
-   <dep type="php" rel="ge" version="5" />
-  </deps>
- </release>
-</package>
-<!--
-vim:et:ts=1:sw=1
--->
diff --git a/ext/dbase/php_dbase.h b/ext/dbase/php_dbase.h
deleted file mode 100644 (file)
index 6e07195..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-   +----------------------------------------------------------------------+
-   | PHP Version 5                                                        |
-   +----------------------------------------------------------------------+
-   | Copyright (c) 1997-2008 The PHP Group                                |
-   +----------------------------------------------------------------------+
-   | This source file is subject to version 3.01 of the PHP license,      |
-   | that is bundled with this package in the file LICENSE, and is        |
-   | available through the world-wide-web at the following url:           |
-   | http://www.php.net/license/3_01.txt                                  |
-   | If you did not receive a copy of the PHP license and are unable to   |
-   | obtain it through the world-wide-web, please send a note to          |
-   | license@php.net so we can mail you a copy immediately.               |
-   +----------------------------------------------------------------------+
-   | Author: Jim Winstead <jimw@php.net>                                  |
-   +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_DBASE_H
-#define PHP_DBASE_H
-#if DBASE
-extern zend_module_entry dbase_module_entry;
-#define dbase_module_ptr &dbase_module_entry
-
-PHP_MINIT_FUNCTION(dbase);
-PHP_FUNCTION(dbase_open);
-PHP_FUNCTION(dbase_create);
-PHP_FUNCTION(dbase_close);
-PHP_FUNCTION(dbase_numrecords);
-PHP_FUNCTION(dbase_numfields);
-PHP_FUNCTION(dbase_add_record);
-PHP_FUNCTION(dbase_get_record);
-PHP_FUNCTION(dbase_delete_record);
-PHP_FUNCTION(dbase_pack);
-PHP_FUNCTION(dbase_get_record_with_names);
-PHP_FUNCTION(dbase_get_header_info);
-#else
-#define dbase_module_ptr NULL
-#endif
-
-#define phpext_dbase_ptr dbase_module_ptr
-
-#endif /* PHP_DBASE_H */
diff --git a/ext/dbase/tests/001.phpt b/ext/dbase/tests/001.phpt
deleted file mode 100644 (file)
index 8d9c007..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
---TEST--
-dbase_create() tests
---SKIPIF--
-<?php if (!extension_loaded("dbase")) print "skip"; ?>
---FILE--
-<?php
-
-function my_error_handler($errno, $errstr, $errfile, $errline) {
-       var_dump($errstr);
-}
-
-set_error_handler('my_error_handler');
-
-$fields_arr = Array(
-    Array(
-        array('date','D'),
-        ),
-    Array(
-        array('error', 'E'),
-        ),
-    Array(
-        array('error', -1),
-        ),
-    Array(
-        array(-1, 'N', 3, 0),
-        ),
-    Array(
-        array(),
-        ),
-    Array(
-        ),
-);
-
-$file = dirname(__FILE__).'/001.dbf';
-
-foreach ($fields_arr as $fields) {
-    var_dump(dbase_create($file, $fields));
-    @unlink($file);
-}
-
-var_dump(dbase_create($file, -1));
-@unlink($file);
-
-var_dump(dbase_create("", ""));
-
-echo "Done\n";
-?>
---EXPECTF--
-int(%d)
-unicode(38) "dbase_create(): unknown field type 'E'"
-bool(false)
-unicode(38) "dbase_create(): unknown field type '-'"
-bool(false)
-int(%d)
-unicode(71) "dbase_create(): expected field name as first element of list in field 0"
-bool(false)
-unicode(56) "dbase_create(): Unable to create database without fields"
-bool(false)
-unicode(67) "Argument 2 passed to dbase_create() must be an array, integer given"
-unicode(50) "dbase_create(): Expected array as second parameter"
-bool(false)
-unicode(%d) "unlink(%s001.dbf): No such file or directory"
-unicode(66) "Argument 2 passed to dbase_create() must be an array, string given"
-unicode(50) "dbase_create(): Expected array as second parameter"
-bool(false)
-Done
diff --git a/ext/dbase/tests/002.phpt b/ext/dbase/tests/002.phpt
deleted file mode 100644 (file)
index 3890978..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
---TEST--
-dbase_open() tests
---SKIPIF--
-<?php if (!extension_loaded("dbase")) print "skip"; ?>
---FILE--
-<?php
-
-$file = dirname(__FILE__)."/002.dbf";
-@unlink($file);
-
-$fp = fopen($file, "w");
-fclose($fp);
-
-var_dump(dbase_open($file, -1));
-var_dump(dbase_open($file, 1000));
-var_dump(dbase_open($file, 0));
-var_dump(dbase_open($file."nonex", 0));
-var_dump(dbase_open("", 0));
-
-@unlink($file);
-
-$def = array(
-  array("date",    "D"),
-  array("name",    "C",  50),
-  array("age",      "N",  3, 0),
-  array("email",    "C", 128),
-  array("ismember", "L")
-);
-
-var_dump(dbase_create($file, $def));
-var_dump(dbase_open($file, 0));
-
-@unlink($file);
-
-echo "Done\n";
-?>
---EXPECTF--
-Warning: dbase_open(): Invalid access mode -1 in %s on line %d
-bool(false)
-
-Warning: dbase_open(): Invalid access mode 1000 in %s on line %d
-bool(false)
-
-Warning: dbase_open(): unable to open database %s in %s on line %d
-bool(false)
-
-Warning: dbase_open(): unable to open database %s in %s on line %d
-bool(false)
-
-Warning: dbase_open(): The filename cannot be empty. in %s on line %d
-bool(false)
-int(%d)
-int(%d)
-Done
diff --git a/ext/dbase/tests/bug31754.phpt b/ext/dbase/tests/bug31754.phpt
deleted file mode 100644 (file)
index bc116ed..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-Bug #31754 (dbase_open() fails for mode = 1)
---SKIPIF--
-<?php
-if (!extension_loaded('dbase')) {
-       die('skip dbase extension not available');
-}
-?>
---FILE--
-<?php
-
-// database "definition"
-$def = array(
-       array("foo", "L")
-);
-
-// creation
-$dbh = dbase_create('/tmp/bug31754.dbf', array(array('foo', 'L')));
-dbase_close($dbh);
-
-$dbh = dbase_open('/tmp/bug31754.dbf', 1);
-unlink('/tmp/bug31754.dbf');
-
-?>
---EXPECTF--
-Warning: dbase_open(): Cannot open /tmp/bug31754.dbf in write-only mode in %sbug31754.php on line %d