Dear Ludwig,Attached please find the source for the application OzServer (compile and install with ozmake).
Examples and documentation is enclosed. You basically start the application OzServer.exe (e.g. at a shell). This starts the compiler in the background (for convenience it opens the compiler panel GUI in order to see your feeds, change switches etc -- you may of course change that in the code..). From some other application you can then connect to its socket (default port 50000) and feed it Oz code. The format of the code feed is explained in the doc (there are special directives supported to differ between statements and expressions etc). Following is the abstract from the doc:
This is an application which serves as a 'headless' OPI: its starts a full Oz compiler and the compiler awaits arbitrary Oz code (even compiler directives) send via a socket. The allows, for example, to start a full Oz evaluator/compiler from another application (e.g. another language such as Lisp, C, ..) and to execute arbitrary Oz code from within that other application. The code is executed concurrently, i.e. without waiting for it to terminate before proceeding to the next fed input. On its initialisation, the full environment (comparable to the OPI) is loaded to the compiler and it is fed an OZRC file according conventions (cf. oz/doc/opi/node4.html). As interface, the compiler panel GUI is opened. To quit the compiler, quit this application by C-c (closing the panel is not sufficient). When compared with the OPI, the compiler panel (messages panel) serves as Oz Compiler buffer and the standard out of the shell in which the OzServer was started serves as Oz Emulator buffer.
As you can see, there was rather little coding required to do this, as all the pieces where already available. There is a little TODO list in the top-level source file which describes some issues and also a bug.
In case you extend/refactor etc this code somehow, I would be grateful if you let me know about your changes. When you find it useful and reliable, I may also consider publishing it via Mogul..
Best, Torsten
OzServer.tgz
Description: GNU Zip compressed data
On 08.10.2006, at 01:51, Ludwig Jossieaux wrote:
Torsten Anders a écrit :It is very easy to have a full Oz compiler running as a server in the background, and feeding it code + returning results etc. via a socket (I could share some code doing that).Hi Torsten,Could you please share such code ? :) Actually, it is one of the problems i'm facing with while developing the IDE I spoke about in July. I'm trying to use a socket to communicate with the Oz compiler, but I don't understand how the protocol works. It will surely help to see a working example.Tia! Ludwig.
-- Torsten Anders Sonic Arts Research Centre • Queen's University Belfast Frankstr. 49 • D-50996 Köln Tel: +49-221-3980750 http://www.torsten-anders.de http://strasheela.sourceforge.net -- Torsten Anders Sonic Arts Research Centre • Queen's University Belfast Frankstr. 49 • D-50996 Köln Tel: +49-221-3980750 http://www.torsten-anders.de http://strasheela.sourceforge.net
_________________________________________________________________________________ mozart-users mailing list [email protected] http://www.mozart-oz.org/mailman/listinfo/mozart-users
