Newsgroups: comp.lang.apl
Path: watmath!watserv1!utgpu!news-server.csri.toronto.edu!torsqnt!jtsv16!itcyyz!yrloc!hui
From: hui@yrloc.ipsa.reuter.COM (Roger Hui)
Subject: Re:  ?:
Message-ID: <1992Mar18.170152.25776@yrloc.ipsa.reuter.COM>
Organization: Iverson Software Inc.
References: <mail> <9203170311.AA28656@keng.Eng.Sun.COM> <ksdci6INNe9e@exodus.Eng.Sun.COM>
Date: Wed, 18 Mar 92 17:01:52 GMT


Alden Desoto writes:
 
> Does any vendor provide an API to allow outside world
> applications to use their APL interpretor? Such an API
> would allow for example an event-driven window based
> application to "trigger" the execution of a defined APL
> function as required.
 
Yes, under the LinkJ interface, one can call J from C and vice versa.
Functions written in C can be linked and are treated like ordinary
J verbs -- subject to rank, can be composed with other verbs, etc.
The interface includes a way to transfer existing data into J
without conversion to literal data.
 
> - the encapsulation of APL (data, functions, or the
>   interpretor itself) into an "Object". Other applications
>   could send requests to this object, (e.g. "execute this
>   expression" or "execute foo in workspace myws and return
>   the result to address a").
 
Under LinkJ, you can think of the main loop as being in your C
application or in J; in particular, one can accomplish the equivalent
of the examples above.  For example:
 
   jinit();            /* Initialize J                                */
   p=jx("a=.i.3 4");   /* p is a 3-by-4 table of the integers 0 to 11 */
   q=jx("+/,a");       /* q is the atom 66                            */
 
Note that "a" persisted from one invocation of jx() to the next.
 
To try this, obtain the J source from watserv1.waterloo.edu and compile
it with the LINKJ parameter in file j.h set to 1.  J is known to work under
various Sun machines.  Documentation is available from the address below.

------------------------------------
Roger Hui, Iverson Software Inc., 33 Major Street, Toronto, Ontario  M5S 2K9
Phone: (416) 925 6096;  Fax: (416) 488 7559
