[comp.sources.misc] v14i071: cat2deskjet

vp@cui.unige.ch (08/31/90)

Posting-number: Volume 14, Issue 71
Submitted-by: vp@cui.unige.ch
Archive-name: cat2deskjet/part01

This distribution contains programs that can translate troff(1)
output to the format used by the Hewlett-Packard DeskJet family printers.
Also include is a program that converts vfonts to DeskJet soft fonts
suitable for downloading to DeskJet printers and a program that prints
the information included in the DeskJet soft font headers.

Have fun

**vp

email:	vp@cui.unige.ch		| Vasilis Prevelakis
uucp:	...!mcsun!cui!vp	| Centre Universitaire d'Informatique (CUI)
Phone:	+41 (22) 787 65 86	| 12 Rue du Lac,
Fax:	+41 (22) 735 39 05	| Geneva, Switzerland CH-1207

For every problem, there is solution that is simple, plausible and wrong.
	-- H.L. Mencken


---------- cut here ------------ cut here ------------ cut here ------------
#! /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 1 (of 3)."
# Contents:  README LICENSE bm.c djinfo.1 djinfo.c fcache.bat ftbl.c
#   lcat.h
# Wrapped by vp@cuisun29 on Tue Aug 28 14:24:38 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(2499 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
XHere are the two versions of the program that converts CAT output to a format
Xsuitable for the Hewlet-Packard DeskJet family of printers.
X
XThis program relies heavily on previous work done by 
Xihnp4!mnetor!clewis (Chris Lewis), published in the 3rd volume of
Xcomp.sources.unix.  For this reason some of the
Xfiles carry the copyright of the original author.  The rest
Xhave the GNU copyleft applied to them.
X
XSpecial thanks are due to Hewlett-Packard for all the information
Xabout the DeskJet and its font format that they sent to me.
X
XNow a few words about the programs in this distribution:
X
XThe first version (lcat) uses the DeskJet graphics mode to send the
Xdocument to the printer, while the other one (vcat) creates soft fonts
Xand downloads them accordingly.  The lcat program gives you a choice of
Xtwo resolutions (300 dpi and 150 dpi).  The low res mode is really good
Xonly for drafts but is so much faster that its worth having.
X
XHere are the times for the execution of the two programs
X
X(the mode button is that little button you have on the DeskJet control
Xpanel.  If the LED is on then you are in DRAFT mode, otherwise you are
Xin LQ mode)
X
XProgram          Resolution     Mode Button     Time (minutes.seconds)
Xlcat              hires             LQ               2.54
X                  lores            DRAFT             1.01
Xvcat
X(empty cache)      N/A              LQ               1.48
X(empty cache)      N/A             DRAFT             1.40
X
X(full cache)       N/A              LQ               0.53
X(full cache)       N/A             DRAFT             0.45
X
XThe times are from the time the RETURN key is pressed till the paper is
Xejected by the printer.  Note though that while lcat ties up the
Xcomputer the whole time, vcat terminates before the DeskJet finishes
Xprinting.  This is due to the fact that the DeskJet buffer can hold
Xquite a few characters, but only one line of graphics data.
X
XTODO:
X	The font cache management needs a lot of work.  It should
X	at least check the size of the downloaded fonts and use
X	that to determine which fonts have to go.
X
X	The ligature code works only on lcat.  If your font doesn't 
X	have ligatures and you want to use vcat, then be sure to
X	tell troff not to use ligatures (.lg 0).  Note that by default
X	troff assumes that you do want ligatures.
X	
XBug fixes, comments etc. to:
X    Vasilis Prevelakis
X    Centre Universitaire d'Informatique (CUI)
X    12 Rue du Lac, Geneva, Switzerland CH-1207
Xemail: vp@cui.unige.ch
Xuucp:  ...!mcsun!cui!vp
X
END_OF_FILE
if test 2499 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'LICENSE' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'LICENSE'\"
else
echo shar: Extracting \"'LICENSE'\" \(12488 characters\)
sed "s/^X//" >'LICENSE' <<'END_OF_FILE'
X
X		    GNU GENERAL PUBLIC LICENSE
X		     Version 1, February 1989
X
X Copyright (C) 1989 Free Software Foundation, Inc.
X                    675 Mass Ave, Cambridge, MA 02139, USA
X Everyone is permitted to copy and distribute verbatim copies
X of this license document, but changing it is not allowed.
X
X			    Preamble
X
X  The license agreements of most software companies try to keep users
Xat the mercy of those companies.  By contrast, our General Public
XLicense is intended to guarantee your freedom to share and change free
Xsoftware--to make sure the software is free for all its users.  The
XGeneral Public License applies to the Free Software Foundation's
Xsoftware and to any other program whose authors commit to using it.
XYou can use it for your programs, too.
X
X  When we speak of free software, we are referring to freedom, not
Xprice.  Specifically, the General Public License is designed to make
Xsure that you have the freedom to give away or sell copies of free
Xsoftware, that you receive source code or can get it if you want it,
Xthat you can change the software or use pieces of it in new free
Xprograms; and that you know you can do these things.
X
X  To protect your rights, we need to make restrictions that forbid
Xanyone to deny you these rights or to ask you to surrender the rights.
XThese restrictions translate to certain responsibilities for you if you
Xdistribute copies of the software, or if you modify it.
X
X  For example, if you distribute copies of a such a program, whether
Xgratis or for a fee, you must give the recipients all the rights that
Xyou have.  You must make sure that they, too, receive or can get the
Xsource code.  And you must tell them their rights.
X
X  We protect your rights with two steps: (1) copyright the software, and
X(2) offer you this license which gives you legal permission to copy,
Xdistribute and/or modify the software.
X
X  Also, for each author's protection and ours, we want to make certain
Xthat everyone understands that there is no warranty for this free
Xsoftware.  If the software is modified by someone else and passed on, we
Xwant its recipients to know that what they have is not the original, so
Xthat any problems introduced by others will not reflect on the original
Xauthors' reputations.
X
X  The precise terms and conditions for copying, distribution and
Xmodification follow.
X
X		    GNU GENERAL PUBLIC LICENSE
X   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
X
X  0. This License Agreement applies to any program or other work which
Xcontains a notice placed by the copyright holder saying it may be
Xdistributed under the terms of this General Public License.  The
X"Program", below, refers to any such program or work, and a "work based
Xon the Program" means either the Program or any work containing the
XProgram or a portion of it, either verbatim or with modifications.  Each
Xlicensee is addressed as "you".
X
X  1. You may copy and distribute verbatim copies of the Program's source
Xcode as you receive it, in any medium, provided that you conspicuously and
Xappropriately publish on each copy an appropriate copyright notice and
Xdisclaimer of warranty; keep intact all the notices that refer to this
XGeneral Public License and to the absence of any warranty; and give any
Xother recipients of the Program a copy of this General Public License
Xalong with the Program.  You may charge a fee for the physical act of
Xtransferring a copy.
X
X  2. You may modify your copy or copies of the Program or any portion of
Xit, and copy and distribute such modifications under the terms of Paragraph
X1 above, provided that you also do the following:
X
X    a) cause the modified files to carry prominent notices stating that
X    you changed the files and the date of any change; and
X
X    b) cause the whole of any work that you distribute or publish, that
X    in whole or in part contains the Program or any part thereof, either
X    with or without modifications, to be licensed at no charge to all
X    third parties under the terms of this General Public License (except
X    that you may choose to grant warranty protection to some or all
X    third parties, at your option).
X
X    c) If the modified program normally reads commands interactively when
X    run, you must cause it, when started running for such interactive use
X    in the simplest and most usual way, to print or display an
X    announcement including an appropriate copyright notice and a notice
X    that there is no warranty (or else, saying that you provide a
X    warranty) and that users may redistribute the program under these
X    conditions, and telling the user how to view a copy of this General
X    Public License.
X
X    d) You may charge a fee for the physical act of transferring a
X    copy, and you may at your option offer warranty protection in
X    exchange for a fee.
X
XMere aggregation of another independent work with the Program (or its
Xderivative) on a volume of a storage or distribution medium does not bring
Xthe other work under the scope of these terms.
X
X  3. You may copy and distribute the Program (or a portion or derivative of
Xit, under Paragraph 2) in object code or executable form under the terms of
XParagraphs 1 and 2 above provided that you also do one of the following:
X
X    a) accompany it with the complete corresponding machine-readable
X    source code, which must be distributed under the terms of
X    Paragraphs 1 and 2 above; or,
X
X    b) accompany it with a written offer, valid for at least three
X    years, to give any third party free (except for a nominal charge
X    for the cost of distribution) a complete machine-readable copy of the
X    corresponding source code, to be distributed under the terms of
X    Paragraphs 1 and 2 above; or,
X
X    c) accompany it with the information you received as to where the
X    corresponding source code may be obtained.  (This alternative is
X    allowed only for noncommercial distribution and only if you
X    received the program in object code or executable form alone.)
X
XSource code for a work means the preferred form of the work for making
Xmodifications to it.  For an executable file, complete source code means
Xall the source code for all modules it contains; but, as a special
Xexception, it need not include source code for modules which are standard
Xlibraries that accompany the operating system on which the executable
Xfile runs, or for standard header files or definitions files that
Xaccompany that operating system.
X
X  4. You may not copy, modify, sublicense, distribute or transfer the
XProgram except as expressly provided under this General Public License.
XAny attempt otherwise to copy, modify, sublicense, distribute or transfer
Xthe Program is void, and will automatically terminate your rights to use
Xthe Program under this License.  However, parties who have received
Xcopies, or rights to use copies, from you under this General Public
XLicense will not have their licenses terminated so long as such parties
Xremain in full compliance.
X
X  5. By copying, distributing or modifying the Program (or any work based
Xon the Program) you indicate your acceptance of this license to do so,
Xand all its terms and conditions.
X
X  6. Each time you redistribute the Program (or any work based on the
XProgram), the recipient automatically receives a license from the original
Xlicensor to copy, distribute or modify the Program subject to these
Xterms and conditions.  You may not impose any further restrictions on the
Xrecipients' exercise of the rights granted herein.
X
X  7. The Free Software Foundation may publish revised and/or new versions
Xof the General Public License from time to time.  Such new versions will
Xbe similar in spirit to the present version, but may differ in detail to
Xaddress new problems or concerns.
X
XEach version is given a distinguishing version number.  If the Program
Xspecifies a version number of the license which applies to it and "any
Xlater version", you have the option of following the terms and conditions
Xeither of that version or of any later version published by the Free
XSoftware Foundation.  If the Program does not specify a version number of
Xthe license, you may choose any version ever published by the Free Software
XFoundation.
X
X  8. If you wish to incorporate parts of the Program into other free
Xprograms whose distribution conditions are different, write to the author
Xto ask for permission.  For software which is copyrighted by the Free
XSoftware Foundation, write to the Free Software Foundation; we sometimes
Xmake exceptions for this.  Our decision will be guided by the two goals
Xof preserving the free status of all derivatives of our free software and
Xof promoting the sharing and reuse of software generally.
X
X			    NO WARRANTY
X
X  9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
XFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
XOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
XPROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
XOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
XMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
XTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
XPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
XREPAIR OR CORRECTION.
X
X  10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
XWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
XREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
XINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
XOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
XTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
XYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
XPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
XPOSSIBILITY OF SUCH DAMAGES.
X
X		     END OF TERMS AND CONDITIONS
X
X	Appendix: How to Apply These Terms to Your New Programs
X
X  If you develop a new program, and you want it to be of the greatest
Xpossible use to humanity, the best way to achieve this is to make it
Xfree software which everyone can redistribute and change under these
Xterms.
X
X  To do so, attach the following notices to the program.  It is safest to
Xattach them to the start of each source file to most effectively convey
Xthe exclusion of warranty; and each file should have at least the
X"copyright" line and a pointer to where the full notice is found.
X
X    <one line to give the program's name and a brief idea of what it does.>
X    Copyright (C) 19yy  <name of author>
X
X    This program is free software; you can redistribute it and/or modify
X    it under the terms of the GNU General Public License as published by
X    the Free Software Foundation; either version 1, or (at your option)
X    any later version.
X
X    This program is distributed in the hope that it will be useful,
X    but WITHOUT ANY WARRANTY; without even the implied warranty of
X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X    GNU General Public License for more details.
X
X    You should have received a copy of the GNU General Public License
X    along with this program; if not, write to the Free Software
X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X
XAlso add information on how to contact you by electronic and paper mail.
X
XIf the program is interactive, make it output a short notice like this
Xwhen it starts in an interactive mode:
X
X    Gnomovision version 69, Copyright (C) 19xx name of author
X    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
X    This is free software, and you are welcome to redistribute it
X    under certain conditions; type `show c' for details.
X
XThe hypothetical commands `show w' and `show c' should show the
Xappropriate parts of the General Public License.  Of course, the
Xcommands you use may be called something other than `show w' and `show
Xc'; they could even be mouse-clicks or menu items--whatever suits your
Xprogram.
X
XYou should also get your employer (if you work as a programmer) or your
Xschool, if any, to sign a "copyright disclaimer" for the program, if
Xnecessary.  Here a sample; alter the names:
X
X  Yoyodyne, Inc., hereby disclaims all copyright interest in the
X  program `Gnomovision' (a program to direct compilers to make passes
X  at assemblers) written by James Hacker.
X
X  <signature of Ty Coon>, 1 April 1989
X  Ty Coon, President of Vice
X
XThat's all there is to it!
END_OF_FILE
if test 12488 -ne `wc -c <'LICENSE'`; then
    echo shar: \"'LICENSE'\" unpacked with wrong size!
fi
# end of 'LICENSE'
fi
if test -f 'bm.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'bm.c'\"
else
echo shar: Extracting \"'bm.c'\" \(2507 characters\)
sed "s/^X//" >'bm.c' <<'END_OF_FILE'
X/*
X *  bm.c -- byte tranfer routine, used by the lcat program
X *  Copyright (C) 1990 Vassilis Prevelakis
X *
X *  This program is free software; you can redistribute it and/or modify
X *  it under the terms of the GNU General Public License as published by
X *  the Free Software Foundation and included with this distribution in the
X *  file named LICENSE.
X *
X *  This program is distributed in the hope that it will be useful,
X *  but WITHOUT ANY WARRANTY; without even the implied warranty of
X *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X *  GNU General Public License for more details.
X *
X *  You should have received a copy of the GNU General Public License
X *  along with this program; if not, write to the Free Software
X *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X *
X *  Bugs fixes, comments etc. to:
X *       Vasilis Prevelakis
X *       Centre Universitaire d'Informatique (CUI)
X *       12 Rue du Lac, Geneva, Switzerland CH-1207
X *  email: vp@cui.unige.ch
X *  uucp:  ...!mcsun!cui!vp
X */
X
X#ifndef UNIX
X#pragma inline
X#endif
X#define LCAT
X#include "lcat.h"
X
Xu_char raster[NLINES][RASTWIDTH];
X
X/*
X * bit_move -- move a number of bytes aligned on a byte boundary
X * to a destination that is defined by a byte address plus
X * a bit offset.
X *
X * Note that we are ORing source with destination because the character
X * cells may have a partial overlap (called overhang in tp jargon).
X *
X * Also the #%$#% CAT is printing in both directions so we cannot
X * sure whether the previous character is to our left or to our right.
X *
X * Anyway we can be sure that when we start a new line the raster
X * is cleared to zeros (the printing routine clears the raster
X * as its sending the bytes to the printer.
X */
Xbit_move(dst_addr, bit, src_addr, nbytes)
X
Xu_char huge* dst_addr, huge* src_addr;
Xint bit, nbytes;
X{
X	u_char a, b;
X	int i;
X
X	if (bit == 0)
X	{
X		for(i = 0; i < nbytes; i++)
X			*dst_addr++ |= *src_addr++;
X		/*	memcpy(dst_addr, src_addr, nbytes);	*/
X		return;
X	}
X	bit = 8-bit;
X	/*	*dst_addr &= (0xff << bit);	*/
X	for (i = 0; i < nbytes; i++)
X	{
X#ifdef USE_C
X	/*
X	 * this is the C version of the assembly code below.
X	 * note that I haven't tested this!
X	 */
X	register unsigned short a;
X
X	a = (*src_addr++) << bit;
X	*dst_addr++ |= ((a>>8) & 0xff);
X	*dst_addr |= (a & 0xff);
X#else
X		b = *dst_addr;
X		a = *src_addr++;
X		_BH = b;
X		_AL = a;
X		_AH = 0;
X		_CL = bit;
X		asm shl ax, cl;
X		asm or	ah, bh;
X		a = _AH;
X		b = _AL;
X		*dst_addr++ = a;
X		*dst_addr |= b;
X#endif
X	}
X}
END_OF_FILE
if test 2507 -ne `wc -c <'bm.c'`; then
    echo shar: \"'bm.c'\" unpacked with wrong size!
fi
# end of 'bm.c'
fi
if test -f 'djinfo.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'djinfo.1'\"
else
echo shar: Extracting \"'djinfo.1'\" \(1595 characters\)
sed "s/^X//" >'djinfo.1' <<'END_OF_FILE'
X.TH DJINFO L "28 August 1990"
X.SH NAME
Xdjinfo \- displays fields from the header of a DeskJet soft font
X.SH SYNOPSIS
X.B lcat
X.BI [ " \-f fontname " ]
X.BI [ " \-l " ]
X.BI [ " \-O output " ]
X.BI [ " file " ]
X
X.SH DESCRIPTION
X.B lcat
Xconverts
X.IR file ,
Xor its standard input, to a format suitable for downloading to
Xa Hewlett-Packard DeskJet.
XThe program offers two output qualities: normal and draft.
XBy default the program selects the normal quality (300 dpi),
Xwhile the 
X.B \-l
Xflag selects the low quality mode (150 dpi).
X.LP
XThe program is designed to be used as a filter, but under \s-2MSDOS\s0
Xthis cannot be done (pipes are considered text streams and there is no way to
Xsuppress output processing; so tabs are converted to spaces etc.).
XFor this reason the
X.B \-O
Xflag is provided to specify an output file.
X.LP
XThe program uses a graphics compression algorithm unique to the DeskJet
Xfamily, so it cannot be used with the LaserJet series (but by specifying
Xthe -\s-2DLASERJET\s0 compile-time option it can be made to produce uncompressed
Xoutput that can be used on both printers).
X.LP
XIf you use the default fonts (times) be sure to supply troff with
Xthe correct font width tables (see
X.BR vwidth (1)).
X.SH EXAMPLES
X.LP
Xtroff -t -man /usr/man/man1/ls.1v | lcat -l
X.SH "SEE ALSO"
X.BR vcat (l)
X.SH BUGS
X.LP
XVery slow in the normal mode, while the draft mode 
Xhas very poor quality.
X.LP
XDue to differences between the DeskJet resolution and the vfont resolution
X(DeskJet is 150 and 300 dpi, while the vfonts are 200 dpi), the program
Xconverts the requested pointsize to a more suitable one.
END_OF_FILE
if test 1595 -ne `wc -c <'djinfo.1'`; then
    echo shar: \"'djinfo.1'\" unpacked with wrong size!
fi
chmod +x 'djinfo.1'
# end of 'djinfo.1'
fi
if test -f 'djinfo.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'djinfo.c'\"
else
echo shar: Extracting \"'djinfo.c'\" \(5426 characters\)
sed "s/^X//" >'djinfo.c' <<'END_OF_FILE'
X/*
X *  djinfo.c -- prints information contained in an HP DeskJet soft font file.
X *  Copyright (C) 1990 Vassilis Prevelakis
X *
X *  This program is free software; you can redistribute it and/or modify
X *  it under the terms of the GNU General Public License as published by
X *  the Free Software Foundation and included with this distribution in the
X *  file named LICENSE.
X *
X *  This program is distributed in the hope that it will be useful,
X *  but WITHOUT ANY WARRANTY; without even the implied warranty of
X *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X *  GNU General Public License for more details.
X *
X *  You should have received a copy of the GNU General Public License
X *  along with this program; if not, write to the Free Software
X *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X *
X *  Bugs fixes, comments etc. to:
X *       Vasilis Prevelakis
X *       Centre Universitaire d'Informatique (CUI)
X *       12 Rue du Lac, Geneva, Switzerland CH-1207
X *  email: vp@cui.unige.ch
X *  uucp:  ...!mcsun!cui!vp
X */
X
X#include <stdio.h>
X
Xtypedef unsigned char u_char;
Xtypedef unsigned short u_short;
X
XFILE* fd;
X
Xstruct fdb {
X	u_short	size;		/* always 72 */
X	u_char	format;		/* DeskJet only: header format (5 or 9) */
X	u_char	ftype;		/* zero for 7-bit font */
X	short	xxx1;		/* RESERVED, must be zero */
X	u_short	baseline;	/* in dots */
X	u_short cell_width;	/* in dots */
X	u_short cell_height;	/* in dots */
X	u_char orientation;	/* 0 portrait, 1 landscape */
X	u_char spacing;		/* 0 fixed, 1 proportional */
X	u_short symbol;
X	u_short pitch;		/* in quarter dots */
X	u_short height;		/* in quarter dots */
X	u_short xHeight;	/* in quarter dots -- IGNORED */
X	u_char w_type;		/* IGNORED, == 0 */
X	u_char style;
X	char str_weight;
X	u_char typeface;
X	u_char	slant;		/* DeskJet only */
X	u_char s_style;
X	u_char quality;		/* DeskJet only */
X	u_char placement;	/* DeskJet only */
X	char ud_dst;
X	u_char ud_height;	/* IGNORED, == 3 */
X	u_short	t_height;	/* IGNORED, == 0 */
X	u_short t_width;	/* IGNORED, == 0 */
X	u_short firstcode;	/* DeskJet only */
X	u_short lastcode; 	/* DeskJet only */
X	u_char ext_pitch;	/* IGNORED by DeskJet == 0 */
X	u_char ext_height;	/* IGNORED by DeskJet == 0 */
X	short xxx5[3];		/* RESERVED, must be zero */
X#define MAXNAME 16
X	char fname[MAXNAME];
X	/* following fields DeskJet only */
X	u_short hres;		/* horizontal resolution == 600 */
X	u_short vres;		/* vertical resolution == 300 */
X	char ud2_dst;
X	u_char ud2_height;
X	char bud_dst;
X	u_char bud_height;
X	u_short psbs;		/* number of subsequent bytes == 20 */
X	u_short font_size;
X	char oneway;
X	char compressed;
X	u_char holdtime;
X	char nohalfpitch;
X	char nodoublepitch;
X	char nohalfheight;
X	char nobold;
X	char nodraft;
X	char boldmethod;
X	char xxx7;		/* RESERVED, must be zero */
X	u_short baseoff2;
X/* following fields used by DeskJet PLUS **ONLY** */
X	u_short baseoff3;
X	u_short baseoff4;
X} myfdb;
X
Xvoid loc_char(cc)
Xchar cc;
X{
X	int c;
X
X	while ((c = getc(fd)) != cc)
X		if (c < 0)
X			exit(0);
X}
X	
Xmain(argc, argv)
Xint argc;
Xchar **argv;
X{
X	int c;
X	int i;
X	struct fdb myfdb;
X	u_char *vp;
X
X	if (argc != 2)
X	{
X		printf("usage: xx filename\n");
X		exit(1);
X	}
X
X	if ((fd = fopen(argv[1], "rb")) == NULL)
X	{
X		printf("Couldn't open %s.\n", argv[1]);
X		exit(1);
X	}
X	do {
X		do {
X			loc_char(0x1b);
X		} while (getc(fd) != ')');
X	} while (getc(fd) != 's');
X	loc_char('W');
X	/* printf("now at %ld\n", ftell(fd)); */
X	fread(&myfdb, sizeof(struct fdb), 1, fd);
X
X#define vp_swab(X) ((((u_short)X & 0xff) << 8) | (((u_short)X & 0xff00) >> 8))
X	myfdb.size = vp_swab(myfdb.size);
X	myfdb.baseline = vp_swab(myfdb.baseline);
X	myfdb.cell_width = vp_swab(myfdb.cell_width);
X	myfdb.cell_height = vp_swab(myfdb.cell_height);
X	myfdb.symbol = vp_swab(myfdb.symbol);
X	myfdb.pitch = vp_swab(myfdb.pitch);
X	myfdb.height = vp_swab(myfdb.height);
X	myfdb.xHeight = vp_swab(myfdb.xHeight);
X	myfdb.t_height = vp_swab(myfdb.t_height);
X	myfdb.t_width = vp_swab(myfdb.t_width);
X	myfdb.firstcode = vp_swab(myfdb.firstcode);
X	myfdb.lastcode = vp_swab(myfdb.lastcode);
X	myfdb.hres = vp_swab(myfdb.hres);
X	myfdb.vres = vp_swab(myfdb.vres);
X	myfdb.psbs = vp_swab(myfdb.psbs);
X	myfdb.font_size = vp_swab(myfdb.font_size);
X	myfdb.baseoff2 = vp_swab(myfdb.baseoff2);
X	myfdb.baseoff3 = vp_swab(myfdb.baseoff3);
X	myfdb.baseoff4 = vp_swab(myfdb.baseoff4);
X	
X	myfdb.fname[MAXNAME-1] = '\0';
Xprintf("Font name: %s.\n", myfdb.fname);
Xprintf("size=%d, format=%d, ftype=%d, baseline=%d, width=%d, height=%d\n",
X	(int)myfdb.size, (int)myfdb.format, (int)myfdb.ftype,
X	(int)myfdb.baseline,
X	(int)myfdb.cell_width, (int)myfdb.cell_height);
X
Xprintf("orien=%d, spacing=%d, pitch=%d, height=%d, xHeight=%d, w_type=%d\n",
X	(int)myfdb.orientation, (int)myfdb.spacing, (int)myfdb.pitch,
X	(int)myfdb.height,
X	(int)myfdb.xHeight, (int)myfdb.w_type);
X
Xprintf("style=%d, str_weight=%d, typeface=%d, slant=%d, s_style=%d\n",
X	(int)myfdb.style, (int)myfdb.str_weight,(int)myfdb.typeface,
X	(int)myfdb.slant, (int)myfdb.s_style);
X
Xprintf("quality=%d, placement=%d, t_height=%d, t_width=%d, Fcode=%d, Lcode=%d\n",
X	(int)myfdb.quality, (int)myfdb.placement, (int)myfdb.t_height,
X	(int)myfdb.t_width,
X	(int)myfdb.firstcode, (int)myfdb.lastcode);
X
Xprintf("hres=%d, vres=%d, psbs=%d, size=%u\n",
X	(int)myfdb.hres, (int)myfdb.vres,
X	(int)myfdb.psbs, (unsigned int)myfdb.font_size);
X
Xprintf("baseoff2=%d, baseoff3=%d, baseoff4=%d\n",  
X	(int)myfdb.baseoff2, (int)myfdb.baseoff3, (int)myfdb.baseoff4);
X}
X	
X
END_OF_FILE
if test 5426 -ne `wc -c <'djinfo.c'`; then
    echo shar: \"'djinfo.c'\" unpacked with wrong size!
fi
# end of 'djinfo.c'
fi
if test -f 'fcache.bat' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fcache.bat'\"
else
echo shar: Extracting \"'fcache.bat'\" \(32 characters\)
sed "s/^X//" >'fcache.bat' <<'END_OF_FILE'
Xrm \usr\vfonts\djfonts\font.tbl
END_OF_FILE
if test 32 -ne `wc -c <'fcache.bat'`; then
    echo shar: \"'fcache.bat'\" unpacked with wrong size!
fi
# end of 'fcache.bat'
fi
if test -f 'ftbl.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'ftbl.c'\"
else
echo shar: Extracting \"'ftbl.c'\" \(2675 characters\)
sed "s/^X//" >'ftbl.c' <<'END_OF_FILE'
X/*
X *	ftbl -- font table management routines
X *  Copyright (C) 1990 Vassilis Prevelakis
X *
X *  This program is free software; you can redistribute it and/or modify
X *  it under the terms of the GNU General Public License as published by
X *  the Free Software Foundation and included with this distribution in the
X *  file named LICENSE.
X *
X *  This program is distributed in the hope that it will be useful,
X *  but WITHOUT ANY WARRANTY; without even the implied warranty of
X *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X *  GNU General Public License for more details.
X *
X *  You should have received a copy of the GNU General Public License
X *  along with this program; if not, write to the Free Software
X *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X *
X *  Bugs fixes, comments etc. to:
X *       Vasilis Prevelakis
X *       Centre Universitaire d'Informatique (CUI)
X *       12 Rue du Lac, Geneva, Switzerland CH-1207
X *  email: vp@cui.unige.ch
X *  uucp:  ...!mcsun!cui!vp
X */
X
X#include <stdio.h>
X
X#define FT_SIZE 16
X
Xstatic FILE* fd;
X
Xstatic struct ft_ent {
X	short fid;
X	char name[256];
X} ft_tbl[FT_SIZE];
Xstatic char fname[256];
Xstatic int nextent;
X
Xft_init(fontdir)
Xchar* fontdir;
X{
X	char buf[256];
X	int c, i, ent;
X	char *vp;
X	int fid;
X
X	/* initialize table */
X	for (ent=0; ent<FT_SIZE; ent++)
X		ft_tbl[ent].fid = -1;
X	nextent = 0;
X		
X	sprintf(fname, "%s/font.tbl", fontdir);
X	if ((fd = fopen(fname, "rt")) == NULL)
X	{
X		fprintf(stderr,
X			"Couldn't open cache file: %s, ignored\n", fname);
X		return;
X	}
X
X	/* load table */
X	for (ent=0; ent<FT_SIZE; ent++)
X	{
X		if (fscanf(fd, "%d: %s", &fid, buf) != 2)
X			break;
X		ft_tbl[ent].fid = fid;
X		strcpy(ft_tbl[ent].name, buf);
X	}
X	fclose(fd);
X}
X
Xshort ft_getnextent()
X{
X	return(ft_tbl[nextent++].fid);
X}
X
Xchar* ft_getname(fid)
Xshort fid;
X{
X	int i;
X
X	for (i=0; i < FT_SIZE; i++)
X		if (ft_tbl[i].fid == fid)
X			return(ft_tbl[i].name);
X	return(NULL);
X}
X
Xint ft_isthere(fid)
Xshort fid;
X{
X	int i;
X
X	for (i=0; i < FT_SIZE; i++)
X		if (ft_tbl[i].fid == fid)
X			return(1);
X	return(0);
X}
X
Xft_delent(fid)
Xshort fid;
X{
X	int i;
X
X	for (i=0; i < FT_SIZE; i++)
X		if (ft_tbl[i].fid == fid)
X			ft_tbl[i].fid = -1;
X}
X
Xint ft_addent(fid, s)
Xshort fid;
Xchar* s;
X{
X	int i;
X
X	for (i=0; i < FT_SIZE; i++)
X		if (ft_tbl[i].fid < 0)
X		{
X			ft_tbl[i].fid = fid;
X			strcpy(ft_tbl[i].name, s);
X			return(i);
X		}
X	return(0);
X}
X
Xft_close()
X{
X	int i;
X
X	unlink(fname);
X	if ((fd = fopen(fname, "wt")) == NULL)
X	{
X		fprintf(stderr, "Couldn't open font cache file: %s\n", fname);
X		exit(1);
X	}
X	
X	for (i=0; i < FT_SIZE; i++)
X		if (ft_tbl[i].fid > 0)
X			fprintf(fd, "%d: %s\n", ft_tbl[i].fid, ft_tbl[i].name);
X	fclose(fd);
X}
X
X
END_OF_FILE
if test 2675 -ne `wc -c <'ftbl.c'`; then
    echo shar: \"'ftbl.c'\" unpacked with wrong size!
fi
# end of 'ftbl.c'
fi
if test -f 'lcat.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'lcat.h'\"
else
echo shar: Extracting \"'lcat.h'\" \(5278 characters\)
sed "s/^X//" >'lcat.h' <<'END_OF_FILE'
X/*
X *  lcat.h -- common definitions for the [lv]cat programs
X *  Copyright (C) 1990 Vassilis Prevelakis
X *
X *  This program is free software; you can redistribute it and/or modify
X *  it under the terms of the GNU General Public License as published by
X *  the Free Software Foundation and included with this distribution in the
X *  file named LICENSE.
X *
X *  This program is distributed in the hope that it will be useful,
X *  but WITHOUT ANY WARRANTY; without even the implied warranty of
X *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X *  GNU General Public License for more details.
X *
X *  You should have received a copy of the GNU General Public License
X *  along with this program; if not, write to the Free Software
X *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
X *
X *  Bugs fixes, comments etc. to:
X *       Vasilis Prevelakis
X *       Centre Universitaire d'Informatique (CUI)
X *       12 Rue du Lac, Geneva, Switzerland CH-1207
X *  email: vp@cui.unige.ch
X *  uucp:  ...!mcsun!cui!vp
X */
X
Xtypedef unsigned char u_char;
X
X#define BASELINE 	150
X#define RASTWIDTH	400
X#define NLINES		200
X#ifdef LCAT
Xextern u_char raster[NLINES][RASTWIDTH];
X#endif
X
X#define MIN(X, Y)	((X < Y) ? X : Y)
X#define MAX(X, Y)	((X > Y) ? X : Y)
X
X#ifdef UNIX
X#define huge /**/
X#define O_BINARY 0
Xchar *calloc();
X#endif
X
Xstatic char	asctab[128] = {
X/*	'\0',	/*blank*/
X	'h',	/*h*/
X	't',	/*t*/
X	'n',	/*n*/
X	'm',	/*m*/
X	'l',	/*l*/
X	'i',	/*i*/
X	'z',	/*z*/
X	's',	/*s*/
X	'd',	/*d*/
X	'b',	/*b*/
X	'x',	/*x*/
X	'f',	/*f*/
X	'j',	/*j*/
X	'u',	/*u*/
X	'k',	/*k*/
X	'\0',	/*blank*/
X	'p',	/*p*/
X	'\06',	/*_ 3/4 em dash*/
X	';',	/*;*/
X	'\0',	/*blank*/
X	'a',	/*a*/
X	'\05',	/*rule*/
X	'c',	/*c*/
X	'`',	/*` open*/
X	'e',	/*e*/
X	'\'',	/*' close*/
X	'o',	/*o*/
X	'\021',	/*1/4*/
X	'r',	/*r*/
X	'\022',	/*1/2*/
X	'v',	/*v*/
X	'-',	/*- hyphen*/
X	'w',	/*w*/
X	'q',	/*q*/
X	'/',	/*/*/
X	'.',	/*.*/
X	'g',	/*g*/
X	'\023',	/*3/4*/
X	',',	/*,*/
X	'&',	/*&*/
X	'y',	/*y*/
X	'\0',	/*blank*/
X	'%',	/*%*/
X	'\0',	/*blank*/
X	'Q',	/*Q*/
X	'T',	/*T*/
X	'O',	/*O*/
X	'H',	/*H*/
X	'N',	/*N*/
X	'M',	/*M*/
X	'L',	/*L*/
X	'R',	/*R*/
X	'G',	/*G*/
X	'I',	/*I*/
X	'P',	/*P*/
X	'C',	/*C*/
X	'V',	/*V*/
X	'E',	/*E*/
X	'Z',	/*Z*/
X	'D',	/*D*/
X	'B',	/*B*/
X	'S',	/*S*/
X	'Y',	/*Y*/
X/*	'\0',	/*blank*/
X	'F',	/*F*/
X	'X',	/*X*/
X	'A',	/*A*/
X	'W',	/*W*/
X	'J',	/*J*/
X	'U',	/*U*/
X	'K',	/*K*/
X	'0',	/*0*/
X	'1',	/*1*/
X	'2',	/*2*/
X	'3',	/*3*/
X	'4',	/*4*/
X	'5',	/*5*/
X	'6',	/*6*/
X	'7',	/*7*/
X	'8',	/*8*/
X	'9',	/*9*/
X	'*',	/***/
X	'\04',	/*minus*/
X	'\01',	/*fi*/
X	'\02',	/*fl*/
X	'\03',	/*ff*/
X	'\020',	/* cent sign */
X	'\012',	/*ffl*/
X	'\011',	/*ffi*/
X	'(',	/*(*/
X	')',	/*)*/
X	'[',	/*[*/
X	']',	/*]*/
X	'\013',	/* degree */
X	'\014',	/* dagger */
X	'=',	/*=*/
X	'\017',	/* registered */
X	':',	/*:*/
X	'+',	/*+*/
X	'\0',	/*blank*/
X	'!',	/*!*/
X	'\07',	/* bullet */
X	'?',	/*?*/
X	'\015',	/*foot mark*/
X	'|',	/*|*/
X	'\0',	/*blank*/
X	'\016',	/* copyright */
X	'\010',	/* square */
X	'$',	/*$*/
X	'\0',
X	'\0',
X	'"',	/*"*/
X	'#',	/*#*/
X	'<',	/*<*/
X	'>',	/*>*/
X	'@',	/*@*/
X	'\\',	/*\\*/
X	'^',	/*^*/
X	'{',	/*{*/
X	'}',	/*}*/
X	'~'	/*~*/
X};
X
Xstatic char spectab[128] = {
X/*	'\0',	/*blank*/
X	'w',	/*psi*/
X	'h',	/*theta*/
X	'm',	/*nu*/
X	'l',	/*mu*/
X	'k',	/*lambda*/
X	'i',	/*iota*/
X	'f',	/*zeta*/
X	'r',	/*sigma*/
X	'd',	/*delta*/
X	'b',	/*beta*/
X	'n',	/*xi*/
X	'g',	/*eta*/
X	'u',	/*phi*/
X	't',	/*upsilon*/
X	'j',	/*kappa*/
X	'\0',	/*blank*/
X	'p',	/*pi*/
X	'@',	/*at-sign*/
X	'7',	/*down arrow*/
X	'\0',	/*blank*/
X	'a',	/*alpha*/
X	'|',	/*or*/
X	'v',	/*chi*/
X	'"',	/*"*/
X	'e',	/*epsilon*/
X	'=',	/*=*/
X	'o',	/*omicron*/
X	'4',	/*left arrow*/
X	'q',	/*rho*/
X	'6',	/*up arrow*/
X	's',	/*tau*/
X	'_',	/*underrule*/
X	'\\',	/*\*/
X	'W',	/*Psi*/
X	'\07',	/*bell system sign*/
X	'\001',	/*infinity*/
X	'c',	/*gamma*/
X	'\002',	/*improper superset*/
X	'\003',	/*proportional to*/
X	'\004',	/*right hand*/
X	'x',	/*omega*/
X	'\0',	/*blank*/
X	'(',	/*gradient*/
X	'\0',	/*blank*/
X	'U',	/*Phi*/
X	'H',	/*Theta*/
X	'X',	/*Omega*/
X	'\005',	/*cup (union)*/
X	'\006',	/*root en*/
X	'\014',	/*terminal sigma*/
X	'K',	/*Lambda*/
X	'-',	/*minus*/
X	'C',	/*Gamma*/
X	'\015',	/*integral sign*/
X	'P',	/*Pi*/
X	'\032',	/*subset of*/
X	'\033',	/*superset of*/
X	'2',	/*approximates*/
X	'y',	/*partial derivative*/
X	'D',	/*Delta*/
X	'\013',	/*square root*/
X	'R',	/*Sigma*/
X	'1',	/*approx =*/
X/*	'\0',	/*blank*/
X	'>',	/*>*/
X	'N',	/*Xi*/
X	'<',	/*<*/
X	'\016',	/*slash (longer)*/
X	'\034',	/*cap (intersection)*/
X	'T',	/*Upsilon*/
X	'\035',	/*not*/
X	'\023',	/*right ceiling (rt of ")*/
X	'\024',	/*left top (of big curly)*/
X	'\017',	/*bold vertical*/
X	'\030',	/*left center of big curly bracket*/
X	'\025',	/*left bottom*/
X	'\026',	/*right top*/
X	'\031',	/*right center of big curly bracket*/
X	'\027',	/*right bot*/
X	'\021',	/*right floor (rb of ")*/
X	'\020',	/*left floor (left bot of big sq bract)*/
X	'\022',	/*left ceiling (lt of ")*/
X	'*',	/*multiply*/
X	'/',	/*divide*/
X	'\010',	/*plus-minus*/
X	'\011',	/*<=*/
X	'\012',	/*>=*/
X	'0',	/*identically equal*/
X	'3',	/*not equal*/
X	'{',	/*{*/
X	'}',	/*}*/
X	'\'',	/*' acute accent*/
X	'\`',	/*` grave accent*/
X	'^',	/*^*/
X	'#',	/*sharp*/
X	'\036',	/*left hand*/
X	'\037',	/*member of*/
X	'~',	/*~*/
X	'z',	/*empty set*/
X	'\0',	/*blank*/
X	'Y',	/*dbl dagger*/
X	'Z',	/*box rule*/
X	'9',	/*asterisk*/
X	'[',	/*improper subset*/
X	']',	/*circle*/
X	'\0',	/*blank*/
X	'+',	/*eqn plus*/
X	'5',	/*right arrow*/
X	'8'	/*section mark*/
X};
END_OF_FILE
if test 5278 -ne `wc -c <'lcat.h'`; then
    echo shar: \"'lcat.h'\" unpacked with wrong size!
fi
# end of 'lcat.h'
fi
echo shar: End of archive 1 \(of 3\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 3 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0