[webkit-changes] cvs commit: JavaScriptCore/kjs lookup.h

Anders andersca at opensource.apple.com
Thu Dec 22 13:07:38 PST 2005


andersca    05/12/22 13:07:37

  Modified:    .        ChangeLog
               kjs      lookup.h
  Log:
  2005-12-22  Anders Carlsson  <andersca at mac.com>
  
          Reviewed by Eric and Darin.
  
          - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6196
          Would like to be able to define prototypes in headers
  
          * kjs/lookup.h:
          Move ClassName from KJS_DECLARE_PROTOTYPE to KJS_IMPLEMENT_PROTOTYPE.
          Also, namespace all macros by prefixing them with KJS_.
  
  Revision  Changes    Path
  1.921     +12 -0     JavaScriptCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
  retrieving revision 1.920
  retrieving revision 1.921
  diff -u -r1.920 -r1.921
  --- ChangeLog	22 Dec 2005 16:48:06 -0000	1.920
  +++ ChangeLog	22 Dec 2005 21:07:35 -0000	1.921
  @@ -1,3 +1,14 @@
  +2005-12-22  Anders Carlsson  <andersca at mac.com>
  +
  +        Reviewed by Eric and Darin.
  +
  +        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6196
  +        Would like to be able to define prototypes in headers
  +        
  +        * kjs/lookup.h:
  +        Move ClassName from KJS_DECLARE_PROTOTYPE to KJS_IMPLEMENT_PROTOTYPE.
  +        Also, namespace all macros by prefixing them with KJS_. 
  +
   2005-12-22  Darin Adler  <darin at apple.com>
   
           Reviewed by Maciej.
  @@ -27,6 +38,7 @@
           Also remove unneeded const in raw pointer versions.
           (KXMLCore::operator!=): Ditto.
   
  +>>>>>>> 1.920
   2005-12-21  Timothy Hatcher  <timothy at apple.com>
   
           * JavaScriptCore.xcodeproj/project.pbxproj:
  
  
  
  1.22      +22 -17    JavaScriptCore/kjs/lookup.h
  
  Index: lookup.h
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/lookup.h,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- lookup.h	13 Dec 2005 21:24:51 -0000	1.21
  +++ lookup.h	22 Dec 2005 21:07:37 -0000	1.22
  @@ -284,39 +284,44 @@
      * not one in each derived class. So we link the (unique) prototypes between them.
      *
      * Using those macros is very simple: define the hashtable (e.g. "DOMNodeProtoTable"), then
  -   * DEFINE_PROTOTYPE("DOMNode",DOMNodeProto)
  -   * IMPLEMENT_PROTOFUNC(DOMNodeProtoFunc)
  -   * IMPLEMENT_PROTOTYPE(DOMNodeProto,DOMNodeProtoFunc)
  +   * KJS_DEFINE_PROTOTYPE(DOMNodeProto)
  +   * KJS_IMPLEMENT_PROTOFUNC(DOMNodeProtoFunc)
  +   * KJS_IMPLEMENT_PROTOTYPE("DOMNode", DOMNodeProto,DOMNodeProtoFunc)
      * and use DOMNodeProto::self(exec) as prototype in the DOMNode constructor.
      * If the prototype has a "parent prototype", e.g. DOMElementProto falls back on DOMNodeProto,
      * then the last line will use IMPLEMENT_PROTOTYPE_WITH_PARENT, with DOMNodeProto as last argument.
      */
  -#define DEFINE_PROTOTYPE(ClassName,ClassProto) \
  +#define KJS_DEFINE_PROTOTYPE(ClassProto) \
     class ClassProto : public JSObject { \
       friend JSObject *cacheGlobalObject<ClassProto>(ExecState *exec, const Identifier &propertyName); \
     public: \
  -    static JSObject *self(ExecState *exec) \
  -    { \
  -      return cacheGlobalObject<ClassProto>(exec, "[[" ClassName ".prototype]]"); \
  -    } \
  +    static JSObject *ClassProto::self(ExecState *exec); \
  +    virtual const ClassInfo *classInfo() const { return &info; } \
  +    static const ClassInfo info; \
  +    bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&); \
     protected: \
       ClassProto( ExecState *exec ) \
         : JSObject( exec->lexicalInterpreter()->builtinObjectPrototype() ) {} \
       \
  -  public: \
  -    virtual const ClassInfo *classInfo() const { return &info; } \
  -    static const ClassInfo info; \
  -    bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&); \
  -  }; \
  -  const ClassInfo ClassProto::info = { ClassName, 0, &ClassProto##Table, 0 };
  +  };
   
  -#define IMPLEMENT_PROTOTYPE(ClassProto,ClassFunc) \
  +#define KJS_IMPLEMENT_PROTOTYPE(ClassName, ClassProto,ClassFunc) \
  +    const ClassInfo ClassProto::info = { ClassName, 0, &ClassProto##Table, 0 }; \
  +    JSObject *ClassProto::self(ExecState *exec) \
  +    { \
  +      return cacheGlobalObject<ClassProto>(exec, "[[" ClassName ".prototype]]"); \
  +    } \
       bool ClassProto::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) \
       { \
         return getStaticFunctionSlot<ClassFunc,JSObject>(exec, &ClassProto##Table, this, propertyName, slot); \
       }
   
  -#define IMPLEMENT_PROTOTYPE_WITH_PARENT(ClassProto,ClassFunc,ParentProto)  \
  +#define KJS_IMPLEMENT_PROTOTYPE_WITH_PARENT(ClassName, ClassProto,ClassFunc,ParentProto)  \
  +    const ClassInfo ClassProto::info = { ClassName, 0, &ClassProto##Table, 0 }; \
  +    JSObject *ClassProto::self(ExecState *exec) \
  +    { \
  +      return cacheGlobalObject<ClassProto>(exec, "[[" ClassName ".prototype]]"); \
  +    } \
       bool ClassProto::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) \
       { \
         if (getStaticFunctionSlot<ClassFunc,JSObject>(exec, &ClassProto##Table, this, propertyName, slot)) \
  @@ -324,7 +329,7 @@
         return ParentProto::self(exec)->getOwnPropertySlot(exec, propertyName, slot); \
       }
   
  -#define IMPLEMENT_PROTOFUNC(ClassFunc) \
  +#define KJS_IMPLEMENT_PROTOFUNC(ClassFunc) \
     class ClassFunc : public DOMFunction { \
     public: \
       ClassFunc(ExecState *exec, int i, int len) : id(i) \
  
  
  



More information about the webkit-changes mailing list