summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sapi/activescript/README10
-rw-r--r--sapi/activescript/classfactory.cpp8
-rw-r--r--sapi/activescript/scriptengine.cpp34
3 files changed, 38 insertions, 14 deletions
diff --git a/sapi/activescript/README b/sapi/activescript/README
index 67e1ed1879..a0d9d0f14f 100644
--- a/sapi/activescript/README
+++ b/sapi/activescript/README
@@ -23,7 +23,7 @@ Build and install it somewhere; then register the engine like this:
Configuration.
==============
-ActivePHP will not use the default php.ini file.
+PHPScript will not use the default php.ini file.
Instead, it will look only in the same directory as the .exe that caused it to
load.
@@ -38,22 +38,22 @@ o. Windows Script Host
Create a .wsf file like this:
<job id="test">
- <script language="ActivePHP5">
+ <script language="PHPScript">
$WScript->Echo("Hello");
</script>
</job>
o. ASP and ASP.NET
- <%@language=ActivePHP5 %>
+ <%@language=PHPScript %>
<% $Response->Write("Hello"); %>
o. Windows Script Components / Behaviours
- Use language="ActivePHP5" on your <script> tags
+ Use language="PHPScript" on your <script> tags
o. MS Scriptlet control
- Set the language property to "ActivePHP5"
+ Set the language property to "PHPScript"
diff --git a/sapi/activescript/classfactory.cpp b/sapi/activescript/classfactory.cpp
index 5fa37c9f03..f4e2c9bd87 100644
--- a/sapi/activescript/classfactory.cpp
+++ b/sapi/activescript/classfactory.cpp
@@ -150,10 +150,10 @@ static const struct reg_entry engine_entries[] = {
{ 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},
+ { HKEY_CLASSES_ROOT, "CLSID\\[CLSID]\\ProgID", NULL, "PHPScript" },
+ { HKEY_CLASSES_ROOT, "PHPScript", NULL, "PHPScript" },
+ { HKEY_CLASSES_ROOT, "PHPScript\\CLSID", NULL, "[CLSID]"},
+ { HKEY_CLASSES_ROOT, "PHPScript\\OLEScript", NULL, NULL},
{ 0, NULL, NULL, NULL }
};
diff --git a/sapi/activescript/scriptengine.cpp b/sapi/activescript/scriptengine.cpp
index 9c035169c7..3838169486 100644
--- a/sapi/activescript/scriptengine.cpp
+++ b/sapi/activescript/scriptengine.cpp
@@ -419,7 +419,7 @@ int TPHPScriptingEngine::create_id(OLECHAR *name, DISPID *dispid TSRMLS_DC)
int i;
for (i = 0; i < m_ids; i++) {
if (!strcasecmp(m_names[i], aname.ansi_string())) {
- trace("already had this ID\n");
+ trace("already had ID %d for %s\n", i, m_names[i]);
return i;
}
}
@@ -764,7 +764,7 @@ static int execute_code_fragment(code_frag *frag,
pv.value.str.val = frag->code;
pv.value.str.len = frag->codelen;
- frag->opcodes = compile_string(&pv, "fragment (JIT)" TSRMLS_CC);
+ frag->opcodes = compile_string(&pv, "fragment" TSRMLS_CC);
if (!frag->opcodes) {
trace("*** JIT compilation of cloned opcodes failed??");
@@ -1223,7 +1223,6 @@ STDMETHODIMP TPHPScriptingEngine::SetScriptSite(IActiveScriptSite *pass)
if (pass) {
m_basethread = tsrm_thread_id();
- HRESULT ret = GIT_put(pass, IID_IActiveScriptSite, &m_asscookie);
}
if (m_pass) {
@@ -1245,6 +1244,7 @@ STDMETHODIMP TPHPScriptingEngine::SetScriptSite(IActiveScriptSite *pass)
trace("----> %s", php_win_err(ret));
if (SUCCEEDED(ret)) {
+ GIT_put(m_pass, IID_IActiveScriptSite, &m_asscookie);
SetScriptState(SCRIPTSTATE_INITIALIZED);
}
}
@@ -1374,7 +1374,7 @@ STDMETHODIMP TPHPScriptingEngine::AddNamedItem(LPCOLESTR pstrName, DWORD dwFlags
TWideString name(pstrName);
trace("AddNamedItem: %s (%08x) m_pass=%08x\n", name.ansi_string(), dwFlags, m_pass);
- res = m_pass->GetItemInfo(pstrName, SCRIPTINFO_IUNKNOWN, &punk, &ti);
+ ASS_CALL(res, GetItemInfo, (pstrName, SCRIPTINFO_IUNKNOWN, &punk, &ti));
if (SUCCEEDED(res)) {
IDispatch *disp = NULL;
@@ -1960,11 +1960,35 @@ public:
TActiveScriptError(const char *filename, const uint lineno, const char *message)
{
+ char *extra_buf, *dest;
+ int msglen = strlen(message);
+
+ extra_buf = (char*)emalloc(2 * msglen + 1);
+
+ /* convert line endings so multi-line output looks reasonable in a GUI */
+ dest = extra_buf;
+ while (*message) {
+ if (*message == '\n') {
+ *dest++ = '\r';
+ *dest++ = '\n';
+ message++;
+ } else if (*message == '\r' && message[1] == '\n') {
+ *dest++ = '\r';
+ *dest++ = '\n';
+ message+=2;
+ } else {
+ *dest++ = *message++;
+ }
+ }
+ *dest = '\0';
+
m_refcount = 0; /* start with zero refcount because this object is passed
* directly to the script site; it will call addref */
m_filename = TWideString::bstr_from_ansi((char*)filename);
- m_message = TWideString::bstr_from_ansi((char*)message);
+ m_message = TWideString::bstr_from_ansi(extra_buf);
m_lineno = lineno;
+
+ efree(extra_buf);
}
~TActiveScriptError()