[comp.sources.x] v06i023: xfig, Part15/15

argv%turnpike@Sun.COM (Dan Heller) (03/08/90)

Submitted-by: Brian Smith <bvsmith@lbl.gov>
Posting-number: Volume 6, Issue 23
Archive-name: xfig2/part15



#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
#		"End of archive 15 (of 15)."
# Contents:  xfig/color.c xfig/const.h xfig/dir.c xfig/f2p.l
#   xfig/font.h xfig/paintop.h xfig/psfonts.h xfig/puterr.c
#   xfig/revbytes.c xfig/save_n_exit.c xfig/version.h xfig/xtra.h
# Wrapped by argv@turnpike on Wed Feb 28 10:53:28 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'xfig/color.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xfig/color.c'\"
else
echo shar: Extracting \"'xfig/color.c'\" \(365 characters\)
sed "s/^X//" >'xfig/color.c' <<'END_OF_FILE'
X/* 
X *	FIG : Facility for Interactive Generation of figures
X *
X *	Copyright (c) 1988 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU)
X *      March 1988.
X *
X *	%W%	%G%
X*/
X
Xint			background_color = 0;	/* black */
Xint			foreground_color = 1;	/* white */
X
Xinvert_color()
X{
X	int	c;
X
X	c = background_color;
X	background_color = foreground_color;
X	foreground_color = c;
X	}
END_OF_FILE
if test 365 -ne `wc -c <'xfig/color.c'`; then
    echo shar: \"'xfig/color.c'\" unpacked with wrong size!
fi
# end of 'xfig/color.c'
fi
if test -f 'xfig/const.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xfig/const.h'\"
else
echo shar: Extracting \"'xfig/const.h'\" \(904 characters\)
sed "s/^X//" >'xfig/const.h' <<'END_OF_FILE'
X/* 
X *	FIG : Facility for Interactive Generation of figures
X *
X *	Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU)
X *      November 1985.
X *
X *	%W%	%G%
X*/
X#define		PIX_PER_INCH		80
X#define		PIX_PER_CM		30 /* ((int)(PIX_PER_INCH / 2.54 + (5.0/2))) */
X					  
X/* Portrait dimensions */
X#define		DEF_CANVAS_HEIGHT_P	9.25*PIX_PER_INCH
X#define		DEF_CANVAS_WIDTH_P	8*PIX_PER_INCH
X
X/* Landscape dimensions */
X#define		DEF_CANVAS_HEIGHT_L	8*PIX_PER_INCH
X#define		DEF_CANVAS_WIDTH_L	10*PIX_PER_INCH
X
X#define		RULER_WIDTH		24
X
X#define		MSG_HEIGHT		25
X
X#define		ICON_COLUMN_PORT	3	/* number of switches wide in panel */
X#define		ICON_COLUMN_LAND	3	/* same for landscape mode */
X
X#define		SWITCH_ICON_WIDTH	32	/* width of a switch icon */
X#define		SWITCH_ICON_HEIGHT	32
X#define		SWITCH_ICON_SPACING	4
X
X#define		MAXPRINTERS		2
X
X#define		DEF_PRINTFONTSIZE	12	/* default printer font size (points) */
END_OF_FILE
if test 904 -ne `wc -c <'xfig/const.h'`; then
    echo shar: \"'xfig/const.h'\" unpacked with wrong size!
fi
# end of 'xfig/const.h'
fi
if test -f 'xfig/dir.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xfig/dir.c'\"
else
echo shar: Extracting \"'xfig/dir.c'\" \(1059 characters\)
sed "s/^X//" >'xfig/dir.c' <<'END_OF_FILE'
X/* 
X *	FIG : Facility for Interactive Generation of figures
X *
X *	Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU)
X *	November 1985.
X *	1st revision: Mar 1988.
X *
X *	%W%	%G%
X*/
X#include "fig.h"
X
Xextern char		*sys_errlist[];
Xextern int		sys_nerr, errno;
X
Xextern char		directory[];
X
Xint
Xchange_directory(path)
Xchar	*path;
X{
X	extern char	*getwd();
X	if (path == NULL) 
X		return(0);
X	put_msg("Changing . . .");
X	if (chdir(path) == -1) {
X	    put_msg("Can't go to directory %s, : %s",
X		path, sys_errlist[errno]);
X	    }
X	else {
X	    if (get_directory(directory) != NULL) /* get current working directory */
X		    print_directory();
X	    }
X	return(1);
X	}
X
Xprint_directory()
X{
X	extern char	*getwd();
X
X	if (*directory == '\0')
X		(void) get_directory(directory); /* get current working directory */
X	put_msg("DIRECTORY: \"%s\"",directory);
X	}
X
Xget_directory(direct)
Xchar *direct;
X	{
X	if (getwd(direct) == NULL)	/* get curent working dir */
X		{
X		put_msg("%s", direct);	/* err msg is in directory */
X		*direct = '\0';
X		return NULL;
X		}
X	return 1;
X	}
END_OF_FILE
if test 1059 -ne `wc -c <'xfig/dir.c'`; then
    echo shar: \"'xfig/dir.c'\" unpacked with wrong size!
fi
# end of 'xfig/dir.c'
fi
if test -f 'xfig/f2p.l' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xfig/f2p.l'\"
else
echo shar: Extracting \"'xfig/f2p.l'\" \(969 characters\)
sed "s/^X//" >'xfig/f2p.l' <<'END_OF_FILE'
X.TH F2P 1 "29 March 1988"
X.SH NAME
Xf2p \- translates fig output into pic language
X.SH SYNOPSIS
X.B f2p
X[-s font_size] [ input_file [ output_file ] ]
X.SH DESCRIPTION
X.I F2p
Xtranslates fig objects in the named
X.I input_file
Xinto pic language and put them in
X.I output_file.
XIf only one file name is presented, it is assumed to be the input file
X(fig output file). The output file
X.I (pic_file), 
Xif not presented, will be the stdout.
XIf the 
X.I input_file 
Xis not presented, input will be assumed to come from the stdin.
XThe output from f2p can be edited to change font sizes/types.
X.PP
XThe unit of
X.I font_size
Xis point.  There are 72 points in an inch. 
XThe upper limit of font_size is 300 points (about 4 inches).
XThe default size is 11 points.
XThe position of text on the hard copy is depended on the specified
Xfont size.
X.SH "SEE ALSO"
Xfig(1),
Xpic(1).
X.SH AUTHOR
XSupoj Sutanthavibul (supoj@sally.UTEXAS.EDU),
X.br
XUniversity of Texas at Austin, 
X.br
XJanuary 29, 1985.
END_OF_FILE
if test 969 -ne `wc -c <'xfig/f2p.l'`; then
    echo shar: \"'xfig/f2p.l'\" unpacked with wrong size!
fi
# end of 'xfig/f2p.l'
fi
if test -f 'xfig/font.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xfig/font.h'\"
else
echo shar: Extracting \"'xfig/font.h'\" \(649 characters\)
sed "s/^X//" >'xfig/font.h' <<'END_OF_FILE'
X/* 
X *	FIG : Facility for Interactive Generation of figures
X *
X *	Copyright (c) 1988 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU)
X *	January 1988.
X *
X *	%W%	%G%
X*/
X
XEXTERN PIX_FONT		bold_font;
XEXTERN PIX_FONT		roman_font;
XEXTERN PIX_FONT		canvas_font;
XEXTERN PIX_FONT		button_font;
X
X#define		NORMAL_FONT	"fixed"
X#define		BOLD_FONT	"8x13bold"
X
X#define			char_height(font)	((font)->max_bounds.ascent + (font)->max_bounds.descent)
X#define			char_width(font)	((font)->max_bounds.width)
X#define			char_advance(font,char)	(\
X			((font)->per_char)?\
X			    ((font)->per_char[(char)-(font)->min_char_or_byte2].width):\
X			    ((font)->max_bounds.width))
END_OF_FILE
if test 649 -ne `wc -c <'xfig/font.h'`; then
    echo shar: \"'xfig/font.h'\" unpacked with wrong size!
fi
# end of 'xfig/font.h'
fi
if test -f 'xfig/paintop.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xfig/paintop.h'\"
else
echo shar: Extracting \"'xfig/paintop.h'\" \(329 characters\)
sed "s/^X//" >'xfig/paintop.h' <<'END_OF_FILE'
X/* 
X *	FIG : Facility for Interactive Generation of figures
X *
X *	Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU)
X *      November 1985.
X *
X *	%W%	%G%
X*/
X
X#define				 INV_PAINT	GXxor
X#define				 MERGE		GXor
X#define				 PAINT		GXcopy
X#define				 ERASE		GXcopyInverted
X
X#define				 DRAW		1
X#define				 UNDRAW		0
END_OF_FILE
if test 329 -ne `wc -c <'xfig/paintop.h'`; then
    echo shar: \"'xfig/paintop.h'\" unpacked with wrong size!
fi
# end of 'xfig/paintop.h'
fi
if test -f 'xfig/psfonts.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xfig/psfonts.h'\"
else
echo shar: Extracting \"'xfig/psfonts.h'\" \(721 characters\)
sed "s/^X//" >'xfig/psfonts.h' <<'END_OF_FILE'
X#define	FONT_PANE_WIDTH 290
X#define	FONT_PANE_HEIGHT 20
X#define	MIN_P_SIZE 6
X#define	MAX_P_SIZE 30
X#define	NUMFONTS 35
X
X/* element of linked list for each font
X   The head of list is for the different font NAMES,
X   and the elements of this list are for each different
X   point size of that font */
X
Xstruct xfont {
X	int size;		/* size in points */
X	Font fid;		/* X font id */
X	XFontStruct *fstruct;	/* X font structure */
X	char *fname;		/* actual name of X font found */
X	struct xfont *next;	/* next in the list */
X	};
X
Xstruct _fstruct {
X	char *psfont;		/* Postscript font name */
X	char *template;		/* template for locating X fonts */
X	struct xfont *xfontlist; /* linked list of X fonts for different point sizes */
X	};
X
END_OF_FILE
if test 721 -ne `wc -c <'xfig/psfonts.h'`; then
    echo shar: \"'xfig/psfonts.h'\" unpacked with wrong size!
fi
# end of 'xfig/psfonts.h'
fi
if test -f 'xfig/puterr.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xfig/puterr.c'\"
else
echo shar: Extracting \"'xfig/puterr.c'\" \(482 characters\)
sed "s/^X//" >'xfig/puterr.c' <<'END_OF_FILE'
X/* 
X *	FIG : Facility for Interactive Generation of figures
X *
X *	Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU)
X *	November 1985.
X *
X *	%W%	%G%
X*/
X#include "fig.h"
X
X/*VARARGS1*/
Xput_err(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
Xchar   *format, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7, *arg8;
X{
X	fprintf(stderr, format, arg1, arg2, arg3, arg4, arg5, 
X		arg6, arg7, arg8);
X	put_msg(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
X}
END_OF_FILE
if test 482 -ne `wc -c <'xfig/puterr.c'`; then
    echo shar: \"'xfig/puterr.c'\" unpacked with wrong size!
fi
# end of 'xfig/puterr.c'
fi
if test -f 'xfig/revbytes.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xfig/revbytes.c'\"
else
echo shar: Extracting \"'xfig/revbytes.c'\" \(890 characters\)
sed "s/^X//" >'xfig/revbytes.c' <<'END_OF_FILE'
X/* use this program for converting Sun bitmap files (MSB first)
X   to Vax X bitmap files (LSB first) */
X
X#include <stdio.h>
X
X#include "bit_reverse.h"
X
X#define MAXLINE 300
X
Xchar line[MAXLINE];
Xchar byte,c;
Xint data,i;
Xint invert=0;	/* inverted (1/0) */
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X	{
X	if (argc > 1)
X		if (strcmp(argv[1],"-i")==0)
X			invert=1;
X	while (1)
X	    {
X	    if (gets(line,MAXLINE,stdin)==0)
X		exit(0);
X	    puts(line,stdout);
X	    if (strncmp(line,"static",6)==0) /* stop reading header when hit "static" */
X		break;
X	    }
X	i=0;
X	putchar('\t');
X	while (1)
X		{
X		while ((c=getc(stdin)) == ' ' || c=='\t') /* skip leading white space */
X			;
X		ungetc(c,stdin);
X		if (scanf("0x%2x, ",&data)==0)
X			{
X			puts("};",stdout);
X			exit(0);
X			}
X		if (invert)
X			data = ~data;
X		printf("0x%02x,",bit_reverse[data]);
X		if ((++i %16)==0)
X			{
X			i=0;
X			printf("\n\t");
X			}
X		}
X	}
END_OF_FILE
if test 890 -ne `wc -c <'xfig/revbytes.c'`; then
    echo shar: \"'xfig/revbytes.c'\" unpacked with wrong size!
fi
# end of 'xfig/revbytes.c'
fi
if test -f 'xfig/save_n_exit.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xfig/save_n_exit.c'\"
else
echo shar: Extracting \"'xfig/save_n_exit.c'\" \(265 characters\)
sed "s/^X//" >'xfig/save_n_exit.c' <<'END_OF_FILE'
Xsave_n_exit()
X	{
X	if (! figure_modified) 
X		quit();
X	if (no_object()) 
X		quit();
X	if (*current_file != 0) {
X	    if (0 == write_file(current_file, 0)) 
X		quit();
X	    }
X	else {
X	    blink_msg();
X	    init_msg_receiving(save_and_exit, "Save in file : ");
X	    }
X	}
X
END_OF_FILE
if test 265 -ne `wc -c <'xfig/save_n_exit.c'`; then
    echo shar: \"'xfig/save_n_exit.c'\" unpacked with wrong size!
fi
# end of 'xfig/save_n_exit.c'
fi
if test -f 'xfig/version.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xfig/version.h'\"
else
echo shar: Extracting \"'xfig/version.h'\" \(252 characters\)
sed "s/^X//" >'xfig/version.h' <<'END_OF_FILE'
X/* 
X *	FIG : Facility for Interactive Generation of figures
X *
X *	Copyright (c) 1988 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU)
X *      March 1988.
X *
X *	%W%	%G%
X*/
X
X#define			FIG_VERSION		"2.0"
X#define			PROTOCOL_VERSION	"1.4X"	/* file format */
END_OF_FILE
if test 252 -ne `wc -c <'xfig/version.h'`; then
    echo shar: \"'xfig/version.h'\" unpacked with wrong size!
fi
# end of 'xfig/version.h'
fi
if test -f 'xfig/xtra.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xfig/xtra.h'\"
else
echo shar: Extracting \"'xfig/xtra.h'\" \(571 characters\)
sed "s/^X//" >'xfig/xtra.h' <<'END_OF_FILE'
X/* 
X *	FIG : Facility for Interactive Generation of figures
X *
X *	Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU)
X *	January 1985.
X *	1st revision : Aug 1985.
X *
X *	%W%	%G%
X*/
X
X#define	tool_destroy(tool)	XtDestroyWidget(tool)
X
Xpr_size pf_textwidth();
X
X#define	msg_text(w, x, y, font, string) \
X	XDrawString(tool_d, (w), (font==bold_font)?bold_gc: gc, (x), (y), \
X		(string), strlen(string))
X
X#define	pw_batch_on(w)
X
X#define	pw_batch_off(w)
X
X#define	CTRL_H	8
X#define	NL	10
X#define	CR	13
X#define	CTRL_U	21
X#define	CTRL_X	24
X#define	SP	32
X#define	DEL	127
END_OF_FILE
if test 571 -ne `wc -c <'xfig/xtra.h'`; then
    echo shar: \"'xfig/xtra.h'\" unpacked with wrong size!
fi
# end of 'xfig/xtra.h'
fi
echo shar: End of archive 15 \(of 15\).
cp /dev/null ark15isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 15 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
dan
-----------------------------------------------------------
		    O'Reilly && Associates
		argv@sun.com / argv@ora.com
	   632 Petaluma Ave, Sebastopol, CA 95472 
     800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104
    Opinions expressed reflect those of the author only.