Changeset 15480 in webkit for trunk/JavaScriptCore/API
- Timestamp:
- Jul 16, 2006, 9:41:01 PM (19 years ago)
- Location:
- trunk/JavaScriptCore/API
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/APICast.h
r15468 r15480 42 42 inline KJS::ExecState* toJS(JSContextRef c) 43 43 { 44 return reinterpret_cast<KJS::ExecState*>(const_cast< __JSContext*>(c));44 return reinterpret_cast<KJS::ExecState*>(const_cast<OpaqueJSContext*>(c)); 45 45 } 46 46 … … 52 52 inline KJS::JSValue* toJS(JSValueRef v) 53 53 { 54 return reinterpret_cast<KJS::JSValue*>(const_cast< __JSValue*>(v));54 return reinterpret_cast<KJS::JSValue*>(const_cast<OpaqueJSValue*>(v)); 55 55 } 56 56 -
trunk/JavaScriptCore/API/JSBase.h
r15468 r15480 33 33 34 34 /*! @typedef JSContextRef A JavaScript execution context. Holds the global object and other execution state. */ 35 typedef const struct __JSContext* JSContextRef;35 typedef const struct OpaqueJSContext* JSContextRef; 36 36 37 37 /*! @typedef JSGlobalContextRef A global JavaScript execution context. A JSGlobalContext is a JSContext. */ 38 typedef struct __JSContext* JSGlobalContextRef;38 typedef struct OpaqueJSContext* JSGlobalContextRef; 39 39 40 40 /*! @typedef JSString A UTF16 character buffer. The fundamental string representation in JavaScript. */ 41 typedef struct __JSString* JSStringRef;41 typedef struct OpaqueJSString* JSStringRef; 42 42 43 43 /*! @typedef JSClassRef A JavaScript class. Used with JSObjectMake to construct objects with custom behavior. */ 44 typedef struct __JSClass* JSClassRef;44 typedef struct OpaqueJSClass* JSClassRef; 45 45 46 46 /*! @typedef JSPropertyNameArrayRef An array of JavaScript property names. */ 47 typedef struct __JSPropertyNameArray* JSPropertyNameArrayRef;47 typedef struct OpaqueJSPropertyNameArray* JSPropertyNameArrayRef; 48 48 49 49 /*! @typedef JSPropertyNameAccumulatorRef A data type used to collect a JavaScript object's property names. */ 50 typedef struct __JSPropertyNameAccumulator* JSPropertyNameAccumulatorRef;50 typedef struct OpaqueJSPropertyNameAccumulator* JSPropertyNameAccumulatorRef; 51 51 52 52 … … 54 54 55 55 /*! @typedef JSValueRef A JavaScript value. The base type for all JavaScript values, and polymorphic functions on them. */ 56 typedef const struct __JSValue* JSValueRef;56 typedef const struct OpaqueJSValue* JSValueRef; 57 57 58 58 /*! @typedef JSObjectRef A JavaScript object. A JSObject is a JSValue. */ 59 typedef struct __JSValue* JSObjectRef;59 typedef struct OpaqueJSValue* JSObjectRef; 60 60 61 61 #ifdef __cplusplus -
trunk/JavaScriptCore/API/JSCallbackObject.cpp
r15473 r15480 107 107 } 108 108 109 if ( __JSClass::StaticValuesTable* staticValues = jsClass->staticValues) {109 if (OpaqueJSClass::StaticValuesTable* staticValues = jsClass->staticValues) { 110 110 if (staticValues->contains(propertyName.ustring().rep())) { 111 111 slot.setCustom(this, staticValueGetter); … … 114 114 } 115 115 116 if ( __JSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) {116 if (OpaqueJSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) { 117 117 if (staticFunctions->contains(propertyName.ustring().rep())) { 118 118 slot.setCustom(this, staticFunctionGetter); … … 143 143 } 144 144 145 if ( __JSClass::StaticValuesTable* staticValues = jsClass->staticValues) {145 if (OpaqueJSClass::StaticValuesTable* staticValues = jsClass->staticValues) { 146 146 if (StaticValueEntry* entry = staticValues->get(propertyName.ustring().rep())) { 147 147 if (entry->attributes & kJSPropertyAttributeReadOnly) … … 154 154 } 155 155 156 if ( __JSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) {156 if (OpaqueJSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) { 157 157 if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.ustring().rep())) { 158 158 if (entry->attributes & kJSPropertyAttributeReadOnly) … … 184 184 } 185 185 186 if ( __JSClass::StaticValuesTable* staticValues = jsClass->staticValues) {186 if (OpaqueJSClass::StaticValuesTable* staticValues = jsClass->staticValues) { 187 187 if (StaticValueEntry* entry = staticValues->get(propertyName.ustring().rep())) { 188 188 if (entry->attributes & kJSPropertyAttributeDontDelete) … … 192 192 } 193 193 194 if ( __JSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) {194 if (OpaqueJSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) { 195 195 if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.ustring().rep())) { 196 196 if (entry->attributes & kJSPropertyAttributeDontDelete) … … 298 298 getPropertyNames(execRef, thisRef, toRef(&propertyNames)); 299 299 300 if ( __JSClass::StaticValuesTable* staticValues = jsClass->staticValues) {301 typedef __JSClass::StaticValuesTable::const_iterator iterator;300 if (OpaqueJSClass::StaticValuesTable* staticValues = jsClass->staticValues) { 301 typedef OpaqueJSClass::StaticValuesTable::const_iterator iterator; 302 302 iterator end = staticValues->end(); 303 303 for (iterator it = staticValues->begin(); it != end; ++it) { … … 309 309 } 310 310 311 if ( __JSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) {312 typedef __JSClass::StaticFunctionsTable::const_iterator iterator;311 if (OpaqueJSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) { 312 typedef OpaqueJSClass::StaticFunctionsTable::const_iterator iterator; 313 313 iterator end = staticFunctions->end(); 314 314 for (iterator it = staticFunctions->begin(); it != end; ++it) { … … 385 385 386 386 for (JSClassRef jsClass = thisObj->m_class; jsClass; jsClass = jsClass->parentClass) 387 if ( __JSClass::StaticValuesTable* staticValues = jsClass->staticValues)387 if (OpaqueJSClass::StaticValuesTable* staticValues = jsClass->staticValues) 388 388 if (StaticValueEntry* entry = staticValues->get(propertyName.ustring().rep())) 389 389 if (JSObjectGetPropertyCallback getProperty = entry->getProperty) … … 403 403 404 404 for (JSClassRef jsClass = thisObj->m_class; jsClass; jsClass = jsClass->parentClass) { 405 if ( __JSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) {405 if (OpaqueJSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) { 406 406 if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.ustring().rep())) { 407 407 if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) { -
trunk/JavaScriptCore/API/JSClassRef.cpp
r15468 r15480 33 33 const JSClassDefinition kJSClassDefinitionNull = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; 34 34 35 __JSClass::__JSClass(JSClassDefinition* definition)35 OpaqueJSClass::OpaqueJSClass(JSClassDefinition* definition) 36 36 : refCount(0) 37 37 , className(definition->className) … … 70 70 } 71 71 72 __JSClass::~__JSClass()72 OpaqueJSClass::~OpaqueJSClass() 73 73 { 74 74 if (staticValues) { -
trunk/JavaScriptCore/API/JSClassRef.h
r15468 r15480 53 53 }; 54 54 55 struct __JSClass {56 __JSClass(JSClassDefinition*);57 ~ __JSClass();55 struct OpaqueJSClass { 56 OpaqueJSClass(JSClassDefinition*); 57 ~OpaqueJSClass(); 58 58 59 59 typedef HashMap<RefPtr<KJS::UString::Rep>, StaticValueEntry*> StaticValuesTable; … … 63 63 64 64 KJS::UString className; 65 __JSClass* parentClass;65 OpaqueJSClass* parentClass; 66 66 67 67 StaticValuesTable* staticValues; -
trunk/JavaScriptCore/API/JSObjectRef.cpp
r15474 r15480 44 44 JSClassRef JSClassCreate(JSClassDefinition* definition) 45 45 { 46 JSClassRef jsClass = new __JSClass(definition);46 JSClassRef jsClass = new OpaqueJSClass(definition); 47 47 return JSClassRetain(jsClass); 48 48 } … … 76 76 } 77 77 78 JSObjectRef JSObjectMakeFunction (JSContextRef context, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction)78 JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef context, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction) 79 79 { 80 80 JSLock lock; … … 92 92 } 93 93 94 JSObjectRef JSObjectMakeFunction WithBody(JSContextRef context, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception)94 JSObjectRef JSObjectMakeFunction(JSContextRef context, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) 95 95 { 96 96 JSLock lock; … … 298 298 } 299 299 300 struct __JSPropertyNameArray301 { 302 __JSPropertyNameArray() : refCount(0)300 struct OpaqueJSPropertyNameArray 301 { 302 OpaqueJSPropertyNameArray() : refCount(0) 303 303 { 304 304 } … … 314 314 ExecState* exec = toJS(context); 315 315 316 JSPropertyNameArrayRef propertyNames = new __JSPropertyNameArray();316 JSPropertyNameArrayRef propertyNames = new OpaqueJSPropertyNameArray(); 317 317 jsObject->getPropertyNames(exec, propertyNames->array); 318 318 -
trunk/JavaScriptCore/API/JSObjectRef.h
r15474 r15480 391 391 @result A JSObject that is an anonymous function. The object's prototype will be the default function prototype. 392 392 */ 393 JSObjectRef JSObjectMakeFunction (JSContextRef context, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction);393 JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef context, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction); 394 394 /*! 395 395 @function … … 415 415 @discussion Use this method when you want to execute a script repeatedly, to avoid the cost of re-parsing the script before each execution. 416 416 */ 417 JSObjectRef JSObjectMakeFunction WithBody(JSContextRef context, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception);417 JSObjectRef JSObjectMakeFunction(JSContextRef context, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception); 418 418 419 419 /*! -
trunk/JavaScriptCore/API/minidom.c
r15469 r15480 41 41 42 42 JSStringRef printIString = JSStringCreateWithUTF8CString("print"); 43 JSObjectSetProperty(context, globalObject, printIString, JSObjectMakeFunction (context, printIString, print), kJSPropertyAttributeNone, NULL);43 JSObjectSetProperty(context, globalObject, printIString, JSObjectMakeFunctionWithCallback(context, printIString, print), kJSPropertyAttributeNone, NULL); 44 44 JSStringRelease(printIString); 45 45 -
trunk/JavaScriptCore/API/testapi.c
r15474 r15480 561 561 functionBody = JSStringCreateWithUTF8CString("rreturn Array;"); 562 562 JSStringRef line = JSStringCreateWithUTF8CString("line"); 563 assert(!JSObjectMakeFunction WithBody(context, NULL, 0, NULL, functionBody, NULL, 1, &exception));563 assert(!JSObjectMakeFunction(context, NULL, 0, NULL, functionBody, NULL, 1, &exception)); 564 564 assert(JSValueIsObject(exception)); 565 565 v = JSObjectGetProperty(context, JSValueToObject(context, exception, NULL), line, NULL); … … 570 570 exception = NULL; 571 571 functionBody = JSStringCreateWithUTF8CString("return Array;"); 572 function = JSObjectMakeFunction WithBody(context, NULL, 0, NULL, functionBody, NULL, 1, &exception);572 function = JSObjectMakeFunction(context, NULL, 0, NULL, functionBody, NULL, 1, &exception); 573 573 JSStringRelease(functionBody); 574 574 assert(!exception); … … 579 579 580 580 exception = NULL; 581 function = JSObjectMakeFunction WithBody(context, NULL, 0, NULL, jsEmptyIString, NULL, 0, &exception);581 function = JSObjectMakeFunction(context, NULL, 0, NULL, jsEmptyIString, NULL, 0, &exception); 582 582 assert(!exception); 583 583 v = JSObjectCallAsFunction(context, function, NULL, 0, NULL, &exception); … … 590 590 JSStringRef argumentNames[] = { foo }; 591 591 functionBody = JSStringCreateWithUTF8CString("return foo;"); 592 function = JSObjectMakeFunction WithBody(context, foo, 1, argumentNames, functionBody, NULL, 1, &exception);592 function = JSObjectMakeFunction(context, foo, 1, argumentNames, functionBody, NULL, 1, &exception); 593 593 assert(function && !exception); 594 594 JSValueRef arguments[] = { JSValueMakeNumber(2) }; … … 602 602 603 603 JSStringRef print = JSStringCreateWithUTF8CString("print"); 604 JSObjectRef printFunction = JSObjectMakeFunction (context, print, print_callAsFunction);604 JSObjectRef printFunction = JSObjectMakeFunctionWithCallback(context, print, print_callAsFunction); 605 605 JSObjectSetProperty(context, globalObject, print, printFunction, kJSPropertyAttributeNone, NULL); 606 606 JSStringRelease(print); … … 633 633 634 634 functionBody = JSStringCreateWithUTF8CString("return this;"); 635 function = JSObjectMakeFunction WithBody(context, NULL, 0, NULL, functionBody, NULL, 1, NULL);635 function = JSObjectMakeFunction(context, NULL, 0, NULL, functionBody, NULL, 1, NULL); 636 636 JSStringRelease(functionBody); 637 637 v = JSObjectCallAsFunction(context, function, NULL, 0, NULL, NULL);
Note:
See TracChangeset
for help on using the changeset viewer.