v04i054: xtroff -- troff previewer for X11, Part09/18

Dan Heller argv at island.uu.net
Tue Jul 18 17:26:01 AEST 1989


Submitted-by: Mark Moraes <moraes at ai.toronto.edu>
Posting-number: Volume 4, Issue 54
Archive-name: xtroff/part09



#! /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 9 (of 18)."
# Contents:  xtroff/XtStuff/ask.c xtroff/devpsc/Makefile xtroff/draw.c
#   xtroff/fontstuff/Makefile xtroff/parse.c
# Wrapped by moraes at neat.ai on Thu Jul 13 20:55:12 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'xtroff/XtStuff/ask.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xtroff/XtStuff/ask.c'\"
else
echo shar: Extracting \"'xtroff/XtStuff/ask.c'\" \(9084 characters\)
sed "s/^X//" >'xtroff/XtStuff/ask.c' <<'END_OF_FILE'
X/* This file contains code from the JOVE screen editor */
X
X/************************************************************************
X * JOVE is Copyright (C) 1986 by Jonathan Payne.  JOVE is               *
X * provided to you without charge, and with no warranty.  You may give  *
X * away copies of JOVE, including sources, provided that this notice is *
X * included in all the files.                                           *
X ************************************************************************/
X
X/*
X *  Modified by Mark Moraes for use in a widget for the X Windows System
X *  Version 11. This file is still independent of the X Windows System.
X */
X
X/* The routines in this file perform Tenex-style filename completion. 
X   The routine to be called is 
X	f_complete(buf, cursorposition, cols, c)
X	char *buf;
X
X   where 'buf' contains the filename so far. 'cursorposition' is the 
X   location of the cursor in 'buf' - it should be at the end of the 'buf'.
X   'cols' is the width of the screen used for typeout, (the listing of files)
X   and 'c' is one of ' ', '\t', and '?'. For the former two, f_complete
X   attempts to complete the name in 'buf', and for the latter, it
X   lists out the files which match the name so far using the typeout
X   routines.
X
X   It requires two sets of external routines to do this - insert_s(), 
X   add_mess() and rbell() are used for completion, and TOstart(), 
X   Typeout(), and TOstop() are used for typeout. These are described 
X   below 
X */
X#include <ctype.h>
X#include <signal.h>
X#include <varargs.h>
X#include <stdio.h>
X#ifdef XWINDOWS
X# include <X11/Xos.h>
X#else
X# include <strings.h>
X# include <sys/types.h>
X#endif
X#include <sys/stat.h>
X#ifdef DIRENT
X# include <sys/param.h>
X# include <dirent.h>
X# ifndef DIRSIZE
X#  define DIRSIZE(entry)	DIRSIZ
X# endif
X# ifndef direct
X#  define direct	dirent
X# endif
X#else
X# include <sys/dir.h>
X# define DIRSIZE(entry)	DIRSIZ(entry)
X#endif DIRENT
X
X#define FILESIZE	128
X#define TRUE		1
X#define FALSE		0
X#define min(x, y)	((x) < (y) ? (x) : (y))
X#define max(x, y)	((x) > (y) ? (x) : (y))
X
Xstatic char *linebuf;
Xstatic int curchar;
Xstatic int maxCols;
X
Xextern char *malloc();
Xextern char *realloc();
X
X/**********************External functions **********************************/
X/* insert_s(at, s, len, curpos) char *at, *s; int len; int *curpos;
X *	deletes from 'at' to the end of the line, and inserts the first len
X *	characters of 's' there. It returns 'curpos' as the new end of the
X *	string being edited - the cursor should now be there
X */
Xextern void insert_s();
X
X/* add_mess(s) char *s;
X *	inserts 's' at the end of the buffer, then waits a respectable
X *	interval, deletes 's', and returns
X */
Xextern void add_mess();
X
X/* rbell()
X *	Rings a bell or attracts the user's attention in some other way 
X */
Xextern void rbell();
X
X/* TOstart(s) char *s;
X *	Starts the typeout, and prints 's' as a title. Typeout is some 
X *	sort of overlay 'window' or something, for temporary output, 
X *	which can popup, and vanish after the user has read it. 
X */
Xextern TOstart();
X
X/* Typeout(fmt, args) char *fmt; va_dcl args;
X *	Is like printf() - prints args according to format 'fmt'. 
X *	Is a <varargs> routine
X */
Xextern Typeout();
X
X/* TOstop()
X *	End of typeout - this performs some sort of wait()
X *	- like for a keypress or a mouse click. It then cleans up
X *	the typeout and returns.
X */
Xextern TOstop();
X
Xchar *xmalloc(n)
X{
X	extern char *malloc();
X	char *p = malloc((unsigned) n);
X
X	if (!p) {
X		(void) fprintf(stderr, "out of memory in malloc\n");
X		exit(-1);
X	}
X	return p;
X}
X
Xchar *xrealloc(s, n)
Xchar *s;
X{
X	extern char *realloc();
X	char *p = realloc(s, (unsigned) n);
X
X	if (!p) {
X		(void) fprintf(stderr, "out of memory in realloc\n");
X		exit(-1);
X	}
X	return p;
X}
X
X/* Scandir returns the number of entries or -1 if the directory cannoot
X   be opened or malloc fails. */
X
Xint
Xmyscandir(dir, nmptr, qualify, sorter)
Xchar	*dir;
Xchar	***nmptr;
Xint	(*qualify)();
Xint	(*sorter)();
X{
X	DIR	*dirp;
X	struct direct	*entry;
X	char	**ourarray;
X	int	nalloc = 10;
X	int	nentries = 0;
X
X	if ((dirp = opendir(dir)) == 0)
X		return -1;
X	ourarray = (char **) xmalloc(nalloc * sizeof (char *));
X	while ((entry = readdir(dirp)) != 0) {
X		if (qualify != 0 && (*qualify)(entry->d_name) == 0)
X			continue;
X		if (nentries == nalloc) {
X			ourarray = (char **) xrealloc((char *) ourarray, (nalloc += 10) * sizeof (char *));
X		}
X		ourarray[nentries] = (char *) xmalloc((int) DIRSIZE(entry) + 1);
X		null_ncpy(ourarray[nentries], entry->d_name, (int) DIRSIZE(entry));
X		nentries++;
X	}
X	closedir(dirp);
X	if ((nentries + 1) != nalloc)
X		ourarray = (char **) xrealloc((char *) ourarray,
X					((nentries + 1) * sizeof (char *)));
X	if (sorter != 0)
X		qsort((char *) ourarray, nentries, sizeof (char **), sorter);
X	*nmptr = ourarray;
X	ourarray[nentries] = 0;		/* guaranteed 0 pointer */
X
X	return nentries;
X}
X
Xfreedir(nmptr, nentries)
Xchar	***nmptr;
X{
X	char	**ourarray = *nmptr;
X
X	while (--nentries >= 0)
X		free(*ourarray++);
X	free((char *) *nmptr);
X	*nmptr = 0;
X}
X
Xalphacomp(a, b)
Xchar	**a,
X	**b;
X{
X	return strcmp(*a, *b);
X}
X
Xnumcomp(s1, s2)
Xregister char	*s1,
X		*s2;
X{
X	register int	count = 0;
X
X	while (*s1 != 0 && *s1++ == *s2++)
X		count++;
X	return count;
X}
X
Xstatic char	*fc_filebase;
Xchar	BadExtensions[128] = ".o";
X
Xstatic
Xbad_extension(name, bads)
Xchar	*name,
X	*bads;
X{
X	char	*ip;
X	int	namelen = strlen(name),
X		ext_len,
X		stop = 0;
X
X	do {
X		if (ip = index(bads, ' '))
X			*ip = 0;
X		else {
X			ip = bads + strlen(bads);
X			stop++;
X		}
X		if ((ext_len = ip - bads) == 0)
X			continue;
X		if ((ext_len < namelen) &&
X		    (strcmp(&name[namelen - ext_len], bads) == 0))
X			return TRUE;
X	} while ((bads = ip + 1), !stop);
X	return FALSE;
X}
X
Xf_match(file)
Xchar	*file;
X{
X	int	len = strlen(fc_filebase);
X
X	return ((len == 0) ||
X		(strncmp(file, fc_filebase, strlen(fc_filebase)) == 0));
X}
X
Xstatic
Xisdir(name)
Xchar	*name;
X{
X	struct stat	stbuf;
X	char	filebuf[FILESIZE];
X
X	PathParse(name, filebuf);
X	return ((stat(filebuf, &stbuf) != -1) &&
X		(stbuf.st_mode & S_IFDIR) == S_IFDIR);
X}
X
Xstatic
Xfill_in(dir_vec, n)
Xregister char	**dir_vec;
X{
X	int	minmatch = 0,
X    		numfound = 0,
X    		lastmatch = -1,
X		i,
X		the_same = TRUE, /* After filling in, are we the same
X				    as when we were called? */
X		is_ntdir;	/* Is Newly Typed Directory name */
X	char	bads[128];
X
X	for (i = 0; i < n; i++) {
X		(void) strcpy(bads, BadExtensions);
X		/* bad_extension() is destructive */
X		if (bad_extension(dir_vec[i], bads))
X			continue;
X		if (numfound)
X			minmatch = min(minmatch,
X				       numcomp(dir_vec[lastmatch], dir_vec[i]));
X		else
X			minmatch = strlen(dir_vec[i]);
X		lastmatch = i;
X		numfound++;
X	}
X	/* Ugh.  Beware--this is hard to get right in a reasonable
X	   manner.  Please excuse this code--it's past my bedtime. */
X	if (numfound == 0) {
X		rbell();
X		return;
X	}
X	if (minmatch > strlen(fc_filebase)) {
X		the_same = FALSE;
X		insert_s(fc_filebase, dir_vec[lastmatch], minmatch, &curchar);
X	}
X	is_ntdir = ((numfound == 1) &&
X		    (curchar > 0) &&
X		    (linebuf[curchar - 1] != '/') &&
X		    (isdir(linebuf)));
X	if (the_same && !is_ntdir) {
X		add_mess((n == 1) ? " [Unique]" : " [Ambiguous]");
X	}
X	if (is_ntdir)
X		insert_s(&linebuf[curchar], "/", 1, &curchar);
X}
X
X/*
X *  called when one of "\t ?" is typed.  Does the right thing,
X *  depending on which.
X */
X
Xf_complete(sbuf, curpos, cols, c)
Xchar *sbuf;
X{
X	char	dir[FILESIZE],
X		**dir_vec;
X	int	nentries;
X#ifdef TYPEOUT
X	int	i;
X#endif
X
X	linebuf = sbuf;
X	curchar = curpos;
X	maxCols = cols;
X	
X	if (linebuf[curpos] != '\0')
X		linebuf[curpos] = '\0';
X		
X	if ((fc_filebase = rindex(linebuf, '/')) != 0) {
X		char	tmp[FILESIZE];
X
X		null_ncpy(tmp, linebuf, (++fc_filebase - linebuf));
X		if (tmp[0] == '\0')
X			(void) strcpy(tmp, "/");
X		PathParse(tmp, dir);
X	} else {		
X		fc_filebase = linebuf;
X		(void) strcpy(dir, ".");
X	}
X	if ((nentries = myscandir(dir, &dir_vec, f_match, alphacomp)) == -1) {
X		char err[FILESIZE];
X		
X		(void) sprintf(err, " [Unknown directory: %s]", dir);
X		add_mess(err);
X		return 1;
X	}
X	if (nentries == 0) {
X		add_mess(" [No match]");
X	} else if (c == ' ' || c == '\t')
X		fill_in(dir_vec, nentries);
X	else {
X		/* we're a '?' */
X#ifdef TYPEOUT
X		int	maxlen = 0,
X			ncols,
X			col,
X			lines,
X			linespercol;
X
X		TOstart("Completion");
X		Typeout("(! means file will not be chosen unless typed explicitly)");
X		Typeout((char *) 0);
X		Typeout("Possible completions (in %s):", dir);
X		Typeout((char *) 0);
X
X		for (i = 0; i < nentries; i++)
X			maxlen = max(strlen(dir_vec[i]), maxlen);
X		maxlen += 4;	/* pad each column with at least 4 spaces */
X		ncols = (maxCols - 2) / maxlen;
X		linespercol = 1 + (nentries / ncols);
X
X		for (lines = 0; lines < linespercol; lines++) {
X			for (col = 0; col < ncols; col++) {
X				int	isbad,
X					which;
X				char	bads[128];
X
X				which = (col * linespercol) + lines;
X				if (which >= nentries)
X					break;
X				(void) strcpy(bads, BadExtensions);
X				isbad = bad_extension(dir_vec[which], bads);
X				Typeout("%s%-*s", isbad ? "!" : "",
X					maxlen - isbad, dir_vec[which]);
X			}
X			Typeout((char *) 0);
X		}
X		TOstop();
X#endif
X	}
X	freedir(&dir_vec, nentries);
X	return 1;
X}
END_OF_FILE
if test 9084 -ne `wc -c <'xtroff/XtStuff/ask.c'`; then
    echo shar: \"'xtroff/XtStuff/ask.c'\" unpacked with wrong size!
fi
# end of 'xtroff/XtStuff/ask.c'
fi
if test -f 'xtroff/devpsc/Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xtroff/devpsc/Makefile'\"
else
echo shar: Extracting \"'xtroff/devpsc/Makefile'\" \(10120 characters\)
sed "s/^X//" >'xtroff/devpsc/Makefile' <<'END_OF_FILE'
X# Makefile generated by imake - do not edit!
X# $XConsortium: imake.c,v 1.37 88/10/08 20:08:30 jim Exp $
X#
X# The cpp used on this machine replaces all newlines and multiple tabs and
X# spaces in a macro expansion with a single space.  Imake tries to compensate
X# for this, but is not always successful.
X#
X
X###########################################################################
X# X Window System Makefile generated from template file Imake.tmpl
X# $XConsortium: Imake.tmpl,v 1.91 88/10/23 22:37:10 jim Exp $
X#
X# Do not change the body of the imake template file.  Server-specific
X# parameters may be set in the appropriate .macros file; site-specific
X# parameters (but shared by all servers) may be set in site.def.  If you
X# make any changes, you'll need to rebuild the makefiles using
X# "make World" (at best) or "make Makefile; make Makefiles" (at least) in
X# the top level directory.
X#
X# If your C preprocessor doesn't define any unique symbols, you'll need
X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
X# "make Makefile", "make Makefiles", or "make World").
X#
X# If you absolutely can't get imake to work, you'll need to set the
X# variables at the top of each Makefile as well as the dependencies at the
X# bottom (makedepend will do this automatically).
X#
X
X###########################################################################
X# platform-specific configuration parameters - edit Sun.macros to change
X
X# platform:  $XConsortium: Sun.macros,v 1.52 88/10/23 11:00:55 jim Exp $
X# operating system:   SunOS 3.5
X
XBOOTSTRAPCFLAGS =
X             AS = as
X             CC = cc
X            CPP = /lib/cpp
X             LD = ld
X           LINT = lint
X        INSTALL = install
X           TAGS = ctags
X             RM = rm -f
X             MV = mv
X             LN = ln -s
X         RANLIB = ranlib
XRANLIBINSTFLAGS = -t
X             AR = ar clq
X             LS = ls
X       LINTOPTS = -axz
X    LINTLIBFLAG = -C
X           MAKE = make
XSTD_CPP_DEFINES =
X    STD_DEFINES =
X
X###########################################################################
X# site-specific configuration parameters - edit site.def to change
X
X# site:  $XConsortium: site.def,v 1.16 88/10/12 10:30:24 jim Exp $
X
X   GCC = gcc -traditional
X    CC = $(GCC)
X
XCC = gcc -traditional
X
X XWSRC = $(CONTRIBSRC)/widgets/Xhp/Xw
X
X XWLIB = $(USRLIBDIR)/libXw.a
X
X###########################################################################
X# definitions common to all Makefiles - do not edit
X
X          SHELL =  /bin/sh
X
X        DESTDIR =
X      USRLIBDIR = /local/lib/X11
X         BINDIR = /local/bin/X11
X         INCDIR = $(LIBDIR)/include
X        INCROOT = $(DESTDIR)/usr/include
X         ADMDIR =  /scr/Xerrors
X         LIBDIR = /local/share/X11
X     LINTLIBDIR = $(LIBDIR)/lint
X        FONTDIR = $(LIBDIR)/fonts
X       XINITDIR = $(LIBDIR)/xinit
X         XDMDIR = $(LIBDIR)/xdm
X         UWMDIR = $(LIBDIR)/uwm
X         AWMDIR = $(LIBDIR)/awm
X         TWMDIR = $(LIBDIR)/twm
X        MANPATH = /local/man
X  MANSOURCEPATH = $(MANPATH)/man
X         MANDIR = $(MANSOURCEPATH)x
X      LIBMANDIR = $(MANSOURCEPATH)3
X    XAPPLOADDIR = $(LIBDIR)/app-defaults
X
X   INSTBINFLAGS = -m 0755
X   INSTUIDFLAGS = -m 4755
X   INSTLIBFLAGS = -m 0664
X   INSTINCFLAGS = -m 0444
X   INSTMANFLAGS = -m 0444
X   INSTAPPFLAGS = -m 0444
X  INSTKMEMFLAGS = -g kmem -m 2755
X        FCFLAGS = -t
X    CDEBUGFLAGS = -O
X
X        PATHSEP = /
X         DEPEND = $(DEPENDSRC)/makedepend
X          IMAKE = $(IMAKESRC)/imake
X            RGB = $(RGBSRC)/rgb
X             FC = $(BDFTOSNFSRC)/bdftosnf
X      MKFONTDIR = $(MKFONTDIRSRC)/mkfontdir
X      MKDIRHIER = $(SCRIPTSSRC)/mkdirhier.sh
X
X         CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(STD_DEFINES) $(DEFINES)
X      LINTFLAGS = $(LINTOPTS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) -DLINT
X        LDFLAGS = $(CDEBUGFLAGS) $(SYS_LIBRARIES) $(SYSAUX_LIBRARIES)
X            TOP = ../../../../../csri3/X.V11R3
X      CLIENTSRC = $(TOP)/clients
X        DEMOSRC = $(TOP)/demos
X         LIBSRC = $(TOP)/lib
X        FONTSRC = $(TOP)/fonts
X     INCLUDESRC = $(TOP)/X11
X      SERVERSRC = $(TOP)/server
X        UTILSRC = $(TOP)/util
X     SCRIPTSSRC = $(UTILSRC)/scripts
X     EXAMPLESRC = $(TOP)/examples
X     CONTRIBSRC = $(TOP)/contrib
X         DOCSRC = $(TOP)/doc
X         RGBSRC = $(TOP)/rgb
X      DEPENDSRC = $(UTILSRC)/makedepend
X       IMAKESRC = $(UTILSRC)/imake
X       IRULESRC = $(UTILSRC)/imake.includes
X        XLIBSRC = $(LIBSRC)/X
X         XMUSRC = $(LIBSRC)/Xmu
X     TOOLKITSRC = $(LIBSRC)/Xt
X     AWIDGETSRC = $(LIBSRC)/Xaw
X     OLDXLIBSRC = $(LIBSRC)/oldX
X    BDFTOSNFSRC = $(FONTSRC)/bdftosnf
X   MKFONTDIRSRC = $(FONTSRC)/mkfontdir
X   EXTENSIONSRC = $(TOP)/extensions
X
X   EXTENSIONLIB = $(USRLIBDIR)/lib/libXext.a
X           XLIB = $(USRLIBDIR)/libX11.a
X         XMULIB = $(USRLIBDIR)/libXmu.a
X        OLDXLIB = $(USRLIBDIR)/liboldX.a
X       XTOOLLIB = $(USRLIBDIR)/libXt.a
X         XAWLIB = $(USRLIBDIR)/libXaw.a
X       INCLUDES = -I$(INCDIR) -I$(INCROOT)
X
X       LINTXLIB = $(XLIBSRC)/llib-lX11.ln
X        LINTXMU = $(XMUSRC)/llib-lXmu.ln
X      LINTXTOOL = $(TOOLKITSRC)/llib-lXt.ln
X        LINTXAW = $(AWIDGETSRC)/llib-lXaw.ln
X      MACROFILE = Sun.macros
X   ICONFIGFILES = $(IRULESRC)/Imake.tmpl \
X			$(IRULESRC)/$(MACROFILE) $(IRULESRC)/site.def
X  IMAKE_DEFINES =
X      IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl -I$(NEWTOP)$(IRULESRC) \
X			-s Makefile $(IMAKE_DEFINES)
X         RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \
X			.emacs_* tags TAGS make.log MakeOut
X
X###########################################################################
X# rules:  $XConsortium: Imake.rules,v 1.71 88/10/23 22:46:34 jim Exp $
X
X###########################################################################
X# start of Imakefile
X
X# fonts/bdf/75dpi/devpsc/Makefile
X#
X# Copyright (c) 1988 Cray Research, Inc.  All Rights Reserved.
X# PostScript is a trademark of Adobe Systems, Inc.
X
X# see README for more information
X# makedev is the program that builds device descriptions
X
XFONTDIR = $(WIDTHDIR)/devpsc
XOFILES = [A-Z].out [A-Z][0-9A-Z].out DESC.out
XAFILES = [A-Z].aux [A-Z][0-9A-Z].aux
XXFONTDIR = ../xfonts
X
XLOADFONTS = R I B BI H HB C CB S
XMOREFONTS = HO HD CO CD N NI NB ND
X
XFONTNAMES = ${LOADFONTS} ${MOREFONTS}
XFONTMAP = ${LOADMAP} ${MOREMAP}
XTEMPFILES = temp.header temp.spaces temp.trailer
X
Xall:: DESC.out moreout
X
XDESC.out: DESC ${FONTNAMES}
X	${MAKEDEV} DESC
X
Xmoreout: ${MOREFONTS}
X	${MAKEDEV} $?
X
Xinstall:: all
X
Xinstall::
X	$(MKDIRHIER)  $(FONTDIR)
X
Xinstall::
X	@case '${MFLAGS}' in *[i]*) set +e;; esac; \
X	for i in $(OFILES) $(AFILES) $(MFILES); do \
X	(set -x; $(INSTALL) -c $(INSTALLFLAGS) $$i  $(FONTDIR)); \
X	done
X
Xclean::
X	rm -f ${TEMPFILES} core *.out *.font temp*
X
Xclobber:: clean
X	rm -f [A-Z] [A-Z][A-Z] *.aux
X
XR:	${XFONTDIR}/timR24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XI:	${XFONTDIR}/timI24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XB:	${XFONTDIR}/timB24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XBI:	${XFONTDIR}/timBI24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XS:	${XFONTDIR}/symb24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XC:	${XFONTDIR}/courR24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XCB:	${XFONTDIR}/courB24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XCD:	${XFONTDIR}/courBO24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XCO:	${XFONTDIR}/courO24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XH:	${XFONTDIR}/helvR24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XHB:	${XFONTDIR}/helvB24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XHD:	${XFONTDIR}/helvBO24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XHO:	${XFONTDIR}/helvO24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XN:	${XFONTDIR}/ncenR24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XNB:	${XFONTDIR}/ncenB24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XND:	${XFONTDIR}/ncenBI24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
XNI:	${XFONTDIR}/ncenI24.bdf
X	awk -f ${XFONTDIR}/adobe.awk $? | awk -f bdfdit.awk ; cat ${TEMPFILES} > $@; mv temp.aux $@.aux; rm ${TEMPFILES}
X
X###########################################################################
X# Imake.tmpl common rules for all Makefiles - do not edit
X
Xemptyrule::
X
Xclean::
X	$(RM_CMD) \#*
X
XMakefile:: $(IMAKE)
X
XMakefile:: Imakefile \
X	$(IRULESRC)/Imake.tmpl \
X	$(IRULESRC)/Imake.rules \
X	$(IRULESRC)/site.def \
X	$(IRULESRC)/$(MACROFILE)
X	- at if [ -f Makefile ]; then \
X	echo "$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X	else exit 0; fi
X	$(IMAKE_CMD) -DTOPDIR=$(TOP)
X
X$(IMAKE):
X	@echo "making $@"; \
X	cd $(IMAKESRC); $(MAKE) BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS)
X
Xtags::
X	$(TAGS) -w *.[ch]
X	$(TAGS) -xw *.[ch] > TAGS
X
X###########################################################################
X# empty rules for directories that do not have SUBDIRS - do not edit
X
Xinstall::
X	@echo "install done"
X
Xinstall.man::
X	@echo "install.man done"
X
XMakefiles::
X
X###########################################################################
X# dependencies generated by makedepend
X
END_OF_FILE
if test 10120 -ne `wc -c <'xtroff/devpsc/Makefile'`; then
    echo shar: \"'xtroff/devpsc/Makefile'\" unpacked with wrong size!
fi
# end of 'xtroff/devpsc/Makefile'
fi
if test -f 'xtroff/draw.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xtroff/draw.c'\"
else
echo shar: Extracting \"'xtroff/draw.c'\" \(8188 characters\)
sed "s/^X//" >'xtroff/draw.c' <<'END_OF_FILE'
X/*
X *	SunTroff -  A program to display the output of Device Independent
X *		Troff as a window on a Sun Workstation.
X *
X *	Troff_draw.c - Code to do the draw the simple stuff in the page
X *		bit map.
X *
X *	Authors - The original version of this program was written by
X *			Richard L. Hyde (Purdue)
X *			David Slattengren (Berkeley)
X *		It was nearly all rewritten, cleaned up and a more elegant
X *		user interface installed by
X *			Malcolm Slaney (Schlumberger Palo Alto Research)
X *		Combine characters into words
X *			David Cahlander (Cray Research, Inc.)
X *
X *	Legalese -  This command was developed as an independent project
X *		to satisfy a need of the author.  This program may contain
X *		bugs and the user is cautioned to independently verify that
X *		the program is suitable for the user's intended purpose.
X *		The program is made available on an ``as is'' basis with
X *		all faults and without any implied or expressed warranties
X *		or support from either the author, Malcolm Slaney, or
X *		Schlumberger Palo Alto Research Laboratory.
X *
X *		I am putting this program in the public domain.  You are
X *		free to use it as you wish.  In return I ask two things.
X *		First, that you do not remove the names of the authors
X *		from this work.  Secondly, if you make changes or
X *		improvements to this program that you pass these back to
X *		the author so that everybody can benefit from the
X *		improvements.
X *
X *					Malcolm Slaney  (December 1986)
X *					Schlumberger Palo Alto Research
X *					3340 Hillview Avenue
X *					Palo Alto, CA 94304
X *					(415) 496-4669
X *					spar!malcolm at decwrl.dec.com
X *					malcolm at ecn.purdue.edu
X *					malcolm at spar.slb.com (Someday)
X */
X
X#include	"suntroff.h"
X#ifdef SUNTOOLS
X#include	<suntool/sunview.h>
X#include	<suntool/panel.h>
X#include	<suntool/canvas.h>
X#include	<suntool/scrollbar.h>
X
Xextern	Frame	BaseFrame;		/* Top Level Window Frame */
Xextern	Canvas	DrawingCanvas;		/* Main Drawing Window for Text */
Xextern	Menu	MainMenu;		/* Top Level User Menu */
X#else SUNTOOLS
X#include <X11/Intrinsic.h>
X#include <math.h>
Xextern Window DrawingCanvas;
Xextern Widget CanvasWidget;
Xextern Display *dpy;
Xextern GC gc;
Xextern GC fillgc;
Xextern GC cleargc;
Xextern Pixmap PagePixRect;
Xextern int ViewTop, ViewLeft, ViewHeight, ViewWidth;
Xextern int SUNRES;
X#endif SUNTOOLS
Xextern	int	DisplayOutput;		/* Display the output for user? */
X
X#define	FastScale(x)	(((x) * SUNRES) / UserTypesetter->Device.res)
X
XScale(x)
Xint	x;
X{
X	return(((x) * SUNRES) / UserTypesetter->Device.res);
X}
X
XClearPage(){
X#ifdef DEBUG
X	printf("clearing page\n");
X#endif /* DEBUG */
X#ifdef SUNTOOLS
X	extern struct pixrect *PagePixRect;
X
X	pr_rop(PagePixRect,0,0,1000000,1000000,PIX_CLR,NULL,0,0);
X#else /* !SUNTOOLS */
X	XFillRectangle(dpy, PagePixRect, cleargc, 0, 0, 
X	 (unsigned int) PAGE_PIXEL_WIDTH, (unsigned int) PAGE_PIXEL_HEIGHT);
X#endif /* !SUNTOOLS */
X}
X
XRefreshPage(){
X#ifdef DEBUG
X	printf("refreshing page\n");
X#endif
X#ifdef SUNTOOLS
X	RepaintCanvas(DrawingCanvas,canvas_pixwin(DrawingCanvas),0);	
X#else
X	RepaintCanvas(CanvasWidget, (caddr_t) NULL, (XEvent *) NULL);
X#endif 
X}
X
XDrawString(x,y,s)
Xint	x, y;
Xchar	*s;
X{
X	if (!CurrentFont)
X		fatal("Don't have a Current Font.\n");
X
X	if (!CurrentFont->Bits)
X		fatal("Don't have the bits for the Current Font.\n");
X
X	XDrawString(dpy, PagePixRect, gc, FastScale(x), FastScale(y), s, strlen(s));
X}
X
X/*ARGSUSED*/
XDrawCharacter(x,y,c,cwidth)
Xint	x, y, c, cwidth;
X{
X#ifdef SUNTOOLS
X	struct pr_prpos where;
X	char	Text[2];
X	extern struct pixrect *PagePixRect;
X
X	if (!CurrentFont){
X		fatal("Don't have a Current Font.\n");
X	}
X
X	if (!CurrentFont->Bits){
X		fatal("Don't have the bits for the Current Font.\n");
X	}
X
X	where.pos.x = FastScale(x);
X	where.pos.y = FastScale(y);
X	where.pr = PagePixRect;
X
X	Text[0] = c;
X	Text[1] = 0;
X
X	if (DisplayOutput)
X		pf_text(where,PIX_SRC|PIX_DST,CurrentFont->Bits,Text);
X#else
X	static char s[2] = " ";
X	int dx = 0;
X	
X	if (!CurrentFont){
X		fatal("Don't have a Current Font.\n");
X	}
X
X	if (!CurrentFont->Bits){
X		fatal("Don't have the bits for the Current Font.\n");
X	}
X
X	if (DisplayOutput) {
X		s[0] = c;
X#ifndef NOADJUST
X		/* 
X		 *  This kludge tries to centre the X char within the
X		 *  troff char space. Looks a bit better. Thanks to Dave
X		 *  Blythe, U of Toronto.
X		 */
X		dx = (CurrentFont->Bits->per_char)? 
X		 CurrentFont->Bits->per_char[c-1].width : 
X		 CurrentFont->Bits->min_bounds.width;
X		dx = (FastScale(cwidth) - dx)/2;
X#ifdef FONTDEBUG
X		printf("char \"%c\"(0x%x), dx = %d, xwid = %d (lb,rb = %d,%d), cwid = %d (%d scaled)\n",
X		 c, c, dx, CurrentFont->Bits->per_char[c-1].width,
X		 CurrentFont->Bits->per_char[c-1].lbearing,
X		 CurrentFont->Bits->per_char[c-1].rbearing,
X		 cwidth, FastScale(cwidth));
X#endif
X#endif NOADJUST
X		XDrawString(dpy, PagePixRect, gc, 
X		 FastScale(x) + dx, 
X		 FastScale(y), s, 1);
X	}
X#endif
X}
X
X
XDrawLine(x,y)
X{
X	if (DisplayOutput)
X#ifdef SUNTOOLS
X		pr_vector(PagePixRect,
X			  FastScale(HorizontalPosition),
X			  FastScale(VerticalPosition),
X			  FastScale(HorizontalPosition+x),
X			  FastScale(VerticalPosition+y),
X			  PIX_SET,1);
X#else /* !SUNTOOLS */
X#ifdef DEBUG
X		printf("Drawline to %d, %d\n", FastScale(HorizontalPosition + x), FastScale(VerticalPosition + y));
X#endif /* DEBUG */
X		XDrawLine(dpy, PagePixRect, gc, 
X			  FastScale(HorizontalPosition),
X			  FastScale(VerticalPosition),
X			  FastScale(HorizontalPosition+x),
X			  FastScale(VerticalPosition+y));
X#endif /* !SUNTOOLS */
X	HorizontalPosition += x;
X	VerticalPosition += y;
X}
X
X#ifndef SUNTOOLS
Xbox(x1, y1, x2, y2)
Xfloat	x1, y1, x2, y2;
X{
X	int i1, j1, i2, j2;
X
X	i1 = round(ditsiz * x1);
X	j1 = round(ditsiz * y1);
X	i2 = round(ditsiz * x2);
X	j2 = round(ditsiz * y2);
X	XFillRectangle(dpy, PagePixRect, gc, 
X	    FastScale(HorizontalPosition) + i1,
X	    FastScale(VerticalPosition) + j1,
X	    (unsigned int) (i2 - i1), (unsigned int) (j2 - j1));
X}
X
Xline(x1, y1, x2, y2)
Xfloat	x1, y1, x2, y2;
X{
X	int i1, j1, i2, j2;
X
X	i1 = round(ditsiz * x1);
X	j1 = round(ditsiz * y1);
X	i2 = round(ditsiz * x2);
X	j2 = round(ditsiz * y2);
X	XDrawLine(dpy, PagePixRect, gc, 
X	    FastScale(HorizontalPosition) + i1,
X	    FastScale(VerticalPosition) + j1,
X	    FastScale(HorizontalPosition) + i2,
X	    FastScale(VerticalPosition) + j2);
X}
X
Xround(x)
Xfloat	x;
X{
X	if (x < 0)
X		return(x - .5);
X	else
X		return(x + .5);
X}
X
Xdraw_fraction(num, den, size)
Xchar num, den;
Xint size;
X{
X	char s[2];
X
X	SetFontSize(round(0.6 * size));
X	LoadFontBits();
X	s[0] = num;
X	XDrawString(dpy, PagePixRect, gc,
X	 FastScale(HorizontalPosition), 
X	 FastScale(VerticalPosition) - round(0.3 * size), s, 1);
X	s[0] = den;
X	XDrawString(dpy, PagePixRect, gc,
X	 FastScale(HorizontalPosition) + round(0.5 * size),
X	 FastScale(VerticalPosition), s, 1);
X	SetFontSize(size);
X	LoadFontBits();
X	s[0] = '\244';
X	XDrawString(dpy, PagePixRect, gc,
X	 FastScale(HorizontalPosition) + round(.16 * ditsiz), 
X	 FastScale(VerticalPosition), s, 1);
X}
X
X
X#endif /*SUNTOOLS*/
X
Xpoint(x,y)
Xint	x, y;
X{
X	if (DisplayOutput)
X#ifdef SUNTOOLS
X		pr_put(PagePixRect,x,y,1);
X#else
X		XDrawPoint(dpy, PagePixRect, gc, x, y);
X#endif
X}
X
X#ifndef SUNTOOLS
X/*
X *  draw a circle
X *	x1 - x position in character box (0. - 1.)
X *	y1 - y position in character box (0. - 1.)
X *	r  - radius of arc (0. - 1.)
X *	fill - TRUE if filled circle
X */
X
Xcircle(x1, y1, r, fill)
Xfloat	x1, y1, r;
Xint	fill;
X{
X	arc(x1, y1, r, 0, 360, fill);
X}
X
X/*
X *  draw an arc
X *	x1 - x position in character box (0. - 1.)
X *	y1 - y position in character box (0. - 1.)
X *	r  - radius of arc (0. - 1.)
X *	a1 - start angle of arc (degrees)
X *	a2 - length of arc (degrees)
X *	fill - TRUE if filled arc
X */
X
Xarc(x1, y1, r, a1, a2, fill)
Xfloat	x1, y1, r;
Xint	a1, a2;
Xint	fill;
X{
X	int i1, j1, r1;
X
X	i1 = round(ditsiz * x1);
X	j1 = round(ditsiz * y1);
X	r1 = round(ditsiz * r);
X	if (fill)
X		XFillArc(dpy, PagePixRect, fillgc,
X		    FastScale(HorizontalPosition) + i1 - r1,
X		    FastScale(VerticalPosition) + j1 - r1,
X		    (unsigned int) (2 * r1), (unsigned int) (2 * r1),
X		    a1 * 64, a2 * 64);
X	else
X		XDrawArc(dpy, PagePixRect, gc,
X		    FastScale(HorizontalPosition) + i1 - r1,
X		    FastScale(VerticalPosition) + j1 - r1,
X		    (unsigned int) (2 * r1), (unsigned int) (2 * r1),
X		    a1 * 64, a2 * 64);
X}
X#endif /*SUNTOOLS*/
END_OF_FILE
if test 8188 -ne `wc -c <'xtroff/draw.c'`; then
    echo shar: \"'xtroff/draw.c'\" unpacked with wrong size!
fi
# end of 'xtroff/draw.c'
fi
if test -f 'xtroff/fontstuff/Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xtroff/fontstuff/Makefile'\"
else
echo shar: Extracting \"'xtroff/fontstuff/Makefile'\" \(9877 characters\)
sed "s/^X//" >'xtroff/fontstuff/Makefile' <<'END_OF_FILE'
X# Makefile generated by imake - do not edit!
X# $XConsortium: imake.c,v 1.37 88/10/08 20:08:30 jim Exp $
X#
X# The cpp used on this machine replaces all newlines and multiple tabs and
X# spaces in a macro expansion with a single space.  Imake tries to compensate
X# for this, but is not always successful.
X#
X
X###########################################################################
X# X Window System Makefile generated from template file Imake.tmpl
X# $XConsortium: Imake.tmpl,v 1.91 88/10/23 22:37:10 jim Exp $
X#
X# Do not change the body of the imake template file.  Server-specific
X# parameters may be set in the appropriate .macros file; site-specific
X# parameters (but shared by all servers) may be set in site.def.  If you
X# make any changes, you'll need to rebuild the makefiles using
X# "make World" (at best) or "make Makefile; make Makefiles" (at least) in
X# the top level directory.
X#
X# If your C preprocessor doesn't define any unique symbols, you'll need
X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
X# "make Makefile", "make Makefiles", or "make World").
X#
X# If you absolutely can't get imake to work, you'll need to set the
X# variables at the top of each Makefile as well as the dependencies at the
X# bottom (makedepend will do this automatically).
X#
X
X###########################################################################
X# platform-specific configuration parameters - edit Sun.macros to change
X
X# platform:  $XConsortium: Sun.macros,v 1.52 88/10/23 11:00:55 jim Exp $
X# operating system:   SunOS 3.5
X
XBOOTSTRAPCFLAGS =
X             AS = as
X             CC = cc
X            CPP = /lib/cpp
X             LD = ld
X           LINT = lint
X        INSTALL = install
X           TAGS = ctags
X             RM = rm -f
X             MV = mv
X             LN = ln -s
X         RANLIB = ranlib
XRANLIBINSTFLAGS = -t
X             AR = ar clq
X             LS = ls
X       LINTOPTS = -axz
X    LINTLIBFLAG = -C
X           MAKE = make
XSTD_CPP_DEFINES =
X    STD_DEFINES =
X
X###########################################################################
X# site-specific configuration parameters - edit site.def to change
X
X# site:  $XConsortium: site.def,v 1.16 88/10/12 10:30:24 jim Exp $
X
X   GCC = gcc -traditional
X    CC = $(GCC)
X
XCC = gcc -traditional
X
X XWSRC = $(CONTRIBSRC)/widgets/Xhp/Xw
X
X XWLIB = $(USRLIBDIR)/libXw.a
X
X###########################################################################
X# definitions common to all Makefiles - do not edit
X
X          SHELL =  /bin/sh
X
X        DESTDIR =
X      USRLIBDIR = /local/lib/X11
X         BINDIR = /local/bin/X11
X         INCDIR = $(LIBDIR)/include
X        INCROOT = $(DESTDIR)/usr/include
X         ADMDIR =  /scr/Xerrors
X         LIBDIR = /local/share/X11
X     LINTLIBDIR = $(LIBDIR)/lint
X        FONTDIR = $(LIBDIR)/fonts
X       XINITDIR = $(LIBDIR)/xinit
X         XDMDIR = $(LIBDIR)/xdm
X         UWMDIR = $(LIBDIR)/uwm
X         AWMDIR = $(LIBDIR)/awm
X         TWMDIR = $(LIBDIR)/twm
X        MANPATH = /local/man
X  MANSOURCEPATH = $(MANPATH)/man
X         MANDIR = $(MANSOURCEPATH)x
X      LIBMANDIR = $(MANSOURCEPATH)3
X    XAPPLOADDIR = $(LIBDIR)/app-defaults
X
X   INSTBINFLAGS = -m 0755
X   INSTUIDFLAGS = -m 4755
X   INSTLIBFLAGS = -m 0664
X   INSTINCFLAGS = -m 0444
X   INSTMANFLAGS = -m 0444
X   INSTAPPFLAGS = -m 0444
X  INSTKMEMFLAGS = -g kmem -m 2755
X        FCFLAGS = -t
X    CDEBUGFLAGS = -O
X
X        PATHSEP = /
X         DEPEND = $(DEPENDSRC)/makedepend
X          IMAKE = $(IMAKESRC)/imake
X            RGB = $(RGBSRC)/rgb
X             FC = $(BDFTOSNFSRC)/bdftosnf
X      MKFONTDIR = $(MKFONTDIRSRC)/mkfontdir
X      MKDIRHIER = $(SCRIPTSSRC)/mkdirhier.sh
X
X         CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(STD_DEFINES) $(DEFINES)
X      LINTFLAGS = $(LINTOPTS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) -DLINT
X        LDFLAGS = $(CDEBUGFLAGS) $(SYS_LIBRARIES) $(SYSAUX_LIBRARIES)
X            TOP = ../../../../../csri3/X.V11R3
X      CLIENTSRC = $(TOP)/clients
X        DEMOSRC = $(TOP)/demos
X         LIBSRC = $(TOP)/lib
X        FONTSRC = $(TOP)/fonts
X     INCLUDESRC = $(TOP)/X11
X      SERVERSRC = $(TOP)/server
X        UTILSRC = $(TOP)/util
X     SCRIPTSSRC = $(UTILSRC)/scripts
X     EXAMPLESRC = $(TOP)/examples
X     CONTRIBSRC = $(TOP)/contrib
X         DOCSRC = $(TOP)/doc
X         RGBSRC = $(TOP)/rgb
X      DEPENDSRC = $(UTILSRC)/makedepend
X       IMAKESRC = $(UTILSRC)/imake
X       IRULESRC = $(UTILSRC)/imake.includes
X        XLIBSRC = $(LIBSRC)/X
X         XMUSRC = $(LIBSRC)/Xmu
X     TOOLKITSRC = $(LIBSRC)/Xt
X     AWIDGETSRC = $(LIBSRC)/Xaw
X     OLDXLIBSRC = $(LIBSRC)/oldX
X    BDFTOSNFSRC = $(FONTSRC)/bdftosnf
X   MKFONTDIRSRC = $(FONTSRC)/mkfontdir
X   EXTENSIONSRC = $(TOP)/extensions
X
X   EXTENSIONLIB = $(USRLIBDIR)/lib/libXext.a
X           XLIB = $(USRLIBDIR)/libX11.a
X         XMULIB = $(USRLIBDIR)/libXmu.a
X        OLDXLIB = $(USRLIBDIR)/liboldX.a
X       XTOOLLIB = $(USRLIBDIR)/libXt.a
X         XAWLIB = $(USRLIBDIR)/libXaw.a
X       INCLUDES = -I$(INCDIR) -I$(INCROOT)
X
X       LINTXLIB = $(XLIBSRC)/llib-lX11.ln
X        LINTXMU = $(XMUSRC)/llib-lXmu.ln
X      LINTXTOOL = $(TOOLKITSRC)/llib-lXt.ln
X        LINTXAW = $(AWIDGETSRC)/llib-lXaw.ln
X      MACROFILE = Sun.macros
X   ICONFIGFILES = $(IRULESRC)/Imake.tmpl \
X			$(IRULESRC)/$(MACROFILE) $(IRULESRC)/site.def
X  IMAKE_DEFINES =
X      IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl -I$(NEWTOP)$(IRULESRC) \
X			-s Makefile $(IMAKE_DEFINES)
X         RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \
X			.emacs_* tags TAGS make.log MakeOut
X
X###########################################################################
X# rules:  $XConsortium: Imake.rules,v 1.71 88/10/23 22:46:34 jim Exp $
X
X###########################################################################
X# start of Imakefile
X
X#	Not standalone - it gets a lot of variables from the invocation.
X#	VFONTS, RSTFONTS, SUNTROFF_FONTS, PERCENT, PREVIEWER, FC
X
XDEFINES=-DVFONTDIR=\"$(VFONTS)\" -DRSTFONTDIR=\"$(RSTFONTS)\"
XSRCS = vft2ch.c ch2vft.c ch2rst.c rst2ch.c scalech.c vf2bdf.c
X
Xall: vft2ch ch2vft ch2rst rst2ch scalech vf2bdf
X
Xvft2ch: vft2ch.o
X	$(RM) $@
X	$(CC) -o $@ vft2ch.o  $(LDFLAGS)  $(SYSLAST_LIBRARIES)
X
Xrelink::
X	$(RM) vft2ch
X	$(MAKE) $(MFLAGS) vft2ch
X
Xclean::
X	$(RM) vft2ch
X
Xinstall:: vft2ch
X	$(INSTALL) -c $(INSTALLFLAGS) vft2ch  $(BINDIR)
X
Xinstall.man:: vft2ch.man
X	$(INSTALL) -c $(INSTMANFLAGS) vft2ch.man  $(MANDIR)/vft2ch.x
X
Xch2vft: ch2vft.o
X	$(RM) $@
X	$(CC) -o $@ ch2vft.o  $(LDFLAGS)  $(SYSLAST_LIBRARIES)
X
Xrelink::
X	$(RM) ch2vft
X	$(MAKE) $(MFLAGS) ch2vft
X
Xclean::
X	$(RM) ch2vft
X
Xinstall:: ch2vft
X	$(INSTALL) -c $(INSTALLFLAGS) ch2vft  $(BINDIR)
X
Xinstall.man:: ch2vft.man
X	$(INSTALL) -c $(INSTMANFLAGS) ch2vft.man  $(MANDIR)/ch2vft.x
X
Xch2rst: ch2rst.o
X	$(RM) $@
X	$(CC) -o $@ ch2rst.o  $(LDFLAGS)  $(SYSLAST_LIBRARIES)
X
Xrelink::
X	$(RM) ch2rst
X	$(MAKE) $(MFLAGS) ch2rst
X
Xclean::
X	$(RM) ch2rst
X
Xinstall:: ch2rst
X	$(INSTALL) -c $(INSTALLFLAGS) ch2rst  $(BINDIR)
X
Xinstall.man:: ch2rst.man
X	$(INSTALL) -c $(INSTMANFLAGS) ch2rst.man  $(MANDIR)/ch2rst.x
X
Xrst2ch: rst2ch.o
X	$(RM) $@
X	$(CC) -o $@ rst2ch.o  $(LDFLAGS)  $(SYSLAST_LIBRARIES)
X
Xrelink::
X	$(RM) rst2ch
X	$(MAKE) $(MFLAGS) rst2ch
X
Xclean::
X	$(RM) rst2ch
X
Xinstall:: rst2ch
X	$(INSTALL) -c $(INSTALLFLAGS) rst2ch  $(BINDIR)
X
Xinstall.man:: rst2ch.man
X	$(INSTALL) -c $(INSTMANFLAGS) rst2ch.man  $(MANDIR)/rst2ch.x
X
Xscalech: scalech.o
X	$(RM) $@
X	$(CC) -o $@ scalech.o  $(LDFLAGS)  $(SYSLAST_LIBRARIES)
X
Xrelink::
X	$(RM) scalech
X	$(MAKE) $(MFLAGS) scalech
X
Xclean::
X	$(RM) scalech
X
Xinstall:: scalech
X	$(INSTALL) -c $(INSTALLFLAGS) scalech  $(BINDIR)
X
Xinstall.man:: scalech.man
X	$(INSTALL) -c $(INSTMANFLAGS) scalech.man  $(MANDIR)/scalech.x
X
Xvf2bdf: vf2bdf.o
X	$(RM) $@
X	$(CC) -o $@ vf2bdf.o  $(LDFLAGS)  $(SYSLAST_LIBRARIES)
X
Xrelink::
X	$(RM) vf2bdf
X	$(MAKE) $(MFLAGS) vf2bdf
X
Xclean::
X	$(RM) vf2bdf
X
Xinstall:: vf2bdf
X	$(INSTALL) -c $(INSTALLFLAGS) vf2bdf  $(BINDIR)
X
Xinstall.man:: vf2bdf.man
X	$(INSTALL) -c $(INSTMANFLAGS) vf2bdf.man  $(MANDIR)/vf2bdf.x
X
Xdepend:: $(DEPEND)
X
Xdepend::
X	$(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS)
X
X$(DEPEND):
X	@echo "making $@"; \
X	cd $(DEPENDSRC); $(MAKE)
X
X#		The two scripts check for suntroff or xtroff.
Xsunfonts:	ch2vft ch2rst vft2ch rst2ch scalech vf2bdf
X		if test -d ${VFONTS}; then \
X			./MakeSunFonts ${VFONTS} ${SUNTROFF_FONTS} \
X			${SUNPERCENT} ${PREVIEWER} ${FC} ${SUNDEVICE}; fi
X
Xrstfonts:
X		if test -d ${RSTFONTS}; then \
X			./MakeImFonts ${RSTFONTS} ${SUNTROFF_FONTS} \
X			${RSTPERCENT} ${PREVIEWER} ${FC} ${RSTDEVICE}; fi
X
X###########################################################################
X# Imake.tmpl common rules for all Makefiles - do not edit
X
Xemptyrule::
X
Xclean::
X	$(RM_CMD) \#*
X
XMakefile:: $(IMAKE)
X
XMakefile:: Imakefile \
X	$(IRULESRC)/Imake.tmpl \
X	$(IRULESRC)/Imake.rules \
X	$(IRULESRC)/site.def \
X	$(IRULESRC)/$(MACROFILE)
X	- at if [ -f Makefile ]; then \
X	echo "$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X	else exit 0; fi
X	$(IMAKE_CMD) -DTOPDIR=$(TOP)
X
X$(IMAKE):
X	@echo "making $@"; \
X	cd $(IMAKESRC); $(MAKE) BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS)
X
Xtags::
X	$(TAGS) -w *.[ch]
X	$(TAGS) -xw *.[ch] > TAGS
X
X###########################################################################
X# empty rules for directories that do not have SUBDIRS - do not edit
X
Xinstall::
X	@echo "install done"
X
Xinstall.man::
X	@echo "install.man done"
X
XMakefiles::
X
X###########################################################################
X# dependencies generated by makedepend
X
X# DO NOT DELETE
X
Xvft2ch.o: /usr/include/stdio.h /usr/include/ctype.h /usr/include/vfont.h
Xch2vft.o: /usr/include/stdio.h /usr/include/ctype.h /usr/include/vfont.h
Xch2rst.o: /usr/include/stdio.h /usr/include/ctype.h rst.h
Xrst2ch.o: /usr/include/stdio.h /usr/include/ctype.h rst.h
Xscalech.o: /usr/include/stdio.h /usr/include/ctype.h
Xvf2bdf.o: /usr/include/stdio.h /usr/include/vfont.h /usr/include/sys/types.h
Xvf2bdf.o: /usr/include/sys/sysmacros.h
END_OF_FILE
if test 9877 -ne `wc -c <'xtroff/fontstuff/Makefile'`; then
    echo shar: \"'xtroff/fontstuff/Makefile'\" unpacked with wrong size!
fi
# end of 'xtroff/fontstuff/Makefile'
fi
if test -f 'xtroff/parse.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xtroff/parse.c'\"
else
echo shar: Extracting \"'xtroff/parse.c'\" \(8018 characters\)
sed "s/^X//" >'xtroff/parse.c' <<'END_OF_FILE'
X/*
X *	SunTroff -  A program to display the output of Device Independent
X *		Troff as a window on a Sun Workstation.
X *
X *	Troff_parse.c - Parse the device independent troff file.  All
X *		the real work of drawing the bits is done by other
X *		files.
X *
X *	Authors - The original version of this program was written by
X *			Richard L. Hyde (Purdue)
X *			David Slattengren (Berkeley)
X *		It was nearly all rewritten, cleaned up and a more elegant
X *		user interface installed by
X *			Malcolm Slaney (Schlumberger Palo Alto Research)
X *		Combine characters into words
X *			David Cahlander (Cray Research, Inc.)
X *
X *	Legalese -  This command was developed as an independent project
X *		to satisfy a need of the author.  This program may contain
X *		bugs and the user is cautioned to independently verify that
X *		the program is suitable for the user's intended purpose.
X *		The program is made available on an ``as is'' basis with
X *		all faults and without any implied or expressed warranties
X *		or support from either the author, Malcolm Slaney, or
X *		Schlumberger Palo Alto Research Laboratory.
X *
X *		I am putting this program in the public domain.  You are
X *		free to use it as you wish.  In return I ask two things.
X *		First, that you do not remove the names of the authors
X *		from this work.  Secondly, if you make changes or
X *		improvements to this program that you pass these back to
X *		the author so that everybody can benefit from the
X *		improvements.
X *
X *					Malcolm Slaney  (December 1986)
X *					Schlumberger Palo Alto Research
X *					3340 Hillview Avenue
X *					Palo Alto, CA 94304
X *					(415) 496-4669
X *					spar!malcolm at decwrl.dec.com
X *					malcolm at ecn.purdue.edu
X *					malcolm at spar.slb.com (Someday)
X */
X
X#include	"suntroff.h"
X
Xstatic int StopSeen = 0;
X
Xextern char *GetWord(), *GetLine();
X
XParseInput()
X{
X	int	n, k, c;
X	char	Buffer[BUFSIZ];
X
X	StopSeen = 0;
X
X	for (;;) {
X		if ((c = GetChar()) != EOF) {
X			switch (c) {
X			case '\n':	
X				LineNumber++;
X				break;
X			case ' ':	/* when input is text */
X			case 0:		/* occasional noise creeps in */
X				break;
X			case '{':	/* push down current environment */
X				push_env();
X				break;
X			case '}':
X				pop_env();
X				break;
X					/* two motion digits plus a
X					   character */
X			case '0': case '1': case '2': case '3': case '4':
X			case '5': case '6': case '7': case '8': case '9':
X				HorizontalMove((c-'0')*10 + GetChar()-'0');
X				PutCharacter(GetChar());
X				break;
X			case 'c':	/* single ascii character */
X				PutCharacterString();
X				break;
X			case 'C':
X				GetWord(Buffer, BUFSIZ);
X				PutSpecialCharacter(Buffer);
X				break;
X#ifdef	BEZERKELYISM
X			case 't':	/* straight text */
X			{
X				char	*s, c;
X
X				if (GetLine(Buffer,BUFSIZ) == NULL){
X					fatal("unexpected end of input");
X				}
X
X				s = Buffer;
X
X				while ((c = *s++) != '\n') {
X					if (c == '\\') {
X						switch (c = *s++) {
X						case '\\':
X						case 'e':
X						    PutCharacter('\\');
X						    break;
X						case '(':
X						{
X						    char str[3];
X
X						    str[0] = *s++;
X						    str[1] = *s++;
X						    str[2] = '\0';
X						    PutSpecialCharacter(str);
X						    break;
X						}
X						}
X					} else {
X					    PutCharacter(c);
X					}
X					/*hmot((int)hscale);*/
X				}
X				break;
X			}
X#endif	BEZERKELYISM				
X			case 'D':	/* draw function */
X				GetLine(Buffer, BUFSIZ);
X				ParseDrawFunction(Buffer);
X				break;
X			case 's':
X					/* ignore fractional sizes */
X				n = GetNumber();
X				SetFontSize(n);
X				break;
X			case 'f':
X				n = GetNumber();
X				SetFont(n);
X				break;
X#ifdef	BEZERKELYISM
X			case 'i':
X				n = GetNumber();
X				setstip(n);	/* ignore for now */
X				break;
X#endif	BEZERKELYISM
X			case 'H':	/* absolute horizontal motion */
X				k = GetNumber();
X				HorizontalGoto(k);
X				break;
X			case 'h':	/* relative horizontal motion */
X				k = GetNumber();
X				HorizontalMove(k);
X				break;
X			case 'w':	/* word space */
X#ifndef BEZERKELYISM
X				c = GetChar();
X				if (c < '0' || c > '9') {
X					UnGetChar(c);
X					break;
X				}
X				HorizontalMove((c-'0')*10 + GetChar()-'0');
X				PutCharacterString();
X#endif
X				break;
X			case 'V':
X				n = GetNumber();
X				VerticalGoto(n);
X				break;
X			case 'v':
X				n = GetNumber();
X				VerticalMove(n);
X				break;
X			case 'P':	/* new spread */
X				break;
X			case 'p':	/* new page */
X				(void) GetNumber();
X				return(RememberPagePosition());
X			case 'n':	/* end of line */
X				GetNumber();
X				GetNumber();
X				HorizontalGoto(0);
X				break;
X			case '#':	/* comment */
X				GetLine((char *) NULL, 0);
X				break;
X			case 'x':	/* device control */
X				ParseDeviceControl();
X				break;
X			default:
X				warning("Unknown input character %c(%d)\n",
X				      c, c);
X			}
X		} else {
X			extern int LastPage, CurrentPage;
X			if (!LastPage && !StopSeen){
X				warning("File is incomplete!\nEnd of file reached before finding\nthe end of the document.\nHave read %d pages.",CurrentPage);
X			}
X			return(CurrentPage);
X		}
X	}
X}
X
Xstruct	state {
X	int	size;
X	int	font;
X	int	style;
X	int 	thick;
X	int	h_pos;
X	int	v_pos;
X};
X
Xstruct	state 	StateStack[MAXSTATE];
Xstruct	state	*statep = StateStack;
X	  
Xpush_env()					/* begin a new block */
X{
X	statep->size = size;
X	statep->font = font;
X	statep->style = linmod;
X	statep->thick = linethickness;
X	statep->h_pos = HorizontalPosition;
X	statep->v_pos = VerticalPosition;
X	if (statep+1 >= StateStack+MAXSTATE)
X		warning( "{ nested too deep");
X	else
X		statep++;
X}
X
Xpop_env()					/* pop to previous state */
X{
X	if (--statep < StateStack)
X		warning("extra }");
X	else {
X		size = statep->size;
X		font = statep->font;
X	    	HorizontalPosition = statep->h_pos;
X		VerticalPosition = statep->v_pos;
X		linmod = statep->style;
X		linethickness = statep->thick;
X		SetFont(font);
X		SetFontSize(size);
X	}
X}
X
XParseDrawFunction(buf)
Xchar	*buf;
X{
X	int	n, m, n1, m1;
X	int bordered; /* until we do polygons right */
X
X	switch (buf[0]) {
X	case 'l':				/* draw a line */
X		sscanf(buf+1, "%d %d", &n, &m);
X		DrawLine(n, m);
X		break;
X	case 'c':				/* circle */
X		sscanf(buf+1, "%d", &n);
X		DrawCircle(n);
X		break;
X	case 'e':				/* ellipse */
X		sscanf(buf+1, "%d %d", &m, &n);
X		DrawEllipse(m, n);
X		break;
X	case 'a':				/* arc */
X		sscanf(buf+1, "%d %d %d %d", &n, &m, &n1, &m1);
X		DrawArc(n, m, n1, m1);
X		break;
X	case '~':				/* wiggly line */
X		DrawSpline(buf+1,1);
X		break;
X#ifdef	BEZERKELYISM
X	case 'q':				/* versatec polygon - ignore */
X		while (buf[strlen(buf) - 1] != '\n'){
X			if (GetLine(buf, sizeof(buf)) == NULL){
X				fatal("unexpected end of input");
X			}
X		}
X		break;
X	case 'P':				/* unbordered */
X		bordered = 0;
X	case 'p':				/* polygon */
X		sscanf(buf+1, "%d", &n);
X		n = 1;
X		while(buf[n++] == ' ');
X		while(isdigit(buf[n])) n++;
X		DrawSpline(buf+n, -1);
X		bordered = 1;
X		break;
X	case 'g':				/* gremlin spline */
X		DrawSpline(buf+1, 0);
X		break;
X	case 't':				/* line thickness */
X		sscanf(buf+1, "%d", &n);
X		drawthick(n); 
X		break;
X	case 's':	/* line style */
X		sscanf(buf+1, "%d", &n);
X		drawstyle(n);
X		break;
X#endif	BEZERKELEYISM
X	default:
X		warning("unknown drawing function %s", buf);
X		break;
X	}
X} 
X
XParseDeviceControl()				/* Parse the x commands */
X{
X        char str[20], str1[50];
X	int c, n;
X	extern int LastPage, CurrentPage;
X
X	GetWord(str, 20);
X	switch (str[0]) {			/* crude for now */
X	case 'T':				/* output device */
X		GetWord(DeviceName, 10);
X		break;
X	case 'i':				/* initialize */
X		UserTypesetter = LoadDevice(DeviceName);
X		CurrentPage = 1;
X		SetPrinter(DeviceName);
X		InitTypesetter();
X		break;
X	case 't':				/* trailer */
X		break;
X	case 'p':				/* pause -- can restart */
X		break;
X	case 's':				/* stop */
X		StopSeen = 1;
X		LastPage = CurrentPage;
X		return;
X	case 'r':				/* resolution when prepared */
X		DeviceResolution = GetNumber();
X		break;
X	case 'f':				/* font used */
X		n = GetNumber();
X		(void) GetWord(str, 20);
X		(void) GetLine(str1, 50);
X		SetFontPosition(n, str, str1);
X		break;
X	case 'H':				/* char height */
X		break;
X	case 'S':				/* slant */
X		break;
X	}
X	while ((c = GetChar()) != '\n')		/* skip rest of input line */
X		if (c == EOF)
X			return;
X	return;
X}
END_OF_FILE
if test 8018 -ne `wc -c <'xtroff/parse.c'`; then
    echo shar: \"'xtroff/parse.c'\" unpacked with wrong size!
fi
# end of 'xtroff/parse.c'
fi
echo shar: End of archive 9 \(of 18\).
cp /dev/null ark9isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 18 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0



More information about the Comp.sources.x mailing list