home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume13
/
lj2ps
/
part01
/
README
< prev
Wrap
Text File
|
1990-07-02
|
10KB
|
232 lines
lj2ps
A LaserJet PCL to PostScript Translator
Version 1.1 (release)
Christopher Lishka
Wisconsin State Laboratory of Hygiene
Data Processing Department
June 30th, 1990
Contents:
1. Introduction
2. This Distribution, and How To Create lj2ps
3. Implementation Notes
4. Miscellaneous (Things I Have To Get Off My Chest)
5. Contacting Me
1. Introduction
The lj2ps program translates HP LaserJet PCL ("Page Control Language")
to PostScript. Currently it converts a subset of the LaserJet Series
II language (PCL 4) to device-independent PostScript.
lj2ps was originally written to allow my organization to "upgrade" our
LaserJets to LaserWriters, yet still have a way to print PCL files.
Due to a lack of time, not all of PCL is emulated (this is discussed
below). I am releasing this program to the "real world" at the
suggestion of by boss and coworkers, and with the hope that others
will also find this program useful and may even extend its
capabilities.
2. This Distribution, and How To Create lj2ps
Included in this distribution are all of the source files for lj2ps,
documentation, a test suite, and a metrics suite.
All source files are included in the top level directory, along with
the Makefile and README file. To create lj2ps, simply type "make".
To clean the directory, type "make clean". Pretty simple, huh? ;-)
There are probably other options in the Makefile, but since I
regularly use "cake" (instead of make), and since I generated it with
mkmf (automatic Makefile creator), I am not sure what they are. Feel
free to edit it. Those who are interested in the Cakefile, please
contact me.
The TestSuite directory contains many tests used to check the
compatibility of lj2ps with real LaserJets. Similarly, the
MetricsSuite directory is used to tune lj2ps to produce output which
looks like LaserJet output. These are discussed in more detail in the
implementation section below.
The documentation directory has several files in it. Here are
explanations of them:
BugFile Known bugs that affect lj2ps are detailed here. Each
entry identifies the date detected, revision affected,
and the person logging the bug (usually me!). The
LogFile describes which bugs have been fixed.
Copying This is the standard Free Software Foundation
copyleft. lj2ps is distributed according to these
restrictions. Please look through it so that you are
familiar with the conditions of use for lj2ps. The
only other thing that I ask is that you send me
changes (with descriptions) if you make them, so that
I can benefit from your work.
LogFile This file contains descriptions of each revision of
lj2ps. All changes including bug fixes, added
features, and removals are detailed here.
compile.options.doc
Options are available at compile-time to conditionally
include or exclude features when the program is
created. This file describes the options currently
available.
limitations.doc Any program worth its salt has certain limitations.
lj2ps is no exception. This file lists some that I
know about. Feel free to fix any (or all) of them.
lj2ps.l The man page for lj2ps, to be installed in
/usr/man/manl. Use the command "nroff -man lj2ps.l"
to create the documentation file.
measurements.doc
One of the worst aspects of LaserJets is the many
different measurements used by different commands,
This file lists all measurements that I know of.
parameter.scanner.idraw
A diagram of the parameter scanner. This file was
produced with the drawing program "idraw," and can be
printed on any PostScript printer.
scanner.doc
There are two distinct (yet related) scanners used in
lj2ps. Scanner.doc describes the conceptual design I
used in creating them, which is derived from standard
scanner and finite state automata theory taught in
college (where do you think I learned it from? ;-).
suggestions.doc This file lists aspects of lj2ps that need work. It
may also provide some insight as to how lj2ps was
designed. If you have some free time, and need some
suggestions on how to improve the program, then look
here.
supported.commands.doc
As detailed below, I did not have time to emulate all
PCL commands. This list shows which ones are (and
are not) supported.
text.scanner.idraw
A diagram of the text scanner. This file was produced
with the drawing program "idraw," and can be printed
on any PostScript printer.
3. Implementation Notes
The program is written completely in K&R C (although not ANSI), and
the C code should compile on nearly every standard machine out there.
To my knowledge, I have not used any "strange" C operators or
combinations, so this program should work on anything from a PC to a
super-computer.
I built the program with the idea of emulating full LJII PCL, so all
of the actual command syntax is parsed. However, I have only
implemented the commands which I needed. Left out are graphics,
macros, and soft font commands (among others). It should not be that
hard to add features to this program, and I have included variables
(some yet unused) for most (if not all) aspects of LaserJet operation.
Feel free to work on extending this program to emulate the unfinished
PCL commands, as well as fixing some of the inconsistencies that will
likely pop up. All I ask is that you send me any changes that you
make, so I can add the same features to my own version (my address is
listed at the end of this file.
I have designed lj2ps with efficiency in mind. To this end, I
hand-coded the scanner in C instead of generating it with Lex. I have
also spent some time profiling the execution. Although one major
bottleneck has been fixed, most of the program actually runs at a
reasonable rate. As would be expected, much of the execution time is
spent in the scanner and _doprnt. The scanner could likely be sped up
some more (a colleague suggests "caching" several variables in
registers), but I have left this for the future.
I have also designed the program with accuracy in mind. Included in
this distribution are two suites of files: one for testing, the other
for accurate reproduction. The test suite is an attempt at providing
test files which will exercise critical and nit-picky features of
LaserJet Series II printers. It is by no means complete. I have only
included tests for features that are needed at our organization, and I
have likely even left out some of these. I encourage you to add more
files to the test suite; if several people contribute, a nice
collection could be created. The metrics suite provides print samples
which highlight different measurements. For instance, you could test
inter-line spacing by printing the appropriate metrics file on a
LaserJet and a PostScript printer, and then tweak lj2ps to match the
LaserJet's output. This suite is also not complete, so feel free to
add more files.
4. Miscellaneous (Things I Have To Get Off My Chest)
It is unlikely that I will have any time at work to finish this
program. I will only support it locally for our own users. Although
it would be nice to work on this outside of my job, I have so many
other program (and non-program) ideas that I likely won't do much more
with lj2ps. Therefore it is up to you to build in the missing
functionality that you want.
Even though the major reason I wrote this was because our organization
needed it, a significant driving-force for me was a "proof of
concept." I always thought that PostScript was a much better language
than LaserJet PCL, and this program provided me with a way to prove
it. Even though this revision of lj2ps is limited, I am convinced
that one could fully emulate a LaserJet with a filter (like lj2ps) and
a PostScript printer. In fact, I bet it could be done with PostScript
alone, although it would be incredibly slow. However, one cannot
emulate a PostScript printer using PCL. Most (if not all) PostScript
to LaserJet emulators are programs (in software or hardware) which
send bitmaps to a LaserJet; PCL is pretty-much bypassed. This says a
lot about the two languages.
I have spent several years writing programs which use PCL on
LaserJets. I have just finished a translator that parses and emulates
PCL. With all this experience and time spent using PCL, all I can say
is that it leaves a really bad taste in my mouth. It is not user
friendly, not consistent, and not robust. Its syntax is lousy, its
commands are impossible to remember, and it inner workings are very
hard to figure out (believe me, I spent too much time doing this!).
Whoever is responsible for developing PCL ought to be taught a lesson.
I have much respect for many Hewlett Packard products (like the hp28s
and hp48sx calculators). However, the LaserJet's language is one of
HP's worst creations. Suffice it to say that the HP LaserJet is the
IBM PC of the laser-printer world.
5. Contacting Me
If you have any additions, fixes, or problems; need to know more about
the secret workings of the code; have suggestions for improving lj2ps;
or simply want to say hello, you can contact me at:
Internet: lishka@uwslh.slh.wisc.edu
UUCP: ...!uunet!uwvax!uwslh!lishka
Work phone: (608) 262-4485 (Tues.-Sat., 5am-9pm)
Address: Christopher Lishka
Data Processing Dept.
Wisconsin State Laboratory of Hygiene
465 Henry Mall
Madison, WI 53715
My only real request is that you send me any bug fixes, enhancements,
or other modifications that you have made. Please don't send source
trees without contacting me first. The best thing to send is a
context-diff (e.g. for "patch") from some released version.
If you like this program enough to donate some money, then I ask that
you give it to charity (for example: an environmental, peace, or
homeless organization). It will make both of us feel good, and it is
even tax-deductible.