[Up] [Contents] [Index] [Summary]

1.4 The XPCE GUI system for Prolog

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":: ( term_to_atom(Term, From) -> 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).

The 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 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/home.html or by E-mail to xpce-request@swi.psy.uva.nl. There is a demo version for Windows 95 and NT in ftp://swi.psy.uva.nl/pub/xpce/Windows/bin/, and one for the i386/Linux system in ftp://swi.psy.uva.nl/pub/xpce/linux. For information on ProWindows-3, please see http://www.aiil.co.uk, or contact sales@aiil.co.uk.