| ![]() |
Wafe - An X Toolkit Based Frontend
forApplication Programs in Various
Programming Languages
Gustaf Neumann ?Wirtschaftsuniversit?t Wien Stefan Nusser ?Wirtschaftsuniversit?t Wien
ABSTRACT
Wafe provides a ?exible and easy to use interface to the XToolkit (Xt) and the Athena widget set (Xaw) using the embeddable command language Tcl [1]. It allows access to Xt'sfunctionality from all compiler and interpreter languages, provided that theycan communicate over stdout and stdin via unbuffered I/O. Atypical Wafe application consists of a frontend process and an application program, which is executed as a child process of the frontend. Wafe provides a relative ly high levelinterface to the X Toolkit and widget programming, where the user interface can be interactive ly developed without anyneed to program in C. Wafe can be used as a rapid prototyping tool and allows easier migration from existing ASCII based programs to X Window applications.
Introduction
When we started to work on the Wafe project in Summer 91 we had the need to provide decent user interfaces for applications in various (mostly interpreted) programming languages. As a matter of fact, at this time most of our applications were running with ASCII based user interfaces under terminal emulators likexterm - which is a practical but suboptimal way of using the graphical user interface of our equipment, which consists mostly of X Windowbased workstations. Wefound out that for most (if not evenall) of our application programs a small set of X Toolkit commands and the Athena widget library with its programmatic interface was completely suf?cient to provide easy to use graphical interfaces.
On the one hand, it seemed impractical to implement widget functionality in all different programming languages used for our applications, on the other hand we did not evenconsider to port our existing programs to C. Therefore we chose a frontend approach where all widget functionality is incorporated in one separate program. Wecalled our frontend Wafe, standing for Widget[Athena]FrontEnd. Wafe was implemented using the embeddable command language Tcl [1], which was augmented with widget speci?c facilities. Tcl is an interpretative language using strings as the only data type and provides a collection of built-in utility commands as well as user de?neable subroutines.
Giventhe situation described so far,wedecided
after a thorough analysis of the existing products to
implement our own solution using the following
design goals:
?Our frontend approach must be able to collaborate
with a broad variety of programming languages,
using a handy communication mechanism. This
implies that we cannot presume that the backend
application will support certain libraries (eg. sockets
or pipes), which are actually not available under
some of the programming languages used for the
examples presented in the last section.
?Tosupport smoothly the different stages of the
developing and prototyping process, we want our
frontend application to provide three different
modes of operation: There is an interactive mode,
where Wafe can be used as a single process reading
commands from standard input, which are interactively
interpeted. The user sees howthe widget tree
is built and modi?ed step by step. The interactive
mode offers the possibility to examine the effects of
different commands or to easily compare different
approaches to accomplish a certain task.
Furthermore, our frontend has to support the possibility
to execute command ?les (?le mode). The ?le
mode offers twomain usages: First, this mode can
be used to provide simple user interfaces just by
writing scripts in the Tcl language, where Tcl's
built-in commands or the commands provided by
Wafe can be used. Typically such a script will start
with the #! magic supported by most of the shells.
This script can also be used later as a frontend. The
user interface (the frontend) can be developed
mostly independent from the application program
(the backend).
Finally,Wafe provides the so-called frontend mode
which uses interprocess communication facilities as
described in the sections belowtosupport the separation
between the backend application and the frontend
process.
?Another requirement for the application development
was the extensibility of the chosen widget set.
This made us choose the X Toolkit as the basis for
our program, granting access to the broad range of
1992 Winter USENIX ? January 25-29, 1993 ? San Diego, CA 1