diff options
Diffstat (limited to 'ext/recode')
-rw-r--r-- | ext/recode/Makefile.in | 7 | ||||
-rw-r--r-- | ext/recode/config.m4 | 65 | ||||
-rw-r--r-- | ext/recode/php_recode.h | 94 | ||||
-rw-r--r-- | ext/recode/recode.c | 227 | ||||
-rw-r--r-- | ext/recode/setup.stub | 3 |
5 files changed, 0 insertions, 396 deletions
diff --git a/ext/recode/Makefile.in b/ext/recode/Makefile.in deleted file mode 100644 index fcf63e9e2a..0000000000 --- a/ext/recode/Makefile.in +++ /dev/null @@ -1,7 +0,0 @@ - -LTLIBRARY_NAME = librecode.la -LTLIBRARY_SOURCES = recode.c -LTLIBRARY_SHARED_NAME = recode.la -LTLIBRARY_SHARED_LIBADD = $(RECODE_SHARED_LIBADD) - -include $(top_srcdir)/build/dynlib.mk diff --git a/ext/recode/config.m4 b/ext/recode/config.m4 deleted file mode 100644 index 83b0b5b193..0000000000 --- a/ext/recode/config.m4 +++ /dev/null @@ -1,65 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension recode -dnl don't forget to call PHP_EXTENSION(recode) - - -PHP_ARG_WITH(recode,for recode support, -[ --with-recode[=DIR] Include recode support. DIR is the recode install - directory.]) - - if test "$PHP_RECODE" != "no"; then - RECODE_LIST="$PHP_RECODE /usr /usr/local /opt" - - for i in $RECODE_LIST; do - if test -f $i/include/recode.h; then - RECODE_DIR=$i - RECODE_INC=include - RECODE_LIB=lib - fi - if test -f $i/include/recode/recode.h; then - RECODE_DIR=$i - RECODE_INC=include/recode - RECODE_LIB=lib/recode - fi - if test -f $i/recode/include/recode.h; then - RECODE_DIR=$i/recode - RECODE_INC=include - RECODE_LIB=lib - fi - done - if test "$RECODE_DIR" = ""; then - AC_MSG_ERROR(I cannot find recode.h anywhere below $RECODE_LIST. Is it installed?) - fi - - old_LDFLAGS="$LDFLAGS" - old_LIBS="$LIBS" - LDFLAGS="$LDFLAGS -L$RECODE_DIR/$RECODE_LIB" - LIBS="$LIBS -lrecode" - AC_TRY_LINK([ -char *program_name; -],[ -recode_format_table(); -],[],[ - AC_MSG_ERROR(I cannot link librecode (-L$RECODE_DIR/$RECODE_LIB -lrecode). Is it installed?) -]) - LIBS="$old_LIBS" - LDFLAGS="$old_LDFLAGS" - - if test "$RECODE_LIB" = ""; then - AC_MSG_ERROR(Please reinstall recode - I cannot find librecode.a) - fi - - AC_ADD_INCLUDE($RECODE_DIR/$RECODE_INC) - if test "$ext_shared" = "yes"; then - AC_ADD_LIBRARY_WITH_PATH(recode, $RECODE_DIR/$RECODE_LIB, RECODE_SHARED_LIBADD) - PHP_SUBST(RECODE_SHARED_LIBADD) - else - AC_ADD_LIBRARY_DEFER_WITH_PATH(recode, $RECODE_DIR/$RECODE_LIB) - fi - - AC_DEFINE(HAVE_LIBRECODE, 1, [Whether we have librecode 3.5 or higher]) - - AC_CHECK_HEADERS(stdbool.h) - - PHP_EXTENSION(recode,$ext_shared) - fi diff --git a/ext/recode/php_recode.h b/ext/recode/php_recode.h deleted file mode 100644 index e20494087b..0000000000 --- a/ext/recode/php_recode.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.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. | - +----------------------------------------------------------------------+ - | Authors: Kristian Koehntopp (kris@koehntopp.de) | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef _PHP_RECODE_H -#define _PHP_RECODE_H - -#ifdef COMPILE_DL_RECODE -#undef HAVE_LIBRECODE -#define HAVE_LIBRECODE 1 -#endif - -#ifdef PHP_WIN32 -#define PHP_MYSQL_API __declspec(dllexport) -#else -#define PHP_MYSQL_API -#endif - -#if HAVE_LIBRECODE - -/* Checking for thread safety and issue warning if necessary. */ -#ifdef ZTS -#warning Recode module has not been tested for thread-safety. -#endif - -/* Recode 3.5 is broken in the sense that it requires the definition - * of a symbol "program_name" in order to link. - */ -#define HAVE_BROKEN_RECODE - -#ifdef HAVE_STDBOOL_H -# include <stdbool.h> -#else - typedef enum {false = 0, true = 1} bool; -#endif - -#include <sys/types.h> -#include <stdio.h> -#include <recode.h> -#include <unistd.h> - -extern zend_module_entry recode_module_entry; -#define phpext_recode_ptr &recode_module_entry - -extern PHP_MINIT_FUNCTION(recode); -extern PHP_MSHUTDOWN_FUNCTION(recode); -extern PHP_MINFO_FUNCTION(recode); - -extern PHP_FUNCTION(recode_string); -extern PHP_FUNCTION(recode_file); - -typedef struct { - RECODE_OUTER outer; -} php_recode_globals; - -#ifdef ZTS -# define ReSLS_D php_recode_globals *recode_globals -# define ReSLS_DC , ReSLS_D -# define ReSLS_C recode_globals -# define ReSLS_CC , ReSLS_C -# define ReSG(v) (recode_globals->v) -# define ReSLS_FETCH() php_recode_globals *recode_globals = ts_resource(recode_globals_id) -#else -# define ReSLS_D -# define ReSLS_DC -# define ReSLS_C -# define ReSLS_CC -# define ReSG(v) (recode_globals.v) -# define ReSLS_FETCH() -extern PHP_MYSQL_API php_recode_globals recode_globals; -#endif - -#else -#define phpext_recode_ptr NULL -#endif - -#endif /* _PHP_RECODE_H */ diff --git a/ext/recode/recode.c b/ext/recode/recode.c deleted file mode 100644 index e1ed131ec4..0000000000 --- a/ext/recode/recode.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.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. | - +----------------------------------------------------------------------+ - | Authors: Kristian Koehntopp (kris@koehntopp.de) | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -/* {{{ includes & prototypes */ - -#include "php.h" -#include "php_recode.h" - -#if HAVE_LIBRECODE -#include "ext/standard/info.h" -#include "ext/standard/file.h" -#include "ext/standard/php_string.h" -#include "zend_list.h" - - -#ifdef HAVE_BROKEN_RECODE -extern char *program_name; -char *program_name = "php"; -#endif - -/* }}} */ - -#define SAFE_STRING(s) ((s)?(s):"") - -php_recode_globals recode_globals; -extern int le_fp,le_pp; - -/* {{{ module stuff */ -static zend_function_entry php_recode_functions[] = { - PHP_FE(recode_string, NULL) - PHP_FE(recode_file, NULL) - PHP_FALIAS(recode, recode_string, NULL) - {NULL, NULL, NULL} -}; - -zend_module_entry recode_module_entry = { - "Recode", - php_recode_functions, - PHP_MINIT(recode), - PHP_MSHUTDOWN(recode), - NULL, - NULL, - PHP_MINFO(recode), - STANDARD_MODULE_PROPERTIES -}; - -#if APACHE -extern void timeout(int sig); -#endif - -#ifdef COMPILE_DL_RECODE -ZEND_GET_MODULE(recode) -#endif - -PHP_MINIT_FUNCTION(recode) -{ - ReSLS_FETCH(); - ReSG(outer) = recode_new_outer(true); - if (ReSG(outer) == NULL) - return FAILURE; - - return SUCCESS; -} - - -PHP_MSHUTDOWN_FUNCTION(recode) -{ - ReSLS_FETCH(); - - if (ReSG(outer)) - recode_delete_outer(ReSG(outer)); - - return SUCCESS; -} - - -PHP_MINFO_FUNCTION(recode) -{ - ReSLS_FETCH(); - - php_info_print_table_start(); - php_info_print_table_row(2, "Recode Support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision$"); - php_info_print_table_end(); - -} - -/* {{{ proto string recode_string(string request, string str) - Recode string str according to request string */ - -PHP_FUNCTION(recode_string) -{ - RECODE_REQUEST request = NULL; - char *r = NULL; - pval **str; - pval **req; - bool success; - - ReSLS_FETCH(); - if (ZEND_NUM_ARGS() != 2 - || zend_get_parameters_ex(2, &req, &str) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string_ex(str); - convert_to_string_ex(req); - - request = recode_new_request(ReSG(outer)); - if (request == NULL) { - php_error(E_WARNING, "Cannot allocate request structure"); - RETURN_FALSE; - } - - success = recode_scan_request(request, (*req)->value.str.val); - if (!success) { - php_error(E_WARNING, "Illegal recode request '%s'", (*req)->value.str.val); - goto error_exit; - } - - r = recode_string(request, (*str)->value.str.val); - if (!r) { - php_error(E_WARNING, "Recoding failed."); - goto error_exit; - } - - RETVAL_STRING(r, 1); - free(r); - /* FALLTHROUGH */ - -error_exit: - if (request) - recode_delete_request(request); - - if (!r) - RETURN_FALSE; - - return; -} -/* }}} */ - -/* {{{ proto bool recode_file(string request, resource input, resource output) - Recode file input into file output according to request */ -PHP_FUNCTION(recode_file) -{ - RECODE_REQUEST request = NULL; - int success; - pval **req; - pval **input, **output; - FILE *in_fp, *out_fp; - int in_type, out_type; - - ReSLS_FETCH(); - if (ZEND_NUM_ARGS() != 3 - || zend_get_parameters_ex(3, &req, &input, &output) == FAILURE) { - WRONG_PARAM_COUNT; - } - - in_fp = zend_fetch_resource(input,-1, "File-Handle", &in_type, - 2, php_file_le_fopen(), php_file_le_popen()); - if (!in_fp) { - php_error(E_WARNING,"Unable to find input file identifier"); - RETURN_FALSE; - } - - out_fp = zend_fetch_resource(output,-1, "File-Handle", &out_type, - 2, php_file_le_fopen(), php_file_le_popen()); - if (!out_fp) { - php_error(E_WARNING,"Unable to find output file identifier"); - RETURN_FALSE; - } - - convert_to_string_ex(req); - - request = recode_new_request(ReSG(outer)); - if (request == NULL) { - php_error(E_WARNING, "Cannot allocate request structure"); - RETURN_FALSE; - } - - success = recode_scan_request(request, (*req)->value.str.val); - if (!success) { - php_error(E_WARNING, "Illegal recode request '%s'", (*req)->value.str.val); - goto error_exit; - } - - success = recode_file_to_file(request, in_fp, out_fp); - if (!success) { - php_error(E_WARNING, "Recoding failed."); - goto error_exit; - } - - if (request) - recode_delete_request(request); - RETURN_TRUE; - -error_exit: - if (request) - recode_delete_request(request); - - RETURN_FALSE; -} -/* }}} */ - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/recode/setup.stub b/ext/recode/setup.stub deleted file mode 100644 index 07bf5d9f39..0000000000 --- a/ext/recode/setup.stub +++ /dev/null @@ -1,3 +0,0 @@ -define_option with-recode 'GNU-Recode support?' yesnodir no \ -' Whether to build the recode extension.' - |