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 68 69 70
|
\section{The XPCE GUI system for Prolog} \label{sec:xpce}
\index{GUI}\index{XPCE}\index{Graphics}\index{Window interface}%
\index{X11}%
The \href{http://www.swi-prolog.org/packages/xpce/}{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.
\begin{code}
:- pce_begin_class(prolog_lister, frame,
"List Prolog predicates").
initialise(Self) :->
"As the C++ constructor"::
send_super(Self, 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),
current_output(Old),
pce_open(V, write, Fd),
set_output(Fd),
listing(Term),
close(Fd),
set_output(Old)
; 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/ME, Windows~NT/2000/XP and MacOS X (using X11).
In the past, versions for Quintus- and SICStus Prolog as well as
some Lisp dialects have existed. After discontinuing active Lisp
development at SWI the Lisp versions have died. Active development
on the Quintus and SICStus versions has been stopped due to lack of
standardisation in the Prolog community. If adequate standards
emerge we are happy to actively support other Prolog implementations.
\paragraph{Info.} further information is available from
\url{http://www.swi-prolog.org/packages/xpce/} or by E-mail to
\email{info@www.swi-prolog.org}.
|