wez Wed Jan 7 16:01:13 2004 EDT Added files: /php-src/sapi/activescript config.w32
Modified files: /php-src/sapi/activescript php4activescript.def scriptengine.cpp Log: Make activescript SAPI build under php5. Untested...! Index: php-src/sapi/activescript/php4activescript.def diff -u php-src/sapi/activescript/php4activescript.def:1.1 php-src/sapi/activescript/php4activescript.def:1.2 --- php-src/sapi/activescript/php4activescript.def:1.1 Sun May 19 21:35:29 2002 +++ php-src/sapi/activescript/php4activescript.def Wed Jan 7 16:01:13 2004 @@ -1,5 +1,5 @@ EXPORTS -DllCanUnloadNow @1 PRIVATE -DllGetClassObject @2 PRIVATE -DllRegisterServer @3 PRIVATE -DllUnregisterServer @4 PRIVATE +DllCanUnloadNow PRIVATE +DllGetClassObject PRIVATE +DllRegisterServer PRIVATE +DllUnregisterServer PRIVATE Index: php-src/sapi/activescript/scriptengine.cpp diff -u php-src/sapi/activescript/scriptengine.cpp:1.8 php-src/sapi/activescript/scriptengine.cpp:1.9 --- php-src/sapi/activescript/scriptengine.cpp:1.8 Tue Jun 10 16:03:44 2003 +++ php-src/sapi/activescript/scriptengine.cpp Wed Jan 7 16:01:13 2004 @@ -1,8 +1,8 @@ /* +----------------------------------------------------------------------+ - | PHP Version 4 | + | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2002 The PHP Group | + | Copyright (c) 1997-2003 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -15,7 +15,7 @@ | Authors: Wez Furlong <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: scriptengine.cpp,v 1.8 2003/06/10 20:03:44 imajes Exp $ */ +/* $Id: scriptengine.cpp,v 1.9 2004/01/07 21:01:13 wez Exp $ */ /* Implementation Notes: * @@ -43,13 +43,8 @@ #include "php_variables.h" #include "php_ini.h" #include "php4activescript.h" -#define PHP_COM_DONT_DECLARE_RPC_HANDLER 1 -#include "ext/rpc/php_rpc.h" -#include "ext/rpc/rpc_proxy.h" -#include "ext/rpc/com/com.h" -#include "ext/rpc/com/com_wrapper.h" -#include "ext/rpc/com/php_COM.h" -#include "ext/rpc/com/conversion.h" +#include "ext/com_dotnet/php_com_dotnet.h" +#include "ext/com_dotnet/php_com_dotnet_internal.h" } #include "php_ticks.h" #include "php4as_scriptengine.h" @@ -210,7 +205,7 @@ VARIANT *varResult, EXCEPINFO *excepinfo TSRMLS_DC); -static void free_code_fragment(code_frag *frag); +static void free_code_fragment(code_frag *frag TSRMLS_DC); static code_frag *clone_code_fragment(code_frag *frag, TPHPScriptingEngine *engine TSRMLS_DC); /* }}} */ @@ -470,7 +465,7 @@ frag->opcodes = compile_string(&pv, "fragment" TSRMLS_CC); if (frag->opcodes == NULL) { - free_code_fragment(frag); + free_code_fragment(frag TSRMLS_CC); if (excepinfo) { memset(excepinfo, 0, sizeof(EXCEPINFO)); @@ -485,7 +480,7 @@ return frag; } -static void free_code_fragment(code_frag *frag) +static void free_code_fragment(code_frag *frag TSRMLS_DC) { switch(frag->fragtype) { case FRAG_PROCEDURE: @@ -499,7 +494,7 @@ } if (frag->opcodes) - destroy_op_array(frag->opcodes); + destroy_op_array(frag->opcodes TSRMLS_CC); if (frag->functionname) CoTaskMemFree(frag->functionname); CoTaskMemFree(frag->code); @@ -538,7 +533,7 @@ newfrag->opcodes = compile_string(&pv, "fragment" TSRMLS_CC); if (newfrag->opcodes == NULL) { - free_code_fragment(newfrag); + free_code_fragment(newfrag TSRMLS_CC); /* if (excepinfo) { memset(excepinfo, 0, sizeof(EXCEPINFO)); @@ -616,7 +611,7 @@ if (retval_ptr) { if (varResult) - php_zval_to_variant(retval_ptr, varResult, CP_ACP); + php_com_variant_from_zval(varResult, retval_ptr, CP_ACP TSRMLS_CC); zval_ptr_dtor(&retval_ptr); } @@ -625,8 +620,9 @@ static void frag_dtor(void *pDest) { + TSRMLS_FETCH(); code_frag *frag = *(code_frag**)pDest; - free_code_fragment(frag); + free_code_fragment(frag TSRMLS_CC); } /* }}} */ @@ -796,7 +792,7 @@ if (SUCCEEDED(LoadRegTypeLib(*info->rguidTypeLib, (USHORT)info->dwMajor, (USHORT)info->dwMinor, LANG_NEUTRAL, &TypeLib))) { - php_COM_load_typelib(TypeLib, CONST_CS); + php_com_import_typelib(TypeLib, CONST_CS, CP_ACP TSRMLS_CC); TypeLib->Release(); } } @@ -1017,7 +1013,7 @@ if (Z_TYPE_PP(tmp) == IS_OBJECT) { /* FIXME: if this causes an allocation (emalloc) and we are * not in the engine thread, things could get ugly!!! */ - disp = php_COM_export_object(*tmp); + disp = php_com_wrapper_export(*tmp TSRMLS_CC); } } @@ -1256,6 +1252,8 @@ * When SCRIPTITEM_GLOBALMEMBERS is set, we're only adding COM objects to the namespace. * We could add *all* properties, but I don't like this idea; what if the value changes * while the page is running? We'd be left with stale data. + * + * TODO: evaluate if it is appropriate to register as an auto_global * */ void TPHPScriptingEngine::add_to_global_namespace(IDispatch *disp, DWORD flags, char *name TSRMLS_DC) { @@ -1273,7 +1271,7 @@ trace("Add %s to global namespace\n", name); - val = php_COM_object_from_dispatch(disp); + php_com_wrap_dispatch(val, disp, CP_ACP TSRMLS_CC); if (val == NULL) { disp->Release(); @@ -1282,7 +1280,7 @@ ZEND_SET_SYMBOL(&EG(symbol_table), name, val); - if (flags & SCRIPTITEM_GLOBALMEMBERS == 0) { + if ((flags & SCRIPTITEM_GLOBALMEMBERS) == 0) { disp->Release(); return; } @@ -1327,10 +1325,12 @@ if (sub) { /* find out its name */ typ->GetDocumentation(func->memid, &funcname, NULL, NULL, NULL); - name = php_OLECHAR_to_char(funcname, &namelen, CP_ACP, 0); + name = php_com_olestring_to_string(funcname, &namelen, CP_ACP, 0); /* add to namespace */ - zval *subval = php_COM_object_from_dispatch(sub); + zval *subval; + + php_com_wrap_dispatch(subval, sub, CP_ACP TSRMLS_CC); if (subval) { ZEND_SET_SYMBOL(&EG(symbol_table), name, subval); } @@ -1537,7 +1537,7 @@ info.dispatch = NULL; /* This hack is required because the host is likely to query us - * for a dispatch if we use any of it's objects from PHP script. + * for a dispatch if we use any of its objects from PHP script. * Since the engine thread will be waiting for the return from * a COM call, we need to deliberately poke a hole in thread * safety so that it is possible to read the symbol table from Index: php-src/sapi/activescript/config.w32 +++ php-src/sapi/activescript/config.w32 // vim:ft=javascript // $Id: config.w32,v 1.1 2004/01/07 21:01:13 wez Exp $ ARG_ENABLE('activescript', 'Build ActiveScript version of PHP', 'no'); if (PHP_ACTIVESCRIPT == "yes") { if (PHP_ZTS == "no") { ERROR("ActiveScript module requires an --enable-zts build of PHP"); } SAPI('activescript', 'classfactory.cpp php4activescript.c scriptengine.cpp', 'php' + PHP_VERSION + 'activescript.dll', '/D PHP4ISAPI_EXPORTS'); ADD_FLAG('LDFLAGS_ACTIVESCRIPT', 'oleaut32.lib ole32.lib user32.lib advapi32.lib /DEF:' + configure_module_dirname + '\\php4activescript.def'); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php