[webkit-changes] cvs commit: JavaScriptCore/kjs nodes2string.cpp

Darin darin at opensource.apple.com
Tue Aug 16 15:01:31 PDT 2005


darin       05/08/16 15:01:31

  Modified:    .        ChangeLog
               JavaScriptCore.xcodeproj project.pbxproj
               bindings NP_jsobject.cpp npruntime.cpp softlinking.c
               bindings/c c_utility.cpp c_utility.h
               bindings/jni jni_utility.cpp
               kjs      nodes2string.cpp
  Added:       bindings softlinking.h
  Log:
          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.
  
  Revision  Changes    Path
  1.801     +28 -0     JavaScriptCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
  retrieving revision 1.800
  retrieving revision 1.801
  diff -u -r1.800 -r1.801
  --- ChangeLog	16 Aug 2005 00:47:20 -0000	1.800
  +++ ChangeLog	16 Aug 2005 22:01:27 -0000	1.801
  @@ -1,3 +1,31 @@
  +2005-08-16  Darin Adler  <darin at 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 at apple.com>
   
           Reviewed by Geoff.
  
  
  
  1.7       +6 -0      JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
  
  Index: project.pbxproj
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- project.pbxproj	12 Aug 2005 23:20:47 -0000	1.6
  +++ project.pbxproj	16 Aug 2005 22:01:29 -0000	1.7
  @@ -175,6 +175,8 @@
   		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, ); }; };
  @@ -497,6 +499,7 @@
   		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>"; };
  @@ -770,6 +773,7 @@
   				51F0EC9605C88DC700E6DF1B /* objc_utility.h */,
   				51F0EC9705C88DC700E6DF1B /* objc_utility.mm */,
   				8442A376074175C2000AE2ED /* softlinking.c */,
  +				93E26CCE08B2921900F85226 /* softlinking.h */,
   			);
   			name = bindings;
   			sourceTree = "<group>";
  @@ -914,6 +918,7 @@
   				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;
   		};
  @@ -995,6 +1000,7 @@
   				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;
   		};
  
  
  
  1.22      +1 -1      JavaScriptCore/bindings/NP_jsobject.cpp
  
  Index: NP_jsobject.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/bindings/NP_jsobject.cpp,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- NP_jsobject.cpp	16 Aug 2005 00:47:21 -0000	1.21
  +++ NP_jsobject.cpp	16 Aug 2005 22:01:29 -0000	1.22
  @@ -73,7 +73,7 @@
   
   NPClass *NPScriptObjectClass = &_javascriptClass;
   
  -Identifier identiferFromNPIdentifier(const NPUTF8 *name)
  +static Identifier identiferFromNPIdentifier(const NPUTF8 *name)
   {
       NPUTF16 *methodName;
       unsigned int UTF16Length;
  
  
  
  1.19      +4 -12     JavaScriptCore/bindings/npruntime.cpp
  
  Index: npruntime.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/bindings/npruntime.cpp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- npruntime.cpp	27 Apr 2005 01:03:57 -0000	1.18
  +++ npruntime.cpp	16 Aug 2005 22:01:29 -0000	1.19
  @@ -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 @@
       return result;
   }
   
  -CFDictionaryKeyCallBacks stringIdentifierCallbacks = {
  +static CFDictionaryKeyCallBacks stringIdentifierCallbacks = {
       0,
       NULL,
       NULL,
  @@ -82,7 +84,7 @@
       return (CFHashCode)value;
   }
   
  -CFDictionaryKeyCallBacks intIdentifierCallbacks = {
  +static CFDictionaryKeyCallBacks intIdentifierCallbacks = {
       0,
       NULL,
       NULL,
  @@ -429,13 +431,3 @@
           }
       }
   }
  -
  -void _NPN_SetExceptionWithUTF8 (NPObject *obj, const NPUTF8 *message, int32_t length)
  -{
  -    assert (obj);
  -    assert (message);
  - 
  -    if (obj && message) {
  -        _NPN_SetException (obj, message);
  -    }
  -}
  
  
  
  1.2       +7 -9      JavaScriptCore/bindings/softlinking.c
  
  Index: softlinking.c
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/bindings/softlinking.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- softlinking.c	10 Nov 2004 00:28:07 -0000	1.1
  +++ softlinking.c	16 Aug 2005 22:01:29 -0000	1.2
  @@ -16,25 +16,23 @@
    * 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 @@
       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) {
  
  
  
  1.1                  JavaScriptCore/bindings/softlinking.h
  
  Index: softlinking.h
  ===================================================================
  /*
   * 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);
  
  
  
  1.11      +11 -14    JavaScriptCore/bindings/c/c_utility.cpp
  
  Index: c_utility.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/bindings/c/c_utility.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- c_utility.cpp	8 Aug 2005 04:07:23 -0000	1.10
  +++ c_utility.cpp	16 Aug 2005 22:01:30 -0000	1.11
  @@ -22,19 +22,15 @@
    * (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 @@
       
       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 @@
           }
           else {
               //  Wrap NPObject in a CInstance.
  -            return Instance::createRuntimeObject(Instance::CLanguage, (void *)obj);
  +            return Instance::createRuntimeObject(Instance::CLanguage, obj);
           }
       }
       
       return Undefined();
   }
   
  +} }
  
  
  
  1.8       +4 -0      JavaScriptCore/bindings/c/c_utility.h
  
  Index: c_utility.h
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/bindings/c/c_utility.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- c_utility.h	8 Aug 2005 04:07:23 -0000	1.7
  +++ c_utility.h	16 Aug 2005 22:01:30 -0000	1.8
  @@ -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 @@
       bool isString;
   } PrivateIdentifier;
   
  +} }
  +
   #endif
  
  
  
  1.25      +6 -4      JavaScriptCore/bindings/jni/jni_utility.cpp
  
  Index: jni_utility.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/bindings/jni/jni_utility.cpp,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- jni_utility.cpp	8 Aug 2005 04:07:24 -0000	1.24
  +++ jni_utility.cpp	16 Aug 2005 22:01:30 -0000	1.25
  @@ -22,13 +22,15 @@
    * (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 @@
       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];
       }
  
  
  
  1.14      +1 -1      JavaScriptCore/kjs/nodes2string.cpp
  
  Index: nodes2string.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/nodes2string.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- nodes2string.cpp	12 Aug 2005 07:36:00 -0000	1.13
  +++ nodes2string.cpp	16 Aug 2005 22:01:31 -0000	1.14
  @@ -368,7 +368,7 @@
     s << logical << " ? " << expr1 << " : " << expr2;
   }
   
  -void streamAssignmentOperatorTo(SourceStream &s, Operator oper)
  +static void streamAssignmentOperatorTo(SourceStream &s, Operator oper)
   {
     const char *opStr;
     switch (oper) {
  
  
  



More information about the webkit-changes mailing list