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_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).
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/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.
Info. further information is available from http://www.swi-prolog.org/packages/xpce/ or by E-mail to firstname.lastname@example.org.