When Wafe is used as a frontend two separate processes are started - one of them the application, the other responsible for the user interface. The application program (backend) communicates with the frontend (Wafe) via standard using UNIX interprocess communication facilities (streams or sockets). The application process can use the graphical functionalities of Wafe by writing the defined commands to its output channel (stdout) and reading the information sent back the front end via its standard input channel (stdin). Since Wafe was developed using the extensible tcl interpreter language, an application program can dynamically submit requests to the front end to build up the graphical user interface; the application can also down-load application specific procedures into the front end, which can be executed without interaction with the backend application program.
The version of Wafe using the Athena widgets is called wafe, the version using the OSF/Motif Widget set is called mofe. Both versions accepts the same command line arguments. The widget set specific commands of both versions are however different (the names of the widget classes differ, as well as the routines of the programmatic interface to the widgets). The commands which are independet of the widget set are however the same. A documentation of the Wafe commands can be found in the reference guide.
--c character This option simply allows the user to specify the prompt character, which is not used if --n is specified. The default prompt character is "--".
--f filename Run Wafe in file mode . The argument after --f must be the name of a file containing valid Wafe commands. The file will be executed by the tcl source command. Note that in this mode no subprocess is started.
--e command Evaluate given command immediately after startup (can be used together with --p)
--p program Wafe calls program as client process (alternative to link magic below)
--D DBUG option This option can be combined with any mode. It passes the specified option to Fred Fish's DBUG library.
--i Switches to input mode , which means that Wafe reads from stdin (which it normally doesn't) and forwards the commands to the client-application. Be aware that programs using input mode can't be executed in the background! This mode can be combined with both file mode and the two process standard mode.
--v Prints the current version number of Wafe and exits immediately.
--n Turn of the prompt character mechanism. This causes Wafe to regard every message it receives from the application as a Wafe command.
--d Enter direct mode ; this is a special mode, which we use mostly for developing purposes. In direct mode, you can start Wafe itself without a link, just by typing
wafe --d --n
which can be abbreviated as
wafe
in which case Wafe writes additionally a banner message during startup.
--T communication channels This option can be used to specify the file numbers of extra communication channel as a pair wafeSide/clientSide. See wafe.pl for an example usage.
--C application class If this option is specified Wafe will use the provided string as Xt application class.
Example:
ln -s /bin/X11/wafe xmyprog xmyprog
If your local Unix variant does not support symbolic links, a hard link may be used instead of the symbolic link in the example above. Wafe searches all directories in the path for the specified program and spawns the child-process myprog.
The application myprog looses it's standard input and output streams, it's diagnostic output will be merged with Wafe's stderr. Wafe communicates with the application by reading it's stdout and writing to stdin. Commands to Wafe must be prefixed by a so called prompt character, defaulting to "%", otherwise they are just echoed to Wafe's standard output. The prompt character can be changed with the --c command line option. Furthermore, if you want Wafe to accept commands without prompt character, use the --n command line option (This means that the application completely looses its output stream).
For the full set of Wafe commands refer to the Wafe documentation, which is included in the distribution.
The application class is derivated from the --p option or from the link's name by capitalizing the "x" and the first letter of the executable; any dots will be substituted by dashes. This is the name, under which X searches the application's defaults file. So, in our example, the class is XMyprog and the corresponding app-defaults file will be searched. The application instance name is the link's name with any dots substituted by dashes.
Command line arguments are passed to the client provided that they do not begin with the characters "--", which is reserved for Wafe's arguments. Thus the command line
xmyprog -r filename --n -display friendly.host:0
will cause Wafe to spawn the process myprog as follows:
myprog -r filename
The "--n" option is one of Wafe's command line arguments, which are described above. The arguments "-display friendly.host:0" are processed as standard X toolkit options.
#!/usr/bin/X11/wafe --f Command c topLevel label "Wafe new World" callback {echo Goodbye; quit} realize
Assuming your system supports the #! notation, you might invoke the little demo program (after setting it executable) by typing "hello". Otherwise you might issue the command "wafe --f hello".
An example using the OSF/Motif version of Wafe is:
#!/usr/bin/X11/mofe --f XmPushButton c topLevel labelString "Wafe new World" activateCallback {echo Goodbye; quit} realize
Refer to the manual page for wafeapp for documentation how to configure perl written wafe applications using wafe.pl.