Changeset 15444 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jul 14, 2006, 9:16:30 PM (19 years ago)
Author:
ggaren
Message:

RS by Maciej.


Global replace in the API of argc/argv with argumentCount/arguments.

Location:
trunk/JavaScriptCore
Files:
11 edited

Legend:

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

    r15376 r15444  
    4848    JSObjectRef thisRef = toRef(this);
    4949
    50     size_t argc = args.size();
    51     JSValueRef argv[argc];
    52     for (size_t i = 0; i < argc; i++)
    53         argv[i] = toRef(args[i]);
    54     return toJS(m_callback(execRef, thisRef, argc, argv, toRef(exec->exceptionSlot())));
     50    size_t argumentCount = args.size();
     51    JSValueRef arguments[argumentCount];
     52    for (size_t i = 0; i < argumentCount; i++)
     53        arguments[i] = toRef(args[i]);
     54    return toJS(m_callback(execRef, thisRef, argumentCount, arguments, toRef(exec->exceptionSlot())));
    5555}
    5656
  • trunk/JavaScriptCore/API/JSCallbackFunction.cpp

    r15376 r15444  
    5151    JSObjectRef thisObjRef = toRef(thisObj);
    5252
    53     size_t argc = args.size();
    54     JSValueRef argv[argc];
    55     for (size_t i = 0; i < argc; i++)
    56         argv[i] = toRef(args[i]);
    57     return toJS(m_callback(execRef, thisRef, thisObjRef, argc, argv, toRef(exec->exceptionSlot())));
     53    size_t argumentCount = args.size();
     54    JSValueRef arguments[argumentCount];
     55    for (size_t i = 0; i < argumentCount; i++)
     56        arguments[i] = toRef(args[i]);
     57    return toJS(m_callback(execRef, thisRef, thisObjRef, argumentCount, arguments, toRef(exec->exceptionSlot())));
    5858}
    5959
  • trunk/JavaScriptCore/API/JSCallbackObject.cpp

    r15443 r15444  
    224224    for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) {
    225225        if (JSObjectCallAsConstructorCallback callAsConstructor = jsClass->callbacks.callAsConstructor) {
    226             size_t argc = args.size();
    227             JSValueRef argv[argc];
    228             for (size_t i = 0; i < argc; i++)
    229                 argv[i] = toRef(args[i]);
    230             return toJS(callAsConstructor(execRef, thisRef, argc, argv, toRef(exec->exceptionSlot())));
     226            size_t argumentCount = args.size();
     227            JSValueRef arguments[argumentCount];
     228            for (size_t i = 0; i < argumentCount; i++)
     229                arguments[i] = toRef(args[i]);
     230            return toJS(callAsConstructor(execRef, thisRef, argumentCount, arguments, toRef(exec->exceptionSlot())));
    231231        }
    232232    }
     
    276276    for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) {
    277277        if (JSObjectCallAsFunctionCallback callAsFunction = jsClass->callbacks.callAsFunction) {
    278             size_t argc = args.size();
    279             JSValueRef argv[argc];
    280             for (size_t i = 0; i < argc; i++)
    281                 argv[i] = toRef(args[i]);
    282             return toJS(callAsFunction(execRef, thisRef, thisObjRef, argc, argv, toRef(exec->exceptionSlot())));
     278            size_t argumentCount = args.size();
     279            JSValueRef arguments[argumentCount];
     280            for (size_t i = 0; i < argumentCount; i++)
     281                arguments[i] = toRef(args[i]);
     282            return toJS(callAsFunction(execRef, thisRef, thisObjRef, argumentCount, arguments, toRef(exec->exceptionSlot())));
    283283        }
    284284    }
  • trunk/JavaScriptCore/API/JSNode.c

    r15404 r15444  
    3333static JSClassRef JSNode_class(JSContextRef context);
    3434
    35 static JSValueRef JSNodePrototype_appendChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, JSValueRef argv[], JSValueRef* exception)
     35static JSValueRef JSNodePrototype_appendChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception)
    3636{
    3737    UNUSED_PARAM(context);
     
    4343        *exception = JSValueMakeString(message);
    4444        JSStringRelease(message);
    45     } else if (argc < 1 || !JSValueIsObjectOfClass(argv[0], JSNode_class(context))) {
     45    } else if (argumentCount < 1 || !JSValueIsObjectOfClass(arguments[0], JSNode_class(context))) {
    4646        JSStringRef message = JSStringCreateWithUTF8CString("TypeError: first argument to appendChild must be a node");
    4747        *exception = JSValueMakeString(message);
     
    4949    } else {
    5050        Node* node = JSObjectGetPrivate(thisObject);
    51         Node* child = JSObjectGetPrivate(JSValueToObject(context, argv[0], NULL));
     51        Node* child = JSObjectGetPrivate(JSValueToObject(context, arguments[0], NULL));
    5252
    5353        Node_appendChild(node, child);
     
    5757}
    5858
    59 static JSValueRef JSNodePrototype_removeChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, JSValueRef argv[], JSValueRef* exception)
     59static JSValueRef JSNodePrototype_removeChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception)
    6060{
    6161    UNUSED_PARAM(context);
     
    6363   
    6464    // Example of ignoring invalid values
    65     if (argc > 0) {
     65    if (argumentCount > 0) {
    6666        if (JSValueIsObjectOfClass(thisObject, JSNode_class(context))) {
    67             if (JSValueIsObjectOfClass(argv[0], JSNode_class(context))) {
     67            if (JSValueIsObjectOfClass(arguments[0], JSNode_class(context))) {
    6868                Node* node = JSObjectGetPrivate(thisObject);
    69                 Node* child = JSObjectGetPrivate(JSValueToObject(context, argv[0], NULL));
     69                Node* child = JSObjectGetPrivate(JSValueToObject(context, arguments[0], NULL));
    7070               
    7171                Node_removeChild(node, child);
     
    7777}
    7878
    79 static JSValueRef JSNodePrototype_replaceChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, JSValueRef argv[], JSValueRef* exception)
     79static JSValueRef JSNodePrototype_replaceChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception)
    8080{
    8181    UNUSED_PARAM(context);
    8282    UNUSED_PARAM(function);
    8383   
    84     if (argc > 1) {
     84    if (argumentCount > 1) {
    8585        if (JSValueIsObjectOfClass(thisObject, JSNode_class(context))) {
    86             if (JSValueIsObjectOfClass(argv[0], JSNode_class(context))) {
    87                 if (JSValueIsObjectOfClass(argv[1], JSNode_class(context))) {
     86            if (JSValueIsObjectOfClass(arguments[0], JSNode_class(context))) {
     87                if (JSValueIsObjectOfClass(arguments[1], JSNode_class(context))) {
    8888                    Node* node = JSObjectGetPrivate(thisObject);
    89                     Node* newChild = JSObjectGetPrivate(JSValueToObject(context, argv[0], NULL));
    90                     Node* oldChild = JSObjectGetPrivate(JSValueToObject(context, argv[1], NULL));
     89                    Node* newChild = JSObjectGetPrivate(JSValueToObject(context, arguments[0], NULL));
     90                    Node* oldChild = JSObjectGetPrivate(JSValueToObject(context, arguments[1], NULL));
    9191                   
    9292                    Node_replaceChild(node, newChild, oldChild);
     
    193193}
    194194
    195 JSObjectRef JSNode_construct(JSContextRef context, JSObjectRef object, size_t argc, JSValueRef argv[], JSValueRef* exception)
     195JSObjectRef JSNode_construct(JSContextRef context, JSObjectRef object, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception)
    196196{
    197197    UNUSED_PARAM(object);
    198     UNUSED_PARAM(argc);
    199     UNUSED_PARAM(argv);
     198    UNUSED_PARAM(argumentCount);
     199    UNUSED_PARAM(arguments);
    200200
    201201    return JSNode_new(context, Node_new());
  • trunk/JavaScriptCore/API/JSNode.h

    r15317 r15444  
    3232
    3333extern JSObjectRef JSNode_new(JSContextRef context, Node* node);
    34 extern JSObjectRef JSNode_construct(JSContextRef context, JSObjectRef object, size_t argc, JSValueRef argv[], JSValueRef* exception);
     34extern JSObjectRef JSNode_construct(JSContextRef context, JSObjectRef object, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception);
    3535
    3636#endif // JSNode_h
  • trunk/JavaScriptCore/API/JSNodeList.c

    r15404 r15444  
    2929#include "UnusedParam.h"
    3030
    31 static JSValueRef JSNodeListPrototype_item(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argc, JSValueRef argv[], JSValueRef* exception)
     31static JSValueRef JSNodeListPrototype_item(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception)
    3232{
    33     if (argc > 0) {
     33    if (argumentCount > 0) {
    3434        NodeList* nodeList = JSObjectGetPrivate(thisObject);
    3535        assert(nodeList);
    36         Node* node = NodeList_item(nodeList, JSValueToNumber(context, argv[0], exception));
     36        Node* node = NodeList_item(nodeList, JSValueToNumber(context, arguments[0], exception));
    3737        if (node)
    3838            return JSNode_new(context, node);
  • trunk/JavaScriptCore/API/JSObjectRef.cpp

    r15443 r15444  
    238238}
    239239
    240 JSValueRef JSObjectCallAsFunction(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argc, JSValueRef argv[], JSValueRef* exception)
     240JSValueRef JSObjectCallAsFunction(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception)
    241241{
    242242    JSLock lock;
     
    249249   
    250250    List argList;
    251     for (size_t i = 0; i < argc; i++)
    252         argList.append(toJS(argv[i]));
     251    for (size_t i = 0; i < argumentCount; i++)
     252        argList.append(toJS(arguments[i]));
    253253
    254254    JSValueRef result = toRef(jsObject->call(exec, jsThisObject, argList)); // returns NULL if object->implementsCall() is false
     
    268268}
    269269
    270 JSObjectRef JSObjectCallAsConstructor(JSContextRef context, JSObjectRef object, size_t argc, JSValueRef argv[], JSValueRef* exception)
     270JSObjectRef JSObjectCallAsConstructor(JSContextRef context, JSObjectRef object, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception)
    271271{
    272272    JSLock lock;
     
    275275   
    276276    List argList;
    277     for (size_t i = 0; i < argc; i++)
    278         argList.append(toJS(argv[i]));
     277    for (size_t i = 0; i < argumentCount; i++)
     278        argList.append(toJS(arguments[i]));
    279279   
    280280    JSObjectRef result = toRef(jsObject->construct(exec, argList)); // returns NULL if object->implementsCall() is false
  • trunk/JavaScriptCore/API/JSObjectRef.h

    r15443 r15444  
    176176@param function A JSObject that is the function being called.
    177177@param thisObject A JSObject that is the 'this' variable in the function's scope.
    178 @param argc An integer count of the number of arguments in argv.
    179 @param argv A JSValue array of the  arguments passed to the function.
     178@param argumentCount An integer count of the number of arguments in arguments.
     179@param arguments A JSValue array of the  arguments passed to the function.
    180180@param exception A pointer to a JSValueRef in which to return an exception, if any.
    181181@result A JSValue that is the function's return value.
    182182@discussion If you named your function CallAsFunction, you would declare it like this:
    183183
    184 JSValueRef CallAsFunction(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, JSValueRef argv[], JSValueRef* exception);
     184JSValueRef CallAsFunction(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception);
    185185
    186186If your callback were invoked by the JavaScript expression 'myObject.myMemberFunction()', function would be set to myMemberFunction, and thisObject would be set to myObject.
     
    189189*/
    190190typedef JSValueRef
    191 (*JSObjectCallAsFunctionCallback) (JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, JSValueRef argv[], JSValueRef* exception);
     191(*JSObjectCallAsFunctionCallback) (JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception);
    192192
    193193/*!
     
    196196@param context The current execution context.
    197197@param constructor A JSObject that is the constructor being called.
    198 @param argc An integer count of the number of arguments in argv.
    199 @param argv A JSValue array of the  arguments passed to the function.
     198@param argumentCount An integer count of the number of arguments in arguments.
     199@param arguments A JSValue array of the  arguments passed to the function.
    200200@param exception A pointer to a JSValueRef in which to return an exception, if any.
    201201@result A JSObject that is the constructor's return value.
    202202@discussion If you named your function CallAsConstructor, you would declare it like this:
    203203
    204 JSObjectRef CallAsConstructor(JSContextRef context, JSObjectRef constructor, size_t argc, JSValueRef argv[], JSValueRef* exception);
     204JSObjectRef CallAsConstructor(JSContextRef context, JSObjectRef constructor, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception);
    205205
    206206If your callback were invoked by the JavaScript expression 'new myConstructorFunction()', constructor would be set to myConstructorFunction.
     
    209209*/
    210210typedef JSObjectRef
    211 (*JSObjectCallAsConstructorCallback) (JSContextRef context, JSObjectRef constructor, size_t argc, JSValueRef argv[], JSValueRef* exception);
     211(*JSObjectCallAsConstructorCallback) (JSContextRef context, JSObjectRef constructor, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception);
    212212
    213213/*!
     
    500500@param object The JSObject to call as a function.
    501501@param thisObject The object to use as "this," or NULL to use the global object as "this."
    502 @param argc An integer count of the number of arguments in argv.
    503 @param argv A JSValue array of the  arguments to pass to the function.
     502@param argumentCount An integer count of the number of arguments in arguments.
     503@param arguments A JSValue array of the  arguments to pass to the function.
    504504@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
    505505@result The JSValue that results from calling object as a function, or NULL if an exception is thrown or object is not a function.
    506506*/
    507 JSValueRef JSObjectCallAsFunction(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argc, JSValueRef argv[], JSValueRef* exception);
     507JSValueRef JSObjectCallAsFunction(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception);
    508508/*!
    509509@function
     
    518518@param context The execution context to use.
    519519@param object The JSObject to call as a constructor.
    520 @param argc An integer count of the number of arguments in argv.
    521 @param argv A JSValue array of the  arguments to pass to the function.
     520@param argumentCount An integer count of the number of arguments in arguments.
     521@param arguments A JSValue array of the  arguments to pass to the function.
    522522@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
    523523@result The JSObject that results from calling object as a constructor, or NULL if an exception is thrown or object is not a constructor.
    524524*/
    525 JSObjectRef JSObjectCallAsConstructor(JSContextRef context, JSObjectRef object, size_t argc, JSValueRef argv[], JSValueRef* exception);
     525JSObjectRef JSObjectCallAsConstructor(JSContextRef context, JSObjectRef object, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception);
    526526
    527527/*!
  • trunk/JavaScriptCore/API/minidom.c

    r15443 r15444  
    3030
    3131static char* createStringWithContentsOfFile(const char* fileName);
    32 static JSValueRef print(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argc, JSValueRef argv[], JSValueRef* exception);
     32static JSValueRef print(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception);
    3333
    3434int main(int argc, char* argv[])
     
    7979}
    8080
    81 static JSValueRef print(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argc, JSValueRef argv[], JSValueRef* exception)
     81static JSValueRef print(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception)
    8282{
    83     if (argc > 0) {
    84         JSStringRef string = JSValueToStringCopy(context, argv[0], NULL);
     83    if (argumentCount > 0) {
     84        JSStringRef string = JSValueToStringCopy(context, arguments[0], NULL);
    8585        size_t numChars = JSStringGetMaximumUTF8CStringSize(string);
    8686        char stringUTF8[numChars];
  • trunk/JavaScriptCore/API/testapi.c

    r15443 r15444  
    183183}
    184184
    185 static JSValueRef MyObject_callAsFunction(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argc, JSValueRef argv[], JSValueRef* exception)
     185static JSValueRef MyObject_callAsFunction(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception)
    186186{
    187187    UNUSED_PARAM(context);
     
    189189    UNUSED_PARAM(thisObject);
    190190
    191     if (argc > 0 && JSValueIsStrictEqual(context, argv[0], JSValueMakeNumber(0)))
     191    if (argumentCount > 0 && JSValueIsStrictEqual(context, arguments[0], JSValueMakeNumber(0)))
    192192        return JSValueMakeNumber(1);
    193193   
     
    195195}
    196196
    197 static JSObjectRef MyObject_callAsConstructor(JSContextRef context, JSObjectRef object, size_t argc, JSValueRef argv[], JSValueRef* exception)
    198 {
    199     UNUSED_PARAM(context);
    200     UNUSED_PARAM(object);
    201 
    202     if (argc > 0 && JSValueIsStrictEqual(context, argv[0], JSValueMakeNumber(0)))
     197static JSObjectRef MyObject_callAsConstructor(JSContextRef context, JSObjectRef object, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception)
     198{
     199    UNUSED_PARAM(context);
     200    UNUSED_PARAM(object);
     201
     202    if (argumentCount > 0 && JSValueIsStrictEqual(context, arguments[0], JSValueMakeNumber(0)))
    203203        return JSValueToObject(context, JSValueMakeNumber(1), NULL);
    204204   
     
    266266}
    267267
    268 static JSValueRef print_callAsFunction(JSContextRef context, JSObjectRef functionObject, JSObjectRef thisObject, size_t argc, JSValueRef argv[], JSValueRef* exception)
     268static JSValueRef print_callAsFunction(JSContextRef context, JSObjectRef functionObject, JSObjectRef thisObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception)
    269269{
    270270    UNUSED_PARAM(functionObject);
    271271    UNUSED_PARAM(thisObject);
    272272   
    273     if (argc > 0) {
    274         JSStringRef string = JSValueToStringCopy(context, argv[0], NULL);
     273    if (argumentCount > 0) {
     274        JSStringRef string = JSValueToStringCopy(context, arguments[0], NULL);
    275275        size_t sizeUTF8 = JSStringGetMaximumUTF8CStringSize(string);
    276276        char stringUTF8[sizeUTF8];
     
    283283}
    284284
    285 static JSObjectRef myConstructor_callAsConstructor(JSContextRef context, JSObjectRef constructorObject, size_t argc, JSValueRef argv[], JSValueRef* exception)
     285static JSObjectRef myConstructor_callAsConstructor(JSContextRef context, JSObjectRef constructorObject, size_t argumentCount, JSValueRef arguments[], JSValueRef* exception)
    286286{
    287287    UNUSED_PARAM(constructorObject);
    288288   
    289289    JSObjectRef result = JSObjectMake(context, NULL, 0);
    290     if (argc > 0) {
     290    if (argumentCount > 0) {
    291291        JSStringRef value = JSStringCreateWithUTF8CString("value");
    292         JSObjectSetProperty(context, result, value, argv[0], kJSPropertyAttributeNone, NULL);
     292        JSObjectSetProperty(context, result, value, arguments[0], kJSPropertyAttributeNone, NULL);
    293293        JSStringRelease(value);
    294294    }
  • trunk/JavaScriptCore/ChangeLog

    r15443 r15444  
     12006-07-14  Geoffrey Garen  <[email protected]>
     2
     3        RS by Maciej.
     4       
     5        Global replace in the API of argc/argv with argumentCount/arguments.
     6
    172006-07-14  Geoffrey Garen  <[email protected]>
    28
Note: See TracChangeset for help on using the changeset viewer.