[comp.sources.x] v04i039: Xgen - An X-window based applications generator, Part01/03

argv@island.uu.net (Dan Heller) (06/30/89)

Submitted-by: Jim Westervelt <westerve@osiris.cso.uiuc.edu>
Posting-number: Volume 4, Issue 39
Archive-name: xgen/part01

[ This was a lot of fun to play with if nothing else.  The demonstration
  "application" provided uses mostly transient shells, so your window
  manager won't see them.  Don't let this give you the wrong impression
  about this program; you can build much different applications than the
  one provided.  This program needs some work and cleaning up, but it is
  an excellent base for a nifty future application (hint to job-seeking
  grads :-).  --argv ]

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
#		"End of shell archive."
# Contents:  README Imakefile Makefile xgen.man xgen.ms Dynamicshell.h
#   DynamicshellP.h Helpcommand.h HelpcommandP.h application.h
#   application
# Wrapped by argv@island on Thu Jun 29 18:54:22 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(2874 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
XXgen - An X-window based applications generator.  Parses user generated
Xscripts which define an interactive user environment in X-window using
Xpop-up menus, messages, and user input fields.  Information collected from
Xusers can be assembled into UNIX commands.
X
XDeveloped as a Master's project in the Department of Civil Engineering, MIT,
Xby Antoine Awaida.  Funded by the US Army Corps' Construction Engineering
XResearch Laboratory, Champaign, Illinois.
X
XOPERATIONAL STATUS:  Developed and running on SUN-3 machines using X11.3.
XNot tested on any other platforms.  Prototype.  Will occasionally crash
Xif user input is in error.  Shareware.  Comments are welcome.  Please
Xmail to westerve@osiris.cso.uiuc.edu where information will be collected
Xfor possible future upgrades.
X
XDOCUMENTATION:  Internal to this directory see:
X  application:   a sample input file to xgen; run via:   xgen application
X  xgen.ms:       pass throught tbl(1) and troff(1) -ms
X
XA master's thesis was generated for this project, but it is not available 
Xin digital form.  It contains similar information to xgen.doc (above)
Xwith the inclusion of short discussions on 1) X, 2) GRASS (a geographical
Xinformation system), 3) design philosophy, and 4) implementation of the
Xapplication generator concepts.   Probably not very useful to most readers.
XFor a copy, mail westerve@osiris.cso.uiuc.edu.
X
X------------------------------------------------------------------------
XImprovements
X
XFeb 1989 - Jim Westervelt, US Army Corps, CERL
X 1) All input parsing converted from series of unpredictable
X	scanf's to routines in get_strings.c.  This has greatly relaxed
X	the syntax.  e.g. the following would be mis-parsed
X		environment "top level"
X			initialshells:"session"
X	but could be "corrected" to:
X		environment "top level"
X			initialshells:" session "
X	All white space is treated as string delimiters (unless entire string
X	enclosed in double quotes).
X 2) The setlocation and setmapset options have been removed.  Replaced
X	with a setXXXXX option which does UNIX environment setting on any XXXXX
X	string (of any length).
X 3) Fixed buffers have been greatly expanded.
X 4) The updatefrom command has been expanded so that
X	* It can deal with a command line (in addition to directory or file)
X	* It can expand environment variables
X 5) Popen of "ls directory" and "cat filename" has been replaced with
X	opendir and fopen subroutines.
X
XLimitations
X 1) Parsing takes place in two phases.  First an initial read of the
X	application is made; information is stored away in structures.
X	Then, during execution this information is analyzed.   Full analysis
X	of the application should take place before execution.
X 2) Despite the larger fixed buffers, users will likely encounter
X	limitations in the form of overwritten memory and core dumps.
X 3) Some logical testing is required as an integral part of applications.
END_OF_FILE
if test 2874 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'Imakefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Imakefile'\"
else
echo shar: Extracting \"'Imakefile'\" \(1134 characters\)
sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
XLOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
X           SRCS = \
X				Dynamicshell.c \
X				Helpcommand.c \
X				create_cmdboard.c \
X				create_msgboard.c \
X				create_scrollbar.c \
X				create_shell.c \
X				expand_string.c \
X				get_button_args.c \
X				get_label_args.c \
X				get_message_args.c \
X				get_pixel.c \
X				get_shell_args.c \
X				get_string.c \
X				get_env.c \
X				hash_env.c \
X				hash_help.c \
X				hash_shell_address.c \
X				hash_shell_descrip.c \
X				help.c \
X				main.c \
X				parse_applica.c \
X				parse_resources.c \
X				parse_shell.c \
X				spreadsheet.c
X           OBJS = \
X				Dynamicshell.o \
X				Helpcommand.o \
X				create_cmdboard.o \
X				create_msgboard.o \
X				create_scrollbar.o \
X				create_shell.o \
X				expand_string.o \
X				get_button_args.o \
X				get_label_args.o \
X				get_message_args.o \
X				get_pixel.o \
X				get_shell_args.o \
X				get_string.o \
X				get_env.o \
X				hash_env.o \
X				hash_help.o \
X				hash_shell_address.o \
X				hash_shell_descrip.o \
X				help.o \
X				main.o \
X				parse_applica.o \
X				parse_resources.o \
X				parse_shell.o \
X				spreadsheet.o
X
XComplexProgramTarget(xgen)
END_OF_FILE
if test 1134 -ne `wc -c <'Imakefile'`; then
    echo shar: \"'Imakefile'\" unpacked with wrong size!
fi
# end of 'Imakefile'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(8159 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X# Makefile generated by imake - do not edit!
X# $XConsortium: imake.c,v 1.37 88/10/08 20:08:30 jim Exp $
X#
X# The cpp used on this machine replaces all newlines and multiple tabs and
X# spaces in a macro expansion with a single space.  Imake tries to compensate
X# for this, but is not always successful.
X#
X
X###########################################################################
X# X Window System Makefile generated from template file Imake.tmpl
X# $XConsortium: Imake.tmpl,v 1.91 88/10/23 22:37:10 jim Exp $
X#
X# Do not change the body of the imake template file.  Server-specific
X# parameters may be set in the appropriate .macros file; site-specific
X# parameters (but shared by all servers) may be set in site.def.  If you
X# make any changes, you'll need to rebuild the makefiles using
X# "make World" (at best) or "make Makefile; make Makefiles" (at least) in
X# the top level directory.
X#
X# If your C preprocessor doesn't define any unique symbols, you'll need
X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
X# "make Makefile", "make Makefiles", or "make World").
X#
X# If you absolutely can't get imake to work, you'll need to set the
X# variables at the top of each Makefile as well as the dependencies at the
X# bottom (makedepend will do this automatically).
X#
X
X###########################################################################
X# platform-specific configuration parameters - edit Sun.macros to change
X
X# platform:  $XConsortium: Sun.macros,v 1.52 88/10/23 11:00:55 jim Exp $
X# operating system:  SunOS 4.0
X
XBOOTSTRAPCFLAGS =
X             AS = as
X             CC = cc
X            CPP = /lib/cpp
X             LD = ld
X           LINT = lint
X        INSTALL = install
X           TAGS = ctags
X             RM = rm -f
X             MV = mv
X             LN = ln -s
X         RANLIB = ranlib
XRANLIBINSTFLAGS = -t
X             AR = ar clq
X             LS = ls
X       LINTOPTS = -axz
X    LINTLIBFLAG = -C
X           MAKE = make
XSTD_CPP_DEFINES =
X    STD_DEFINES =
X
X###########################################################################
X# site-specific configuration parameters - edit site.def to change
X
X# site:  $XConsortium: site.def,v 1.16 88/10/12 10:30:24 jim Exp $
X
X###########################################################################
X# definitions common to all Makefiles - do not edit
X
X          SHELL = /bin/sh
X
X        DESTDIR =
X      USRLIBDIR = $(DESTDIR)/usr/lib
X         BINDIR = $(DESTDIR)/usr/bin/X11
X         INCDIR = $(DESTDIR)/usr/include/X11
X         ADMDIR = $(DESTDIR)/usr/adm
X         LIBDIR = $(USRLIBDIR)/X11
X     LINTLIBDIR = $(USRLIBDIR)/lint
X        FONTDIR = $(LIBDIR)/fonts
X       XINITDIR = $(LIBDIR)/xinit
X         XDMDIR = $(LIBDIR)/xdm
X         UWMDIR = $(LIBDIR)/uwm
X         AWMDIR = $(LIBDIR)/awm
X         TWMDIR = $(LIBDIR)/twm
X        MANPATH = $(DESTDIR)/usr/man
X  MANSOURCEPATH = $(MANPATH)/man
X         MANDIR = $(MANSOURCEPATH)n
X      LIBMANDIR = $(MANSOURCEPATH)3
X    XAPPLOADDIR = $(LIBDIR)/app-defaults
X
X   INSTBINFLAGS = -m 0755
X   INSTUIDFLAGS = -m 4755
X   INSTLIBFLAGS = -m 0664
X   INSTINCFLAGS = -m 0444
X   INSTMANFLAGS = -m 0444
X   INSTAPPFLAGS = -m 0444
X  INSTKMEMFLAGS = -m 4755
X        FCFLAGS = -t
X    CDEBUGFLAGS = -O -DPURDUE
X
X        PATHSEP = /
X         DEPEND = $(DEPENDSRC)/makedepend
X          IMAKE = $(IMAKESRC)/imake
X            RGB = $(RGBSRC)/rgb
X             FC = $(BDFTOSNFSRC)/bdftosnf
X      MKFONTDIR = $(MKFONTDIRSRC)/mkfontdir
X      MKDIRHIER = $(SCRIPTSSRC)/mkdirhier.sh
X
X         CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(STD_DEFINES) $(DEFINES)
X      LINTFLAGS = $(LINTOPTS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) -DLINT
X        LDFLAGS = $(CDEBUGFLAGS) $(SYS_LIBRARIES) $(SYSAUX_LIBRARIES)
X            TOP = /usr/src/X11/X11R3
X      CLIENTSRC = $(TOP)/clients
X        DEMOSRC = $(TOP)/demos
X         LIBSRC = $(TOP)/lib
X        FONTSRC = $(TOP)/fonts
X     INCLUDESRC = $(TOP)/X11
X      SERVERSRC = $(TOP)/server
X        UTILSRC = $(TOP)/util
X     SCRIPTSSRC = $(UTILSRC)/scripts
X     EXAMPLESRC = $(TOP)/examples
X     CONTRIBSRC = $(TOP)/contrib
X         DOCSRC = $(TOP)/doc
X         RGBSRC = $(TOP)/rgb
X      DEPENDSRC = $(UTILSRC)/makedepend
X       IMAKESRC = $(UTILSRC)/imake
X       IRULESRC = $(UTILSRC)/imake.includes
X        XLIBSRC = $(LIBSRC)/X
X         XMUSRC = $(LIBSRC)/Xmu
X     TOOLKITSRC = $(LIBSRC)/Xt
X     AWIDGETSRC = $(LIBSRC)/Xaw
X     OLDXLIBSRC = $(LIBSRC)/oldX
X    BDFTOSNFSRC = $(FONTSRC)/bdftosnf
X   MKFONTDIRSRC = $(FONTSRC)/mkfontdir
X   EXTENSIONSRC = $(TOP)/extensions
X   EXTENSIONLIB = $(EXTENSIONSRC)/lib/libXext.a
X           XLIB = $(XLIBSRC)/libX11.a
X         XMULIB = $(XMUSRC)/libXmu.a
X        OLDXLIB = $(OLDXLIBSRC)/liboldX.a
X       XTOOLLIB = $(TOOLKITSRC)/libXt.a
X         XAWLIB = $(AWIDGETSRC)/libXaw.a
X       LINTXLIB = $(XLIBSRC)/llib-lX11.ln
X        LINTXMU = $(XMUSRC)/llib-lXmu.ln
X      LINTXTOOL = $(TOOLKITSRC)/llib-lXt.ln
X        LINTXAW = $(AWIDGETSRC)/llib-lXaw.ln
X       INCLUDES = -I$(TOP)
X      MACROFILE = Sun.macros
X   ICONFIGFILES = $(IRULESRC)/Imake.tmpl \
X			$(IRULESRC)/$(MACROFILE) $(IRULESRC)/site.def
X  IMAKE_DEFINES =
X      IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl -I$(NEWTOP)$(IRULESRC) \
X			-s Makefile $(IMAKE_DEFINES)
X         RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \
X			.emacs_* tags TAGS make.log MakeOut
X
X###########################################################################
X# rules:  $XConsortium: Imake.rules,v 1.71 88/10/23 22:46:34 jim Exp $
X
X###########################################################################
X# start of Imakefile
X
XLOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
X           SRCS = \
X				Dynamicshell.c \
X				Helpcommand.c \
X				create_cmdboard.c \
X				create_msgboard.c \
X				create_scrollbar.c \
X				create_shell.c \
X				expand_string.c \
X				get_button_args.c \
X				get_label_args.c \
X				get_message_args.c \
X				get_pixel.c \
X				get_shell_args.c \
X				get_string.c \
X				get_env.c \
X				hash_env.c \
X				hash_help.c \
X				hash_shell_address.c \
X				hash_shell_descrip.c \
X				help.c \
X				main.c \
X				parse_applica.c \
X				parse_resources.c \
X				parse_shell.c \
X				spreadsheet.c
X           OBJS = \
X				Dynamicshell.o \
X				Helpcommand.o \
X				create_cmdboard.o \
X				create_msgboard.o \
X				create_scrollbar.o \
X				create_shell.o \
X				expand_string.o \
X				get_button_args.o \
X				get_label_args.o \
X				get_message_args.o \
X				get_pixel.o \
X				get_shell_args.o \
X				get_string.o \
X				get_env.o \
X				hash_env.o \
X				hash_help.o \
X				hash_shell_address.o \
X				hash_shell_descrip.o \
X				help.o \
X				main.o \
X				parse_applica.o \
X				parse_resources.o \
X				parse_shell.o \
X				spreadsheet.o
X
X PROGRAM = xgen
X
Xall:: xgen
X
Xxgen: $(OBJS)
X	$(RM) $@
X	$(CC) -o $@ $(OBJS) -lXaw -lXmu -lXt -lX $(LDFLAGS) $(SYSLAST_LIBRARIES)
X
Xrelink::
X	$(RM) $(PROGRAM)
X	$(MAKE) $(MFLAGS) $(PROGRAM)
X
Xinstall:: xgen
X	$(INSTALL) -c $(INSTALLFLAGS) xgen $(BINDIR)
X
Xinstall.man:: xgen.man
X	$(INSTALL) -c $(INSTMANFLAGS) xgen.man $(MANDIR)/xgen.n
X
Xdepend:: $(DEPEND)
X
Xdepend::
X	$(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS)
X
X$(DEPEND):
X	@echo "making $@"; \
X	cd $(DEPENDSRC); $(MAKE)
X
Xclean::
X	$(RM) $(PROGRAM)
X
X###########################################################################
X# Imake.tmpl common rules for all Makefiles - do not edit
X
Xemptyrule::
X
Xclean::
X	$(RM_CMD) \#*
X
XMakefile:: $(IMAKE)
X
XMakefile:: Imakefile \
X	$(IRULESRC)/Imake.tmpl \
X	$(IRULESRC)/Imake.rules \
X	$(IRULESRC)/site.def \
X	$(IRULESRC)/$(MACROFILE)
X	-@if [ -f Makefile ]; then \
X	echo "$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X	else exit 0; fi
X	$(IMAKE_CMD) -DTOPDIR=$(TOP)
X
X$(IMAKE):
X	@echo "making $@"; \
X	cd $(IMAKESRC); $(MAKE) BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS)
X
Xtags::
X	$(TAGS) -w *.[ch]
X	$(TAGS) -xw *.[ch] > TAGS
X
X###########################################################################
X# empty rules for directories that do not have SUBDIRS - do not edit
X
Xinstall::
X	@echo "install done"
X
Xinstall.man::
X	@echo "install.man done"
X
XMakefiles::
X
X###########################################################################
X# dependencies generated by makedepend
X
END_OF_FILE
if test 8159 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'xgen.man' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xgen.man'\"
else
echo shar: Extracting \"'xgen.man'\" \(579 characters\)
sed "s/^X//" >'xgen.man' <<'END_OF_FILE'
X.TH XGEN 1 "June 1989" SUN-3/X11R3
X.SH NAME
Xxgen \- X window applications generator
X.SH SYNOPSIS
X.B xgen
X.I script
X.SH DESCRIPTION
X.I Xgen
Xallows UNIX shell programmers access to X-window based menus, messages, and
Xuser input fields. A simple language is used to describe the user interface
Xwhich can be used as a front end to UNIX commands.
X.SH "SEE ALSO"
X.I "Xgen: An X-Window Based Application Generator".
XX(1)
X.SH BUGS
XError messages are not always self-explanatory.  Certain script errors can
Xcrash the program.
X.SH AUTHOR
XAntony Awaida, MIT Department of Civil Engineering
END_OF_FILE
if test 579 -ne `wc -c <'xgen.man'`; then
    echo shar: \"'xgen.man'\" unpacked with wrong size!
fi
# end of 'xgen.man'
fi
if test -f 'xgen.ms' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xgen.ms'\"
else
echo shar: Extracting \"'xgen.ms'\" \(24473 characters\)
sed "s/^X//" >'xgen.ms' <<'END_OF_FILE'
X.TL
XXgen: An X-Window Based Application Generator
X.AU
X.AI
XU.S. Army Corps Construction Engineering Research Laboratory
X.AB
XThis application generator, xgen,  was developed to provide an easy
Xroute toward the simple generation of X-window user interfaces for
Xexisting shell level programs.   A simple language allows a user to
Xdefine a graphically oriented user interface which 1) collects
Xinformation from the user, and 2) 
Xcalls shell level commands using the collected user information.
X
XThis code is an experimental product.  Those responsible for the design,
Xdevelopment, and distribution of the code make no warranties of any kind as
Xto its suitability for any purpose.   It has been developed on SUN-3
Xmachines under X-windows 11.3.  As of this writing it is \*Qshare-ware\*U
Xquality; that is, it will crash sometimes if not run perfectly.
X.AE
X.NH 1
XINTRODUCTION and PURPOSE
X.LP
XXgen provides UNIX shell programmers with access to X-windows capabilities.
XThe strength of UNIX lies in its vast array of commands; Nearly all of these
Xcommands are command line driven.  UNIX itself is a high level programming
Xlanguage.  Its assorted commands can be assembled in shell scripts which 
Xbecome commands themselves to users.  Indeed, many users never know whether the
Xcommand they execute is a shell script or a compiled C or Fortran program.
X.LP
XThe weakness of UNIX lies in its lack of a consistent and simple user
Xinterface that is palpable to the new and occassional user.  (Actually
Xthis is a strength for the experienced user and programmer.)  X-windows
Xis a very serious attempt to remedy this weakness.  It provides the
Xprogrammer to write graphic oriented code for UNIX machines, rather
Xthan for a particular UNIX machine.
X.LP
XX windows provides the C programmer with new graphical opportunities.
XHowever, it does little for the traditional shell programmer.  Those
Xusers who bring application expertise to the UNIX world have generated
Xshell scripts for years.  Xgen gives shell
Xprogrammers access to some of the power of X.
X.LP
XXgen provides a language which
Xdefines X-windows user interfaces. They basically collect information
Xfrom a user and then pass that information on to UNIX programs.
XApplication generator scripts are interpreted at run time.
X.NH 1
XHOW DOES XGEN FIT IN?
X.LP
XThe person familiar with the construction of shell scripts will find this
Xapplication generator the most useful.   For new applications,
Xxgen scripts will be written which interact graphically 
Xwith the user collecting information that was previously read from the
Xkeyboard.  Instead of typing the name of an option, the user will now 
Xmove the cursor to the box showing that option and click a mouse button.
X.LP
XAfter information is collected through graphics defined by the script,
Xprograms (shell scripts of binary executables) are called to check
Xand/or run-with the user entered information.  Program output can go to
Xan xterm window or can be displayed using the application generator.
X.NH 1
XOVERALL STRUCTURE
X.LP
XThe xgen user writes scripts with standard text editors which are interpreted
Xby xgen at run-time.
XThe script consists of one or more \fBenvironments\fR each of which
Xcontain one or more user interface shells.  Each \fBshell\fR is
Xassociated with a single X-windows graphical interface window.  Each
Xshell is composed of \fBobjects\fR whose appearances are defined by
X\fBaspects\fR and whose actions are defined by \fBprocedures.\fR.
X
X.LP
XENVIRONMENTS contain a set of SHELLS contained in curly braces \*Q{}\*U.
X.RS
X.LP
XSHELLS create user interface windows.  Contents and actions of those
XSHELLS are defined by OBJECTS contained in parentheses \*Q()\*U.
X.RS
X.LP
XOBJECT presentation is defined by ASPECTS and PROCEDURES
X.RE
X.RE
X.LP
XThe format is free; that is, spaces, tabs, and new-lines are all considered
Xequivalent.   The format here is structured for readability.
XAll text on a line beginning with a # character are ignored.
X
XEnvironments, shells, and objects are organized in this manner:
X
X.RS
XENVIRONMENT
X.RS
X(environment options)
X.RE
X{
X.RS
XSHELL-1
X.RS
X(shell options)
X.RE
X(
X.RS
XOBJECT-1
X.RS
X(object options)
X.br
X;
X.RE
XOBJECT-2
X.RS
X(object options)
X.br
X;
X.RE
Xetc.
X.RE
X)
X.br
X(more shells)
X.RE
X}
X.br
X(more environments)
X.RE
X
X.LP
XAll options are 
Xdefined by using a keyword followed by a colon followed by a string 
Xto be attached to that keyword.   For example:
X.DS
Xxxx:yyy
Xxxx:"yyy zzz"
X.DE
XIn the first example option \fBxxx\fR is defined to be string \fIyyy\fR. In
Xthe second it is defined to be \fIyyy zzz\fR.  Environments, shells, and
Xobjects all have options.
X
X.NH 1
XLEARNING XGEN
X.LP
XYou have now read enough to put down this document and give it a try.
XXgen provides a programming language.  All languages are best learned by
Xunderstanding examples.  The appendix to this paper contains a sample
Xapplication.  It was written to be fairly obvious to run without instruction.
XThis application script is found in the source directory for xgen.  Assuming
Xthat you are familar with the operation of X windows, have X running and are
Xworking inside an xterm window, xgen can
Xbe started from there with the command:
X.DS
Xxgen application
X.DE
XRun this application to become familiar with what xgen can do.  Then,
Xrun the application while inspecting a printout of the application.  There
Xis enough verbosity in the xgen language and in the application example to make
Xit fairly easy to follow the language.
X.LP
XWhat doesn't make sense intuitively is explained in this document which you 
Xwill then be obligated to read.
X
X.NH 1
XENVIRONMENTS
X.LP
XEnvironments are defined in the script using the keyword \fBenvironment\fR
Xfollowed by a unique name for the environment.  Names can be composed of
Xseveral words; however, if there is more than one word, the entire string
Xmust be enclosed in double quotes.  To make something happen upon calling
Xan environment, an \fBinitialshell\fR or two must be specified.  All
X\fBshells\fR associated with the environment are then specified inside a pair
Xof curley braces: \fB{ and }\fR.
X.LP
XOne environment MUST be named \fB"top level"\fR.  The beginning of an
Xapplications generator script might look like this:
X
X.RS
Xenvironment "top level"   
X.RS
X	initialshells:session
X.RE
X{
X.br
X}
X.RE
X
XThis defines environment \fB"top level"\fR which is to start up a shell called
X\fBsession\fR.  This is an incomplete script of course, partly because the
Xshell \fBsession\fR has been called, but not defined.
X.LP
XNote the \fBxxx:yyy\fR syntax.  The name on the left (\fBinitialshells\fR
Xabove) is a keyword variable which is set to the name on the right
X(\fBsession\fR above).   This syntax is very common in the applications
Xgenerator.
X.LP
XEnvironments call each other.
XUpon calling, the shells associated with the calling environment
Xdisappear and the called environment starts up.  Also, environments can call
Xshells that are defined in other environments.
X.NH 1
XSHELLS
X.LP
XEnvironments contain three types of shells:
X.TS
Xallbox, center;
Xll.
XSHELL	EXPLANATION                                             
Xmsgboard	T{
X\fBMessage-board\fR. User menu items are arranged horizontally.
XMultiline messages are available.
XT}
Xmenu	T{
XLists of options are presented vertically, sometimes with a scrollbar.
XT}
Xcmdboard	T{
X\fBCommand-board\fR. Allows entry of information by user used to call programs.
XT}
X.TE
X
XEach shell in a script must have a unique name.   Shells have the following
Xcharacteristics which can be programmer selected using the \fBxxx:yyy\fR
Xsyntax.
X
X.TS
Xbox, center;
Xl|l|l.
XShell Option	Default	Description
X_
Xheight	computed	height of shell
Xwidth	computed	width of shell
Xmaxheight	none	max permissible height
Xmaxwidth	none	max permissible width
Xoverride	off	should window manager be overridden
Xupdatefrom	none	file, directory, or command used for list
X		syntax for file or directory:
X			updatefrom:name
X		syntax for program:
X			updatefrom:!program
Xx	0	x position of top left corner
Xy	0	y position of top left corner
X.TE
X
XFor example, this example defines a \fBmsgboard\fR shell called \fIsession\fR.
X
X.RS
Xmsgboard session x:10 y:10 override:on
X.br
X(
X.br
X)
X.RE
X
XIts top-left corner is to be placed 10 pixles down from the top of the screen
Xand 10 pixles to the right of the left edge of the screen.  The window manager,
Xe.g. uwm, is asked to override its normal mode of prompting the user for the 
Xnew window's screen position.  
X.LP
XShells are defined by a series of interface objects which appear between a set
Xof parentheses.
X
X.NH 1
XINTERFACE OBJECTS
X.LP
XEach shell is defined by a series of objects.  The buttons are of type:
X.TS
Xbox, center;
Xc|css|c
Xl|c|c|c|l.
XOBJECTS	SHELL TYPES	DEFINITION
X_
X	menu	msgboard	cmdboard
X_
Xlabel	allowed	allowed	allowed	A simple label of one or more words.
X_
Xmessage		allowed		T{
XA multi-line message or statement.  If the keyword \fBhelp\fR is used, then
Xthe text in a special help buffer is displayed.  This buffer is filled with
Xtext using the aspect command \fBhelp\fR described below.  Similarly, the
Xkeyword \fBerror\fR is used to use the contents of the error buffer.  This
Xbuffer is filled with the output (stdout) of a command that was run and exited
Xwith a non-zero status.
XT}
X_
Xbutton	allowed	allowed	allowed	T{
XAn object whose associated procedures can be activited by pressing any mouse
Xbutton while the cursor is in the object.  The argument becomes a label for the
Xbutton object.
XT}
X_
Xtextspace		allowed	allowed	T{
XA place for the user to enter text.  The argument becomes a label for the
Xobject.  It is also used as a keyword in the procedure \fBcommandarg\fR to
Xaccess the string the user enters.
XT}
X_
Xscrolltextspace			allowed	T{
XA multi-column \*Qspreadsheet like\*U space for receiving user input.
XT}
X.TE
X
X.LP
XAs an example, our message-board called \fIsession\fR above may be
Xfleshed out with the following objects:
X
X.RS
Xmsgboard session x:10 y:10 override:on
X.br
X(
X.RS
Xlabel "X Application Generator Demonstration"
X.RS
X;
X.RE
Xbutton "Select Me to QUIT"
X.RS
Xexit:0 ;
X.RE
X.RE
X)
X.RE
X
X.LP
XThe msgboard \fBshell\fR called \fIsession\fR is defined here to have two
Xobjects; 1) a \fBlabel\fR, and 2) a \fBbutton\fR.   An action associated
Xwith the button is the \fBexit\fR procedure.   Note that each object takes
Xthe form:
X
X.DS
X1) Object name
X2) One or more characteristics and/or actions
X3) A \*Q;\*U character.
X.DE
X
XNote that the indentations are for readability only.  For example, note 
Xwhere the terminating \*Q;\*U is for each object.
X
X.NH 1
XSIMPLE XGEN SCRIPT
X.LP
XWe have almost presented enough to generate a first complete xgen script.
XThe only pieces missing come from the requirement that every script must define
Xa \fBmsgboard\fR for the reserved names \fBerror\fR and \fBhelp\fR.  Combining
Xsimple msgboards that meet this requirement with script parts already presented
Xyields:
X
X.RS
Xenvironment "top level"   
X.RS
Xinitialshells:session
X.RE
X{
X.RS
Xmsgboard session x:10 y:10 override:on
X.br
X(
X.RS
Xlabel "X Application Generator Demonstration"
X.RS
X;
X.RE
Xbutton "Select Me to QUIT"
X.RS
Xhelp:"Move the cursor over me and hit any mouse button to quit"
X.br
Xexit:0 ;
X.RE
X.RE
X)
X.br
Xmsgboard help x:10 y:200 override:on
X.br
X(
X.RS
Xlabel Help
X.RS
X;
X.RE
Xmessage help
X.RS
X;
X.RE
Xbutton "RETURN"
X.RS
Xpopdown:help ;
X.RE
X.RE
X)
X.br
Xmsgboard error x:10 y:200 override:on
X.br
X(
X.RS
Xlabel Error
X.RS
X;
X.RE
Xmessage error
X.RS
X;
X.RE
Xbutton "RETURN"
Xpopdown:error ;
X.RE
X)
X.RE
X}
X.RE
X.LP
XLet's piece through this script.  First, there is a single environment.  It is
Xthe environment that is started first because it is name with the key name 
X\fBtop level\fR.  A script without an environment having this name will do
Xnothing.  This environment states that the initial shell started has the name
X\fIsession\fR.  Second, the environment defines three shells, all of which
Xare \fBmsgboard\fR shells.  Their names are \fIsession, help,\fR and
X\fIerror\fR.
X.LP
XThe shells called \fIerror\fR and \fIhelp\fR MUST exist somewhere in any
Xscript. It is appropriate for each to carry an appropriate label and a button
Xfor exiting the shell.  The \fIhelp\fR msgboard displays a message using the
X\fBmessage\fR object.  At first reading you might expect that the message
Xdisplayed is simply \*Qhelp\*U. The word help here has a special meaning.  It
Xtells the message object to read its message from an internal message buffer.
XIf the user places the mouse in the button entitled \*QSelect Me to QUIT\*U,
Xholds the shift key down, and presses any mouse button, the help buffer
Xwill be filled with the help message specified for that button, and
Xthe \fIhelp\fB msgboard will be called.
X.LP
XWhat does this user interface look like?  Something more pleasing than this:
XWhat happens when the user positions the cursor over the QUIT button and
Xpresses any mouse key?
X
X.NH 1
XASPECTS AND PROCEDURES ASSOCIATED WITH OBJECTS
X.LP
XNumerous object characteristics and procedures are available to define or
Xrefine each object. These are organized into the following table.  Most
Xobject names are self-explanatory.  Explanations for all follow the table.
X.TS
Xbox, center;
Xc|csssss
Xc|c|c|c|c|c|c
Xc|c|c|c|c|c|c
Xl|c|c|c|c|c|c.
XASPECTS	OBJECTS
X	button	button	label	message	textspace	scroll-
X		(cmdboard)				textspace
X_
Xbordercolor	black	black	black	black	---	black
Xborderwidth	1	1	1	1	---	1
Xbackground	white	white	white	white	---	---	
Xforeground	black	black	black	black	---	---	
Xheight	text	text	text	none	---	---	
Xwidth	text	text	text	none	---	---	
Xfont	fixed	fixed	fixed	fixed	---	---	
Xhighlight	2	2	---	---	---	---	
Xlabelborderwidth	---	---	---	---	1	---	
Xlabelbackground	---	---	---	---	white	white
Xlabelforeground	---	---	---	---	black	black
Xlabelheight	---	---	---	---	text	---	
Xlabelwidth	---	---	---	---	text	---	
Xlabelfont	---	---	---	---	fixed	fixed
Xtextborderwidth	---	---	---	---	1	---	
Xtextbackground	---	---	---	---	white	white
Xtextforeground	---	---	---	---	black	black
Xtextheight	---	---	---	---	text	---	
Xtextwidth	---	---	---	---	text	---	
Xtextfont	---	---	---	---	fixed	fixed
Xscrollbackground	---	---	---	---	---	white
Xscrollforeground	---	---	---	---	---	black
Xscrollheight	---	---	---	---	---	none
Xscrollfont	---	---	---	---	---	fixed
Xcolumns	---	---	---	---	---	none
X.T&
Xc|c|c|c|c|c|c
Xl|c|c|c|c|c|c.
X_
XPROCEDURE:
X_
Xdestroy	none	none	---	---	---	---	
Xgetenv	none	none	---	---	---	---	
Xhelp	none	none	---	---	none	none
Xpopdown	none	none	---	---	---	---	
Xpopup	none	none	---	---	---	---	
Xstore	none	none	---	---	---	---	
XsetXXXXXX	none	none	---	---	---	---	
Xrunforeground	none	none	---	---	---	---	
Xrunbackground	none	none	---	---	---	---	
Xcommandarg	---	none	---	---	---	---	
Xclearcmdboard	---	none	---	---	---	---	
X.TE
X
XThe aspects are simpler than they first appear.  They are simply different
Xtypes of background and foreground color, height and widths, and fonts with
Xa border width and color thrown in.  Defining each individually:
X
X.IP "bordercolor -"
XThe color of the border of the window. The default is always black.
XExample:
X.DS
Xbordercolor:red
X.DE
XUsed for buttons, messages, and labels.
X.IP "borderwidth -"
XThe width of the border stripe in pixles.  The default is 1. Example:
X.DS
Xborderwidth:4.
X.DE
XUsed for buttons, messages, and labels.
X.IP "background -"
XThe background color of the object.  Default is white.  Example:
X.DS
Xbackground:thistle
X.DE
XUsed for buttons, messages, and labels.
X.IP "foreground -"
XThe foreground color of the object.  Default is black.  Example:
X.DS
Xforeground:red
X.DE
XUsed for buttons, messages, and labels.
X.IP "height -"
XThe height of the object.  By default a height is set to accommodate the font.
XIt is unusual for a height to be specified.  Units are in screen pixles.
XExample:
X.DS
Xheight:20
X.DE
XUsed for buttons, messages, and labels.
X.IP "width -"
XThe width of the object.  By default a width is set to accommodate the text
Xlength in the given font.
XIt is unusual for a width to be specified.  Units are in screen pixles.
XExample:
X.DS
Xwidth:200
X.DE
XUsed for buttons, messages, and labels.
X.IP "font -"
XThe font defaults to \*Qfixed\*U, though any font listed by the xlsfonts
Xprogram can be specified.  Example
X.DS
Xfont:8x15
X.DE
XUsed for buttons, messages, and labels.
X.IP "highlight -"
XButtons are selectable by the user.   The interactive indication of this is
Xthat the border of the button is highlighted using the color specified by
X\fBbordercolor\fR.  The default width of the border is 2 pixles.  If a
X\fBhighlight\fR value is given which is greater than half the height of the
Xbutton object, the \fBbackground\fR and \fBforeground\fR colors are reversed
Xwhen the cursor enters the button.  Example:
X.DS
Xhighlight:400
X.DE
XUsed for buttons only.
X.LP
XThe aspects given above are consistent for buttons, labels, and messages.  In
Xeach case there is a single box in which text is placed.  The \fBtextspace\fR
Xand \fBscrolltextspace\fR objects provide two and three separate spaces
Xrespectively.  Each of these spaces is defined with separate background,
Xforeground, height, width, and font characteristics:
X
X.IP "labelborderwidth -"
XSets width of border for programmer provided labels for textspace and
Xscrolltextspace objects. Defaults to 1.
X.IP "labelbackground -"
XSets background color for programmer provided labels for textspace and
Xscrolltextspace objects. Defaults to white.
X.IP "labelforeground -"
XSets foreground color for programmer provided labels for textspace and
Xscrolltextspace objects. Defaults to black.
X.IP "labelheight -"
XSets label height for programmer provided labels for textspace and
Xscrolltextspace objects. Defaults to accommodate text.
X.IP "labelwidth -"
XSets label width for programmer provided labels for textspace and
Xscrolltextspace objects. Defaults to accommodate text.
X.IP "labelfont -"
XSets label font for programmer provided labels for textspace and
Xscrolltextspace objects. Defaults to \*Qfixed\*U.
X.IP "textborderwidth -"
XSets the border width for user input boxes in textspace and
Xscrolltextspace objects. Defaults to 1 pixle.
X.IP "textbackground -"
XSets the background color for user input boxes in textspace and
Xscrolltextspace objects.
XDefaults to white.
X.IP "textforeground -"
XSets the foreground color for user input boxes in textspace and
Xscrolltextspace objects. Defaults to black.
X.IP "textheight -"
XSets the height for user input boxes in textspace and
Xscrolltextspace objects. Defaults to accommodate text.
X.IP "textwidth -"
XSets the width for user input boxes in textspace and
Xscrolltextspace objects. Defaults to accommodate text.
X.IP "textfont -"
XSets the font for user input boxes in textspace and
Xscrolltextspace objects. Defaults to \*Qfixed\*U.
X.IP "scrollbackground -"
XSets the background color for saved user text in scrolltextspace objects.
XDefaults to white.
X.IP "scrollforeground -"
XSets the foreground color for saved user text in scrolltextspace objects.
XDefaults to black.
X.IP "scrollheight -"
XSets the height for saved user text in scrolltextspace objects.
XNo default.
X.IP "scrollfont -"
XSets the width for saved user text in scrolltextspace objects. Defaults to
X\*Qfixed\*U.
X.IP "columns -"
XThis is used to provide column headings and width. See example:
X.DS
Xcolumns:"Easting:12 Northing:12"
X.DE
XThis specifies that in a \fBscrolltextspace\fR object there will be
Xtwo columns.  Their headings will be \*QEasting\*U and \*QNorthing\*U.
Xeach will accommodate 12 characters.  The headings are also key words used by
Xthe procedure \fBcommandarg\fR.
X.LP
XButtons found in any shell can cause the following procedures to take place.
X.IP "popup -"
XA this causes the specified shell to appear on the screen.  Other than the
Xappearance of the new shell, no other modifications are made to the screen.
XExample:
X.DS
Xpopup:new_shell
X.DE
XIf the shell has never been popped up, the shell description is parsed and
Xmemory is allocated to preserve information about the shell.
X.IP "popdown -"
XThe specified shell is removed from the screen.
XExample:
X.DS
Xpopdown:new_shell
X.DE
X.IP "destroy -"
XLike \fBpopdown\fR except that all memory allocated for that shell is
Xdestroyed.  If the shell is popped up again it will be created as if it
Xwere being popped up for the first time.
X.DS
Xdestroy:new_shell
X.DE
X.IP "help -"
XThe shell \fBhelp\fR, which must be defined in every xgen script is called with
Xthe message specified.
XExample:
X.DS
Xhelp:"This is a help message"
X.DE
X.IP "getenv -"
XThe current environment and all of its associated shells are removed
Xfrom the screen.  The specified environment is called.
XExample:
X.DS
Xgetenv:"new environment"
X.DE
X.IP "store -"
XStore the specified string into the X server cut buffer.  This can be retrieved
Xusing the mouse's middle button.
XExample:
X.DS
Xstore:"this string"
X.DE
X.IP "setXXXXXX -"
XSet a UNIX environment variable, XXXXXX.  Example:
X.DS
XsetVARIABLE:"a string"
X.DE
X.IP "runforeground -"
XRun the specified program in the foreground.  In a \fBmsgboard\fR or \fBmenu\fR
Xthe command is run as stated with environment variables expanded.  In a
X\fBcmdboard\fR the command is appended with information provided by the
Xarguments to \fBcommandarg\fR.
XExample:
X.DS
Xrunforeground:"ls -l $HOME > /dev/tty"
X.DE
XXgen waits for the process to finish before continuing.  The commands are fed
Xthrough the UNIX Bourne shell, sh(1).  If the process exits with other than a
Xzero (0) exit status, the stdout is presummed to be an error message and the
Xshell \fBerror\fR, which must be defined in any script is called with that
Xmessage.
X
XNote: see \fBcommandarg\fR below for how \fBrunforeground\fR and
X\fBrunbackground\fR work inside a \fBcmdboard\fR.
X.IP "runbackground -"
XLike \fBrunforeground\fR except the process is run in background.  The exit
Xstatus is not checked and all stdout is directed to the xterm window in which
Xxgen was started.
X.LP
XThe following procedures are available for buttons operated inside
X\fBcmdboards\fR.
X.IP "commandarg -"
XThis specifies the arguments to be used when calling a program using
X\fBrunforeground\fR, or \fBrunbackground\fR.  It can also provide
Xuser defaults to \fBtextspace\fR objects.  Evaluate this example:
X.RS
Xcommandarg:
X.DS
X"input=[Input(input)] \\
Xoutput=[Output(output)] \\
Xcoor=[Easting],[Northing]"
X.DE
X.RE
X\fIInput\fR must be a label attached to a \fBtextspace\fR.  That textspace is
Xbeing told to use the string \fIinput\fR as the user default.  Similarly,
Xa textspace called \fIOutput\fR is to use \fIoutput\fR as the user default.
X\fIEasting\fR and \fINorthing\fR could each refer to a \fBtextspace\fR.  Since
Xthey do not provide user default strings, they could refer to columns in
Xa \fBscrolltextspace\fR. (See the example for the aspect \fBcolumns\fR above.)
X
XAssume that these do specify columns in a \fBscrolltextspace\fR.  If the
Xobject containing this definition for \fBcommandarg\fR calls a command using
X\fBrunforeground\fR, or \fBrunbackground\fR, the command specified will
Xbe appended with something like this:
X.DS
Xinput=input output=output coor=1,2 coor=3,4
X.DE
XThis would be true if the user did not change the defaults for the fields in
Xthe \fBtextspace\fR \fIInput\fR and \fIOutput\fR and if the user entered the
Xcoordinates 1,2 and 3,4 in a \fBscrolltextspace\R defined thus:
X.RS
Xscrolltextspace:Coordinates
X.RS
Xcolumns:"Easting:12 Northing:12"
X.RE
X.RE
XSee the sample application for an example of all this.
X.IP "clearcmdboard -"
XThis clears any \fBscrolltextspace\fR fields associated with a \fBcmdboard\fR
Xshell.  It also resets all \fBtextspace\fR fields to any default specified by
Xa \fBcommandarg\fR procedure in that shell.
X.NH 1
XCOLORS
X.LP
XXgen works in color mode and in black/white on the SUN 3 machines.  Colors
Xthat look good in color mode may not render visible text in black and white.
XIf the black and white mode is to be used, programmers should take care to
Xchoose foreground and background colors that contrast significantly in
Xintensity.
X.LP
XColors can be specified in at least two ways.  First, colors known by your
XX configuration (you may have an X client called \fIxcolors\fR that can help)
Xcan be specified by name.  Secondly, colors can be specified in hexidecimal
Xformat.  For example,
X.DS
Xforeground:#000000
Xbackground:#FFFFFF
X.DE
Xsets the foreground color to black and the background color to white.  The
X\*Q#\*U sign identifies the string as a hex representation of color.  The first
Xtwo numbers following specify the red intensity, the second two green, and the
Xlast two blue.  Some examples:
X.TS
Xcenter, box;
Xc c
Xc l.
XHex Code	Color
X_
X#000000	black
X#FFFFFF	white
X#FF0000	red
X#00FF00	green
X#0000FF	blue
X#A0A0A0	grey
X#A0A0FF	light blue
X#FFA0A0	pink
X#FFFFA0	light yellow
X.TS
END_OF_FILE
if test 24473 -ne `wc -c <'xgen.ms'`; then
    echo shar: \"'xgen.ms'\" unpacked with wrong size!
fi
# end of 'xgen.ms'
fi
if test -f 'Dynamicshell.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Dynamicshell.h'\"
else
echo shar: Extracting \"'Dynamicshell.h'\" \(306 characters\)
sed "s/^X//" >'Dynamicshell.h' <<'END_OF_FILE'
X#ifndef _XtDynamicshell.h
X#define _XtDynamicshell.h
X
X#include <X11/Shell.h>
X
X
X#define XtNupdateFrom      "updateFrom"
X
Xextern WidgetClass dynamicshellWidgetClass;
X
Xtypedef struct _DynamicshellClassRec *DynamicshellWidgetClass;
Xtypedef struct _DynamicshellRec *DynamicshellWidget;
X
X#endif _XtDynamicshell.h
END_OF_FILE
if test 306 -ne `wc -c <'Dynamicshell.h'`; then
    echo shar: \"'Dynamicshell.h'\" unpacked with wrong size!
fi
# end of 'Dynamicshell.h'
fi
if test -f 'DynamicshellP.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'DynamicshellP.h'\"
else
echo shar: Extracting \"'DynamicshellP.h'\" \(942 characters\)
sed "s/^X//" >'DynamicshellP.h' <<'END_OF_FILE'
X#ifndef _XtDynamicshellP_h
X#define _XtDynamicshellP_h
X
X#include <X11/ShellP.h>
X#include <X11/Shell.h>
X#include "Dynamicshell.h"
X
Xtypedef struct _DynamicshellClass
X  {
X    int makecompilerhappy;
X  } DynamicshellClassPart;
X
Xtypedef struct _DynamicshellClassRec {
XCoreClassPart     core_class;
XCompositeClassPart composite_class;
XShellClassPart  shell_class;
XWMShellClassPart wm_shell_class;
XVendorShellClassPart vendor_shell_class;
XTransientShellClassPart transient_shell_class;
XDynamicshellClassPart dynamic_shell_class;
X} DynamicshellClassRec;
X
Xextern DynamicshellClassRec dynamicshellClassRec;
X
Xtypedef struct {
X  char *update_from;
X}  DynamicShellPart;
X
Xtypedef struct _DynamicshellRec {
X  CorePart           core;
X  CompositePart      composite;
X  ShellPart          shell;
X  WMShellPart        wm;
X  VendorShellPart    vendor;
X  TransientShellPart transient;
X  DynamicShellPart   dynamic;
X} DynamicshellRec;
X
X#endif _XtDynamicshellP_h
X
X
X
END_OF_FILE
if test 942 -ne `wc -c <'DynamicshellP.h'`; then
    echo shar: \"'DynamicshellP.h'\" unpacked with wrong size!
fi
# end of 'DynamicshellP.h'
fi
if test -f 'Helpcommand.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Helpcommand.h'\"
else
echo shar: Extracting \"'Helpcommand.h'\" \(673 characters\)
sed "s/^X//" >'Helpcommand.h' <<'END_OF_FILE'
X#ifndef _XtHelpcommand.h
X#define _XtHelpcommand.h
X
X#include <X11/Label.h>
X#include <X11/Command.h>
X
X#define XtNhelp           "help"
X#define XtNhelpCallback   "helpCallback"
X#define XtNfreePointer1   "freePointer1"
X#define XtNfreePointer2   "freePointer2"
X
X#define XtCHelp           "Help"
X#define XtCHelpCallback   "HelpCallback"
X#define XtCFreePointer    "FreePointer"
X
X#define XtRHelp           "Help"
X#define XtRHelpCallback   "HelpCallback"
X#define XtRFreePointer    "FreePointer"
X
Xextern WidgetClass helpcommandWidgetClass;
X
Xtypedef struct _HelpcommandClassRec *HelpcommandWidgetClass;
Xtypedef struct _HelpcommandRec      *HelpcommandWidget;
X
X#endif _XtHelpcommand.h
END_OF_FILE
if test 673 -ne `wc -c <'Helpcommand.h'`; then
    echo shar: \"'Helpcommand.h'\" unpacked with wrong size!
fi
# end of 'Helpcommand.h'
fi
if test -f 'HelpcommandP.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'HelpcommandP.h'\"
else
echo shar: Extracting \"'HelpcommandP.h'\" \(896 characters\)
sed "s/^X//" >'HelpcommandP.h' <<'END_OF_FILE'
X#ifndef _XtHelpcommandP_h
X#define _XtHelpcommandP_h
X
X#include <X11/Command.h>
X#include <X11/LabelP.h>
X#include <X11/CommandP.h>
X#include "Helpcommand.h"
X
Xtypedef struct _HelpcommandClass
X  {
X    int makecompilerhappy;
X  } HelpcommandClassPart;
X
Xtypedef  struct _HelpcommandClassRec {
X  CoreClassPart        core_class;
X  SimpleClassPart     simple_class;
X  LabelClassPart      label_class;
X  CommandClassPart    command_class;
X  HelpcommandClassPart helpcommand_class;
X}  HelpcommandClassRec;
X
Xextern  HelpcommandClassRec  helpcommandClassRec;
X
Xtypedef struct {
X  char *help_string;
X  XtCallbackList help_callbacks;
X  caddr_t freepointer1;
X} HelpcommandPart;
X
Xtypedef  struct _HelpcommandRec {
X      CorePart        core;
X      SimplePart      simple;
X      LabelPart       label;
X      CommandPart     command;
X      HelpcommandPart helpcommand;
X}  HelpcommandRec;
X
X#endif _XtHelpcommandP_h
X
X
X
X
END_OF_FILE
if test 896 -ne `wc -c <'HelpcommandP.h'`; then
    echo shar: \"'HelpcommandP.h'\" unpacked with wrong size!
fi
# end of 'HelpcommandP.h'
fi
if test -f 'application.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'application.h'\"
else
echo shar: Extracting \"'application.h'\" \(1552 characters\)
sed "s/^X//" >'application.h' <<'END_OF_FILE'
X#include <X11/Xlib.h>
X#include <X11/Intrinsic.h>
X
X#define STR_LEN	1024
X
X#define STATIC_SHELL 0
X#define DYNAMIC_SHELL  1
X#define HELP_SHELL 2
X
X#define STATIC_CREATE 0
X#define DYNAMIC_CREATE 1
X
X#define HELP_MSG 0
X#define DIALOG_MSG 1
X#define DIALOG_INPUT 2
X
X#define COMMAND 0
X#define OPTION 1
X#define DELETE 2
X#define STUFF 3
X
X#define TEXTSPACE 1
X#define TEXTSCROLLSPACE 2
X
Xstruct resource {
X	char name[STR_LEN];
X	char *value;
X	struct resource *next;
X};
X
Xstruct widget {
X	char type[STR_LEN];
X	struct resource *resources;
X	struct widget *next_widget;
X};
X
Xstruct shell {
X	char type[STR_LEN];
X	char name[STR_LEN];
X	struct widget *child;
X	struct resource *resources;
X};
X
Xstruct  env_shell {
X	char name[STR_LEN];
X	struct env_shell *next;
X};
X
X
Xstruct _env {
X	char *name;
X	struct env_shell  *initial_shells;
X};
X
Xstruct _widget_help {
X	Widget widget_ptr;
X	char *help_msg;
X};
X
Xstruct _shell_state {
X	int flag;
X	caddr_t shell_ptr;
X};
X
Xstruct _shell_address {
X	Widget widget_ptr;
X	char *name;
X};
X
Xstruct _grouped_arg {
X	XrmQuark name_quark;
X	char *value;
X	char *tag_string;
X	char *default_string;
X	struct _grouped_arg *next;
X};
X
Xstruct _rec_cmd_line_arg {
X	XrmQuark name_quark;
X	struct _grouped_arg *grouped_arg;
X	struct _cmd_line_arg *next;
X	char *tag_string;
X	Widget text_widget;
X	Widget input_text_widget;
X	int num_columns;
X	char *scroll_string;
X	int scrolltext_width;
X};
X
Xstruct _cmd_line_arg {
X	XrmQuark name_quark;
X	struct _grouped_arg *grouped_arg;
X	struct _cmd_line_arg *next;
X	char *tag_string;
X	Widget text_widget;
X	char *default_string;
X	char *value;
X};
END_OF_FILE
if test 1552 -ne `wc -c <'application.h'`; then
    echo shar: \"'application.h'\" unpacked with wrong size!
fi
# end of 'application.h'
fi
if test -f 'application' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'application'\"
else
echo shar: Extracting \"'application'\" \(8149 characters\)
sed "s/^X//" >'application' <<'END_OF_FILE'
X#########################################################################
X#  Sample xgen script
X#########################################################################
X#
X# A organizational overview of this script. Note the following minimal
X# xgen script requirements:
X#    1) An environment called "top level"
X#    2) A "help" and an "error" msgboard.
X#
X#	environment "top level"   
X#		initialshells:session
X#	{
X#		msgboard session
X#				( options )
X#		msgboard help
X#				( options )
X#		msgboard error
X#				( options )
X#	}
X#	environment "button_opts"
X#		initialshells: button_menu
X#	{
X#		menu button_menu
X#				( options )
X#		menu float_menu
X#				( options )
X#		cmdboard get_text
X#				( options )
X#		msgboard get_text_help
X#				( options )
X#		menu get_item
X#				( options )
X#		msgboard explain_table
X#				( options )
X#		cmdboard get_table
X#				( options )
X#	}
X#
X
Xenvironment "top level"   
X	initialshells:session
X{
X	msgboard session x:10 y:10 override:on
X	(
X		label "X Application Generator Demonstration"
X			font:9x15 ;
X
X		message "Experimental Product of USA-CERL. \
X			To select an option, position cursor over the \
X			option and press any mouse button. \
X			To get help, position cursor over item, and while holding \
X			the shift and control keys down, press any mouse button."
X			background:thistle
X			maxwidth:500
X			font:8x13 ;
X
X		button "Select Me for Sample Options"
X			background:#D0FFD0 foreground:#005000 highlight:100
X			font:8x13
X			help:"Selecting this option will place you in a menu \
X				that demonstrates scrollable menus and user text input"
X			getenv:button_opts ;
X		
X		button "Select Me to QUIT"
X			background:#FFA0A0 foreground:#000000
X			font:8x13
X			highlight:100
X			help:"Selecting this exits the application"
X			exit:0 ;
X	)
X
X	msgboard help x:10 y:200 override:on
X	(
X		label "Help for Application Generator"
X			font:9x15
X			background:#D0D0FF foreground:#000090 ;
X
X		message "help"
X			maxwidth:400 borderwidth:4
X			font:8x13
X			background:#D0D0FF foreground:#000090 ;
X
X		button "RETURN"
X			background:#FFA0A0 foreground:#000000
X			font:8x13
X			popdown:help ;
X	)
X
X	msgboard error x:200 y:10 override:on
X	(
X		label "ERROR"
X			font:9x15
X			background:#FFFF90 foreground:#000000 ;
X
X		message "error"
X			maxwidth:400 borderwidth:4
X			font:8x13
X			background:#FF9090 foreground:#000000 ;
X
X		button "RETURN"
X			foreground:thistle
X			font:8x13
X			popdown:error ;
X	)
X}
X
Xenvironment "button_opts"
X	initialshells: button_menu
X{
X	menu button_menu x:10 y:10 override:on
X	(
X		label "User Input Options"
X			font:9x15
X			background:#D0D0FF foreground:#000090 ;
X
X		button "Floating menu (use mouse to place)"
X			font:8x13
X			help:"Your currently running window manager will be used to \
X				place the window"
X			popup: float_menu ;
X
X		button "Get simple user input"
X			font:8x13
X			help:"This shows an example of how single strings may be entered \
X				by the user"
X			popup: get_text_help
X			popup: get_text ;
X
X		button "Get more user input (for commands)"
X			font:8x13
X			help:"This shows an example of how tabular text may be entered by \
X				the user"
X			popup: explain_table
X			popup: get_table ;
X
X		button "Select item from list (floating)"
X			font:8x13
X			help:"This shows an example of how a list may be constructed \
X				based on the output of a command"
X			popup: get_item ;
X
X		button "Generate a command error"
X			font:8x13
X			help:"This demonstrates the warning a user can get when a UNIX \
X				command exits with other than 0"
X			runforeground:"echo this is an error message ; exit 1" ;
X
X		button "RETURN"
X			background:#FFA0A0 foreground:#000000
X			font:8x13
X			help:"This returns you to the initial screen"
X			getenv:"top level" ;
X	)
X
X	menu float_menu
X	(
X		label "Congratulations on" ;
X		label "placing me" ;
X
X		button "Quit"
X			font:8x13
X			help:"Quit this window"
X			foreground:"#0000A0"
X			popdown:float_menu ;
X	)
X
X	cmdboard get_text x:10 y:200 override:on
X	(
X		label "Sample cmdboard"
X			background:"#0000A0" foreground:white
X			font:9x15 ;
X
X		label "Enter arguments for UNIX ls(1)"
X			background:"#0000A0" foreground:white
X			font:8x13 ;
X
X		label "Run an ls command"
X			background:"#0000A0" foreground:white
X			font:9x15 ;
X
X		textspace "arguments"
X			labelbackground:thistle labelforeground:white
X			labelfont:8x13
X			textfont:8x13
X			help:"Enter arguments to the UNIX ls command" ;
X
X		textspace "output_to"
X			labelbackground:thistle labelforeground:white
X			labelfont:8x13
X			textfont:8x13
X			help:"Enter a string which identifies where the output should \
X				go to.  Examples: '> /dev/tty' -or- '| sort > /tmp/junk'" ;
X
X		button "Run"
X			font:8x13
X			foreground:"#0000A0"
X			commandarg:"[arguments(-l)] [output_to(> /dev/tty)]"
X			help:"This causes the ls program to be run with the arguments \
X				indicated above appended."
X			runforeground:"ls" ;
X
X		button "Quit"
X			font:8x13
X			foreground:"#0000A0"
X			help:"This quits this example"
X			popdown:get_text_help
X			popdown:get_text ;
X
X		button "Clear"
X			font:8x13
X			foreground:"#0000A0"
X			help:"Reset the command arguments to the defaults"
X			clearcmdboard:all ;
X	)
X
X	msgboard get_text_help x:250 y:200 override:on
X	(
X		message "The following edit commands are available: \
X				 Ctrl-f:forward character \
X				 Ctrl-b:backward character \
X				 Ctrl-d:delete next character \
X				 Ctrl-a:begin of line \
X				 Ctrl-e:end of line \
X				 Ctrl-k:kill \
X				 Ctrl-y:unkill \
X				 Delete:delete character"
X			background:thistle
X			maxwidth:320
X			font:8x13 ;
X	)
X
X	menu get_item maxheight:200 x:10 y:200
X	updatefrom:"!ls -aF"
X	(
X		label "Select directory entry"
X			background:"#0000A0"
X			foreground:white
X			font:9x15 ;
X
X		label "Press mouse on any entry to return"
X			font:9x15 ;
X
X		button null
X			font:8x13
X			highlight:100
X			setVARIABLE:buttonname
X			runforeground:"echo - > /dev/tty"
X			runforeground:"echo you just selected: $VARIABLE > /dev/tty"
X			popdown:get_item ;
X	)
X
X	msgboard explain_table x:350 y:250 override:on
X	(
X		label "Instructions for Entering Tabular Data"
X			background:"light steel blue"
X			foreground:white
X			font:9x15 ;
X
X		message "This entry format allows you to enter tables of data. \
X			Numbers (strings) are entered in the box next to the label \
X			'Starting Points' one at a time.   Upon pressing return, they \
X			appear in the spreadsheet style table below.  Values can be \
X			'pasted' into the entry box using information stored in the \
X			X cut buffer.   Editing is possible by identifying the entry \
X			to be edited by using the following keys: \
X			Ctrl-f:forward one column \
X			Ctrl-b:back one column \
X			Ctrl-p:previous line \
X			Ctrl-n:next line."
X			maxwidth:400 borderwidth:4
X			font:8x13
X			background:#FF9090 foreground:#000000 ;
X	)
X
X	cmdboard get_table x:10 y:200 override:on
X	(
X		label "Sample Command Input Gathering"
X			background:"light steel blue"
X			foreground:white
X			font:9x15 ;
X
X		textspace "Output"
X			labelbackground:thistle
X			labelforeground:white
X			labelfont:8x13
X			textfont:8x13
X			help:"Enter in this space the name of \
X				  the file to contain the (make believe) result";
X
X		textspace "Input"
X			labelbackground:thistle
X			labelforeground:white
X			labelfont:8x13
X			textfont:8x13
X			help:"Enter in this space the name of the \
X				  file containing the (make believe) information";
X
X		scrolltextspace "Starting Points"
X			labelbackground:thistle
X			labelforeground:white
X			labelfont:8x13
X			textfont:8x13
X			titlefont:8x13
X			scrollfont:8x13
X			borderwidth:5
X			bordercolor:gray
X			columns:"Easting:12 Northing:12"
X			scrollheight:80
X			help: "Enter the E and N (make believe) grid coordinates \
X				   of  starting points.  This can be repeated for as \
X				   many points as desired.   Read the window titled \
X				   Instructions for entering tabular data." ;
X
X		button "Run"
X			font:8x13
X			foreground:"light steel blue"
X			commandarg:"input=[Input(input)] \
X				output=[Output(output)] \
X				coor=[Easting],[Northing]"
X			runforeground:"echo > /dev/tty Sample command arguments:" ;
X
X		button "Quit"
X			font:8x13
X			foreground:"light steel blue"
X			popdown:explain_table
X			popdown:get_table ;
X
X		button "Clear"
X			font:8x13
X			foreground:"light steel blue"
X			clearcmdboard:all ;
X	)
X}
END_OF_FILE
if test 8149 -ne `wc -c <'application'`; then
    echo shar: \"'application'\" unpacked with wrong size!
fi
# end of 'application'
fi
echo shar: End of shell archive.
exit 0