Re: Javascript in Amaya

Hi Fred,

We're preparing the next Amaya release and by security your Javascript support 
won't be integrated in that release. Anyway a Javascript support without DOM 
support has a limited interest. 

On Thursday 10 May 2007 16:53, fwsmail35 wrote:
> Hello,
>
> Five years ago, some people wanted to integrate javascript in Amaya.
> Paul Cheyrou-lagreze proposed to use SpiderMonkey, the Mozilla's
> interpreter, but I guess nothing has been done until now. Here is the
> message he posted :
> http://lists.w3.org/Archives/Public/www-amaya-dev/2002Aug/0007.html
>
> I started a bit the work : you can now execute a script contained in an
> external file, or between <script type="text/javascript"></script>. For
> the moment, you can only manipulate objects/functions that do not
> require informations about the structure of the document (such as
> Math.abs) and also alert() and confirm() (implementation of prompt is
> not finished yet). Errors are reported in a dialog box, but this has to
> be improved.
>
> To integrate javascript in Amaya source code, follow these instructions :
>
> - compile Spidermonkey (download the source code at
> http://www.mozilla.org/js/spidermonkey/ ). Normally this is possible in
> Linux, Mac and Windows but I can only test with the first. On Linux, you
> have to go to the directory js/src/ and "make -f Makefile.ref". On
> Ubuntu, I got errors that I solved thanks to the following page :
> http://milindalakmal.wordpress.com/2007/02/21/compiling-spidermonkey/ .
>
> - put the javascript.c file in the Amaya/amaya/ directory
>
> - change the Makefile.in from Amaya/amaya/ to integrate new files :
>    1) in AMAYA_OBJ =, add the file javascript.o and libjs.so (the latter
> can be founded in SpiderMonkey compilation directory)
>    2) add informations to compile javascript.c. The two important things
> is to add the location of jsapi.h (I put it in
> /usr/local/include/spidermonkey) and the option -DXP_UNIX (other options
> must be added for windows or mac). Here is the lines I added :
>    javascript.o : javascript.c
>     $(CXX) $(CXXFLAGS) $(ALL_AMAYA_OPTIONS) $(INCLUDES)
> -I/usr/local/include/spidermonkey -DXP_UNIX -c @srcdir@/javascript.c -o $@
>
> - In Amaya/amaya/init.c, in function AmayaClose, after the line
> "RemoveDocumentImages (0);", add "DestroyJavascript ();". This is to
> free the memory used by spidermonkey when closing Amaya.
>
> - Add a way to launch the interpreter. I chosed to use a shortcut.
>   1) In Amaya/amaya/EDITOR.a, add InitJavascript to the list of
> functions (for instance after ...CreateMSINH, CreateMTAN, CreateMTANH)
>   2) In Amaya/config/amaya.keyboard, add the shortcut to launched
> InitJavascript : "Ctrl <Key>j , Ctrl <Key>j:         InitJavascript() "
>
> - You can now launch Amaya and test javascript : each time you make
> "Ctrl j j", the scripts contained in the current document (in formatted
> view) are executed.
>
> Some questions : Can somebody tell me which functions give the location
> of a document, and the line of an Element (for Error report). I would
> also like to know how to get the callback in javascript.c (for the
> function prompt).
>
> Fred

-- 
     Irène.
-----
Irène Vatton                     INRIA Rhône-Alpes
INRIA                               ZIRST
e-mail: Irene.Vatton@inria.fr       655 avenue de l'Europe
Tel.: +33 4 76 61 53 61             Montbonnot
Fax:  +33 4 76 61 52 07             38334 Saint Ismier Cedex - France

Received on Monday, 21 May 2007 07:50:09 UTC