Annotation of Amaya/amaya/javascript.h, revision 1.1

1.1     ! vatton      1: /*
        !             2:  *
        !             3:  *  (c) COPYRIGHT INRIA and W3C, 2007
        !             4:  *  Please first read the full copyright statement in file COPYRIGHT.
        !             5:  *
        !             6:  */
        !             7: 
        !             8: #ifndef __AMAYA_JAVASCRIPT_H__
        !             9: #define __AMAYA_JAVASCRIPT_H__
        !            10: 
        !            11: /* javascript.h : defines functions, properties and classes
        !            12:  * used by the javascript interpreter
        !            13:  *
        !            14:  * Author: F. Wang
        !            15:  *
        !            16:  */
        !            17: 
        !            18: /*----------------------------------------------------------------------
        !            19:            Instructions to complete the javascript/DOM support
        !            20: 
        !            21:   * Properties
        !            22: 
        !            23:      - Add a C identifier for your property in the enum list
        !            24:        properties_names.
        !            25: 
        !            26:      - Complete or create a JSPropertySpec to integrate your new property.
        !            27:         If your property must not be modified by the user, then add a
        !            28:         JSPROP_READONLY flag in its definition.
        !            29: 
        !            30:      - In javascript.c, complete the functions that manipulate your property:
        !            31:         getProperty, setProperty (if your property is not readonly)...
        !            32: 
        !            33:      - If your property does not belong to an already declared class, you
        !            34:        have to create one first (see the instructions for Classes). Then
        !            35:        apply JS_DefineProperties to all the object of the classes that
        !            36:        have the property.
        !            37: 
        !            38:   * Methods (functions)
        !            39: 
        !            40:      - Add a declaration of a C function representing the method.
        !            41: 
        !            42:      - Complete or create a JSFunctionSpec to integrate your new method.
        !            43: 
        !            44:      - In javascript.c, create the C function representing the method.
        !            45: 
        !            46:      - If your method does not belong to an already declared class, you
        !            47:        have to create one first (see the instructions for Classes). Then
        !            48:        apply JS_DefineFunctions to all the object of the classes that
        !            49:        have the method.
        !            50: 
        !            51:   * Classes (in DOM specification, they correspond to "Object" in the
        !            52:              pages ECMA Script Language Binding)
        !            53: 
        !            54:      - Add a JSClass definition (see all the possible configurations
        !            55:        at http://www.mozilla.org/js/spidermonkey/):
        !            56:        
        !            57:          > The first element is the name of your class
        !            58: 
        !            59:          > If the class is supposed to be applied to objects that have an
        !            60:            equivalent in Thot document tree (type Element), then add a
        !            61:            JSCLASS_HAS_PRIVATE flag to the second element.
        !            62: 
        !            63:          > The next four elements indicate the name of the C functions
        !            64:            (for instance getProperty) that manipulate properties of an
        !            65:            object, respectivly to add, delete, get or set a property.
        !            66:            If they are not used, then put JS_PropertyStub.
        !            67:            
        !            68:          > The last elements indicate other manipulations, that normally
        !            69:            are not used, so you can let them to JS_EnumerateStub,
        !            70:            JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
        !            71: 
        !            72:       - Define Properties and Methods to use with your class. See the
        !            73:         instructions before.
        !            74: 
        !            75:       - In javascript.c, make Amaya apply your class (and the corresponding
        !            76:         property and methods) to a certain kind of objects:
        !            77: 
        !            78:         > If they are childs of the global object (such as Navigator,
        !            79:           Screen...), then only one object is created for this class and
        !            80:           this must directly be done in the function InitJavascript.
        !            81: 
        !            82:         > Otherwise, you have to analyse the type of Thot's Document/Node
        !            83:           in the function BuildDocumentTree in order to apply the class to
        !            84:           each object of the expected type.
        !            85: 
        !            86:         >  To create an object with a given class use the function
        !            87:            JS_NewObject. If the object is actually a property, you have to
        !            88:            use JS_DefineObject. Note that in this case, it is not mandatory
        !            89:            to define the property in javascript.h
        !            90: 
        !            91:   -----------------------------------------------------------------------*/
        !            92: 
        !            93: /*----------------------------------------------------------------------
        !            94:   Functions used to manipulate property values
        !            95:   -----------------------------------------------------------------------*/
        !            96: static JSBool getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
        !            97: static JSBool setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
        !            98: 
        !            99: /*----------------------------------------------------------------------
        !           100:   Name of all properties used in getProperty, setProperty...
        !           101:   -----------------------------------------------------------------------*/
        !           102: enum properties_names
        !           103: {
        !           104:  WINDOW,
        !           105:  WINDOW_CLOSED, WINDOW_FRAMES, WINDOW_LENGTH, WINDOW_OPENER,
        !           106:  WINDOW_PARENT, WINDOW_SELF, WINDOW_TOP, WINDOW_NAME,
        !           107: 
        !           108:  NAVIGATOR_APPNAME, NAVIGATOR_APPCODENAME, NAVIGATOR_APPVERSION, 
        !           109:  NAVIGATOR_USERAGENT, NAVIGATOR_COOKIESENABLED, NAVIGATOR_PLATFORM,
        !           110:  NAVIGATOR_BROWSERLANGUAGE, /*NAVIGATOR_PLUGINS, */
        !           111: 
        !           112:  SCREEN_PIXELDEPTH, SCREEN_COLORDEPTH,
        !           113:  SCREEN_AVAILHEIGHT, SCREEN_AVAILWIDTH,  SCREEN_HEIGHT, SCREEN_WIDTH,
        !           114:  
        !           115:  HISTORY_LENGTH,
        !           116: 
        !           117:  LOCATION_HREF, LOCATION_PATHNAME, LOCATION_HASH,
        !           118:  /*, LOCATION_HOST, LOCATION_HOSTNAME, 
        !           119:  LOCATION_PORT, LOCATION_PROTOCOL, LOCATION_SEARCH, */
        !           120: 
        !           121:  DOCUMENT_IMPLEMENTATION, DOCUMENT_DOCTYPE, DOCUMENT_DOCUMENTELEMENT,
        !           122: 
        !           123:  DOCUMENTTYPE_NAME, DOCUMENTTYPE_ENTITIES, DOCUMENTTYPE_NOTATIONS,
        !           124: 
        !           125:  NODE_NODENAME, NODE_NODEVALUE, NODE_NODETYPE, NODE_PARENTNODE, NODE_CHILDNODES, NODE_FIRSTCHILD,
        !           126:  NODE_LASTCHILD, NODE_PREVIOUSSIBLING, NODE_NEXTSIBLING, NODE_ATTRIBUTES, NODE_OWNERDOCUMENT,
        !           127: 
        !           128:  NODELIST_LENGTH
        !           129: };
        !           130: 
        !           131: /*----------------------------------------------------------------------
        !           132:   Global Object Window
        !           133:   -----------------------------------------------------------------------*/
        !           134: static JSBool window_alert(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           135: static JSBool window_confirm(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           136: static JSBool window_prompt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           137: static JSBool window_close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           138: static JSBool window_blur(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           139: static JSBool window_print(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           140: 
        !           141: /*
        !           142: static JSBool window_clearInterval(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           143: static JSBool window_clearTimeout(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           144: static JSBool window_focus(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           145: static JSBool window_moveBy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           146: static JSBool window_moveTo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           147: static JSBool window_open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           148: static JSBool window_resizeBy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           149: static JSBool window_resizeTo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           150: static JSBool window_scrollBy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           151: static JSBool window_scrollTo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           152: static JSBool window_setInterval(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           153: static JSBool window_setTimeout(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           154: */
        !           155: 
        !           156: static JSFunctionSpec window_functions[] =
        !           157: {
        !           158:   /* name of javascript function     name of C function       number of arguments  */
        !           159:   {"alert"                        , window_alert          ,        1},
        !           160:   {"confirm"                      , window_confirm        ,        1},
        !           161:   {"prompt"                       , window_prompt         ,        2},
        !           162:   {"close"                        , window_close          ,        0},
        !           163:   {"blur"                         , window_blur           ,        0},
        !           164:   {"print"                        , window_print          ,        0},
        !           165: 
        !           166: /*
        !           167:   {"clearInterval"                , window_clearInterval  ,        1},
        !           168:   {"clearTimeout"                 , window_clearTimeout   ,        1},
        !           169:   {"focus"                        , window_focus          ,        0},
        !           170:   {"moveBy"                       , window_moveBy         ,        2},
        !           171:   {"moveTo"                       , window_moveTo         ,        2},
        !           172:   {"open"                         , window_open           ,        4},
        !           173:   {"resizeBy"                     , window_resizeBy       ,        2},
        !           174:   {"resizeTo"                     , window_resizeTo       ,        2},
        !           175:   {"scrollBy"                     , window_scrollBy       ,        2},
        !           176:   {"scrollTo"                     , window_scrollTo       ,        2},
        !           177:   {"setInterval"                  , window_setInterval    ,        3},
        !           178:   {"setTimeout"                   , window_setTimeout     ,        3},
        !           179: */
        !           180:   {0}
        !           181: };
        !           182: 
        !           183: static JSPropertySpec window_properties[] =
        !           184: {
        !           185:   {"window"     ,      WINDOW,             JSPROP_READONLY},
        !           186:   {"closed"     ,      WINDOW_CLOSED,      JSPROP_READONLY},
        !           187:   {"frames"     ,      WINDOW_FRAMES,      JSPROP_INDEX & JSPROP_READONLY},
        !           188:   {"length"     ,      WINDOW_LENGTH,      JSPROP_READONLY},
        !           189:   {"opener"     ,      WINDOW_OPENER,      JSPROP_READONLY},
        !           190:   {"parent"     ,      WINDOW_PARENT,      JSPROP_READONLY},
        !           191:   {"self"       ,      WINDOW_SELF  ,      JSPROP_READONLY},
        !           192:   {"top"        ,      WINDOW_TOP   ,      JSPROP_READONLY},
        !           193:   {0}
        !           194: };
        !           195: 
        !           196: static JSClass window_class =
        !           197: {
        !           198:   "Window",0,
        !           199:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           200:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           201: };
        !           202: 
        !           203: /*----------------------------------------------------------------------
        !           204:   Object Navigator
        !           205:   -----------------------------------------------------------------------*/
        !           206: 
        !           207: static JSBool navigator_javaEnabled(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           208: static JSBool navigator_taintEnabled(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           209: 
        !           210: static JSFunctionSpec navigator_functions[] =
        !           211: {
        !           212:   /* name of javascript function     name of C function       number of arguments  */
        !           213:   {"javaEnabled"                  , navigator_javaEnabled  ,        0},
        !           214:   {"taintEnabled"                 , navigator_taintEnabled ,        0},
        !           215:   {0}
        !           216: };
        !           217: 
        !           218: static JSPropertySpec navigator_properties[] =
        !           219: {
        !           220: /*  {"plugins"         ,      NAVIGATOR_PLUGINS          , JSPROP_INDEX & JSPROP_READONLY},*/
        !           221:   {"appCodeName"     ,      NAVIGATOR_APPCODENAME      , JSPROP_READONLY},
        !           222:   {"appName"         ,      NAVIGATOR_APPNAME          , JSPROP_READONLY},
        !           223:   {"appVersion"      ,      NAVIGATOR_APPVERSION       , JSPROP_READONLY},
        !           224:   {"browserLanguage" ,      NAVIGATOR_BROWSERLANGUAGE  , JSPROP_READONLY},
        !           225:   {"cookieEnabled"   ,      NAVIGATOR_COOKIESENABLED   , JSPROP_READONLY},
        !           226:   {"platform"        ,      NAVIGATOR_PLATFORM         , JSPROP_READONLY},
        !           227:   {"userAgent"       ,      NAVIGATOR_USERAGENT        , JSPROP_READONLY},
        !           228:   {0}
        !           229: };
        !           230: 
        !           231: static JSClass navigator_class =
        !           232: {
        !           233:   "Navigator",0,
        !           234:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           235:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           236: };
        !           237: 
        !           238: 
        !           239: /*----------------------------------------------------------------------
        !           240:   Object Screen
        !           241:   -----------------------------------------------------------------------*/
        !           242: 
        !           243: static JSPropertySpec screen_properties[] =
        !           244: {
        !           245:   {"availHeight",      SCREEN_AVAILHEIGHT      , JSPROP_READONLY},
        !           246:   {"availWidth" ,      SCREEN_AVAILWIDTH       , JSPROP_READONLY},
        !           247:   {"colorDepth" ,      SCREEN_COLORDEPTH       , JSPROP_READONLY},
        !           248:   {"pixelDepth" ,      SCREEN_PIXELDEPTH       , JSPROP_READONLY},
        !           249:   {"height"     ,      SCREEN_HEIGHT           , JSPROP_READONLY},
        !           250:   {"width"      ,      SCREEN_WIDTH            , JSPROP_READONLY},
        !           251:   {0}
        !           252: };
        !           253: 
        !           254: static JSClass screen_class =
        !           255: {
        !           256:   "Screen",0,
        !           257:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           258:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           259: };
        !           260: 
        !           261: /*----------------------------------------------------------------------
        !           262:   Object History
        !           263:   -----------------------------------------------------------------------*/
        !           264: 
        !           265: static JSBool history_back(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           266: static JSBool history_forward(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           267: /*static JSBool history_go(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);*/
        !           268: 
        !           269: static JSFunctionSpec history_functions[] =
        !           270: {
        !           271:   /* name of javascript function     name of C function       number of arguments  */
        !           272:   {"back"                            , history_back          ,        0},
        !           273:   {"forward"                         , history_forward       ,        0},
        !           274: /*  {"go"                              , history_go            ,        1},*/
        !           275:   {0}
        !           276: };
        !           277: 
        !           278: static JSPropertySpec history_properties[] =
        !           279: {
        !           280:   {"length"      ,      HISTORY_LENGTH            , JSPROP_READONLY},
        !           281:   {0}
        !           282: };
        !           283: 
        !           284: static JSClass history_class =
        !           285: {
        !           286:   "History",0,
        !           287:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           288:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           289: };
        !           290: 
        !           291: /*----------------------------------------------------------------------
        !           292:   Object Location
        !           293:   -----------------------------------------------------------------------*/
        !           294: 
        !           295: static JSBool location_replace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           296: static JSBool location_assign(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           297: static JSBool location_reload(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           298: 
        !           299: static JSFunctionSpec location_functions[] =
        !           300: {
        !           301:   /* name of javascript function     name of C function       number of arguments  */
        !           302:   {"reload"                         , location_reload          ,        0},
        !           303:   {"assign"                         , location_assign          ,        1},
        !           304:   {"replace"                        , location_replace         ,        1},
        !           305:   {0}
        !           306: };
        !           307: 
        !           308: 
        !           309: static JSPropertySpec location_properties[] =
        !           310: {
        !           311:   {"href"            ,      LOCATION_HREF               , 0},
        !           312:   {"pathname"        ,      LOCATION_PATHNAME           , JSPROP_READONLY},
        !           313:   {"hash"            ,      LOCATION_HASH               , JSPROP_READONLY},
        !           314: /*   {"host"            ,      LOCATION_HOST               , 0},
        !           315:   {"hostname"        ,      LOCATION_HOSTNAME           , 0},
        !           316:   {"port"            ,      LOCATION_PORT               , 0},
        !           317:   {"protocol"        ,      LOCATION_PROTOCOL           , 0},
        !           318:   {"search"          ,      LOCATION_SEARCH             , 0},*/
        !           319:   {0}
        !           320: };
        !           321: 
        !           322: 
        !           323: static JSClass location_class =
        !           324: {
        !           325:   "Location",0,
        !           326:   JS_PropertyStub,JS_PropertyStub,getProperty,setProperty,
        !           327:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           328: };
        !           329: 
        !           330: /*----------------------------------------------------------------------
        !           331:   Object DOMException
        !           332:   -----------------------------------------------------------------------*/
        !           333: /*
        !           334: static JSClass DOMException_class =
        !           335: {
        !           336:   "DOMException",0,
        !           337:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           338:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           339: };*/
        !           340: 
        !           341: /*----------------------------------------------------------------------
        !           342:   Object ExceptionCode
        !           343:   -----------------------------------------------------------------------*/
        !           344: /*
        !           345: static JSClass ExceptionCode_class =
        !           346: {
        !           347:   "ExceptionCode",0,
        !           348:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           349:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           350: };
        !           351: */
        !           352: 
        !           353: /* Definition ExceptionCode */
        !           354: #define INDEX_SIZE_ERR                   1
        !           355: #define DOMSTRING_SIZE_ERR               2
        !           356: #define HIERARCHY_REQUEST_ERR            3
        !           357: #define WRONG_DOCUMENT_ERR               4
        !           358: #define INVALID_CHARACTER_ERR            5
        !           359: #define NO_DATA_ALLOWED_ERR              6
        !           360: #define NO_MODIFICATION_ALLOWED_ERR      7
        !           361: #define NOT_FOUND_ERR                    8
        !           362: #define NOT_SUPPORTED_ERR                9
        !           363: #define INUSE_ATTRIBUTE_ERR             10 
        !           364: 
        !           365: /*----------------------------------------------------------------------
        !           366:   Object DOMImplementation
        !           367:   -----------------------------------------------------------------------*/
        !           368: static JSBool DOMImplementation_hasFeature(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           369: 
        !           370: static JSFunctionSpec DOMImplementation_functions[] =
        !           371: {
        !           372:   /* name of javascript function     name of C function             number of arguments  */
        !           373:   {"hasFeature"                   , DOMImplementation_hasFeature   ,        2},
        !           374:   {0}
        !           375: };
        !           376: 
        !           377: static JSClass DOMImplementation_class =
        !           378: {
        !           379:   "DOMImplementation",0,
        !           380:   JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,
        !           381:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           382: };
        !           383: 
        !           384: 
        !           385: /*----------------------------------------------------------------------
        !           386:   Object DocumentFragment
        !           387:   -----------------------------------------------------------------------*/
        !           388: static JSClass DocumentFragment_class =
        !           389: {
        !           390:   "DocumentFragment",0,
        !           391:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           392:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           393: };
        !           394: 
        !           395: /*----------------------------------------------------------------------
        !           396:   Object Document
        !           397:   -----------------------------------------------------------------------*/
        !           398: /*
        !           399: 
        !           400: static JSBool Document_createElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           401: static JSBool Document_createDocumentFragment(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           402: static JSBool Document_createCDATASection(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           403: static JSBool Document_createProcessingInstruction(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           404: static JSBool Document_createAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           405: static JSBool Document_createEntityReference(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           406: static JSBool Document_getElementsByTagName(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           407: 
        !           408: static JSFunctionSpec Document_functions[] =
        !           409: {
        !           410:   / name of javascript function     name of C function                   number of arguments  /
        !           411:   {"createElement"                , Document_createElement               ,        1},
        !           412:   {"createDocumentFragment"       , Document_createDocumentFragment      ,        0},
        !           413:   {"createCDATASection"           , Document_createCDATASection          ,        1},
        !           414:   {"createProcessingInstruction"  , Document_createProcessingInstruction ,        2},
        !           415:   {"createAttribute"              , Document_createAttribute             ,        1},
        !           416:   {"createEntityReference"        , Document_createEntityReference       ,        1},
        !           417:   {"getElementsByTagName"         , Document_getElementsByTagName        ,        1},
        !           418:   {0}
        !           419: };
        !           420: */
        !           421: 
        !           422: static JSPropertySpec Document_properties[] =
        !           423: {
        !           424:   {"doctype"            ,    DOCUMENT_DOCTYPE          , JSPROP_READONLY},
        !           425:   {"implementation"     ,    DOCUMENT_IMPLEMENTATION   , JSPROP_READONLY},
        !           426:   {"documentElement"    ,    DOCUMENT_DOCUMENTELEMENT  , JSPROP_READONLY},
        !           427:   {0}
        !           428: };
        !           429: 
        !           430: static JSClass Document_class =
        !           431: {
        !           432:   "Document", JSCLASS_HAS_PRIVATE,
        !           433:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           434:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           435: };
        !           436: 
        !           437: 
        !           438: /*----------------------------------------------------------------------
        !           439:   Object Node
        !           440:   -----------------------------------------------------------------------*/
        !           441: /*
        !           442: static JSBool Node_createElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           443: static JSBool Node_replaceChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           444: static JSBool Node_removeChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           445: static JSBool Node_appendChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);*/
        !           446: static JSBool Node_hasChildNodes(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           447: //static JSBool Node_cloneNode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);*/
        !           448: 
        !           449: static JSFunctionSpec Node_functions[] =
        !           450: {
        !           451: /*  {"insertBefore"                 , Node_createElement                   ,        2},
        !           452:   {"replaceChild"                 , Node_replaceChild                    ,        1},
        !           453:   {"removeChild"                  , Node_removeChild                     ,        0},
        !           454:   {"appendChild"                  , Node_appendChild                     ,        1},*/
        !           455:   {"hasChildNodes"                , Node_hasChildNodes                   ,        0},
        !           456: /*  {"cloneNode"                    , Node_cloneNode                       ,        1},*/
        !           457:   {0}
        !           458: };
        !           459: 
        !           460: static JSPropertySpec Node_properties[] =
        !           461: {
        !           462:   {"nodeName"            ,      NODE_NODENAME               , JSPROP_READONLY},
        !           463:   {"nodeValue"           ,      NODE_NODEVALUE              , JSPROP_READONLY},
        !           464:   {"nodeType"            ,      NODE_NODETYPE               , JSPROP_READONLY},
        !           465:   {"parentNode"          ,      NODE_PARENTNODE             , JSPROP_READONLY},
        !           466:   {"childNodes"          ,      NODE_CHILDNODES             , JSPROP_READONLY},
        !           467:   {"firstChild"          ,      NODE_FIRSTCHILD             , JSPROP_READONLY},
        !           468:   {"lastChild"           ,      NODE_LASTCHILD              , JSPROP_READONLY},
        !           469:   {"previousSibling"     ,      NODE_PREVIOUSSIBLING        , JSPROP_READONLY},
        !           470:   {"nextSibling"         ,      NODE_NEXTSIBLING            , JSPROP_READONLY},
        !           471:   {"attributes"          ,      NODE_ATTRIBUTES             , JSPROP_READONLY},
        !           472:   {"ownerDocument"       ,      NODE_OWNERDOCUMENT          , JSPROP_READONLY},
        !           473:   {0}
        !           474: };
        !           475: 
        !           476: /*static JSClass Node_class =
        !           477: {
        !           478:   "Node", JSCLASS_HAS_PRIVATE,
        !           479:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           480:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           481: };*/
        !           482: 
        !           483: /* Definition NodeType */
        !           484: #define ELEMENT_NODE                    1
        !           485: #define ATTRIBUTE_NODE                  2
        !           486: #define TEXT_NODE                       3
        !           487: #define CDATA_SECTION_NODE              4
        !           488: #define ENTITY_REFERENCE_NODE           5
        !           489: #define ENTITY_NODE                     6
        !           490: #define PROCESSING_INSTRUCTION_NODE     7
        !           491: #define COMMENT_NODE                    8
        !           492: #define DOCUMENT_NODE                   9
        !           493: #define DOCUMENT_TYPE_NODE             10
        !           494: #define DOCUMENT_FRAGMENT_NODE         11
        !           495: #define NOTATION_NODE                  12
        !           496: 
        !           497: /*----------------------------------------------------------------------
        !           498:   Object NodeList
        !           499:   -----------------------------------------------------------------------*/
        !           500: static JSBool NodeList_item(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           501: 
        !           502: static JSFunctionSpec NodeList_functions[] =
        !           503: {
        !           504:   {"item"                 , NodeList_item                   ,        1},
        !           505:   {0}
        !           506: };
        !           507: 
        !           508: static JSPropertySpec NodeList_properties[] =
        !           509: {
        !           510:   {"length"            ,      NODELIST_LENGTH               , JSPROP_READONLY},
        !           511:   {0}
        !           512: };
        !           513: 
        !           514: static JSClass NodeList_class =
        !           515: {
        !           516:   "NodeList", JSCLASS_HAS_PRIVATE,
        !           517:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           518:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           519: };
        !           520: 
        !           521: /*----------------------------------------------------------------------
        !           522:   Object NamedNodeMap
        !           523:   -----------------------------------------------------------------------*/
        !           524: /*
        !           525: static JSBool NamedNodeMap_getNamedItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           526: static JSBool NamedNodeMap_setNamedItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           527: static JSBool NamedNodeMap_removeNamedItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           528: static JSBool NamedNodeMap_item(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           529: 
        !           530: static JSFunctionSpec NamedNodeMap_functions[] =
        !           531: {
        !           532:   {"getNamedItem"                 , NamedNodeMap_getNamedItem           ,        1},
        !           533:   {"setNamedItem"                 , NamedNodeMap_setNamedItem           ,        1},
        !           534:   {"removeNamedItem"              , NamedNodeMap_removeNamedItem        ,        1},
        !           535:   {"item"                         , NamedNodeMap_item                   ,        1},
        !           536:   {0}
        !           537: };
        !           538: 
        !           539: static JSPropertySpec NamedNodeMap_properties[] =
        !           540: {
        !           541:   {"length"            ,      NAMEDNODEMAP_LENGTH               , JSPROP_READONLY},
        !           542:   {0}
        !           543: };
        !           544: 
        !           545: static JSClass NamedNodeMap_class =
        !           546: {
        !           547:   "NamedNodeMap", JSCLASS_HAS_PRIVATE,
        !           548:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           549:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           550: };
        !           551: */
        !           552: 
        !           553: /*----------------------------------------------------------------------
        !           554:   Object CharacterData
        !           555:   -----------------------------------------------------------------------*/
        !           556: /*
        !           557: static JSBool CharacterData_substringData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           558: static JSBool CharacterData_appendData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           559: static JSBool CharacterData_insertData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           560: static JSBool CharacterData_deleteData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           561: static JSBool CharacterData_replaceData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           562: 
        !           563: static JSFunctionSpec CharacterData_functions[] =
        !           564: {
        !           565:   {"substringData"              , CharacterData_createElement                   ,        2},
        !           566:   {"appendData"                 , CharacterData_createElement                   ,        1},
        !           567:   {"insertData"                 , CharacterData_createElement                   ,        2},
        !           568:   {"deleteData"                 , CharacterData_createElement                   ,        2},
        !           569:   {"replaceData"                , CharacterData_createElement                   ,        3},
        !           570:   {0}
        !           571: };
        !           572: 
        !           573: static JSPropertySpec CharacterData_properties[] =
        !           574: {
        !           575:   {"data"                ,      CHARACTERDATA_DATA               , JSPROP_READONLY},
        !           576:   {"length"              ,      CHARACTERDATA_LENGTH             , JSPROP_READONLY},
        !           577:   {0}
        !           578: };
        !           579: 
        !           580: static JSClass CharacterData_class =
        !           581: {
        !           582:   "CharacterData", JSCLASS_HAS_PRIVATE,
        !           583:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           584:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           585: };
        !           586: */
        !           587: 
        !           588: /*----------------------------------------------------------------------
        !           589:   Object Attr
        !           590:   -----------------------------------------------------------------------*/
        !           591: /*
        !           592: static JSPropertySpec Attr_properties[] =
        !           593: {
        !           594:   {"name"            ,      ATTR_NAME                   , JSPROP_READONLY},
        !           595:   {"specified"       ,      ATTR_SPECIFIED              , JSPROP_READONLY},
        !           596:   {"value"           ,      ATTR_VALUE                  , JSPROP_READONLY},
        !           597:   {0}
        !           598: };
        !           599: */
        !           600: 
        !           601: static JSClass Attr_class =
        !           602: {
        !           603:   "Attr", JSCLASS_HAS_PRIVATE,
        !           604:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           605:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           606: };
        !           607: 
        !           608: 
        !           609: /*----------------------------------------------------------------------
        !           610:   Object Element
        !           611:   -----------------------------------------------------------------------*/
        !           612: /*
        !           613: static JSBool Element_getAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           614: static JSBool Element_setAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           615: static JSBool Element_removeAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           616: static JSBool Element_getAttributeNode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           617: static JSBool Element_setAttributeNode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           618: static JSBool Element_removeAttributeNode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           619: static JSBool Element_getElementsByTagName(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           620: static JSBool Element_normalize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           621: 
        !           622: static JSFunctionSpec Element_functions[] =
        !           623: {
        !           624:   {"getAttribute"                 , Element_getAttribute                ,        1},
        !           625:   {"setAttribute"                 , Element_setAttribute                ,        1},
        !           626:   {"removeAttribute"              , Element_removeAttribute             ,        1},
        !           627:   {"getAttributeNode"             , Element_getAttributeNode            ,        1},
        !           628:   {"setAttributeNode"             , Element_setAttributeNode            ,        1},
        !           629:   {"removeAttributeNode"          , Element_removeAttributeNode         ,        1},
        !           630:   {"getElementsByTagName"         , Element_getElementsByTagName        ,        1},
        !           631:   {"normalize"                    , Element_normalize                   ,        0},
        !           632:   {0}
        !           633: };
        !           634: 
        !           635: static JSPropertySpec Element_properties[] =
        !           636: {
        !           637:   {"tagName"            ,      ELEMENT_TAGNAME               , JSPROP_READONLY},
        !           638:   {0}
        !           639: };
        !           640: 
        !           641: */
        !           642: static JSClass Element_class =
        !           643: {
        !           644:   "Element", JSCLASS_HAS_PRIVATE,
        !           645:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           646:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           647: };
        !           648: 
        !           649: /*----------------------------------------------------------------------
        !           650:   Object Text
        !           651:   -----------------------------------------------------------------------*/
        !           652: /*
        !           653: static JSBool Element_splitText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
        !           654: 
        !           655: static JSFunctionSpec Text_functions[] =
        !           656: {
        !           657:   {"splitText"                 , Text_splitText                   ,        1},
        !           658:   {0}
        !           659: };*/
        !           660: 
        !           661: static JSClass Text_class =
        !           662: {
        !           663:   "Text", JSCLASS_HAS_PRIVATE,
        !           664:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           665:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           666: };
        !           667: 
        !           668: /*----------------------------------------------------------------------
        !           669:   Object Comment
        !           670:   -----------------------------------------------------------------------*/
        !           671: static JSClass Comment_class =
        !           672: {
        !           673:   "Comment", JSCLASS_HAS_PRIVATE,
        !           674:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           675:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           676: };
        !           677: 
        !           678: /*----------------------------------------------------------------------
        !           679:   Object CDATASection
        !           680:   -----------------------------------------------------------------------*/
        !           681: static JSClass CDATASection_class =
        !           682: {
        !           683:   "CDATASection", JSCLASS_HAS_PRIVATE,
        !           684:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           685:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           686: };
        !           687: 
        !           688: /*----------------------------------------------------------------------
        !           689:   Object DocumentType
        !           690:   -----------------------------------------------------------------------*/
        !           691: 
        !           692: static JSPropertySpec DocumentType_properties[] =
        !           693: {
        !           694:   {"name"                ,      DOCUMENTTYPE_NAME           , JSPROP_READONLY},
        !           695:   {"entities"            ,      DOCUMENTTYPE_ENTITIES       , JSPROP_READONLY},
        !           696:   {"notations"           ,      DOCUMENTTYPE_NOTATIONS      , JSPROP_READONLY},
        !           697:   {0}
        !           698: };
        !           699: 
        !           700: static JSClass DocumentType_class =
        !           701: {
        !           702:   "DocumentType", JSCLASS_HAS_PRIVATE,
        !           703:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           704:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           705: };
        !           706: 
        !           707: /*----------------------------------------------------------------------
        !           708:   Object Notation
        !           709:   -----------------------------------------------------------------------*/
        !           710: /*
        !           711: static JSPropertySpec Notation_properties[] =
        !           712: {
        !           713:   {"publicId"            ,      NOTATION_PUBLICID            , JSPROP_READONLY},
        !           714:   {"systemId"            ,      NOTATION_SYSTEMID            , JSPROP_READONLY},
        !           715:   {0}
        !           716: };
        !           717: */
        !           718: static JSClass Notation_class =
        !           719: {
        !           720:   "Notation", JSCLASS_HAS_PRIVATE,
        !           721:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           722:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           723: };
        !           724: 
        !           725: /*----------------------------------------------------------------------
        !           726:   Object Entity
        !           727:   -----------------------------------------------------------------------*/
        !           728: /*
        !           729: static JSPropertySpec Entity_properties[] =
        !           730: {
        !           731:   {"publicId"            ,      ENTITY_PUBLICID               , JSPROP_READONLY},
        !           732:   {"systemId"            ,      ENTITY_SYSTEMID               , JSPROP_READONLY},
        !           733:   {"notationName"        ,      ENTITY_NOTATIONNAME           , JSPROP_READONLY},
        !           734:   {0}
        !           735: };
        !           736: */
        !           737: static JSClass Entity_class =
        !           738: {
        !           739:   "Entity_properties", JSCLASS_HAS_PRIVATE,
        !           740:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           741:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           742: };
        !           743: 
        !           744: /*----------------------------------------------------------------------
        !           745:   Object EntityReference
        !           746:   -----------------------------------------------------------------------*/
        !           747: static JSClass EntityReference_class =
        !           748: {
        !           749:   "EntityReference", JSCLASS_HAS_PRIVATE,
        !           750:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           751:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           752: };
        !           753: 
        !           754: /*----------------------------------------------------------------------
        !           755:   Object ProcessingInstruction
        !           756:   -----------------------------------------------------------------------*/
        !           757: /*
        !           758: static JSPropertySpec ProcessingInstruction_properties[] =
        !           759: {
        !           760:   {"target"            , PROCESSINGINSTRUCTION_TARGET     , JSPROP_READONLY},
        !           761:   {"data"              , PROCESSINGINSTRUCTION_DATA       , JSPROP_READONLY},
        !           762:   {0}
        !           763: };
        !           764: */
        !           765: static JSClass ProcessingInstruction_class =
        !           766: {
        !           767:   "ProcessingInstruction", JSCLASS_HAS_PRIVATE,
        !           768:   JS_PropertyStub,JS_PropertyStub,getProperty,JS_PropertyStub,
        !           769:   JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
        !           770: };
        !           771: 
        !           772: #endif /* __AMAYA_JAVASCRIPT_H__ */

Webmaster