1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 17:22:15 +01:00

Moved to PECL

This commit is contained in:
Wez Furlong
2004-07-28 23:39:36 +00:00
parent 26319ee1a1
commit 46b2bef868
12 changed files with 0 additions and 3120 deletions

View File

@@ -1,2 +0,0 @@
ActiveScript
Wez Furlong

View File

@@ -1,5 +0,0 @@
this module is experimental,
its functions may change their names
or move to extension all together
so do not rely to much on them
you have been warned!

View File

@@ -1,56 +0,0 @@
This is the ActiveScript SAPI for PHP.
======================================
Once registered on your system (using regsvr32), you will be able to use
PHP script in any ActiveScript compliant host. The list includes:
o. Client-side script in Internet Explorer
o. Windows Script Host
o. ASP and ASP.NET
o. Windows Script Components / Behaviours
o. MS Scriptlet control
Probably the most useful of these will be using it with the scriptlet
control, or in your own activescript host, so that you can very easily
embed PHP into your win32 application.
Installation.
=============
Build and install it somewhere; then register the engine like this:
regsvr32 php5activescript.dll
Usage.
======
o. Client-side script in Internet Explorer
<script language="ActivePHP5">
$window->alert("Hello");
</script>
o. Windows Script Host
Create a .wsf file like this:
<job id="test">
<script language="ActivePHP5">
$WScript->Echo("Hello");
</script>
</script>
o. ASP and ASP.NET
<%@language=ActivePHP5 %>
<% $Response->Write("Hello"); %>
o. Windows Script Components / Behaviours
Use language="ActivePHP5" on your <script> tags
o. MS Scriptlet control
Set the language property to "ActivePHP5"

View File

@@ -1,362 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 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 |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
/* IClassFactory Implementation, and DllXXX function implementation */
#define INITGUID
#define DEBUG_CLASS_FACTORY 0
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
#include <initguid.h>
extern "C" {
HINSTANCE module_handle;
}
#include <comcat.h>
#include "TSRM.h"
#include "php5as_classfactory.h"
#include "php5as_scriptengine.h"
volatile LONG TPHPClassFactory::factory_count = 0;
volatile LONG TPHPClassFactory::object_count = 0;
/* {{{ Class Factory Implementation */
TPHPClassFactory::TPHPClassFactory()
{
m_refcount = 1;
InterlockedIncrement(const_cast<long*> (&factory_count));
}
TPHPClassFactory::~TPHPClassFactory()
{
InterlockedDecrement(const_cast<long*> (&factory_count));
}
void TPHPClassFactory::AddToObjectCount(void)
{
InterlockedIncrement(const_cast<long*> (&object_count));
}
void TPHPClassFactory::RemoveFromObjectCount(void)
{
InterlockedDecrement(const_cast<long*> (&object_count));
}
STDMETHODIMP_(DWORD) TPHPClassFactory::AddRef(void)
{
return InterlockedIncrement(const_cast<long*> (&m_refcount));
}
STDMETHODIMP_(DWORD) TPHPClassFactory::Release(void)
{
DWORD ret = InterlockedDecrement(const_cast<long*> (&m_refcount));
if (ret == 0)
delete this;
return ret;
}
STDMETHODIMP TPHPClassFactory::QueryInterface(REFIID iid, void **ppvObject)
{
*ppvObject = NULL;
if (IsEqualGUID(IID_IClassFactory, iid)) {
*ppvObject = (IClassFactory*)this;
} else if (IsEqualGUID(IID_IUnknown, iid)) {
*ppvObject = this;
}
if (*ppvObject) {
AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
STDMETHODIMP TPHPClassFactory::LockServer(BOOL fLock)
{
return E_NOTIMPL;
}
STDMETHODIMP TPHPClassFactory::CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppvObject)
{
TPHPScriptingEngine *engine = new TPHPScriptingEngine;
HRESULT ret = engine->QueryInterface(iid, ppvObject);
engine->Release();
return ret;
}
int TPHPClassFactory::CanUnload(void)
{
return (object_count + factory_count) == 0 ? 1 : 0;
}
/* }}} */
/* {{{ Registration structures */
struct reg_entry {
HKEY root_key;
char *sub_key;
char *value_name;
char *data;
};
struct reg_class {
/* REFIID here causes compilation errors */
const GUID *class_id;
char *class_name;
char *threading;
const struct reg_entry *reg;
const GUID **cats;
};
#define MAX_REG_SUBST 8
struct reg_subst {
int count;
char *names[MAX_REG_SUBST];
char *values[MAX_REG_SUBST];
};
/* }}} */
/* {{{ Registration information */
/* This registers the sapi as a scripting engine that can be instantiated using it's progid */
static const struct reg_entry engine_entries[] = {
{ HKEY_CLASSES_ROOT, "CLSID\\[CLSID]", NULL, "[CLASSNAME]" },
{ HKEY_CLASSES_ROOT, "CLSID\\[CLSID]\\InprocServer32", NULL, "[MODULENAME]" },
{ HKEY_CLASSES_ROOT, "CLSID\\[CLSID]\\InprocServer32", "ThreadingModel", "[THREADING]" },
{ HKEY_CLASSES_ROOT, "CLSID\\[CLSID]\\OLEScript", NULL, NULL },
{ HKEY_CLASSES_ROOT, "CLSID\\[CLSID]\\ProgID", NULL, "ActivePHP5" },
{ HKEY_CLASSES_ROOT, "ActivePHP5", NULL, "ActivePHP5" },
{ HKEY_CLASSES_ROOT, "ActivePHP5\\CLSID", NULL, "[CLSID]"},
{ HKEY_CLASSES_ROOT, "ActivePHP5\\OLEScript", NULL, NULL},
{ 0, NULL, NULL, NULL }
};
static const GUID *script_engine_categories[] = {
&CATID_ActiveScript,
&CATID_ActiveScriptParse,
NULL
};
static const struct reg_class classes_to_register[] = {
{ &CLSID_PHPActiveScriptEngine, "PHP Active Script Engine", "Both", engine_entries, script_engine_categories },
{ NULL, NULL, NULL, 0, NULL }
};
/* }}} */
/* {{{ Registration code */
static void substitute(struct reg_subst *subst, char *srcstring, char *deststring)
{
int i;
char *srcpos = srcstring;
char *destpos = deststring;
while(1) {
char *repstart = strchr(srcpos, '[');
if (repstart == NULL) {
strcpy(destpos, srcpos);
break;
}
/* copy everything up until that character to the dest */
strncpy(destpos, srcpos, repstart - srcpos);
destpos += repstart - srcpos;
*destpos = 0;
/* search for replacement strings in the table */
for (i = 0; i < subst->count; i++) {
int len = strlen(subst->names[i]);
if (strncmp(subst->names[i], repstart + 1, len) == 0) {
/* append the replacement value to the buffer */
strcpy(destpos, subst->values[i]);
destpos += strlen(subst->values[i]);
srcpos = repstart + len + 2;
break;
}
}
}
#if DEBUG_CLASS_FACTORY
MessageBox(0, deststring, srcstring, MB_ICONHAND);
#endif
}
static int reg_string(BOOL do_reg, struct reg_subst *subst, const struct reg_entry *entry)
{
char subbuf[MAX_PATH], valuebuf[MAX_PATH], databuf[MAX_PATH];
char *sub = NULL, *value = NULL, *data = NULL;
LRESULT res;
HKEY hkey;
DWORD disp;
if (entry->sub_key) {
substitute(subst, entry->sub_key, subbuf);
sub = subbuf;
}
if (entry->value_name) {
substitute(subst, entry->value_name, valuebuf);
value = valuebuf;
}
if (entry->data) {
substitute(subst, entry->data, databuf);
data = databuf;
}
if (do_reg) {
res = RegCreateKeyEx(entry->root_key, sub, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_WRITE, NULL, &hkey, &disp);
if (res == NOERROR) {
if (data)
res = RegSetValueEx(hkey, value, 0, REG_SZ, (LPBYTE)data, strlen(data) + 1);
RegCloseKey(hkey);
}
} else {
res = RegDeleteKey(entry->root_key, sub);
}
return res == NOERROR ? 1 : 0;
}
static int perform_registration(BOOL do_reg)
{
char module_name[MAX_PATH];
char classid[40];
int ret = 1;
int i, j;
struct reg_subst subst = {0};
LPOLESTR classidw;
ICatRegister *catreg = NULL;
CATID cats[8];
int ncats;
CoInitialize(NULL);
CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (LPVOID*)&catreg);
GetModuleFileName(module_handle, module_name, sizeof(module_name));
subst.names[0] = "CLSID";
subst.values[0] = classid;
subst.names[1] = "MODULENAME";
subst.values[1] = module_name;
subst.names[2] = "CLASSNAME";
subst.names[3] = "THREADING";
subst.count = 4;
for (i = 0; classes_to_register[i].class_id; i++) {
StringFromCLSID(*classes_to_register[i].class_id, &classidw);
WideCharToMultiByte(CP_ACP, 0, classidw, -1, classid, sizeof(classid), NULL, NULL);
classid[39] = 0;
CoTaskMemFree(classidw);
subst.values[2] = classes_to_register[i].class_name;
subst.values[3] = classes_to_register[i].threading;
if (catreg && classes_to_register[i].cats) {
ncats = 0;
while(classes_to_register[i].cats[ncats]) {
CopyMemory(&cats[ncats], classes_to_register[i].cats[ncats], sizeof(CATID));
ncats++;
}
}
if (do_reg) {
for (j = 0; classes_to_register[i].reg[j].root_key; j++) {
if (!reg_string(do_reg, &subst, &classes_to_register[i].reg[j])) {
ret = 0;
break;
}
}
if (catreg && ncats) {
catreg->RegisterClassImplCategories(*classes_to_register[i].class_id, ncats, cats);
}
} else {
if (catreg && ncats) {
catreg->UnRegisterClassImplCategories(*classes_to_register[i].class_id, ncats, cats);
}
/* do it in reverse order, so count the number of entries first */
for (j = 0; classes_to_register[i].reg[j].root_key; j++)
;
while(j-- > 0) {
if (!reg_string(do_reg, &subst, &classes_to_register[i].reg[j])) {
ret = 0;
break;
}
}
}
}
if (catreg)
catreg->Release();
CoUninitialize();
return ret;
}
/* }}} */
/* {{{ Standard COM server DllXXX entry points */
STDAPI DllCanUnloadNow(void)
{
if (TPHPClassFactory::CanUnload())
return S_OK;
return S_FALSE;
}
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
HRESULT ret = E_FAIL;
if (IsEqualCLSID(CLSID_PHPActiveScriptEngine, rclsid)) {
TPHPClassFactory *factory = new TPHPClassFactory();
if (factory) {
ret = factory->QueryInterface(riid, ppv);
factory->Release();
}
}
return ret;
}
STDAPI DllRegisterServer(void)
{
return perform_registration(TRUE) ? S_OK : S_FALSE;
}
STDAPI DllUnregisterServer(void)
{
return perform_registration(FALSE) ? S_OK : S_FALSE;
}
/* }}} */

View File

@@ -1,13 +0,0 @@
// vim:ft=javascript
// $Id$
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 php5activescript.c scriptengine.cpp', 'php' + PHP_VERSION + 'activescript.dll', '/D PHP5ISAPI_EXPORTS');
ADD_FLAG('LDFLAGS_ACTIVESCRIPT', 'oleaut32.lib ole32.lib user32.lib advapi32.lib /DEF:' + configure_module_dirname + '\\php5activescript.def');
}

View File

@@ -1,154 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 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 |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php.h"
#include "php_main.h"
#include "SAPI.h"
#include "php_globals.h"
#include "ext/standard/info.h"
#include "php_variables.h"
#include "php_ini.h"
#include "php5activescript.h"
/* SAPI definitions and DllMain */
static int php_activescript_startup(sapi_module_struct *sapi_module)
{
if (php_module_startup(sapi_module, &php_activescript_module, 1) == FAILURE) {
return FAILURE;
} else {
return SUCCESS;
}
}
static int sapi_activescript_ub_write(const char *str, uint str_length TSRMLS_DC)
{
/* In theory, this is a blackhole. In practice, I want to see the output
* in the debugger! */
char buf[1024];
uint l, a = str_length;
while(a) {
l = a;
if (l > sizeof(buf) - 1)
l = sizeof(buf) - 1;
memcpy(buf, str, l);
buf[l] = 0;
OutputDebugString(buf);
a -= l;
}
return str_length;
}
static void sapi_activescript_register_server_variables(zval *track_vars_array TSRMLS_DC)
{
}
static char *sapi_activescript_read_cookies(TSRMLS_D)
{
return NULL;
}
static int sapi_activescript_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC)
{
return SAPI_HEADER_ADD;
}
static int sapi_activescript_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
{
return SAPI_HEADER_SENT_SUCCESSFULLY;
}
zend_module_entry php_activescript_module = {
STANDARD_MODULE_HEADER,
"ActiveScript",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
STANDARD_MODULE_PROPERTIES
};
sapi_module_struct activescript_sapi_module = {
"activescript", /* name */
"Active Script", /* pretty name */
php_activescript_startup, /* startup */
php_module_shutdown_wrapper, /* shutdown */
NULL, /* activate */
NULL, /* deactivate */
sapi_activescript_ub_write, /* unbuffered write */
NULL, /* flush */
NULL, /* get uid */
NULL, /* getenv */
zend_error, /* error handler */
sapi_activescript_header_handler, /* header handler */
sapi_activescript_send_headers, /* send headers handler */
NULL, /* send header handler */
NULL, /* read POST data */
sapi_activescript_read_cookies, /* read Cookies */
sapi_activescript_register_server_variables, /* register server variables */
NULL, /* Log message */
STANDARD_SAPI_MODULE_PROPERTIES
};
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
module_handle = hinstDLL;
tsrm_startup(128, 32, TSRM_ERROR_LEVEL_CORE, "C:\\TSRM.log");
sapi_startup(&activescript_sapi_module);
if (activescript_sapi_module.startup) {
activescript_sapi_module.startup(&sapi_module);
}
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
//OutputDebugString("THREAD_DETACH\n");
ts_free_thread();
break;
case DLL_PROCESS_DETACH:
if (activescript_sapi_module.shutdown) {
activescript_sapi_module.shutdown(&sapi_module);
}
//OutputDebugString("PROCESS_DETACH\n");
tsrm_shutdown();
break;
}
return TRUE;
}

View File

@@ -1,5 +0,0 @@
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE

View File

@@ -1,185 +0,0 @@
# Microsoft Developer Studio Project File - Name="php5activescript" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=php5activescript - Win32 Debug_TS
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "php5activescript.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "php5activescript.mak" CFG="php5activescript - Win32 Debug_TS"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "php5activescript - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "php5activescript - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "php5activescript - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "php5activescript - Win32 Release_TSDbg" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "php5activescript - Win32 Debug_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug_TS"
# PROP BASE Intermediate_Dir "Debug_TS"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\..\Debug_TS"
# PROP Intermediate_Dir "Debug_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /Ze /W3 /Gm /GX /ZI /Od /Ob0 /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D "COMPILE_LIBZEND" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "_DEBUG"
# ADD RSC /l 0x40d /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /pdbtype:sept /libpath:"..\..\Debug_TS"
!ELSEIF "$(CFG)" == "php5activescript - Win32 Release_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release_TS"
# PROP BASE Intermediate_Dir "Release_TS"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\Release_TS"
# PROP Intermediate_Dir "Release_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "NDEBUG"
# ADD RSC /l 0x40d /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS"
!ELSEIF "$(CFG)" == "php5activescript - Win32 Release_TS_inline"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "php5activescript___Win32_Release_TS_inline"
# PROP BASE Intermediate_Dir "php5activescript___Win32_Release_TS_inline"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\Release_TS_inline"
# PROP Intermediate_Dir "Release_TS_inline"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "NDEBUG"
# ADD RSC /l 0x40d /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 /libpath:"..\..\Release_TS"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS_inline"
!ELSEIF "$(CFG)" == "php5activescript - Win32 Release_TSDbg"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "php5activescript___Win32_Release_TSDbg"
# PROP BASE Intermediate_Dir "php5activescript___Win32_Release_TSDbg"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\Release_TSDbg"
# PROP Intermediate_Dir "Release_TSDbg"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP5ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "NDEBUG"
# ADD RSC /l 0x40d /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /version:4.0 /dll /debug /machine:I386 /libpath:"..\..\Release_TSDbg"
!ENDIF
# Begin Target
# Name "php5activescript - Win32 Debug_TS"
# Name "php5activescript - Win32 Release_TS"
# Name "php5activescript - Win32 Release_TS_inline"
# Name "php5activescript - Win32 Release_TSDbg"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\classfactory.cpp
# End Source File
# Begin Source File
SOURCE=.\php5activescript.c
# End Source File
# Begin Source File
SOURCE=.\php5activescript.def
# End Source File
# Begin Source File
SOURCE=.\scriptengine.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\php5activescript.h
# End Source File
# Begin Source File
SOURCE=.\php5as_classfactory.h
# End Source File
# Begin Source File
SOURCE=.\php5as_scriptengine.h
# End Source File
# End Group
# End Target
# End Project

View File

@@ -1,25 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 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 |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
extern zend_module_entry php_activescript_module;
extern sapi_module_struct activescript_sapi_module;
extern HINSTANCE module_handle;
extern void activescript_error_func(int type, const char *error_msg, ...);
extern void activescript_error_handler(int type, const char *error_filename,
const uint error_lineno, const char *format, va_list args);

View File

@@ -1,59 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 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 |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
/* IClassFactory Implementation */
#include <unknwn.h>
// {CF108A38-59A9-468a-AF45-1368D7855DAE}
DEFINE_GUID(CLSID_PHPActiveScriptEngine,
0xcf108a38, 0x59a9, 0x468a, 0xaf, 0x45, 0x13, 0x68, 0xd7, 0x85, 0x5d, 0xae);
#if 0
/* this was for PHP 4 */
// {A0AD8E7A-95EC-4819-986F-78D93895F2AE}
DEFINE_GUID(CLSID_PHPActiveScriptEngine,
0xa0ad8e7a, 0x95ec, 0x4819, 0x98, 0x6f, 0x78, 0xd9, 0x38, 0x95, 0xf2, 0xae);
#endif
class TPHPClassFactory:
public IClassFactory
{
protected:
volatile LONG m_refcount;
static volatile LONG factory_count;
static volatile LONG object_count;
public: /* IUnknown */
STDMETHODIMP QueryInterface(REFIID iid, void **ppvObject);
STDMETHODIMP_(DWORD) AddRef(void);
STDMETHODIMP_(DWORD) Release(void);
public: /* IClassFactory */
STDMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppvObject);
STDMETHODIMP LockServer(BOOL fLock);
TPHPClassFactory();
~TPHPClassFactory();
static void AddToObjectCount(void);
static void RemoveFromObjectCount(void);
static int CanUnload(void);
};

View File

@@ -1,255 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 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 |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include <activscp.h>
#if ACTIVEPHP_OBJECT_SAFETY
# include <objsafe.h>
#endif
#include "zend.h"
#include <setjmp.h>
/* Definitions for thread messages */
enum {
PHPSE_STATE_CHANGE = WM_USER + 20,
PHPSE_INIT_NEW,
PHPSE_PARSE_SCRIPT,
PHPSE_ADD_SCRIPTLET,
PHPSE_CLOSE,
PHPSE_CLONE,
PHPSE_ENTER,
PHPSE_LEAVE,
PHPSE_TERMINATE,
PHPSE_PARSE_PROC,
PHPSE_EXEC_PROC,
PHPSE_ADD_NAMED_ITEM,
PHPSE_SET_SITE,
PHPSE_ADD_TYPELIB,
PHPSE_TRIGGER_ERROR,
PHPSE_GET_DISPATCH,
PHPSE_DUMMY_TICK,
};
struct php_active_script_get_dispatch_info {
LPCOLESTR pstrItemName;
DWORD dispatch;
};
struct php_active_script_add_named_item_info {
LPCOLESTR pstrName;
DWORD dwFlags;
IUnknown *punk;
ITypeInfo *ptyp;
IDispatch *pdisp;
DWORD marshal;
};
struct php_active_script_add_scriptlet_info {
/* [in] */ LPCOLESTR pstrDefaultName;
/* [in] */ LPCOLESTR pstrCode;
/* [in] */ LPCOLESTR pstrItemName;
/* [in] */ LPCOLESTR pstrSubItemName;
/* [in] */ LPCOLESTR pstrEventName;
/* [in] */ LPCOLESTR pstrDelimiter;
/* [in] */ DWORD dwSourceContextCookie;
/* [in] */ ULONG ulStartingLineNumber;
/* [in] */ DWORD dwFlags;
/* [out] */ BSTR *pbstrName;
/* [out] */ EXCEPINFO *pexcepinfo;
};
struct php_active_script_parse_info {
/* [in] */ LPCOLESTR pstrCode;
/* [in] */ LPCOLESTR pstrItemName;
/* [in] */ IUnknown *punkContext;
/* [in] */ LPCOLESTR pstrDelimiter;
/* [in] */ DWORD dwSourceContextCookie;
/* [in] */ ULONG ulStartingLineNumber;
/* [in] */ DWORD dwFlags;
/* [out] */ VARIANT *pvarResult;
/* [out] */ EXCEPINFO *pexcepinfo;
};
struct php_active_script_parse_proc_info {
/* [in] */ LPCOLESTR pstrCode;
/* [in] */ LPCOLESTR pstrFormalParams;
/* [in] */ LPCOLESTR pstrProcedureName;
/* [in] */ LPCOLESTR pstrItemName;
/* [in] */ IUnknown *punkContext;
/* [in] */ LPCOLESTR pstrDelimiter;
/* [in] */ DWORD dwSourceContextCookie;
/* [in] */ ULONG ulStartingLineNumber;
/* [in] */ DWORD dwFlags;
DWORD dispcookie;
};
struct php_active_script_add_tlb_info {
/* [in] */ const GUID * rguidTypeLib;
/* [in] */ DWORD dwMajor;
/* [in] */ DWORD dwMinor;
/* [in] */ DWORD dwFlags;
};
class TPHPScriptingEngine:
public IActiveScript,
public IActiveScriptParse,
public IActiveScriptParseProcedure
#if ACTIVEPHP_OBJECT_SAFETY
, public IObjectSafety
#endif
{
public:
volatile LONG m_refcount;
IActiveScriptSite *m_pass;
SCRIPTSTATE m_scriptstate;
MUTEX_T m_mutex;
HashTable m_script_dispatchers;
HANDLE m_engine_thread_handle;
HANDLE m_sync_thread_msg;
HRESULT m_sync_thread_ret;
/* This is hacky, but only used when the host queries us for a script dispatch */
void *** m_tsrm_hack;
void add_to_global_namespace(IDispatch *disp, DWORD flags, char *name TSRMLS_DC);
THREAD_T m_enginethread, m_basethread;
HashTable m_frags;
ULONG m_lambda_count;
IActiveScriptSite *m_pass_eng;
jmp_buf *m_err_trap;
int m_in_main, m_stop_main;
HRESULT SendThreadMessage(LONG msg, WPARAM wparam, LPARAM lparam);
void engine_thread_func(void);
HRESULT engine_thread_handler(LONG msg, WPARAM wParam, LPARAM lParam, int *handled TSRMLS_DC);
public: /* IUnknown */
STDMETHODIMP QueryInterface(REFIID iid, void **ppvObject);
STDMETHODIMP_(DWORD) AddRef(void);
STDMETHODIMP_(DWORD) Release(void);
public: /* IActiveScript */
STDMETHODIMP SetScriptSite(
/* [in] */ IActiveScriptSite *pass);
STDMETHODIMP GetScriptSite(
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject);
STDMETHODIMP SetScriptState(
/* [in] */ SCRIPTSTATE ss);
STDMETHODIMP GetScriptState(
/* [out] */ SCRIPTSTATE *pssState);
STDMETHODIMP Close( void);
STDMETHODIMP AddNamedItem(
/* [in] */ LPCOLESTR pstrName,
/* [in] */ DWORD dwFlags);
STDMETHODIMP AddTypeLib(
/* [in] */ REFGUID rguidTypeLib,
/* [in] */ DWORD dwMajor,
/* [in] */ DWORD dwMinor,
/* [in] */ DWORD dwFlags);
STDMETHODIMP GetScriptDispatch(
/* [in] */ LPCOLESTR pstrItemName,
/* [out] */ IDispatch **ppdisp);
STDMETHODIMP GetCurrentScriptThreadID(
/* [out] */ SCRIPTTHREADID *pstidThread);
STDMETHODIMP GetScriptThreadID(
/* [in] */ DWORD dwWin32ThreadId,
/* [out] */ SCRIPTTHREADID *pstidThread);
STDMETHODIMP GetScriptThreadState(
/* [in] */ SCRIPTTHREADID stidThread,
/* [out] */ SCRIPTTHREADSTATE *pstsState);
STDMETHODIMP InterruptScriptThread(
/* [in] */ SCRIPTTHREADID stidThread,
/* [in] */ const EXCEPINFO *pexcepinfo,
/* [in] */ DWORD dwFlags);
STDMETHODIMP Clone(
/* [out] */ IActiveScript **ppscript);
public: /* IActiveScriptParse */
STDMETHODIMP InitNew( void);
STDMETHODIMP AddScriptlet(
/* [in] */ LPCOLESTR pstrDefaultName,
/* [in] */ LPCOLESTR pstrCode,
/* [in] */ LPCOLESTR pstrItemName,
/* [in] */ LPCOLESTR pstrSubItemName,
/* [in] */ LPCOLESTR pstrEventName,
/* [in] */ LPCOLESTR pstrDelimiter,
/* [in] */ DWORD dwSourceContextCookie,
/* [in] */ ULONG ulStartingLineNumber,
/* [in] */ DWORD dwFlags,
/* [out] */ BSTR *pbstrName,
/* [out] */ EXCEPINFO *pexcepinfo);
STDMETHODIMP ParseScriptText(
/* [in] */ LPCOLESTR pstrCode,
/* [in] */ LPCOLESTR pstrItemName,
/* [in] */ IUnknown *punkContext,
/* [in] */ LPCOLESTR pstrDelimiter,
/* [in] */ DWORD dwSourceContextCookie,
/* [in] */ ULONG ulStartingLineNumber,
/* [in] */ DWORD dwFlags,
/* [out] */ VARIANT *pvarResult,
/* [out] */ EXCEPINFO *pexcepinfo);
public: /* IActiveScriptParseProcedure */
STDMETHODIMP ParseProcedureText(
/* [in] */ LPCOLESTR pstrCode,
/* [in] */ LPCOLESTR pstrFormalParams,
/* [in] */ LPCOLESTR pstrProcedureName,
/* [in] */ LPCOLESTR pstrItemName,
/* [in] */ IUnknown *punkContext,
/* [in] */ LPCOLESTR pstrDelimiter,
/* [in] */ DWORD dwSourceContextCookie,
/* [in] */ ULONG ulStartingLineNumber,
/* [in] */ DWORD dwFlags,
/* [out] */ IDispatch **ppdisp);
#if ACTIVEPHP_OBJECT_SAFETY
public: /* IObjectSafety */
STDMETHODIMP GetInterfaceSafetyOptions(
/* [in] */ REFIID riid, // Interface that we want options for
/* [out] */ DWORD *pdwSupportedOptions, // Options meaningful on this interface
/* [out] */ DWORD *pdwEnabledOptions); // current option values on this interface
STDMETHODIMP SetInterfaceSafetyOptions(
/* [in] */ REFIID riid, // Interface to set options for
/* [in] */ DWORD dwOptionSetMask, // Options to change
/* [in] */ DWORD dwEnabledOptions); // New option values
#endif
public:
TPHPScriptingEngine();
~TPHPScriptingEngine();
};

File diff suppressed because it is too large Load Diff