2006-08-23 Anders Carlsson <acarlsson@apple.com>
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Aug 2006 17:44:10 +0000 (17:44 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Aug 2006 17:44:10 +0000 (17:44 +0000)
        Reviewed by Darin.

        Make the bindings compile without CoreFoundation.

        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
        * bindings/c/c_instance.cpp:
        * bindings/c/c_utility.cpp:
        (KJS::Bindings::convertUTF8ToUTF16):
        * bindings/npapi.h:
        * bindings/runtime.cpp:
        (KJS::Bindings::Instance::createBindingForLanguageInstance):
        (KJS::Bindings::Instance::createLanguageInstanceForValue):
        * bindings/runtime_root.cpp:
        * bindings/runtime_root.h:
        * kjs/interpreter.cpp:
        (KJS::Interpreter::createLanguageInstanceForValue):
        * kjs/interpreter.h:

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

JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
JavaScriptCore/bindings/c/c_instance.cpp
JavaScriptCore/bindings/c/c_utility.cpp
JavaScriptCore/bindings/npapi.h
JavaScriptCore/bindings/runtime.cpp
JavaScriptCore/bindings/runtime_root.cpp
JavaScriptCore/bindings/runtime_root.h
JavaScriptCore/kjs/interpreter.cpp
JavaScriptCore/kjs/interpreter.h

index 4b109f8..2c7b6bb 100644 (file)
@@ -1,3 +1,23 @@
+2006-08-23  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Darin.
+
+        Make the bindings compile without CoreFoundation.
+        
+        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+        * bindings/c/c_instance.cpp:
+        * bindings/c/c_utility.cpp:
+        (KJS::Bindings::convertUTF8ToUTF16):
+        * bindings/npapi.h:
+        * bindings/runtime.cpp:
+        (KJS::Bindings::Instance::createBindingForLanguageInstance):
+        (KJS::Bindings::Instance::createLanguageInstanceForValue):
+        * bindings/runtime_root.cpp:
+        * bindings/runtime_root.h:
+        * kjs/interpreter.cpp:
+        (KJS::Interpreter::createLanguageInstanceForValue):
+        * kjs/interpreter.h:
+
 2006-08-22  Anders Carlsson  <acarlsson@apple.com>
 
         Reviewed by Darin.
index 4039b24..5fb9e92 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
        ProjectType="Visual C++"
-       Version="8.00"
+       Version="8,00"
        Name="JavaScriptCore"
        ProjectGUID="{011D10F1-B656-4A1B-A0C3-3842F02122C5}"
        RootNamespace="JavaScriptCore"
@@ -45,7 +45,7 @@
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\JavaScriptCore.intermediate\$(ConfigurationName)\JavaScriptCore.intermediate\DerivedSources\&quot;;../../;&quot;../../os-win32/&quot;;../../pcre/;../../kjs/;../../wtf/;../../../icu/include"
+                               AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\JavaScriptCore.intermediate\$(ConfigurationName)\JavaScriptCore.intermediate\DerivedSources\&quot;;../../;&quot;../../os-win32/&quot;;../../pcre/;../../kjs/;../../wtf/;../../../icu/include;../../bindings;../../bindings/c;../../bindings/jni"
                                PreprocessorDefinitions="HAVE_CONFIG_H;WIN32;__STD_C"
                                MinimalRebuild="true"
                                ExceptionHandling="0"
                                >
                        </File>
                </Filter>
+               <Filter
+                       Name="Bindings"
+                       >
+                       <File
+                               RelativePath="..\..\bindings\c\c_class.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\c\c_class.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\c\c_instance.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\c\c_instance.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\c\c_runtime.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\c\c_runtime.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\c\c_utility.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\c\c_utility.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\NP_jsobject.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\NP_jsobject.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\npapi.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\npruntime.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\npruntime.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\npruntime_impl.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\npruntime_priv.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\runtime.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\runtime.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\runtime_array.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\runtime_array.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\runtime_method.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\runtime_method.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\runtime_object.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\runtime_object.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\runtime_root.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\bindings\runtime_root.h"
+                               >
+                       </File>
+               </Filter>
        </Files>
        <Globals>
        </Globals>
index 2b1e8ac..b4a9a9f 100644 (file)
 #include "npruntime_impl.h"
 #include <wtf/Vector.h>
 
+#if PLATFORM(WIN_OS)
+#define snprintf _snprintf
+#endif
+
 namespace KJS {
 namespace Bindings {
 
index 929cfb9..549c580 100644 (file)
@@ -63,7 +63,7 @@ void convertUTF8ToUTF16(const NPUTF8 *UTF8Chars, int UTF8Length, NPUTF16 **UTF16
     if (U_SUCCESS(status)) { 
         *UTF16Chars = (NPUTF16 *)malloc(sizeof(NPUTF16) * (*UTF16Length));
         ucnv_setToUCallBack(conv, UCNV_TO_U_CALLBACK_STOP, 0, 0, 0, &status);
-        *UTF16Length = ucnv_toUChars(conv, *UTF16Chars, *UTF16Length, UTF8Chars, UTF8Length, &status); 
+        *UTF16Length = ucnv_toUChars(conv, (::UChar*)*UTF16Chars, *UTF16Length, UTF8Chars, UTF8Length, &status); 
         ucnv_close(conv);
     } 
     
index f5b93f6..5b76f6e 100644 (file)
     #include <X11/Xutil.h>
 #endif
 
+#ifdef XP_WIN
+    #include <windows.h>
+#endif
+
 #if defined(XP_MACOSX) && defined(__LP64__)
     #define NP_NO_QUICKDRAW
 #endif
index c5a86e1..8b3fa30 100644 (file)
 #include "JSLock.h"
 #include "NP_jsobject.h"
 #include "c_instance.h"
+#if PLATFORM(MAC)
 #include "jni_instance.h"
 #include "objc_instance.h"
+#endif
 #include "runtime_object.h"
 
 namespace KJS { namespace Bindings {
@@ -112,6 +114,7 @@ Instance *Instance::createBindingForLanguageInstance(BindingLanguage language, v
     Instance *newInstance = 0;
     
     switch (language) {
+#if PLATFORM(MAC)
         case Instance::JavaLanguage: {
             newInstance = new Bindings::JavaInstance((jobject)nativeInstance, executionContext);
             break;
@@ -120,6 +123,7 @@ Instance *Instance::createBindingForLanguageInstance(BindingLanguage language, v
             newInstance = new Bindings::ObjcInstance((ObjectStructPtr)nativeInstance);
             break;
         }
+#endif
         case Instance::CLanguage: {
             newInstance = new Bindings::CInstance((NPObject *)nativeInstance);
             break;
@@ -152,19 +156,21 @@ void *Instance::createLanguageInstanceForValue(ExecState*, BindingLanguage langu
     JSObject *imp = static_cast<JSObject*>(value);
     
     switch (language) {
+#if PLATFORM(MAC)
         case Instance::ObjectiveCLanguage: {
             result = createObjcInstanceForValue(value, origin, current);
             break;
         }
-        case Instance::CLanguage: {
-            result = _NPN_CreateScriptObject(0, imp, origin, current);
-            break;
-        }
         case Instance::JavaLanguage: {
             // FIXME:  factor creation of jni_jsobjects, also remove unnecessary thread
             // invocation code.
             break;
         }
+#endif
+        case Instance::CLanguage: {
+            result = _NPN_CreateScriptObject(0, imp, origin, current);
+            break;
+        }
         default:
             break;
     }
index 7351631..b8bffdd 100644 (file)
@@ -23,7 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 #include "config.h"
-#include "jni_jsobject.h"
+
 #include "object.h"
 #include "runtime_root.h"
 #include <wtf/HashCountedSet.h>
@@ -160,6 +160,7 @@ void KJS::Bindings::removeNativeReference (JSObject *imp)
     }
 }
 
+#if PLATFORM(MAC)
 // May only be set by dispatchToJavaScriptThread().
 static CFRunLoopSourceRef completionSource;
 
@@ -281,7 +282,7 @@ void RootObject::setFindRootObjectForNativeHandleFunction(FindRootObjectForNativ
     Bindings::RootObject::_performJavaScriptSource = CFRunLoopSourceCreate(NULL, 0, &sourceContext);
     CFRunLoopAddSource(Bindings::RootObject::_runLoop, Bindings::RootObject::_performJavaScriptSource, kCFRunLoopDefaultMode);
 }
-
+#endif
 // Must be called when the applet is shutdown.
 void RootObject::removeAllNativeReferences ()
 {
index 2d3585a..65a25a2 100644 (file)
@@ -27,7 +27,9 @@
 #define RUNTIME_ROOT_H_
 
 #include "interpreter.h"
+#if PLATFORM(MAC)
 #include "jni_jsobject.h"
+#endif
 #include "protect.h"
 
 namespace KJS {
@@ -60,7 +62,7 @@ public:
 
     void removeAllNativeReferences ();
 
-
+#if PLATFORM(MAC)
     // Must be called from the thread that will be used to access JavaScript.
     static void setFindRootObjectForNativeHandleFunction(FindRootObjectForNativeHandleFunctionPtr aFunc);
     static FindRootObjectForNativeHandleFunctionPtr findRootObjectForNativeHandleFunction() {
@@ -71,7 +73,7 @@ public:
     static CFRunLoopSourceRef performJavaScriptSource() { return _performJavaScriptSource; }
     
     static void dispatchToJavaScriptThread(JSObjectCallContext *context);
-    
+#endif
     const void *nativeHandle() const { return _nativeHandle; }
 
 private:
@@ -79,9 +81,11 @@ private:
     ProtectedPtr<JSObject> _imp;
     Interpreter *_interpreter;
 
+#if PLATFORM(MAC)
     static FindRootObjectForNativeHandleFunctionPtr _findRootObjectForNativeHandleFunctionPtr;
     static CFRunLoopRef _runLoop;
     static CFRunLoopSourceRef _performJavaScriptSource;
+#endif
 };
 
 } // namespace Bindings
index 30163c9..9f364b8 100644 (file)
@@ -46,9 +46,7 @@
 #include "types.h"
 #include "value.h"
 
-#if PLATFORM(MAC)
 #include "runtime.h"
-#endif
 
 #if HAVE(SYS_TIME_H)
 #include <sys/time.h>
@@ -690,13 +688,10 @@ void Interpreter::setShouldPrintExceptions(bool print)
   printExceptions = print;
 }
 
-// bindings are OS X WebKit-only for now
-#if PLATFORM(MAC)
 void *Interpreter::createLanguageInstanceForValue(ExecState *exec, int language, JSObject *value, const Bindings::RootObject *origin, const Bindings::RootObject *current)
 {
     return Bindings::Instance::createLanguageInstanceForValue (exec, (Bindings::Instance::BindingLanguage)language, value, origin, current);
 }
-#endif
 
 void Interpreter::saveBuiltins (SavedBuiltins& builtins) const
 {
index 73ba781..119f1c4 100644 (file)
@@ -304,9 +304,7 @@ namespace KJS {
      */
     virtual bool isSafeScript(const Interpreter*) { return true; }
   
-#if PLATFORM(MAC)
     virtual void *createLanguageInstanceForValue(ExecState*, int language, JSObject* value, const Bindings::RootObject* origin, const Bindings::RootObject* current);
-#endif
 
     // This is a workaround to avoid accessing the global variables for these identifiers in
     // important property lookup functions, to avoid taking PIC branches in Mach-O binaries