the COM module.
also fixed a few bugs.
pResults.pIID = &IID_IDispatch;
pResults.pItf = NULL;
pResults.hr = S_OK;
- hr=CoCreateInstanceEx(&clsid, NULL, CLSCTX_SERVER, &server_info, 1, &pResults);
+ hr = CoCreateInstanceEx(&clsid, NULL, CLSCTX_REMOTE_SERVER, &server_info, 1, &pResults);
if (SUCCEEDED(hr)) {
hr = pResults.hr;
C_DISPATCH(obj) = (IDispatch *) pResults.pItf;
int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **arguments, int arg_count TSRMLS_DC)
{
DISPID dispid;
+ DISPPARAMS dispparams;
HRESULT hr;
OLECHAR *funcname;
- char *error_message;
+ SAFEARRAY *pSA;
+ SAFEARRAYBOUND rgsabound[1];
VARIANT *variant_args;
+ char *error_message;
int current_arg, current_variant;
- DISPPARAMS dispparams;
- SAFEARRAY *pSA;
+ unsigned long count;
if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "next")) {
/* Grab one argument off the stack, allocate enough
* VARIANTs
* Get the IEnumVariant interface and call ->Next();
*/
- SAFEARRAYBOUND rgsabound[1];
- unsigned long count;
switch (arg_count) {
case 0:
if ((pSA = SafeArrayCreate(VT_VARIANT, 1, rgsabound)) == NULL) {
VariantInit(var_result);
-
return FAILURE;
} else {
V_ARRAY(var_result) = pSA;
}
return SUCCESS;
+ } else if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "all")) {
+#define FETCH_BLOCKSIZE 10 /* fetch blocks of 10 elements */
+
+ count = FETCH_BLOCKSIZE;
+
+ rgsabound[0].lLbound = 0;
+ rgsabound[0].cElements = count;
+
+ if ((pSA = SafeArrayCreate(VT_VARIANT, 1, rgsabound)) == NULL) {
+ VariantInit(var_result);
+ return FAILURE;
+ } else {
+ V_ARRAY(var_result) = pSA;
+ V_VT(var_result) = VT_VARIANT|VT_ARRAY;
+ }
+
+ /* blah*/
+
+
} else if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "reset")) {
if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Reset(C_ENUMVARIANT(obj)))) {
char *error_message = php_COM_error_message(hr TSRMLS_CC);
{
le_comval = zend_register_list_destructors_ex(php_comval_destructor, NULL, "COM", module_number);
php_register_COM_class(TSRMLS_C);
+
+ php_VARIANT_init(module_number, TSRMLS_C);
+
REGISTER_INI_ENTRIES();
return SUCCESS;
}
1) Multi-dimenstional array support
-- done 2) IErrorInfo
+-- done 13) export VARIANT through the COM module
3) WithEvents
4) Documentation (internal and user) and howtos
5) IEnumVariant::All() which would be like IEnumVariant::Next(IDispatch::Count)
9) reduce the need for VARIANT()
10) lets try if we are able to call non IDispatch - only Typelib components
-- done 11) IEnumVariant::Next() without parameter should only return an object, not an array with one element
-12) VARIANT->value as lvalue
+-- done 12) VARIANT->value as lvalue
ad 6.) check vbsample.php (new VARIANT(*, *|VT_BYREF)) GPs
ad 4.) faq (i've collected a few questions from various lists)
+ variant attributes !!
to be discussed:
static zend_class_entry VARIANT_class_entry;
-function_entry VARIANT_functions[] = {
- {NULL, NULL, NULL}
-};
-
-
-static PHP_MINFO_FUNCTION(VARIANT)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "VARIANT support", "enabled");
- php_info_print_table_end();
-}
-
-
-zend_module_entry VARIANT_module_entry = {
- "variant", VARIANT_functions, PHP_MINIT(VARIANT), PHP_MSHUTDOWN(VARIANT), NULL, NULL, PHP_MINFO(VARIANT), STANDARD_MODULE_PROPERTIES
-};
-
-
-PHP_MINIT_FUNCTION(VARIANT)
+void php_VARIANT_init(int module_number, TSRMLS_D)
{
le_variant = zend_register_list_destructors_ex(php_VARIANT_destructor, NULL, "VARIANT", module_number);
REGISTER_LONG_CONSTANT("CP_OEMCP", CP_OEMCP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_UTF7", CP_UTF7, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_UTF8", CP_UTF8, CONST_CS | CONST_PERSISTENT);
+
#ifdef CP_SYMBOL
REGISTER_LONG_CONSTANT("CP_SYMBOL", CP_SYMBOL, CONST_CS | CONST_PERSISTENT);
#else
#endif
php_register_VARIANT_class(TSRMLS_C);
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(VARIANT)
-{
- return SUCCESS;
}
static int do_VARIANT_propset(VARIANT *var_arg, pval *arg_property, pval *value TSRMLS_DC)
{
- pval type;
+ int type;
- Z_TYPE(type) = IS_STRING;
+ if (!strcmp(Z_STRVAL_P(arg_property), "value")) {
+ php_pval_to_variant(value, var_arg, codepage TSRMLS_CC);
- if (!strcmp(Z_STRVAL_P(arg_property), "bVal")) {
- Z_LVAL(type) = VT_UI1;
+ return SUCCESS;
+ } else if (!strcmp(Z_STRVAL_P(arg_property), "bVal")) {
+ type = VT_UI1;
} else if (!strcmp(Z_STRVAL_P(arg_property), "iVal")) {
- Z_LVAL(type) = VT_I2;
+ type = VT_I2;
} else if (!strcmp(Z_STRVAL_P(arg_property), "lVal")) {
- Z_LVAL(type) = VT_I4;
+ type = VT_I4;
} else if (!strcmp(Z_STRVAL_P(arg_property), "fltVal")) {
- Z_LVAL(type) = VT_R4;
+ type = VT_R4;
} else if (!strcmp(Z_STRVAL_P(arg_property), "dblVal")) {
- Z_LVAL(type) = VT_R8;
+ type = VT_R8;
} else if (!strcmp(Z_STRVAL_P(arg_property), "boolVal")) {
- Z_LVAL(type) = VT_BOOL;
+ type = VT_BOOL;
} else if (!strcmp(Z_STRVAL_P(arg_property), "scode")) {
- Z_LVAL(type) = VT_ERROR;
+ type = VT_ERROR;
} else if (!strcmp(Z_STRVAL_P(arg_property), "cyVal")) {
- Z_LVAL(type) = VT_CY;
+ type = VT_CY;
} else if (!strcmp(Z_STRVAL_P(arg_property), "date")) {
- Z_LVAL(type) = VT_DATE;
+ type = VT_DATE;
} else if (!strcmp(Z_STRVAL_P(arg_property), "bstrVal")) {
- Z_LVAL(type) = VT_BSTR;
+ type = VT_BSTR;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pdecVal")) {
- Z_LVAL(type) = VT_DECIMAL|VT_BYREF;
+ type = VT_DECIMAL|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "punkVal")) {
- Z_LVAL(type) = VT_UNKNOWN;
+ type = VT_UNKNOWN;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pdispVal")) {
- Z_LVAL(type) = VT_DISPATCH;
+ type = VT_DISPATCH;
} else if (!strcmp(Z_STRVAL_P(arg_property), "parray")) {
- Z_LVAL(type) = VT_ARRAY;
+ type = VT_ARRAY;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pbVal")) {
- Z_LVAL(type) = VT_UI1|VT_BYREF;
+ type = VT_UI1|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "piVal")) {
- Z_LVAL(type) = VT_I2|VT_BYREF;
+ type = VT_I2|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "plVal")) {
- Z_LVAL(type) = VT_I4|VT_BYREF;
+ type = VT_I4|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pfltVal")) {
- Z_LVAL(type) = VT_R4|VT_BYREF;
+ type = VT_R4|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pdblVal")) {
- Z_LVAL(type) = VT_R8|VT_BYREF;
+ type = VT_R8|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pboolVal")) {
- Z_LVAL(type) = VT_BOOL|VT_BYREF;
+ type = VT_BOOL|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pscode")) {
- Z_LVAL(type) = VT_ERROR|VT_BYREF;
+ type = VT_ERROR|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pcyVal")) {
- Z_LVAL(type) = VT_CY|VT_BYREF;
+ type = VT_CY|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pdate")) {
- Z_LVAL(type) = VT_DATE|VT_BYREF;
+ type = VT_DATE|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pbstrVal")) {
- Z_LVAL(type) = VT_BSTR|VT_BYREF;
+ type = VT_BSTR|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "ppunkVal")) {
- Z_LVAL(type) = VT_UNKNOWN|VT_BYREF;
+ type = VT_UNKNOWN|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "ppdispVal")) {
- Z_LVAL(type) = VT_DISPATCH|VT_BYREF;
+ type = VT_DISPATCH|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pparray")) {
- Z_LVAL(type) = VT_ARRAY|VT_BYREF;
+ type = VT_ARRAY|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pvarVal")) {
- Z_LVAL(type) = VT_VARIANT|VT_BYREF;
+ type = VT_VARIANT|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "byref")) {
- Z_LVAL(type) = VT_BYREF;
+ type = VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "cVal")) {
- Z_LVAL(type) = VT_I1;
+ type = VT_I1;
} else if (!strcmp(Z_STRVAL_P(arg_property), "uiVal")) {
- Z_LVAL(type) = VT_UI2;
+ type = VT_UI2;
} else if (!strcmp(Z_STRVAL_P(arg_property), "ulVal")) {
- Z_LVAL(type) = VT_UI4;
+ type = VT_UI4;
} else if (!strcmp(Z_STRVAL_P(arg_property), "intVal")) {
- Z_LVAL(type) = VT_INT;
+ type = VT_INT;
} else if (!strcmp(Z_STRVAL_P(arg_property), "uintVal")) {
- Z_LVAL(type) = VT_UINT|VT_BYREF;
+ type = VT_UINT|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pcVal")) {
- Z_LVAL(type) = VT_I1|VT_BYREF;
+ type = VT_I1|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "puiVal")) {
- Z_LVAL(type) = VT_UI2|VT_BYREF;
+ type = VT_UI2|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pulVal")) {
- Z_LVAL(type) = VT_UI4|VT_BYREF;
+ type = VT_UI4|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pintVal")) {
- Z_LVAL(type) = VT_INT|VT_BYREF;
+ type = VT_INT|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "puintVal")) {
- Z_LVAL(type) = VT_UINT|VT_BYREF;
+ type = VT_UINT|VT_BYREF;
} else {
php_error(E_WARNING, "Unknown member.");
return FAILURE;
}
- php_pval_to_variant_ex(value, var_arg, &type, codepage TSRMLS_CC);
+ php_pval_to_variant_ex2(value, var_arg, type, codepage TSRMLS_CC);
return SUCCESS;
}
/* prototypes */
-static void pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, int type, int codepage TSRMLS_DC);
static void comval_to_variant(pval *pval_arg, VARIANT *var_arg TSRMLS_DC);
/* implementations */
break;
}
- if (pval_arg->is_ref) { /* deprecated, implemented for downwards compatiblity */
-// type |= VT_BYREF;
- }
-
- pval_to_variant_ex(pval_arg, var_arg, type, codepage TSRMLS_CC);
+ php_pval_to_variant_ex2(pval_arg, var_arg, type, codepage TSRMLS_CC);
}
PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_type, int codepage TSRMLS_DC)
{
- pval_to_variant_ex(pval_arg, var_arg, Z_LVAL_P(pval_type), codepage TSRMLS_CC);
+ php_pval_to_variant_ex2(pval_arg, var_arg, Z_LVAL_P(pval_type), codepage TSRMLS_CC);
}
-static void pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, int type, int codepage TSRMLS_DC)
+PHPAPI void php_pval_to_variant_ex2(pval *pval_arg, VARIANT *var_arg, int type, int codepage TSRMLS_DC)
{
OLECHAR *unicode_str;
/* Add another value to the safe array */
if (SUCCEEDED(SafeArrayPtrOfIndex( safeArray, &i, &v))) { /* Pointer to output element entry retrieved successfully */
if (type) { /* explicit type */
- pval_to_variant_ex(*entry, v, type, codepage TSRMLS_CC); /* Do the required conversion */
+ php_pval_to_variant_ex2(*entry, v, type, codepage TSRMLS_CC); /* Do the required conversion */
} else {
php_pval_to_variant(*entry, v, codepage TSRMLS_CC); /* Do the required conversion */
}
case VT_BSTR:
convert_to_string_ex(&pval_arg);
unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
- V_BSTR(var_arg) = SysAllocString(unicode_str);
+ V_BSTR(var_arg) = SysAllocStringByteLen((char *) unicode_str, Z_STRLEN_P(pval_arg));
+/* @todo test
+ V_BSTR(var_arg) = SysAllocString(unicode_str); */
efree(unicode_str);
break;
/* This call has failed for everything I have tried */
/* But best leave it to be on the safe side */
- if (FAILED(SafeArrayGetVartype(array, &vartype))) {
+ if (FAILED(SafeArrayGetVartype(array, &vartype)) || (vartype == VT_EMPTY)) {
/* Fall back to what we do know */
/* Mask off the array bit and assume */
/* what is left is the type of the array */
PHPAPI void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage TSRMLS_DC);
PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_type, int codepage TSRMLS_DC);
+PHPAPI void php_pval_to_variant_ex2(pval *pval_arg, VARIANT *var_arg, int type, int codepage TSRMLS_DC);
PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int codepage TSRMLS_DC);
PHPAPI OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage TSRMLS_DC);
PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int codepage TSRMLS_DC);
#include "conversion.h"
#include "variant.h"
-PHP_MINIT_FUNCTION(VARIANT);
-PHP_MSHUTDOWN_FUNCTION(VARIANT);
+void php_VARIANT_init(int module_number, TSRMLS_D);
PHPAPI int php_VARIANT_get_le_variant();
-zend_module_entry VARIANT_module_entry;
-
END_EXTERN_C()
-#define VARIANT_module_ptr &VARIANT_module_entry
-
-#else
-
-#define VARIANT_module_ptr NULL
-
#endif /* PHP_WIN32 */
-#define phpext_VARIANT_ptr VARIANT_module_ptr
-
#endif /* PHP_TYPEDEF_VARIANT_H */
1) Multi-dimenstional array support
-- done 2) IErrorInfo
+-- done 13) export VARIANT through the COM module
3) WithEvents
4) Documentation (internal and user) and howtos
5) IEnumVariant::All() which would be like IEnumVariant::Next(IDispatch::Count)
9) reduce the need for VARIANT()
10) lets try if we are able to call non IDispatch - only Typelib components
-- done 11) IEnumVariant::Next() without parameter should only return an object, not an array with one element
-12) VARIANT->value as lvalue
+-- done 12) VARIANT->value as lvalue
ad 6.) check vbsample.php (new VARIANT(*, *|VT_BYREF)) GPs
ad 4.) faq (i've collected a few questions from various lists)
+ variant attributes !!
to be discussed:
pResults.pIID = &IID_IDispatch;
pResults.pItf = NULL;
pResults.hr = S_OK;
- hr=CoCreateInstanceEx(&clsid, NULL, CLSCTX_SERVER, &server_info, 1, &pResults);
+ hr = CoCreateInstanceEx(&clsid, NULL, CLSCTX_REMOTE_SERVER, &server_info, 1, &pResults);
if (SUCCEEDED(hr)) {
hr = pResults.hr;
C_DISPATCH(obj) = (IDispatch *) pResults.pItf;
int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **arguments, int arg_count TSRMLS_DC)
{
DISPID dispid;
+ DISPPARAMS dispparams;
HRESULT hr;
OLECHAR *funcname;
- char *error_message;
+ SAFEARRAY *pSA;
+ SAFEARRAYBOUND rgsabound[1];
VARIANT *variant_args;
+ char *error_message;
int current_arg, current_variant;
- DISPPARAMS dispparams;
- SAFEARRAY *pSA;
+ unsigned long count;
if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "next")) {
/* Grab one argument off the stack, allocate enough
* VARIANTs
* Get the IEnumVariant interface and call ->Next();
*/
- SAFEARRAYBOUND rgsabound[1];
- unsigned long count;
switch (arg_count) {
case 0:
if ((pSA = SafeArrayCreate(VT_VARIANT, 1, rgsabound)) == NULL) {
VariantInit(var_result);
-
return FAILURE;
} else {
V_ARRAY(var_result) = pSA;
}
return SUCCESS;
+ } else if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "all")) {
+#define FETCH_BLOCKSIZE 10 /* fetch blocks of 10 elements */
+
+ count = FETCH_BLOCKSIZE;
+
+ rgsabound[0].lLbound = 0;
+ rgsabound[0].cElements = count;
+
+ if ((pSA = SafeArrayCreate(VT_VARIANT, 1, rgsabound)) == NULL) {
+ VariantInit(var_result);
+ return FAILURE;
+ } else {
+ V_ARRAY(var_result) = pSA;
+ V_VT(var_result) = VT_VARIANT|VT_ARRAY;
+ }
+
+ /* blah*/
+
+
} else if (C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "reset")) {
if (FAILED(hr = C_ENUMVARIANT_VT(obj)->Reset(C_ENUMVARIANT(obj)))) {
char *error_message = php_COM_error_message(hr TSRMLS_CC);
{
le_comval = zend_register_list_destructors_ex(php_comval_destructor, NULL, "COM", module_number);
php_register_COM_class(TSRMLS_C);
+
+ php_VARIANT_init(module_number, TSRMLS_C);
+
REGISTER_INI_ENTRIES();
return SUCCESS;
}
/* prototypes */
-static void pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, int type, int codepage TSRMLS_DC);
static void comval_to_variant(pval *pval_arg, VARIANT *var_arg TSRMLS_DC);
/* implementations */
break;
}
- if (pval_arg->is_ref) { /* deprecated, implemented for downwards compatiblity */
-// type |= VT_BYREF;
- }
-
- pval_to_variant_ex(pval_arg, var_arg, type, codepage TSRMLS_CC);
+ php_pval_to_variant_ex2(pval_arg, var_arg, type, codepage TSRMLS_CC);
}
PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_type, int codepage TSRMLS_DC)
{
- pval_to_variant_ex(pval_arg, var_arg, Z_LVAL_P(pval_type), codepage TSRMLS_CC);
+ php_pval_to_variant_ex2(pval_arg, var_arg, Z_LVAL_P(pval_type), codepage TSRMLS_CC);
}
-static void pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, int type, int codepage TSRMLS_DC)
+PHPAPI void php_pval_to_variant_ex2(pval *pval_arg, VARIANT *var_arg, int type, int codepage TSRMLS_DC)
{
OLECHAR *unicode_str;
/* Add another value to the safe array */
if (SUCCEEDED(SafeArrayPtrOfIndex( safeArray, &i, &v))) { /* Pointer to output element entry retrieved successfully */
if (type) { /* explicit type */
- pval_to_variant_ex(*entry, v, type, codepage TSRMLS_CC); /* Do the required conversion */
+ php_pval_to_variant_ex2(*entry, v, type, codepage TSRMLS_CC); /* Do the required conversion */
} else {
php_pval_to_variant(*entry, v, codepage TSRMLS_CC); /* Do the required conversion */
}
case VT_BSTR:
convert_to_string_ex(&pval_arg);
unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
- V_BSTR(var_arg) = SysAllocString(unicode_str);
+ V_BSTR(var_arg) = SysAllocStringByteLen((char *) unicode_str, Z_STRLEN_P(pval_arg));
+/* @todo test
+ V_BSTR(var_arg) = SysAllocString(unicode_str); */
efree(unicode_str);
break;
/* This call has failed for everything I have tried */
/* But best leave it to be on the safe side */
- if (FAILED(SafeArrayGetVartype(array, &vartype))) {
+ if (FAILED(SafeArrayGetVartype(array, &vartype)) || (vartype == VT_EMPTY)) {
/* Fall back to what we do know */
/* Mask off the array bit and assume */
/* what is left is the type of the array */
PHPAPI void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage TSRMLS_DC);
PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_type, int codepage TSRMLS_DC);
+PHPAPI void php_pval_to_variant_ex2(pval *pval_arg, VARIANT *var_arg, int type, int codepage TSRMLS_DC);
PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int codepage TSRMLS_DC);
PHPAPI OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage TSRMLS_DC);
PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int codepage TSRMLS_DC);
#include "conversion.h"
#include "variant.h"
-PHP_MINIT_FUNCTION(VARIANT);
-PHP_MSHUTDOWN_FUNCTION(VARIANT);
+void php_VARIANT_init(int module_number, TSRMLS_D);
PHPAPI int php_VARIANT_get_le_variant();
-zend_module_entry VARIANT_module_entry;
-
END_EXTERN_C()
-#define VARIANT_module_ptr &VARIANT_module_entry
-
-#else
-
-#define VARIANT_module_ptr NULL
-
#endif /* PHP_WIN32 */
-#define phpext_VARIANT_ptr VARIANT_module_ptr
-
#endif /* PHP_TYPEDEF_VARIANT_H */
static zend_class_entry VARIANT_class_entry;
-function_entry VARIANT_functions[] = {
- {NULL, NULL, NULL}
-};
-
-
-static PHP_MINFO_FUNCTION(VARIANT)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "VARIANT support", "enabled");
- php_info_print_table_end();
-}
-
-
-zend_module_entry VARIANT_module_entry = {
- "variant", VARIANT_functions, PHP_MINIT(VARIANT), PHP_MSHUTDOWN(VARIANT), NULL, NULL, PHP_MINFO(VARIANT), STANDARD_MODULE_PROPERTIES
-};
-
-
-PHP_MINIT_FUNCTION(VARIANT)
+void php_VARIANT_init(int module_number, TSRMLS_D)
{
le_variant = zend_register_list_destructors_ex(php_VARIANT_destructor, NULL, "VARIANT", module_number);
REGISTER_LONG_CONSTANT("CP_OEMCP", CP_OEMCP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_UTF7", CP_UTF7, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("CP_UTF8", CP_UTF8, CONST_CS | CONST_PERSISTENT);
+
#ifdef CP_SYMBOL
REGISTER_LONG_CONSTANT("CP_SYMBOL", CP_SYMBOL, CONST_CS | CONST_PERSISTENT);
#else
#endif
php_register_VARIANT_class(TSRMLS_C);
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(VARIANT)
-{
- return SUCCESS;
}
static int do_VARIANT_propset(VARIANT *var_arg, pval *arg_property, pval *value TSRMLS_DC)
{
- pval type;
+ int type;
- Z_TYPE(type) = IS_STRING;
+ if (!strcmp(Z_STRVAL_P(arg_property), "value")) {
+ php_pval_to_variant(value, var_arg, codepage TSRMLS_CC);
- if (!strcmp(Z_STRVAL_P(arg_property), "bVal")) {
- Z_LVAL(type) = VT_UI1;
+ return SUCCESS;
+ } else if (!strcmp(Z_STRVAL_P(arg_property), "bVal")) {
+ type = VT_UI1;
} else if (!strcmp(Z_STRVAL_P(arg_property), "iVal")) {
- Z_LVAL(type) = VT_I2;
+ type = VT_I2;
} else if (!strcmp(Z_STRVAL_P(arg_property), "lVal")) {
- Z_LVAL(type) = VT_I4;
+ type = VT_I4;
} else if (!strcmp(Z_STRVAL_P(arg_property), "fltVal")) {
- Z_LVAL(type) = VT_R4;
+ type = VT_R4;
} else if (!strcmp(Z_STRVAL_P(arg_property), "dblVal")) {
- Z_LVAL(type) = VT_R8;
+ type = VT_R8;
} else if (!strcmp(Z_STRVAL_P(arg_property), "boolVal")) {
- Z_LVAL(type) = VT_BOOL;
+ type = VT_BOOL;
} else if (!strcmp(Z_STRVAL_P(arg_property), "scode")) {
- Z_LVAL(type) = VT_ERROR;
+ type = VT_ERROR;
} else if (!strcmp(Z_STRVAL_P(arg_property), "cyVal")) {
- Z_LVAL(type) = VT_CY;
+ type = VT_CY;
} else if (!strcmp(Z_STRVAL_P(arg_property), "date")) {
- Z_LVAL(type) = VT_DATE;
+ type = VT_DATE;
} else if (!strcmp(Z_STRVAL_P(arg_property), "bstrVal")) {
- Z_LVAL(type) = VT_BSTR;
+ type = VT_BSTR;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pdecVal")) {
- Z_LVAL(type) = VT_DECIMAL|VT_BYREF;
+ type = VT_DECIMAL|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "punkVal")) {
- Z_LVAL(type) = VT_UNKNOWN;
+ type = VT_UNKNOWN;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pdispVal")) {
- Z_LVAL(type) = VT_DISPATCH;
+ type = VT_DISPATCH;
} else if (!strcmp(Z_STRVAL_P(arg_property), "parray")) {
- Z_LVAL(type) = VT_ARRAY;
+ type = VT_ARRAY;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pbVal")) {
- Z_LVAL(type) = VT_UI1|VT_BYREF;
+ type = VT_UI1|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "piVal")) {
- Z_LVAL(type) = VT_I2|VT_BYREF;
+ type = VT_I2|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "plVal")) {
- Z_LVAL(type) = VT_I4|VT_BYREF;
+ type = VT_I4|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pfltVal")) {
- Z_LVAL(type) = VT_R4|VT_BYREF;
+ type = VT_R4|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pdblVal")) {
- Z_LVAL(type) = VT_R8|VT_BYREF;
+ type = VT_R8|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pboolVal")) {
- Z_LVAL(type) = VT_BOOL|VT_BYREF;
+ type = VT_BOOL|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pscode")) {
- Z_LVAL(type) = VT_ERROR|VT_BYREF;
+ type = VT_ERROR|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pcyVal")) {
- Z_LVAL(type) = VT_CY|VT_BYREF;
+ type = VT_CY|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pdate")) {
- Z_LVAL(type) = VT_DATE|VT_BYREF;
+ type = VT_DATE|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pbstrVal")) {
- Z_LVAL(type) = VT_BSTR|VT_BYREF;
+ type = VT_BSTR|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "ppunkVal")) {
- Z_LVAL(type) = VT_UNKNOWN|VT_BYREF;
+ type = VT_UNKNOWN|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "ppdispVal")) {
- Z_LVAL(type) = VT_DISPATCH|VT_BYREF;
+ type = VT_DISPATCH|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pparray")) {
- Z_LVAL(type) = VT_ARRAY|VT_BYREF;
+ type = VT_ARRAY|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pvarVal")) {
- Z_LVAL(type) = VT_VARIANT|VT_BYREF;
+ type = VT_VARIANT|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "byref")) {
- Z_LVAL(type) = VT_BYREF;
+ type = VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "cVal")) {
- Z_LVAL(type) = VT_I1;
+ type = VT_I1;
} else if (!strcmp(Z_STRVAL_P(arg_property), "uiVal")) {
- Z_LVAL(type) = VT_UI2;
+ type = VT_UI2;
} else if (!strcmp(Z_STRVAL_P(arg_property), "ulVal")) {
- Z_LVAL(type) = VT_UI4;
+ type = VT_UI4;
} else if (!strcmp(Z_STRVAL_P(arg_property), "intVal")) {
- Z_LVAL(type) = VT_INT;
+ type = VT_INT;
} else if (!strcmp(Z_STRVAL_P(arg_property), "uintVal")) {
- Z_LVAL(type) = VT_UINT|VT_BYREF;
+ type = VT_UINT|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pcVal")) {
- Z_LVAL(type) = VT_I1|VT_BYREF;
+ type = VT_I1|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "puiVal")) {
- Z_LVAL(type) = VT_UI2|VT_BYREF;
+ type = VT_UI2|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pulVal")) {
- Z_LVAL(type) = VT_UI4|VT_BYREF;
+ type = VT_UI4|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "pintVal")) {
- Z_LVAL(type) = VT_INT|VT_BYREF;
+ type = VT_INT|VT_BYREF;
} else if (!strcmp(Z_STRVAL_P(arg_property), "puintVal")) {
- Z_LVAL(type) = VT_UINT|VT_BYREF;
+ type = VT_UINT|VT_BYREF;
} else {
php_error(E_WARNING, "Unknown member.");
return FAILURE;
}
- php_pval_to_variant_ex(value, var_arg, &type, codepage TSRMLS_CC);
+ php_pval_to_variant_ex2(value, var_arg, type, codepage TSRMLS_CC);
return SUCCESS;
}