Javascript in Amaya

Hello,

I continued the javascript in Amaya this week-end : the major part of
properties and methods of the object Window, Navigator, Screen, History
and Location are now integrated. I started to implement the DOM Core
Level 1, but I need your help to add a specific structure in Thot. Here
is the problem :
  - The module javascript.c creates javascript objects, that represent
each node of the document tree, in order to be manipulated by a script.
  - Each of this objects has a private data (a pointer) that I use to
store the node (type Element) represented.
  - I would like to add such a private data to the type Element of Thot,
in order to store (a pointer to) the javascript object.

Here is the two functions of SpiderMonkey used to manipulate the private
data :
  1) void * JS_GetPrivate(JSContext *cx, JSObject *obj);
      Retrieves the private data associated with an object.

  2) JSBool JS_SetPrivate(JSContext *cx, JSObject *obj, void *data);
      Sets the private data for a JS object.

And the corresponding Thot functions I need :
  1) void * TtaGetPrivate(Element *element);
  2) ThotBool TtaSetPrivate(Element *element, void *data);

The updates are in the amaya_javascript.tar.gz file, but they required
the two functions I mentionned to be compiled. Then you can try the
javascript test contained in scan_tree.tar.gz : load the xml file with
Amaya and execute the script. If everything is ok, this should list all
the nodes of the document tree.

Fred

-- 
Frédéric WANG
fwsmail35@aol.com
http://www.maths-informatique-jeux.com  
--

Received on Sunday, 20 May 2007 09:41:19 UTC