Article: 1761
From: staples@csg.lbl.gov (John Staples)
Newsgroups: rec.puzzles.crosswords
Subject: Crossword puzzle solver/generator for Sun 4.1.2 Openwindows
Date: 14 Mar 1994 18:32:34 GMT
Organization: Lawrence Berkeley Laboratory, California
 
 
Here's an Aerican-style crossword puzzle generator/solver with nice
graphics and dictionary help.  Compiles on a Sun Openwindows 4.1.2 platform.
Uses mouse and keyboard.  Enforces diagonal symmetry.  Quite intuitive
graphical user interface.
 
-------------------------------------cut here---------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	xword.6
#	README
#	Makefile
#	xword.c
#	xword.h
#	xword.save1
#	xword.list
#	xword.ps
# This archive created: Mon Mar 14 10:26:17 1994
export PATH; PATH=/bin:$PATH
echo shar: extracting "'xword.6'" '(3769 characters)'
if test -f 'xword.6'
then
	echo shar: will not over-write existing file "'xword.6'"
else
sed 's/^	X//' << \SHAR_EOF > 'xword.6'
	X.TH XWORD 6 "March 1994" "OpenWindows Version 1.0"
	X.SH NAME
	X
	Xxword  \- Crossword puzzle generation/solving program
	X
	X.SH SYNOPSIS
	X
	X.B xword
	X
	X.SH DESCRIPTION
	X
	X.I xword
	Xis an OpenWindows program to solve or generate an American-style
	Xcrossword puzzle.  Upon opening the program, a 15 x 15 blank grid
	Xis presented, along with a control panel.  The grid size can be
	Xvaried from 5 x 5 to 24 x 24.
	X.PP
	XBlack squares are placed, and 
	X.I xword
	Xinsures they are symmetric across the diagonal.  The mouse
	Xkeys select the entry mode (see below) for black squares
	Xor words.
	XThe crossword grid is automatically numbered as black squares
	Xare added or subtracted.
	X.PP
	XIf you have a dictionary, 
	X.I xword
	Xwill supply you with words that fit the the current word
	Xspace, taking into account letters that currently fill that
	Xspace.
	X.PP
	X.I xword
	Xwill save the wordlist to a formatted printfile, and will
	Xgenerate a postscript file containing the completed crossword
	Xgrid.  It will also flip the puzzle across the diagonal, and
	Xsave/recall up to nine temporary grid files.  The directory
	Xentries of the savefiles can be listed from within the program.
	X
	X.SH MODES
	XThree data entry modes are selected by the mouse. 
	XInitially, the left mouse button is used to enter/delete
	Xblack squares.  The center and right mouse buttons are used
	Xto switch to "across" or "down" word entry mode, which uses
	Xthe keyboard.
	X
	X.SH CONTROL PANEL
	X.PP
	XThe control panel consists of the following buttons and one
	Xtext entry item:
	X
	X.TS
	X;
	Xr l.
	XQuit	Exit immediately
	XReset	Reinitialize the program - all data lost
	XRefresh	Simply refresh the screen
	XList Words	Generate a formatted word list file, and also to stdout
	XFlip	Flip the puzzle across the diagonal
	XClear Words	Clear letters: leave grid
	XList Saves	List, on stdout, the current saved grids
	XPostscript	Generate a postscript plot file of the puzzle
	XSave n	Save current grid to a file; n in [1-9]
	XRecall n	Read back in previously saved grid, overwrite current
	XGrid Size<15>	Change grid size within the range of [5-24]
	X.TE
	X
	X.SH MOUSE CONTROL
	X.PP
	XThe mouse is used to control the entry of data.  The mouse keys
	Xare defined as follows:
	X
	X.TS
	X;
	Xl c l.
	X  Select	(Left button)	Insert/delete black space
	X  Adjust	(Center button)	Start an across word
	X  Menu	(Right button)	Start a down word
	X.TE
	X
	X.PP
	XThe cursor, initially a black space cursor, will change to across
	Xor down arrow cursors indicating the entry mode.  For each black grid square
	Xentered/deleted (it is a toggle), the symmetric one along the
	Xdiagonal will also be entered/deleted.
	X.PP
	XIn the across or down character entry modes, characters are typed
	Xon the keyboard, converted to upper case, and entered in the grid.
	XYou cannot type into a black square, or into a square that contains
	Xa letter different from the one you type.  You can erase characters
	Xby either backspacing or entering a blank (space).
	X
	X.SH DICTIONARY HELP
	X.PP
	XIf you have a dictionary, such as /usr/dict/words, 
	X.I xword
	Xwill supply you with suggestions to fill a given word space.
	XThe list is written to stdout through the pager more.
	XA word space is defined by the position on the grid that the
	Xcursor was last clicked in the across or down mode to the
	Xend of the wordspace, defined by a black cell or the edge of the
	Xgrid.  Any characters already in the word space limit the dictionary
	Xsearch.
	X
	X.SH FILES
	X.PP
	X.I xword
	Xwrites in the user file directory space grid save files saveN, where N is in [1-9],
	Xwhich can be later recalled by
	X.I xword.
	XIt also writes xword.list, a formatted file of all wordspaces in the
	Xpuzzle, and xword.ps, a Postscript plot of the grid.
	X
	Xxword - xword for X11 Copyright 1994 by John Staples
	X
	X.SH AUTHOR
	X
	XJohn Staples, staples@lbl.gov
	X
	X.SH BUGS
	X
	XMay still be some, but
	X.I xword
	Xis small enough to be tractable.
	X
SHAR_EOF
if test 3769 -ne "`wc -c < 'xword.6'`"
then
	echo shar: error transmitting "'xword.6'" '(should have been 3769 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'README'" '(579 characters)'
if test -f 'README'
then
	echo shar: will not over-write existing file "'README'"
else
sed 's/^	X//' << \SHAR_EOF > 'README'
	X
	Xxword is an American-style crossword puzzle generator/solver utility.
	X
	X
	Xxword is compiled under Sun OpenWindows 4.1.2 with the Makefile
	Xprovided. Take a look at the xword.h file and adjust it accordingly
	Xto your own word dictionary (try /usr/dict/words), and where you want
	Xthe save files and Postscript files to be deposited. The grid size is
	Xsomewhat hard-wired into the code, which is optimized with regard to
	Xfont size, readibility, etc.
	X
	Xxword.list is the wordlist of a recent NYT puzzle, xword.ps is the
	XPostscript plot of it, and xword.save1 is the savefile of the same.
SHAR_EOF
if test 579 -ne "`wc -c < 'README'`"
then
	echo shar: error transmitting "'README'" '(should have been 579 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'Makefile'" '(265 characters)'
if test -f 'Makefile'
then
	echo shar: will not over-write existing file "'Makefile'"
else
sed 's/^	X//' << \SHAR_EOF > 'Makefile'
	X#! /bin/sh
	X#
	X
	XINCLUDE		= -I${OPENWINHOME}/include
	XCFLAGS		= ${INCLUDE} -O3
	XXVIEW_LIBS	=  -L${OPENWINHOME}/lib -lxview -lolgx -lX11
	XCC              = cc
	X
	Xxword:	xword.c xword.h
	X	${CC} ${CFLAGS} ${LDFLAGS} -o xword ${XVIEW_LIBS} xword.c
	X
	Xclean:
	X	rm -f core *.o xword
SHAR_EOF
if test 265 -ne "`wc -c < 'Makefile'`"
then
	echo shar: error transmitting "'Makefile'" '(should have been 265 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'xword.c'" '(26363 characters)'
if test -f 'xword.c'
then
	echo shar: will not over-write existing file "'xword.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'xword.c'
	X/* Generate or solve crossword puzzles, with dictionary help  */
	X/* John Staples */
	X
	X#include <X11/Xlib.h>
	X#include <X11/Xutil.h>
	X#include <xview/xview.h>
	X#include <xview/canvas.h>
	X#include <xview/xv_xrect.h>
	X#include <xview/panel.h>
	X#include <xview/cms.h>
	X#include <xview/font.h>
	X#include <math.h>
	X#include <stdio.h>
	X#include <string.h>
	X#include <ctype.h>
	X#include <stdlib.h>
	X#include <xview/cursor.h>
	X#include <xview/svrimage.h>
	X#include "xword.h"
	X
	X#define TRUE		1
	X#define FALSE		0
	X
	X#define BLACK		-1
	X#define WHITE		0
	X
	X#define ACROSS		1
	X#define DOWN		2
	X
	X#define WRITE_GRID	1
	X#define PUT_LETTER	2
	X
	XFrame           frame1, frame2;
	XRect            rect1;
	XPanel           panel;
	XCanvas          canvas;
	XPanel_numeric_text_item N_select;
	XPanel_button_item quit_button, reset_button, print_button, clear_button,
	X		refresh_button, flip_button, dir_button, ps_button,
	X		save_button1,
	X		save_button2,
	X		save_button3,
	X		save_button4,
	X		save_button5,
	X		save_button6,
	X		save_button7,
	X		save_button8,
	X		save_button9,
	X		recall_button1;
	X		recall_button2;
	X		recall_button3;
	X		recall_button4;
	X		recall_button5;
	X		recall_button6;
	X		recall_button7;
	X		recall_button8;
	X		recall_button9;
	Xint             N;
	Xint             A[Nmax][Nmax];
	Xint             direction, action, letter, istart, jstart;
	XXv_Font         font1, font2;
	Xint             width, height;
	XXGCValues       gcvalues;
	XGC              gc1, gc2;
	XDisplay        *dpy;
	XXv_Cursor       block_cursor, across_cursor, down_cursor;
	XServer_image    svr_image;
	X
	Xmain(argc, argv)
	X	int             argc;
	X	char           *argv[];
	X{
	X	void            quit(), canvas_repaint_proc(), mouse_event(), get_N(),
	X	                reset_proc(), save_proc(), print_proc(), clear_proc(),
	X	                refresh_proc(), flip_proc(), recall_proc(), dir_proc(), ps_proc();
	X	int             i, j;
	X
	X	svr_image = (Server_image) xv_create(XV_NULL, SERVER_IMAGE,
	X					XV_WIDTH, 16,
	X					XV_HEIGHT, 16,
	X					SERVER_IMAGE_BITS, across_bits,
	X					NULL);
	X
	X	across_cursor = (Xv_Cursor) xv_create(XV_NULL, CURSOR,
	X					CURSOR_IMAGE, svr_image,
	X					CURSOR_XHOT, 8,
	X					CURSOR_YHOT, 8,
	X					NULL);
	X
	X	svr_image = (Server_image) xv_create(XV_NULL, SERVER_IMAGE,
	X					XV_WIDTH, 16,
	X					XV_HEIGHT, 16,
	X					SERVER_IMAGE_BITS, down_bits,
	X					NULL);
	X
	X	down_cursor = (Xv_Cursor) xv_create(XV_NULL, CURSOR,
	X					CURSOR_IMAGE, svr_image,
	X					CURSOR_XHOT, 8,
	X					CURSOR_YHOT, 8,
	X					NULL);
	X
	X	svr_image = (Server_image) xv_create(XV_NULL, SERVER_IMAGE,
	X					XV_WIDTH, 16,
	X					XV_HEIGHT, 16,
	X					SERVER_IMAGE_BITS, block_bits,
	X					NULL);
	X
	X	block_cursor = (Xv_Cursor) xv_create(XV_NULL, CURSOR,
	X					CURSOR_IMAGE, svr_image,
	X					CURSOR_XHOT, 8,
	X					CURSOR_YHOT, 8,
	X					NULL);
	X
	X	xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
	X
	X	frame1 = xv_create(XV_NULL, FRAME,
	X					XV_WIDTH, 525,
	X					XV_HEIGHT, 525,
	X					FRAME_LABEL, "Crossword Display",
	X					FRAME_SHOW_FOOTER, FALSE,
	X					FRAME_SHOW_RESIZE_CORNER, TRUE,
	X					NULL);
	X
	X	frame2 = xv_create(frame1, FRAME,
	X					XV_WIDTH, 305,
	X					XV_HEIGHT, 280,
	X					FRAME_LABEL, "Crosswords Control",
	X					FRAME_SHOW_FOOTER, FALSE,
	X					FRAME_SHOW_RESIZE_CORNER, TRUE,
	X					NULL);
	X
	X	canvas = xv_create(frame1, CANVAS,
	X					CANVAS_REPAINT_PROC, canvas_repaint_proc,
	X					CANVAS_X_PAINT_WINDOW, TRUE,
	X					CANVAS_AUTO_EXPAND, TRUE,
	X					XV_WIDTH, WIN_EXTEND_TO_EDGE,
	X					XV_HEIGHT, WIN_EXTEND_TO_EDGE,
	X			   		NULL);
	X
	X	xv_set(canvas_paint_window(canvas),	/* calls event_proc on canvas mouse, keyboard hit */
	X					WIN_EVENT_PROC, mouse_event,
	X					WIN_CONSUME_EVENTS,
	X					WIN_MOUSE_BUTTONS, WIN_ASCII_EVENTS, NULL,
	X					NULL);
	X
	X	panel = xv_create(frame2, PANEL,
	X			  		NULL);
	X
	X	quit_button = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 10,
	X					XV_Y, 10,
	X					PANEL_LABEL_STRING, "Quit ",
	X					PANEL_NOTIFY_PROC, quit,
	X					NULL);
	X
	X	reset_button = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 10,
	X					XV_Y, 40,
	X					PANEL_LABEL_STRING, "Reset ",
	X					PANEL_NOTIFY_PROC, reset_proc,
	X					NULL);
	X
	X	refresh_button = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 10,
	X					XV_Y, 70,
	X					PANEL_LABEL_STRING, "Refresh ",
	X					PANEL_NOTIFY_PROC, refresh_proc,
	X					NULL);
	X
	X	print_button = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 10,
	X					XV_Y, 100,
	X					PANEL_LABEL_STRING, "List Words ",
	X					PANEL_NOTIFY_PROC, print_proc,
	X					NULL);
	X
	X	flip_button = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 10,
	X					XV_Y, 130,
	X					PANEL_LABEL_STRING, "Flip ",
	X					PANEL_NOTIFY_PROC, flip_proc,
	X					NULL);
	X
	X	clear_button = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 10,
	X					XV_Y, 160,
	X					PANEL_LABEL_STRING, "Clear Words ",
	X					PANEL_NOTIFY_PROC, clear_proc,
	X					NULL);
	X	
	X	dir_button = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 10,
	X					XV_Y, 190,
	X					PANEL_LABEL_STRING, "List Saves ",
	X					PANEL_NOTIFY_PROC, dir_proc,
	X					NULL);
	X	
	X	ps_button = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 10,
	X					XV_Y, 220,
	X					PANEL_LABEL_STRING, "Postscript  ",
	X					PANEL_NOTIFY_PROC, ps_proc,
	X					NULL);
	X	
	X	N_select = xv_create(panel, PANEL_NUMERIC_TEXT,
	X					XV_X, 10,
	X					XV_Y, 252,
	X					PANEL_LABEL_STRING, "Grid Size",
	X					PANEL_VALUE_DISPLAY_WIDTH, 3,
	X					PANEL_DIRECTION, PANEL_HORIZONTAL,
	X					PANEL_MIN_VALUE, 5,
	X					PANEL_MAX_VALUE, Nmax - 1,
	X					PANEL_VALUE, Ninit,
	X					PANEL_NOTIFY_PROC, get_N,
	X					PANEL_READ_ONLY, FALSE,
	X					NULL);
	X
	X	save_button1 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 160,
	X					XV_Y, 10,
	X					PANEL_LABEL_STRING, "Save 1 ",
	X					PANEL_NOTIFY_PROC, save_proc,
	X					PANEL_CLIENT_DATA, 1,
	X					NULL);
	X
	X	save_button2 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 160,
	X					XV_Y, 40,
	X					PANEL_LABEL_STRING, "Save 2 ",
	X					PANEL_NOTIFY_PROC, save_proc,
	X					PANEL_CLIENT_DATA, 2,
	X					NULL);
	X
	X	save_button3 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 160,
	X					XV_Y, 70,
	X					PANEL_LABEL_STRING, "Save 3 ",
	X					PANEL_NOTIFY_PROC, save_proc,
	X					PANEL_CLIENT_DATA, 3,
	X					NULL);
	X
	X	save_button4 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 160,
	X					XV_Y, 100,
	X					PANEL_LABEL_STRING, "Save 4 ",
	X					PANEL_NOTIFY_PROC, save_proc,
	X					PANEL_CLIENT_DATA, 4,
	X					NULL);
	X
	X	save_button5 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 160,
	X					XV_Y, 130,
	X					PANEL_LABEL_STRING, "Save 5 ",
	X					PANEL_NOTIFY_PROC, save_proc,
	X					PANEL_CLIENT_DATA, 5,
	X					NULL);
	X
	X	save_button6 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 160,
	X					XV_Y, 160,
	X					PANEL_LABEL_STRING, "Save 6 ",
	X					PANEL_NOTIFY_PROC, save_proc,
	X					PANEL_CLIENT_DATA, 6,
	X					NULL);
	X
	X	save_button7 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 160,
	X					XV_Y, 190,
	X					PANEL_LABEL_STRING, "Save 7 ",
	X					PANEL_NOTIFY_PROC, save_proc,
	X					PANEL_CLIENT_DATA, 7,
	X					NULL);
	X
	X	save_button8 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 160,
	X					XV_Y, 220,
	X					PANEL_LABEL_STRING, "Save 8 ",
	X					PANEL_NOTIFY_PROC, save_proc,
	X					PANEL_CLIENT_DATA, 8,
	X					NULL);
	X
	X	save_button9 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 160,
	X					XV_Y, 250,
	X					PANEL_LABEL_STRING, "Save 9 ",
	X					PANEL_NOTIFY_PROC, save_proc,
	X					PANEL_CLIENT_DATA, 9,
	X					NULL);
	X
	X	recall_button1 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 230,
	X					XV_Y, 10,
	X					PANEL_LABEL_STRING, "Recall 1 ",
	X					PANEL_NOTIFY_PROC, recall_proc,
	X					PANEL_CLIENT_DATA, 1,
	X					NULL);
	X
	X	recall_button2 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 230,
	X					XV_Y, 40,
	X					PANEL_LABEL_STRING, "Recall 2 ",
	X					PANEL_NOTIFY_PROC, recall_proc,
	X					PANEL_CLIENT_DATA, 2,
	X					NULL);
	X
	X	recall_button3 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 230,
	X					XV_Y, 70,
	X					PANEL_LABEL_STRING, "Recall 3 ",
	X					PANEL_NOTIFY_PROC, recall_proc,
	X					PANEL_CLIENT_DATA, 3,
	X					NULL);
	X
	X	recall_button4 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 230,
	X					XV_Y, 100,
	X					PANEL_LABEL_STRING, "Recall 4 ",
	X					PANEL_NOTIFY_PROC, recall_proc,
	X					PANEL_CLIENT_DATA, 4,
	X					NULL);
	X
	X	recall_button5 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 230,
	X					XV_Y, 130,
	X					PANEL_LABEL_STRING, "Recall 5 ",
	X					PANEL_NOTIFY_PROC, recall_proc,
	X					PANEL_CLIENT_DATA, 5,
	X					NULL);
	X
	X	recall_button6 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 230,
	X					XV_Y, 160,
	X					PANEL_LABEL_STRING, "Recall 6 ",
	X					PANEL_NOTIFY_PROC, recall_proc,
	X					PANEL_CLIENT_DATA, 6,
	X					NULL);
	X
	X	recall_button7 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 230,
	X					XV_Y, 190,
	X					PANEL_LABEL_STRING, "Recall 7 ",
	X					PANEL_NOTIFY_PROC, recall_proc,
	X					PANEL_CLIENT_DATA, 7,
	X					NULL);
	X
	X	recall_button8 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 230,
	X					XV_Y, 220,
	X					PANEL_LABEL_STRING, "Recall 8 ",
	X					PANEL_NOTIFY_PROC, recall_proc,
	X					PANEL_CLIENT_DATA, 8,
	X					NULL);
	X
	X	recall_button9 = xv_create(panel, PANEL_BUTTON,
	X					XV_X, 230,
	X					XV_Y, 250,
	X					PANEL_LABEL_STRING, "Recall 9 ",
	X					PANEL_NOTIFY_PROC, recall_proc,
	X					PANEL_CLIENT_DATA, 9,
	X					NULL);
	X
	X	N = Ninit;
	X	direction = ACROSS;
	X	action = WRITE_GRID;
	X	width = 525;
	X	height = 525;
	X	istart = -1;
	X	jstart = -1;
	X
	X	for (i = 0; i < Nmax; i++)
	X		for (j = 0; j < Nmax; j++)
	X			A[i][j] = WHITE;
	X
	X	font1 = (Xv_Font) xv_find(frame1, FONT,
	X				  FONT_FAMILY, FONT_FAMILY_HELVETICA,
	X				  FONT_STYLE, FONT_STYLE_NORMAL,
	X				  FONT_SIZE, 12,
	X				  NULL);
	X	if (!font1) {
	X		fprintf(stderr, "%s: cannot use font1\n", argv[0]);
	X		font1 = (Xv_Font) xv_get(frame1, XV_FONT);
	X	}
	X	dpy = (Display *) xv_get(frame1, XV_DISPLAY);
	X	gcvalues.font = (Font) xv_get(font1, XV_XID);
	X	gcvalues.foreground = BlackPixel(dpy, DefaultScreen(dpy));
	X	gcvalues.background = WhitePixel(dpy, DefaultScreen(dpy));
	X	gc1 = XCreateGC(dpy, RootWindow(dpy, DefaultScreen(dpy)),
	X		 GCForeground | GCBackground | GCFont | GCGraphicsExposures,
	X			&gcvalues);
	X
	X	font2 = (Xv_Font) xv_find(frame1, FONT,
	X				  FONT_FAMILY, FONT_FAMILY_HELVETICA,
	X				  FONT_STYLE, FONT_STYLE_BOLD,
	X				  FONT_SIZE, 24,
	X				  NULL);
	X	if (!font2) {
	X		fprintf(stderr, "%s: cannot use font2\n", argv[0]);
	X		font2 = (Xv_Font) xv_get(frame1, XV_FONT);
	X	}
	X	gcvalues.font = (Font) xv_get(font2, XV_XID);
	X	gcvalues.foreground = BlackPixel(dpy, DefaultScreen(dpy));
	X	gcvalues.background = WhitePixel(dpy, DefaultScreen(dpy));
	X	gc2 = XCreateGC(dpy, RootWindow(dpy, DefaultScreen(dpy)),
	X		 GCForeground | GCBackground | GCFont | GCGraphicsExposures,
	X			&gcvalues);
	X
	X	xv_set(xv_get(canvas, CANVAS_NTH_PAINT_WINDOW, 0),
	X	       WIN_CURSOR, block_cursor,
	X	       NULL);
	X
	X	xv_set(frame2, XV_SHOW, TRUE, NULL);
	X	xv_main_loop(frame1);
	X}
	X
	Xvoid
	Xquit(item, event)		/* quit button */
	X	Panel_item      item;
	X	Event          *event;
	X{
	X	xv_destroy_safe(frame1);
	X}
	X
	Xvoid
	Xdir_proc(item, event)		/* list saves button */
	X	Panel_item      item;
	X	Event          *event;
	X{
	X	system(lscommand);
	X}
	X
	Xvoid
	Xreset_proc(item, event)		/* reset button */
	X	Panel_item      item;
	X	Event          *event;
	X{
	X	int             i, j;
	X	Xv_Window       window;
	X
	X	window = canvas_paint_window(canvas);
	X	N = Ninit;
	X	istart = 0;
	X	jstart = 0;
	X	action = WRITE_GRID;
	X	direction = ACROSS;
	X	xv_set(N_select, PANEL_VALUE, Ninit, NULL);
	X	xv_set(xv_get(canvas, CANVAS_NTH_PAINT_WINDOW, 0),
	X	       WIN_CURSOR, block_cursor,
	X	       NULL);
	X	for (i = 0; i < Nmax; i++)
	X		for (j = 0; j < Nmax; j++)
	X			A[i][j] = WHITE;
	X	frame_get_rect(frame1, &rect1);
	X	rect1.r_width = 35 * N + 13;
	X	rect1.r_height = 35 * N + 34;
	X	width = 35 * N;
	X	height = 35 * N;
	X	frame_set_rect(frame1, &rect1);
	X	canvas_repaint_proc((Canvas) NULL, window, (Display *) xv_get(window,
	X		XV_DISPLAY), xv_get(window, XV_XID), (Xv_xrectlist *) NULL);
	X}
	X
	Xvoid
	Xclear_proc(item, event)
	X	Panel_item      item;
	X	Event          *event;
	X{
	X	int             i, j;
	X	Xv_Window       window;
	X
	X	window = canvas_paint_window(canvas);
	X	istart = 0;
	X	jstart = 0;
	X	action = WRITE_GRID;
	X	direction = ACROSS;
	X	xv_set(xv_get(canvas, CANVAS_NTH_PAINT_WINDOW, 0),
	X	       WIN_CURSOR, block_cursor,
	X	       NULL);
	X	for (i = 0; i < Nmax; i++)
	X		for (j = 0; j < Nmax; j++)
	X			if (isupper(A[i][j]))
	X				A[i][j] = WHITE;
	X	canvas_repaint_proc((Canvas) NULL, window, (Display *) xv_get(window,
	X		XV_DISPLAY), xv_get(window, XV_XID), (Xv_xrectlist *) NULL);
	X}
	X
	Xvoid
	Xrefresh_proc(item, event)
	X	Panel_item      item;
	X	Event          *event;
	X{
	X	int             i, j;
	X	Xv_Window       window;
	X
	X	window = canvas_paint_window(canvas);
	X	action = WRITE_GRID;
	X	canvas_repaint_proc((Canvas) NULL, window, (Display *) xv_get(window,
	X		XV_DISPLAY), xv_get(window, XV_XID), (Xv_xrectlist *) NULL);
	X}
	X
	Xvoid
	Xflip_proc(item, event)
	X	Panel_item      item;
	X	Event          *event;
	X{
	X	int             i, j, t;
	X	Xv_Window       window;
	X
	X	for (i = 0; i < N; i++)
	X		for (j = i + 1; j < N; j++) {
	X			t = A[i][j];
	X			A[i][j] = A[j][i];
	X			A[j][i] = t;
	X		}
	X	window = canvas_paint_window(canvas);
	X	action = WRITE_GRID;
	X	canvas_repaint_proc((Canvas) NULL, window, (Display *) xv_get(window,
	X		XV_DISPLAY), xv_get(window, XV_XID), (Xv_xrectlist *) NULL);
	X}
	X
	Xvoid
	Xsave_proc(item, event)
	X	Panel_item      item;
	X	Event          *event;
	X{
	X	int             i, j, Nsave;
	X	FILE		*savefile;
	X	char		filename[60];
	X
	X	Nsave = (int) xv_get(item, PANEL_CLIENT_DATA);
	X	sprintf(filename,"%sxword.save%i\0",saveplace,Nsave);
	X	savefile = fopen(filename,"w");
	X	printf("Data saved to %s\n",filename);
	X	printf("%d\n", N);
	X	fprintf(savefile,"%d\n", N);
	X	for (j = 0; j < N; j++) {
	X		for (i = 0; i < N; i++) {
	X			if (A[i][j] == 0) {
	X				printf(". ");
	X				fprintf(savefile,".");
	X			}
	X			else if (A[i][j] == -1) {
	X				printf("# ");
	X				fprintf(savefile,"#");
	X			}
	X			else {
	X				printf("%c ", A[i][j]);
	X				fprintf(savefile,"%c", A[i][j]);
	X			}
	X		}
	X		printf("\n");
	X		fprintf(savefile,"\n");
	X	}
	X	printf("\n\n");
	X	fclose(savefile);
	X}
	X
	Xvoid
	Xrecall_proc(item, event)
	X	Panel_item      item;
	X	Event          *event;
	X{
	X	int             i, j, c, Nrecall;
	X	FILE		*recallfile;
	X	Xv_Window       window;
	X	char		filename[60];
	X
	X	Nrecall = (int) xv_get(item, PANEL_CLIENT_DATA);
	X	sprintf(filename,"%sxword.save%i\0",saveplace,Nrecall);
	X	if ((recallfile = fopen(filename,"r")) == NULL) 
	X		return;
	X		
	X	window = canvas_paint_window(canvas);
	X
	X	fscanf(recallfile,"%d\n", &N);
	X
	X	for (i = 0; i < Nmax; i++)
	X		for (j = 0; j < Nmax; j++)
	X			A[i][j] = WHITE;
	X
	X	frame_get_rect(frame1, &rect1);
	X	rect1.r_width = 35 * N + 13;
	X	rect1.r_height = 35 * N + 34;
	X	width = 35 * N;
	X	height = 35 * N;
	X	frame_set_rect(frame1, &rect1);
	X
	X	for (j = 0; j < N; j++) {
	X		for (i = 0; i < N; i++) {
	X			c = fgetc(recallfile);	
	X			if (c == '.')
	X				A[i][j] = 0;
	X			else if (c == '#')
	X				A[i][j] = -1;
	X			else if isalpha(c)
	X				A[i][j] = c;
	X		}
	X		c = fgetc(recallfile);    /* eol  */
	X	}
	X	fclose(recallfile);
	X	action = WRITE_GRID;
	X	canvas_repaint_proc((Canvas) NULL, window, (Display *) xv_get(window,
	X		XV_DISPLAY), xv_get(window, XV_XID), (Xv_xrectlist *) NULL);
	X}
	X
	Xvoid
	Xprint_proc(item, event)
	X	Panel_item      item;
	X	Event          *event;
	X{
	X	int             i, j, k, m, ii, jj;
	X	char            astring[pmax][Nmax], dstring[pmax][Nmax];
	X	int             anum[pmax], dnum[pmax];
	X	int             nacross, ndown;
	X	FILE		*listfile;
	X
	X	nacross = 0;
	X	ndown = 0;
	X	k = 0;
	X	for (i = 0; i < pmax; i++) {
	X		anum[i] = 0;
	X		dnum[i] = 0;
	X	}
	X	for (j = 0; j < N; j++)
	X		for (i = 0; i < N; i++) {
	X			if ((A[i][j] != BLACK) &&
	X			    (((i == 0) ||
	X			      (j == 0)) ||
	X			   ((i > 0) && (i < N) && (A[i - 1][j] == BLACK)) ||
	X			  ((j > 0) && (j < N) && (A[i][j - 1] == BLACK)))) {
	X				k++;
	X				if ((i == 0) || ((i > 0) && (i < N) && (A[i - 1][j] == BLACK))) {
	X					nacross++;
	X					ii = i;
	X					jj = j;
	X					m = 0;
	X					while ((A[ii][jj] != BLACK) && (ii < N) && (jj < N)) {
	X
	X						if (A[ii][jj] == 0)
	X							astring[nacross][m++] = '.';
	X						else if isupper
	X							(A[ii][jj])
	X								astring[nacross][m++] = A[ii][jj];
	X						ii++;
	X					}
	X					astring[nacross][m] = 0;
	X					anum[nacross] = k;
	X				}
	X			}
	X		}
	X
	X	k = 0;
	X	for (j = 0; j < N; j++)
	X		for (i = 0; i < N; i++) {
	X			if ((A[i][j] != BLACK) &&
	X			    (((i == 0) ||
	X			      (j == 0)) ||
	X			   ((i > 0) && (i < N) && (A[i - 1][j] == BLACK)) ||
	X			  ((j > 0) && (j < N) && (A[i][j - 1] == BLACK)))) {
	X				k++;
	X				if ((j == 0) || ((j > 0) && (j < N) && (A[i][j - 1] == BLACK))) {
	X					ndown++;
	X					ii = i;
	X					jj = j;
	X					m = 0;
	X					while ((A[ii][jj] != BLACK) && (ii < N) && (jj < N)) {
	X
	X						if (A[ii][jj] == 0)
	X							dstring[ndown][m++] = '.';
	X						else if isupper
	X							(A[ii][jj])
	X								dstring[ndown][m++] = A[ii][jj];
	X						jj++;
	X					}
	X					dstring[ndown][m] = 0;
	X					dnum[ndown] = k;
	X				}
	X			}
	X		}
	X
	X	listfile = fopen(listfilename,"w");
	X	printf("     Across  (%2d words)                    Down (%2d words)\n",
	X	       nacross, ndown);
	X	fprintf(listfile,"     Across  (%2d words)                    Down (%2d words)\n",
	X	       nacross, ndown);
	X	printf("     ------                                ----\n");
	X	fprintf(listfile,"     ------                                ----\n");
	X	m = (nacross > ndown) ? nacross : ndown;
	X	for (i = 1; i <= m; i++) {
	X
	X		if (anum[i] > 0) {
	X			printf("%3d  %-25s", anum[i], astring[i]);
	X			fprintf(listfile,"%3d  %-25s", anum[i], astring[i]);
	X		}
	X		else {
	X			printf("                              ");
	X			fprintf(listfile,"                              ");
	X
	X		}
	X		if (dnum[i] > 0) {
	X			printf("        %3d  %-25s\n", dnum[i], dstring[i]);
	X			fprintf(listfile,"        %3d  %-25s\n", dnum[i], dstring[i]);
	X		}
	X		else {
	X			printf("\n");
	X			fprintf(listfile,"\n");
	X		}
	X	}
	X	fclose(listfile);
	X	printf("Word list written to %s\n",listfilename);
	X}
	X
	Xvoid
	Xps_proc(item, event)
	X	Panel_item      item;
	X	Event          *event;
	X{
	X
	X	int             i, j, k;
	X	FILE		*psfile;
	X
	X	k = 0;
	X	psfile = fopen(psfilename,"w");
	X	printf("Picture saved to %s\n",psfilename);
	X
	X	fprintf(psfile,"%%!PS-Adobe-1.0\n");
	X	fprintf(psfile,"%%%%Creator: John Staples, LBL Berkeley.\n");
	X	fprintf(psfile,"%%%%Title: crossword puzzle\n");
	X	fprintf(psfile,"%%%%CreationDate: March 1994\n");
	X	fprintf(psfile,"%%%%Pages: 1\n");
	X	fprintf(psfile,"%%%%BoundingBox: 0 0 612 792\n");
	X	fprintf(psfile,"%%%%EndComments\n");
	X	fprintf(psfile,"/inch {72 mul} def\n");
	X	fprintf(psfile,"/pageheight 11 inch def\n");
	X	fprintf(psfile,"/pagewidth 8.5 inch def\n");
	X	fprintf(psfile,"/offset 0.9 inch def\n");
	X	fprintf(psfile,"/maxgrid 24 def\n");
	X	fprintf(psfile,"/dx pagewidth offset 2 mul sub maxgrid div def\n");
	X	fprintf(psfile,"/dxnum dx 0.022 mul def\n");
	X	fprintf(psfile,"/dynum dx 0.72 mul def\n");
	X	fprintf(psfile,"/dxlet dx 0.2 mul def\n");
	X	fprintf(psfile,"/dylet dx 0.18 mul def\n");
	X	fprintf(psfile,"/thin 0.005 inch def\n");
	X	fprintf(psfile,"/thick 0.02 inch def\n");
	X	fprintf(psfile,"/Numfont /Helvetica-Narrow findfont 7 scalefont def\n");
	X	fprintf(psfile,"/Letfont /Helvetica findfont 16 scalefont def\n");
	X	fprintf(psfile,"/grid %d def\n",N);
	X	fprintf(psfile,"/black { 2 dict begin /y exch grid exch sub 1 sub def /x exch def\n");
	X	fprintf(psfile,"newpath x dx mul y dx mul moveto x 1 add dx mul y dx mul lineto\n");
	X	fprintf(psfile,"x 1 add dx mul y 1 add dx mul lineto x dx mul y 1 add dx mul lineto\n");
	X	fprintf(psfile,"closepath fill end } def\n");
	X	fprintf(psfile,"/num {4 dict begin /n exch def grid exch sub 1 sub /y exch def /x exch def\n");
	X	fprintf(psfile,"x dx mul dxnum add y dx mul dynum add moveto /str 3 string def n str cvs show\n");
	X	fprintf(psfile,"end } def\n");
	X	fprintf(psfile,"/let {3 dict begin /n exch def grid exch sub 1 sub /y exch def /x exch def\n");
	X	fprintf(psfile,"x dx mul dxlet add y dx mul dylet add moveto n  stringwidth pop 0.6 mul\n");
	X	fprintf(psfile,"grid 2 div exch sub 0 rmoveto n show end } def\n");
	X	fprintf(psfile,"pagewidth grid dx mul sub 2 div pageheight grid dx mul sub 2 div translate\n");
	X	fprintf(psfile,"thick setlinewidth newpath 0 0 moveto grid dx mul 0\n");
	X	fprintf(psfile,"lineto grid dx mul dup lineto 0 grid dx mul lineto closepath stroke thin setlinewidth\n");
	X	fprintf(psfile,"0 1 grid {newpath dx mul dup 0 exch moveto grid dx mul exch lineto stroke } for \n");
	X	fprintf(psfile,"0 1 grid {newpath dx mul dup 0 moveto grid dx mul lineto stroke } for\n");
	X	fprintf(psfile,"Numfont setfont\n");
	X	for (j = 0; j < N; j++)
	X		for (i = 0; i < N; i++) {
	X			if ((A[i][j] != BLACK) &&
	X			    (((i == 0) || (j == 0)) ||
	X			     ((i > 0) && (i < N) && (A[i - 1][j] == BLACK)) ||
	X			     ((j > 0) && (j < N) && (A[i][j - 1] == BLACK)))) {
	X
	X				k++;
	X				fprintf(psfile,"%d %d %d num\n",i,j,k);
	X			}
	X		}
	X	fprintf(psfile,"Letfont setfont\n");
	X	for (j = 0; j < N; j++) {
	X		for (i = 0; i < N; i++) {
	X			if (A[i][j] == -1) 
	X				fprintf(psfile,"%d %d black\n",i,j);
	X			
	X			else if isupper(A[i][j]) {
	X				fprintf(psfile,"%d %d (%c) let\n",i,j,A[i][j]);
	X			}
	X		}
	X	}
	X	fprintf(psfile,"showpage\n");
	X	fclose(psfile);
	X}
	X
	Xvoid
	Xget_N(item, event)		/* text numeric field */
	X	Panel_item      item;
	X	Event          *event;
	X{
	X	Xv_Window       window;
	X	int             i, j;
	X
	X	window = canvas_paint_window(canvas);
	X
	X	N = xv_get(item, PANEL_VALUE);
	X	for (i = 0; i < Nmax; i++)
	X		for (j = 0; j < Nmax; j++)
	X			A[i][j] = WHITE;
	X
	X	frame_get_rect(frame1, &rect1);
	X	rect1.r_width = 35 * N + 13;
	X	rect1.r_height = 35 * N + 34;
	X	width = 35 * N;
	X	height = 35 * N;
	X	frame_set_rect(frame1, &rect1);
	X	action = WRITE_GRID;
	X
	X	canvas_repaint_proc((Canvas) NULL, window, (Display *) xv_get(window,
	X		XV_DISPLAY), xv_get(window, XV_XID), (Xv_xrectlist *) NULL);
	X}
	X
	X
	Xvoid
	Xmouse_event(window, event)	/* repaint canvas if hit by mouse select */
	X	Xv_Window       window;
	X	Event          *event;
	X{
	X	int             x, y, i, j, k;
	X	char            teststring[Nmax];
	X	char            grepstring[100];
	X
	X	if (event_action(event) == ACTION_SELECT && event_is_down(event)) {
	X		action = WRITE_GRID;
	X		x = event_x(event);
	X		y = event_y(event);
	X		i = N * x / width;
	X		j = N * y / height;
	X		xv_set(xv_get(canvas, CANVAS_NTH_PAINT_WINDOW, 0),
	X		       WIN_CURSOR, block_cursor,
	X		       NULL);
	X		if (((0 <= i) && (i < N)) && ((0 <= j) && (j < N))) {
	X			switch (A[i][j]) {
	X			case BLACK:
	X				if (A[N - i - 1][N - j - 1] == BLACK) {
	X					A[i][j] = WHITE;
	X					A[N - i - 1][N - j - 1] = WHITE;
	X				}
	X				break;
	X			case WHITE:
	X				if (A[N - i - 1][N - j - 1] == WHITE) {
	X					A[i][j] = BLACK;
	X					A[N - i - 1][N - j - 1] = BLACK;
	X				}
	X				break;
	X			default:
	X				break;
	X			}
	X		}
	X		canvas_repaint_proc((Canvas) NULL, window, (Display *) xv_get(window,
	X		XV_DISPLAY), xv_get(window, XV_XID), (Xv_xrectlist *) NULL);
	X	} else if (event_action(event) == ACTION_ADJUST && event_is_down(event)) {
	X		direction = ACROSS;
	X		x = event_x(event);
	X		y = event_y(event);
	X		istart = N * x / width;
	X		jstart = N * y / height;
	X		xv_set(xv_get(canvas, CANVAS_NTH_PAINT_WINDOW, 0),
	X		       WIN_CURSOR, across_cursor,
	X		       NULL);
	X	} else if (event_action(event) == ACTION_MENU && event_is_down(event)) {
	X		direction = DOWN;
	X		x = event_x(event);
	X		y = event_y(event);
	X		istart = N * x / width;
	X		jstart = N * y / height;
	X		xv_set(xv_get(canvas, CANVAS_NTH_PAINT_WINDOW, 0),
	X		       WIN_CURSOR, down_cursor,
	X		       NULL);
	X	} else if (event_is_ascii(event) && event_is_down(event)) {
	X		letter = event_action(event);
	X		if (islower(letter) || isupper(letter)) {
	X			if islower
	X				(letter)
	X					letter = toupper(letter);
	X			if (((A[istart][jstart] == 0) || (A[istart][jstart] == letter))
	X			    && ((istart < N) && (jstart < N))) {
	X				A[istart][jstart] = letter;
	X				action = PUT_LETTER;
	X				canvas_repaint_proc((Canvas) NULL, window, (Display *) xv_get(window,
	X				    XV_DISPLAY), xv_get(window, XV_XID), (Xv_xrectlist *) NULL);
	X			}
	X		} else if ((isspace(letter)) && (isupper(A[istart][jstart]))) {
	X			A[istart][jstart] = WHITE;
	X			(direction == ACROSS) ? istart++ : jstart++;
	X			action = WRITE_GRID;
	X			canvas_repaint_proc((Canvas) NULL, window, (Display *) xv_get(window,
	X				    XV_DISPLAY), xv_get(window, XV_XID), (Xv_xrectlist *) NULL);
	X
	X		} else if ((letter == '?') || (letter == '/')) {
	X			i = istart;
	X			j = jstart;
	X			k = 0;
	X			while ((A[i][j] != BLACK) && (i < N) && (j < N)) {
	X
	X				if (A[i][j] == 0)
	X					teststring[k++] = '.';
	X				else if isupper
	X					(A[i][j])
	X						teststring[k++] = A[i][j];
	X				(direction == ACROSS) ? i++ : j++;
	X			}
	X			teststring[k] = 0;
	X			sprintf(grepstring, "grep -i \'^%s$\' %s | more", teststring, dictionary);
	X			system(grepstring);
	X			printf("----------\n");
	X		}
	X	} else if ((event_is_down(event)) && (event_action(event) == ACTION_ERASE_CHAR_BACKWARD)) {
	X		switch (direction) {
	X		case ACROSS:
	X			if (((istart - 1) >= 0) && (isupper(A[istart - 1][jstart]))) {
	X				istart--;
	X				A[istart][jstart] = WHITE;
	X			}
	X			break;
	X		case DOWN:
	X			if (((jstart - 1) >= 0) && (isupper(A[istart][jstart - 1]))) {
	X				jstart--;
	X				A[istart][jstart] = WHITE;
	X				break;
	X			}
	X		}
	X		action = WRITE_GRID;
	X		canvas_repaint_proc((Canvas) NULL, window, (Display *) xv_get(window,
	X		XV_DISPLAY), xv_get(window, XV_XID), (Xv_xrectlist *) NULL);
	X	}
	X}
	X
	Xvoid				/* all canvas redraws  */
	Xcanvas_repaint_proc(canvas, paint_window, dpy, xwin, xrects)
	X	Canvas          canvas;
	X	Xv_Window       paint_window;
	X	Display        *dpy;
	X	Window          xwin;
	X	Xv_xrectlist   *xrects;
	X{
	X	GC              gc;
	X	int             dx1, dx2, dy1, dy2;
	X	Rect            rect;
	X	int             i, j, k;
	X	char            digit[5];
	X
	X	xv_set(frame1, XV_SHOW, TRUE, NULL);	/* puts pix up immediately */
	X
	X	gc = DefaultGC(dpy, DefaultScreen(dpy));
	X	dx1 = 2;
	X	dx2 = 11;
	X	dy1 = 12;
	X	dy2 = 28;
	X
	X	switch (action) {
	X
	X	case WRITE_GRID:
	X
	X		k = 0;
	X		xv_set(frame1, FRAME_BUSY, TRUE, NULL);	/* busy signal */
	X		XClearWindow(dpy, xwin, gc);
	X
	X		for (i = 0; i <= N; i++)
	X			XDrawLine(dpy, xwin, gc, 0, i * height / N, width, i * height / N);
	X		for (i = 0; i <= N; i++)
	X			XDrawLine(dpy, xwin, gc, i * width / N, 0, i * width / N, height);
	X
	X		for (j = 0; j < N; j++)
	X			for (i = 0; i < N; i++) {
	X				if (A[i][j] == BLACK) {
	X				    XDrawRectangle(dpy, xwin, gc, i * width / N, j * height / N, width / N, height / N);
	X				    XFillRectangle(dpy, xwin, gc, i * width / N, j * height / N, width / N, height / N);
	X				}
	X				if ((A[i][j] != BLACK) &&
	X				    (((i == 0) || (j == 0)) ||
	X				     ((i > 0) && (i < N) && (A[i - 1][j] == BLACK)) ||
	X				     ((j > 0) && (j < N) && (A[i][j - 1] == BLACK)))) {
	X
	X					k++;
	X					sprintf(digit, "%d  ", k);
	X					XDrawString(dpy, xwin, gc1, i * width / N + dx1, j * height / N + dy1, digit, 3);
	X				}
	X				if (isupper(A[i][j])) {
	X					sprintf(digit, "%c", A[i][j]);
	X					XDrawString(dpy, xwin, gc2, i * width / N + dx2, j * height / N + dy2, digit, 1);
	X				}
	X			}
	X		xv_set(frame1, FRAME_BUSY, FALSE, NULL);
	X		break;
	X
	X	case PUT_LETTER:
	X
	X		sprintf(digit, "%c", letter);
	X		XDrawString(dpy, xwin, gc2, istart * width / N + dx2, jstart * height / N + dy2, digit, 1);
	X		switch (direction) {
	X
	X		case ACROSS:
	X			istart++;
	X			break;
	X		case DOWN:
	X			jstart++;
	X			break;
	X		}
	X
	X		break;
	X
	X	}
	X}
SHAR_EOF
if test 26363 -ne "`wc -c < 'xword.c'`"
then
	echo shar: error transmitting "'xword.c'" '(should have been 26363 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'xword.h'" '(1086 characters)'
if test -f 'xword.h'
then
	echo shar: will not over-write existing file "'xword.h'"
else
sed 's/^	X//' << \SHAR_EOF > 'xword.h'
	X
	X/* consts and defs for xword.c  */
	X
	X#define dictionary	"/usr/staples/words/words6"
	X#define saveplace	"/home/staples/acct/staples/X11/xword/"
	X#define lscommand	"ls -1 /home/staples/acct/staples/X11/xword/xword.save*"
	X#define psfilename	"/home/staples/acct/staples/X11/xword/xword.ps"
	X#define listfilename    "/home/staples/acct/staples/X11/xword/xword.list"
	X
	X#define Ninit           15      /* initial grid size */
	X#define Nmax            25      /* max grid size */
	X#define pmax            200     /* max number of across or down words */
	X
	X
	X /*  define block, across and down cursors  */
	Xshort           block_bits[] = {
	X	0x0000, 0x7FFE, 0x7FFE, 0x6006, 0x6FF6, 0x6FF6, 0x6FF6, 0x6FF6,
	X	0x6FF6, 0x6FF6, 0x6FF6, 0x6FF6, 0x6006, 0x7FFE, 0x7FFE, 0x0000};
	X
	Xshort           across_bits[] = {
	X	0x0000, 0x0040, 0x0060, 0x0070, 0x0078, 0xFFFC, 0xFFFE, 0xFFFF,
	X	0xFFFF, 0xFFFE, 0xFFFC, 0x0078, 0x0070, 0x0060, 0x0040, 0x0000};
	X
	Xshort           down_bits[] = {
	X	0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0,
	X	0x07E0, 0x7FFE, 0x3FFC, 0x1FF8, 0x0FF0, 0x07E0, 0x03C0, 0x0180};
	X
	X
	X
SHAR_EOF
if test 1086 -ne "`wc -c < 'xword.h'`"
then
	echo shar: error transmitting "'xword.h'" '(should have been 1086 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'xword.save1'" '(243 characters)'
if test -f 'xword.save1'
then
	echo shar: will not over-write existing file "'xword.save1'"
else
sed 's/^	X//' << \SHAR_EOF > 'xword.save1'
	X15
	XSET##GLEAN##SAL
	XHAIG#ROUSE#CAFE
	XACME#ERROR#ARIA
	XWHETHER#FORWARD
	X###MODEM#WISHES
	XMISERY#AROMA###
	XUPTON#CLEO#NOEL
	XISAW#MOTIF#DELI
	XROBO#OWEN#MEUSE
	X###FOOLS#DOFFED
	XMASHER#EYEOF###
	XINHERIT#UNDERGO
	XDIOR#VINCI#COOK
	XACRE#ERICA#TORI
	XSET##RENAL##TEE
SHAR_EOF
if test 243 -ne "`wc -c < 'xword.save1'`"
then
	echo shar: error transmitting "'xword.save1'" '(should have been 243 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'xword.list'" '(2722 characters)'
if test -f 'xword.list'
then
	echo shar: will not over-write existing file "'xword.list'"
else
sed 's/^	X//' << \SHAR_EOF > 'xword.list'
	X     Across  (39 words)                    Down (37 words)
	X     ------                                ----
	X  1  SET                                1  SHAW                     
	X  4  GLEAN                              2  EACH                     
	X  9  SAL                                3  TIME                     
	X 12  HAIG                               4  GREEDY                   
	X 14  ROUSE                              5  LORRE                    
	X 15  CAFE                               6  EUR                      
	X 16  ACME                               7  ASOF                     
	X 17  ERROR                              8  NEROWOOF                 
	X 18  ARIA                               9  SARAH                    
	X 19  WHETHER                           10  AFIRE                    
	X 21  FORWARD                           11  LEADS                    
	X 23  MODEM                             13  GETMEOWOFHERE            
	X 25  WISHES                            15  CAWSANDEFFECT            
	X 26  MISERY                            20  HORN                     
	X 29  AROMA                             22  RIM                      
	X 31  UPTON                             24  MALTESE                  
	X 32  CLEO                              26  MUIR                     
	X 33  NOEL                              27  IPSO                     
	X 37  ISAW                              28  STAB                     
	X 38  MOTIF                             30  REIN                     
	X 39  DELI                              32  COWL                     
	X 40  ROBO                              34  OEUF                     
	X 41  OWEN                              35  ELSE                     
	X 42  MEUSE                             36  LIED                     
	X 43  FOOLS                             38  MOORIVER                 
	X 45  DOFFED                            42  MOOD                     
	X 46  MASHER                            44  OER                      
	X 49  EYEOF                             45  DENIAL                   
	X 51  INHERIT                           46  MIDAS                    
	X 53  UNDERGO                           47  ANICE                    
	X 57  DIOR                              48  SHORT                    
	X 58  VINCI                             50  YUCCA                    
	X 60  COOK                              52  TIRE                     
	X 61  ACRE                              54  ROOT                     
	X 62  ERICA                             55  GORE                     
	X 63  TORI                              56  OKIE                     
	X 64  SET                               59  NIN                      
	X 65  RENAL                    
	X 66  TEE                      
SHAR_EOF
if test 2722 -ne "`wc -c < 'xword.list'`"
then
	echo shar: error transmitting "'xword.list'" '(should have been 2722 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'xword.ps'" '(5066 characters)'
if test -f 'xword.ps'
then
	echo shar: will not over-write existing file "'xword.ps'"
else
sed 's/^	X//' << \SHAR_EOF > 'xword.ps'
	X%!PS-Adobe-1.0
	X%%Creator: John Staples, LBL Berkeley.
	X%%Title: crossword puzzle
	X%%CreationDate: March 1994
	X%%Pages: 1
	X%%BoundingBox: 0 0 612 792
	X%%EndComments
	X/inch {72 mul} def
	X/pageheight 11 inch def
	X/pagewidth 8.5 inch def
	X/offset 0.9 inch def
	X/maxgrid 24 def
	X/dx pagewidth offset 2 mul sub maxgrid div def
	X/dxnum dx 0.022 mul def
	X/dynum dx 0.72 mul def
	X/dxlet dx 0.2 mul def
	X/dylet dx 0.18 mul def
	X/thin 0.005 inch def
	X/thick 0.02 inch def
	X/Numfont /Helvetica-Narrow findfont 7 scalefont def
	X/Letfont /Helvetica findfont 16 scalefont def
	X/grid 15 def
	X/black { 2 dict begin /y exch grid exch sub 1 sub def /x exch def
	Xnewpath x dx mul y dx mul moveto x 1 add dx mul y dx mul lineto
	Xx 1 add dx mul y 1 add dx mul lineto x dx mul y 1 add dx mul lineto
	Xclosepath fill end } def
	X/num {4 dict begin /n exch def grid exch sub 1 sub /y exch def /x exch def
	Xx dx mul dxnum add y dx mul dynum add moveto /str 3 string def n str cvs show
	Xend } def
	X/let {3 dict begin /n exch def grid exch sub 1 sub /y exch def /x exch def
	Xx dx mul dxlet add y dx mul dylet add moveto n  stringwidth pop 0.6 mul
	Xgrid 2 div exch sub 0 rmoveto n show end } def
	Xpagewidth grid dx mul sub 2 div pageheight grid dx mul sub 2 div translate
	Xthick setlinewidth newpath 0 0 moveto grid dx mul 0
	Xlineto grid dx mul dup lineto 0 grid dx mul lineto closepath stroke thin setlinewidth
	X0 1 grid {newpath dx mul dup 0 exch moveto grid dx mul exch lineto stroke } for 
	X0 1 grid {newpath dx mul dup 0 moveto grid dx mul lineto stroke } for
	XNumfont setfont
	X0 0 1 num
	X1 0 2 num
	X2 0 3 num
	X5 0 4 num
	X6 0 5 num
	X7 0 6 num
	X8 0 7 num
	X9 0 8 num
	X12 0 9 num
	X13 0 10 num
	X14 0 11 num
	X0 1 12 num
	X3 1 13 num
	X5 1 14 num
	X11 1 15 num
	X0 2 16 num
	X5 2 17 num
	X11 2 18 num
	X0 3 19 num
	X4 3 20 num
	X8 3 21 num
	X10 3 22 num
	X3 4 23 num
	X7 4 24 num
	X9 4 25 num
	X0 5 26 num
	X1 5 27 num
	X2 5 28 num
	X7 5 29 num
	X8 5 30 num
	X0 6 31 num
	X6 6 32 num
	X11 6 33 num
	X12 6 34 num
	X13 6 35 num
	X14 6 36 num
	X0 7 37 num
	X5 7 38 num
	X11 7 39 num
	X0 8 40 num
	X5 8 41 num
	X10 8 42 num
	X3 9 43 num
	X4 9 44 num
	X9 9 45 num
	X0 10 46 num
	X1 10 47 num
	X2 10 48 num
	X7 10 49 num
	X8 10 50 num
	X0 11 51 num
	X6 11 52 num
	X8 11 53 num
	X12 11 54 num
	X13 11 55 num
	X14 11 56 num
	X0 12 57 num
	X5 12 58 num
	X7 12 59 num
	X11 12 60 num
	X0 13 61 num
	X5 13 62 num
	X11 13 63 num
	X0 14 64 num
	X5 14 65 num
	X12 14 66 num
	XLetfont setfont
	X0 0 (S) let
	X1 0 (E) let
	X2 0 (T) let
	X3 0 black
	X4 0 black
	X5 0 (G) let
	X6 0 (L) let
	X7 0 (E) let
	X8 0 (A) let
	X9 0 (N) let
	X10 0 black
	X11 0 black
	X12 0 (S) let
	X13 0 (A) let
	X14 0 (L) let
	X0 1 (H) let
	X1 1 (A) let
	X2 1 (I) let
	X3 1 (G) let
	X4 1 black
	X5 1 (R) let
	X6 1 (O) let
	X7 1 (U) let
	X8 1 (S) let
	X9 1 (E) let
	X10 1 black
	X11 1 (C) let
	X12 1 (A) let
	X13 1 (F) let
	X14 1 (E) let
	X0 2 (A) let
	X1 2 (C) let
	X2 2 (M) let
	X3 2 (E) let
	X4 2 black
	X5 2 (E) let
	X6 2 (R) let
	X7 2 (R) let
	X8 2 (O) let
	X9 2 (R) let
	X10 2 black
	X11 2 (A) let
	X12 2 (R) let
	X13 2 (I) let
	X14 2 (A) let
	X0 3 (W) let
	X1 3 (H) let
	X2 3 (E) let
	X3 3 (T) let
	X4 3 (H) let
	X5 3 (E) let
	X6 3 (R) let
	X7 3 black
	X8 3 (F) let
	X9 3 (O) let
	X10 3 (R) let
	X11 3 (W) let
	X12 3 (A) let
	X13 3 (R) let
	X14 3 (D) let
	X0 4 black
	X1 4 black
	X2 4 black
	X3 4 (M) let
	X4 4 (O) let
	X5 4 (D) let
	X6 4 (E) let
	X7 4 (M) let
	X8 4 black
	X9 4 (W) let
	X10 4 (I) let
	X11 4 (S) let
	X12 4 (H) let
	X13 4 (E) let
	X14 4 (S) let
	X0 5 (M) let
	X1 5 (I) let
	X2 5 (S) let
	X3 5 (E) let
	X4 5 (R) let
	X5 5 (Y) let
	X6 5 black
	X7 5 (A) let
	X8 5 (R) let
	X9 5 (O) let
	X10 5 (M) let
	X11 5 (A) let
	X12 5 black
	X13 5 black
	X14 5 black
	X0 6 (U) let
	X1 6 (P) let
	X2 6 (T) let
	X3 6 (O) let
	X4 6 (N) let
	X5 6 black
	X6 6 (C) let
	X7 6 (L) let
	X8 6 (E) let
	X9 6 (O) let
	X10 6 black
	X11 6 (N) let
	X12 6 (O) let
	X13 6 (E) let
	X14 6 (L) let
	X0 7 (I) let
	X1 7 (S) let
	X2 7 (A) let
	X3 7 (W) let
	X4 7 black
	X5 7 (M) let
	X6 7 (O) let
	X7 7 (T) let
	X8 7 (I) let
	X9 7 (F) let
	X10 7 black
	X11 7 (D) let
	X12 7 (E) let
	X13 7 (L) let
	X14 7 (I) let
	X0 8 (R) let
	X1 8 (O) let
	X2 8 (B) let
	X3 8 (O) let
	X4 8 black
	X5 8 (O) let
	X6 8 (W) let
	X7 8 (E) let
	X8 8 (N) let
	X9 8 black
	X10 8 (M) let
	X11 8 (E) let
	X12 8 (U) let
	X13 8 (S) let
	X14 8 (E) let
	X0 9 black
	X1 9 black
	X2 9 black
	X3 9 (F) let
	X4 9 (O) let
	X5 9 (O) let
	X6 9 (L) let
	X7 9 (S) let
	X8 9 black
	X9 9 (D) let
	X10 9 (O) let
	X11 9 (F) let
	X12 9 (F) let
	X13 9 (E) let
	X14 9 (D) let
	X0 10 (M) let
	X1 10 (A) let
	X2 10 (S) let
	X3 10 (H) let
	X4 10 (E) let
	X5 10 (R) let
	X6 10 black
	X7 10 (E) let
	X8 10 (Y) let
	X9 10 (E) let
	X10 10 (O) let
	X11 10 (F) let
	X12 10 black
	X13 10 black
	X14 10 black
	X0 11 (I) let
	X1 11 (N) let
	X2 11 (H) let
	X3 11 (E) let
	X4 11 (R) let
	X5 11 (I) let
	X6 11 (T) let
	X7 11 black
	X8 11 (U) let
	X9 11 (N) let
	X10 11 (D) let
	X11 11 (E) let
	X12 11 (R) let
	X13 11 (G) let
	X14 11 (O) let
	X0 12 (D) let
	X1 12 (I) let
	X2 12 (O) let
	X3 12 (R) let
	X4 12 black
	X5 12 (V) let
	X6 12 (I) let
	X7 12 (N) let
	X8 12 (C) let
	X9 12 (I) let
	X10 12 black
	X11 12 (C) let
	X12 12 (O) let
	X13 12 (O) let
	X14 12 (K) let
	X0 13 (A) let
	X1 13 (C) let
	X2 13 (R) let
	X3 13 (E) let
	X4 13 black
	X5 13 (E) let
	X6 13 (R) let
	X7 13 (I) let
	X8 13 (C) let
	X9 13 (A) let
	X10 13 black
	X11 13 (T) let
	X12 13 (O) let
	X13 13 (R) let
	X14 13 (I) let
	X0 14 (S) let
	X1 14 (E) let
	X2 14 (T) let
	X3 14 black
	X4 14 black
	X5 14 (R) let
	X6 14 (E) let
	X7 14 (N) let
	X8 14 (A) let
	X9 14 (L) let
	X10 14 black
	X11 14 black
	X12 14 (T) let
	X13 14 (E) let
	X14 14 (E) let
	Xshowpage
SHAR_EOF
if test 5066 -ne "`wc -c < 'xword.ps'`"
then
	echo shar: error transmitting "'xword.ps'" '(should have been 5066 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0

