The XPCE GUI system for dynamically typed languages has been with SWI-Prolog for a long time. It is developed by Anjo Anjewierden and Jan Wielemaker from the department of SWI, University of Amsterdam. It aims at a high-productive development environment for graphical applications based on Prolog.
Object oriented technology has proven to be a suitable model for implementing GUIs, which typically deal with things Prolog is not very good at: event-driven control and global state. With XPCE, we designed a system that has similar characteristics that make Prolog such a powerful tool: dynamic typing, meta-programming and dynamic modification of the running system.
XPCE is an object-system written in the C-language. It provides for the implementation of methods in multiple languages. New XPCE classes may be defined from Prolog using a simple, natural syntax. The body of the method is executed by Prolog itself, providing a natural interface between the two systems. Below is a very simple class definition.
:- pce_begin_class(prolog_lister, frame,
"List Prolog predicates").
initialise(Self) :->
"As the C++ constructor"::
send(Self, send_super, initialise, 'Prolog Lister'),
send(Self, append, new(D, dialog)),
send(D, append,
text_item(predicate, message(Self, list, @arg1))),
send(new(view), below, D).
list(Self, From:name) :->
"List predicates from specification"::
( catch(term_to_atom(Term, From), _, fail)
-> get(Self, member, view, V),
pce_open(V, write, Fd),
set_output(Fd),
listing(Term),
close(Fd)
; send(Self, report, error, 'Syntax error')
).
:- pce_end_class.
test :- send(new(prolog_lister), open).
|
Its 165 built-in classes deal with the meta-environment, data-representation and---of course---graphics. The graphics classes concentrate on direct-manipulation of diagrammatic representations.
Availability. XPCE runs on most Unix® platforms, Windows 95, 98 and Windows NT. It has been connected to SWI-Prolog, SICStus® and Quintus® Prolog as well as some Lisp dialects and C++. The Quintus version is commercially distributed and supported as ProWindows-3®.
Info. further information is available from http://www.swi.psy.uva.nl/projects/xpce/ or by E-mail to xpce-request@swi.psy.uva.nl. There are demo versions for Windows 95, 98, NT and i386/Linux available from the XPCE download page.