JavaScriptCore:
authorkmccullo <kmccullo@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Oct 2007 21:19:44 +0000 (21:19 +0000)
committerkmccullo <kmccullo@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Oct 2007 21:19:44 +0000 (21:19 +0000)
        Reviewed by Sam and Steve.

        - Added convenience methods for converting between BSTR and JSStringRefs

        * API/JSStringRefCOM.cpp: Added.
        (JSStringCreateWithCFString):
        (JSStringCopyCFString):
        * API/JSStringRefCOM.h: Added.
        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:

win:

        Reviewed by Sam and Steve.

        - Added convenience methods for converting between BSTR and JSSTringRefs
        - Added WebKit_debug.def to the project.

        * WebKit.vcproj/WebKit.def:
        * WebKit.vcproj/WebKit.vcproj:
        * WebKit.vcproj/WebKit_debug.def:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27123 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/API/JSStringRefCOM.cpp [new file with mode: 0644]
JavaScriptCore/API/JSStringRefCOM.h [new file with mode: 0644]
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
WebKit/win/ChangeLog
WebKit/win/WebKit.vcproj/WebKit.def
WebKit/win/WebKit.vcproj/WebKit.vcproj
WebKit/win/WebKit.vcproj/WebKit_debug.def

diff --git a/JavaScriptCore/API/JSStringRefCOM.cpp b/JavaScriptCore/API/JSStringRefCOM.cpp
new file mode 100644 (file)
index 0000000..1b6454f
--- /dev/null
@@ -0,0 +1,43 @@
+// -*- mode: c++; c-basic-offset: 4 -*-
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSStringRefCOM.h"
+
+#include "JSStringRef.h"
+
+JSStringRef JSStringCreateWithBSTR(BSTR string)
+{
+    return JSStringCreateWithCharacters(string, SysStringLen(string));
+}
+
+BSTR JSStringCopyBSTR(const JSStringRef string)
+{
+    return SysAllocStringLen(JSStringGetCharactersPtr(string), JSStringGetLength(string));
+}
diff --git a/JavaScriptCore/API/JSStringRefCOM.h b/JavaScriptCore/API/JSStringRefCOM.h
new file mode 100644 (file)
index 0000000..bbde5e1
--- /dev/null
@@ -0,0 +1,63 @@
+// -*- mode: c++; c-basic-offset: 4 -*-
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSStringRefCOM_h
+#define JSStringRefCOM_h
+
+#include "JSBase.h"
+
+#include <windows.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// COM convenience methods
+
+/*!
+@function
+@abstract         Creates a JavaScript string from a BSTR.
+@param string     The BSTR to copy into the new JSString.
+@result           A JSString containing string. Ownership follows the Create Rule.
+*/
+JSStringRef JSStringCreateWithBSTR(const BSTR string);
+
+/*!
+@function
+@abstract         Creates a BSTR from a JavaScript string.
+@param string     The JSString to copy into the new BSTR.
+@result           A BSTR containing string. Ownership follows the Create Rule.
+*/
+BSTR JSStringCopyBSTR(const JSStringRef string);
+    
+#ifdef __cplusplus
+}
+#endif
+
+#endif // JSStringRefCOM_h
index ea0fe6833d13da70a1ef7f4b3a5ea6b9828e6371..95ce0cc9ca9e66adf99037c0ce4878c6ef96dae0 100644 (file)
@@ -1,3 +1,15 @@
+2007-10-26  Kevin McCullough  <kmccullough@apple.com>
+
+        Reviewed by Sam and Steve.
+
+        - Added convenience methods for converting between BSTR and JSStringRefs
+
+        * API/JSStringRefCOM.cpp: Added.
+        (JSStringCreateWithCFString):
+        (JSStringCopyCFString):
+        * API/JSStringRefCOM.h: Added.
+        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+
 2007-10-26  Mark Rowe  <mrowe@apple.com>
 
         Windows build fix.
index c45acacf609a2adb588035a26034860fbf790e13..17ac9d974d995c9b2b5929b2585407d6864807d7 100644 (file)
@@ -27,7 +27,7 @@
                        <Tool\r
                                Name="VCPreBuildEventTool"\r
                                Description="Constructing generated files..."\r
-                               CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;&#x0D;&#x0A;bash build-generated-files.sh &quot;$(WebKitOutputDir)&quot; &quot;$(WebKitLibrariesDir)&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\APICast.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSBase.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSContextRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSObjectRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSStringRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSStringRefCF.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSValueRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JavaScriptCore.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSRetainPtr.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;"\r
+                               CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;&#x0D;&#x0A;bash build-generated-files.sh &quot;$(WebKitOutputDir)&quot; &quot;$(WebKitLibrariesDir)&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\APICast.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSBase.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSContextRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSObjectRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSStringRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSStringRefCF.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSStringRefCOM.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSValueRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JavaScriptCore.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSRetainPtr.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;"\r
                        />\r
                        <Tool\r
                                Name="VCCustomBuildTool"\r
                        <Tool\r
                                Name="VCPreBuildEventTool"\r
                                Description="Constructing generated files..."\r
-                               CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;&#x0D;&#x0A;bash build-generated-files.sh &quot;$(WebKitOutputDir)&quot; &quot;$(WebKitLibrariesDir)&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\APICast.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSBase.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSContextRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSObjectRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSStringRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSStringRefCF.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSValueRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JavaScriptCore.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSRetainPtr.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;"\r
+                               CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;&#x0D;&#x0A;bash build-generated-files.sh &quot;$(WebKitOutputDir)&quot; &quot;$(WebKitLibrariesDir)&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\APICast.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSBase.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSContextRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSObjectRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSStringRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSStringRefCF.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSStringRefCOM.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSValueRef.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JavaScriptCore.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\..\API\JSRetainPtr.h&quot; &quot;$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore&quot;&#x0D;&#x0A;"\r
                        />\r
                        <Tool\r
                                Name="VCCustomBuildTool"\r
                                RelativePath="..\..\API\JSStringRefCF.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\API\JSStringRefCOM.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\..\API\JSStringRefCOM.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\API\JSValueRef.cpp"\r
                                >\r
index 0035f25913681c6d2525ecadc69b2cc47fbe954f..fd0896c924061964a9dff3da870b049d164321b0 100644 (file)
@@ -1,3 +1,14 @@
+2007-10-26  Kevin McCullough  <kmccullough@apple.com>
+
+        Reviewed by Sam and Steve.
+
+        - Added convenience methods for converting between BSTR and JSSTringRefs
+        - Added WebKit_debug.def to the project.
+
+        * WebKit.vcproj/WebKit.def:
+        * WebKit.vcproj/WebKit.vcproj:
+        * WebKit.vcproj/WebKit_debug.def:
+
 2007-10-25  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Adam Roben.
index cce6bbe7b8bb8e78952961428dce597baf99416e..44def702ce9a3701f56c0b46de717e250bfba4f1 100644 (file)
@@ -41,7 +41,9 @@ EXPORTS
            JSPropertyNameArrayGetNameAtIndex
            JSPropertyNameArrayRelease
            JSPropertyNameArrayRetain
+           JSStringCopyBSTR
            JSStringCopyCFString
+           JSStringCreateWithBSTR
            JSStringCreateWithCFString
            JSStringCreateWithCharacters
            JSStringCreateWithUTF8CString
index c8197d9cf4ff7efed7e07817c5ad0da9d027a5a5..abf3c93d281ad4798ca1215cdcc36d047685d644 100644 (file)
                                RelativePath=".\WebKit.def"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath=".\WebKit_debug.def"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\WebKitGraphics.cpp"\r
                                >\r
index fbc23f4f33e18c1b54f78ed8535b55506704304c..3fc460708459938a05193897e22d2e7468591113 100644 (file)
@@ -41,7 +41,9 @@ EXPORTS
         JSPropertyNameArrayGetNameAtIndex
         JSPropertyNameArrayRelease
         JSPropertyNameArrayRetain
+        JSStringCopyBSTR
         JSStringCopyCFString
+        JSStringCreateWithBSTR
         JSStringCreateWithCFString
         JSStringCreateWithCharacters
         JSStringCreateWithUTF8CString