v05i054: Xrooms -- A Rooms implementation for X, Part04/14
Kent Landfield
kent at ssbell.IMD.Sterling.COM
Mon Jan 15 17:07:38 AEST 1990
Submitted-by: wsl.dec.com!mikey (Mike Yang)
Posting-number: Volume 5, Issue 54
Archive-name: xrooms/part04
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 4 (of 14)."
# Contents: ./lib/profscan.h ./lib/rooms.c ./utils/Makefile
# ./utils/utils.c ./utils/utils.h ./xrooms/xrMain.c ./xrset/Makefile
# Wrapped by kent at ssbell on Sun Jan 14 21:57:42 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f './lib/profscan.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'./lib/profscan.h'\"
else
echo shar: Extracting \"'./lib/profscan.h'\" \(7311 characters\)
sed "s/^X//" >'./lib/profscan.h' <<'END_OF_FILE'
X#ifndef PROFSCAN_H
X#define PROFSCAN_H 1
X
X /*\
X * $Header: profscan.h,v 5.0 90/01/10 06:54:12 erik Exp $
X *
X * COPYRIGHT 1990
X * DIGITAL EQUIPMENT CORPORATION
X * MAYNARD, MASSACHUSETTS
X * ALL RIGHTS RESERVED.
X *
X * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
X * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
X * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE
X * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED
X * WARRANTY.
X *
X * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT
X * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN
X * ADDITION TO THAT SET FORTH ABOVE.
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 Digital Equipment Corporation not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X \*/
X
X /*\
X
X \*/
X
X /*\
X * Implements a "scannable object" class.
X * A Scannable traverses a string, named file, or file pointer
X * generating a stream of tokens until it reaches the end of the
X * stream or encounters an illegal character. An illegal character
X * is a character that is not contained in a token and is not a prefix
X * for one of the legal tokens.
X *
X * A scannableString ends at the first NUL it encounters, a
X * scannableFile, or scannableFileName ends at EOF.
X *
X * Most tokens represent keywords or punctuation marks, and have
X * no associated data.
X * The tokens: TOK_PROPERTY,TOK_STRING,TOK_IDENT, and TOK_COMMENT
X * also have an associated string value which may be retrieved
X * using "scanUseString."
X * The token TOK_GEOMETRY has an associated AppState, which may be
X * retrieved using "scanUseState."
X *
X * PUBLIC GLOBAL VARIABLES --
X * unsigned scanDebug;
X * A mask of debugging flags. The only flags currently used
X * are ENTER (0x10, defined in ../utils/utils.h) which tracks
X * function entry and exit, and DEBUG_TOKENS (0x08) which prints
X * out the value of each token as it is scanned.
X *
X * FUNCTIONS TO OPEN AND CLOSE A SCANNABLE --
X * ScannablePtr
X * scannableOpen( type, source )
X * unsigned type;
X * Opaque source; // (char *) or (FILE *)
X * Opens the "source" for scanning, and returns a pointer to
X * the new Scannable. If "type" is scannableString, "source"
X * is expected to contain a (char *) pointer to the string to
X * be scanned. If "type" is scannableFile, "source" should
X * contain a (FILE *) pointer to the file to be scanned; this
X * (FILE *) should already be open. If "type" is
X * scannableFileName, "source" should contain a (char *) pointer
X * to the name of the file to be scanned; scannableOpen will
X * try to open the named file.
X * Returns a pointer to the newly created Scannable, or
X * NullScannable if "source" is NULL, "type" is not a legal
X * value, or "type" is scannableFileName and scannableOpen
X * cannot open the named file.
X *
X * void
X * scannableClose( pScan )
X * ScannablePtr pScan;
X * Frees any memory associated with "pScan." If "pScan" is
X * of type scannableFileName, the associated file is closed
X * before "pScan" is freed. If "pScan" is of type
X * scannableFile or scannableString, the calling function is
X * expected to finalize the associated file or string. No
X * return value.
X *
X * FUNCTIONS TO GET TOKENS FROM A SCANNABLE --
X * int
X * scanPeek(pScan)
X * ScannablePtr pScan;
X * Peeks at the next token in the input stream. The stream
X * pointer is not moved, so successive Peeks will return the
X * same value. Returns the next token or TOK_END if "pScan"
X * is NullScannable.
X *
X * int
X * scanToken(pScan)
X * ScannablePtr pScan;
X * Returns the next token in the input stream. The stream
X * pointer is moved, so successive Scans may return different
X * values. Returns TOK_END if "pScan" is NullScannable.
X *
X * FUNCTIONS TO RETRIEVE VALUES ASSOCIATED WITH TOKENS --
X * char *
X * scanUseString(pScan)
X * ScannablePtr pScan;
X * Returns the string value associated with the most recently
X * scanned STRING, PROPERTY, COMMENT, or IDENT in "pScan."
X * The returned string is allocated and should be freed by
X * the calling function when it is no longer needed.
X * The "most recent string" field is cleared by this function,
X * so subsequent calls will not return the same value.
X * Returns NullString if "pScan" is NullScannable, or if none
X * of these tokens have been scanned after the last call to
X * scanUseString or "pScan" was opened.
X *
X * AppStatePtr
X * scanUseState(pScan)
X * ScannablePtr pScan;
X * Returns the AppStatePtr associated with the most recently
X * scanned GEOMETRY. The returned AppState is not static
X * and should be destroyed with asDestroy when it is no longer
X * needed. Like scanUseString, scanUseState clears the
X * "most recent geometry" field, so subsequent calls will not
X * return the same value. Returns NullAppState if "pScan" is
X * NullScannable, or if no GEOMETRY has been scanned since the
X * last call to scanUseState or "pScan" was opened.
X *
X * OTHER USEFUL FUNCTIONS --
X * int
X * scanLineNum(pScan)
X * ScannablePtr pScan;
X * Returns the current line number in "pScan," of -1 if pScan
X * is NullScannable;
X \*/
X
X#include "profile.h"
X
X#define TOK_END 0
X#define TOK_APPLICATION 1
X#define TOK_ROOM 2
X#define TOK_NAMES 3
X
X#define TOK_LBRACE 10
X#define TOK_RBRACE 11
X#define TOK_LBRACKET 12
X#define TOK_RBRACKET 13
X#define TOK_LPAREN 14
X#define TOK_RPAREN 15
X
X#define TOK_BOLT 20
X#define TOK_QUESTION 21
X#define TOK_EQUALS 22
X#define TOK_GETS 23
X#define TOK_PLUS 24
X#define TOK_SEMI 25
X#define TOK_COLON 26
X
X#define TOK_DEFAULT 30
X#define TOK_ICONIC 31
X#define TOK_NORMAL 32
X
X#define TOK_IF 200
X#define TOK_ELSE 201
X#define TOK_SWITCH 202
X#define TOK_CASE 203
X#define TOK_USE 204
X#define TOK_CLASS 205
X#define TOK_IGNORE 206
X
X#define TOK_VISIBLE 40
X#define TOK_HIDDEN 41
X#define TOK_ALWAYS 42
X#define TOK_WHEN_ACTIVE 43
X#define TOK_WHEN_NONEMPTY 44
X
X#define TOK_TRANSIENT 50
X#define TOK_PERMANENT 51
X
X#define TOK_PROPERTY 100
X#define TOK_STRING 101
X#define TOK_IDENT 102
X#define TOK_GEOMETRY 103
X#define TOK_COMMENT 104
X
Xtypedef struct _ScannableRec *ScannablePtr;
X#define NullScannable ((ScannablePtr)NULL)
X
X#define scannableFile ((unsigned)(1<<0))
X#define scannableFileName ((unsigned)(1<<1))
X#define scannableString ((unsigned)(1<<2))
X
X#define scannableDone ((unsigned)(1<<8))
X#define scannableEnd ((unsigned)(1<<9))
X
X#define DEBUG_TOKENS 0x08
Xextern unsigned scanDebug;
X
Xextern ScannablePtr scannableOpen(/* type, source */);
Xextern void scannableClose(/* pScan */);
X
Xextern int scanPeek(/* pScan */);
Xextern int scanToken(/* pScan */);
X
Xextern char *scanUseString(/* pScan */);
Xextern AppStatePtr scanUseState(/* pScan */);
X
Xextern int scanLineNum(/* pScan */);
X
X#endif /* PROFSCAN_H */
END_OF_FILE
if test 7311 -ne `wc -c <'./lib/profscan.h'`; then
echo shar: \"'./lib/profscan.h'\" unpacked with wrong size!
fi
# end of './lib/profscan.h'
fi
if test -f './lib/rooms.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'./lib/rooms.c'\"
else
echo shar: Extracting \"'./lib/rooms.c'\" \(7934 characters\)
sed "s/^X//" >'./lib/rooms.c' <<'END_OF_FILE'
X
X /*\
X * $Header: rooms.c,v 5.0 90/01/10 06:54:24 erik Exp $
X *
X * COPYRIGHT 1990
X * DIGITAL EQUIPMENT CORPORATION
X * MAYNARD, MASSACHUSETTS
X * ALL RIGHTS RESERVED.
X *
X * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
X * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
X * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE
X * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED
X * WARRANTY.
X *
X * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT
X * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN
X * ADDITION TO THAT SET FORTH ABOVE.
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 Digital Equipment Corporation not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X \*/
X
X#define DEBUG_VAR roomsDebug
X#include "utils.h"
X#include "strtbl.h"
X#include "hash.h"
X#include "apps.h"
X#include "rooms.h"
X#include "profile.h"
X
Xstatic HashTablePtr pAllRooms= NullHashTable;
Xstatic RoomPtr CurrentRoom= NullRoom;
Xstatic RoomFeedbackFunc DefaultFeedback= NULL;
Xstatic RoomFinderFunc DefaultFinder= NULL;
Xstatic int nRooms= 0;
X
X/***====================================================================***/
X
Xvoid
XDebugPrintRooms(name)
Xchar *name;
X{
XRoomPtr pRoom;
XOpaque rstate;
X
X uENTRY1("DebugPrintRooms(%s)\n",uStringText(name));
X if (pAllRooms!=NullHashTable) {
X if (name==NullString) {
X uDebug("All rooms:\n");
X uDebugIndent(1);
X RoomsIterator(pRoom,rstate) {
X roomDebugPrint(pRoom);
X }
X RoomsEndIterator(rstate);
X uDebugIndent(-1);
X }
X else {
X StringToken token;
X if (stGetTokenIfExists(name,&token)) {
X RoomPtr pRoom= (RoomPtr)htLookup(pAllRooms,(GenKey)token);
X if (pRoom!=NullRoom) {
X roomDebugPrint(pRoom);
X }
X else uDebug("Room %s doesn't exist\n",stText(token));
X }
X else uDebug("token %s undefined\n",uStringText(name));
X }
X }
X else uDebug("no rooms defined\n");
X uVOIDRETURN;
X}
X
X/***====================================================================***/
X
XRoomPtr
XLookupRoom(name)
XStringToken name;
X{
XRoomPtr pRoom= NullRoom;
X
X uENTRY1("LookupRoom(%s)\n",stText(name));
X if (pAllRooms!=NullHashTable) {
X pRoom= (RoomPtr)htLookup(pAllRooms,(GenKey)name);
X }
X uRETURN(pRoom);
X}
X
X/***====================================================================***/
X
Xint
XNumberOfRooms()
X{
X uENTRY("NumberOfRooms()\n");
X uRETURN(nRooms);
X}
X
X/***====================================================================***/
X
XRoomPtr
XCreateRoom(name)
XStringToken name;
X{
XRoomPtr pRoom= NullRoom;
X
X uENTRY1("CreateRoom(%s)\n",stText(name));
X if (pAllRooms!=NullHashTable) {
X pRoom= (RoomPtr)htLookup(pAllRooms,(GenKey)name);
X if (pRoom!=NullRoom) {
X uRETURN(NullRoom);
X }
X }
X else {
X pAllRooms= htCreate((unsigned)13,genIntegerKeyType,genPointerDataType);
X if (pAllRooms==NullHashTable) {
X uRETURN(NullRoom);
X }
X }
X
X pRoom= roomCreate(name,(Opaque)NULL,DefaultFeedback);
X if (pRoom!=NullRoom) { /* realize all active apps in the new room */
X (void)htAdd(pAllRooms,(GenKey)name,(GenData)pRoom);
X (void)ActiveAppsIterate((AppsIterFunc)roomManageApp,(Opaque)pRoom);
X (void)profileForRoom(name);
X }
X nRooms++;
X uRETURN(pRoom);
X}
X
X/***====================================================================***/
X
XBoolean
XDestroyRoom(pRoom)
XRoomPtr pRoom;
X{
XRoomPtr pStoredRoom;
X
X uENTRY1("DestroyRoom(%s)\n",roomText(pRoom));
X if ((pRoom!=NullRoom)&&(pAllRooms!=NullHashTable)) {
X if (pRoom==CurrentRoom) {
X CurrentRoom= NullRoom;
X }
X pStoredRoom= (RoomPtr)htRemove(pAllRooms,(GenKey)roomName(pRoom));
X if (pStoredRoom==pRoom) {
X roomDestroy(pRoom);
X nRooms--;
X uRETURN(True);
X }
X }
X uRETURN(False);
X}
X
X/***====================================================================***/
X
Xtypedef struct _RoomsIterArgRec {
X RoomsIterFunc func;
X Opaque arg;
X} RoomsIterArgRec,*RoomsIterArgPtr;
X
Xstatic Boolean
X_RoomsIterator(row,keyIn,dataIn,argIn)
Xint row;
XGenKey keyIn;
XGenData dataIn;
XOpaque argIn;
X{
XStringToken key= (StringToken)keyIn;
XRoomPtr pRoom= (RoomPtr)dataIn;
XRoomsIterArgPtr pArg= (RoomsIterArgPtr)argIn;
XBoolean ok;
X
X uENTRY4("_RoomsIterator(%d,%s,%s,0x%x)\n",row,stText(key),roomText(pRoom),
X pArg);
X ok= (*pArg->func)(pRoom,pArg->arg);
X uRETURN(ok);
X}
X
Xvoid
XRoomsIterate(func,arg)
XRoomsIterFunc func;
XOpaque arg;
X{
XRoomsIterArgRec iarg;
X
X uENTRY2("RoomsIterate(0x%x,0x%x)\n",func,arg);
X if ((func==NULL)||(pAllRooms==NullHashTable)) {
X uVOIDRETURN;
X }
X iarg.func= func;
X iarg.arg= arg;
X (void)htIterate(pAllRooms,_RoomsIterator,(Opaque)&iarg);
X uVOIDRETURN;
X}
X
X/***====================================================================***/
X
XBoolean
XSwitchToRoom(pRoom)
XRoomPtr pRoom;
X{
X uENTRY1("SwitchToRoom(%s)\n",roomText(pRoom));
X if (pRoom==CurrentRoom) {
X uRETURN(True);
X }
X if (CurrentRoom!=NullRoom) {
X roomDeactivate(CurrentRoom);
X }
X CurrentRoom= pRoom;
X if (pRoom!=NullRoom) {
X uRETURN(roomActivate(pRoom));
X }
X uRETURN(True);
X}
X
X/***====================================================================***/
X
XRoomPtr
XGetCurrentRoom()
X{
XRoomPtr pRoom;
X
X uENTRY("GetCurrentRoom()\n");
X if (((CurrentRoom==NullRoom)||(!roomIsVisible(CurrentRoom)))&&
X (DefaultFinder!=NULL)) {
X pRoom= (*DefaultFinder)();
X (void)SwitchToRoom(pRoom);
X }
X uRETURN(CurrentRoom);
X}
X
X/***====================================================================***/
X
Xvoid
XSetDefaultRoomFinder(pFinder)
XRoomFinderFunc pFinder;
X{
X uENTRY1("SetDefaultRoomFinder(0x%x)\n",pFinder);
X DefaultFinder= pFinder;
X uVOIDRETURN;
X}
X
X/***====================================================================***/
X
Xvoid
XSetDefaultRoomFeedback(pFunc)
XRoomFeedbackFunc pFunc;
X{
X uENTRY1("SetDefaultRoomFeedback(0x%x)\n",pFunc);
X DefaultFeedback= pFunc;
X uVOIDRETURN;
X}
X
X/***====================================================================***/
X
XBoolean
X_RoomsInitIter(pState)
XOpaque *pState;
X{
XBoolean ok= False;
X
X uENTRY1("_RoomsInitIter(0x%x)\n",pState);
X if (pAllRooms!=NullHashTable) {
X ok= _htInitIter(pAllRooms,pState);
X }
X else *pState= (Opaque)NULL;
X uRETURN(ok);
X}
X
X/***====================================================================***/
X
XBoolean
X_RoomsIterNext(pState, ppRoom)
XOpaque pState;
XRoomPtr *ppRoom;
X{
XBoolean ok= False;
XGenKey key;
XGenData data;
X
X uENTRY2("_RoomsIterNext(0x%x,0x%x)\n",pState,ppRoom);
X if ((pAllRooms!=NullHashTable)&&(pState!=(Opaque)NULL)) {
X ok= _htIterNext(pAllRooms,pState,&key,&data);
X if (ok) {
X *ppRoom= (RoomPtr)data;
X }
X else *ppRoom= NullRoom;
X }
X uRETURN(ok);
X}
X
X/***====================================================================***/
X
XBoolean
X_RoomsIterNextVisible(pState, ppRoom)
XOpaque pState;
XRoomPtr *ppRoom;
X{
XBoolean ok= False;
XGenKey key;
XGenData data;
X
X uENTRY2("_RoomsIterNextVisible(0x%x,0x%x)\n",pState,ppRoom);
X if ((pAllRooms!=NullHashTable)&&(pState!=(Opaque)NULL)) {
X do {
X ok= _htIterNext(pAllRooms,pState,&key,&data);
X if (ok) {
X *ppRoom= (RoomPtr)data;
X }
X else *ppRoom= NullRoom;
X } while ((ok)&&(!roomIsVisible(*ppRoom)));
X }
X uRETURN(ok);
X}
X
X/***====================================================================***/
X
Xvoid
XRoomsEndIterator(state)
XOpaque state;
X{
X uENTRY1("RoomsEndIterator(0x%x)\n",state);
X if (state!=(Opaque)NULL)
X htEndIterator(pAllRooms,state);
X uVOIDRETURN;
X}
END_OF_FILE
if test 7934 -ne `wc -c <'./lib/rooms.c'`; then
echo shar: \"'./lib/rooms.c'\" unpacked with wrong size!
fi
# end of './lib/rooms.c'
fi
if test -f './utils/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'./utils/Makefile'\"
else
echo shar: Extracting \"'./utils/Makefile'\" \(7593 characters\)
sed "s/^X//" >'./utils/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###########################################################################
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 Mips.macros to change
X
X# platform: $XConsortium: Vax.macros,v 1.49 88/10/23 11:01:02 jim Exp $
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
XSYSLAST_LIBRARIES = -ldnet
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/local/man
X MANSOURCEPATH = $(MANPATH)/man
X MANDIR = $(MANSOURCEPATH)1
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 0755
X FCFLAGS = -t
X CDEBUGFLAGS = -O
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
X CLIENTSRC = $(TOP)/clients
X DEMOSRC = $(TOP)/demos
X LIBSRC = $(TOP)/lib
X FONTSRC = $(TOP)/fonts
X INCLUDESRC = $(TOP)/X11 -I$(TOP)
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 = Mips.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
X SRCS = storage.c hash.c list.c regex.c strtbl.c utils.c
X OBJS = storage.o hash.o list.o regex.o strtbl.o utils.o
X INCLUDES = -I.
X
X UTIL_DEFINES = -DDEBUG_ON -DENTRY_TRACKING_ON -DASSERTIONS_ON
X
X DEFINES = $(STD_DEFINES) $(UTIL_DEFINES)
X
X CDEBUGFLAGS = -g
X
Xall:: libutils.a
X
Xlibutils.a: $(OBJS)
X $(RM) $@
X $(AR) $@ $(OBJS)
X $(RANLIB) $@
X
Xdepend:: $(DEPEND)
X
Xdepend::
X $(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS)
X
X$(DEPEND):
X @echo "making $@"; \
X cd $(DEPENDSRC); $(MAKE)
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 - at 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
X# DO NOT DELETE
X
Xstorage.o: utils.h /usr/include/stdio.h /usr/include/string.h machdep.h
Xstorage.o: storagestr.h storage.h
Xhash.o: utils.h /usr/include/stdio.h /usr/include/string.h machdep.h
Xhash.o: hashstr.h storagestr.h storage.h hash.h
Xlist.o: utils.h /usr/include/stdio.h /usr/include/string.h machdep.h
Xlist.o: liststr.h list.h storage.h storagestr.h
Xregex.o: utils.h /usr/include/stdio.h /usr/include/string.h machdep.h regex.h
Xstrtbl.o: utils.h /usr/include/stdio.h /usr/include/string.h machdep.h
Xstrtbl.o: storagestr.h storage.h strtblstr.h strtbl.h hash.h
Xutils.o: utils.h /usr/include/stdio.h /usr/include/string.h machdep.h
Xutils.o: /usr/include/signal.h /usr/include/sys/time.h
END_OF_FILE
if test 7593 -ne `wc -c <'./utils/Makefile'`; then
echo shar: \"'./utils/Makefile'\" unpacked with wrong size!
fi
# end of './utils/Makefile'
fi
if test -f './utils/utils.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'./utils/utils.c'\"
else
echo shar: Extracting \"'./utils/utils.c'\" \(7548 characters\)
sed "s/^X//" >'./utils/utils.c' <<'END_OF_FILE'
X
X /*\
X * $Header: utils.c,v 5.0 90/01/10 06:51:32 erik Exp $
X *
X * COPYRIGHT 1990
X * DIGITAL EQUIPMENT CORPORATION
X * MAYNARD, MASSACHUSETTS
X * ALL RIGHTS RESERVED.
X *
X * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
X * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
X * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE
X * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED
X * WARRANTY.
X *
X * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT
X * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN
X * ADDITION TO THAT SET FORTH ABOVE.
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 Digital Equipment Corporation not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X \*/
X
X#include "utils.h"
X
X/***====================================================================***/
X
XOpaque
XuAlloc(size)
Xunsigned size;
X{
X return((Opaque)malloc(size));
X}
X
X/***====================================================================***/
X
XOpaque
XuCalloc(n, size)
Xunsigned n,size;
X{
X return((Opaque)calloc(n,size));
X}
X
X/***====================================================================***/
X
XOpaque
XuRealloc(old, newSize)
XOpaque old;
Xunsigned newSize;
X{
X return((Opaque)realloc((char *)old,newSize));
X}
X
X/***====================================================================***/
X
Xvoid
XuFree(ptr)
XOpaque ptr;
X{
X if (ptr!=(Opaque)NULL)
X free((char *)ptr);
X return;
X}
X
X/***====================================================================***/
X/*** FUNCTION ENTRY TRACKING ***/
X/***====================================================================***/
X
Xstatic FILE *entryFile= stderr;
X int uEntryLevel;
X
XBoolean
XuSetEntryFile(name)
Xchar *name;
X{
X if ((entryFile!=NULL)&&(entryFile!=stderr)) {
X fprintf(entryFile,"switching to %s\n",name?name:"stderr");
X fclose(entryFile);
X }
X if (name!=NullString) entryFile= fopen(name,"w");
X else entryFile= stderr;
X if (entryFile==NULL) {
X entryFile= stderr;
X return(False);
X }
X return(True);
X}
X
Xvoid
XuEntry(l,s,a1,a2,a3,a4,a5,a6,a7,a8)
Xint l;
Xchar *s,*a1,*a2,*a3,*a4,*a5,*a6,*a7,*a8;
X{
Xint i;
X
X for (i=0;i<uEntryLevel;i++) {
X putc(' ',entryFile);
X }
X fprintf(entryFile,s,a1,a2,a3,a4,a5,a6,a7,a8);
X uEntryLevel+= l;
X return;
X}
X
Xvoid
XuExit(l,rtVal)
Xint l;
Xchar *rtVal;
X{
Xint i;
X
X uEntryLevel-= l;
X if (uEntryLevel<0) uEntryLevel= 0;
X for (i=0;i<uEntryLevel;i++) {
X putc(' ',entryFile);
X }
X fprintf(entryFile,"---> 0x%x\n",rtVal);
X return;
X}
X
X/***====================================================================***/
X/*** PRINT FUNCTIONS ***/
X/***====================================================================***/
X
Xstatic FILE *debugFile= stderr;
X int uDebugIndentLevel= 0;
X int uDebugIndentSize= 4;
X
XBoolean
XuSetDebugFile(name)
Xchar *name;
X{
X if ((debugFile!=NULL)&&(debugFile!=stderr)) {
X fprintf(debugFile,"switching to %s\n",name?name:"stderr");
X fclose(debugFile);
X }
X if (name!=NullString) debugFile= fopen(name,"w");
X else debugFile= stderr;
X if (debugFile==NULL) {
X debugFile= stderr;
X return(False);
X }
X return(True);
X}
X
Xvoid
XuDebug(s,a1,a2,a3,a4,a5,a6,a7,a8)
Xchar *s,*a1,*a2,*a3,*a4,*a5,*a6,*a7,*a8;
X{
Xint i;
X
X for (i=(uDebugIndentLevel*uDebugIndentSize);i>0;i--) {
X putc(' ',debugFile);
X }
X fprintf(debugFile,s,a1,a2,a3,a4,a5,a6,a7,a8);
X fflush(debugFile);
X return;
X}
X
X/***====================================================================***/
X
Xstatic FILE *errorFile= stderr;
X
XBoolean
XuSetErrorFile(name)
Xchar *name;
X{
X if ((errorFile!=NULL)&&(errorFile!=stderr)) {
X fprintf(errorFile,"switching to %s\n",name?name:"stderr");
X fclose(errorFile);
X }
X if (name!=NullString) errorFile= fopen(name,"w");
X else errorFile= stderr;
X if (errorFile==NULL) {
X errorFile= stderr;
X return(False);
X }
X return(True);
X}
X
Xvoid
XuInformation(s,a1,a2,a3,a4,a5,a6,a7,a8)
Xchar *s,*a1,*a2,*a3,*a4,*a5,*a6,*a7,*a8;
X{
X fprintf(errorFile,s,a1,a2,a3,a4,a5,a6,a7,a8);
X fflush(errorFile);
X return;
X}
X
X/***====================================================================***/
X
Xvoid
XuAction(s,a1,a2,a3,a4,a5,a6,a7,a8)
Xchar *s,*a1,*a2,*a3,*a4,*a5,*a6,*a7,*a8;
X{
X fprintf(errorFile," ");
X fprintf(errorFile,s,a1,a2,a3,a4,a5,a6,a7,a8);
X fflush(errorFile);
X return;
X}
X
X/***====================================================================***/
X
Xvoid
XuWarning(s,a1,a2,a3,a4,a5,a6,a7,a8)
Xchar *s,*a1,*a2,*a3,*a4,*a5,*a6,*a7,*a8;
X{
X fprintf(errorFile,"Warning: ");
X fprintf(errorFile,s,a1,a2,a3,a4,a5,a6,a7,a8);
X fflush(errorFile);
X return;
X}
X
X/***====================================================================***/
X
Xvoid
XuError(s,a1,a2,a3,a4,a5,a6,a7,a8)
Xchar *s,*a1,*a2,*a3,*a4,*a5,*a6,*a7,*a8;
X{
X fprintf(errorFile,"Error: ");
X fprintf(errorFile,s,a1,a2,a3,a4,a5,a6,a7,a8);
X fflush(errorFile);
X return;
X}
X
X/***====================================================================***/
X
Xvoid
XuFatalError(s,a1,a2,a3,a4,a5,a6,a7,a8)
Xchar *s,*a1,*a2,*a3,*a4,*a5,*a6,*a7,*a8;
X{
X fprintf(errorFile,"Fatal Error: ");
X fprintf(errorFile,s,a1,a2,a3,a4,a5,a6,a7,a8);
X fprintf(errorFile," Exiting\n");
X fflush(errorFile);
X exit(1);
X /* NOTREACHED */
X}
X
X/***====================================================================***/
X
Xvoid
XuInternalError(s,a1,a2,a3,a4,a5,a6,a7,a8)
Xchar *s,*a1,*a2,*a3,*a4,*a5,*a6,*a7,*a8;
X{
X fprintf(errorFile,"Internal error: ");
X fprintf(errorFile,s,a1,a2,a3,a4,a5,a6,a7,a8);
X fflush(errorFile);
X return;
X}
X
X/***====================================================================***/
X/*** STRING HELPER FUNCTIONS ***/
X/***====================================================================***/
X
Xchar *
XuStringDup(str)
Xchar *str;
X{
Xchar *new;
X
X if (!str) return(NULL);
X
X new= (char *)uAlloc((unsigned)strlen(str)+1);
X if (!new) return(NULL);
X strcpy(new,str);
X return(new);
X}
X
X#ifndef NO_TIMEOUTS
X/***====================================================================***/
X/*** TIMER HELPER FUNCTIONS ***/
X/***====================================================================***/
X
X#include <signal.h>
X#include <sys/time.h>
X
Xvoid
XuSetTimeout(seconds,milliSeconds,pFunc)
Xint seconds;
Xint milliSeconds;
Xvoid (*pFunc)();
X{
Xstruct itimerval time,otime;
Xstruct sigvec sig,osig;
X
X sig.sv_handler= pFunc;
X sig.sv_mask= 0;
X sig.sv_flags= SV_INTERRUPT;
X sigvec(SIGALRM,&sig,&osig);
X timerclear(&time.it_interval);
X time.it_value.tv_sec= seconds;
X time.it_value.tv_usec= milliSeconds;
X setitimer(ITIMER_REAL,&time,&otime);
X return;
X}
X
Xvoid
XuClearTimeout()
X{
Xstruct itimerval time,otime;
Xstruct sigvec sig,osig;
X
X sig.sv_handler= SIG_DFL;
X sig.sv_mask= 0;
X sig.sv_flags= 0;
X sigvec(SIGALRM,&sig,&osig);
X timerclear(&time.it_interval);
X timerclear(&time.it_value);
X setitimer(ITIMER_REAL,&time,&otime);
X return;
X}
X#endif
END_OF_FILE
if test 7548 -ne `wc -c <'./utils/utils.c'`; then
echo shar: \"'./utils/utils.c'\" unpacked with wrong size!
fi
# end of './utils/utils.c'
fi
if test -f './utils/utils.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'./utils/utils.h'\"
else
echo shar: Extracting \"'./utils/utils.h'\" \(6872 characters\)
sed "s/^X//" >'./utils/utils.h' <<'END_OF_FILE'
X#ifndef UTILS_H
X#define UTILS_H 1
X
X /*\
X * $Header: utils.h,v 5.0 90/01/10 06:51:36 erik Exp $
X *
X * COPYRIGHT 1990
X * DIGITAL EQUIPMENT CORPORATION
X * MAYNARD, MASSACHUSETTS
X * ALL RIGHTS RESERVED.
X *
X * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
X * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
X * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE
X * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED
X * WARRANTY.
X *
X * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT
X * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN
X * ADDITION TO THAT SET FORTH ABOVE.
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 Digital Equipment Corporation not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X \*/
X
X/***====================================================================***/
X
X#include <stdio.h>
X#include <string.h>
X#include "machdep.h"
X
X#ifndef NULL
X#define NULL 0
X#endif
X
X#ifndef NUL
X#define NUL '\0'
X#endif
X
X/***====================================================================***/
X
X#ifndef OPAQUE_DEFINED
Xtypedef unsigned long *Opaque;
X#endif
X
X#ifndef BOOLEAN_DEFINED
Xtypedef char Boolean;
X#endif
X
X#ifndef True
X#define True ((Boolean)1)
X#define False ((Boolean)0)
X#endif /* ndef True */
X#define booleanText(b) ((b)?"True":"False")
X
X#ifndef COMPARISON_DEFINED
Xtypedef int Comparison;
X
X#define Greater ((Comparison)1)
X#define Equal ((Comparison)0)
X#define Less ((Comparison)-1)
X#define CannotCompare ((Comparison)-37)
X#define comparisonText(c) ((c)?((c)<0?"Less":"Greater"):"Equal")
X#endif
X
X/***====================================================================***/
X
Xextern Opaque uAlloc(/* size */);
Xextern Opaque uCalloc(/* n, size */);
Xextern Opaque uRealloc(/* old, newSize */);
Xextern void uFree(/* ptr */);
X
X#define uTypedAlloc(t) ((t *)uAlloc((unsigned)sizeof(t)))
X#define uTypedCalloc(n,t) ((t *)uCalloc((unsigned)n,(unsigned)sizeof(t)))
X#if (defined mdHasAlloca) && (mdHasAlloca)
X#define uTmpAlloc(n) ((Opaque)alloca((unsigned)n))
X#define uTmpFree(p)
X#else
X#define uTmpAlloc(n) uAlloc(n)
X#define uTmpFree(p) uFree(p)
X#endif
X
X/***====================================================================***/
X
Xextern Boolean uSetErrorFile(/* name */);
Xextern void uInformation();
Xextern void uAction();
Xextern void uWarning();
Xextern void uError();
Xextern void uFatalError();
Xextern void uInternalError();
X
X/***====================================================================***/
X
X#ifndef NO_TIMEOUTS
Xextern void uSetTimeout(/* seconds, uSecs, pFunc*/);
Xextern void uClearTimeout();
X#endif /* NO_TIMEOUTS */
X
X/***====================================================================***/
X
X#define NullString ((char *)NULL)
X
X#define uStringText(s) ((s)==NullString?"<NullString>":(s))
X#define uStringEqual(s1,s2) (uStringCompare(s1,s2)==Equal)
X#define uStringPrefix(p,s) (strncmp(p,s,strlen(p))==0)
X#define uStringCompare(s1,s2) (strcmp(s1,s2))
Xextern char *uStringDup(/* str */);
X
X/***====================================================================***/
X
X#ifdef ASSERTIONS_ON
X#define uASSERT(where,why) \
X {if (!(why)) uFatalError("assertion botched in %s ( why )\n",where);}
X#else
X#define uASSERT(where,why)
X#endif
X
X/***====================================================================***/
X
X#ifndef DEBUG_VAR
X#define DEBUG_VAR debugFlags
X#endif
X
Xunsigned int DEBUG_VAR;
X
Xextern void uDebug();
Xextern Boolean uSetDebugFile(/* name */);
Xextern int uDebugIndentLevel;
Xextern int uDebugIndentSize;
X#define uDebugIndent(l) (uDebugIndentLevel+=(l))
X#define uDebugOutdent(l) (uDebugIndentLevel-=(l))
X#ifdef DEBUG_ON
X#define uDEBUG(f,s) { if (DEBUG_VAR&(f)) uDebug(s);}
X#define uDEBUG1(f,s,a) { if (DEBUG_VAR&(f)) uDebug(s,a);}
X#define uDEBUG2(f,s,a,b) { if (DEBUG_VAR&(f)) uDebug(s,a,b);}
X#define uDEBUG3(f,s,a,b,c) { if (DEBUG_VAR&(f)) uDebug(s,a,b,c);}
X#define uDEBUG4(f,s,a,b,c,d) { if (DEBUG_VAR&(f)) uDebug(s,a,b,c,d);}
X#define uDEBUG5(f,s,a,b,c,d,e) { if (DEBUG_VAR&(f)) uDebug(s,a,b,c,d,e);}
X#else
X#define uDEBUG(b,s)
X#define uDEBUG1(b,s,a)
X#define uDEBUG2(b,s,a,b)
X#define uDEBUG3(b,s,a,b,c)
X#define uDEBUG4(b,s,a,b,c,d)
X#define uDEBUG5(b,s,a,b,c,d,e)
X#endif
X
Xextern Boolean uSetEntryFile(/* name */);
Xextern void uEntry();
Xextern void uExit();
X#ifdef ENTRY_TRACKING_ON
X#define ENTRY_BIT 0x10
X#define LOW_ENTRY_BIT 0x1000
X#define ENTER (DEBUG_VAR&ENTRY_BIT)
X#define FLAG(fLag) (DEBUG_VAR&(fLag))
X
Xextern int uEntryLevel;
X
X#define uENTRY(s) { if (ENTER) uEntry(1,s);}
X#define uENTRY1(s,a) { if (ENTER) uEntry(1,s,a);}
X#define uENTRY2(s,a,b) { if (ENTER) uEntry(1,s,a,b);}
X#define uENTRY3(s,a,b,c) { if (ENTER) uEntry(1,s,a,b,c);}
X#define uENTRY4(s,a,b,c,d) { if (ENTER) uEntry(1,s,a,b,c,d);}
X#define uENTRY5(s,a,b,c,d,e) { if (ENTER) uEntry(1,s,a,b,c,d,e);}
X#define uENTRY6(s,a,b,c,d,e,f) { if (ENTER) uEntry(1,s,a,b,c,d,e,f);}
X#define uENTRY7(s,a,b,c,d,e,f,g) { if (ENTER) uEntry(1,s,a,b,c,d,e,f,g);}
X#define uRETURN(v) { if (ENTER) uEntryLevel--; return(v); }
X#define uVOIDRETURN { if (ENTER) uEntryLevel--; return; }
X
X#define uFLAG_ENTRY(w,s) { if (FLAG(w)) uEntry(0,s);}
X#define uFLAG_ENTRY1(w,s,a) { if (FLAG(w)) uEntry(0,s,a);}
X#define uFLAG_ENTRY2(w,s,a,b) { if (FLAG(w)) uEntry(0,s,a,b);}
X#define uFLAG_ENTRY3(w,s,a,b,c) { if (FLAG(w)) uEntry(0,s,a,b,c);}
X#define uFLAG_ENTRY4(w,s,a,b,c,d) { if (FLAG(w)) uEntry(0,s,a,b,c,d);}
X#define uFLAG_ENTRY5(w,s,a,b,c,d,e) { if (FLAG(w)) uEntry(0,s,a,b,c,d,e);}
X#define uFLAG_ENTRY6(w,s,a,b,c,d,e,f) { if (FLAG(w)) uEntry(0,s,a,b,c,d,e,f);}
X#define uFLAG_ENTRY7(w,s,a,b,c,d,e,f,g) { if(FLAG(w))uEntry(0,s,a,b,c,d,e,f,g);}
X#define uFLAG_RETURN(v) { return(v);}
X#define uFLAG_VOIDRETURN { return; }
X#else
X#define uENTRY(s)
X#define uENTRY1(s,a)
X#define uENTRY2(s,a1,a2)
X#define uENTRY3(s,a1,a2,a3)
X#define uENTRY4(s,a1,a2,a3,a4)
X#define uENTRY5(s,a1,a2,a3,a4,a5)
X#define uENTRY6(s,a1,a2,a3,a4,a5,a6)
X#define uENTRY7(s,a1,a2,a3,a4,a5,a6,a7)
X#define uRETURN(v) { return(v); }
X#define uVOIDRETURN { return; }
X
X#define uFLAG_ENTRY(f,s)
X#define uFLAG_ENTRY1(f,s,a)
X#define uFLAG_ENTRY2(f,s,a,b)
X#define uFLAG_ENTRY3(f,s,a,b,c)
X#define uFLAG_ENTRY4(f,s,a,b,c,d)
X#define uFLAG_ENTRY5(f,s,a,b,c,d,e)
X#define uFLAG_ENTRY6(f,s,a,b,c,d,e,f)
X#define uFLAG_ENTRY7(f,s,a,b,c,d,e,f,g)
X#define uFLAG_RETURN(v) { return(v);}
X#define uFLAG_VOIDRETURN { return; }
X#endif
X#endif /* UTILS_H */
END_OF_FILE
if test 6872 -ne `wc -c <'./utils/utils.h'`; then
echo shar: \"'./utils/utils.h'\" unpacked with wrong size!
fi
# end of './utils/utils.h'
fi
if test -f './xrooms/xrMain.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'./xrooms/xrMain.c'\"
else
echo shar: Extracting \"'./xrooms/xrMain.c'\" \(6869 characters\)
sed "s/^X//" >'./xrooms/xrMain.c' <<'END_OF_FILE'
X
X /*\
X * $Header: xrMain.c,v 5.1 90/01/11 14:12:19 erik Exp $
X *
X * COPYRIGHT 1990
X * DIGITAL EQUIPMENT CORPORATION
X * MAYNARD, MASSACHUSETTS
X * ALL RIGHTS RESERVED.
X *
X * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
X * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
X * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE
X * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED
X * WARRANTY.
X *
X * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT
X * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN
X * ADDITION TO THAT SET FORTH ABOVE.
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 Digital Equipment Corporation not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X \*/
X
X#include <X11/Xlib.h>
X#include <X11/Xutil.h>
X
X#include <X11/Intrinsic.h>
X
X#define BOOLEAN_DEFINED
X#define OPAQUE_DEFINED
X#define DEBUG_VAR xrMainDebug
X#include "utils.h"
X#include "hash.h"
X
X#include "appstate.h"
X#include "apps.h"
X#include "room.h"
X
X#include "xrDebug.h"
X#include "xrXUtils.h"
X#include "xrProfile.h"
X#include "xrProto.h"
X#include "xrApp.h"
X#include "xrUI.h"
X#include "xrooms.h"
X
X#include "xrGen.h"
X
XAtom WM_STATE,WM_CHANGE_STATE,WM_MOVED;
X
X/***====================================================================***/
X
XDisplay *xroomsDpy;
Xint xroomsScreenIndex;
XScreen *xroomsScrn;
XWindow xroomsRoot;
XWindow xroomsRealRoot;
X
XWindow xroomsMainWindow= None;
X
X#ifdef COMPILE_STAMP
Xchar *xroomsCompileStamp= COMPILE_STAMP;
X#else
Xchar *xroomsCompileStamp= "no stamp";
X#endif
Xunsigned xroomsMajorVersion= 1; /* don't change this */
Xunsigned xroomsMinorVersion= 2; /* don't change this */
Xunsigned xroomsLocalVersion= 0; /* you can change this */
X
XBoolean xroomsPrintWarnings= True;
X
XBoolean xroomsSetupMode= True;
X
Xchar *debugSettings= NULL;
X
X/***====================================================================***/
X
Xvoid
XHandleConfigureNotify(event)
XXEvent *event;
X{
X
X uENTRY1("HandleConfigureNotify(0x%x)\n",event);
X if (!event->xconfigure.override_redirect) {
X if (event->xconfigure.send_event) {
X xraClientMoved(event->xconfigure.window,event->xconfigure.x,
X event->xconfigure.y);
X }
X else {
X xraClientResized(event->xconfigure.window,
X (unsigned)event->xconfigure.width,
X (unsigned)event->xconfigure.height);
X }
X }
X uVOIDRETURN;
X}
X
X/***====================================================================***/
X
Xvoid
XHandleClientMessage(event)
XXEvent *event;
X{
X uENTRY1("HandleClientMessage(0x%x)\n",event);
X if (event->xclient.message_type != WM_MOVED) {
X uVOIDRETURN;
X }
X xraClientMoved(event->xclient.window,event->xclient.data.s[0],
X event->xclient.data.s[1]);
X uVOIDRETURN;
X}
X
X/***====================================================================***/
X
Xvoid
XHandlePropertyNotify(event)
XXEvent *event;
X{
X uENTRY1("HandlePropertyNotify(0x%x)\n",event);
X uDEBUG3(WATCH_EVENTS,"property %d %s on 0x%x\n",event->xproperty.atom,
X (event->xproperty.state==PropertyNewValue?"changed":"deleted"),
X event->xproperty.window);
X
X if (event->xproperty.window==xroomsRealRoot) {
X if ((event->xproperty.atom == ROOMS_REQUEST)&&
X (event->xproperty.state == PropertyNewValue)) {
X (void)xrprHandleRequests(xroomsDpy,xroomsRealRoot);
X }
X }
X else if ((event->xproperty.atom == WM_STATE)&&
X (event->xproperty.state == PropertyNewValue)) {
X xraStateChanged(event->xproperty.window);
X }
X else if (xroomsPrintWarnings&&
X (event->xproperty.state==PropertyNewValue)&&
X ((event->xproperty.atom==XA_WM_NAME)||
X (event->xproperty.atom==XA_WM_ICON_NAME))) {
X AppPtr pApp;
X pApp= xraLookupWindowApp(event->xproperty.window);
X if ((!xrnHaveProfile())&&(appIsPermanent(pApp))) {
X uWarning("%s PROPERTY changed on permanent application \"%s\"\n",
X (event->xproperty.atom==XA_WM_NAME?"WM_NAME":
X "WM_ICON_NAME"),
X appText(pApp));
X uAction("This application will probably be identified incorrectly\n");
X uAction("in your .xroomsrc. See xrooms(1) for a description of\n");
X uAction("ways to use name profiles to circumvent this problem.\n");
X uAction("To avoid this message in the future, invoke xrooms -nowarnings\n");
X }
X }
X uVOIDRETURN;
X}
X
X/***====================================================================***/
X
Xvoid
XHandleDestroyNotify(event)
XXEvent *event;
X{
X uENTRY1("HandleDestroyNotify(0x%x)\n",event);
X uDEBUG(WATCH_EVENTS,"Got a destroy notify\n");
X xraClientDestroyed(event->xdestroywindow.window);
X uVOIDRETURN;
X}
X
X/***====================================================================***/
X
Xvoid
XDoExit(code,message)
Xint code;
Xchar *message;
X{
X uENTRY2("DoExit(%d,%s)\n",code,uStringText(message));
X xrgenCleanUp(xroomsDpy,xroomsRealRoot);
X XSync(xroomsDpy, False);
X XCloseDisplay(xroomsDpy);
X if (code!=0) {/* abnormal exit -- print message */
X uError("%s\n",message);
X }
X exit(code);
X /* NOTREACHED */
X}
X
X/***====================================================================***/
X
Xmain(argc, argv)
Xint argc;
Xchar **argv;
X{
XWindow *children;
Xint numchildren, i;
XXEvent event;
X
X xrInitialize(argc,argv);
X
X if (xrpfLoadFile(NULL))
X xroomsSetupMode= False;
X
X if (xruGetChildren(xroomsRoot, &children, &numchildren)) {
X for (i=0 ; i<numchildren ; i++) {
X xraAddApp(children[i]);
X }
X if (numchildren)
X XFree((char *) children);
X }
X
X xruiBecomeVisible();
X
X if (xroomsRoot!=xroomsRealRoot) {
X XSelectInput(xroomsDpy,xroomsRoot,SubstructureNotifyMask);
X XSelectInput(xroomsDpy,xroomsRealRoot,PropertyChangeMask);
X }
X else {
X XSelectInput(xroomsDpy,xroomsRoot,
X SubstructureNotifyMask|PropertyChangeMask);
X }
X
X for (;;) {
X XtNextEvent(&event);
X uDEBUG2(WATCH_EVENTS,"event of type %d (0x%x)\n",event.type,event.type);
X if ((event.type==MapNotify) && (event.xmap.event==xroomsRoot)) {
X uDEBUG(WATCH_EVENTS,"Got a map notify\n");
X xraAddApp(event.xmap.window);
X }
X else if (event.type == PropertyNotify)
X HandlePropertyNotify(&event);
X else if (event.type == DestroyNotify)
X HandleDestroyNotify(&event);
X else if (xraUseGeometries && (event.type == ConfigureNotify)) {
X HandleConfigureNotify(&event);
X }
X else if (xraUseGeometries && (event.type == ClientMessage)) {
X HandleClientMessage(&event);
X }
X XtDispatchEvent(&event);
X }
X}
END_OF_FILE
if test 6869 -ne `wc -c <'./xrooms/xrMain.c'`; then
echo shar: \"'./xrooms/xrMain.c'\" unpacked with wrong size!
fi
# end of './xrooms/xrMain.c'
fi
if test -f './xrset/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'./xrset/Makefile'\"
else
echo shar: Extracting \"'./xrset/Makefile'\" \(7233 characters\)
sed "s/^X//" >'./xrset/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###########################################################################
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 Mips.macros to change
X
X# platform: $XConsortium: Vax.macros,v 1.49 88/10/23 11:01:02 jim Exp $
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
XSYSLAST_LIBRARIES = -ldnet
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/local/man
X MANSOURCEPATH = $(MANPATH)/man
X MANDIR = $(MANSOURCEPATH)1
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 0755
X FCFLAGS = -t
X CDEBUGFLAGS = -O
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
X CLIENTSRC = $(TOP)/clients
X DEMOSRC = $(TOP)/demos
X LIBSRC = $(TOP)/lib
X FONTSRC = $(TOP)/fonts
X INCLUDESRC = $(TOP)/X11 -I$(TOP)
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 = Mips.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
X CDEBUGFLAGS = -g
X
X UTIL_DEFINES = -DDEBUG_ON -DENTRY_TRACKING_ON -DASSERTIONS_ON
X
X LOCAL_LIBRARIES = ../lib/librooms.a ../utils/libutils.a
X SRCS = xrset.c xrReq.c
X OBJS = xrset.o xrReq.o ../xrooms/xrGen.o
X PROGRAMS = xrset
X INCLUDES = -I/usr/include/mit -I../utils -I../lib -I../xrooms -I. -I$(TOP) -I$(TOP)/X11
XSYSLAST_LIBRARIES = -lX11 -lm
X DEFINES = $(UTIL_DEFINES) $(STD_DEFINES)
X
X PROGRAM = xrset
X
Xall:: xrset
X
Xxrset: $(OBJS) $(LOCAL_LIBRARIES)
X $(RM) $@
X $(CC) -o $@ $(OBJS) $(LOCAL_LIBRARIES) $(LDFLAGS) $(SYSLAST_LIBRARIES)
X
Xrelink::
X $(RM) $(PROGRAM)
X $(MAKE) $(MFLAGS) $(PROGRAM)
X
Xinstall:: xrset
X $(INSTALL) -c $(INSTALLFLAGS) xrset $(BINDIR)
X
Xinstall.man:: xrset.man
X $(INSTALL) -c $(INSTMANFLAGS) xrset.man $(MANDIR)/xrset.1
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 - at 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
END_OF_FILE
if test 7233 -ne `wc -c <'./xrset/Makefile'`; then
echo shar: \"'./xrset/Makefile'\" unpacked with wrong size!
fi
# end of './xrset/Makefile'
fi
echo shar: End of archive 4 \(of 14\).
cp /dev/null ark4isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 14 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
More information about the Comp.sources.x
mailing list