]> granicus.if.org Git - php/commitdiff
- Rename ProgID from ActivePHP (tm) to PHPScript (bah)
authorWez Furlong <wez@php.net>
Wed, 28 Jul 2004 12:32:49 +0000 (12:32 +0000)
committerWez Furlong <wez@php.net>
Wed, 28 Jul 2004 12:32:49 +0000 (12:32 +0000)
- Convert line-endings for error messages to CRLF
- Misc other tweaks

sapi/activescript/README
sapi/activescript/classfactory.cpp
sapi/activescript/scriptengine.cpp

index 67e1ed1879d55a96ed6dabde4c2ccaed655a1243..a0d9d0f14f0f83a189899404bf4bac58a12d6f0a 100644 (file)
@@ -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"
 
 
index 5fa37c9f039491bb525cb61f97f0ff640a9273e4..f4e2c9bd87b07bb59178a5a35924e6f50e671954 100644 (file)
@@ -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 }
 };
index 9c035169c768a38d7fb64f83daef383a8508bb49..3838169486faf7b5d40f6244659d2fc40acac89f 100644 (file)
@@ -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()