]> granicus.if.org Git - php/commitdiff
Fixup some constants and error handling.
authorWez Furlong <wez@php.net>
Mon, 3 May 2004 15:51:41 +0000 (15:51 +0000)
committerWez Furlong <wez@php.net>
Mon, 3 May 2004 15:51:41 +0000 (15:51 +0000)
Remove unfinished and un-needed function.

ext/com_dotnet/README
ext/com_dotnet/com_extension.c
ext/com_dotnet/com_variant.c
ext/com_dotnet/com_wrapper.c

index e369d74459642d3e4286af7d52e0858d905d778e..0d9db40d981d4f6702d861d7fd35b84669af8018 100644 (file)
@@ -65,9 +65,6 @@ $word->Quit();
 
 TODO:
 
-- Mapping PHP arrays as SafeArray's.  This is currently not done.
-  Probably will implement this into $a = new variant($php_array, VT_ARRAY)
-  or something similar.
 - documentation
 
 * dotnet support requires that you have the mscoree.h header from the .net sdk
index b88a99ccfba23415868a153491de935c51d5dfb9..354cbcd1cc1af570ae8cece18cfd317b2f53aa7b 100644 (file)
@@ -228,9 +228,11 @@ PHP_MINIT_FUNCTION(com_dotnet)
        COM_CONST(CLSCTX_SERVER);
        COM_CONST(CLSCTX_ALL);
 
+#if 0
        COM_CONST(DISPATCH_METHOD);
        COM_CONST(DISPATCH_PROPERTYGET);
        COM_CONST(DISPATCH_PROPERTYPUT);
+#endif
 
        COM_CONST(VT_NULL);
        COM_CONST(VT_EMPTY);
@@ -269,6 +271,17 @@ PHP_MINIT_FUNCTION(com_dotnet)
        COM_CONST(VARCMP_GT);
        COM_CONST(VARCMP_NULL);
 
+       COM_CONST(NORM_IGNORECASE);
+       COM_CONST(NORM_IGNORENONSPACE);
+       COM_CONST(NORM_IGNORESYMBOLS);
+       COM_CONST(NORM_IGNOREWIDTH);
+       COM_CONST(NORM_IGNOREKANATYPE);
+#ifdef NORM_IGNOREKASHIDA
+       COM_CONST(NORM_IGNOREKASHIDA);
+#endif
+       COM_CONST(DISP_E_DIVBYZERO);
+       COM_CONST(DISP_E_OVERFLOW);
+
        return SUCCESS;
 }
 /* }}} */
index 48a0a66c20559e5f1e62d18637d8a928d67d220d..ccb8c18321f5a05c0531d9b49a4f658978d46cbe 100644 (file)
@@ -312,7 +312,7 @@ PHP_FUNCTION(com_variant_create_instance)
 /* }}} */
 
 /* {{{ proto void variant_set(object variant, mixed value)
-   Assigns a new value for a variant object (like "set" in VB) */
+   Assigns a new value for a variant object */
 PHP_FUNCTION(variant_set)
 {
        zval *zobj, *zvalue = NULL;
@@ -443,6 +443,11 @@ static void variant_binary_operation(enum variant_binary_opcode op, INTERNAL_FUN
 
        if (SUCCEEDED(result)) {
                php_com_wrap_variant(return_value, &vres, codepage TSRMLS_CC);
+       } else {
+               char *werr;
+               werr = php_win_err(result);
+               php_com_throw_exception(result, werr TSRMLS_CC);
+               LocalFree(werr);
        }
 
        VariantClear(&vres);
@@ -468,7 +473,7 @@ PHP_FUNCTION(variant_cat)
 /* }}} */
 
 /* {{{ proto mixed variant_sub(mixed left, mixed right)
-   subjects the value of the right variant from the left variant value and returns the result */
+   subtracts the value of the right variant from the left variant value and returns the result */
 PHP_FUNCTION(variant_sub)
 {
        variant_binary_operation(VOP_SUB, INTERNAL_FUNCTION_PARAM_PASSTHRU);
@@ -508,7 +513,7 @@ PHP_FUNCTION(variant_eqv)
 /* }}} */
 
 /* {{{ proto mixed variant_idiv(mixed left, mixed right)
-   Converts variants to operands and then returns the result from dividing them */
+   Converts variants to integers and then returns the result from dividing them */
 PHP_FUNCTION(variant_idiv)
 {
        variant_binary_operation(VOP_IDIV, INTERNAL_FUNCTION_PARAM_PASSTHRU);
@@ -600,6 +605,11 @@ static void variant_unary_operation(enum variant_unary_opcode op, INTERNAL_FUNCT
 
        if (SUCCEEDED(result)) {
                php_com_wrap_variant(return_value, &vres, codepage TSRMLS_CC);
+       } else {
+               char *werr;
+               werr = php_win_err(result);
+               php_com_throw_exception(result, werr TSRMLS_CC);
+               LocalFree(werr);
        }
 
        VariantClear(&vres);
@@ -616,7 +626,7 @@ PHP_FUNCTION(variant_abs)
 /* }}} */
 
 /* {{{ proto mixed variant_fix(mixed left)
-   Returns the ? of a variant */
+   Returns the integer part ? of a variant */
 PHP_FUNCTION(variant_fix)
 {
        variant_unary_operation(VOP_FIX, INTERNAL_FUNCTION_PARAM_PASSTHRU);
@@ -902,19 +912,3 @@ PHP_FUNCTION(variant_cast)
 }
 /* }}} */
 
-/* {{{ proto mixed variant_index_get(object variant, mixed index1 [, mixed index2 [, ...]])
-   Get the value of a multi dimensional array property */
-PHP_FUNCTION(variant_index_get)
-{
-       zval *zobj;
-       php_com_dotnet_object *obj;
-
-       if (FAILURE == zend_parse_parameters(1 TSRMLS_CC,
-               "O", &zobj, php_com_variant_class_entry)) {
-               return;
-       }
-       obj = CDNO_FETCH(zobj);
-
-       /* TODO: finish... */
-}
-/* }}} */
index 0ca3247a452c44c91ebebf22806183a3160743ca..4ca96cc8c5f76799a13b5c213585bb9bff4b85b4 100644 (file)
@@ -314,14 +314,8 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex(
                /* return value */
                if (retval) {
                        if (pvarRes) {
-                               if (Z_TYPE_P(retval) == IS_OBJECT) {
-                                       /* export the object using a dispatch like ourselves */
-                                       VariantInit(pvarRes);
-                                       V_VT(pvarRes) = VT_DISPATCH;
-                                       V_DISPATCH(pvarRes) = php_com_wrapper_export(retval TSRMLS_CC);
-                               } else {
-                                       php_com_variant_from_zval(pvarRes, retval, COMG(code_page) TSRMLS_CC);
-                               }
+                               VariantInit(pvarRes);
+                               php_com_variant_from_zval(pvarRes, retval, COMG(code_page) TSRMLS_CC);
                        }
                        zval_ptr_dtor(&retval);
                } else if (pvarRes) {
@@ -344,6 +338,8 @@ static HRESULT STDMETHODCALLTYPE disp_deletememberbyname(
 
        FETCH_DISP("DeleteMemberByName");
 
+       /* TODO: unset */
+
        return S_FALSE;
 }
 
@@ -355,6 +351,8 @@ static HRESULT STDMETHODCALLTYPE disp_deletememberbydispid(
 
        FETCH_DISP("DeleteMemberByDispID");
        
+       /* TODO: unset */
+       
        return S_FALSE;
 }