[comp.sources.x] v09i004: TWM with a virtual root window, Part03/09

toml@marvin.Solbourne.COM (Tom LaStrange) (08/30/90)

Submitted-by: toml@marvin.Solbourne.COM (Tom LaStrange)
Posting-number: Volume 9, Issue 4
Archive-name: tvtwm/part03

#! /bin/sh
# This is a shell archive, meaning:
# 1.  Remove everything above the #! /bin/sh line.
# 2.  Save the resulting test in a file
# 3.  Execute the file with /bin/sh (not csh) to create the files:
#
#icons.c
#lex.c
#list.c
#menus.h
#move.c
#parse.h
#resize.h
#system.twmrc
#
# Created by toml () on Wed Aug 29 08:43:30 MDT 1990
#
if test -f 'icons.c'
then
    echo shar: will not over-write existing file "icons.c"
else
echo extracting "icons.c"
sed 's/^X//' >icons.c <<'SHAR_EOF'
X/*
X * Copyright 1989 Massachusetts Institute of Technology
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted, provided
X * that the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of M.I.T. not be used in advertising
X * or publicity pertaining to distribution of the software without specific,
X * written prior permission.  M.I.T. makes no representations about the
X * suitability of this software for any purpose.  It is provided "as is"
X * without express or implied warranty.
X *
X * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
X * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
X * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
X * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
X * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
X */
X
X/**********************************************************************
X *
X * $XConsortium: icons.c,v 1.20 90/03/27 13:51:34 jim Exp $
X *
X * Icon releated routines
X *
X * 10-Apr-89 Tom LaStrange        Initial Version.
X *
X **********************************************************************/
X
X#include <stdio.h>
X#include "twm.h"
X#include "screen.h"
X#include "icons.h"
X#include "gram.h"
X#include "parse.h"
X#include "util.h"
X
X#define iconWidth(w)	(Scr->IconBorderWidth * 2 + w->icon_w_width)
X#define iconHeight(w)	(Scr->IconBorderWidth * 2 + w->icon_w_height)
X
Xstatic
XsplitEntry (ie, grav1, grav2, w, h)
X    IconEntry	*ie;
X    int		grav1, grav2;
X    int		w, h;
X{
X    IconEntry	*new;
X
X    switch (grav1) {
X    case D_NORTH:
X    case D_SOUTH:
X	if (w != ie->w)
X	    splitEntry (ie, grav2, grav1, w, ie->h);
X	if (h != ie->h) {
X	    new = (IconEntry *)malloc (sizeof (IconEntry));
X	    new->twm_win = 0;
X	    new->used = 0;
X	    new->next = ie->next;
X	    ie->next = new;
X	    new->x = ie->x;
X	    new->h = (ie->h - h);
X	    new->w = ie->w;
X	    ie->h = h;
X	    if (grav1 == D_SOUTH) {
X		new->y = ie->y;
X		ie->y = new->y + new->h;
X	    } else
X		new->y = ie->y + ie->h;
X	}
X	break;
X    case D_EAST:
X    case D_WEST:
X	if (h != ie->h)
X	    splitEntry (ie, grav2, grav1, ie->w, h);
X	if (w != ie->w) {
X	    new = (IconEntry *)malloc (sizeof (IconEntry));
X	    new->twm_win = 0;
X	    new->used = 0;
X	    new->next = ie->next;
X	    ie->next = new;
X	    new->y = ie->y;
X	    new->w = (ie->w - w);
X	    new->h = ie->h;
X	    ie->w = w;
X	    if (grav1 == D_EAST) {
X		new->x = ie->x;
X		ie->x = new->x + new->w;
X	    } else
X		new->x = ie->x + ie->w;
X	}
X	break;
X    }
X}
X
XroundUp (v, multiple)
X{
X    return ((v + multiple - 1) / multiple) * multiple;
X}
X
XPlaceIcon(tmp_win, def_x, def_y, final_x, final_y)
XTwmWindow *tmp_win;
Xint def_x, def_y;
Xint *final_x, *final_y;
X{
X    IconRegion	*ir;
X    IconEntry	*ie;
X    int		w = 0, h = 0;
X
X    ie = 0;
X    for (ir = Scr->FirstRegion; ir; ir = ir->next) {
X	w = roundUp (iconWidth (tmp_win), ir->stepx);
X	h = roundUp (iconHeight (tmp_win), ir->stepy);
X	for (ie = ir->entries; ie; ie=ie->next) {
X	    if (ie->used)
X		continue;
X	    if (ie->w >= w && ie->h >= h)
X		break;
X	}
X	if (ie)
X	    break;
X    }
X    if (ie) {
X	splitEntry (ie, ir->grav1, ir->grav2, w, h);
X	ie->used = 1;
X	ie->twm_win = tmp_win;
X	*final_x = ie->x + (ie->w - iconWidth (tmp_win)) / 2;
X	*final_y = ie->y + (ie->h - iconHeight (tmp_win)) / 2;
X    } else {
X	*final_x = def_x;
X	*final_y = def_y;
X    }
X    return;
X}
X
Xstatic IconEntry *
XFindIconEntry (tmp_win, irp)
X    TwmWindow   *tmp_win;
X    IconRegion	**irp;
X{
X    IconRegion	*ir;
X    IconEntry	*ie;
X
X    for (ir = Scr->FirstRegion; ir; ir = ir->next) {
X	for (ie = ir->entries; ie; ie=ie->next)
X	    if (ie->twm_win == tmp_win) {
X		if (irp)
X		    *irp = ir;
X		return ie;
X	    }
X    }
X    return 0;
X}
X
XIconUp (tmp_win)
X    TwmWindow   *tmp_win;
X{
X    int		x, y;
X    int		defx, defy;
X    struct IconRegion *ir;
X
X    /*
X     * If the client specified a particular location, let's use it (this might
X     * want to be an option at some point).  Otherwise, try to fit within the
X     * icon region.
X     */
X    if (tmp_win->wmhints && (tmp_win->wmhints->flags & IconPositionHint))
X      return;
X
X    if (tmp_win->icon_moved) {
X	if (!XGetGeometry (dpy, tmp_win->icon_w, &JunkRoot, &defx, &defy,
X			   &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth))
X	  return;
X
X	x = defx + ((int) JunkWidth) / 2;
X	y = defy + ((int) JunkHeight) / 2;
X
X	for (ir = Scr->FirstRegion; ir; ir = ir->next) {
X	    if (x >= ir->x && x < (ir->x + ir->w) &&
X		y >= ir->y && y < (ir->y + ir->h))
X	      break;
X	}
X	if (!ir) return;		/* outside icon regions, leave alone */
X    }
X
X    defx = -100;
X    defy = -100;
X    PlaceIcon(tmp_win, defx, defy, &x, &y);
X    if (x != defx || y != defy) {
X	MoveIcon(tmp_win, x, y);
X	tmp_win->icon_moved = FALSE;	/* since we've restored it */
X    }
X}
X
Xstatic IconEntry *
XprevIconEntry (ie, ir)
X    IconEntry	*ie;
X    IconRegion	*ir;
X{
X    IconEntry	*ip;
X
X    if (ie == ir->entries)
X	return 0;
X    for (ip = ir->entries; ip->next != ie; ip=ip->next)
X	;
X    return ip;
X}
X
X/* old is being freed; and is adjacent to ie.  Merge
X * regions together
X */
X
Xstatic
XmergeEntries (old, ie)
X    IconEntry	*old, *ie;
X{
X    if (old->y == ie->y) {
X	ie->w = old->w + ie->w;
X	if (old->x < ie->x)
X	    ie->x = old->x;
X    } else {
X	ie->h = old->h + ie->h;
X	if (old->y < ie->y)
X	    ie->y = old->y;
X    }
X}
X
XIconDown (tmp_win)
X    TwmWindow   *tmp_win;
X{
X    IconEntry	*ie, *ip, *in;
X    IconRegion	*ir;
X
X    ie = FindIconEntry (tmp_win, &ir);
X    if (ie) {
X	ie->twm_win = 0;
X	ie->used = 0;
X	ip = prevIconEntry (ie, ir);
X	in = ie->next;
X	for (;;) {
X	    if (ip && ip->used == 0 &&
X	       ((ip->x == ie->x && ip->w == ie->w) ||
X	        (ip->y == ie->y && ip->h == ie->h)))
X	    {
X	    	ip->next = ie->next;
X	    	mergeEntries (ie, ip);
X	    	free ((char *) ie);
X		ie = ip;
X	    	ip = prevIconEntry (ip, ir);
X	    } else if (in && in->used == 0 &&
X	       ((in->x == ie->x && in->w == ie->w) ||
X	        (in->y == ie->y && in->h == ie->h)))
X	    {
X	    	ie->next = in->next;
X	    	mergeEntries (in, ie);
X	    	free ((char *) in);
X	    	in = ie->next;
X	    } else
X		break;
X	}
X    }
X}
X
XAddIconRegion(geom, grav1, grav2, stepx, stepy)
Xchar *geom;
Xint grav1, grav2;
X{
X    IconRegion *ir;
X    int mask;
X
X    ir = (IconRegion *)malloc(sizeof(IconRegion));
X    ir->next = NULL;
X    if (Scr->LastRegion)
X	Scr->LastRegion->next = ir;
X    Scr->LastRegion = ir;
X    if (!Scr->FirstRegion)
X	Scr->FirstRegion = ir;
X
X    ir->entries = NULL;
X    ir->grav1 = grav1;
X    ir->grav2 = grav2;
X    if (stepx <= 0)
X	stepx = 1;
X    if (stepy <= 0)
X	stepy = 1;
X    ir->stepx = stepx;
X    ir->stepy = stepy;
X    ir->x = ir->y = ir->w = ir->h = 0;
X
X    mask = XParseGeometry(geom, &ir->x, &ir->y, (unsigned int *)&ir->w, (unsigned int *)&ir->h);
X
X    if (mask & XNegative)
X	ir->x += Scr->MyDisplayWidth - ir->w;
X
X    if (mask & YNegative)
X	ir->y += Scr->MyDisplayHeight - ir->h;
X    ir->entries = (IconEntry *)malloc(sizeof(IconEntry));
X    ir->entries->next = 0;
X    ir->entries->x = ir->x;
X    ir->entries->y = ir->y;
X    ir->entries->w = ir->w;
X    ir->entries->h = ir->h;
X    ir->entries->twm_win = 0;
X    ir->entries->used = 0;
X}
X
X#ifdef comment
XFreeIconEntries (ir)
X    IconRegion	*ir;
X{
X    IconEntry	*ie, *tmp;
X
X    for (ie = ir->entries; ie; ie=tmp)
X    {
X	tmp = ie->next;
X	free ((char *) ie);
X    }
X}
XFreeIconRegions()
X{
X    IconRegion *ir, *tmp;
X
X    for (ir = Scr->FirstRegion; ir != NULL;)
X    {
X	tmp = ir;
X	FreeIconEntries (ir);
X	ir = ir->next;
X	free((char *) tmp);
X    }
X    Scr->FirstRegion = NULL;
X    Scr->LastRegion = NULL;
X}
X#endif
X
XCreateIconWindow(tmp_win, def_x, def_y)
XTwmWindow *tmp_win;
Xint def_x, def_y;
X{
X    unsigned long event_mask;
X    unsigned long valuemask;		/* mask for create windows */
X    XSetWindowAttributes attributes;	/* attributes for create windows */
X    Pixmap pm = None;			/* tmp pixmap variable */
X    int final_x, final_y;
X    int x;
X
X
X    FB(tmp_win->iconc.fore, tmp_win->iconc.back);
X
X    tmp_win->forced = FALSE;
X    tmp_win->icon_not_ours = FALSE;
X
X    /* now go through the steps to get an icon window,  if ForceIcon is 
X     * set, then no matter what else is defined, the bitmap from the
X     * .twmrc file is used
X     */
X    if (Scr->ForceIcon)
X    {
X	char *icon_name;
X	Pixmap bm;
X
X	icon_name = LookInNameList(Scr->IconNames, tmp_win->full_name);
X        if (icon_name == NULL)
X	    icon_name = LookInList(Scr->IconNames, tmp_win->full_name,
X				   &tmp_win->class);
X
X	bm = NULL;
X	if (icon_name != NULL)
X	{
X	    if ((bm = (Pixmap)LookInNameList(Scr->Icons, icon_name)) == None)
X	    {
X		if ((bm = GetBitmap (icon_name)) != None)
X		    AddToList(&Scr->Icons, icon_name, (char *)bm);
X	    }
X	}
X
X	if (bm != NULL)
X	{
X	    XGetGeometry(dpy, bm, &JunkRoot, &JunkX, &JunkY,
X		(unsigned int *) &tmp_win->icon_width, (unsigned int *)&tmp_win->icon_height,
X		&JunkBW, &JunkDepth);
X
X	    pm = XCreatePixmap(dpy, Scr->Root, tmp_win->icon_width,
X		tmp_win->icon_height, Scr->d_depth);
X
X	    /* the copy plane works on color ! */
X	    XCopyPlane(dpy, bm, pm, Scr->NormalGC,
X		0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 );
X
X	    tmp_win->forced = TRUE;
X	}
X    }
X
X    /* if the pixmap is still NULL, we didn't get one from the above code,
X     * that could mean that ForceIcon was not set, or that the window
X     * was not in the Icons list, now check the WM hints for an icon
X     */
X    if (pm == None && tmp_win->wmhints &&
X	tmp_win->wmhints->flags & IconPixmapHint)
X    {
X    
X	XGetGeometry(dpy,   tmp_win->wmhints->icon_pixmap,
X             &JunkRoot, &JunkX, &JunkY,
X	     (unsigned int *)&tmp_win->icon_width, (unsigned int *)&tmp_win->icon_height, &JunkBW, &JunkDepth);
X
X	pm = XCreatePixmap(dpy, Scr->Root,
X			   tmp_win->icon_width, tmp_win->icon_height,
X			   Scr->d_depth);
X
X	XCopyPlane(dpy, tmp_win->wmhints->icon_pixmap, pm, Scr->NormalGC,
X	    0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 );
X    }
X
X    /* if we still haven't got an icon, let's look in the Icon list 
X     * if ForceIcon is not set
X     */
X    if (pm == None && !Scr->ForceIcon)
X    {
X	char *icon_name;
X	Pixmap bm;
X
X	icon_name = LookInNameList(Scr->IconNames, tmp_win->full_name);
X        if (icon_name == NULL)
X	    icon_name = LookInList(Scr->IconNames, tmp_win->full_name,
X				   &tmp_win->class);
X
X	bm = NULL;
X	if (icon_name != NULL)
X	{
X	    if ((bm = (Pixmap)LookInNameList(Scr->Icons, icon_name)) == None)
X	    {
X		if ((bm = GetBitmap (icon_name)) != None)
X		    AddToList(&Scr->Icons, icon_name, (char *)bm);
X	    }
X	}
X
X	if (bm != NULL)
X	{
X	    XGetGeometry(dpy, bm, &JunkRoot, &JunkX, &JunkY,
X		(unsigned int *)&tmp_win->icon_width, (unsigned int *)&tmp_win->icon_height,
X		&JunkBW, &JunkDepth);
X
X	    pm = XCreatePixmap(dpy, Scr->Root, tmp_win->icon_width,
X		tmp_win->icon_height, Scr->d_depth);
X
X	    /* the copy plane works on color ! */
X	    XCopyPlane(dpy, bm, pm, Scr->NormalGC,
X		0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 );
X	}
X    }
X
X    /* if we still don't have an icon, assign the UnknownIcon */
X
X    if (pm == None && Scr->UnknownPm != NULL)
X    {
X	tmp_win->icon_width = Scr->UnknownWidth;
X	tmp_win->icon_height = Scr->UnknownHeight;
X
X	pm = XCreatePixmap(dpy, Scr->Root, tmp_win->icon_width,
X	    tmp_win->icon_height, Scr->d_depth);
X
X	/* the copy plane works on color ! */
X	XCopyPlane(dpy, Scr->UnknownPm, pm, Scr->NormalGC,
X	    0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 );
X    }
X
X    if (pm == None)
X    {
X	tmp_win->icon_height = 0;
X	tmp_win->icon_width = 0;
X	valuemask = 0;
X    }
X    else
X    {
X	valuemask = CWBackPixmap;
X	attributes.background_pixmap = pm;
X    }
X
X    tmp_win->icon_w_width = XTextWidth(Scr->IconFont.font,
X	tmp_win->icon_name, strlen(tmp_win->icon_name));
X
X    tmp_win->icon_w_width += 6;
X    if (tmp_win->icon_w_width < tmp_win->icon_width)
X    {
X	tmp_win->icon_x = (tmp_win->icon_width - tmp_win->icon_w_width)/2;
X	tmp_win->icon_x += 3;
X	tmp_win->icon_w_width = tmp_win->icon_width;
X    }
X    else
X    {
X	tmp_win->icon_x = 3;
X    }
X    tmp_win->icon_y = tmp_win->icon_height + Scr->IconFont.height;
X    tmp_win->icon_w_height = tmp_win->icon_height + Scr->IconFont.height + 4;
X
X    event_mask = 0;
X    if (tmp_win->wmhints && tmp_win->wmhints->flags & IconWindowHint)
X    {
X	tmp_win->icon_w = tmp_win->wmhints->icon_window;
X	if (tmp_win->forced ||
X	    XGetGeometry(dpy, tmp_win->icon_w, &JunkRoot, &JunkX, &JunkY,
X		     (unsigned int *)&tmp_win->icon_w_width, (unsigned int *)&tmp_win->icon_w_height,
X		     &JunkBW, &JunkDepth) == 0)
X	{
X	    tmp_win->icon_w = NULL;
X	    tmp_win->wmhints->flags &= ~IconWindowHint;
X	}
X	else
X	{
X	    tmp_win->icon_not_ours = TRUE;
X	}
X    }
X    else
X    {
X	tmp_win->icon_w = NULL;
X    }
X
X    if (tmp_win->icon_w == NULL)
X    {
X	tmp_win->icon_w = XCreateSimpleWindow(dpy, tmp_win->root,
X	    0,0,
X	    tmp_win->icon_w_width, tmp_win->icon_w_height,
X	    Scr->IconBorderWidth, tmp_win->icon_border, tmp_win->iconc.back);
X	event_mask = ExposureMask;
X    }
X
X    if (Scr->VirtualDesktop) {
X	tmp_win->virtualIcon = MakeVirtual(tmp_win,
X	    0, 0, tmp_win->icon_w_width, tmp_win->icon_w_height,
X	    tmp_win->iconc.back, tmp_win->icon_border);
X    }
X    XSelectInput (dpy, tmp_win->icon_w,
X		  KeyPressMask | ButtonPressMask | ButtonReleaseMask |
X		  event_mask);
X
X    tmp_win->icon_bm_w = NULL;
X    if (pm != None &&
X	(! (tmp_win->wmhints && tmp_win->wmhints->flags & IconWindowHint)))
X    {
X	int y;
X
X	y = 0;
X	if (tmp_win->icon_w_width == tmp_win->icon_width)
X	    x = 0;
X	else
X	    x = (tmp_win->icon_w_width - tmp_win->icon_width)/2;
X
X	tmp_win->icon_bm_w = XCreateWindow (dpy, tmp_win->icon_w, x, y,
X					    (unsigned int)tmp_win->icon_width,
X					    (unsigned int)tmp_win->icon_height,
X					    (unsigned int) 0, Scr->d_depth,
X					    (unsigned int) CopyFromParent,
X					    Scr->d_visual, valuemask,
X					    &attributes);
X    }
X
X    /* I need to figure out where to put the icon window now, because 
X     * getting here means that I am going to make the icon visible
X     */
X    if (tmp_win->wmhints &&
X	tmp_win->wmhints->flags & IconPositionHint)
X    {
X	final_x = tmp_win->wmhints->icon_x;
X	final_y = tmp_win->wmhints->icon_y;
X    }
X    else
X    {
X	PlaceIcon(tmp_win, def_x, def_y, &final_x, &final_y);
X    }
X
X    if (final_x > Scr->MyDisplayWidth)
X	final_x = Scr->MyDisplayWidth - tmp_win->icon_w_width -
X	    (2 * Scr->IconBorderWidth);
X
X    if (final_y > Scr->MyDisplayHeight)
X	final_y = Scr->MyDisplayHeight - tmp_win->icon_height -
X	    Scr->IconFont.height - 4 - (2 * Scr->IconBorderWidth);
X
X    MoveIcon(tmp_win, final_x, final_y);
X    tmp_win->iconified = TRUE;
X
X    XMapSubwindows(dpy, tmp_win->icon_w);
X    XSaveContext(dpy, tmp_win->icon_w, TwmContext, (caddr_t)tmp_win);
X    XSaveContext(dpy, tmp_win->icon_w, ScreenContext, (caddr_t)Scr);
X    XDefineCursor(dpy, tmp_win->icon_w, Scr->IconCursor);
X    if (pm) XFreePixmap (dpy, pm);
X    return;
X}
SHAR_EOF
if test 15055 -ne "`wc -c < icons.c`"
then
    echo shar: error transmitting "icons.c" '(should have been 15055 characters)'
fi
fi
if test -f 'lex.c'
then
    echo shar: will not over-write existing file "lex.c"
else
echo extracting "lex.c"
sed 's/^X//' >lex.c <<'SHAR_EOF'
X# include "stdio.h"
X# define U(x) x
X# define NLSTATE yyprevious=YYNEWLINE
X# define BEGIN yybgin = yysvec + 1 +
X# define INITIAL 0
X# define YYLERR yysvec
X# define YYSTATE (yyestate-yysvec-1)
X# define YYOPTIM 1
X# define YYLMAX BUFSIZ
X# define output(c) putc(c,yyout)
X# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
X# define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;}
X# define yymore() (yymorfg=1)
X# define ECHO fprintf(yyout, "%s",yytext)
X# define REJECT { nstr = yyreject(); goto yyfussy;}
Xint yyleng; extern char yytext[];
Xint yymorfg;
Xextern char *yysptr, yysbuf[];
Xint yytchar;
XFILE *yyin = {stdin}, *yyout = {stdout};
Xextern int yylineno;
Xstruct yysvf { 
X	struct yywork *yystoff;
X	struct yysvf *yyother;
X	int *yystops;};
Xstruct yysvf *yyestate;
Xextern struct yysvf yysvec[], *yybgin;
X/*****************************************************************************/
X/**       Copyright 1988 by Evans & Sutherland Computer Corporation,        **/
X/**                          Salt Lake City, Utah                           **/
X/**  Portions Copyright 1989 by the Massachusetts Institute of Technology   **/
X/**                        Cambridge, Massachusetts                         **/
X/**                                                                         **/
X/**                           All Rights Reserved                           **/
X/**                                                                         **/
X/**    Permission to use, copy, modify, and distribute this software and    **/
X/**    its documentation  for  any  purpose  and  without  fee is hereby    **/
X/**    granted, provided that the above copyright notice appear  in  all    **/
X/**    copies and that both  that  copyright  notice  and  this  permis-    **/
X/**    sion  notice appear in supporting  documentation,  and  that  the    **/
X/**    names of Evans & Sutherland and M.I.T. not be used in advertising    **/
X/**    in publicity pertaining to distribution of the  software  without    **/
X/**    specific, written prior permission.                                  **/
X/**                                                                         **/
X/**    EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD    **/
X/**    TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES  OF  MERCHANT-    **/
X/**    ABILITY  AND  FITNESS,  IN  NO  EVENT SHALL EVANS & SUTHERLAND OR    **/
X/**    M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL  DAM-    **/
X/**    AGES OR  ANY DAMAGES WHATSOEVER  RESULTING FROM LOSS OF USE, DATA    **/
X/**    OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER    **/
X/**    TORTIOUS ACTION, ARISING OUT OF OR IN  CONNECTION  WITH  THE  USE    **/
X/**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
X/*****************************************************************************/
X
X/***********************************************************************
X *
X * $XConsortium: lex.l,v 1.62 89/12/10 17:46:33 jim Exp $
X *
X * .twmrc lex file
X *
X * 12-Nov-87 Thomas E. LaStrange		File created
X *
X ***********************************************************************/
X
X/* #include <stdio.h> */		/* lex already includes stdio.h */
X#include "gram.h"
X#include "parse.h"
Xextern char *ProgramName;
X
Xextern int ParseError;
X
X# define YYNEWLINE 10
Xyylex(){
Xint nstr; extern int yyprevious;
Xwhile((nstr = yylook()) >= 0)
Xyyfussy: switch(nstr){
Xcase 0:
Xif(yywrap()) return(0); break;
Xcase 1:
X			{ return (LB); }
Xbreak;
Xcase 2:
X			{ return (RB); }
Xbreak;
Xcase 3:
X			{ return (LP); }
Xbreak;
Xcase 4:
X			{ return (RP); }
Xbreak;
Xcase 5:
X			{ return (EQUALS); }
Xbreak;
Xcase 6:
X			{ return (COLON); }
Xbreak;
Xcase 7:
X			{ return PLUS; }
Xbreak;
Xcase 8:
X			{ return MINUS; }
Xbreak;
Xcase 9:
X			{ return OR; }
Xbreak;
Xcase 10:
X		{ int token = parse_keyword (yytext, 
X							     &yylval.num);
X				  if (token == ERRORTOKEN) {
X				      twmrc_error_prefix();
X				      fprintf (stderr,
X				       "ignoring unknown keyword:  %s\n", 
X					       yytext);
X				      ParseError = 1;
X				  } else 
X				    return token;
X				}
Xbreak;
Xcase 11:
X			{ yylval.num = F_EXEC; return FSKEYWORD; }
Xbreak;
Xcase 12:
X			{ yylval.num = F_CUT; return FSKEYWORD; }
Xbreak;
Xcase 13:
X		{ yylval.ptr = (char *)yytext; return STRING; }
Xbreak;
Xcase 14:
X		{ (void)sscanf(yytext, "%d", &yylval.num);
X				  return (NUMBER);
X				}
Xbreak;
Xcase 15:
X		{;}
Xbreak;
Xcase 16:
X			{;}
Xbreak;
Xcase 17:
X			{
X				  twmrc_error_prefix();
X				  fprintf (stderr, 
X					   "ignoring character \"%s\"\n",
X					   yytext);
X				  ParseError = 1;
X				}
Xbreak;
Xcase -1:
Xbreak;
Xdefault:
Xfprintf(yyout,"bad switch yylook %d",nstr);
X} return(0); }
X/* end of yylex */
Xyywrap() { return(1);}
X
X#undef unput
X#undef input
X#undef output
X#undef feof
X#define unput(c)	twmUnput(c)
X#define input()		(*twmInputFunc)()
X#define output(c)	TwmOutput(c)
X#define feof()		(1)
Xint yyvstop[] = {
X0,
X
X17,
X0,
X
X16,
X17,
X0,
X
X16,
X0,
X
X11,
X17,
X0,
X
X17,
X0,
X
X17,
X0,
X
X3,
X17,
X0,
X
X4,
X17,
X0,
X
X7,
X17,
X0,
X
X8,
X17,
X0,
X
X10,
X17,
X0,
X
X14,
X17,
X0,
X
X6,
X17,
X0,
X
X5,
X17,
X0,
X
X12,
X17,
X0,
X
X1,
X17,
X0,
X
X9,
X17,
X0,
X
X2,
X17,
X0,
X
X13,
X0,
X
X15,
X0,
X
X10,
X0,
X
X14,
X0,
X
X13,
X0,
X0};
X# define YYTYPE char
Xstruct yywork { YYTYPE verify, advance; } yycrank[] = {
X0,0,	0,0,	1,3,	0,0,	
X0,0,	0,0,	0,0,	7,21,	
X0,0,	0,0,	1,4,	1,5,	
X0,0,	0,0,	0,0,	7,21,	
X7,21,	0,0,	0,0,	0,0,	
X0,0,	0,0,	0,0,	0,0,	
X0,0,	0,0,	0,0,	0,0,	
X0,0,	0,0,	8,24,	0,0,	
X0,0,	0,0,	1,6,	1,7,	
X1,8,	0,0,	8,24,	8,25,	
X7,22,	1,9,	1,10,	2,6,	
X1,11,	2,8,	1,12,	1,13,	
X23,28,	1,14,	2,9,	2,10,	
X7,21,	2,11,	7,21,	2,12,	
X0,0,	0,0,	0,0,	1,15,	
X0,0,	0,0,	1,16,	8,24,	
X0,0,	0,0,	0,0,	0,0,	
X2,15,	0,0,	0,0,	2,16,	
X0,0,	0,0,	0,0,	8,24,	
X0,0,	8,24,	14,27,	14,27,	
X14,27,	14,27,	14,27,	14,27,	
X14,27,	14,27,	14,27,	14,27,	
X0,0,	0,0,	0,0,	0,0,	
X0,0,	21,23,	28,23,	1,17,	
X0,0,	0,0,	7,23,	0,0,	
X0,0,	0,0,	0,0,	0,0,	
X2,17,	0,0,	23,23,	0,0,	
X0,0,	0,0,	0,0,	0,0,	
X0,0,	0,0,	0,0,	0,0,	
X0,0,	13,26,	0,0,	0,0,	
X0,0,	0,0,	0,0,	0,0,	
X1,18,	1,19,	1,20,	0,0,	
X0,0,	0,0,	0,0,	0,0,	
X0,0,	2,18,	2,19,	2,20,	
X13,26,	13,26,	13,26,	13,26,	
X13,26,	13,26,	13,26,	13,26,	
X13,26,	13,26,	13,26,	13,26,	
X13,26,	13,26,	13,26,	13,26,	
X13,26,	13,26,	13,26,	13,26,	
X13,26,	13,26,	13,26,	13,26,	
X13,26,	13,26,	0,0,	0,0,	
X0,0,	0,0,	0,0,	0,0,	
X13,26,	13,26,	13,26,	13,26,	
X13,26,	13,26,	13,26,	13,26,	
X13,26,	13,26,	13,26,	13,26,	
X13,26,	13,26,	13,26,	13,26,	
X13,26,	13,26,	13,26,	13,26,	
X13,26,	13,26,	13,26,	13,26,	
X13,26,	13,26,	0,0,	0,0,	
X0,0};
Xstruct yysvf yysvec[] = {
X0,	0,	0,
Xyycrank+-1,	0,		0,	
Xyycrank+-10,	yysvec+1,	0,	
Xyycrank+0,	0,		yyvstop+1,
Xyycrank+0,	0,		yyvstop+3,
Xyycrank+0,	0,		yyvstop+6,
Xyycrank+0,	0,		yyvstop+8,
Xyycrank+-6,	0,		yyvstop+11,
Xyycrank+-29,	0,		yyvstop+13,
Xyycrank+0,	0,		yyvstop+15,
Xyycrank+0,	0,		yyvstop+18,
Xyycrank+0,	0,		yyvstop+21,
Xyycrank+0,	0,		yyvstop+24,
Xyycrank+71,	0,		yyvstop+27,
Xyycrank+30,	0,		yyvstop+30,
Xyycrank+0,	0,		yyvstop+33,
Xyycrank+0,	0,		yyvstop+36,
Xyycrank+0,	0,		yyvstop+39,
Xyycrank+0,	0,		yyvstop+42,
Xyycrank+0,	0,		yyvstop+45,
Xyycrank+0,	0,		yyvstop+48,
Xyycrank+-1,	yysvec+7,	0,	
Xyycrank+0,	0,		yyvstop+51,
Xyycrank+-14,	yysvec+7,	0,	
Xyycrank+0,	yysvec+8,	0,	
Xyycrank+0,	0,		yyvstop+53,
Xyycrank+0,	yysvec+13,	yyvstop+55,
Xyycrank+0,	yysvec+14,	yyvstop+57,
Xyycrank+-2,	yysvec+7,	yyvstop+59,
X0,	0,	0};
Xstruct yywork *yytop = yycrank+193;
Xstruct yysvf *yybgin = yysvec+1;
Xchar yymatch[] = {
X00  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
X01  ,011 ,012 ,01  ,01  ,01  ,01  ,01  ,
X01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
X01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
X011 ,01  ,'"' ,01  ,01  ,01  ,01  ,01  ,
X01  ,01  ,01  ,01  ,01  ,01  ,'.' ,01  ,
X'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,
X'0' ,'0' ,01  ,01  ,01  ,01  ,01  ,01  ,
X01  ,'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,
X'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,
X'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,
X'.' ,'.' ,'.' ,01  ,01  ,01  ,01  ,01  ,
X01  ,'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,
X'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,
X'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,'.' ,
X'.' ,'.' ,'.' ,01  ,01  ,01  ,01  ,01  ,
X0};
Xchar yyextra[] = {
X0,0,0,0,0,0,0,0,
X0,0,0,0,0,0,0,0,
X0,0,0,0,0,0,0,0,
X0};
X#ifndef lint
Xstatic	char ncform_sccsid[] = "@(#)ncform 1.6 88/02/08 SMI"; /* from S5R2 1.2 */
X#endif
X
Xint yylineno =1;
X# define YYU(x) x
X# define NLSTATE yyprevious=YYNEWLINE
Xchar yytext[YYLMAX];
Xstruct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
Xchar yysbuf[YYLMAX];
Xchar *yysptr = yysbuf;
Xint *yyfnd;
Xextern struct yysvf *yyestate;
Xint yyprevious = YYNEWLINE;
Xyylook(){
X	register struct yysvf *yystate, **lsp;
X	register struct yywork *yyt;
X	struct yysvf *yyz;
X	int yych, yyfirst;
X	struct yywork *yyr;
X# ifdef LEXDEBUG
X	int debug;
X# endif
X	char *yylastch;
X	/* start off machines */
X# ifdef LEXDEBUG
X	debug = 0;
X# endif
X	yyfirst=1;
X	if (!yymorfg)
X		yylastch = yytext;
X	else {
X		yymorfg=0;
X		yylastch = yytext+yyleng;
X		}
X	for(;;){
X		lsp = yylstate;
X		yyestate = yystate = yybgin;
X		if (yyprevious==YYNEWLINE) yystate++;
X		for (;;){
X# ifdef LEXDEBUG
X			if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
X# endif
X			yyt = yystate->yystoff;
X			if(yyt == yycrank && !yyfirst){  /* may not be any transitions */
X				yyz = yystate->yyother;
X				if(yyz == 0)break;
X				if(yyz->yystoff == yycrank)break;
X				}
X			*yylastch++ = yych = input();
X			yyfirst=0;
X		tryagain:
X# ifdef LEXDEBUG
X			if(debug){
X				fprintf(yyout,"char ");
X				allprint(yych);
X				putchar('\n');
X				}
X# endif
X			yyr = yyt;
X			if ( (int)yyt > (int)yycrank){
X				yyt = yyr + yych;
X				if (yyt <= yytop && yyt->verify+yysvec == yystate){
X					if(yyt->advance+yysvec == YYLERR)	/* error transitions */
X						{unput(*--yylastch);break;}
X					*lsp++ = yystate = yyt->advance+yysvec;
X					goto contin;
X					}
X				}
X# ifdef YYOPTIM
X			else if((int)yyt < (int)yycrank) {		/* r < yycrank */
X				yyt = yyr = yycrank+(yycrank-yyt);
X# ifdef LEXDEBUG
X				if(debug)fprintf(yyout,"compressed state\n");
X# endif
X				yyt = yyt + yych;
X				if(yyt <= yytop && yyt->verify+yysvec == yystate){
X					if(yyt->advance+yysvec == YYLERR)	/* error transitions */
X						{unput(*--yylastch);break;}
X					*lsp++ = yystate = yyt->advance+yysvec;
X					goto contin;
X					}
X				yyt = yyr + YYU(yymatch[yych]);
X# ifdef LEXDEBUG
X				if(debug){
X					fprintf(yyout,"try fall back character ");
X					allprint(YYU(yymatch[yych]));
X					putchar('\n');
X					}
X# endif
X				if(yyt <= yytop && yyt->verify+yysvec == yystate){
X					if(yyt->advance+yysvec == YYLERR)	/* error transition */
X						{unput(*--yylastch);break;}
X					*lsp++ = yystate = yyt->advance+yysvec;
X					goto contin;
X					}
X				}
X			if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
X# ifdef LEXDEBUG
X				if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
X# endif
X				goto tryagain;
X				}
X# endif
X			else
X				{unput(*--yylastch);break;}
X		contin:
X# ifdef LEXDEBUG
X			if(debug){
X				fprintf(yyout,"state %d char ",yystate-yysvec-1);
X				allprint(yych);
X				putchar('\n');
X				}
X# endif
X			;
X			}
X# ifdef LEXDEBUG
X		if(debug){
X			fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
X			allprint(yych);
X			putchar('\n');
X			}
X# endif
X		while (lsp-- > yylstate){
X			*yylastch-- = 0;
X			if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
X				yyolsp = lsp;
X				if(yyextra[*yyfnd]){		/* must backup */
X					while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
X						lsp--;
X						unput(*yylastch--);
X						}
X					}
X				yyprevious = YYU(*yylastch);
X				yylsp = lsp;
X				yyleng = yylastch-yytext+1;
X				yytext[yyleng] = 0;
X# ifdef LEXDEBUG
X				if(debug){
X					fprintf(yyout,"\nmatch ");
X					sprint(yytext);
X					fprintf(yyout," action %d\n",*yyfnd);
X					}
X# endif
X				return(*yyfnd++);
X				}
X			unput(*yylastch);
X			}
X		if (yytext[0] == 0  /* && feof(yyin) */)
X			{
X			yysptr=yysbuf;
X			return(0);
X			}
X		yyprevious = yytext[0] = input();
X		if (yyprevious>0)
X			output(yyprevious);
X		yylastch=yytext;
X# ifdef LEXDEBUG
X		if(debug)putchar('\n');
X# endif
X		}
X	}
Xyyback(p, m)
X	int *p;
X{
Xif (p==0) return(0);
Xwhile (*p)
X	{
X	if (*p++ == m)
X		return(1);
X	}
Xreturn(0);
X}
X	/* the following are only used in the lex library */
Xyyinput(){
X	return(input());
X	}
Xyyoutput(c)
X  int c; {
X	output(c);
X	}
Xyyunput(c)
X   int c; {
X	unput(c);
X	}
SHAR_EOF
if test 12196 -ne "`wc -c < lex.c`"
then
    echo shar: error transmitting "lex.c" '(should have been 12196 characters)'
fi
fi
if test -f 'list.c'
then
    echo shar: will not over-write existing file "list.c"
else
echo extracting "list.c"
sed 's/^X//' >list.c <<'SHAR_EOF'
X/*****************************************************************************/
X/**       Copyright 1988 by Evans & Sutherland Computer Corporation,        **/
X/**                          Salt Lake City, Utah                           **/
X/**  Portions Copyright 1989 by the Massachusetts Institute of Technology   **/
X/**                        Cambridge, Massachusetts                         **/
X/**                                                                         **/
X/**                           All Rights Reserved                           **/
X/**                                                                         **/
X/**    Permission to use, copy, modify, and distribute this software and    **/
X/**    its documentation  for  any  purpose  and  without  fee is hereby    **/
X/**    granted, provided that the above copyright notice appear  in  all    **/
X/**    copies and that both  that  copyright  notice  and  this  permis-    **/
X/**    sion  notice appear in supporting  documentation,  and  that  the    **/
X/**    names of Evans & Sutherland and M.I.T. not be used in advertising    **/
X/**    in publicity pertaining to distribution of the  software  without    **/
X/**    specific, written prior permission.                                  **/
X/**                                                                         **/
X/**    EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD    **/
X/**    TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES  OF  MERCHANT-    **/
X/**    ABILITY  AND  FITNESS,  IN  NO  EVENT SHALL EVANS & SUTHERLAND OR    **/
X/**    M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL  DAM-    **/
X/**    AGES OR  ANY DAMAGES WHATSOEVER  RESULTING FROM LOSS OF USE, DATA    **/
X/**    OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER    **/
X/**    TORTIOUS ACTION, ARISING OUT OF OR IN  CONNECTION  WITH  THE  USE    **/
X/**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
X/*****************************************************************************/
X
X
X/**********************************************************************
X *
X * $XConsortium: list.c,v 1.18 90/03/13 15:28:51 jim Exp $
X *
X * TWM code to deal with the name lists for the NoTitle list and
X * the AutoRaise list
X *
X * 11-Apr-88 Tom LaStrange        Initial Version.
X *
X **********************************************************************/
X
X#if !defined(lint) && !defined(SABER)
Xstatic char RCSinfo[]=
X"$XConsortium: list.c,v 1.18 90/03/13 15:28:51 jim Exp $";
X#endif
X
X#include <stdio.h>
X#include "twm.h"
X#include "screen.h"
X#include "gram.h"
X#include "list.h"
X
X/***********************************************************************
X *
X *  Procedure:
X *	AddToList - add a window name to the appropriate list
X *
X *  Inputs:
X *	list	- the address of the pointer to the head of a list
X *	name	- a pointer to the name of the window 
X *	ptr	- pointer to list dependent data
X *
X *  Special Considerations
X *	If the list does not use the ptr value, a non-null value 
X *	should be placed in it.  LookInList returns this ptr value
X *	and procedures calling LookInList will check for a non-null 
X *	return value as an indication of success.
X *
X ***********************************************************************
X */
X
Xvoid
XAddToList(list_head, name, ptr)
Xname_list **list_head;
Xchar *name;
Xchar *ptr;
X{
X    name_list *nptr;
X
X    if (!list_head) return;	/* ignore empty inserts */
X
X    nptr = (name_list *)malloc(sizeof(name_list));
X    if (nptr == NULL)
X    {
X	twmrc_error_prefix();
X	fprintf (stderr, "unable to allocate %d bytes for name_list\n",
X		 sizeof(name_list));
X	Done();
X    }
X
X    nptr->next = *list_head;
X    nptr->name = name;
X    nptr->namelen = strlen(name);
X    nptr->ptr = (ptr == NULL) ? (char *)TRUE : ptr;
X    *list_head = nptr;
X}    
X
X/***********************************************************************
X *
X *  Procedure:
X *	LookInList - look through a list for a window name, or class
X *
X *  Returned Value:
X *	the ptr field of the list structure or NULL if the name 
X *	or class was not found in the list
X *
X *  Inputs:
X *	list	- a pointer to the head of a list
X *	name	- a pointer to the name to look for
X *	class	- a pointer to the class to look for
X *
X ***********************************************************************
X */
X
Xchar *
XLookInList(list_head, name, class)
Xname_list *list_head;
Xchar *name;
XXClassHint *class;
X{
X    name_list *nptr;
X
X    /* look for the name first */
X    for (nptr = list_head; nptr != NULL; nptr = nptr->next)
X    {
X	if (strncmp(name, nptr->name, nptr->namelen) == 0)
X	    return (nptr->ptr);
X    }
X
X    if (class)
X    {
X	/* look for the res_name next */
X	for (nptr = list_head; nptr != NULL; nptr = nptr->next)
X	{
X	    if (strncmp(class->res_name, nptr->name, nptr->namelen) == 0)
X		return (nptr->ptr);
X	}
X
X	/* finally look for the res_class */
X	for (nptr = list_head; nptr != NULL; nptr = nptr->next)
X	{
X	    if (strncmp(class->res_class, nptr->name, nptr->namelen) == 0)
X		return (nptr->ptr);
X	}
X    }
X    return (NULL);
X}
X
Xchar *
XLookInNameList(list_head, name)
Xname_list *list_head;
Xchar *name;
X{
X    return (LookInList(list_head, name, NULL));
X}
X
X/***********************************************************************
X *
X *  Procedure:
X *	GetFromList - look through a list for a window name, or class
X *
X *  Returned Value:
X *	TRUE if the name was found
X *	FALSE if the name was not found
X *
X *  Inputs:
X *	list	- a pointer to the head of a list
X *	name	- a pointer to the name to look for
X *	class	- a pointer to the class to look for
X *
X *  Outputs:
X *	ptr	- fill in the list value if the name was found
X *
X ***********************************************************************
X */
X
Xint GetColorFromList(list_head, name, class, ptr)
Xname_list *list_head;
Xchar *name;
XXClassHint *class;
XPixel *ptr;
X{
X    int save;
X    name_list *nptr;
X
X    for (nptr = list_head; nptr != NULL; nptr = nptr->next)
X    {
X	int len;
X
X	len = strlen(nptr->name);
X	if (strncmp(name, nptr->name, len) == 0)
X	{
X	    save = Scr->FirstTime;
X	    Scr->FirstTime = TRUE;
X	    GetColor(Scr->Monochrome, ptr, nptr->ptr);
X	    Scr->FirstTime = save;
X	    return (TRUE);
X	}
X    }
X    if (class)
X    {
X	for (nptr = list_head; nptr != NULL; nptr = nptr->next)
X	{
X	    int len;
X
X	    len = strlen(nptr->name);
X	    if (strncmp(class->res_name, nptr->name, len) == 0)
X	    {
X		save = Scr->FirstTime;
X		Scr->FirstTime = TRUE;
X		GetColor(Scr->Monochrome, ptr, nptr->ptr);
X		Scr->FirstTime = save;
X		return (TRUE);
X	    }
X	}
X
X	for (nptr = list_head; nptr != NULL; nptr = nptr->next)
X	{
X	    int len;
X
X	    len = strlen(nptr->name);
X	    if (strncmp(class->res_class, nptr->name, len) == 0)
X	    {
X		save = Scr->FirstTime;
X		Scr->FirstTime = TRUE;
X		GetColor(Scr->Monochrome, ptr, nptr->ptr);
X		Scr->FirstTime = save;
X		return (TRUE);
X	    }
X	}
X    }
X    return (FALSE);
X}
X
X/***********************************************************************
X *
X *  Procedure:
X *	FreeList - free up a list
X *
X ***********************************************************************
X */
X
XFreeList(list)
Xname_list **list;
X{
X    name_list *nptr;
X    name_list *tmp;
X
X    for (nptr = *list; nptr != NULL; )
X    {
X	tmp = nptr->next;
X	free((char *) nptr);
X	nptr = tmp;
X    }
X    *list = NULL;
X}
SHAR_EOF
if test 7301 -ne "`wc -c < list.c`"
then
    echo shar: error transmitting "list.c" '(should have been 7301 characters)'
fi
fi
if test -f 'menus.h'
then
    echo shar: will not over-write existing file "menus.h"
else
echo extracting "menus.h"
sed 's/^X//' >menus.h <<'SHAR_EOF'
X/*****************************************************************************/
X/**       Copyright 1988 by Evans & Sutherland Computer Corporation,        **/
X/**                          Salt Lake City, Utah                           **/
X/**  Portions Copyright 1989 by the Massachusetts Institute of Technology   **/
X/**                        Cambridge, Massachusetts                         **/
X/**                                                                         **/
X/**                           All Rights Reserved                           **/
X/**                                                                         **/
X/**    Permission to use, copy, modify, and distribute this software and    **/
X/**    its documentation  for  any  purpose  and  without  fee is hereby    **/
X/**    granted, provided that the above copyright notice appear  in  all    **/
X/**    copies and that both  that  copyright  notice  and  this  permis-    **/
X/**    sion  notice appear in supporting  documentation,  and  that  the    **/
X/**    names of Evans & Sutherland and M.I.T. not be used in advertising    **/
X/**    in publicity pertaining to distribution of the  software  without    **/
X/**    specific, written prior permission.                                  **/
X/**                                                                         **/
X/**    EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD    **/
X/**    TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES  OF  MERCHANT-    **/
X/**    ABILITY  AND  FITNESS,  IN  NO  EVENT SHALL EVANS & SUTHERLAND OR    **/
X/**    M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL  DAM-    **/
X/**    AGES OR  ANY DAMAGES WHATSOEVER  RESULTING FROM LOSS OF USE, DATA    **/
X/**    OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER    **/
X/**    TORTIOUS ACTION, ARISING OUT OF OR IN  CONNECTION  WITH  THE  USE    **/
X/**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
X/*****************************************************************************/
X
X
X/***********************************************************************
X *
X * $XConsortium: menus.h,v 1.24 89/12/10 17:46:26 jim Exp $
X *
X * twm menus include file
X *
X * 17-Nov-87 Thomas E. LaStrange		File created
X *
X ***********************************************************************/
X
X#ifndef _MENUS_
X#define _MENUS_
X
X#define TWM_ROOT	"bLoB_GoOp"	/* my private root menu */
X#define TWM_WINDOWS	"TwmWindows"	/* for f.menu "TwmWindows" */
X
X#define MAX_FILE_SIZE 4096	/* max chars to read from file for cut */
X
Xtypedef struct MenuItem
X{
X    struct MenuItem *next;	/* next menu item */
X    struct MenuItem *prev;	/* prev menu item */
X    struct MenuRoot *sub;	/* MenuRoot of a pull right menu */
X    struct MenuRoot *root;	/* back pointer to my MenuRoot */
X    char *item;			/* the character string displayed */
X    char *action;		/* action to be performed */
X    Pixel fore;			/* foreground color */
X    Pixel back;			/* background color */
X    Pixel hi_fore;		/* highlight foreground */
X    Pixel hi_back;		/* highlight background */
X    short item_num;		/* item number of this menu */
X    short x;			/* x coordinate for text */
X    short func;			/* twm built in function */
X    short state;		/* video state, 0 = normal, 1 = reversed */
X    short strlen;		/* strlen(item) */
X    short user_colors;		/* colors were specified */
X} MenuItem;
X
Xtypedef struct MenuRoot
X{
X    struct MenuItem *first;	/* first item in menu */
X    struct MenuItem *last;	/* last item in menu */
X    struct MenuRoot *prev;	/* previous root menu if pull right */
X    struct MenuRoot *next;	/* next in list of root menus */
X    char *name;			/* name of root */
X    Window w;			/* the window of the menu */
X    Window shadow;		/* the shadow window */
X    Pixel hi_fore;		/* highlight foreground */
X    Pixel hi_back;		/* highlight background */
X    short mapped;		/* NEVER_MAPPED, UNMAPPED, or MAPPED */
X    short height;		/* height of the menu */
X    short width;		/* width of the menu */
X    short items;		/* number of items in the menu */
X    short pull;			/* is there a pull right entry ? */
X    short entered;		/* EnterNotify following pop up */
X    short real_menu;		/* this is a real menu */
X} MenuRoot;
X
X#define NEVER_MAPPED	0	/* constants for mapped field of MenuRoot */
X#define UNMAPPED	1
X#define MAPPED		2
X
X
Xtypedef struct MouseButton
X{
X    int func;			/* the function number */
X    int mask;			/* modifier mask */
X    MenuRoot *menu;		/* menu if func is F_MENU */
X    MenuItem *item;		/* action to perform if func != F_MENU */
X} MouseButton;
X
Xtypedef struct FuncKey
X{
X    struct FuncKey *next;	/* next in the list of function keys */
X    char *name;			/* key name */
X    KeySym keysym;		/* X keysym */
X    KeyCode keycode;		/* X keycode */
X    int cont;			/* context */
X    int mods;			/* modifiers */
X    int func;			/* function to perform */
X    char *win_name;		/* window name (if any) */
X    char *action;		/* action string (if any) */
X} FuncKey;
X
Xextern int RootFunction;
Xextern MenuRoot *ActiveMenu;
Xextern MenuItem *ActiveItem;
Xextern int MoveFunction;
Xextern int WindowMoved;
Xextern int ConstMove;
Xextern int ConstMoveDir;
Xextern int ConstMoveX;
Xextern int ConstMoveY;
Xextern int ConstMoveXL;
Xextern int ConstMoveXR;
Xextern int ConstMoveYT;
Xextern int ConstMoveYB;
X
X#define MAXMENUDEPTH	10	/* max number of nested menus */
Xextern int MenuDepth;
X
X#define MOVE_NONE	0	/* modes of constrained move */
X#define MOVE_VERT	1
X#define MOVE_HORIZ	2
X
X#define WARPSCREEN_NEXT "next"
X#define WARPSCREEN_PREV "prev"
X#define WARPSCREEN_BACK "back"
X
X#define COLORMAP_NEXT "next"
X#define COLORMAP_PREV "prev"
X#define COLORMAP_DEFAULT "default"
X
Xextern void InitTitlebarButtons();
Xextern void InitMenus();
Xextern MenuRoot *NewMenuRoot();
Xextern MenuItem *AddToMenu();
Xextern Bool PopUpMenu();
Xextern MenuRoot *FindMenuRoot();
Xextern Bool AddFuncKey();
Xextern int ExecuteFunction();
Xextern int DeferExecution();
Xextern void Execute();
Xextern void FocusOnRoot();
X
X#endif /* _MENUS_ */
SHAR_EOF
if test 6044 -ne "`wc -c < menus.h`"
then
    echo shar: error transmitting "menus.h" '(should have been 6044 characters)'
fi
fi
if test -f 'move.c'
then
    echo shar: will not over-write existing file "move.c"
else
echo extracting "move.c"
sed 's/^X//' >move.c <<'SHAR_EOF'
X/*****************************************************************************/
X/**               Copyright 1990 by Solbourne Computer Inc.                 **/
X/**                          Longmont, Colorado                             **/
X/**                                                                         **/
X/**                           All Rights Reserved                           **/
X/**                                                                         **/
X/**    Permission to use, copy, modify, and distribute this software and    **/
X/**    its documentation  for  any  purpose  and  without  fee is hereby    **/
X/**    granted, provided that the above copyright notice appear  in  all    **/
X/**    copies and that both  that  copyright  notice  and  this  permis-    **/
X/**    sion  notice appear in supporting  documentation,  and  that  the    **/
X/**    name of Solbourne not be used in advertising                         **/
X/**    in publicity pertaining to distribution of the  software  without    **/
X/**    specific, written prior permission.                                  **/
X/**                                                                         **/
X/**    SOLBOURNE COMPUTER INC. DISCLAIMS ALL WARRANTIES WITH REGARD         **/
X/**    TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES  OF  MERCHANT-    **/
X/**    ABILITY  AND  FITNESS,  IN  NO  EVENT SHALL SOLBOURNE                **/
X/**    BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL  DAM-           **/
X/**    AGES OR  ANY DAMAGES WHATSOEVER  RESULTING FROM LOSS OF USE, DATA    **/
X/**    OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER    **/
X/**    TORTIOUS ACTION, ARISING OUT OF OR IN  CONNECTION  WITH  THE  USE    **/
X/**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
X/*****************************************************************************/
X
X/**********************************************************************
X *
X * $XConsortium: move.c,v 1.140 90/03/23 11:42:33 jim Exp $
X *
X * New window move code to allow interaction with the virtual desktop
X * All of this code came from the Solbourne Window Manager (swm)
X *
X * 23-Aug-90 Tom LaStrange        Initial Version.
X *
X **********************************************************************/
X
X#if !defined(lint) && !defined(SABER)
Xstatic char RCSinfo[]=
X"$XConsortium: move.c,v 1.140 90/03/23 11:42:33 jim Exp $";
X#endif
X
X#include <stdio.h>
X#include <X11/X.h>
X#include <X11/Xatom.h>
X#include "twm.h"
X#include "screen.h"
X#include "vdt.h"
X#include "move.h"
X#include "events.h"
X
Xstatic int dragX;
Xstatic int dragY;
Xstatic int origX;
Xstatic int origY;
Xstatic unsigned int dragWidth;
Xstatic unsigned int dragHeight;
Xstatic unsigned int dragBW;
Xstatic int dragBW2;
Xstatic int diffX;
Xstatic int diffY;
Xstatic Window outlineWindow;
Xstatic int scale;
Xstatic int titleHeight;
Xstatic int doingMove = False;
X
Xstatic void reallyStartMove();
Xstatic void doMove();
Xstatic void getPointer();
X
X/***********************************************************************
X *
X *  Procedure:
X *	DragFrame - move the window frame
X *	
X *  Returned Value:
X *	None
X *
X ***********************************************************************
X */
X
Xvoid
XDragFrame(tmp_win, ev, pulldown)
XTwmWindow *tmp_win;
XXButtonEvent *ev;
Xint pulldown;
X{
X    int cancel;
X    int x_root, y_root;
X
X    x_root = ev->x_root;
X    y_root = ev->y_root;
X    StartMove(tmp_win, tmp_win->frame, tmp_win->title_height,
X	&x_root, &y_root, &cancel, OUT_PANNER, 1, 0, 0, False, pulldown);
X
X    if (!cancel && WindowMoved) {
X	SetupWindow (tmp_win, x_root, y_root,
X	     tmp_win->frame_width, tmp_win->frame_height, -1);
X    }
X}
X
X/***********************************************************************
X *
X *  Procedure:
X *	DragIcon - move the window icon
X *	
X *  Returned Value:
X *	None
X *
X ***********************************************************************
X */
X
Xvoid
XDragIcon(tmp_win, ev, pulldown)
XTwmWindow *tmp_win;
XXButtonEvent *ev;
Xint pulldown;
X{
X    int cancel;
X    int x_root, y_root;
X
X    x_root = ev->x_root;
X    y_root = ev->y_root;
X    StartMove(tmp_win, tmp_win->icon_w, 0, &x_root, &y_root, &cancel,
X	OUT_PANNER, 1, 0, 0, False, pulldown);
X
X    if (!cancel && WindowMoved) {
X	MoveIcon(tmp_win, x_root, y_root);
X    }
X}
X
X/***********************************************************************
X *
X *  Procedure:
X *	StartMove - start a move operation on an icon or a frame
X *	
X *  Returned Value:
X *	None
X *
X ***********************************************************************
X */
X
Xvoid
XStartMove(tmp_win, window, title_height, x_root, y_root, cancel,
X    panner, move_scale, objWidth, objHeight, adding, pulldown)
XTwmWindow *tmp_win;
XWindow window;
Xint title_height;
Xint *x_root;
Xint *y_root;
Xint *cancel;
Xint panner;
Xint move_scale;
Xunsigned objWidth;	/* if IN_PANNER */
Xunsigned objHeight;	/* if IN_PANNER */
Xint adding;		/* adding a window from add_window() */
Xint pulldown;		/* moving window from a pulldown menu */
X{
X    Window junkRoot, junkChild;
X    unsigned int junkDepth, numChildren;
X    int junkX, junkY;
X    int junkxroot, junkyroot;
X    unsigned int junkMask;
X    int first;
X
X    if (!Scr->NoGrabServer || !Scr->OpaqueMove)
X	XGrabServer(dpy);
X
X    if (!adding) {
X	XGrabPointer(dpy, Scr->Root, True,
X	    PointerMotionMask | EnterWindowMask | LeaveWindowMask | ButtonPressMask | ButtonReleaseMask,
X	    GrabModeAsync, GrabModeAsync,
X	    Scr->Root, Scr->MoveCursor, CurrentTime);
X    }
X
X    /* how big is this thing we are moving? */
X    XGetGeometry(dpy, window, &junkRoot, &junkX, &junkY, &dragWidth, &dragHeight, &dragBW, &junkDepth);
X    origX = junkX;
X    origY = junkY;
X
X    /* translate its coordinates to root coordinates */
X    XTranslateCoordinates(dpy, window, Scr->Root, -dragBW, -dragBW, &dragX, &dragY, &junkChild);
X
X    dragBW2 = 2 * dragBW;
X    dragWidth += dragBW2;
X    dragHeight += dragBW2;
X    diffX = dragX - *x_root;
X    diffY = dragY - *y_root;
X
X    /* translate the real root coordinates to our root coordinates */
X    if (tmp_win->root != Scr->Root) {
X	XTranslateCoordinates(dpy, Scr->Root, tmp_win->root, dragX, dragY, x_root, y_root, &junkChild);
X    }
X
X    if (tmp_win->root != Scr->Root && !Scr->OpaqueMove)
X	doingMove = True;
X    outlineWindow = tmp_win->root;
X    scale = move_scale;
X
X    if (panner == OUT_PANNER)
X    {
X	titleHeight = title_height;
X	objWidth = dragWidth;
X	objHeight = dragHeight;
X    }
X    else
X    {
X	titleHeight = 0;
X    }
X
X    first = True;
X    while (True)
X    {
X	*cancel = False;
X	reallyStartMove(tmp_win, window, x_root, y_root, cancel, outlineWindow, &first, adding, pulldown);
X
X	if (*cancel == IN_PANNER)
X	{
X	    panner = IN_PANNER;
X	    dragWidth /= Scr->PannerScale;
X	    dragHeight /= Scr->PannerScale;
X	    diffX /= Scr->PannerScale;
X	    diffY /= Scr->PannerScale;
X	    outlineWindow = Scr->Panner;
X	    scale = Scr->PannerScale;
X	    titleHeight = 0;
X	}
X	else if (*cancel == OUT_PANNER)
X	{
X	    panner = OUT_PANNER;
X	    dragWidth = objWidth;
X	    dragHeight = objHeight;
X	    diffX *= Scr->PannerScale;
X	    diffY *= Scr->PannerScale;
X	    outlineWindow = Scr->VirtualDesktop;
X	    scale = 1;
X	    titleHeight = title_height;
X	}
X	else
X	    break;
X    }
X
X    if (panner == IN_PANNER)
X    {
X	*x_root *= Scr->PannerScale;
X	*y_root *= Scr->PannerScale;
X    }
X    doingMove = False;
X    if (!adding)
X    {
X	XUngrabPointer(dpy, CurrentTime);
X	XUngrabServer(dpy);
X    }
X}
X
X/***********************************************************************
X *
X *  Procedure:
X *	reallyStartMove - do the meat of the move operation
X *	
X *  Returned Value:
X *	None
X *
X ***********************************************************************
X */
X
Xstatic void
XreallyStartMove(tmp_win, window, x_root, y_root,
X    cancel, outlineWindow, first, adding, pulldown)
XTwmWindow *tmp_win;
XWindow window;
Xint *x_root;
Xint *y_root;
Xint *cancel;
XWindow outlineWindow;
Xint *first;
Xint adding;
Xint pulldown;
X{
X    int xdest, ydest;
X    int done;
X
X    xdest = *x_root;
X    ydest = *y_root;
X    done = False;
X
X    /* put up the initial outline if adding a window */
X    if (*first && adding)
X	doMove(tmp_win, window, *x_root, *y_root, &xdest, &ydest);
X	
X    while (True) {
X	getPointer(outlineWindow, x_root, y_root, cancel, &done, first, adding, pulldown);
X	if (done)
X	    break;
X	if (!*cancel)
X	    doMove(tmp_win, window, *x_root, *y_root, &xdest, &ydest);
X    }
X
X    if (*cancel)
X	WindowMoved = False;
X
X    *x_root = xdest;
X    *y_root = ydest;
X}
X
Xstatic void
XdoMove(tmp_win, window, x_root, y_root, x_dest, y_dest)
XTwmWindow *tmp_win;
XWindow window;
Xint x_root;
Xint y_root;
Xint *x_dest;
Xint *y_dest;
X{
X    int xl, yt;
X    int deltax, deltay;
X    char str[20];
X
X    dragX = x_root;
X    dragY = y_root;
X
X    xl = dragX + diffX;
X    yt = dragY + diffY;
X
X    deltax = xl - origX/scale;
X    deltay = yt - origY/scale;
X
X#ifdef NOT_YET
X    if (wp->constrain())
X    {
X	if (xl < 0)
X	    xl = 0;
X	else if ((xl + dragWidth) > wp->root()->size_x())
X	    xl = wp->root()->size_x() - dragWidth;
X
X	if (yt < 0)
X	    yt = 0;
X	else if ((yt + dragHeight) > wp->root()->size_y())
X	    yt = wp->root()->size_y() - dragHeight;
X    }
X
X    if (wmMoveOpaque)
X	oi->set_loc(xl, yt);
X    else 
X    {
X	rectcount = 0;
X	if (numRectangles == 1)
X	{
X	    rects[0].x = xl;
X	    rects[0].y = yt;
X	    rects[0].width = dragWidth;
X	    rects[0].height = dragHeight;
X	    rectcount = 1;
X	}
X	else
X	{
X	    for (i = 1; i < wmSweptCount; i++)
X	    {
X		if (wmSwept[i] && wmSwept[i]->state() == OI_ACTIVE)
X		{
X		    rects[rectcount].x = wmSwept[i]->loc_x()/xRatio + deltax;
X		    rects[rectcount].y = wmSwept[i]->loc_y()/yRatio + deltay;
X		    rects[rectcount].width = wmSwept[i]->space_x()/xRatio;
X		    rects[rectcount].height = wmSwept[i]->space_y()/yRatio;
X		    rectcount++;
X		}
X	    }
X	}
X	wmMoveOutline(outlineWindow, rectcount, rects);
X    }
X    sprintf(str, " %5d, %-5d  ", xl*xRatio, yt*yRatio);
X    XRaiseWindow(DPY, wmScr->sizeOI->outside_X_window());
X    wmScr->sizeOI->set_text(str);
X#endif NOT_YET
X
X    MoveOutline(outlineWindow, xl, yt, dragWidth, dragHeight, 0, titleHeight);
X
X    *x_dest = xl;
X    *y_dest = yt;
X}
X
Xstatic void
XgetPointer(window, x_root, y_root, cancel, done, first, adding, pulldown)
Xint *x_root;
Xint *y_root;
Xint *cancel;
Xint *done;
Xint *first;
Xint adding;
Xint pulldown;
X{
X    Window junkChild;
X    int doingFine;
X    XEvent event;
X    int xdest, ydest;
X    unsigned mask;
X    static int firstX, firstY;
X    static int buttons;
X
X    if (*first) {
X	*first = False;
X	firstX = *x_root;
X	firstY = *y_root;
X	buttons = 0;
X    }
X
X    doingFine = True;
X    while (doingFine) {
X	XMaskEvent(dpy, ButtonPressMask|ButtonReleaseMask|PointerMotionMask|EnterWindowMask|LeaveWindowMask, &event);
X	switch (event.type) {
X	    case ButtonPress:
X		if (pulldown) {
X		    if (buttons++)
X			pulldown = False;
X		}
X		if (!pulldown) {
X		    *cancel = event.xbutton.button;
X		    doingFine = False;
X		    MoveOutline(outlineWindow, 0,0,0,0,0,0);
X		    if (adding) {
X			*done = True;
X		    }
X		    else {
X			XGrabPointer(dpy, Scr->Root, True,
X			    ButtonPressMask | ButtonReleaseMask,
X			    GrabModeAsync, GrabModeAsync,
X			    Scr->Root, Scr->WaitCursor, CurrentTime);
X		    }
X		}
X		break;
X	    case ButtonRelease:
X		MoveOutline(outlineWindow, 0,0,0,0,0,0);
X
X                /* clear the mask bit for the button just released */
X                mask = (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask);
X                switch (event.xbutton.button)
X                {
X                    case Button1: mask &= ~Button1Mask; break;
X                    case Button2: mask &= ~Button2Mask; break;
X                    case Button3: mask &= ~Button3Mask; break;
X                    case Button4: mask &= ~Button4Mask; break;
X                    case Button5: mask &= ~Button5Mask; break;
X                }
X
X                /* if all buttons have been released */
X                if ((event.xbutton.state & mask) == 0)
X                {
X		    ButtonPressed = -1;
X                    *done = True;
X		    doingFine = False;
X		}
X		break;
X	    case EnterNotify:
X                if (doingMove && event.xcrossing.window == Scr->Panner && event.xcrossing.detail != NotifyInferior)
X                {
X                    MoveOutline(outlineWindow, 0,0,0,0,0,0);
X                    *cancel = IN_PANNER;
X                    *done = True;
X		    doingFine = False;
X                }
X		break;
X	    case LeaveNotify:
X                if (doingMove && event.xcrossing.window == Scr->Panner &&
X		    event.xcrossing.detail != NotifyInferior && event.xcrossing.mode == NotifyNormal)
X                {
X                    MoveOutline(outlineWindow, 0,0,0,0,0,0);
X                    *cancel = OUT_PANNER;
X                    *done = True;
X		    doingFine = False;
X                }
X		break;
X	    case MotionNotify:
X		if (!WindowMoved &&
X		    abs(event.xmotion.x_root - firstX) >= Scr->MoveDelta &&
X		    abs(event.xmotion.y_root - firstY) >= Scr->MoveDelta)
X		{
X		    WindowMoved = True;
X		}
X		if (WindowMoved) {
X		    *x_root = event.xmotion.x_root;
X		    *y_root = event.xmotion.y_root;
X		    if (window != Scr->Root) {
X			if (window != Scr->VirtualDesktop || (Scr->vdtPositionX != 0 || Scr->vdtPositionY != 0)) {
X			    XTranslateCoordinates(dpy, Scr->Root, window,
X				event.xbutton.x_root, event.xbutton.y_root,
X				x_root, y_root, &junkChild);
X			}
X		    }
X		    doingFine = False;
X		}
X		break;
X	}
X    }
X}
SHAR_EOF
if test 13403 -ne "`wc -c < move.c`"
then
    echo shar: error transmitting "move.c" '(should have been 13403 characters)'
fi
fi
if test -f 'parse.h'
then
    echo shar: will not over-write existing file "parse.h"
else
echo extracting "parse.h"
sed 's/^X//' >parse.h <<'SHAR_EOF'
X/*****************************************************************************/
X/**       Copyright 1988 by Evans & Sutherland Computer Corporation,        **/
X/**                          Salt Lake City, Utah                           **/
X/**  Portions Copyright 1989 by the Massachusetts Institute of Technology   **/
X/**                        Cambridge, Massachusetts                         **/
X/**                                                                         **/
X/**                           All Rights Reserved                           **/
X/**                                                                         **/
X/**    Permission to use, copy, modify, and distribute this software and    **/
X/**    its documentation  for  any  purpose  and  without  fee is hereby    **/
X/**    granted, provided that the above copyright notice appear  in  all    **/
X/**    copies and that both  that  copyright  notice  and  this  permis-    **/
X/**    sion  notice appear in supporting  documentation,  and  that  the    **/
X/**    names of Evans & Sutherland and M.I.T. not be used in advertising    **/
X/**    in publicity pertaining to distribution of the  software  without    **/
X/**    specific, written prior permission.                                  **/
X/**                                                                         **/
X/**    EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD    **/
X/**    TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES  OF  MERCHANT-    **/
X/**    ABILITY  AND  FITNESS,  IN  NO  EVENT SHALL EVANS & SUTHERLAND OR    **/
X/**    M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL  DAM-    **/
X/**    AGES OR  ANY DAMAGES WHATSOEVER  RESULTING FROM LOSS OF USE, DATA    **/
X/**    OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER    **/
X/**    TORTIOUS ACTION, ARISING OUT OF OR IN  CONNECTION  WITH  THE  USE    **/
X/**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
X/*****************************************************************************/
X
X
X/**********************************************************************
X *
X * $XConsortium: parse.h,v 1.14 89/12/14 14:51:25 jim Exp $
X *
X * .twmrc parsing externs
X *
X *  8-Apr-88 Tom LaStrange        Initial Version.
X *
X **********************************************************************/
X
X#ifndef _PARSE_
X#define _PARSE_
X
Xextern int ParseTwmrc(), ParseStringList();
Xextern int (*twmInputFunc)();
Xextern void twmUnput();
Xextern void TwmOutput();
X
X#define F_NOP			0
X#define F_BEEP			1
X#define F_RESTART		2
X#define F_QUIT			3
X#define F_FOCUS			4
X#define F_REFRESH		5
X#define F_WINREFRESH		6
X#define F_DELTASTOP		7
X#define F_MOVE			8
X#define F_POPUP			9
X#define F_FORCEMOVE		10
X#define F_AUTORAISE		11
X#define F_IDENTIFY		12
X#define F_ICONIFY		13
X#define F_DEICONIFY		14
X#define F_UNFOCUS		15
X#define F_RESIZE		16
X#define F_ZOOM			17
X#define F_LEFTZOOM		18
X#define F_RIGHTZOOM		19
X#define F_TOPZOOM		20
X#define F_BOTTOMZOOM		21
X#define F_HORIZOOM		22
X#define F_FULLZOOM		23
X#define F_RAISE			24
X#define F_RAISELOWER		25
X#define F_LOWER			26
X#define F_DESTROY		27
X#define F_DELETE		28
X#define F_SAVEYOURSELF		29
X#define F_VERSION		30
X#define F_TITLE			31
X#define F_RIGHTICONMGR		32
X#define F_LEFTICONMGR		33
X#define F_UPICONMGR		34
X#define F_DOWNICONMGR		35
X#define F_FORWICONMGR		36
X#define F_BACKICONMGR		37
X#define F_NEXTICONMGR		38
X#define F_PREVICONMGR		39
X#define F_SORTICONMGR		40
X#define F_CIRCLEUP		41
X#define F_CIRCLEDOWN		42
X#define F_CUTFILE		43
X#define F_SHOWLIST		44
X#define F_HIDELIST		45
X#define F_STICK			46
X#define F_SCROLLHOME		47
X#define F_SCROLLRIGHT		48
X#define F_SCROLLLEFT		49
X#define F_SCROLLDOWN		50
X#define F_SCROLLUP		51
X#define F_PANNER		52
X
X#define F_MENU			101	/* string */
X#define F_WARPTO		102	/* string */
X#define F_WARPTOICONMGR		103	/* string */
X#define F_WARPRING		104	/* string */
X#define F_FILE			105	/* string */
X#define F_EXEC			106	/* string */
X#define F_CUT			107	/* string */
X#define F_FUNCTION		108	/* string */
X#define F_WARPTOSCREEN		109	/* string */
X#define F_COLORMAP		110	/* string */
X
X#define D_NORTH			1
X#define D_SOUTH			2
X#define D_EAST			3
X#define D_WEST			4
X
X#endif /* _PARSE_ */
SHAR_EOF
if test 4219 -ne "`wc -c < parse.h`"
then
    echo shar: error transmitting "parse.h" '(should have been 4219 characters)'
fi
fi
if test -f 'resize.h'
then
    echo shar: will not over-write existing file "resize.h"
else
echo extracting "resize.h"
sed 's/^X//' >resize.h <<'SHAR_EOF'
X/*****************************************************************************/
X/**       Copyright 1988 by Evans & Sutherland Computer Corporation,        **/
X/**                          Salt Lake City, Utah                           **/
X/**  Portions Copyright 1989 by the Massachusetts Institute of Technology   **/
X/**                        Cambridge, Massachusetts                         **/
X/**                                                                         **/
X/**                           All Rights Reserved                           **/
X/**                                                                         **/
X/**    Permission to use, copy, modify, and distribute this software and    **/
X/**    its documentation  for  any  purpose  and  without  fee is hereby    **/
X/**    granted, provided that the above copyright notice appear  in  all    **/
X/**    copies and that both  that  copyright  notice  and  this  permis-    **/
X/**    sion  notice appear in supporting  documentation,  and  that  the    **/
X/**    names of Evans & Sutherland and M.I.T. not be used in advertising    **/
X/**    in publicity pertaining to distribution of the  software  without    **/
X/**    specific, written prior permission.                                  **/
X/**                                                                         **/
X/**    EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD    **/
X/**    TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES  OF  MERCHANT-    **/
X/**    ABILITY  AND  FITNESS,  IN  NO  EVENT SHALL EVANS & SUTHERLAND OR    **/
X/**    M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL  DAM-    **/
X/**    AGES OR  ANY DAMAGES WHATSOEVER  RESULTING FROM LOSS OF USE, DATA    **/
X/**    OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER    **/
X/**    TORTIOUS ACTION, ARISING OUT OF OR IN  CONNECTION  WITH  THE  USE    **/
X/**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
X/*****************************************************************************/
X
X
X/**********************************************************************
X *
X * $XConsortium: resize.h,v 1.7 90/03/23 11:42:32 jim Exp $
X *
X * resize function externs
X *
X *  8-Apr-88 Tom LaStrange        Initial Version.
X *
X **********************************************************************/
X
X#ifndef _RESIZE_
X#define _RESIZE_
X
Xextern void StartResize();
Xextern void AddStartResize();
Xextern void DoResize();
Xextern void DisplaySize();
Xextern void EndResize();
Xextern void AddEndResize();
Xextern void SetupWindow();
Xextern void SetupFrame();
Xextern void SendSyntheticConfigureNotify();
X
X#endif /* _RESIZE_ */
X
Xextern void fullzoom();
SHAR_EOF
if test 2719 -ne "`wc -c < resize.h`"
then
    echo shar: error transmitting "resize.h" '(should have been 2719 characters)'
fi
fi
if test -f 'system.twmrc'
then
    echo shar: will not over-write existing file "system.twmrc"
else
echo extracting "system.twmrc"
sed 's/^X//' >system.twmrc <<'SHAR_EOF'
X#
X# $XConsortium: system.twmrc,v 1.7 89/12/01 11:23:47 jim Exp $
X# 
X# Default twm configuration file; needs to be kept small to conserve string
X# space in systems whose compilers don't handle medium-sized strings.
X#
X# Sites should tailor this file, providing any extra title buttons, menus, etc.
X# that may be appropriate for their environment.  For example, if most of the
X# users were accustomed to uwm, the defaults could be set up not to decorate
X# any windows and to use meta-keys.
X#
X
XNoGrabServer
XDecorateTransients
XTitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"
XResizeFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"
XMenuFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"
XIconFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*"
XIconManagerFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*"
X#ClientBorderWidth
X
XColor
X{
X    BorderColor "slategrey"
X    DefaultBackground "maroon"
X    DefaultForeground "gray85"
X    TitleBackground "maroon"
X    TitleForeground "gray85"
X    MenuBackground "maroon"
X    MenuForeground "gray85"
X    MenuTitleBackground "gray70"
X    MenuTitleForeground "maroon"
X    IconBackground "maroon"
X    IconForeground "gray85"
X    IconBorderColor "gray85"
X    IconManagerBackground "maroon"
X    IconManagerForeground "gray85"
X}
X
X#
X# Define some useful functions for motion-based actions.
X#
XMoveDelta 3
XFunction "move-or-lower" { f.move f.deltastop f.lower }
XFunction "move-or-raise" { f.move f.deltastop f.raise }
XFunction "move-or-iconify" { f.move f.deltastop f.iconify }
X
X#
X# Set some useful bindings.  Sort of uwm-ish, sort of simple-button-ish
X#
XButton1 = : root : f.menu "defops"
X
XButton1 = m : window|icon : f.function "move-or-lower"
XButton2 = m : window|icon : f.iconify
XButton3 = m : window|icon : f.function "move-or-raise"
X
XButton1 = : title : f.function "move-or-raise"
XButton2 = : title : f.raiselower
X
XButton1 = : icon : f.function "move-or-iconify"
XButton2 = : icon : f.iconify
X
XButton1 = : iconmgr : f.iconify
XButton2 = : iconmgr : f.iconify
X
X#
X# And a menus with the usual things
X#
Xmenu "defops"
X{
X"Twm"	f.title
X"Iconify"	f.iconify
X"Resize"	f.resize
X"Move"		f.move
X"Raise"		f.raise
X"Lower"		f.lower
X""		f.nop
X"Focus"		f.focus
X"Unfocus"	f.unfocus
X"Show Iconmgr"	f.showiconmgr
X"Hide Iconmgr"	f.hideiconmgr
X""		f.nop
X"Kill"		f.destroy
X"Delete"	f.delete
X""		f.nop
X"Restart"	f.restart
X"Exit"		f.quit
X}
SHAR_EOF
if test 2373 -ne "`wc -c < system.twmrc`"
then
    echo shar: error transmitting "system.twmrc" '(should have been 2373 characters)'
fi
fi
# end of shell archive
exit 0

dan
----------------------------------------------------
O'Reilly && Associates   argv@sun.com / argv@ora.com
Opinions expressed reflect those of the author only.