RS by Beth.
authorggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Jul 2006 19:10:49 +0000 (19:10 +0000)
committerggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Jul 2006 19:10:49 +0000 (19:10 +0000)
        Renamed JSCharBufferRef, which was universally unpopular, to JSStringBufferRef,
        which, hopefully, will be less unpopular.

        * API/APICast.h:
        (toJS):
        (toRef):
        * API/JSBase.h:
        * API/JSCallbackObject.cpp:
        (KJS::JSCallbackObject::getOwnPropertySlot):
        (KJS::JSCallbackObject::put):
        (KJS::JSCallbackObject::deleteProperty):
        (KJS::JSCallbackObject::staticValueGetter):
        (KJS::JSCallbackObject::callbackGetter):
        * API/JSCharBufferRef.cpp: Removed.
        * API/JSCharBufferRef.h: Removed.
        * API/JSContextRef.cpp:
        (JSEvaluate):
        (JSCheckSyntax):
        * API/JSContextRef.h:
        * API/JSNode.c:
        (JSNodePrototype_appendChild):
        (JSNode_getNodeType):
        (JSNode_getChildNodes):
        (JSNode_getFirstChild):
        * API/JSNodeList.c:
        (JSNodeList_length):
        (JSNodeList_getProperty):
        * API/JSObjectRef.cpp:
        (JSFunctionMakeWithBody):
        (JSObjectGetDescription):
        (JSObjectHasProperty):
        (JSObjectGetProperty):
        (JSObjectSetProperty):
        (JSObjectDeleteProperty):
        (JSPropertyEnumeratorGetNext):
        (JSPropertyListAdd):
        * API/JSObjectRef.h:
        * API/JSStringBufferRef.cpp: Added.
        (JSStringMake):
        (JSStringBufferCreate):
        (JSStringBufferCreateUTF8):
        (JSStringBufferRetain):
        (JSStringBufferRelease):
        (JSValueCopyStringValue):
        (JSStringBufferGetLength):
        (JSStringBufferGetCharactersPtr):
        (JSStringBufferGetCharacters):
        (JSStringBufferGetMaxLengthUTF8):
        (JSStringBufferGetCharactersUTF8):
        (JSStringBufferIsEqual):
        (JSStringBufferIsEqualUTF8):
        (JSStringBufferCreateWithCFString):
        (CFStringCreateWithJSStringBuffer):
        * API/JSStringBufferRef.h: Added.
        * API/JSValueRef.h:
        * API/JavaScriptCore.h:
        * API/minidom.c:
        (main):
        (print):
        * API/testapi.c:
        (assertEqualsAsUTF8String):
        (assertEqualsAsCharactersPtr):
        (assertEqualsAsCharacters):
        (MyObject_hasProperty):
        (MyObject_getProperty):
        (MyObject_setProperty):
        (MyObject_deleteProperty):
        (MyObject_getPropertyList):
        (print_callAsFunction):
        (myConstructor_callAsConstructor):
        (main):
        * JavaScriptCore.exp:
        * JavaScriptCore.xcodeproj/project.pbxproj:

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

18 files changed:
JavaScriptCore/API/APICast.h
JavaScriptCore/API/JSBase.h
JavaScriptCore/API/JSCallbackObject.cpp
JavaScriptCore/API/JSContextRef.cpp
JavaScriptCore/API/JSContextRef.h
JavaScriptCore/API/JSNode.c
JavaScriptCore/API/JSNodeList.c
JavaScriptCore/API/JSObjectRef.cpp
JavaScriptCore/API/JSObjectRef.h
JavaScriptCore/API/JSStringBufferRef.cpp [moved from JavaScriptCore/API/JSCharBufferRef.cpp with 75% similarity]
JavaScriptCore/API/JSStringBufferRef.h [moved from JavaScriptCore/API/JSCharBufferRef.h with 63% similarity]
JavaScriptCore/API/JSValueRef.h
JavaScriptCore/API/JavaScriptCore.h
JavaScriptCore/API/minidom.c
JavaScriptCore/API/testapi.c
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.exp
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

index cc7003f8b8e2e0c28744739b2bb262b30ae75d94..378861c9c9b1288a57da4009862b97b8f876527d 100644 (file)
@@ -49,7 +49,7 @@ inline KJS::JSValue* toJS(JSValueRef v)
     return reinterpret_cast<KJS::JSValue*>(v);
 }
 
-inline KJS::UString::Rep* toJS(JSCharBufferRef b)
+inline KJS::UString::Rep* toJS(JSStringBufferRef b)
 {
     return reinterpret_cast<KJS::UString::Rep*>(b);
 }
@@ -69,9 +69,9 @@ inline JSValueRef toRef(KJS::JSValue* v)
     return reinterpret_cast<JSValueRef>(v);
 }
 
-inline JSCharBufferRef toRef(KJS::UString::Rep* s)
+inline JSStringBufferRef toRef(KJS::UString::Rep* s)
 {
-    return reinterpret_cast<JSCharBufferRef>(s);
+    return reinterpret_cast<JSStringBufferRef>(s);
 }
 
 inline JSObjectRef toRef(KJS::JSObject* o)
index 66ead74b87d4a5fad29fe63a0c309d6a18b09c99..d3d09d780f3cd77403ed782c59b3adfcb0ce031f 100644 (file)
@@ -29,7 +29,7 @@
 
 /* JS runtime interface types */
 typedef struct __JSContext* JSContextRef;
-typedef struct __JSCharBuffer* JSCharBufferRef;
+typedef struct __JSStringBuffer* JSStringBufferRef;
 typedef struct __JSClass* JSClassRef;
 typedef struct __JSPropertyList* JSPropertyListRef;
 typedef struct __JSPropertyEnumerator* JSPropertyEnumeratorRef;
index aa3f2f39b2c610c50f2b67590ac17e08ed2439d8..9b99653c586ebdf9a440624473d90c5f9e398916 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "APICast.h"
 #include "JSCallbackObject.h"
-#include "JSCharBufferRef.h"
+#include "JSStringBufferRef.h"
 #include "JSClassRef.h"
 #include "JSObjectRef.h"
 #include "internal.h"
@@ -81,7 +81,7 @@ UString JSCallbackObject::className() const
 bool JSCallbackObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
 {
     JSObjectRef thisRef = toRef(this);
-    JSCharBufferRef propertyNameRef = toRef(propertyName.ustring().rep());
+    JSStringBufferRef propertyNameRef = toRef(propertyName.ustring().rep());
     
     for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) {
         // optional optimization to bypass getProperty in cases when we only need to know if the property exists
@@ -129,7 +129,7 @@ bool JSCallbackObject::getOwnPropertySlot(ExecState* exec, unsigned propertyName
 void JSCallbackObject::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr)
 {
     JSObjectRef thisRef = toRef(this);
-    JSCharBufferRef propertyNameRef = toRef(propertyName.ustring().rep());
+    JSStringBufferRef propertyNameRef = toRef(propertyName.ustring().rep());
 
     for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) {
         if (JSSetPropertyCallback setPropertyCallback = jsClass->callbacks.setProperty) {
@@ -168,7 +168,7 @@ void JSCallbackObject::put(ExecState* exec, unsigned propertyName, JSValue* valu
 bool JSCallbackObject::deleteProperty(ExecState* exec, const Identifier& propertyName)
 {
     JSObjectRef thisRef = toRef(this);
-    JSCharBufferRef propertyNameRef = toRef(propertyName.ustring().rep());
+    JSStringBufferRef propertyNameRef = toRef(propertyName.ustring().rep());
     
     for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) {
         if (JSDeletePropertyCallback deletePropertyCallback = jsClass->callbacks.deleteProperty) {
@@ -364,7 +364,7 @@ JSValue* JSCallbackObject::staticValueGetter(ExecState* exec, JSObject*, const I
     JSCallbackObject* thisObj = static_cast<JSCallbackObject*>(slot.slotBase());
 
     JSObjectRef thisRef = toRef(thisObj);
-    JSCharBufferRef propertyNameRef = toRef(propertyName.ustring().rep());
+    JSStringBufferRef propertyNameRef = toRef(propertyName.ustring().rep());
 
     for (JSClassRef jsClass = thisObj->m_class; jsClass; jsClass = jsClass->parent) {
         JSValueRef returnValue;
@@ -406,7 +406,7 @@ JSValue* JSCallbackObject::callbackGetter(ExecState* exec, JSObject*, const Iden
     JSCallbackObject* thisObj = static_cast<JSCallbackObject*>(slot.slotBase());
 
     JSObjectRef thisRef = toRef(thisObj);
-    JSCharBufferRef propertyNameRef = toRef(propertyName.ustring().rep());
+    JSStringBufferRef propertyNameRef = toRef(propertyName.ustring().rep());
 
     for (JSClassRef jsClass = thisObj->m_class; jsClass; jsClass = jsClass->parent) {
         JSValueRef returnValue;
index e7200d104ca1aa8d0a9769add3d5f4295b7987da..e7f744d89d7f0379cfd09ea3afd8aaca5a6fadc5 100644 (file)
@@ -71,7 +71,7 @@ JSObjectRef JSContextGetGlobalObject(JSContextRef context)
     return toRef(exec->dynamicInterpreter()->globalObject());
 }
 
-JSValueRef JSEvaluate(JSContextRef context, JSCharBufferRef script, JSValueRef thisValue, JSCharBufferRef sourceURL, int startingLineNumber, JSValueRef* exception)
+JSValueRef JSEvaluate(JSContextRef context, JSStringBufferRef script, JSValueRef thisValue, JSStringBufferRef sourceURL, int startingLineNumber, JSValueRef* exception)
 {
     JSLock lock;
     ExecState* exec = toJS(context);
@@ -94,7 +94,7 @@ JSValueRef JSEvaluate(JSContextRef context, JSCharBufferRef script, JSValueRef t
     return toRef(jsUndefined());
 }
 
-bool JSCheckSyntax(JSContextRef context, JSCharBufferRef script, JSCharBufferRef sourceURL, int startingLineNumber, JSValueRef* exception)
+bool JSCheckSyntax(JSContextRef context, JSStringBufferRef script, JSStringBufferRef sourceURL, int startingLineNumber, JSValueRef* exception)
 {
     JSLock lock;
 
index 05731dee3a75f4e7dc96c5f254f853952e13b38a..8850d5cc5fdf30407723f0bf0f643cd3fec457d1 100644 (file)
@@ -55,7 +55,7 @@ void JSContextClearException(JSContextRef context);
   @param exception          pointer to a JSValueRef in which to store an uncaught exception, if any; can be NULL
   @result                   result of evaluation, or NULL if an uncaught exception was thrown
 */
-JSValueRef JSEvaluate(JSContextRef context, JSCharBufferRef script, JSValueRef thisValue, JSCharBufferRef sourceURL, int startingLineNumber, JSValueRef* exception);
+JSValueRef JSEvaluate(JSContextRef context, JSStringBufferRef script, JSValueRef thisValue, JSStringBufferRef sourceURL, int startingLineNumber, JSValueRef* exception);
 
 /*!
   @function JSCheckSyntax
@@ -68,7 +68,7 @@ JSValueRef JSEvaluate(JSContextRef context, JSCharBufferRef script, JSValueRef t
   @result                   true if the script is syntactically correct, false otherwise
 
 */
-bool JSCheckSyntax(JSContextRef context, JSCharBufferRef script, JSCharBufferRef sourceURL, int startingLineNumber, JSValueRef* exception);
+bool JSCheckSyntax(JSContextRef context, JSStringBufferRef script, JSStringBufferRef sourceURL, int startingLineNumber, JSValueRef* exception);
 
 #ifdef __cplusplus
 }
index f1abd5354ff3915b03b05e2595a9182d81262e16..3f920f0a32fc790bb49ee26367b45c358f93e587 100644 (file)
@@ -39,13 +39,13 @@ static JSValueRef JSNodePrototype_appendChild(JSContextRef context, JSObjectRef
 
     // Example of throwing a type error for invalid values
     if (!JSValueIsObjectOfClass(thisObject, JSNode_class(context))) {
-        JSCharBufferRef messageBuf = JSCharBufferCreateUTF8("TypeError: appendChild can only be called on nodes");
+        JSStringBufferRef messageBuf = JSStringBufferCreateUTF8("TypeError: appendChild can only be called on nodes");
         JSContextSetException(context, JSStringMake(messageBuf));
-        JSCharBufferRelease(messageBuf);
+        JSStringBufferRelease(messageBuf);
     } else if (argc < 1 || !JSValueIsObjectOfClass(argv[0], JSNode_class(context))) {
-        JSCharBufferRef messageBuf = JSCharBufferCreateUTF8("TypeError: first argument to appendChild must be a node");
+        JSStringBufferRef messageBuf = JSStringBufferCreateUTF8("TypeError: first argument to appendChild must be a node");
         JSContextSetException(context, JSStringMake(messageBuf));
-        JSCharBufferRelease(messageBuf);
+        JSStringBufferRelease(messageBuf);
     } else {
         Node* node = JSObjectGetPrivate(thisObject);
         Node* child = JSObjectGetPrivate(argv[0]);
@@ -113,22 +113,22 @@ static JSClassRef JSNodePrototype_class(JSContextRef context)
     return nodePrototypeClass;
 }
 
-static bool JSNode_getNodeType(JSContextRef context, JSObjectRef object, JSCharBufferRef propertyName, JSValueRef* returnValue)
+static bool JSNode_getNodeType(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef* returnValue)
 {
     UNUSED_PARAM(context);
     UNUSED_PARAM(propertyName);
 
     Node* node = JSObjectGetPrivate(object);
     if (node) {
-        JSCharBufferRef nodeBuf = JSCharBufferCreateUTF8(node->nodeType);
+        JSStringBufferRef nodeBuf = JSStringBufferCreateUTF8(node->nodeType);
         *returnValue = JSStringMake(nodeBuf);
-        JSCharBufferRelease(nodeBuf);
+        JSStringBufferRelease(nodeBuf);
         return true;
     }
     return false;
 }
 
-static bool JSNode_getChildNodes(JSContextRef context, JSObjectRef thisObject, JSCharBufferRef propertyName, JSValueRef* returnValue)
+static bool JSNode_getChildNodes(JSContextRef context, JSObjectRef thisObject, JSStringBufferRef propertyName, JSValueRef* returnValue)
 {
     UNUSED_PARAM(propertyName);
     Node* node = JSObjectGetPrivate(thisObject);
@@ -137,7 +137,7 @@ static bool JSNode_getChildNodes(JSContextRef context, JSObjectRef thisObject, J
     return true;
 }
 
-static bool JSNode_getFirstChild(JSContextRef context, JSObjectRef object, JSCharBufferRef propertyName, JSValueRef* returnValue)
+static bool JSNode_getFirstChild(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef* returnValue)
 {
     UNUSED_PARAM(context);
     UNUSED_PARAM(propertyName);
index 868efdf8018e73e19628a63c79be3a148e6bd53d..61e9eaefd5320229777c8e66cf192c2f33c8d3db 100644 (file)
@@ -56,7 +56,7 @@ static JSClassRef JSNodeListPrototype_class(JSContextRef context)
     return jsClass;
 }
 
-static bool JSNodeList_length(JSContextRef context, JSObjectRef thisObject, JSCharBufferRef propertyName, JSValueRef* returnValue)
+static bool JSNodeList_length(JSContextRef context, JSObjectRef thisObject, JSStringBufferRef propertyName, JSValueRef* returnValue)
 {
     UNUSED_PARAM(context);
     
@@ -71,7 +71,7 @@ static JSStaticValue JSNodeList_staticValues[] = {
     { 0, 0, 0, 0 }
 };
 
-static bool JSNodeList_getProperty(JSContextRef context, JSObjectRef thisObject, JSCharBufferRef propertyName, JSValueRef* returnValue)
+static bool JSNodeList_getProperty(JSContextRef context, JSObjectRef thisObject, JSStringBufferRef propertyName, JSValueRef* returnValue)
 {
     NodeList* nodeList = JSObjectGetPrivate(thisObject);
     assert(nodeList);
index ad244892e3468aa3e06df79c4e8bb55c2382f486..003f8ef1a0749432ebbc2e977e0d1be78170969a 100644 (file)
@@ -70,7 +70,7 @@ JSObjectRef JSConstructorMake(JSContextRef context, JSCallAsConstructorCallback
     return toRef(new JSCallbackConstructor(exec, callAsConstructor));
 }
 
-JSObjectRef JSFunctionMakeWithBody(JSContextRef context, JSCharBufferRef body, JSCharBufferRef sourceURL, int startingLineNumber)
+JSObjectRef JSFunctionMakeWithBody(JSContextRef context, JSStringBufferRef body, JSStringBufferRef sourceURL, int startingLineNumber)
 {
     JSLock lock;
     
@@ -88,7 +88,7 @@ JSObjectRef JSFunctionMakeWithBody(JSContextRef context, JSCharBufferRef body, J
     return toRef(static_cast<JSObject*>(new DeclaredFunctionImp(exec, "anonymous", bodyNode.get(), scopeChain)));
 }
 
-JSCharBufferRef JSObjectGetDescription(JSObjectRef object)
+JSStringBufferRef JSObjectGetDescription(JSObjectRef object)
 {
     JSLock lock;
     JSObject* jsObject = toJS(object);
@@ -109,7 +109,7 @@ void JSObjectSetPrototype(JSObjectRef object, JSValueRef value)
     jsObject->setPrototype(jsValue);
 }
 
-bool JSObjectHasProperty(JSContextRef context, JSObjectRef object, JSCharBufferRef propertyName)
+bool JSObjectHasProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName)
 {
     JSLock lock;
     ExecState* exec = toJS(context);
@@ -119,7 +119,7 @@ bool JSObjectHasProperty(JSContextRef context, JSObjectRef object, JSCharBufferR
     return jsObject->hasProperty(exec, Identifier(nameRep));
 }
 
-bool JSObjectGetProperty(JSContextRef context, JSObjectRef object, JSCharBufferRef propertyName, JSValueRef* value)
+bool JSObjectGetProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef* value)
 {
     JSLock lock;
     ExecState* exec = toJS(context);
@@ -130,7 +130,7 @@ bool JSObjectGetProperty(JSContextRef context, JSObjectRef object, JSCharBufferR
     return !JSValueIsUndefined(*value);
 }
 
-bool JSObjectSetProperty(JSContextRef context, JSObjectRef object, JSCharBufferRef propertyName, JSValueRef value, JSPropertyAttributes attributes)
+bool JSObjectSetProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef value, JSPropertyAttributes attributes)
 {
     JSLock lock;
     ExecState* exec = toJS(context);
@@ -146,7 +146,7 @@ bool JSObjectSetProperty(JSContextRef context, JSObjectRef object, JSCharBufferR
         return false;
 }
 
-bool JSObjectDeleteProperty(JSContextRef context, JSObjectRef object, JSCharBufferRef propertyName)
+bool JSObjectDeleteProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName)
 {
     JSLock lock;
     ExecState* exec = toJS(context);
@@ -254,7 +254,7 @@ JSPropertyEnumeratorRef JSObjectCreatePropertyEnumerator(JSContextRef context, J
     return JSPropertyEnumeratorRetain(enumerator);
 }
 
-JSCharBufferRef JSPropertyEnumeratorGetNext(JSContextRef context, JSPropertyEnumeratorRef enumerator)
+JSStringBufferRef JSPropertyEnumeratorGetNext(JSContextRef context, JSPropertyEnumeratorRef enumerator)
 {
     ExecState* exec = toJS(context);
     ReferenceListIterator& iterator = enumerator->iterator;
@@ -277,7 +277,7 @@ void JSPropertyEnumeratorRelease(JSPropertyEnumeratorRef enumerator)
         delete enumerator;
 }
 
-void JSPropertyListAdd(JSPropertyListRef propertyList, JSObjectRef thisObject, JSCharBufferRef propertyName)
+void JSPropertyListAdd(JSPropertyListRef propertyList, JSObjectRef thisObject, JSStringBufferRef propertyName)
 {
     JSLock lock;
     ReferenceList* jsPropertyList = toJS(propertyList);
index 5518eb7559e1cdeb2fba3fddbf1d62aebda447e7..e50a3c633952dd04432f6459a1d77b095049f862 100644 (file)
@@ -49,16 +49,16 @@ typedef void
 (*JSFinalizeCallback)           (JSObjectRef object);
 
 typedef bool
-(*JSHasPropertyCallback)        (JSObjectRef object, JSCharBufferRef propertyName);
+(*JSHasPropertyCallback)        (JSObjectRef object, JSStringBufferRef propertyName);
 
 typedef bool
-(*JSGetPropertyCallback)        (JSContextRef context, JSObjectRef object, JSCharBufferRef propertyName, JSValueRef* returnValue);
+(*JSGetPropertyCallback)        (JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef* returnValue);
 
 typedef bool
-(*JSSetPropertyCallback)        (JSObjectRef object, JSCharBufferRef propertyName, JSValueRef value);
+(*JSSetPropertyCallback)        (JSObjectRef object, JSStringBufferRef propertyName, JSValueRef value);
 
 typedef bool
-(*JSDeletePropertyCallback)     (JSObjectRef object, JSCharBufferRef propertyName);
+(*JSDeletePropertyCallback)     (JSObjectRef object, JSStringBufferRef propertyName);
 
 typedef void
 (*JSGetPropertyListCallback)    (JSObjectRef object, JSPropertyListRef propertyList);
@@ -114,17 +114,17 @@ JSObjectRef JSFunctionMake(JSContextRef context, JSCallAsFunctionCallback callAs
 JSObjectRef JSConstructorMake(JSContextRef context, JSCallAsConstructorCallback callAsConstructor);
 
 // returns NULL if functionBody has a syntax error
-JSObjectRef JSFunctionMakeWithBody(JSContextRef context, JSCharBufferRef body, JSCharBufferRef sourceURL, int startingLineNumber);
+JSObjectRef JSFunctionMakeWithBody(JSContextRef context, JSStringBufferRef body, JSStringBufferRef sourceURL, int startingLineNumber);
 
-JSCharBufferRef JSObjectGetDescription(JSObjectRef object);
+JSStringBufferRef JSObjectGetDescription(JSObjectRef object);
 
 JSValueRef JSObjectGetPrototype(JSObjectRef object);
 void JSObjectSetPrototype(JSObjectRef object, JSValueRef value);
 
-bool JSObjectHasProperty(JSContextRef context, JSObjectRef object, JSCharBufferRef propertyName);
-bool JSObjectGetProperty(JSContextRef context, JSObjectRef object, JSCharBufferRef propertyName, JSValueRef* value);
-bool JSObjectSetProperty(JSContextRef context, JSObjectRef object, JSCharBufferRef propertyName, JSValueRef value, JSPropertyAttributes attributes);
-bool JSObjectDeleteProperty(JSContextRef context, JSObjectRef object, JSCharBufferRef propertyName);
+bool JSObjectHasProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName);
+bool JSObjectGetProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef* value);
+bool JSObjectSetProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef value, JSPropertyAttributes attributes);
+bool JSObjectDeleteProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName);
 
 // Only works with objects created by JSObjectMake
 void* JSObjectGetPrivate(JSObjectRef object);
@@ -139,10 +139,10 @@ JSObjectRef JSObjectCallAsConstructor(JSContextRef context, JSObjectRef object,
 JSPropertyEnumeratorRef JSObjectCreatePropertyEnumerator(JSContextRef context, JSObjectRef object);
 JSPropertyEnumeratorRef JSPropertyEnumeratorRetain(JSPropertyEnumeratorRef enumerator);
 void JSPropertyEnumeratorRelease(JSPropertyEnumeratorRef enumerator);
-JSCharBufferRef JSPropertyEnumeratorGetNext(JSContextRef context, JSPropertyEnumeratorRef enumerator);
+JSStringBufferRef JSPropertyEnumeratorGetNext(JSContextRef context, JSPropertyEnumeratorRef enumerator);
 
 // Used for adding property names to a for...in enumeration
-void JSPropertyListAdd(JSPropertyListRef propertyList, JSObjectRef thisObject, JSCharBufferRef propertyName);
+void JSPropertyListAdd(JSPropertyListRef propertyList, JSObjectRef thisObject, JSStringBufferRef propertyName);
 
 #ifdef __cplusplus
 }
similarity index 75%
rename from JavaScriptCore/API/JSCharBufferRef.cpp
rename to JavaScriptCore/API/JSStringBufferRef.cpp
index 34321d2bd431e1dc3cca9d431969e48bca525f7a..c42a47f1d78ed33a1942a07ec87602ddc2de4541 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include "APICast.h"
-#include "JSCharBufferRef.h"
+#include "JSStringBufferRef.h"
 
 #include <kjs/JSLock.h>
 #include <kjs/JSType.h>
 
 using namespace KJS;
 
-JSValueRef JSStringMake(JSCharBufferRef buffer)
+JSValueRef JSStringMake(JSStringBufferRef buffer)
 {
     JSLock lock;
     UString::Rep* rep = toJS(buffer);
     return toRef(jsString(UString(rep)));
 }
 
-JSCharBufferRef JSCharBufferCreate(const JSChar* chars, size_t numChars)
+JSStringBufferRef JSStringBufferCreate(const JSChar* chars, size_t numChars)
 {
     JSLock lock;
     return toRef(UString(reinterpret_cast<const UChar*>(chars), numChars).rep()->ref());
 }
 
-JSCharBufferRef JSCharBufferCreateUTF8(const char* string)
+JSStringBufferRef JSStringBufferCreateUTF8(const char* string)
 {
     JSLock lock;
     // FIXME: Only works with ASCII
@@ -57,44 +57,44 @@ JSCharBufferRef JSCharBufferCreateUTF8(const char* string)
     return toRef(UString(string).rep()->ref());
 }
 
-JSCharBufferRef JSCharBufferRetain(JSCharBufferRef buffer)
+JSStringBufferRef JSStringBufferRetain(JSStringBufferRef buffer)
 {
     UString::Rep* rep = toJS(buffer);
     return toRef(rep->ref());
 }
 
-void JSCharBufferRelease(JSCharBufferRef buffer)
+void JSStringBufferRelease(JSStringBufferRef buffer)
 {
     JSLock lock;
     UString::Rep* rep = toJS(buffer);
     rep->deref();
 }
 
-JSCharBufferRef JSValueCopyStringValue(JSContextRef context, JSValueRef value)
+JSStringBufferRef JSValueCopyStringValue(JSContextRef context, JSValueRef value)
 {
     JSLock lock;
     JSValue* jsValue = toJS(value);
     ExecState* exec = toJS(context);
 
-    JSCharBufferRef charBufferRef = toRef(jsValue->toString(exec).rep()->ref());
+    JSStringBufferRef charBufferRef = toRef(jsValue->toString(exec).rep()->ref());
     if (exec->hadException())
         exec->clearException();
     return charBufferRef;
 }
 
-size_t JSCharBufferGetLength(JSCharBufferRef buffer)
+size_t JSStringBufferGetLength(JSStringBufferRef buffer)
 {
     UString::Rep* rep = toJS(buffer);
     return rep->size();
 }
 
-const JSChar* JSCharBufferGetCharactersPtr(JSCharBufferRef buffer)
+const JSChar* JSStringBufferGetCharactersPtr(JSStringBufferRef buffer)
 {
     UString::Rep* rep = toJS(buffer);
     return reinterpret_cast<const JSChar*>(rep->data());
 }
 
-void JSCharBufferGetCharacters(JSCharBufferRef inBuffer, JSChar* outBuffer, size_t numChars)
+void JSStringBufferGetCharacters(JSStringBufferRef inBuffer, JSChar* outBuffer, size_t numChars)
 {
     UString::Rep* rep = toJS(inBuffer);
     const JSChar* data = reinterpret_cast<const JSChar*>(rep->data());
@@ -102,7 +102,7 @@ void JSCharBufferGetCharacters(JSCharBufferRef inBuffer, JSChar* outBuffer, size
     memcpy(outBuffer, data, numChars * sizeof(JSChar));
 }
 
-size_t JSCharBufferGetMaxLengthUTF8(JSCharBufferRef buffer)
+size_t JSStringBufferGetMaxLengthUTF8(JSStringBufferRef buffer)
 {
     UString::Rep* rep = toJS(buffer);
     
@@ -110,7 +110,7 @@ size_t JSCharBufferGetMaxLengthUTF8(JSCharBufferRef buffer)
     return rep->size() * 3 + 1; // + 1 for terminating '\0'
 }
 
-size_t JSCharBufferGetCharactersUTF8(JSCharBufferRef inBuffer, char* outBuffer, size_t bufferSize)
+size_t JSStringBufferGetCharactersUTF8(JSStringBufferRef inBuffer, char* outBuffer, size_t bufferSize)
 {
     JSLock lock;
     UString::Rep* rep = toJS(inBuffer);
@@ -121,7 +121,7 @@ size_t JSCharBufferGetCharactersUTF8(JSCharBufferRef inBuffer, char* outBuffer,
     return length;
 }
 
-bool JSCharBufferIsEqual(JSCharBufferRef a, JSCharBufferRef b)
+bool JSStringBufferIsEqual(JSStringBufferRef a, JSStringBufferRef b)
 {
     UString::Rep* aRep = toJS(a);
     UString::Rep* bRep = toJS(b);
@@ -129,17 +129,17 @@ bool JSCharBufferIsEqual(JSCharBufferRef a, JSCharBufferRef b)
     return UString(aRep) == UString(bRep);
 }
 
-bool JSCharBufferIsEqualUTF8(JSCharBufferRef a, const char* b)
+bool JSStringBufferIsEqualUTF8(JSStringBufferRef a, const char* b)
 {
-    JSCharBufferRef bBuf = JSCharBufferCreateUTF8(b);
-    bool result = JSCharBufferIsEqual(a, bBuf);
-    JSCharBufferRelease(bBuf);
+    JSStringBufferRef bBuf = JSStringBufferCreateUTF8(b);
+    bool result = JSStringBufferIsEqual(a, bBuf);
+    JSStringBufferRelease(bBuf);
     
     return result;
 }
 
 #if defined(__APPLE__)
-JSCharBufferRef JSCharBufferCreateWithCFString(CFStringRef string)
+JSStringBufferRef JSStringBufferCreateWithCFString(CFStringRef string)
 {
     JSLock lock;
     CFIndex length = CFStringGetLength(string);
@@ -156,7 +156,7 @@ JSCharBufferRef JSCharBufferCreateWithCFString(CFStringRef string)
     return toRef(rep);
 }
 
-CFStringRef CFStringCreateWithJSCharBuffer(CFAllocatorRef alloc, JSCharBufferRef buffer)
+CFStringRef CFStringCreateWithJSStringBuffer(CFAllocatorRef alloc, JSStringBufferRef buffer)
 {
     UString::Rep* rep = toJS(buffer);
     return CFStringCreateWithCharacters(alloc, reinterpret_cast<const JSChar*>(rep->data()), rep->size());
similarity index 63%
rename from JavaScriptCore/API/JSCharBufferRef.h
rename to JavaScriptCore/API/JSStringBufferRef.h
index 07d518198b28e41b23cadebec160aad163044e33..e4218aecf0a42c1a0cbc8ce1607655671961e2cf 100644 (file)
@@ -24,8 +24,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef JSCharBufferRef_h
-#define JSCharBufferRef_h
+#ifndef JSStringBufferRef_h
+#define JSStringBufferRef_h
 
 #include "JSValueRef.h"
 #ifdef __cplusplus
@@ -38,32 +38,32 @@ extern "C" {
     typedef unsigned short JSChar;
 #endif
     
-JSCharBufferRef JSCharBufferCreate(const JSChar* chars, size_t numChars);
-JSCharBufferRef JSCharBufferCreateUTF8(const char* string);
+JSStringBufferRef JSStringBufferCreate(const JSChar* chars, size_t numChars);
+JSStringBufferRef JSStringBufferCreateUTF8(const char* string);
 
-JSCharBufferRef JSCharBufferRetain(JSCharBufferRef buffer);
-void JSCharBufferRelease(JSCharBufferRef buffer);
+JSStringBufferRef JSStringBufferRetain(JSStringBufferRef buffer);
+void JSStringBufferRelease(JSStringBufferRef buffer);
 
-size_t JSCharBufferGetLength(JSCharBufferRef buffer);
-const JSChar* JSCharBufferGetCharactersPtr(JSCharBufferRef buffer);
-void JSCharBufferGetCharacters(JSCharBufferRef inBuffer, JSChar* outBuffer, size_t numChars);
+size_t JSStringBufferGetLength(JSStringBufferRef buffer);
+const JSChar* JSStringBufferGetCharactersPtr(JSStringBufferRef buffer);
+void JSStringBufferGetCharacters(JSStringBufferRef inBuffer, JSChar* outBuffer, size_t numChars);
 
-size_t JSCharBufferGetMaxLengthUTF8(JSCharBufferRef buffer);
+size_t JSStringBufferGetMaxLengthUTF8(JSStringBufferRef buffer);
 // Returns the number of bytes written into outBuffer, including the trailing '\0'
-size_t JSCharBufferGetCharactersUTF8(JSCharBufferRef inBuffer, char* outBuffer, size_t bufferSize);
+size_t JSStringBufferGetCharactersUTF8(JSStringBufferRef inBuffer, char* outBuffer, size_t bufferSize);
 
-bool JSCharBufferIsEqual(JSCharBufferRef a, JSCharBufferRef b);
-bool JSCharBufferIsEqualUTF8(JSCharBufferRef a, const char* b);
+bool JSStringBufferIsEqual(JSStringBufferRef a, JSStringBufferRef b);
+bool JSStringBufferIsEqualUTF8(JSStringBufferRef a, const char* b);
 
 #if defined(__APPLE__)
 #include <CoreFoundation/CoreFoundation.h>
 // CFString convenience methods
-JSCharBufferRef JSCharBufferCreateWithCFString(CFStringRef string);
-CFStringRef CFStringCreateWithJSCharBuffer(CFAllocatorRef alloc, JSCharBufferRef buffer);
+JSStringBufferRef JSStringBufferCreateWithCFString(CFStringRef string);
+CFStringRef CFStringCreateWithJSStringBuffer(CFAllocatorRef alloc, JSStringBufferRef buffer);
 #endif // __APPLE__
     
 #ifdef __cplusplus
 }
 #endif
 
-#endif // JSCharBufferRef_h
+#endif // JSStringBufferRef_h
index ba54fc098886cae537ad27d3de7eecfbc48d1353..4779bd5e9ff32f61041ac82e471c139214841f68 100644 (file)
@@ -181,7 +181,7 @@ JSValueRef JSNumberMake(double value);
   @param  buffer the internal string contents for the string value
   @result a JS string value that has the value of the buffer
 */
-JSValueRef JSStringMake(JSCharBufferRef buffer);
+JSValueRef JSStringMake(JSStringBufferRef buffer);
 
 // Converting to primitive values
 
@@ -210,7 +210,7 @@ double JSValueToNumber(JSContextRef context, JSValueRef value);
   @param value   the value to convert
   @result        a character buffer containing the result of conversion, or an empty character buffer if conversion fails
 */
-JSCharBufferRef JSValueCopyStringValue(JSContextRef context, JSValueRef value);
+JSStringBufferRef JSValueCopyStringValue(JSContextRef context, JSValueRef value);
 
 /*!
   @function JSValueToObject
index 21d4cb9a33e656fd7b21f5fb948ba3d76b3ffb53..c81d2b3fa0bd039c5a0cf591f7b2b0773132a2ac 100644 (file)
@@ -31,7 +31,7 @@
 #include <stddef.h> // for size_t
 
 #include "JSBase.h"
-#include "JSCharBufferRef.h"
+#include "JSStringBufferRef.h"
 #include "JSContextRef.h"
 #include "JSObjectRef.h"
 #include "JSValueRef.h"
index 00fa2690af9c9ab7aa7e150a35c38687d9795dc2..3659b351a553aec0461bcc2bbbaf2bea7962a2dc 100644 (file)
@@ -39,29 +39,29 @@ int main(int argc, char* argv[])
     JSContextRef context = JSContextCreate(NULL, NULL);
     JSObjectRef globalObject = JSContextGetGlobalObject(context);
     
-    JSCharBufferRef printBuf = JSCharBufferCreateUTF8("print");
+    JSStringBufferRef printBuf = JSStringBufferCreateUTF8("print");
     JSObjectSetProperty(context, globalObject, printBuf, JSFunctionMake(context, print), kJSPropertyAttributeNone);
-    JSCharBufferRelease(printBuf);
+    JSStringBufferRelease(printBuf);
     
-    JSCharBufferRef nodeBuf = JSCharBufferCreateUTF8("Node");
+    JSStringBufferRef nodeBuf = JSStringBufferCreateUTF8("Node");
     JSObjectSetProperty(context, globalObject, nodeBuf, JSConstructorMake(context, JSNode_construct), kJSPropertyAttributeNone);
-    JSCharBufferRelease(nodeBuf);
+    JSStringBufferRelease(nodeBuf);
     
     char* script = createStringWithContentsOfFile("minidom.js");
-    JSCharBufferRef scriptBuf = JSCharBufferCreateUTF8(script);
+    JSStringBufferRef scriptBuf = JSStringBufferCreateUTF8(script);
     JSValueRef exception;
     JSValueRef result = JSEvaluate(context, scriptBuf, NULL, NULL, 0, &exception);
     if (result)
         printf("PASS: Test script executed successfully.\n");
     else {
         printf("FAIL: Test script threw exception:\n");
-        JSCharBufferRef exceptionBuf = JSValueCopyStringValue(context, exception);
-        CFStringRef exceptionCF = CFStringCreateWithJSCharBuffer(kCFAllocatorDefault, exceptionBuf);
+        JSStringBufferRef exceptionBuf = JSValueCopyStringValue(context, exception);
+        CFStringRef exceptionCF = CFStringCreateWithJSStringBuffer(kCFAllocatorDefault, exceptionBuf);
         CFShow(exceptionCF);
         CFRelease(exceptionCF);
-        JSCharBufferRelease(exceptionBuf);
+        JSStringBufferRelease(exceptionBuf);
     }
-    JSCharBufferRelease(scriptBuf);
+    JSStringBufferRelease(scriptBuf);
     free(script);
 
 #if 0 // used for leak/finalize debugging    
@@ -81,10 +81,10 @@ int main(int argc, char* argv[])
 static JSValueRef print(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argc, JSValueRef argv[])
 {
     if (argc > 0) {
-        JSCharBufferRef stringBuf = JSValueCopyStringValue(context, argv[0]);
-        size_t numChars = JSCharBufferGetMaxLengthUTF8(stringBuf);
+        JSStringBufferRef stringBuf = JSValueCopyStringValue(context, argv[0]);
+        size_t numChars = JSStringBufferGetMaxLengthUTF8(stringBuf);
         char string[numChars];
-        JSCharBufferGetCharactersUTF8(stringBuf, string, numChars);
+        JSStringBufferGetCharactersUTF8(stringBuf, string, numChars);
         printf("%s\n", string);
     }
     
index 47ce02ea02d8263d0a600eae1489122c405daf3b..3877785f7026997b8d46368c1481022cdef2be3e 100644 (file)
@@ -51,11 +51,11 @@ static void assertEqualsAsNumber(JSValueRef value, double expectedValue)
 
 static void assertEqualsAsUTF8String(JSValueRef value, const char* expectedValue)
 {
-    JSCharBufferRef valueAsString = JSValueCopyStringValue(context, value);
+    JSStringBufferRef valueAsString = JSValueCopyStringValue(context, value);
 
-    size_t jsSize = JSCharBufferGetMaxLengthUTF8(valueAsString);
+    size_t jsSize = JSStringBufferGetMaxLengthUTF8(valueAsString);
     char jsBuffer[jsSize];
-    JSCharBufferGetCharactersUTF8(valueAsString, jsBuffer, jsSize);
+    JSStringBufferGetCharactersUTF8(valueAsString, jsBuffer, jsSize);
     
     if (strcmp(jsBuffer, expectedValue) != 0)
         fprintf(stderr, "assertEqualsAsUTF8String strcmp failed: %s != %s\n", jsBuffer, expectedValue);
@@ -63,16 +63,16 @@ static void assertEqualsAsUTF8String(JSValueRef value, const char* expectedValue
     if (jsSize < strlen(jsBuffer) + 1)
         fprintf(stderr, "assertEqualsAsUTF8String failed: jsSize was too small\n");
 
-    JSCharBufferRelease(valueAsString);
+    JSStringBufferRelease(valueAsString);
 }
 
 #if defined(__APPLE__)
 static void assertEqualsAsCharactersPtr(JSValueRef value, const char* expectedValue)
 {
-    JSCharBufferRef valueAsString = JSValueCopyStringValue(context, value);
+    JSStringBufferRef valueAsString = JSValueCopyStringValue(context, value);
 
-    size_t jsLength = JSCharBufferGetLength(valueAsString);
-    const JSChar* jsBuffer = JSCharBufferGetCharactersPtr(valueAsString);
+    size_t jsLength = JSStringBufferGetLength(valueAsString);
+    const JSChar* jsBuffer = JSStringBufferGetCharactersPtr(valueAsString);
 
     CFStringRef expectedValueAsCFString = CFStringCreateWithCString(kCFAllocatorDefault, 
                                                                     expectedValue,
@@ -88,16 +88,16 @@ static void assertEqualsAsCharactersPtr(JSValueRef value, const char* expectedVa
     if (jsLength != (size_t)cfLength)
         fprintf(stderr, "assertEqualsAsCharactersPtr failed: jsLength(%ld) != cfLength(%ld)\n", jsLength, cfLength);
     
-    JSCharBufferRelease(valueAsString);
+    JSStringBufferRelease(valueAsString);
 }
 
 static void assertEqualsAsCharacters(JSValueRef value, const char* expectedValue)
 {
-    JSCharBufferRef valueAsString = JSValueCopyStringValue(context, value);
+    JSStringBufferRef valueAsString = JSValueCopyStringValue(context, value);
     
-    size_t jsLength = JSCharBufferGetLength(valueAsString);
+    size_t jsLength = JSStringBufferGetLength(valueAsString);
     JSChar jsBuffer[jsLength];
-    JSCharBufferGetCharacters(valueAsString, jsBuffer, jsLength);
+    JSStringBufferGetCharacters(valueAsString, jsBuffer, jsLength);
     
     CFStringRef expectedValueAsCFString = CFStringCreateWithCString(kCFAllocatorDefault, 
                                                                     expectedValue,
@@ -113,7 +113,7 @@ static void assertEqualsAsCharacters(JSValueRef value, const char* expectedValue
     if (jsLength != (size_t)cfLength)
         fprintf(stderr, "assertEqualsAsCharacters failed: jsLength(%ld) != cfLength(%ld)\n", jsLength, cfLength);
     
-    JSCharBufferRelease(valueAsString);
+    JSStringBufferRelease(valueAsString);
 }
 #endif // __APPLE__
 
@@ -129,35 +129,35 @@ static void MyObject_initialize(JSObjectRef object)
     didInitialize = true;
 }
 
-static bool MyObject_hasProperty(JSObjectRef object, JSCharBufferRef propertyName)
+static bool MyObject_hasProperty(JSObjectRef object, JSStringBufferRef propertyName)
 {
     UNUSED_PARAM(object);
 
-    if (JSCharBufferIsEqualUTF8(propertyName, "alwaysOne")
-        || JSCharBufferIsEqualUTF8(propertyName, "cantFind")
-        || JSCharBufferIsEqualUTF8(propertyName, "myPropertyName")) {
+    if (JSStringBufferIsEqualUTF8(propertyName, "alwaysOne")
+        || JSStringBufferIsEqualUTF8(propertyName, "cantFind")
+        || JSStringBufferIsEqualUTF8(propertyName, "myPropertyName")) {
         return true;
     }
     
     return false;
 }
 
-static bool MyObject_getProperty(JSContextRef context, JSObjectRef object, JSCharBufferRef propertyName, JSValueRef* returnValue)
+static bool MyObject_getProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef* returnValue)
 {
     UNUSED_PARAM(context);
     UNUSED_PARAM(object);
     
-    if (JSCharBufferIsEqualUTF8(propertyName, "alwaysOne")) {
+    if (JSStringBufferIsEqualUTF8(propertyName, "alwaysOne")) {
         *returnValue = JSNumberMake(1);
         return true;
     }
     
-    if (JSCharBufferIsEqualUTF8(propertyName, "myPropertyName")) {
+    if (JSStringBufferIsEqualUTF8(propertyName, "myPropertyName")) {
         *returnValue = JSNumberMake(1);
         return true;
     }
 
-    if (JSCharBufferIsEqualUTF8(propertyName, "cantFind")) {
+    if (JSStringBufferIsEqualUTF8(propertyName, "cantFind")) {
         *returnValue = JSUndefinedMake();
         return true;
     }
@@ -165,22 +165,22 @@ static bool MyObject_getProperty(JSContextRef context, JSObjectRef object, JSCha
     return false;
 }
 
-static bool MyObject_setProperty(JSObjectRef object, JSCharBufferRef propertyName, JSValueRef value)
+static bool MyObject_setProperty(JSObjectRef object, JSStringBufferRef propertyName, JSValueRef value)
 {
     UNUSED_PARAM(object);
     UNUSED_PARAM(value);
 
-    if (JSCharBufferIsEqualUTF8(propertyName, "cantSet"))
+    if (JSStringBufferIsEqualUTF8(propertyName, "cantSet"))
         return true; // pretend we set the property in order to swallow it
     
     return false;
 }
 
-static bool MyObject_deleteProperty(JSObjectRef object, JSCharBufferRef propertyName)
+static bool MyObject_deleteProperty(JSObjectRef object, JSStringBufferRef propertyName)
 {
     UNUSED_PARAM(object);
     
-    if (JSCharBufferIsEqualUTF8(propertyName, "cantDelete"))
+    if (JSStringBufferIsEqualUTF8(propertyName, "cantDelete"))
         return true;
     
     return false;
@@ -188,15 +188,15 @@ static bool MyObject_deleteProperty(JSObjectRef object, JSCharBufferRef property
 
 static void MyObject_getPropertyList(JSObjectRef object, JSPropertyListRef propertyList)
 {
-    JSCharBufferRef propertyNameBuf;
+    JSStringBufferRef propertyNameBuf;
     
-    propertyNameBuf = JSCharBufferCreateUTF8("alwaysOne");
+    propertyNameBuf = JSStringBufferCreateUTF8("alwaysOne");
     JSPropertyListAdd(propertyList, object, propertyNameBuf);
-    JSCharBufferRelease(propertyNameBuf);
+    JSStringBufferRelease(propertyNameBuf);
     
-    propertyNameBuf = JSCharBufferCreateUTF8("myPropertyName");
+    propertyNameBuf = JSStringBufferCreateUTF8("myPropertyName");
     JSPropertyListAdd(propertyList, object, propertyNameBuf);
-    JSCharBufferRelease(propertyNameBuf);
+    JSStringBufferRelease(propertyNameBuf);
 }
 
 static JSValueRef MyObject_callAsFunction(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argc, JSValueRef argv[])
@@ -279,12 +279,12 @@ static JSValueRef print_callAsFunction(JSContextRef context, JSObjectRef functio
     UNUSED_PARAM(thisObject);
     
     if (argc > 0) {
-        JSCharBufferRef string = JSValueCopyStringValue(context, argv[0]);
-        size_t sizeUTF8 = JSCharBufferGetMaxLengthUTF8(string);
+        JSStringBufferRef string = JSValueCopyStringValue(context, argv[0]);
+        size_t sizeUTF8 = JSStringBufferGetMaxLengthUTF8(string);
         char stringUTF8[sizeUTF8];
-        JSCharBufferGetCharactersUTF8(string, stringUTF8, sizeUTF8);
+        JSStringBufferGetCharactersUTF8(string, stringUTF8, sizeUTF8);
         printf("%s\n", stringUTF8);
-        JSCharBufferRelease(string);
+        JSStringBufferRelease(string);
     }
     
     return JSUndefinedMake();
@@ -296,9 +296,9 @@ static JSObjectRef myConstructor_callAsConstructor(JSContextRef context, JSObjec
     
     JSObjectRef result = JSObjectMake(context, NULL, 0);
     if (argc > 0) {
-        JSCharBufferRef valueBuffer = JSCharBufferCreateUTF8("value");
+        JSStringBufferRef valueBuffer = JSStringBufferCreateUTF8("value");
         JSObjectSetProperty(context, result, valueBuffer, argv[0], kJSPropertyAttributeNone);
-        JSCharBufferRelease(valueBuffer);
+        JSStringBufferRelease(valueBuffer);
     }
     
     return result;
@@ -323,10 +323,10 @@ int main(int argc, char* argv[])
     JSObjectRef jsObjectNoProto = JSObjectMake(context, NULL, JSNullMake());
 
     // FIXME: test funny utf8 characters
-    JSCharBufferRef jsEmptyStringBuf = JSCharBufferCreateUTF8("");
+    JSStringBufferRef jsEmptyStringBuf = JSStringBufferCreateUTF8("");
     JSValueRef jsEmptyString = JSStringMake(jsEmptyStringBuf);
     
-    JSCharBufferRef jsOneStringBuf = JSCharBufferCreateUTF8("1");
+    JSStringBufferRef jsOneStringBuf = JSStringBufferCreateUTF8("1");
     JSValueRef jsOneString = JSStringMake(jsOneStringBuf);
 
 #if defined(__APPLE__)
@@ -338,12 +338,12 @@ int main(int argc, char* argv[])
                                                           1,
                                                           kCFAllocatorNull);
 
-    JSCharBufferRef jsCFStringBuf = JSCharBufferCreateWithCFString(cfString);
+    JSStringBufferRef jsCFStringBuf = JSStringBufferCreateWithCFString(cfString);
     JSValueRef jsCFString = JSStringMake(jsCFStringBuf);
     
     CFStringRef cfEmptyString = CFStringCreateWithCString(kCFAllocatorDefault, "", kCFStringEncodingUTF8);
     
-    JSCharBufferRef jsCFEmptyStringBuf = JSCharBufferCreateWithCFString(cfEmptyString);
+    JSStringBufferRef jsCFEmptyStringBuf = JSStringBufferCreateWithCFString(cfEmptyString);
     JSValueRef jsCFEmptyString = JSStringMake(jsCFEmptyStringBuf);
 
     CFIndex cfStringLength = CFStringGetLength(cfString);
@@ -351,10 +351,10 @@ int main(int argc, char* argv[])
     CFStringGetCharacters(cfString, 
                           CFRangeMake(0, cfStringLength), 
                           buffer);
-    JSCharBufferRef jsCFStringWithCharactersBuf = JSCharBufferCreate(buffer, cfStringLength);
+    JSStringBufferRef jsCFStringWithCharactersBuf = JSStringBufferCreate(buffer, cfStringLength);
     JSValueRef jsCFStringWithCharacters = JSStringMake(jsCFStringWithCharactersBuf);
     
-    JSCharBufferRef jsCFEmptyStringWithCharactersBuf = JSCharBufferCreate(buffer, CFStringGetLength(cfEmptyString));
+    JSStringBufferRef jsCFEmptyStringWithCharactersBuf = JSStringBufferCreate(buffer, CFStringGetLength(cfEmptyString));
     JSValueRef jsCFEmptyStringWithCharacters = JSStringMake(jsCFEmptyStringWithCharactersBuf);
 #endif // __APPLE__
 
@@ -470,8 +470,8 @@ int main(int argc, char* argv[])
     assert(!JSValueIsEqual(context, jsTrue, jsFalse));
     
 #if defined(__APPLE__)
-    CFStringRef cfJSString = CFStringCreateWithJSCharBuffer(kCFAllocatorDefault, jsCFStringBuf);
-    CFStringRef cfJSEmptyString = CFStringCreateWithJSCharBuffer(kCFAllocatorDefault, jsCFEmptyStringBuf);
+    CFStringRef cfJSString = CFStringCreateWithJSStringBuffer(kCFAllocatorDefault, jsCFStringBuf);
+    CFStringRef cfJSEmptyString = CFStringCreateWithJSStringBuffer(kCFAllocatorDefault, jsCFEmptyStringBuf);
     assert(CFEqual(cfJSString, cfString));
     assert(CFEqual(cfJSEmptyString, cfEmptyString));
     CFRelease(cfJSString);
@@ -492,8 +492,8 @@ int main(int argc, char* argv[])
     JSObjectRef globalObject = JSContextGetGlobalObject(context);
     assert(JSValueIsObject(globalObject));
 
-    JSCharBufferRef goodSyntaxBuf = JSCharBufferCreateUTF8("x = 1;");
-    JSCharBufferRef badSyntaxBuf = JSCharBufferCreateUTF8("x := 1;");
+    JSStringBufferRef goodSyntaxBuf = JSStringBufferCreateUTF8("x = 1;");
+    JSStringBufferRef badSyntaxBuf = JSStringBufferCreateUTF8("x := 1;");
     assert(JSCheckSyntax(context, goodSyntaxBuf, NULL, 0, NULL));
     assert(!JSCheckSyntax(context, badSyntaxBuf, NULL, 0, NULL));
 
@@ -515,36 +515,36 @@ int main(int argc, char* argv[])
     JSContextClearException(context);
     assert(!JSContextGetException(context));
 
-    JSCharBufferRelease(jsEmptyStringBuf);
-    JSCharBufferRelease(jsOneStringBuf);
+    JSStringBufferRelease(jsEmptyStringBuf);
+    JSStringBufferRelease(jsOneStringBuf);
 #if defined(__APPLE__)
-    JSCharBufferRelease(jsCFStringBuf);
-    JSCharBufferRelease(jsCFEmptyStringBuf);
-    JSCharBufferRelease(jsCFStringWithCharactersBuf);
-    JSCharBufferRelease(jsCFEmptyStringWithCharactersBuf);
+    JSStringBufferRelease(jsCFStringBuf);
+    JSStringBufferRelease(jsCFEmptyStringBuf);
+    JSStringBufferRelease(jsCFStringWithCharactersBuf);
+    JSStringBufferRelease(jsCFEmptyStringWithCharactersBuf);
 #endif // __APPLE__
-    JSCharBufferRelease(goodSyntaxBuf);
-    JSCharBufferRelease(badSyntaxBuf);
+    JSStringBufferRelease(goodSyntaxBuf);
+    JSStringBufferRelease(badSyntaxBuf);
 
-    JSCharBufferRef arrayBuf = JSCharBufferCreateUTF8("Array");
+    JSStringBufferRef arrayBuf = JSStringBufferCreateUTF8("Array");
     JSValueRef v;
     assert(JSObjectGetProperty(context, globalObject, arrayBuf, &v));
     JSObjectRef arrayConstructor = JSValueToObject(context, v);
-    JSCharBufferRelease(arrayBuf);
+    JSStringBufferRelease(arrayBuf);
     result = JSObjectCallAsConstructor(context, arrayConstructor, 0, NULL, NULL);
     assert(result);
     assert(JSValueIsInstanceOf(context, result, arrayConstructor));
     assert(!JSValueIsInstanceOf(context, JSNullMake(), arrayConstructor));
     
-    JSCharBufferRef functionBuf;
+    JSStringBufferRef functionBuf;
     
-    functionBuf = JSCharBufferCreateUTF8("rreturn Array;");
+    functionBuf = JSStringBufferCreateUTF8("rreturn Array;");
     assert(!JSFunctionMakeWithBody(context, functionBuf, NULL, 1));
-    JSCharBufferRelease(functionBuf);
+    JSStringBufferRelease(functionBuf);
 
-    functionBuf = JSCharBufferCreateUTF8("return Array;");
+    functionBuf = JSStringBufferCreateUTF8("return Array;");
     JSObjectRef function = JSFunctionMakeWithBody(context, functionBuf, NULL, 1);
-    JSCharBufferRelease(functionBuf);
+    JSStringBufferRelease(functionBuf);
 
     assert(JSObjectIsFunction(function));
     v = JSObjectCallAsFunction(context, function, NULL, 0, NULL, NULL);
@@ -552,32 +552,32 @@ int main(int argc, char* argv[])
                                                   
     JSObjectRef myObject = JSObjectMake(context, MyObject_class(context), NULL);
     assert(didInitialize);
-    JSCharBufferRef myObjectBuf = JSCharBufferCreateUTF8("MyObject");
+    JSStringBufferRef myObjectBuf = JSStringBufferCreateUTF8("MyObject");
     JSObjectSetProperty(context, globalObject, myObjectBuf, myObject, kJSPropertyAttributeNone);
-    JSCharBufferRelease(myObjectBuf);
+    JSStringBufferRelease(myObjectBuf);
 
-    JSCharBufferRef printBuf = JSCharBufferCreateUTF8("print");
+    JSStringBufferRef printBuf = JSStringBufferCreateUTF8("print");
     JSObjectSetProperty(context, globalObject, printBuf, JSFunctionMake(context, print_callAsFunction), kJSPropertyAttributeNone); 
-    JSCharBufferRelease(printBuf);
+    JSStringBufferRelease(printBuf);
 
-    JSCharBufferRef myConstructorBuf = JSCharBufferCreateUTF8("MyConstructor");
+    JSStringBufferRef myConstructorBuf = JSStringBufferCreateUTF8("MyConstructor");
     JSObjectSetProperty(context, globalObject, myConstructorBuf, JSConstructorMake(context, myConstructor_callAsConstructor), kJSPropertyAttributeNone);
-    JSCharBufferRelease(myConstructorBuf);
+    JSStringBufferRelease(myConstructorBuf);
 
     char* script = createStringWithContentsOfFile("testapi.js");
-    JSCharBufferRef scriptBuf = JSCharBufferCreateUTF8(script);
+    JSStringBufferRef scriptBuf = JSStringBufferCreateUTF8(script);
     result = JSEvaluate(context, scriptBuf, NULL, NULL, 1, &exception);
     if (JSValueIsUndefined(result))
         printf("PASS: Test script executed successfully.\n");
     else {
         printf("FAIL: Test script returned unexcpected value:\n");
-        JSCharBufferRef exceptionBuf = JSValueCopyStringValue(context, exception);
-        CFStringRef exceptionCF = CFStringCreateWithJSCharBuffer(kCFAllocatorDefault, exceptionBuf);
+        JSStringBufferRef exceptionBuf = JSValueCopyStringValue(context, exception);
+        CFStringRef exceptionCF = CFStringCreateWithJSStringBuffer(kCFAllocatorDefault, exceptionBuf);
         CFShow(exceptionCF);
         CFRelease(exceptionCF);
-        JSCharBufferRelease(exceptionBuf);
+        JSStringBufferRelease(exceptionBuf);
     }
-    JSCharBufferRelease(scriptBuf);
+    JSStringBufferRelease(scriptBuf);
     free(script);
 
     // Allocate a few dummies so that at least one will be collected
index 3551bd847feb4125953396aa074d161502af2307..67007ce2682d29b079d34c8948eed0b6a9d03011 100644 (file)
@@ -1,3 +1,81 @@
+2006-07-05  Geoffrey Garen  <ggaren@apple.com>
+
+        RS by Beth.
+        
+        Renamed JSCharBufferRef, which was universally unpopular, to JSStringBufferRef,
+        which, hopefully, will be less unpopular.
+
+        * API/APICast.h:
+        (toJS):
+        (toRef):
+        * API/JSBase.h:
+        * API/JSCallbackObject.cpp:
+        (KJS::JSCallbackObject::getOwnPropertySlot):
+        (KJS::JSCallbackObject::put):
+        (KJS::JSCallbackObject::deleteProperty):
+        (KJS::JSCallbackObject::staticValueGetter):
+        (KJS::JSCallbackObject::callbackGetter):
+        * API/JSCharBufferRef.cpp: Removed.
+        * API/JSCharBufferRef.h: Removed.
+        * API/JSContextRef.cpp:
+        (JSEvaluate):
+        (JSCheckSyntax):
+        * API/JSContextRef.h:
+        * API/JSNode.c:
+        (JSNodePrototype_appendChild):
+        (JSNode_getNodeType):
+        (JSNode_getChildNodes):
+        (JSNode_getFirstChild):
+        * API/JSNodeList.c:
+        (JSNodeList_length):
+        (JSNodeList_getProperty):
+        * API/JSObjectRef.cpp:
+        (JSFunctionMakeWithBody):
+        (JSObjectGetDescription):
+        (JSObjectHasProperty):
+        (JSObjectGetProperty):
+        (JSObjectSetProperty):
+        (JSObjectDeleteProperty):
+        (JSPropertyEnumeratorGetNext):
+        (JSPropertyListAdd):
+        * API/JSObjectRef.h:
+        * API/JSStringBufferRef.cpp: Added.
+        (JSStringMake):
+        (JSStringBufferCreate):
+        (JSStringBufferCreateUTF8):
+        (JSStringBufferRetain):
+        (JSStringBufferRelease):
+        (JSValueCopyStringValue):
+        (JSStringBufferGetLength):
+        (JSStringBufferGetCharactersPtr):
+        (JSStringBufferGetCharacters):
+        (JSStringBufferGetMaxLengthUTF8):
+        (JSStringBufferGetCharactersUTF8):
+        (JSStringBufferIsEqual):
+        (JSStringBufferIsEqualUTF8):
+        (JSStringBufferCreateWithCFString):
+        (CFStringCreateWithJSStringBuffer):
+        * API/JSStringBufferRef.h: Added.
+        * API/JSValueRef.h:
+        * API/JavaScriptCore.h:
+        * API/minidom.c:
+        (main):
+        (print):
+        * API/testapi.c:
+        (assertEqualsAsUTF8String):
+        (assertEqualsAsCharactersPtr):
+        (assertEqualsAsCharacters):
+        (MyObject_hasProperty):
+        (MyObject_getProperty):
+        (MyObject_setProperty):
+        (MyObject_deleteProperty):
+        (MyObject_getPropertyList):
+        (print_callAsFunction):
+        (myConstructor_callAsConstructor):
+        (main):
+        * JavaScriptCore.exp:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+
 2006-07-05  Geoffrey Garen  <ggaren@apple.com>
 
         RS by Beth.
index 5a44ecdede7ea22ccc19b4826814e25a7434216a..7e1a3d717aa396d63272c6384d3768b105f2b489 100644 (file)
@@ -1,21 +1,8 @@
-
 .objc_class_name_WebScriptObject
 .objc_class_name_WebScriptObjectPrivate
 .objc_class_name_WebUndefined
-_CFStringCreateWithJSCharBuffer
+_CFStringCreateWithJSStringBuffer
 _JSBooleanMake
-_JSCharBufferCreate
-_JSCharBufferCreateUTF8
-_JSCharBufferCreateWithCFString
-_JSCharBufferGetCharacters
-_JSCharBufferGetCharactersPtr
-_JSCharBufferGetCharactersUTF8
-_JSCharBufferGetLength
-_JSCharBufferGetMaxLengthUTF8
-_JSCharBufferIsEqual
-_JSCharBufferIsEqualUTF8
-_JSCharBufferRelease
-_JSCharBufferRetain
 _JSCheckSyntax
 _JSClassCreate
 _JSClassRelease
@@ -54,6 +41,18 @@ _JSPropertyEnumeratorGetNext
 _JSPropertyEnumeratorRelease
 _JSPropertyEnumeratorRetain
 _JSPropertyListAdd
+_JSStringBufferCreate
+_JSStringBufferCreateUTF8
+_JSStringBufferCreateWithCFString
+_JSStringBufferGetCharacters
+_JSStringBufferGetCharactersPtr
+_JSStringBufferGetCharactersUTF8
+_JSStringBufferGetLength
+_JSStringBufferGetMaxLengthUTF8
+_JSStringBufferIsEqual
+_JSStringBufferIsEqualUTF8
+_JSStringBufferRelease
+_JSStringBufferRetain
 _JSStringMake
 _JSUndefinedMake
 _JSValueCopyStringValue
index 1eb5f2015ad2a0738e18a2d725a0aacf5fc1950c..75b3f67fb2f9af0a04332263eaeca3cc71a2a200 100644 (file)
@@ -54,8 +54,8 @@
                1440FCE40A51E46B0005F061 /* JSClassRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1440FCE20A51E46B0005F061 /* JSClassRef.cpp */; };
                14760864099C633800437128 /* JSImmediate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14760863099C633800437128 /* JSImmediate.cpp */; };
                1482B6EB0A4300B300517CFC /* JSValueRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B6EA0A4300B300517CFC /* JSValueRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               1482B74D0A43032800517CFC /* JSCharBufferRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B74B0A43032800517CFC /* JSCharBufferRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               1482B74E0A43032800517CFC /* JSCharBufferRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1482B74C0A43032800517CFC /* JSCharBufferRef.cpp */; };
+               1482B74D0A43032800517CFC /* JSStringBufferRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B74B0A43032800517CFC /* JSStringBufferRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1482B74E0A43032800517CFC /* JSStringBufferRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1482B74C0A43032800517CFC /* JSStringBufferRef.cpp */; };
                1482B78B0A4305AB00517CFC /* APICast.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B78A0A4305AB00517CFC /* APICast.h */; };
                1482B7E30A43076000517CFC /* JSObjectRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B7E10A43076000517CFC /* JSObjectRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1482B7E40A43076000517CFC /* JSObjectRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1482B7E20A43076000517CFC /* JSObjectRef.cpp */; };
                1440FCE20A51E46B0005F061 /* JSClassRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSClassRef.cpp; sourceTree = "<group>"; };
                14760863099C633800437128 /* JSImmediate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSImmediate.cpp; sourceTree = "<group>"; };
                1482B6EA0A4300B300517CFC /* JSValueRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSValueRef.h; sourceTree = "<group>"; };
-               1482B74B0A43032800517CFC /* JSCharBufferRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCharBufferRef.h; sourceTree = "<group>"; };
-               1482B74C0A43032800517CFC /* JSCharBufferRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCharBufferRef.cpp; sourceTree = "<group>"; };
+               1482B74B0A43032800517CFC /* JSStringBufferRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringBufferRef.h; sourceTree = "<group>"; };
+               1482B74C0A43032800517CFC /* JSStringBufferRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStringBufferRef.cpp; sourceTree = "<group>"; };
                1482B78A0A4305AB00517CFC /* APICast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APICast.h; sourceTree = "<group>"; };
                1482B7E10A43076000517CFC /* JSObjectRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSObjectRef.h; sourceTree = "<group>"; };
                1482B7E20A43076000517CFC /* JSObjectRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSObjectRef.cpp; sourceTree = "<group>"; };
                                1440F88F0A508B100005F061 /* JSCallbackFunction.h */,
                                14ABDF5E0A437FEF00ECCA01 /* JSCallbackObject.cpp */,
                                14ABDF5D0A437FEF00ECCA01 /* JSCallbackObject.h */,
-                               1482B74C0A43032800517CFC /* JSCharBufferRef.cpp */,
-                               1482B74B0A43032800517CFC /* JSCharBufferRef.h */,
                                1440FCE20A51E46B0005F061 /* JSClassRef.cpp */,
                                1440FCE10A51E46B0005F061 /* JSClassRef.h */,
                                14BD5A290A3E91F600BAF59C /* JSContextRef.cpp */,
                                14BD5A2A0A3E91F600BAF59C /* JSContextRef.h */,
                                1482B7E20A43076000517CFC /* JSObjectRef.cpp */,
                                1482B7E10A43076000517CFC /* JSObjectRef.h */,
+                               1482B74C0A43032800517CFC /* JSStringBufferRef.cpp */,
+                               1482B74B0A43032800517CFC /* JSStringBufferRef.h */,
                                14BD5A2B0A3E91F600BAF59C /* JSValueRef.cpp */,
                                1482B6EA0A4300B300517CFC /* JSValueRef.h */,
                        );
                                14BD534C0A3E0AEA00BAF59C /* SavedBuiltins.h in Headers */,
                                14BD53F50A3E12D800BAF59C /* ExecState.h in Headers */,
                                1482B6EB0A4300B300517CFC /* JSValueRef.h in Headers */,
-                               1482B74D0A43032800517CFC /* JSCharBufferRef.h in Headers */,
+                               1482B74D0A43032800517CFC /* JSStringBufferRef.h in Headers */,
                                1482B78B0A4305AB00517CFC /* APICast.h in Headers */,
                                1482B7E30A43076000517CFC /* JSObjectRef.h in Headers */,
                                14ABDF5F0A437FEF00ECCA01 /* JSCallbackObject.h in Headers */,
                                14BD5A300A3E91F600BAF59C /* JSContextRef.cpp in Sources */,
                                14BD5A320A3E91F600BAF59C /* JSValueRef.cpp in Sources */,
                                14BD53F60A3E12D800BAF59C /* ExecState.cpp in Sources */,
-                               1482B74E0A43032800517CFC /* JSCharBufferRef.cpp in Sources */,
+                               1482B74E0A43032800517CFC /* JSStringBufferRef.cpp in Sources */,
                                1482B7E40A43076000517CFC /* JSObjectRef.cpp in Sources */,
                                14ABDF600A437FEF00ECCA01 /* JSCallbackObject.cpp in Sources */,
                                1440F8920A508B100005F061 /* JSCallbackFunction.cpp in Sources */,