Reviewed by Geoff.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Aug 2005 22:01:31 +0000 (22:01 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Aug 2005 22:01:31 +0000 (22:01 +0000)
        - clean up exported symbols that are not in a "KJS" namespace

        * bindings/NP_jsobject.cpp: (identiferFromNPIdentifier): Marked this function static
        so it no longer has external linkage.
        * bindings/c/c_utility.h: Put all this stuff inside the KJS namespace.
        * bindings/c/c_utility.cpp: Also marked some globals static so they don't have external
        linkage; not as important given the namespace.
        * bindings/npruntime.cpp: Marked functions static so they no longer have internal linkage.
        Also removed unused _NPN_SetExceptionWithUTF8 function (not in header, had C++ linkage!).

        * bindings/jni/jni_utility.cpp: (KJS::Bindings::getJavaVM): Call KJS_GetCreatedJavaVMs
        using the soft linking header, instead of calling the JNI call. This allows processes
        to link both JavaScriptCore and JavaVM without a symbol conflict.
        * bindings/softlinking.c:
        (loadFramework): Marked this function static so it no longer has external linkage.
        (getFunctionPointer): Ditto.
        (KJS_GetCreatedJavaVMs): Renamed this so it has a KJS prefix.

        * JavaScriptCore.xcodeproj/project.pbxproj: Added softlinking.h.
        * bindings/softlinking.h: Added.

        * kjs/nodes2string.cpp: (streamAssignmentOperatorTo): Marked this function static so it
        no longer has external linkage.

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

JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
JavaScriptCore/bindings/NP_jsobject.cpp
JavaScriptCore/bindings/c/c_utility.cpp
JavaScriptCore/bindings/c/c_utility.h
JavaScriptCore/bindings/jni/jni_utility.cpp
JavaScriptCore/bindings/npruntime.cpp
JavaScriptCore/bindings/softlinking.c
JavaScriptCore/bindings/softlinking.h [new file with mode: 0644]
JavaScriptCore/kjs/nodes2string.cpp

index e89782c415c6b6cb9f75fdbf32734181a2b847d4..8ae1bd6b2dc98108b19d5fc22d52c5d2a2e5aba9 100644 (file)
@@ -1,3 +1,31 @@
+2005-08-16  Darin Adler  <darin@apple.com>
+
+        Reviewed by Geoff.
+
+        - clean up exported symbols that are not in a "KJS" namespace
+
+        * bindings/NP_jsobject.cpp: (identiferFromNPIdentifier): Marked this function static
+        so it no longer has external linkage.
+        * bindings/c/c_utility.h: Put all this stuff inside the KJS namespace.
+        * bindings/c/c_utility.cpp: Also marked some globals static so they don't have external
+        linkage; not as important given the namespace.
+        * bindings/npruntime.cpp: Marked functions static so they no longer have internal linkage.
+        Also removed unused _NPN_SetExceptionWithUTF8 function (not in header, had C++ linkage!).
+
+        * bindings/jni/jni_utility.cpp: (KJS::Bindings::getJavaVM): Call KJS_GetCreatedJavaVMs
+        using the soft linking header, instead of calling the JNI call. This allows processes
+        to link both JavaScriptCore and JavaVM without a symbol conflict.
+        * bindings/softlinking.c:
+        (loadFramework): Marked this function static so it no longer has external linkage.
+        (getFunctionPointer): Ditto.
+        (KJS_GetCreatedJavaVMs): Renamed this so it has a KJS prefix.
+
+        * JavaScriptCore.xcodeproj/project.pbxproj: Added softlinking.h.
+        * bindings/softlinking.h: Added.
+
+        * kjs/nodes2string.cpp: (streamAssignmentOperatorTo): Marked this function static so it
+        no longer has external linkage.
+
 2005-08-15  Darin Adler  <darin@apple.com>
 
         Reviewed by Geoff.
index 068315a76313870c056908fa5159d40f06cce7ac..cb991766eb34749404093852e6e439879411d61b 100644 (file)
                932FC11D0824A6A3005B3C75 /* create_hash_table in Headers */ = {isa = PBXBuildFile; fileRef = F692A8540255597D01FF60F7 /* create_hash_table */; settings = {ATTRIBUTES = (Private, ); }; };
                935F69FE08245057003D1A45 /* dftables.c in Sources */ = {isa = PBXBuildFile; fileRef = 6541720E039E08B90058BFEB /* dftables.c */; };
                93DE3E420868DCAB00B8897C /* grammar.y in Sources */ = {isa = PBXBuildFile; fileRef = 933A3499038AE7C6008635CE /* grammar.y */; };
+               93E26CCF08B2921900F85226 /* softlinking.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E26CCE08B2921900F85226 /* softlinking.h */; };
+               93E26CD008B2921900F85226 /* softlinking.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E26CCE08B2921900F85226 /* softlinking.h */; };
                A85D81F8087B2822006A9172 /* array_object.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A84E0255597D01FF60F7 /* array_object.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A85D81F9087B2822006A9172 /* collector.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8530255597D01FF60F7 /* collector.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A85D81FA087B2822006A9172 /* date_object.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8560255597D01FF60F7 /* date_object.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9374D3A8038D9D74008635CE /* scope_chain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scope_chain.cpp; sourceTree = "<group>"; };
                937F4F24048E5B9900CA2AC4 /* internal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = internal.h; path = pcre/internal.h; sourceTree = "<group>"; };
                938772E5038BFE19008635CE /* array_instance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = array_instance.h; sourceTree = "<group>"; };
+               93E26CCE08B2921900F85226 /* softlinking.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = softlinking.h; path = bindings/softlinking.h; sourceTree = "<group>"; };
                93F1981A08245AAE001E9ABC /* keywords.table */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = keywords.table; sourceTree = "<group>"; };
                A85D8288087B2822006A9172 /* JavaScriptCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
                F50888B6030BB74C012A967E /* simple_number.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = simple_number.h; sourceTree = "<group>"; };
                                51F0EC9605C88DC700E6DF1B /* objc_utility.h */,
                                51F0EC9705C88DC700E6DF1B /* objc_utility.mm */,
                                8442A376074175C2000AE2ED /* softlinking.c */,
+                               93E26CCE08B2921900F85226 /* softlinking.h */,
                        );
                        name = bindings;
                        sourceTree = "<group>";
                                932F5B8F0822A1C700736975 /* fast_malloc.h in Headers */,
                                932FC11D0824A6A3005B3C75 /* create_hash_table in Headers */,
                                65621E6E089E859700760F35 /* property_slot.h in Headers */,
+                               93E26CCF08B2921900F85226 /* softlinking.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                A85D823E087B2822006A9172 /* fast_malloc.h in Headers */,
                                65621E70089E85D300760F35 /* property_slot.h in Headers */,
                                A85D823F087B2822006A9172 /* create_hash_table in Headers */,
+                               93E26CD008B2921900F85226 /* softlinking.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 19ae88caa13a1d2aa2e41a85ee36d6e5bac92625..e2438fe1be9440b195f5f69a5bc6c2151425f374 100644 (file)
@@ -73,7 +73,7 @@ static NPClass _javascriptClass = {
 
 NPClass *NPScriptObjectClass = &_javascriptClass;
 
-Identifier identiferFromNPIdentifier(const NPUTF8 *name)
+static Identifier identiferFromNPIdentifier(const NPUTF8 *name)
 {
     NPUTF16 *methodName;
     unsigned int UTF16Length;
index b868869790354991ee68d15c779e50b19818fa57..a1b3a29b34041d446abb297d8a41cad26a6c463f 100644 (file)
  * (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 <c_instance.h> 
-#include <c_utility.h> 
-#include <internal.h>
-#include <npruntime_impl.h>
-#include <npruntime_priv.h>
-#include <runtime.h>
-#include <runtime_object.h>
-#include <runtime_root.h>
-#include <value.h>
-#include <NP_jsobject.h>
-
-using namespace KJS;
-using namespace KJS::Bindings;
+
+#include "c_utility.h"
+
+#include "c_instance.h" 
+#include "npruntime_impl.h"
+#include "npruntime_priv.h"
+#include "NP_jsobject.h"
+
+namespace KJS { namespace Bindings {
 
 // Requires free() of returned UTF16Chars.
 void convertNPStringToUTF16(const NPString *string, NPUTF16 **UTF16Chars, unsigned int *UTF16Length)
@@ -49,7 +45,7 @@ void convertUTF8ToUTF16(const NPUTF8 *UTF8Chars, int UTF8Length, NPUTF16 **UTF16
     
     if (UTF8Length == -1)
         UTF8Length = strlen(UTF8Chars);
-        
+
     CFStringRef stringRef = CFStringCreateWithBytes(NULL, (const UInt8*)UTF8Chars, (CFIndex)UTF8Length, kCFStringEncodingUTF8, false);
 
     *UTF16Length = (unsigned int)CFStringGetLength(stringRef);
@@ -175,10 +171,11 @@ ValueImp *convertNPVariantToValue(ExecState *exec, const NPVariant *variant)
         }
         else {
             //  Wrap NPObject in a CInstance.
-            return Instance::createRuntimeObject(Instance::CLanguage, (void *)obj);
+            return Instance::createRuntimeObject(Instance::CLanguage, obj);
         }
     }
     
     return Undefined();
 }
 
+} }
index e757b97bb1a5002c4a5154b9eef72443f71bb6f2..06981d3c5e7427ca078aafaa3bfe7678f20bca60 100644 (file)
@@ -31,6 +31,8 @@
 #include <runtime_object.h>
 #include <runtime_root.h>
 
+namespace KJS { namespace Bindings {
+
 typedef uint16_t NPUTF16;
 NPUTF16 *NPN_UTF16FromString (NPString *obj);
 
@@ -60,4 +62,6 @@ typedef struct
     bool isString;
 } PrivateIdentifier;
 
+} }
+
 #endif
index cd06a8c78cd28c19ebd8cfc2e65cbb7e4ee32c87..9b28e6fd25aabf6166b18707ce5f44d7c7fcde9f 100644 (file)
  * (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 <interpreter.h>
-#include <list.h>
 
-#include "jni_runtime.h"
 #include "jni_utility.h"
+
+#include "interpreter.h"
+#include "list.h"
+#include "jni_runtime.h"
 #include "runtime_array.h"
 #include "runtime_object.h"
+#include "softlinking.h"
 
 namespace KJS {
 
@@ -47,7 +49,7 @@ JavaVM *getJavaVM()
     jint jniError = 0;
 
     // Assumes JVM is already running ..., one per process
-    jniError = JNI_GetCreatedJavaVMs(jvmArray, bufLen, &nJVMs);
+    jniError = KJS_GetCreatedJavaVMs(jvmArray, bufLen, &nJVMs);
     if ( jniError == JNI_OK && nJVMs > 0 ) {
         jvm = jvmArray[0];
     }
index 162fb8d0ff483ee5b3eaa50db556de2ca88495ee..4f9a8f7afb34e8665e6582e6c8af03dfa12757d0 100644 (file)
@@ -29,6 +29,8 @@
 
 #include <JavaScriptCore/npruntime_impl.h>
 
+using namespace KJS::Bindings;
+
 static Boolean stringIdentifierEqual(const void *value1, const void *value2)
 {
     return strcmp((const char *)value1, (const char *)value2) == 0;
@@ -54,7 +56,7 @@ static CFHashCode stringIdentifierHash (const void *value)
     return result;
 }
 
-CFDictionaryKeyCallBacks stringIdentifierCallbacks = {
+static CFDictionaryKeyCallBacks stringIdentifierCallbacks = {
     0,
     NULL,
     NULL,
@@ -82,7 +84,7 @@ static CFHashCode intIdentifierHash (const void *value)
     return (CFHashCode)value;
 }
 
-CFDictionaryKeyCallBacks intIdentifierCallbacks = {
+static CFDictionaryKeyCallBacks intIdentifierCallbacks = {
     0,
     NULL,
     NULL,
@@ -429,13 +431,3 @@ void _NPN_ReleaseObject (NPObject *obj)
         }
     }
 }
-
-void _NPN_SetExceptionWithUTF8 (NPObject *obj, const NPUTF8 *message, int32_t length)
-{
-    assert (obj);
-    assert (message);
-    if (obj && message) {
-        _NPN_SetException (obj, message);
-    }
-}
index dd2d1f6bca38d198683b17720c6a1f734bc43819..c5b02658a21470de3099cc50c4c2f6c2fdb47cb2 100644 (file)
  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
  * 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
+ * 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 <JavaVM/jni.h>
-#import <mach-o/dyld.h>
+#include "softlinking.h"
 
-const struct mach_header *loadFramework(const char *execPath);
-void *getFunctionPointer(const struct mach_header *header, const char *functionName);
+#include <mach-o/dyld.h>
 
-const struct mach_header *loadFramework(const char *execPath)
+static const struct mach_header *loadFramework(const char *execPath)
 {
     return NSAddImage(execPath, NSADDIMAGE_OPTION_WITH_SEARCHING | NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME);
 }
 
-void *getFunctionPointer(const struct mach_header *header, const char *functionName)
+static void *getFunctionPointer(const struct mach_header *header, const char *functionName)
 {
     NSSymbol symbol = NSLookupSymbolInImage(header, functionName, NSLOOKUPSYMBOLINIMAGE_OPTION_BIND);
     if (symbol!=NULL) {
@@ -43,7 +41,7 @@ void *getFunctionPointer(const struct mach_header *header, const char *functionN
     return 0;
 }
 
-jint JNI_GetCreatedJavaVMs(JavaVM **vmBuf, jsize bufLen, jsize *nVMs)
+jint KJS_GetCreatedJavaVMs(JavaVM **vmBuf, jsize bufLen, jsize *nVMs)
 {
     static const struct mach_header *header = 0;
     if (!header) {
diff --git a/JavaScriptCore/bindings/softlinking.h b/JavaScriptCore/bindings/softlinking.h
new file mode 100644 (file)
index 0000000..adac418
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2005 Apple Computer, 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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 <JavaVM/jni.h>
+
+#if __cplusplus
+extern "C"
+#endif
+jint KJS_GetCreatedJavaVMs(JavaVM **vmBuf, jsize bufLen, jsize *nVMs);
index e88b5b0c64d334a7ec4a4761aa67d41db3fce0ce..abba613dc253d07a4375c33db5f0458aa4a3f588 100644 (file)
@@ -368,7 +368,7 @@ void ConditionalNode::streamTo(SourceStream &s) const
   s << logical << " ? " << expr1 << " : " << expr2;
 }
 
-void streamAssignmentOperatorTo(SourceStream &s, Operator oper)
+static void streamAssignmentOperatorTo(SourceStream &s, Operator oper)
 {
   const char *opStr;
   switch (oper) {