Ignore:
Timestamp:
Jul 12, 2006, 1:12:08 AM (19 years ago)
Author:
ggaren
Message:

Reviewed by Maciej.


  • Implemented a vast number of renames and comment clarifications suggested during API review.


JSInternalString -> JSString
JS*Make -> JSValueMake*, JSObjectMake*
JSTypeCode -> JSType
JSValueIsInstanceOf -> JSValueIsInstanceOfConstructor (reads strangely well in client code)
JSGC*Protect -> JSValue*Protect
JS*Callback -> JSObject*Callback
JSGetPropertyListCallback -> JSObjectAddPropertiesToListCallback
JSPropertyEnumeratorGetNext -> JSPropertyEnumeratorGetNextName
JSString* ->

JSStringCreateWithUTF8CString, JSStringGetUTF8CString,
JSStringGetMaximumUTF8CStringSize JSStringIsEqualToUTF8CString,
JSStringCreateWithCFString, JSStringCopyCFString, JSStringCreateWithCharacters.


  • Changed functions taking a JSValue out arg and returning a bool indicating whether it was set to simply return a JSValue or NULL.


  • Removed JSStringGetCharacters because it's more documentation than code, and it's just a glorified memcpy built on existing API functionality.


  • Moved standard library includes into the headers that actually require them.


  • Standardized use of the phrase "Create Rule."


  • Removed JSLock from make functions that don't allocate.


  • Added exception handling to JSValueToBoolean, since we now allow callback objects to throw exceptions upon converting to boolean.


  • Renamed JSGCCollect to JSGarbageCollect.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSInternalStringRef.cpp

    r15328 r15376  
    3737using namespace KJS;
    3838
    39 JSValueRef JSStringMake(JSInternalStringRef string)
     39JSValueRef JSValueMakeString(JSStringRef string)
    4040{
    4141    JSLock lock;
     
    4444}
    4545
    46 JSInternalStringRef JSInternalStringCreate(const JSChar* chars, size_t numChars)
     46JSStringRef JSStringCreateWithCharacters(const JSChar* chars, size_t numChars)
    4747{
    4848    JSLock lock;
     
    5050}
    5151
    52 JSInternalStringRef JSInternalStringCreateUTF8(const char* string)
     52JSStringRef JSStringCreateWithUTF8CString(const char* string)
    5353{
    5454    JSLock lock;
     
    5858}
    5959
    60 JSInternalStringRef JSInternalStringRetain(JSInternalStringRef string)
     60JSStringRef JSStringRetain(JSStringRef string)
    6161{
    6262    UString::Rep* rep = toJS(string);
     
    6464}
    6565
    66 void JSInternalStringRelease(JSInternalStringRef string)
     66void JSStringRelease(JSStringRef string)
    6767{
    6868    JSLock lock;
     
    7171}
    7272
    73 JSInternalStringRef JSValueCopyStringValue(JSContextRef context, JSValueRef value)
     73JSStringRef JSValueToStringCopy(JSContextRef context, JSValueRef value)
    7474{
    7575    JSLock lock;
     
    7777    ExecState* exec = toJS(context);
    7878
    79     JSInternalStringRef stringRef = toRef(jsValue->toString(exec).rep()->ref());
     79    JSStringRef stringRef = toRef(jsValue->toString(exec).rep()->ref());
    8080    if (exec->hadException())
    8181        exec->clearException();
     
    8383}
    8484
    85 size_t JSInternalStringGetLength(JSInternalStringRef string)
     85size_t JSStringGetLength(JSStringRef string)
    8686{
    8787    UString::Rep* rep = toJS(string);
     
    8989}
    9090
    91 const JSChar* JSInternalStringGetCharactersPtr(JSInternalStringRef string)
     91const JSChar* JSStringGetCharactersPtr(JSStringRef string)
    9292{
    9393    UString::Rep* rep = toJS(string);
     
    9595}
    9696
    97 void JSInternalStringGetCharacters(JSInternalStringRef string, JSChar* buffer, size_t numChars)
    98 {
    99     UString::Rep* rep = toJS(string);
    100     const JSChar* data = reinterpret_cast<const JSChar*>(rep->data());
    101    
    102     memcpy(buffer, data, numChars * sizeof(JSChar));
    103 }
    104 
    105 size_t JSInternalStringGetMaxLengthUTF8(JSInternalStringRef string)
     97size_t JSStringGetMaximumUTF8CStringSize(JSStringRef string)
    10698{
    10799    UString::Rep* rep = toJS(string);
     
    111103}
    112104
    113 size_t JSInternalStringGetCharactersUTF8(JSInternalStringRef string, char* buffer, size_t bufferSize)
     105size_t JSStringGetUTF8CString(JSStringRef string, char* buffer, size_t bufferSize)
    114106{
    115107    JSLock lock;
     
    122114}
    123115
    124 bool JSInternalStringIsEqual(JSInternalStringRef a, JSInternalStringRef b)
     116bool JSStringIsEqual(JSStringRef a, JSStringRef b)
    125117{
    126118    UString::Rep* aRep = toJS(a);
     
    130122}
    131123
    132 bool JSInternalStringIsEqualUTF8(JSInternalStringRef a, const char* b)
     124bool JSStringIsEqualToUTF8CString(JSStringRef a, const char* b)
    133125{
    134     JSInternalStringRef bBuf = JSInternalStringCreateUTF8(b);
    135     bool result = JSInternalStringIsEqual(a, bBuf);
    136     JSInternalStringRelease(bBuf);
     126    JSStringRef bBuf = JSStringCreateWithUTF8CString(b);
     127    bool result = JSStringIsEqual(a, bBuf);
     128    JSStringRelease(bBuf);
    137129   
    138130    return result;
     
    140132
    141133#if defined(__APPLE__)
    142 JSInternalStringRef JSInternalStringCreateCF(CFStringRef string)
     134JSStringRef JSStringCreateWithCFString(CFStringRef string)
    143135{
    144136    JSLock lock;
     
    157149}
    158150
    159 CFStringRef CFStringCreateWithJSInternalString(CFAllocatorRef alloc, JSInternalStringRef string)
     151CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string)
    160152{
    161153    UString::Rep* rep = toJS(string);
Note: See TracChangeset for help on using the changeset viewer.