cvs: php4 /ext/saprfc CREDITS EXPERIMENTAL Makefile.in README config.m4 php_saprfc.c php_saprfc.h /ext/saprfc/tests 001.phpt

From: Date: Tue, 01 May 2001 20:15:59 +0000
Subject: cvs: php4 /ext/saprfc CREDITS EXPERIMENTAL Makefile.in README config.m4 php_saprfc.c php_saprfc.h /ext/saprfc/tests 001.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-5441@lists.php.net to get a copy of this message
hholzgra Tue May 1 13:15:59 2001 EDT Added files: /php4/ext/saprfc CREDITS EXPERIMENTAL Makefile.in README config.m4 php_saprfc.c php_saprfc.h /php4/ext/saprfc/tests 001.phpt Log: the beginning of the SAP R/3 ABAP4 Remote Function Call extension configure works, it finds headers and lib compile and link against librfc works too but no functionality yet :(

Index: php4/ext/saprfc/Makefile.in +++ php4/ext/saprfc/Makefile.in # $Id: Makefile.in,v 1.1 2001/05/01 20:15:59 hholzgra Exp $ LTLIBRARY_NAME = libsaprfc.la LTLIBRARY_SOURCES = php_saprfc.c LTLIBRARY_SHARED_NAME = php_saprfc.la LTLIBRARY_SHARED_LIBADD = $(SAPRFC_SHARED_LIBADD) include $(top_srcdir)/build/dynlib.mk Index: php4/ext/saprfc/config.m4 +++ php4/ext/saprfc/config.m4 dnl $Id: config.m4,v 1.1 2001/05/01 20:15:59 hholzgra Exp $ dnl config.m4 for extension saprfc PHP_ARG_WITH(saprfc, for saprfc support, [ --with-saprfc Include saprfc support]) if test "$PHP_SAPRFC" != "no"; then # --with-saprfc -> check with-path SEARCH_PATH="/usr/sap/rfcsdk" SEARCH_FOR="/include/saprfc.h" if test -r $PHP_SAPRFC/; then # path given as parameter SAPRFC_DIR=$PHP_SAPRFC else # search default path list AC_MSG_CHECKING(for saprfc files in default path) for i in $SEARCH_PATH ; do if test -r $i/$SEARCH_FOR; then SAPRFC_DIR=$i AC_MSG_RESULT(found in $i) fi done fi if test -z "$SAPRFC_DIR"; then AC_MSG_RESULT(not found) AC_MSG_ERROR(Please reinstall the saprfc distribution) fi # --with-saprfc -> add include path PHP_ADD_INCLUDE($SAPRFC_DIR/include) # --with-saprfc -> chech for lib and symbol presence LIBNAME=rfc LIBSYMBOL=RfcInit old_LIBS=$LIBS LIBS="$LIBS -L$SAPRFC_DIR/lib -lm -ldl" AC_CHECK_LIB($LIBNAME, $LIBSYMBOL, [AC_DEFINE(HAVE_SAPRFCLIB,1,[ ])], [AC_MSG_ERROR(wrong saprfc lib version or lib not found)]) LIBS=$old_LIBS PHP_SUBST(SAPRFC_SHARED_LIBADD) PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $SAPRFC_DIR/lib, SAPRFC_SHARED_LIBADD) PHP_EXTENSION(saprfc, $ext_shared) fi Index: php4/ext/saprfc/php_saprfc.c +++ php4/ext/saprfc/php_saprfc.c /* +----------------------------------------------------------------------+ | PHP version 4.0 | +----------------------------------------------------------------------+ | Copyright (c) 1997, 1998, 1999, 2000, 2001 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: | | | +----------------------------------------------------------------------+ */ #include "php.h" #include "php_ini.h" #include "php_saprfc.h" /* If you declare any globals in php_saprfc.h uncomment this: ZEND_DECLARE_MODULE_GLOBALS(saprfc) */ /* True global resources - no need for thread safety here */ static int le_saprfc; /* Every user visible function must have an entry in saprfc_functions[]. */ function_entry saprfc_functions[] = { PHP_FE(confirm_saprfc_compiled, NULL) /* For testing, remove later. */ {NULL, NULL, NULL} /* Must be the last line in saprfc_functions[] */ }; zend_module_entry saprfc_module_entry = { "saprfc", saprfc_functions, PHP_MINIT(saprfc), PHP_MSHUTDOWN(saprfc), PHP_RINIT(saprfc), /* Replace with NULL if there's nothing to do at request start */ PHP_RSHUTDOWN(saprfc), /* Replace with NULL if there's nothing to do at request end */ PHP_MINFO(saprfc), STANDARD_MODULE_PROPERTIES }; #ifdef COMPILE_DL_SAPRFC ZEND_GET_MODULE(saprfc) #endif /* Remove comments and fill if you need to have entries in php.ini PHP_INI_BEGIN() PHP_INI_END() */ PHP_MINIT_FUNCTION(saprfc) { /* Remove comments if you have entries in php.ini REGISTER_INI_ENTRIES(); */ RfcInit(); return SUCCESS; } PHP_MSHUTDOWN_FUNCTION(saprfc) { /* Remove comments if you have entries in php.ini UNREGISTER_INI_ENTRIES(); */ return SUCCESS; } /* Remove if there's nothing to do at request start */ PHP_RINIT_FUNCTION(saprfc) { return SUCCESS; } /* Remove if there's nothing to do at request end */ PHP_RSHUTDOWN_FUNCTION(saprfc) { return SUCCESS; } PHP_MINFO_FUNCTION(saprfc) { php_info_print_table_start(); php_info_print_table_header(2, "saprfc support", "enabled"); php_info_print_table_end(); /* Remove comments if you have entries in php.ini DISPLAY_INI_ENTRIES(); */ } /* Remove the following function when you have succesfully modified config.m4 so that your module can be compiled into PHP, it exists only for testing purposes. */ /* Every user-visible function in PHP should document itself in the source */ /* {{{ proto string confirm_saprfc_compiled(string arg) Return a string to confirm that the module is compiled in */ PHP_FUNCTION(confirm_saprfc_compiled) { zval **arg; int len; char string[256]; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_string_ex(arg); len = sprintf(string, "Congratulations, you have successfully modified ext/saprfc/config.m4, module %s is compiled into PHP", Z_STRVAL_PP(arg)); RETURN_STRINGL(string, len, 1); } /* }}} */ /* The previous line is meant for emacs, so it can correctly fold and unfold functions in source code. See the corresponding marks just before function definition, where the functions purpose is also documented. Please follow this convention for the convenience of others editing your code. */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: */ Index: php4/ext/saprfc/php_saprfc.h +++ php4/ext/saprfc/php_saprfc.h /* +----------------------------------------------------------------------+ | PHP version 4.0 | +----------------------------------------------------------------------+ | Copyright (c) 1997, 1998, 1999, 2000, 2001 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: | | | +----------------------------------------------------------------------+ */ #ifndef PHP_SAPRFC_H #define PHP_SAPRFC_H extern zend_module_entry saprfc_module_entry; #define phpext_saprfc_ptr &saprfc_module_entry #ifdef PHP_WIN32 #define PHP_SAPRFC_API __declspec(dllexport) #else #define PHP_SAPRFC_API #endif PHP_MINIT_FUNCTION(saprfc); PHP_MSHUTDOWN_FUNCTION(saprfc); PHP_RINIT_FUNCTION(saprfc); PHP_RSHUTDOWN_FUNCTION(saprfc); PHP_MINFO_FUNCTION(saprfc); PHP_FUNCTION(confirm_saprfc_compiled); /* For testing, remove later. */ /* Declare any global variables you may need between the BEGIN and END macros here: ZEND_BEGIN_MODULE_GLOBALS(saprfc) int global_variable; ZEND_END_MODULE_GLOBALS(saprfc) */ /* In every function that needs to use variables in php_saprfc_globals, do call SAPRFCLS_FETCH(); after declaring other variables used by that function, and always refer to them as SAPRFCG(variable). You are encouraged to rename these macros something shorter, see examples in any other php module directory. */ #ifdef ZTS #define SAPRFCG(v) (saprfc_globals->v) #define SAPRFCLS_FETCH() php_saprfc_globals *saprfc_globals = ts_resource(saprfc_globals_id) #else #define SAPRFCG(v) (saprfc_globals.v) #define SAPRFCLS_FETCH() #endif #endif /* PHP_SAPRFC_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: */ Index: php4/ext/saprfc/tests/001.phpt +++ php4/ext/saprfc/tests/001.phpt --TEST-- Check for saprfc presence --SKIPIF-- <?php if (!extension_loaded("saprfc")) print "skip"; ?> --POST-- --GET-- --FILE-- <?php echo "saprfc extension is available"; /* you can add regression tests for your extension here the output of your test code has to be equal to the text in the --EXPECT-- section below for the tests to pass, differences between the output and the expected text are interpreted as failure see php4/tests/README for further information on writing regression tests */ ?> --EXPECT-- saprfc extension is available
« previous php.cvs (#5441) next »