1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
\section{The XPCE GUI system for Prolog} \label{sec:xpce}
\index{GUI}\index{XPCE}\index{Graphics}\index{Window interface}%
\index{X11}%
The \url[XPCE GUI system]{http://www,swi.psy.uva.nl/projects/xpce/} 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.
\begin{code}
:- 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).
\end{code}
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.
\paragraph{Availability.} XPCE runs on most Unix\tm{} platforms,
Windows~95, 98 and Windows~NT. It has been connected to SWI-Prolog,
SICStus\tm{} and Quintus\tm{} Prolog as well as some Lisp
dialects and C++. The Quintus version is commercially distributed and
supported as ProWindows-3\tm{}.
\paragraph{Info.} further information is available from
\url{http://www.swi.psy.uva.nl/projects/xpce/} or by E-mail to
\email{xpce-request@swi.psy.uva.nl}. There are demo versions for
Windows~95, 98, NT and i386/Linux available from the
\url[XPCE download page]{http://www.swi.psy.uva.nl/projects/xpce/download.html}.
|