diff options
author | David Eriksson <eriksson@php.net> | 2001-08-09 21:55:10 +0000 |
---|---|---|
committer | David Eriksson <eriksson@php.net> | 2001-08-09 21:55:10 +0000 |
commit | ece087b842df61a66b9bbadef97d159573c7fd81 (patch) | |
tree | 8e5b114b7fa78bdcdcab29f49d6fbea4ad13c927 /ext/satellite | |
parent | 114d33ae07690c4e205e0a1a7550c46554a01821 (diff) | |
download | php-git-ece087b842df61a66b9bbadef97d159573c7fd81.tar.gz |
(PHP satellite_object_to_string) Added function to get IOR of object.
Diffstat (limited to 'ext/satellite')
-rw-r--r-- | ext/satellite/object.c | 47 | ||||
-rw-r--r-- | ext/satellite/php_orbit.c | 1 | ||||
-rw-r--r-- | ext/satellite/php_orbit.h | 1 |
3 files changed, 47 insertions, 2 deletions
diff --git a/ext/satellite/object.c b/ext/satellite/object.c index 7eb9a3dcad..741a69a834 100644 --- a/ext/satellite/object.c +++ b/ext/satellite/object.c @@ -33,6 +33,9 @@ * * ----------------------------------------------------------------------- */ +#include <php.h> +#include "php_orbit.h" + #include "class.h" #include "corba.h" #include "common.h" @@ -282,7 +285,7 @@ zend_bool OrbitObject_Constructor(OrbitObject ** ppObject, /* check parameter count */ if (parameterCount != 1) { - wrong_param_count(); + zend_wrong_param_count(TSRMLS_C); goto error; } @@ -421,7 +424,7 @@ static zend_bool OrbitObject_AddArguments(OrbitObject * pObject, /* printf("%i, %i, %i\n", i, argumentCount, ParameterType_IsValid(p_parameter));*/ /* bad number of arguments */ - wrong_param_count(); + zend_wrong_param_count(TSRMLS_C); goto error; } @@ -863,3 +866,43 @@ OrbitObject_GetProperty_exit: return success; } +PHP_FUNCTION(satellite_object_to_string) +{ + zval **arg = NULL; + char * p_ior = NULL; + OrbitObject * p_object = NULL; + + if (zend_get_parameters_ex(1, &arg) != SUCCESS) + { + zend_error(E_WARNING, "(Satellite) Bad parameter count"); + goto error; + } + + p_object = OrbitObject_RetrieveData(*arg); + if (!p_object) + { + zend_error(E_WARNING, "(Satellite) Object has no data"); + goto error; + } + + if (!p_object->mCorbaObject) + { + zend_error(E_WARNING, "(Satellite) Object has no CORBA object"); + goto error; + } + + p_ior = CORBA_ORB_object_to_string(orbit_get_orb(), p_object->mCorbaObject, + orbit_get_environment()); + + if (!p_ior /*|| orbit_caught_exception()*/) + { + zend_error(E_WARNING, "(Satellite) CORBA call failed"); + goto error; + } + + RETURN_STRING(p_ior, TRUE); + +error: + RETURN_NULL(); +} + diff --git a/ext/satellite/php_orbit.c b/ext/satellite/php_orbit.c index 41bb0e06b7..7fa82a6aca 100644 --- a/ext/satellite/php_orbit.c +++ b/ext/satellite/php_orbit.c @@ -64,6 +64,7 @@ static function_entry satellite_functions[] = { PHP_FE(satellite_caught_exception, NULL) PHP_FE(satellite_exception_id, NULL) PHP_FE(satellite_exception_value, NULL) + PHP_FE(satellite_object_to_string, NULL) /* support the old prefix orbit_ */ PHP_FALIAS(orbit_load_idl, satellite_load_idl, NULL) diff --git a/ext/satellite/php_orbit.h b/ext/satellite/php_orbit.h index 5b0bf61034..62c3edca4b 100644 --- a/ext/satellite/php_orbit.h +++ b/ext/satellite/php_orbit.h @@ -33,6 +33,7 @@ extern zend_module_entry satellite_module_entry; PHP_FUNCTION(satellite_load_idl); PHP_FUNCTION(satellite_get_repository_id); +PHP_FUNCTION(satellite_object_to_string); /* exception handling */ PHP_FUNCTION(satellite_caught_exception); |