[comp.sources.x] v08i084: chaos, Part08/10

ken@uunet.UU.NET (Ken Marks (x2425)) (08/21/90)

Submitted-by: balr!panasun!ken@uunet.UU.NET (Ken Marks (x2425))
Posting-number: Volume 8, Issue 84
Archive-name: chaos/part08

#! /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 8 (of 10)."
# Contents:  common/file.c common/ipc.c drone/doPropNotify.c
#   drone/propNotify.c headers/patchlevel.h maps/default.map
#   maps/special3.map maps/special4.map maps/special8.map
#   maps/white.map master/Chaos.ad master/messageDb.c master/queue.c
#   master/task.c
# Wrapped by ken@panasun on Mon Jul 30 14:59:50 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'common/file.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'common/file.c'\"
else
echo shar: Extracting \"'common/file.c'\" \(6004 characters\)
sed "s/^X//" >'common/file.c' <<'END_OF_FILE'
X/*
X * Copyright (c) Ken W. Marks 1989, 1990.
X */
X
X#include <stdio.h>
X#include <fcntl.h>
X#include <signal.h>
X#include <string.h>
X#include <ctype.h>
X#include <X11/Xos.h>
X#include <sys/dir.h>
X#include <sys/stat.h>
X#include <X11/Intrinsic.h>
X#include <Chaos.h>
X
X#define FAIL		-1
X#define LXOR(a,b)	((!(a)&&(b)) || (!(b)&&(a)))
X#define MALLOC_FACTOR	10
X
X
X/*
X * Function:	Match
X *
X * Purpose :	Given two strings, determine if they match.  The pattern
X *		string can contain wildcards.
X *		?	Match any single character
X *		*	Match any string of characters
X *		[...]	Match any one of the enclosed characters. A
X *			pair of characters separated by - matches any
X *			character lexically between the pair, inclusive.
X *			If the first character after the opening [ is a
X *			! then any character not enclosed is matched. A
X *			- can included in the character set by putting it
X *			as the first or last character.
X *
X * Returns:	1 if the string matches the pattern, 0 if not.
X */
X
XMatch(pat, str)
Xchar *pat;			/* the pattern */
Xchar *str;			/* the string */
X{
X    char sc;
X    char pc;
X
X    sc = *str++;
X    switch (pc = *pat++)
X    {
X    case '[':
X	{
X	    int ok = 0;		/* Has a match been made with the characters
X				 * between the [] */
X	    int lc = -1;	/* Last character from pattern */
X	    int notflag = 0;	/* Include or exclude? */
X
X	    if (*pat == '!')
X	    {
X		notflag = 1;
X		pat++;
X	    }
X
X	    /* SUPPRESS 560 */
X	    while (pc = *pat++)
X	    {
X		if (pc == ']')
X		    return (ok ? Match(pat, str) : 0);
X		else if (pc == '-')
X		{
X		    if (lc == -1 || *pat == ']')
X		    {
X			if (LXOR((sc == pc), (notflag)))
X			    ok++;
X			else if (notflag && sc == pc)
X			    return (0);
X		    }
X		    else if (notflag)
X			if (lc > sc || sc > *(pat++))
X			    ok++;
X			else
X			    return (0);
X		    else if (lc <= sc && sc <= (*pat++))
X			ok++;
X		}
X		else if (notflag)
X		    if (sc != (lc = pc))
X			ok++;
X		    else
X			return (0);
X		else if (sc == (lc = pc))
X		    ok++;
X	    }
X	    return (0);
X	}
X
X    case '?':
X	return (sc ? Match(pat, str) : 0);	/* Does the rest of the string
X						 * match the rest of the
X						 * pattern? */
X
X    case '*':
X	if (*pat == '\0')
X	    return (1);		/* guaranteed match if we're at the end of the
X				 * pattern */
X
X	/* Try to find a substring of s that will match the	 */
X	/* rest of the pattern.					 */
X	--str;
X	while (*str)
X	    if (Match(pat, str++))
X		return (1);
X	return (0);		/* couldn't find a substring - no match */
X
X    case '\0':			/* end of pattern */
X	return (sc == '\0');	/* match if s ends as well */
X
X    default:
X	if (pc != sc)
X	    return (0);
X	return (sc ? Match(pat, str) : 0);	/* check to see if the rest of
X						 * the strings match */
X    }
X}
X
X
Xint compar(a, b)
Xchar **a;
Xchar **b;
X{
X    return (strcmp(*a, *b));
X}
X
X
Xchar **GetFileList(path, pattern)
Xchar *path;
Xchar *pattern;
X{
X#ifdef SYSV
X    FILE *dirstr;
X#else
X    DIR *dirp;
X#endif
X    struct direct dirent;
X    struct direct *pdirent = &dirent;
X    struct stat status;
X    char **files = NULL;
X    int nitems = 0;
X    int nitems_alloced = 0;
X    char full_path[256];
X    char *filename;
X    extern int qsort();
X    extern int errno;
X
X    (void) strcpy(full_path, path);
X    filename = &full_path[strlen(path)];
X    *filename++ = '/';
X
X#ifdef SYSV
X    if ((dirstr = fopen(path, "r")) == NULL)
X    {
X	eprintf("Can't open %s (errno=%d)\n", path, errno);
X	return (NULL);
X    }
X    while (fread((char *) &dirent, sizeof(struct direct), 1, dirstr) == 1)
X#else
X    if ((dirp = opendir(path)) == NULL)
X    {
X	eprintf("Can't open '%s'\n", path);
X	return (NULL);
X    }
X    while ((pdirent = readdir(dirp)) != NULL)
X#endif
X    {
X	(void) strcpy(filename, pdirent->d_name);
X	if (stat(full_path, &status) == FAIL)
X	{
X	    eprintf("Can't stat '%s' (errno=%d)\n",
X	      full_path, errno);
X	    if (files != NULL)
X		free((char *) files);
X	    return (NULL);
X	}
X	if ((status.st_mode & S_IFMT) == S_IFREG &&
X	  Match(pattern, pdirent->d_name))
X	{
X	    if (++nitems > nitems_alloced)
X	    {
X		if (nitems_alloced == 0)
X		{
X		    nitems_alloced = MALLOC_FACTOR;
X		    files = (char **) malloc((unsigned) (nitems_alloced *
X			sizeof(char *)));
X		}
X		else
X		{
X		    nitems_alloced += MALLOC_FACTOR;
X		    files = (char **) realloc((char *) files,
X		      (unsigned) (nitems_alloced * sizeof(char *)));
X		}
X	    }
X	    files[nitems - 1] = strcpy(malloc(pdirent->d_namlen + 1),
X	      pdirent->d_name);
X	}
X    }
X
X#ifdef SYSV
X    fclose(dirstr);
X#else
X    (void) closedir(dirp);
X#endif
X
X    qsort((char *) files, nitems, sizeof(char *), compar);
X
X    if (files == NULL)
X	files = (char **) malloc(sizeof(char *));
X    else
X	files = (char **) realloc((char *) files,
X	  (unsigned) ((nitems + 1) * sizeof(char *)));
X
X    files[nitems] = NULL;
X    return (files);
X}
X
X
Xvoid FreeFileList(files)
Xchar **files;
X{
X    char **ptr = files;
X
X    while (*ptr)
X	free((char *) (*ptr++));
X    free((char *) files);
X}
X
X
XBoolean FileExists(dir, filename)
Xchar *dir;
Xchar *filename;
X{
X    char path[128];
X    int fd;
X
X    (void) sprintf(path, "%s/%s", dir, filename);
X
X    if ((fd = open(path, O_RDONLY)) > 0)
X    {
X	(void) close(fd);
X	return (True);
X    }
X    return (False);
X}
X
X
XBoolean RemoveFile(dir, filename)
Xchar *dir;
Xchar *filename;
X{
X    char path[128];
X
X    (void) sprintf(path, "%s/%s", dir, filename);
X
X    if (unlink(path) != 0)
X	return (False);
X    else
X	return (True);
X}
X
X
Xchar *FileCheckFilename(filename, extension)
Xchar *filename;
Xchar *extension;
X{
X    static char buffer[128];
X    char *ptr;
X    char *bptr = buffer;
X    extern char *strrchr();
X
X    /* Attempt to strip off any and all path elements */
X    ptr = strrchr(filename, '/');
X    if (ptr == NULL)
X	ptr = filename;
X    else
X	++ptr;
X
X    /* Scan off any leading white space */
X    while (isspace(*ptr))
X	++ptr;
X
X    while (*ptr != '\0' && *ptr != '.' && !isspace(*ptr))
X	*bptr++ = *ptr++;
X
X    /* If there was not detectable base name */
X    if (bptr == buffer)
X	return (NULL);
X
X    /* Add extension */
X    (void) strcpy(bptr, extension);
X
X    return (buffer);
X}
END_OF_FILE
if test 6004 -ne `wc -c <'common/file.c'`; then
    echo shar: \"'common/file.c'\" unpacked with wrong size!
fi
# end of 'common/file.c'
fi
if test -f 'common/ipc.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'common/ipc.c'\"
else
echo shar: Extracting \"'common/ipc.c'\" \(2887 characters\)
sed "s/^X//" >'common/ipc.c' <<'END_OF_FILE'
X/*
X * Copyright (c) Ken W. Marks 1989, 1990.
X */
X
X#include <stdio.h>
X#include <X11/Intrinsic.h>
X#include <X11/StringDefs.h>
X#include <Chaos.h>
X#include <Ipc.h>
X
Xstatic Cardinal pad_amount[] = {0, 3, 2, 1};
X
X/* macro for padding a length to an even multiple of 4 (uses pad_amount[]) */
X#define PAD(length) ((length) + pad_amount[(length) & 3])
X
Xstatic Window recv_window;
X
XAtom CHAOS_WINDOW;
XAtom MAILBOX;
XAtom MESSAGE_TYPE;
XAtom REGISTRATION_EVENT;
X
Xextern Display *dpy;
X
X
XBoolean InitIpc(window)
XWindow window;
X{
X    recv_window = window;
X
X    CHAOS_WINDOW = XInternAtom(dpy, "CHAOS_WINDOW", False);
X    MAILBOX = XInternAtom(dpy, "MAILBOX", False);
X    MESSAGE_TYPE = XInternAtom(dpy, "MESSAGE_TYPE", False);
X    REGISTRATION_EVENT = XInternAtom(dpy, "REGISTRATION_EVENT", False);
X
X    return (CHAOS_WINDOW && MAILBOX && MESSAGE_TYPE && REGISTRATION_EVENT);
X}
X
X
Xvoid SetOwner(atom)
XAtom atom;
X{
X    Window current_owner;
X    char *atom_name;
X
X    if ((current_owner = XGetSelectionOwner(dpy, atom)) != NULL)
X    {
X	atom_name = XGetAtomName(dpy, atom);
X	eprintf("%s is currently owned by window 0x%lx\n",
X	  atom_name, current_owner);
X	exit(1);
X    }
X    XSetSelectionOwner(dpy, atom, recv_window, CurrentTime);
X
X    if (XGetSelectionOwner(dpy, CHAOS_WINDOW) != recv_window)
X    {
X	atom_name = XGetAtomName(dpy, atom);
X	eprintf("Could not become owner of %s selection\n", atom_name);
X	abort();
X    }
X}
X
X
XWindow GetOwner(atom)
XAtom atom;
X{
X    Window owner;
X
X    owner = XGetSelectionOwner(dpy, atom);
X    return (owner);
X}
X
X
XBoolean SendMsg(window, msg_len, msg)
XWindow window;
Xunsigned msg_len;
Xchar *msg;
X{
X    extern int error_status;
X    extern int allow_errors;
X
X    XSync(dpy, False);		/* Flush out all other requests */
X
X    error_status = Success;	/* Feign optimism */
X    allow_errors = True;	/* Don't protest if we generate an error */
X
X    XChangeProperty(dpy, window, MAILBOX, MESSAGE_TYPE, 8, PropModeAppend,
X      msg, PAD(msg_len));
X
X    XSync(dpy, False);		/* Make sure this request has been sent */
X
X    allow_errors = False;	/* Report future errors */
X
X    return (error_status == Success);
X}
X
X
XBoolean RecvMsg(msg, msg_len)
Xchar **msg;
Xunsigned long *msg_len;
X{
X    Atom actual_type;
X    int actual_format;
X    unsigned long bytes_after;
X    int result;
X
X    result = XGetWindowProperty(dpy, recv_window, MAILBOX, 0, 65536, True,
X      AnyPropertyType, &actual_type, &actual_format, msg_len, &bytes_after,
X      msg);
X
X    if (result == BadWindow)
X    {
X	eprintf("Invalid window (0x%lx)\n", recv_window);
X	*msg = NULL;
X	return (False);
X    }
X    if (actual_type == None)
X    {
X	eprintf("No message was read from property\n");
X	*msg = NULL;
X	return (False);
X    }
X    if (actual_type != MESSAGE_TYPE)
X    {
X	eprintf("Invalid message type (%d)\n", actual_type);
X	free(*msg);		/* throw away erroneous message */
X	*msg = NULL;
X	return (False);
X    }
X    return (True);
X}
END_OF_FILE
if test 2887 -ne `wc -c <'common/ipc.c'`; then
    echo shar: \"'common/ipc.c'\" unpacked with wrong size!
fi
# end of 'common/ipc.c'
fi
if test -f 'drone/doPropNotify.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'drone/doPropNotify.c'\"
else
echo shar: Extracting \"'drone/doPropNotify.c'\" \(4875 characters\)
sed "s/^X//" >'drone/doPropNotify.c' <<'END_OF_FILE'
X/*
X * Copyright (c) Ken W. Marks 1989, 1990.
X */
X
X#include <stdio.h>
X#include <X11/Intrinsic.h>
X#include <Ipc.h>
X#include <Chaos.h>
X
X/* This is the default static buffer size */
X#define BUFFER_SIZE     10000
X
Xextern void SwapImageRequest();
Xextern void SwapImageResponse();
Xextern void ComputeMandelbrot();
Xextern void ComputeJulia();
X
Xvoid DoPropNotify(event)
XXPropertyEvent *event;
X{
X    extern Window master_window;
X    char *msg;
X    unsigned long msg_len;
X    GenericMessage generic;
X    ImageRequest *req;
X    static int read_ahead = 0;
X    static char buffer[BUFFER_SIZE];
X    unsigned int data_size;
X    long byte_order;
X    ImageResponse *resp;
X    XEvent dummy_event;
X    extern void ByteSwapLong();
X
X    if (event->atom != MAILBOX)
X    {
X	/* must have been some other property (handle as usual) */
X	return;
X    }
X    if (event->state != PropertyNewValue)
X    {
X	/* Generally, ignore the PropertyDelete events. they are generated by
X	 * our destructive reads on the property and since we can't stop them
X	 * we must simply ignore them. */
X	return;
X    }
X
X    /* The counter read_ahead will become greater than zero when multiple
X     * messages are read from the property in response to a single
X     * PropertyNotify event.  By keeping track of how many messages we have
X     * "read ahead" of the events, we do not attempt to read from an empty
X     * property. */
X    if (--read_ahead > 0)
X	return;
X
X    if (RecvMsg(&msg, &msg_len) == False)
X    {
X#ifdef DEBUG
X	dprintf("Could not receive message\n");
X#endif
X	return;
X    }
X
X    (void) memcpy((char *) &generic, msg, sizeof(GenericMessage));
X
X    if (generic.byte_order != 0x11223344)
X	ByteSwapLong((char *) &generic, 2 * sizeof(long));
X
X    if (generic.type == TERMINATE_REQUEST)
X	/* Goodbye cruel world... */
X	exit(0);
X    else if (generic.type != IMAGE_REQUEST)
X    {
X#ifdef DEBUG
X	dprintf("Unknown message type: %d\n", generic.type);
X#endif
X	abort();
X    }
X
X    /* Otherwise, must be an image request */
X    req = (ImageRequest *) msg;
X
X    byte_order = req->byte_order;
X
X    if (byte_order != 0x11223344)
X	ByteSwapLong((char *) req, 7 * sizeof(long));
X
X#ifdef DEBUG
X    (void) printf("ImageRequest\n");
X    (void) printf("  byte_order:   0x%x\n", req->byte_order);
X    (void) printf("        type:   %d\n", req->type);
X    (void) printf("      serial:   %d\n", req->serial);
X    (void) printf("       width:   %d\n", req->width);
X    (void) printf("      height:   %d\n", req->height);
X    (void) printf("       limit:   %d\n", req->limit);
X    (void) printf("      method:   %d\n", req->method);
X    (void) printf("        p_lo:   %s\n", req->p_lo);
X    (void) printf("        p_hi:   %s\n", req->p_hi);
X    (void) printf("        q_lo:   %s\n", req->q_lo);
X    (void) printf("        q_hi:   %s\n", req->q_hi);
X    (void) printf("\n\n");
X#endif
X
X    data_size = DATA_SIZE(req->width, req->height);
X
X    if (data_size > BUFFER_SIZE)
X    {
X	if ((resp = (ImageResponse *) malloc(data_size)) == NULL)
X	{
X#ifdef DEBUG
X	    dprintf("Can't allocate %d bytes\n", data_size);
X#endif
X	    exit(1);
X	}
X    }
X    else
X    {
X	resp = (ImageResponse *) buffer;
X    }
X
X    switch (req->method)
X    {
X    case MANDELBROT:
X	ComputeMandelbrot(req, resp);
X	break;
X
X    case JULIA:
X	/* This is here for future expansion.  Possibly, pressing the middle 
X	 * mouse button at a point within the Mandelbrot set will cause a 
X	 * popup window to be displayed which will draw the Julia set for the 
X	 * selected point. This window size would be set from the settings
X	 * dialogbox. */
X
X#ifdef DEBUG
X	dprintf("Julia sets not implemented yet!\n");
X#endif
X	abort();
X	break;
X
X    default:
X#ifdef DEBUG
X	dprintf("Invalid method: %d\n", req->method);
X#endif
X	abort();
X    }
X
X    resp->type = IMAGE_RESPONSE;
X
X#ifdef DEBUG
X    (void) printf("ImageResponse\n");
X    (void) printf("  byte_order:   0x%x\n", resp->byte_order);
X    (void) printf("        type:   %d\n", resp->type);
X    (void) printf("      serial:   %d\n", resp->serial);
X    (void) printf("       width:   %d\n", resp->width);
X    (void) printf("      height:   %d\n", resp->height);
X    (void) printf("    max_iter:   %d\n", resp->max_iter);
X    (void) printf("\n\n");
X#endif
X
X    /* Swap the response back to the master's byte order */
X    if (byte_order != 0x11223344)
X	ByteSwapLong((char *) resp, 6 * sizeof(long));
X
X    /* See if the master has terminated while we were busy computing the
X     * response.  If there is a DestroyNotify event on the queue, then there
X     * is no reason to go on... */
X    if (XCheckTypedEvent(event->display, DestroyNotify, &dummy_event))
X	exit(0);
X
X    if (SendMsg(master_window, data_size, (char *) resp) == False)
X    {
X#ifdef DEBUG
X	dprintf("SendMsg failed - terminating\n");
X#endif
X	exit(1);
X    }
X
X    /* Free the data (only if it was malloced) */
X    if ((char *) resp != buffer)
X	free((char *) resp);
X
X    free((char *) msg);
X}
END_OF_FILE
if test 4875 -ne `wc -c <'drone/doPropNotify.c'`; then
    echo shar: \"'drone/doPropNotify.c'\" unpacked with wrong size!
fi
# end of 'drone/doPropNotify.c'
fi
if test -f 'drone/propNotify.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'drone/propNotify.c'\"
else
echo shar: Extracting \"'drone/propNotify.c'\" \(4875 characters\)
sed "s/^X//" >'drone/propNotify.c' <<'END_OF_FILE'
X/*
X * Copyright (c) Ken W. Marks 1989, 1990.
X */
X
X#include <stdio.h>
X#include <X11/Intrinsic.h>
X#include <Ipc.h>
X#include <Chaos.h>
X
X/* This is the default static buffer size */
X#define BUFFER_SIZE     10000
X
Xextern void SwapImageRequest();
Xextern void SwapImageResponse();
Xextern void ComputeMandelbrot();
Xextern void ComputeJulia();
X
Xvoid DoPropNotify(event)
XXPropertyEvent *event;
X{
X    extern Window master_window;
X    char *msg;
X    unsigned long msg_len;
X    GenericMessage generic;
X    ImageRequest *req;
X    static int read_ahead = 0;
X    static char buffer[BUFFER_SIZE];
X    unsigned int data_size;
X    long byte_order;
X    ImageResponse *resp;
X    XEvent dummy_event;
X    extern void ByteSwapLong();
X
X    if (event->atom != MAILBOX)
X    {
X	/* must have been some other property (handle as usual) */
X	return;
X    }
X    if (event->state != PropertyNewValue)
X    {
X	/* Generally, ignore the PropertyDelete events. they are generated by
X	 * our destructive reads on the property and since we can't stop them
X	 * we must simply ignore them. */
X	return;
X    }
X
X    /* The counter read_ahead will become greater than zero when multiple
X     * messages are read from the property in response to a single
X     * PropertyNotify event.  By keeping track of how many messages we have
X     * "read ahead" of the events, we do not attempt to read from an empty
X     * property. */
X    if (--read_ahead > 0)
X	return;
X
X    if (RecvMsg(&msg, &msg_len) == False)
X    {
X#ifdef DEBUG
X	dprintf("Could not receive message\n");
X#endif
X	return;
X    }
X
X    (void) memcpy((char *) &generic, msg, sizeof(GenericMessage));
X
X    if (generic.byte_order != 0x11223344)
X	ByteSwapLong((char *) &generic, 2 * sizeof(long));
X
X    if (generic.type == TERMINATE_REQUEST)
X	/* Goodbye cruel world... */
X	exit(0);
X    else if (generic.type != IMAGE_REQUEST)
X    {
X#ifdef DEBUG
X	dprintf("Unknown message type: %d\n", generic.type);
X#endif
X	abort();
X    }
X
X    /* Otherwise, must be an image request */
X    req = (ImageRequest *) msg;
X
X    byte_order = req->byte_order;
X
X    if (byte_order != 0x11223344)
X	ByteSwapLong((char *) req, 7 * sizeof(long));
X
X#ifdef DEBUG
X    (void) printf("ImageRequest\n");
X    (void) printf("  byte_order:   0x%x\n", req->byte_order);
X    (void) printf("        type:   %d\n", req->type);
X    (void) printf("      serial:   %d\n", req->serial);
X    (void) printf("       width:   %d\n", req->width);
X    (void) printf("      height:   %d\n", req->height);
X    (void) printf("       limit:   %d\n", req->limit);
X    (void) printf("      method:   %d\n", req->method);
X    (void) printf("        p_lo:   %s\n", req->p_lo);
X    (void) printf("        p_hi:   %s\n", req->p_hi);
X    (void) printf("        q_lo:   %s\n", req->q_lo);
X    (void) printf("        q_hi:   %s\n", req->q_hi);
X    (void) printf("\n\n");
X#endif
X
X    data_size = DATA_SIZE(req->width, req->height);
X
X    if (data_size > BUFFER_SIZE)
X    {
X	if ((resp = (ImageResponse *) malloc(data_size)) == NULL)
X	{
X#ifdef DEBUG
X	    dprintf("Can't allocate %d bytes\n", data_size);
X#endif
X	    exit(1);
X	}
X    }
X    else
X    {
X	resp = (ImageResponse *) buffer;
X    }
X
X    switch (req->method)
X    {
X    case MANDELBROT:
X	ComputeMandelbrot(req, resp);
X	break;
X
X    case JULIA:
X	/* This is here for future expansion.  Possibly, pressing the middle 
X	 * mouse button at a point within the Mandelbrot set will cause a 
X	 * popup window to be displayed which will draw the Julia set for the 
X	 * selected point. This window size would be set from the settings
X	 * dialogbox. */
X
X#ifdef DEBUG
X	dprintf("Julia sets not implemented yet!\n");
X#endif
X	abort();
X	break;
X
X    default:
X#ifdef DEBUG
X	dprintf("Invalid method: %d\n", req->method);
X#endif
X	abort();
X    }
X
X    resp->type = IMAGE_RESPONSE;
X
X#ifdef DEBUG
X    (void) printf("ImageResponse\n");
X    (void) printf("  byte_order:   0x%x\n", resp->byte_order);
X    (void) printf("        type:   %d\n", resp->type);
X    (void) printf("      serial:   %d\n", resp->serial);
X    (void) printf("       width:   %d\n", resp->width);
X    (void) printf("      height:   %d\n", resp->height);
X    (void) printf("    max_iter:   %d\n", resp->max_iter);
X    (void) printf("\n\n");
X#endif
X
X    /* Swap the response back to the master's byte order */
X    if (byte_order != 0x11223344)
X	ByteSwapLong((char *) resp, 6 * sizeof(long));
X
X    /* See if the master has terminated while we were busy computing the
X     * response.  If there is a DestroyNotify event on the queue, then there
X     * is no reason to go on... */
X    if (XCheckTypedEvent(event->display, DestroyNotify, &dummy_event))
X	exit(0);
X
X    if (SendMsg(master_window, data_size, (char *) resp) == False)
X    {
X#ifdef DEBUG
X	dprintf("SendMsg failed - terminating\n");
X#endif
X	exit(1);
X    }
X
X    /* Free the data (only if it was malloced) */
X    if ((char *) resp != buffer)
X	free((char *) resp);
X
X    free((char *) msg);
X}
END_OF_FILE
if test 4875 -ne `wc -c <'drone/propNotify.c'`; then
    echo shar: \"'drone/propNotify.c'\" unpacked with wrong size!
fi
# end of 'drone/propNotify.c'
fi
if test -f 'headers/patchlevel.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'headers/patchlevel.h'\"
else
echo shar: Extracting \"'headers/patchlevel.h'\" \(21 characters\)
sed "s/^X//" >'headers/patchlevel.h' <<'END_OF_FILE'
X#define PATCHLEVEL 1
END_OF_FILE
if test 21 -ne `wc -c <'headers/patchlevel.h'`; then
    echo shar: \"'headers/patchlevel.h'\" unpacked with wrong size!
fi
# end of 'headers/patchlevel.h'
fi
if test -f 'maps/default.map' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'maps/default.map'\"
else
echo shar: Extracting \"'maps/default.map'\" \(2830 characters\)
sed "s/^X//" >'maps/default.map' <<'END_OF_FILE'
X0 0 0
X0 0 0
X0 0 0
X0 0 0
X0 0 0
X0 220 220
X6 217 223
X12 214 226
X19 210 229
X25 206 232
X31 203 235
X38 199 237
X44 195 239
X50 191 241
X56 186 243
X63 182 245
X69 177 247
X75 173 248
X81 168 250
X87 163 251
X93 158 252
X99 153 253
X105 148 253
X111 143 254
X116 137 254
X122 132 254
X127 127 254
X133 121 254
X138 115 254
X144 110 254
X149 104 253
X154 98 252
X159 92 252
X164 86 251
X169 80 249
X174 74 248
X178 68 246
X183 62 245
X187 55 243
X191 49 241
X195 43 239
X199 37 237
X203 30 234
X207 24 232
X211 18 229
X214 11 226
X218 5 223
X221 1 220
X224 7 217
X227 13 213
X230 20 210
X232 26 206
X235 32 202
X237 39 198
X240 45 194
X242 51 190
X244 58 186
X245 64 181
X247 70 177
X248 76 172
X250 82 167
X251 88 162
X252 94 157
X253 100 152
X253 106 147
X254 112 142
X254 117 137
X254 123 131
X254 128 126
X254 134 120
X254 139 114
X254 145 109
X253 150 103
X252 155 97
X251 160 91
X250 165 85
X249 170 79
X248 174 73
X246 179 67
X244 183 61
X243 188 54
X241 192 48
X238 196 42
X236 200 36
X234 204 29
X231 208 23
X228 211 17
X225 215 10
X222 218 4
X219 221 2
X216 224 8
X213 227 14
X209 230 21
X205 233 27
X201 235 33
X197 238 40
X193 240 46
X189 242 52
X185 244 59
X180 246 65
X176 247 71
X171 249 77
X166 250 83
X162 251 89
X157 252 95
X151 253 101
X146 253 107
X141 254 112
X136 254 118
X130 254 124
X125 254 129
X119 254 135
X113 254 140
X108 254 145
X102 253 151
X96 252 156
X90 251 161
X84 250 166
X78 249 170
X72 247 175
X66 246 180
X60 244 184
X53 242 188
X47 240 193
X41 238 197
X34 236 201
X28 233 205
X22 231 208
X15 228 212
X9 225 215
X3 222 219
X3 219 222
X9 215 225
X15 212 228
X22 208 231
X28 205 233
X34 201 236
X41 197 238
X47 193 240
X53 188 242
X60 184 244
X66 180 246
X72 175 247
X78 170 249
X84 166 250
X90 161 251
X96 156 252
X102 151 253
X108 145 254
X113 140 254
X119 135 254
X125 129 254
X130 124 254
X136 118 254
X141 112 254
X146 107 253
X151 101 253
X157 95 252
X162 89 251
X166 83 250
X171 77 249
X176 71 247
X180 65 246
X185 59 244
X189 52 242
X193 46 240
X197 40 238
X201 33 235
X205 27 233
X209 21 230
X213 14 227
X216 8 224
X219 2 221
X222 4 218
X225 10 215
X228 17 211
X231 23 208
X234 29 204
X236 36 200
X238 42 196
X241 48 192
X243 54 188
X244 61 183
X246 67 179
X248 73 174
X249 79 170
X250 85 165
X251 91 160
X252 97 155
X253 103 150
X254 109 145
X254 114 139
X254 120 134
X254 126 128
X254 131 123
X254 137 117
X254 142 112
X253 147 106
X253 152 100
X252 157 94
X251 162 88
X250 167 82
X248 172 76
X247 177 70
X245 181 64
X244 186 58
X242 190 51
X240 194 45
X237 198 39
X235 202 32
X232 206 26
X230 210 20
X227 213 13
X224 217 7
X221 220 1
X218 223 5
X214 226 11
X211 229 18
X207 232 24
X203 234 30
X199 237 37
X195 239 43
X191 241 49
X187 243 55
X183 245 62
X178 246 68
X174 248 74
X169 249 80
X164 251 86
X159 252 92
X154 252 98
X149 253 104
X144 254 110
X138 254 115
X133 254 121
X127 254 127
X122 254 132
X116 254 137
X111 254 143
X105 253 148
X99 253 153
X93 252 158
X87 251 163
X81 250 168
X75 248 173
X69 247 177
X63 245 182
X56 243 186
X50 241 191
X44 239 195
X38 237 199
X31 235 203
X25 232 206
X19 229 210
X12 226 214
X6 223 217
END_OF_FILE
if test 2830 -ne `wc -c <'maps/default.map'`; then
    echo shar: \"'maps/default.map'\" unpacked with wrong size!
fi
# end of 'maps/default.map'
fi
if test -f 'maps/special3.map' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'maps/special3.map'\"
else
echo shar: Extracting \"'maps/special3.map'\" \(2824 characters\)
sed "s/^X//" >'maps/special3.map' <<'END_OF_FILE'
X0 0 0
X0 0 0
X0 0 0
X0 0 0
X0 0 0
X0 0 0
X0 220 220
X19 210 229
X38 199 237
X57 186 243
X75 172 248
X93 158 252
X111 142 254
X128 126 254
X144 109 254
X160 91 251
X174 73 248
X188 55 243
X200 36 236
X211 17 228
X221 2 219
X230 21 209
X238 40 197
X244 59 185
X249 77 171
X252 95 156
X254 113 141
X254 130 124
X254 146 107
X251 161 89
X247 176 71
X242 189 53
X235 201 34
X227 212 14
X218 222 4
X208 231 23
X196 239 42
X183 245 61
X169 249 79
X155 252 97
X139 254 115
X122 254 132
X105 253 148
X87 251 163
X69 247 177
X50 241 190
X31 235 203
X12 226 214
X6 217 223
X25 206 232
X44 195 239
X63 182 245
X81 168 250
X99 153 253
X117 137 254
X133 120 254
X149 103 253
X164 85 250
X179 67 246
X192 48 241
X204 29 234
X215 10 225
X224 8 216
X233 27 205
X240 46 193
X246 65 180
X250 83 166
X253 101 151
X254 119 135
X254 135 119
X253 151 101
X250 166 83
X246 180 65
X240 193 46
X233 205 27
X224 216 8
X215 225 10
X204 234 29
X192 241 48
X179 246 67
X164 250 85
X149 253 103
X133 254 120
X117 254 137
X99 253 153
X81 250 168
X63 245 182
X44 239 195
X25 232 206
X6 223 217
X12 214 226
X31 203 235
X50 190 241
X69 177 247
X87 163 251
X105 148 253
X122 132 254
X139 115 254
X155 97 252
X169 79 249
X183 61 245
X196 42 239
X208 23 231
X218 4 222
X227 14 212
X235 34 201
X242 53 189
X247 71 176
X251 89 161
X254 107 146
X254 124 130
X254 141 113
X252 156 95
X249 171 77
X244 185 59
X238 197 40
X230 209 21
X221 219 2
X211 228 17
X200 236 36
X188 243 55
X174 248 73
X160 251 91
X144 254 109
X128 254 126
X111 254 142
X93 252 158
X75 248 172
X57 243 186
X38 237 199
X19 229 210
X0 220 220
X19 210 229
X38 199 237
X57 186 243
X75 172 248
X93 158 252
X111 142 254
X128 126 254
X144 109 254
X160 91 251
X174 73 248
X188 55 243
X200 36 236
X211 17 228
X221 2 219
X230 21 209
X238 40 197
X244 59 185
X249 77 171
X252 95 156
X254 113 141
X254 130 124
X254 146 107
X251 161 89
X247 176 71
X242 189 53
X235 201 34
X227 212 14
X218 222 4
X208 231 23
X196 239 42
X183 245 61
X169 249 79
X155 252 97
X139 254 115
X122 254 132
X105 253 148
X87 251 163
X69 247 177
X50 241 190
X31 235 203
X12 226 214
X6 217 223
X25 206 232
X44 195 239
X63 182 245
X81 168 250
X99 153 253
X117 137 254
X133 120 254
X149 103 253
X164 85 250
X179 67 246
X192 48 241
X204 29 234
X215 10 225
X224 8 216
X233 27 205
X240 46 193
X246 65 180
X250 83 166
X253 101 151
X254 119 135
X254 135 119
X253 151 101
X250 166 83
X246 180 65
X240 193 46
X233 205 27
X224 216 8
X215 225 10
X204 234 29
X192 241 48
X179 246 67
X164 250 85
X149 253 103
X133 254 120
X117 254 137
X99 253 153
X81 250 168
X63 245 182
X44 239 195
X25 232 206
X6 223 217
X12 214 226
X31 203 235
X50 190 241
X69 177 247
X87 163 251
X105 148 253
X122 132 254
X139 115 254
X155 97 252
X169 79 249
X183 61 245
X196 42 239
X208 23 231
X218 4 222
X227 14 212
X235 34 201
X242 53 189
X247 71 176
X251 89 161
X254 107 146
X254 124 130
X254 141 113
X252 156 95
X249 171 77
X244 185 59
X238 197 40
X230 209 21
X221 219 2
X211 228 17
X200 236 36
X188 243 55
X174 248 73
X160 251 91
X144 254 109
X128 254 126
X111 254 142
X93 252 158
X75 248 172
X57 243 186
X38 237 199
X19 229 210
END_OF_FILE
if test 2824 -ne `wc -c <'maps/special3.map'`; then
    echo shar: \"'maps/special3.map'\" unpacked with wrong size!
fi
# end of 'maps/special3.map'
fi
if test -f 'maps/special4.map' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'maps/special4.map'\"
else
echo shar: Extracting \"'maps/special4.map'\" \(2824 characters\)
sed "s/^X//" >'maps/special4.map' <<'END_OF_FILE'
X0 0 0
X0 0 0
X0 0 0
X0 0 0
X0 0 0
X0 0 0
X0 220 220
X25 206 232
X50 190 241
X75 172 248
X99 153 253
X122 132 254
X144 109 254
X164 85 250
X183 61 245
X200 36 236
X215 10 225
X227 14 212
X238 40 197
X246 65 180
X251 89 161
X254 113 141
X254 135 119
X252 156 95
X247 176 71
X240 193 46
X230 209 21
X218 222 4
X204 234 29
X188 243 55
X169 249 79
X149 253 103
X128 254 126
X105 253 148
X81 250 168
X57 243 186
X31 235 203
X6 223 217
X19 210 229
X44 195 239
X69 177 247
X93 158 252
X117 137 254
X139 115 254
X160 91 251
X179 67 246
X196 42 239
X211 17 228
X224 8 216
X235 34 201
X244 59 185
X250 83 166
X254 107 146
X254 130 124
X253 151 101
X249 171 77
X242 189 53
X233 205 27
X221 219 2
X208 231 23
X192 241 48
X174 248 73
X155 252 97
X133 254 120
X111 254 142
X87 251 163
X63 245 182
X38 237 199
X12 226 214
X12 214 226
X38 199 237
X63 182 245
X87 163 251
X111 142 254
X133 120 254
X155 97 252
X174 73 248
X192 48 241
X208 23 231
X221 2 219
X233 27 205
X242 53 189
X249 77 171
X253 101 151
X254 124 130
X254 146 107
X250 166 83
X244 185 59
X235 201 34
X224 216 8
X211 228 17
X196 239 42
X179 246 67
X160 251 91
X139 254 115
X117 254 137
X93 252 158
X69 247 177
X44 239 195
X19 229 210
X6 217 223
X31 203 235
X57 186 243
X81 168 250
X105 148 253
X128 126 254
X149 103 253
X169 79 249
X188 55 243
X204 29 234
X218 4 222
X230 21 209
X240 46 193
X247 71 176
X252 95 156
X254 119 135
X254 141 113
X251 161 89
X246 180 65
X238 197 40
X227 212 14
X215 225 10
X200 236 36
X183 245 61
X164 250 85
X144 254 109
X122 254 132
X99 253 153
X75 248 172
X50 241 190
X25 232 206
X0 220 220
X25 206 232
X50 190 241
X75 172 248
X99 153 253
X122 132 254
X144 109 254
X164 85 250
X183 61 245
X200 36 236
X215 10 225
X227 14 212
X238 40 197
X246 65 180
X251 89 161
X254 113 141
X254 135 119
X252 156 95
X247 176 71
X240 193 46
X230 209 21
X218 222 4
X204 234 29
X188 243 55
X169 249 79
X149 253 103
X128 254 126
X105 253 148
X81 250 168
X57 243 186
X31 235 203
X6 223 217
X19 210 229
X44 195 239
X69 177 247
X93 158 252
X117 137 254
X139 115 254
X160 91 251
X179 67 246
X196 42 239
X211 17 228
X224 8 216
X235 34 201
X244 59 185
X250 83 166
X254 107 146
X254 130 124
X253 151 101
X249 171 77
X242 189 53
X233 205 27
X221 219 2
X208 231 23
X192 241 48
X174 248 73
X155 252 97
X133 254 120
X111 254 142
X87 251 163
X63 245 182
X38 237 199
X12 226 214
X12 214 226
X38 199 237
X63 182 245
X87 163 251
X111 142 254
X133 120 254
X155 97 252
X174 73 248
X192 48 241
X208 23 231
X221 2 219
X233 27 205
X242 53 189
X249 77 171
X253 101 151
X254 124 130
X254 146 107
X250 166 83
X244 185 59
X235 201 34
X224 216 8
X211 228 17
X196 239 42
X179 246 67
X160 251 91
X139 254 115
X117 254 137
X93 252 158
X69 247 177
X44 239 195
X19 229 210
X6 217 223
X31 203 235
X57 186 243
X81 168 250
X105 148 253
X128 126 254
X149 103 253
X169 79 249
X188 55 243
X204 29 234
X218 4 222
X230 21 209
X240 46 193
X247 71 176
X252 95 156
X254 119 135
X254 141 113
X251 161 89
X246 180 65
X238 197 40
X227 212 14
X215 225 10
X200 236 36
X183 245 61
X164 250 85
X144 254 109
X122 254 132
X99 253 153
X75 248 172
X50 241 190
X25 232 206
END_OF_FILE
if test 2824 -ne `wc -c <'maps/special4.map'`; then
    echo shar: \"'maps/special4.map'\" unpacked with wrong size!
fi
# end of 'maps/special4.map'
fi
if test -f 'maps/special8.map' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'maps/special8.map'\"
else
echo shar: Extracting \"'maps/special8.map'\" \(2824 characters\)
sed "s/^X//" >'maps/special8.map' <<'END_OF_FILE'
X0 0 0
X0 0 0
X0 0 0
X0 0 0
X0 0 0
X0 0 0
X0 220 220
X50 190 241
X99 153 253
X144 109 254
X183 61 245
X215 10 225
X238 40 197
X251 89 161
X254 135 119
X247 176 71
X230 209 21
X204 234 29
X169 249 79
X128 254 126
X81 250 168
X31 235 203
X19 210 229
X69 177 247
X117 137 254
X160 91 251
X196 42 239
X224 8 216
X244 59 185
X254 107 146
X253 151 101
X242 189 53
X221 219 2
X192 241 48
X155 252 97
X111 254 142
X63 245 182
X12 226 214
X38 199 237
X87 163 251
X133 120 254
X174 73 248
X208 23 231
X233 27 205
X249 77 171
X254 124 130
X250 166 83
X235 201 34
X211 228 17
X179 246 67
X139 254 115
X93 252 158
X44 239 195
X6 217 223
X57 186 243
X105 148 253
X149 103 253
X188 55 243
X218 4 222
X240 46 193
X252 95 156
X254 141 113
X246 180 65
X227 212 14
X200 236 36
X164 250 85
X122 254 132
X75 248 172
X25 232 206
X25 206 232
X75 172 248
X122 132 254
X164 85 250
X200 36 236
X227 14 212
X246 65 180
X254 113 141
X252 156 95
X240 193 46
X218 222 4
X188 243 55
X149 253 103
X105 253 148
X57 243 186
X6 223 217
X44 195 239
X93 158 252
X139 115 254
X179 67 246
X211 17 228
X235 34 201
X250 83 166
X254 130 124
X249 171 77
X233 205 27
X208 231 23
X174 248 73
X133 254 120
X87 251 163
X38 237 199
X12 214 226
X63 182 245
X111 142 254
X155 97 252
X192 48 241
X221 2 219
X242 53 189
X253 101 151
X254 146 107
X244 185 59
X224 216 8
X196 239 42
X160 251 91
X117 254 137
X69 247 177
X19 229 210
X31 203 235
X81 168 250
X128 126 254
X169 79 249
X204 29 234
X230 21 209
X247 71 176
X254 119 135
X251 161 89
X238 197 40
X215 225 10
X183 245 61
X144 254 109
X99 253 153
X50 241 190
X0 220 220
X50 190 241
X99 153 253
X144 109 254
X183 61 245
X215 10 225
X238 40 197
X251 89 161
X254 135 119
X247 176 71
X230 209 21
X204 234 29
X169 249 79
X128 254 126
X81 250 168
X31 235 203
X19 210 229
X69 177 247
X117 137 254
X160 91 251
X196 42 239
X224 8 216
X244 59 185
X254 107 146
X253 151 101
X242 189 53
X221 219 2
X192 241 48
X155 252 97
X111 254 142
X63 245 182
X12 226 214
X38 199 237
X87 163 251
X133 120 254
X174 73 248
X208 23 231
X233 27 205
X249 77 171
X254 124 130
X250 166 83
X235 201 34
X211 228 17
X179 246 67
X139 254 115
X93 252 158
X44 239 195
X6 217 223
X57 186 243
X105 148 253
X149 103 253
X188 55 243
X218 4 222
X240 46 193
X252 95 156
X254 141 113
X246 180 65
X227 212 14
X200 236 36
X164 250 85
X122 254 132
X75 248 172
X25 232 206
X25 206 232
X75 172 248
X122 132 254
X164 85 250
X200 36 236
X227 14 212
X246 65 180
X254 113 141
X252 156 95
X240 193 46
X218 222 4
X188 243 55
X149 253 103
X105 253 148
X57 243 186
X6 223 217
X44 195 239
X93 158 252
X139 115 254
X179 67 246
X211 17 228
X235 34 201
X250 83 166
X254 130 124
X249 171 77
X233 205 27
X208 231 23
X174 248 73
X133 254 120
X87 251 163
X38 237 199
X12 214 226
X63 182 245
X111 142 254
X155 97 252
X192 48 241
X221 2 219
X242 53 189
X253 101 151
X254 146 107
X244 185 59
X224 216 8
X196 239 42
X160 251 91
X117 254 137
X69 247 177
X19 229 210
X31 203 235
X81 168 250
X128 126 254
X169 79 249
X204 29 234
X230 21 209
X247 71 176
X254 119 135
X251 161 89
X238 197 40
X215 225 10
X183 245 61
X144 254 109
X99 253 153
X50 241 190
END_OF_FILE
if test 2824 -ne `wc -c <'maps/special8.map'`; then
    echo shar: \"'maps/special8.map'\" unpacked with wrong size!
fi
# end of 'maps/special8.map'
fi
if test -f 'maps/white.map' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'maps/white.map'\"
else
echo shar: Extracting \"'maps/white.map'\" \(3036 characters\)
sed "s/^X//" >'maps/white.map' <<'END_OF_FILE'
X0 0 0
X0 0 0
X0 0 0
X0 0 0
X0 0 0
X0 0 0
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
X255 255 255
END_OF_FILE
if test 3036 -ne `wc -c <'maps/white.map'`; then
    echo shar: \"'maps/white.map'\" unpacked with wrong size!
fi
# end of 'maps/white.map'
fi
if test -f 'master/Chaos.ad' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'master/Chaos.ad'\"
else
echo shar: Extracting \"'master/Chaos.ad'\" \(2949 characters\)
sed "s/^X//" >'master/Chaos.ad' <<'END_OF_FILE'
X! dronePath specifies a path where the drone executable may
X! be found.  This is used by the master process when executing
X! remote drones via rsh.  The full path name is needed since
X! the drone executable will probably not be found in rsh's
X! PATH.
XChaos*dronePath: /usr/local/bin/X11/drone
X
X! mapDir specifies the pathname where colormap specification
X! files are stored.  These files have the extension ".map"
X! and are plain ASCII files consisting of red-green-blue 
X! triplets one to a line with values in the range 0-255.
X! New maps may be created by hand or with the help of the
X! gencmap utility.  This path should probably be changed
X! to some directory under the users home directory.
X! Currently it is set to work if chaos is executed from
X! chaos/master.
XChaos*mapDir: ../maps
X
X! imageDir specifies the pathname where images are to be
X! saved to and loaded from.  Images have filenames with
X! the extension ".cif" (chaos image format).  This format is
X! is an extension of the X window dump format which means
X! that chaos image format files may be loaded with xwud or
X! processed with any other conversion utility which recognizes
X! X window dump formatted images.  This path should be changed
X! to where the user wishes to store these images.
XChaos*imageDir: .
X
X! zoomDir specifies the pathname where the images of the zoom
X! stack are to be stored.  Zoom images have filenames of the
X! form "LEVEL##.cif".  This path should be changed to a 
X! directory where there is sufficient disk space to hold a
X! number of potentially large files.  The directory /tmp 
X! might be a good choice since this directory will be
X! periodically cleared of any old images.
XChaos*zoomDir: .
X
X! taskWidth and taskHeight are the width and height of the
X! tasks that the drawing region is divided into for 
X! computation by drone processes.
XChaos*taskWidth: 32
XChaos*taskHeight: 32
X
X! keepTasksSquare is a boolean value which determines if the
X! tasks should be forced to be square.  If the value is True,
X! taskWidth and taskHeight are set to their average and are
X! constrained to remain equal.  If the value is False, the
X! values may vary independently.
XChaos*keepTasksSquare: True
X
X! retainAspectRatio is a boolean value which determines if the
X! aspect ratio will be preserved while zooming.  If the value is
X! True, the zoom will occur around the center of the zoom
X! rectangle while preserving the same aspect ratio.  If the
X! value is False, the zoom will occur within the limits of the
X! zoom rectangle and the aspect ratio will be distorted.
XChaos*retainAspectRatio: True
X
X! iterationLimit specifies the maximum number of iterations
X! before a point will be considered to be within the Mandelbrot 
X! set (and colored black).
XChaos*iterationLimit: 256
X
X! hosts is a list of hostnames of machines which are available
X! to run one or more drone processes.  This resource should be
X! tailored to each site's environment.
XChaos*hosts: calvin hobbes
X
END_OF_FILE
if test 2949 -ne `wc -c <'master/Chaos.ad'`; then
    echo shar: \"'master/Chaos.ad'\" unpacked with wrong size!
fi
# end of 'master/Chaos.ad'
fi
if test -f 'master/messageDb.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'master/messageDb.c'\"
else
echo shar: Extracting \"'master/messageDb.c'\" \(4553 characters\)
sed "s/^X//" >'master/messageDb.c' <<'END_OF_FILE'
X/*
X * Copyright (c) Ken W. Marks 1989, 1990.
X */
X
X#include <stdio.h>
X#include <signal.h>
X#include <ctype.h>
X#include <X11/Intrinsic.h>
X#include <X11/StringDefs.h>
X#include <X11/Xaw/Form.h>
X#include <X11/Shell.h>
X#include <LocalDefs.h>
X#include <Colormap.h>
X#include <Canvas.h>
X#include <DlgShell.h>
X#include <Push.h>
X#include <Label.h>
X
X#define CONFIRM_PUSH		cwidgets[0]
X#define CANCEL_PUSH		cwidgets[1]
X#define CONFIRM_LABEL		cwidgets[2]
X
X#define NUM_CONF_CONTROLS	(unsigned) 2
X
X#define DISMISS_PUSH            mwidgets[0]
X#define MESSAGE_LABEL		mwidgets[1]
X
X#define NUM_MESG_CONTROLS	(unsigned) 2
X
X#define NUM_LABELS		(unsigned) 1
X
Xstatic void CommonPushActivate();
X
Xstatic Widget popup, form;
Xstatic Widget cwidgets[NUM_CONF_CONTROLS + NUM_LABELS];
Xstatic Widget mwidgets[NUM_MESG_CONTROLS + NUM_LABELS];
X
Xstatic XtCallbackRec callbacks[] = {
X    {CommonPushActivate, NULL},
X    {NULL, NULL},
X    {NULL, NULL},
X};
X
Xstatic Arg PopupArgs[] = {
X    {XtNallowShellResize, (XtArgVal) True},
X    {XtNborderWidth, (XtArgVal) 3},
X};
X
Xstatic Arg LabelArgs[] = {
X    {XtNfromHoriz, (XtArgVal) NULL},
X    {XtNfromVert, (XtArgVal) NULL},
X    {XtNhorizDistance, (XtArgVal) 10},
X    {XtNvertDistance, (XtArgVal) 10},
X    {XtNlabel, (XtArgVal) "This will be changed"},
X    {XtNresizable, (XtArgVal) True},
X    {XtNborderWidth, (XtArgVal) 0},
X};
X
Xstatic Arg PushArgs[] = {
X    {XtNfromHoriz, (XtArgVal) NULL},
X    {XtNfromVert, (XtArgVal) NULL},
X    {XtNhorizDistance, (XtArgVal) 10},
X    {XtNvertDistance, (XtArgVal) 10},
X    {XtNlabel, (XtArgVal) NULL},
X    {XtNdialogbox, (XtArgVal) NULL},
X    {XtNcallback, (XtArgVal) callbacks},
X    {XtNresizable, (XtArgVal) False},
X};
X
Xstatic Arg ChangeArgs[] = {
X    {XtNcallback, (XtArgVal) callbacks},
X};
X
X
X/*ARGSUSED*/
Xstatic void CommonPushActivate(widget, client_data, call_data)
XWidget widget;
Xcaddr_t client_data;
Xcaddr_t call_data;
X{
X    /* For pushbuttons, the parent dialogbox widget id is sent as the
X     * call_data for the callback function. */
X    DialogPopdown((Widget) call_data);
X}
X
X
Xvoid MessageSetup(message, proc)
Xchar *message;
XXtCallbackProc proc;
X{
X    LabelChangeLabel(MESSAGE_LABEL, message);
X
X    callbacks[1].callback = proc;
X    XtSetValues(DISMISS_PUSH, ChangeArgs, XtNumber(ChangeArgs));
X}
X
X
XWidget MessageCreateDialogbox(parent)
XWidget parent;
X{
X    popup = XtCreatePopupShell("message_dialogbox_popup",
X      dialogShellWidgetClass, parent, PopupArgs, XtNumber(PopupArgs));
X
X    form = XtCreateManagedWidget("message_dialogbox_form",
X      formWidgetClass, popup, (ArgList) NULL, 0);
X
X    LabelArgs[0].value = (XtArgVal) NULL;
X    LabelArgs[1].value = (XtArgVal) NULL;
X    MESSAGE_LABEL = XtCreateManagedWidget("message_label",
X      labelWidgetClass, form, LabelArgs, XtNumber(LabelArgs));
X
X    PushArgs[0].value = (XtArgVal) NULL;
X    PushArgs[1].value = (XtArgVal) MESSAGE_LABEL;
X    PushArgs[4].value = (XtArgVal) "Dismiss";
X    PushArgs[5].value = (XtArgVal) popup;
X    DISMISS_PUSH = XtCreateManagedWidget("dismiss_push", pushWidgetClass,
X      form, PushArgs, XtNumber(PushArgs));
X
X    DialogSetFocusOrder(popup, mwidgets, NUM_MESG_CONTROLS);
X
X    return (popup);
X}
X
X
Xvoid ConfirmSetup(message, proc)
Xchar *message;
XXtCallbackProc proc;
X{
X    LabelChangeLabel(CONFIRM_LABEL, message);
X
X    callbacks[1].callback = proc;
X    XtSetValues(CONFIRM_PUSH, ChangeArgs, XtNumber(ChangeArgs));
X}
X
X
XWidget ConfirmCreateDialogbox(parent)
XWidget parent;
X{
X    popup = XtCreatePopupShell("confirm_dialogbox_popup",
X      dialogShellWidgetClass, parent, PopupArgs, XtNumber(PopupArgs));
X
X    form = XtCreateManagedWidget("confirm_dialogbox_form",
X      formWidgetClass, popup, (ArgList) NULL, (Cardinal) 0);
X
X    LabelArgs[0].value = (XtArgVal) NULL;
X    LabelArgs[1].value = (XtArgVal) NULL;
X    CONFIRM_LABEL = XtCreateManagedWidget("confirm_label",
X      labelWidgetClass, form, LabelArgs, XtNumber(LabelArgs));
X
X    PushArgs[0].value = (XtArgVal) NULL;
X    PushArgs[1].value = (XtArgVal) CONFIRM_LABEL;
X    PushArgs[4].value = (XtArgVal) "Confirm";
X    PushArgs[5].value = (XtArgVal) popup;
X    CONFIRM_PUSH = XtCreateManagedWidget("confirm_push", pushWidgetClass,
X      form, PushArgs, XtNumber(PushArgs));
X
X    PushArgs[0].value = (XtArgVal) CONFIRM_PUSH;
X    PushArgs[1].value = (XtArgVal) CONFIRM_LABEL;
X    PushArgs[4].value = (XtArgVal) "Cancel";
X    PushArgs[5].value = (XtArgVal) popup;
X    CANCEL_PUSH = XtCreateManagedWidget("cancel_push", pushWidgetClass,
X      form, PushArgs, XtNumber(PushArgs));
X
X    DialogSetFocusOrder(popup, cwidgets, NUM_CONF_CONTROLS);
X
X    return (popup);
X}
END_OF_FILE
if test 4553 -ne `wc -c <'master/messageDb.c'`; then
    echo shar: \"'master/messageDb.c'\" unpacked with wrong size!
fi
# end of 'master/messageDb.c'
fi
if test -f 'master/queue.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'master/queue.c'\"
else
echo shar: Extracting \"'master/queue.c'\" \(3018 characters\)
sed "s/^X//" >'master/queue.c' <<'END_OF_FILE'
X/*
X * Copyright (c) Ken W. Marks 1989, 1990.
X */
X
X#include <stdio.h>
X#include <X11/Intrinsic.h>
X#include <Chaos.h>
X#include <Task.h>
X#include <Queue.h>
X
X/* tail pointers are stored in the previous pointer of the 1st node */
X
Xstatic Task *free_list;
Xstatic Task *run_list;
Xstatic Task *wait_list;
Xstatic Task *stale_list;
Xstatic Task *zombie_list;
Xstatic Task *unfinished_list;
X
X
XTask *AllocTask()
X{
X    Task *task;
X    int ii;
X
X    if (free_list == NULL)
X    {
X	free_list = (Task *) malloc(TASK_ALLOC_COUNT * sizeof(Task));
X	if (free_list == NULL)
X	{
X	    eprintf("Could not malloc %d bytes!\n",
X	      TASK_ALLOC_COUNT * sizeof(Task));
X	    abort();
X	}
X	for (ii = 0; ii < TASK_ALLOC_COUNT - 1; ++ii)
X	    free_list[ii].next = &free_list[ii + 1];
X	free_list[ii].next = NULL;
X    }
X    task = free_list;
X    free_list = free_list->next;
X    return (task);
X}
X
X
Xvoid FreeTask(task)
XTask *task;
X{
X    task->next = free_list;
X    free_list = task;
X}
X
X
XTask *TaskFind(qtype, window, serial)
XQueueType qtype;
XWindow window;
Xlong serial;
X{
X    Task *task;
X
X    switch (qtype)
X    {
X    case runQ:
X	task = run_list;
X	break;
X
X    case waitQ:
X	task = wait_list;
X	break;
X
X    case staleQ:
X	task = stale_list;
X	break;
X
X    case zombieQ:
X	task = zombie_list;
X	break;
X
X    case unfinishedQ:
X	task = unfinished_list;
X	break;
X
X    default:
X	eprintf("Now how the heck did you manage that?!\n");
X	abort();
X    }
X
X    while (task != NULL)
X    {
X	if ((window == NULL || task->window == window) &&
X	  (serial == NULL || task->serial == serial))
X	    break;
X	task = task->next;
X    }
X    return (task);
X}
X
X
Xvoid TaskNQ(qtype, task)
XQueueType qtype;
XTask *task;
X{
X    Task **queue;
X
X    switch (qtype)
X    {
X    case runQ:
X	queue = &run_list;
X	break;
X
X    case waitQ:
X	queue = &wait_list;
X	break;
X
X    case staleQ:
X	queue = &stale_list;
X	break;
X
X    case zombieQ:
X	queue = &zombie_list;
X	break;
X
X    case unfinishedQ:
X	queue = &unfinished_list;
X	break;
X
X    default:
X	eprintf("Now how the heck did you manage that?!\n");
X	abort();
X    }
X
X    task->next = NULL;
X
X    if (*queue == NULL)
X	*queue = task;
X    else
X    {
X	(*queue)->prev->next = task;
X	task->prev = (*queue)->prev;
X    }
X
X    (*queue)->prev = task;
X}
X
X
XTask *TaskDQ(qtype, window, serial)
XQueueType qtype;
XWindow window;
Xlong serial;
X{
X    Task *task;
X    Task **queue;
X
X    switch (qtype)
X    {
X    case runQ:
X	queue = &run_list;
X	break;
X
X    case waitQ:
X	queue = &wait_list;
X	break;
X
X    case staleQ:
X	queue = &stale_list;
X	break;
X
X    case zombieQ:
X	queue = &zombie_list;
X	break;
X
X    case unfinishedQ:
X	queue = &unfinished_list;
X	break;
X
X    default:
X	eprintf("Now how the heck did you manage that?!\n");
X	abort();
X    }
X
X    task = TaskFind(qtype, window, serial);
X    if (task == NULL)
X	return (NULL);
X
X    if (task->next == NULL)	/* taking last task (tail) */
X	(*queue)->prev = task->prev;
X    else
X	task->next->prev = task->prev;
X
X    if (task == *queue)		/* taking first task (head) */
X	*queue = task->next;
X    else
X	task->prev->next = task->next;
X
X    return (task);
X}
END_OF_FILE
if test 3018 -ne `wc -c <'master/queue.c'`; then
    echo shar: \"'master/queue.c'\" unpacked with wrong size!
fi
# end of 'master/queue.c'
fi
if test -f 'master/task.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'master/task.c'\"
else
echo shar: Extracting \"'master/task.c'\" \(4989 characters\)
sed "s/^X//" >'master/task.c' <<'END_OF_FILE'
X/*
X * Copyright (c) Ken W. Marks 1989, 1990.
X */
X
X#include <stdio.h>
X#include <fcntl.h>
X#include <math.h>
X#include <X11/Intrinsic.h>
X#include <Chaos.h>
X#include <Ipc.h>
X#include <Canvas.h>
X#include <Task.h>
X#include <Queue.h>
X
X
Xvoid PrintTask(task)
XTask *task;
X{
X    (void) printf("serial=%d window=0x%x\n",
X      task->serial, task->window);
X
X    (void) printf("p_lo=%.20G p_hi=%.20G\n", task->p_lo, task->p_hi);
X    (void) printf("q_lo=%.20G q_hi=%.20G\n", task->q_lo, task->q_hi);
X
X    (void) printf("x=%d y=%d width=%d height=%d limit=%d method=%d\n\n",
X      task->x, task->y, task->width, task->height, task->limit, task->method);
X}
X
X
XBoolean SendTask(task)
XTask *task;
X{
X    ImageRequest req;
X
X    req.byte_order = 0x11223344;
X    req.type = IMAGE_REQUEST;
X    req.serial = task->serial;
X    req.width = task->width;
X    req.height = task->height;
X    req.limit = task->limit;
X    req.method = task->method;
X    (void) sprintf(req.p_lo, "%.20G", task->p_lo);
X    (void) sprintf(req.p_hi, "%.20G", task->p_hi);
X    (void) sprintf(req.q_lo, "%.20G", task->q_lo);
X    (void) sprintf(req.q_hi, "%.20G", task->q_hi);
X
X    return (SendMsg(task->window, (unsigned) sizeof(ImageRequest),
X	(char *) &req));
X}
X
X
Xvoid MakeTasksStale()
X{
X    Task *task;
X
X    while ((task = TaskDQ(runQ, (Window) NULL, (long) NULL)) != NULL)
X    {
X
X#ifdef DEBUG
X	dprintf("Moved following task from run queue to stale queue:\n");
X	PrintTask(task);
X#endif
X
X	TaskNQ(staleQ, task);
X    }
X}
X
X
Xvoid WasteTasks()
X{
X    Task *task;
X
X    while ((task = TaskDQ(zombieQ, (Window) NULL, (long) NULL)) != NULL)
X    {
X
X#ifdef DEBUG
X	dprintf("Removed following task from zombie queue:\n");
X	PrintTask(task);
X#endif
X
X	FreeTask(task);
X    }
X
X    while ((task = TaskDQ(unfinishedQ, (Window) NULL, (long) NULL)) != NULL)
X    {
X
X#ifdef DEBUG
X	dprintf("Removed following task from unfinished queue:\n");
X	PrintTask(task);
X#endif
X
X	FreeTask(task);
X    }
X}
X
X
Xvoid StartDrawing(widget)
XWidget widget;
X{
X    Task *task;
X
X    /* make sure we are unpaused */
X    CanvasUnpause(widget);
X
X    while ((task = TaskDQ(waitQ, (Window) NULL, (long) NULL)) != NULL)
X    {
X	CanvasFillTask(widget, task);
X
X#ifdef DEBUG
X	dprintf("Moved following task from wait queue to run queue:\n");
X	PrintTask(task);
X#endif
X
X	TaskNQ(runQ, task);
X	if (SendTask(task) == False)
X	    eprintf("SendTask() failed\n");
X    }
X}
X
X
Xvoid WriteTask(fd, task)
Xint fd;
XTask *task;
X{
X    TaskSaveStruct package;
X    unsigned long swap_test = 1;
X    extern void ByteSwapLong();
X
X    package.serial = (long) task->serial;
X    package.x = (long) task->x;
X    package.y = (long) task->y;
X    package.width = (long) task->width;
X    package.height = (long) task->height;
X    package.limit = (long) task->limit;
X    package.method = (long) task->method;
X
X    /* do the necessary swapping before laying in the strings */
X    if (*(char *) &swap_test)
X	ByteSwapLong((char *) &package, sizeof(TaskSaveStruct));
X
X    (void) sprintf(package.p_lo, "%.20G", task->p_lo);
X    (void) sprintf(package.p_hi, "%.20G", task->p_hi);
X    (void) sprintf(package.q_lo, "%.20G", task->q_lo);
X    (void) sprintf(package.q_hi, "%.20G", task->q_hi);
X
X    (void) write(fd, (char *) &package, sizeof(TaskSaveStruct));
X}
X
X
Xvoid SaveTasks(fd, destructive)
Xint fd;
XBoolean destructive;
X{
X    Task *task;
X
X#ifdef DEBUG
X    dprintf("Saving the following task(s):\n");
X#endif
X
X    if (destructive)
X	while ((task = TaskDQ(runQ, (Window) NULL, (long) NULL)) != NULL)
X	{
X
X#ifdef DEBUG
X	    PrintTask(task);
X#endif
X	    TaskNQ(staleQ, task);
X	    WriteTask(fd, task);
X	}
X    else
X    {
X	task = TaskFind(runQ, (Window) NULL, (long) NULL);
X	while (task != NULL)
X	{
X
X#ifdef DEBUG
X	    PrintTask(task);
X#endif
X	    WriteTask(fd, task);
X	    task = task->next;
X	}
X    }
X}
X
X
XBoolean ReadTask(fd, task)
Xint fd;
XTask *task;
X{
X    TaskSaveStruct package;
X    unsigned long swap_test = 1;
X    extern void ByteSwapLong();
X
X    if (read(fd, (char *) &package, sizeof(TaskSaveStruct)) <
X      sizeof(TaskSaveStruct))
X	return (False);
X
X    /* grab the strings before doing the necessary swapping */
X    task->p_lo = atof(package.p_lo);
X    task->p_hi = atof(package.p_hi);
X    task->q_lo = atof(package.q_lo);
X    task->q_hi = atof(package.q_hi);
X
X    if (*(char *) &swap_test)
X	ByteSwapLong((char *) &package, sizeof(TaskSaveStruct));
X
X    task->serial = (short) package.serial;
X    task->x = (short) package.x;
X    task->y = (short) package.y;
X    task->width = (short) package.width;
X    task->height = (short) package.height;
X    task->limit = (short) package.limit;
X    task->method = (short) package.method;
X    return (True);
X}
X
X
Xvoid LoadTasks(fd)
Xint fd;
X{
X    Task task;
X    Task *ptask;
X
X#ifdef DEBUG
X    dprintf("Loading the following task(s):\n");
X#endif
X
X    while (ReadTask(fd, &task))
X    {
X
X#ifdef DEBUG
X	PrintTask(&task);
X#endif
X	ptask = AllocTask();
X	(void) memcpy((char *) ptask, (char *) &task, sizeof(Task));
X
X	/* put this task with all the other unfinished business */
X	TaskNQ(unfinishedQ, ptask);
X    }
X}
END_OF_FILE
if test 4989 -ne `wc -c <'master/task.c'`; then
    echo shar: \"'master/task.c'\" unpacked with wrong size!
fi
# end of 'master/task.c'
fi
echo shar: End of archive 8 \(of 10\).
cp /dev/null ark8isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 10 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

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