]> granicus.if.org Git - php/commitdiff
(PHP satellite_object_to_string) Added function to get IOR of object.
authorDavid Eriksson <eriksson@php.net>
Thu, 9 Aug 2001 21:55:10 +0000 (21:55 +0000)
committerDavid Eriksson <eriksson@php.net>
Thu, 9 Aug 2001 21:55:10 +0000 (21:55 +0000)
ext/satellite/object.c
ext/satellite/php_orbit.c
ext/satellite/php_orbit.h

index 7eb9a3dcad0b306b5cef6f1d9e763b5927f0ecf2..741a69a834635300c8f62bf5762dee24131e6238 100644 (file)
@@ -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();
+}
+
index 41bb0e06b777b85735017504c7351644eb30ad97..7fa82a6aca99ae98ac84b5f1f4da8fe5955d2a88 100644 (file)
@@ -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)
index 5b0bf61034201ba52d0a5a95ae4151e38a5d634e..62c3edca4bf995d5b8782a93875d0ff5c3331142 100644 (file)
@@ -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);