pkg://hpgl2ps-2.2-1.src.rpm:131048/hpgl2ps-2.2.tar.gz
info downloads
hpgl2ps-2.2/Makefile 100644 0 0 14146 6546527545 12523 0 ustar root root # dxy2ps and hpgl2ps (Copyright) D McCormick
# Commercial reproduction prohibited.
#
# Obtained from UUCP Newsgroup comp.sources.unix
# Spring 1988
#
# Modified by Gordon Jacobs, July 1989
#
# Modified by Michael L. Brown, June, 1990
#
# Modified by Jeffrey A. Stern, Nov, 1994. Called v2.1.
#
# UNIX and DOS/DJGPP Makefile
# SETUP:
#
# 1) Check that you have the 'ar' and 'install' commands on your
# system, and that CC, INSTALLFLAGS, INSTALLMANFLAGS are set to your
# compiler/preferences.
CC= gcc
SHELL= /bin/sh
FILTER1= dxy2ps.in
FILTER2= hpgl2ps.in
FILTER1.C= dxy2ps.c
FILTER2.C= hpgl2ps.c
INSTALLFLAGS= -s -o root -g root -m 755
MANFILTER1= dxy2ps.1
MANFILTER2= hpgl2ps.1
INSTALLMANFLAGS=-o root -g root -m 644
TESTFILES= test1h.ps test2h.ps test3h.ps test1d.ps
# 3) Make sure this is where you want the man pages to go.
# This complies with the Linux FSSTND (File System Standard).
INSDIR= /usr/local/bin
INSMANDIR= /usr/local/man/man1
# 4) Find your system below and uncomment the lines. Default is
# Linux. So far, Sun, MIPS, Linux supported, but it 'shouldn't"
# be much to adapt these variables to your system.
#
# For the CFLAGS variable below:
#
# Add -DNOTIMP to list the non-implemented HPGL commands out to the stderr.
#
# Add -DDEBUG for listing the HPGL implemented commands and the PostScript
# output that goes with it.
#
# For Sun using GNU, activate the following lines, and deactivate the
# other machines'.
# LOADLIBES= -lieee -lm
# CFLAGS= -O -Wall -DNOTIMP -ansi -pedantic
# FILTER1A= dxy2ps
# FILTER2A= hpgl2ps
# ACONVERT1= cp $(FILTER1) $(FILTER1A); strip $(FILTER1A)
# ACONVERT2= cp $(FILTER2) $(FILTER2A); strip $(FILTER2A)
# For MIPS or Linux, activate the following lines, and deactivate the
# other machines'.
# I originally needed the -lieee flag for the libraries. I kept
# getting 'Floating Exception' when I ran hpgl2ps. This was reputedly
# caused by a bug in strtod or floatconv.c (which manifests as _IO_dtoa
# in gdb output). Apparently strtod will die after too many calls to
# itself, or something like that. Later, I found that with a lot of
# cleanup using 'gcc -Wall', and no dependence up math.h for rint, and
# a bunch of other stuff to get the programs into strict ANSI
# compliance and compile without error, the -lieee was not needed. A
# phantom, I guess. But one heck of an ugly one. :) Anyway, if you get
# the error mentioned above and you're compiling on linux, try adding
# the -lieee back into LOADLIBES. For reference, I have libc 4.5.26,
# and gcc 2.5.8. -jas.
CC= egcs
LOADLIBES= -lm
CFLAGS= -O -Wall -DNOTIMP
FILTER1A= dxy2ps
FILTER2A= hpgl2ps
ACONVERT1= cp $(FILTER1) $(FILTER1A); strip $(FILTER1A)
ACONVERT2= cp $(FILTER2) $(FILTER2A); strip $(FILTER2A)
# For MS-DOS using djgpp compiler, activate these lines and deactivate
# the other machines'. Leave SHELL= /bin/sh as it is above. The linker
# bombed when I had SHELL=c:\dos\command.com and I don't know what
# blanking it out entirely would do, either. Also note: There is no
# 'make install': Instead, just copy the *.exe's and *.man's where you want.
# The 32-bit djgpp compiler (source and bins) can be ftp'd from either
# omnigate.clarkson.edu or oak.oakland.edu. In both places it's found
# in the directory /pub/msdos/djgpp. Or, you can send email to the
# FSF (Free Software Foundation) at gnu@prep.ai.mit.edu for information
# on obtaining djgpp on CDROM.
# LOADLIBES= -lm
# CFLAGS= -O -Wall -DNOTIMP -ansi -pedantic
# FILTER1A= dxy2ps.exe
# FILTER2A= hpgl2ps.exe
# ACONVERT1= coff2exe $(FILTER1)
# ACONVERT2= coff2exe $(FILTER2)
# 5) You're done. Now just type 'make' and with any luck...
##############################################################################
# YOU SHOULDN'T HAVE TO EDIT BELOW HERE.
##############################################################################
# .c.o: $(INCLUDE)
# $(CC) $(CFLAGS) -c $< -o $@
all: $(FILTER1A) $(FILTER2A) $(TESTFILES)
$(FILTER1A): $(FILTER1)
$(ACONVERT1)
$(FILTER2A): $(FILTER2)
$(ACONVERT2)
$(FILTER1): $(FILTER1.C)
$(CC) $(CFLAGS) $< -o $@ $(LOADLIBES)
$(FILTER2): $(FILTER2.C)
$(CC) $(CFLAGS) $< -o $@ $(LOADLIBES)
test1d.ps: $(FILTER1A) test1d.dxy
$(FILTER1A) test1d.dxy > test1d.ps
test1h.ps: $(FILTER2A) test1h.hpg
$(FILTER2A) test1h.hpg > test1h.ps
test2h.ps: $(FILTER2A) test2h.hpg
$(FILTER2A) test2h.hpg > test2h.ps
test3h.ps: $(FILTER2A) test3h.hpg
$(FILTER2A) test3h.hpg > test3h.ps
install: install1 install2 installman
install1: $(FILTER1A)
install $(INSTALLFLAGS) $(FILTER1A) $(INSDIR)
install2: $(FILTER2A)
install $(INSTALLFLAGS) $(FILTER2A) $(INSDIR)
installman: $(MANFILTER1) $(MANFILTER2)
install $(INSTALLMANFLAGS) $(MANFILTER1) $(INSMANDIR)
install $(INSTALLMANFLAGS) $(MANFILTER2) $(INSMANDIR)
clean:
rm -f *~* *.o *.ps a.out core hpgl2ps dxy2ps *.in
uninstall:
rm -f $(INSDIR)/$(FILTER1A)
rm -f $(INSDIR)/$(FILTER2A)
rm -f $(INSMANDIR)/$(MANFILTER1)
rm -f $(INSMANDIR)/$(MANFILTER2)
# To be used on Unix to create manuals for dos users and ps printers
dosman: dosstuff/hpgl2ps.txt dosstuff/dxy2ps.txt dosstuff/hpgl2ps.ps dosstuff/dxy2ps.ps
dosstuff/hpgl2ps.txt: hpgl2ps.1
groff -Tascii -mandoc hpgl2ps.1 > dosstuff/hpgl2ps.txt
dosstuff/dxy2ps.txt: dxy2ps.1
groff -Tascii -mandoc dxy2ps.1 > dosstuff/dxy2ps.txt
dosstuff/hpgl2ps.ps: hpgl2ps.1
groff -Tps -mandoc hpgl2ps.1 > dosstuff/hpgl2ps.ps
dosstuff/dxy2ps.ps: dxy2ps.1
groff -Tps -mandoc dxy2ps.1 > dosstuff/dxy2ps.ps
arcps.obj: arcps.c
$(CC) -c $.
changesizes.obj: changesizes.c
$(CC) -c $.
circle.obj: circle.c
$(CC) -c $.
dxycom.obj: dxycom.c
$(CC) -c $.
end_draw.obj: end_draw.c
$(CC) -c $.
getval.obj: getval.c
$(CC) -c $.
hpglcom.obj: hpglcom.c
$(CC) -c $.
linesize.obj: linesize.c
$(CC) -c $.
linetype.obj: linetype.c
$(CC) -c $.
manualfeed.obj: manualfeed.c
$(CC) -c $.
plotdot.obj: plotdot.c
$(CC) -c $.
plotinit.obj: plotinit.c
$(CC) -c $.
plotps.obj: plotps.c
$(CC) -c $.
userdefchar.obj: userdefchar.c
$(CC) -c $.
ps_macros.obj: ps_macros.c
$(CC) -c $.
rectangle.obj: rectangle.c
$(CC) -c $.
textps.obj: textps.c
$(CC) -c $.
viewport.obj: viewport.c
$(CC) -c $.
plotcoords.obj: plotcoords.c
$(CC) -c $.
tick.obj: tick.c
$(CC) -c $.
hpgl2ps-2.2/README.DOS 100644 0 0 31604 5745537242 12360 0 ustar root root DOS INSTALLATION:
================
A) To install the executables:
1) Copy the two programs (HPGL2PS.EXE and DXY2PS.EXE) to a directory
in your PATH, so that they can be executed, no matter where you are
in the directory tree. For instance, if you have a directory called
C:\BIN where you keep utility programs like this, and C:\BIN is on
your path, and, supposing that this release of the converter programs
is on a disk in your A: drive, then just type:
COPY A:\DOSSTUFF\HPGL2PS.EXE C:\BIN
COPY A:\DOSSTUFF\DXY2PS.EXE C:\BIN
2) To Print out Documentation:
If you have a postscript printer, just send your PostScript-formatted
hpgl2ps or dxy2ps doc files to the printer. For example:
COPY A:\DOSSTUFF\HPGL2PS.PS PRN
Or if you have another kind of printer which just accepts plain
text:
COPY A:\DOSSTUFF\HPGL2PS.TXT PRN
B) If you want to actually recompile the program (in order to modify it):
1) If you are using djgpp compiler, then
a) Use the Unix (GNU) makefile:
cp makefile.unx makefile
b) Follow the directions in the makefile for djgpp.
c) Type 'make'. This should run without warnings or errors, even if
you've compiled with -Wall. Upon successful completion of the
executables, make will construct four test files (with suffix of
.ps) automatically. Compare these to their *.ps1 counterparts I
provide (via 'ls'/'dir' or 'cmp'/'fc' or actual printout): Check
that your *.ps files are reasonably close the the *.ps1 files. They
should be only slightly different, owing to decimal point rounding
variation. If you use MS-DOS, your file sizes will be even more
different, owing I believe to the carriage returns in the postscript
output. But they should still be in roughly the same ballpark.
2) If you are using Borland C/C++ 4.5, then
a) Use the borland makefile:
copy makefile.bor makefile
b) Follow the directions in the makefile for borland.
3) I've also included some pre-formatted manual pages in
text/backspace form (*.txt) and postscript (*.ps) for you, since
most dos users won't have t/n/groff to format the *.1 manual
pages. These are in the dosstuff subdirectory of this archive.
TO RUN (UNIX and DOS):
=====================
You can try out your converter programs by running them on the sample
test HPGL and DXY files. For instance, test1h.hpg is an hpgl
file. Convert it to Postscript and save it in a file called
test1.ps by running the program this way:
hpgl2ps test1h.hpg > test1h.ps
You can compare your test1h.ps with the postscript version I made,
'test1h.ps1'.
Now, if you have a Postscript printer, you can print out your
file by typing (in UNIX):
lpr test1h.ps
or, in DOS:
copy test1h.ps prn
Alternatively, if you want to save a step from the above two
commands, you can omit the step to make a file, and just pipe the
converter's output right into the printer, instead. In UNIX, you
would type:
hpgl2ps test1h.hpg | lpr
and in DOS:
hpgl2ps test1h.hpg > prn
NOTES:
=====
/* hpgl2ps.pckd - enhanced version */
/* hpgl2ps.ucb - Further enhanced version */
/* hpgl2ps.mlb - Enhanced even further */
/* hpgl2ps v2.1 - Cleaned up for warnings, bugs, ported to DOS. */
There are two filters in this package which are based on the Roland
plotter command set.
1. DXY: A simple command set which is used with all DXY plotters
2. RD-GL: This command set is a superset of the HP (Hewlet Packard)
graphics language.
Not all the commands of DXY or RD-GL (HPGL) are implemented (approx 95%
are) and those commands that are not are skipped and a warning given.
It is very easy to add to this filter if a particular unimplemented
command is desired.
If you wish to implement a command go to the relevant portion in the
command switch "dxycom.c" or "hpglcom.c" and call an appropriate user
written procedure. (You will need a good knowledge of writing
PostScript programs)
The filters use the the procedure "getopt" which is used to interpret
command line options and arguments and is normally available on 4.3 bsd
and Sys V Unix. For those sites running 4.1 or 4.2 it may be available
as a local library and must be written into the Makefile.
IF YOU DONT HAVE GETOPT YOU WILL HAVE REWRITE THE CODE THAT INTERPRETS
COMMAND LINE OPTIONS AND ARGUMENTS.
NOTE 1: The method of writing text is not fully compatible with HPGL
and will be changed at a later date.
NOTE 2: The PostScript macros are written into a C procedure to allow
each filter to be a single stand alone program. These macros can easily
be incorporated into other filter programs.
I have written some test procedures for the testing of each filter they
are "test1.hpgl" for hpgl2ps and "test1.dxy" for dxy2ps.
Don McCormick.
-------------------------
Notes on first enhancement:
Support for user defined characters added by
Gerald William Kokodyniak B.A.Sc. M.A.Sc.
University of Toronto, Department of Mechanical Engineering
-------------------------
Notes on second enhancement:
Support for Scaling, tickmarks, and better user defined characters
added by Gordon Jacobs, (Ph.D., since we're into titles above)
University of California, Berkeley in July 1989.
Mods were made ONLY for the hpgl2ps program and are not guaranteed
to work for dxy2ps. HP-GL code from the Tektronix DSA 602
Digitizing Signal Analyzer (scope) were used as a test.
Laserwriter output was compared directly with plots from a
HP7550A plotter reading the same HP-GL file.
Support for scaling was added.
The Scaling involves re-setting the coordinate
system by re-calculating the XSCALE and YSCALE numbers and adding
an offset to the origin. The offset had to be added to all files
that make use of the scaling parameters.
Tick marks were added with tick.c. Uses relative draw commands
to make the tick marks and adds two global variables which are
the tick length as a percentage of the overall dimensions.
The parser was changed. The SIGNED_NUMERIC macro recognized a comma
as a valid character which does not make sense. The HP-GL code from
the DSA 602 often contains a mnemonic followed by a comma, but with
no parameters. This is valid code although most sources will not
place a comma unless optional parameters actually follow. The comma
was removed as a valid SIGNED_NUMERIC character and the function
getval() was modified to read all trailing commas and spaces. In this way
the parser works for both the standard and odd case mentioned above.
The user defined character routine was modified heavily. Original
function did not take into account the angle of characters. The
new function reads the current angle of characters and orients
the user defined character in the same way. The scaling, which was
originally huge for some reason now is dynamically set to a
proportion of the size of regular text character. The linewidth
of the user defined character is arbitrarily set to 0.25mm and
then the restored to the previous value. This width seems to fit
the "linewidth" of the characters in the postscript helvetica
font sized for the DSA 602 output.
The default paper size is changed to be 8.5 x 11 inch paper with
command line options added to support all others.
The command line options -w and -h were added because the relative
scaling of fonts with the "SR" HP-GL command, while implemented
correctly, gives much smaller character sizes than the HP7550A plotter.
The defaults were set empirically to match plotter output.
The sizes in viewport.c were modified to get correct positioning
on the 8.5 x 11 paper when compared to a plot directly from the
HP7550A on the same type of paper.
The textps() routine was modified to move the position pointers to
the end of a string when a string is drawn. This was commented out
in the code that I received, but needed to be restored for the
user defined character to be in the correct place. The results
match the HP plotter for the same code.
----------------------
Notes on third enhancement:
All changes pertain to HPGL stuff only.
The removale of the comma in the SIGNED_NUMBER function was incorrect.
The problem was that some programs put out a comma after the PD command
and before the set of numbers. This problem was fixed when the parser
was enhanced. For some reason the change mentioned above in the previous
enhancement didn't work when the comma was followed by valid numbers.
The hpglcom.c parser was changed so that:
1. All of the known HPGL commands (1984 HP 7580 plotter manual) have
been added to the parser list, making it easier for someone to
implement a command.
2. All unknown commands had the data following that command, up until
the next command, dumped. This cleaned up the parser problem that
I was seeing.
3. Three new compilable options have been added:
DEBUG: When turned on, all PostScript output (after the macros)
is put out on stderr, along with the HPGL commands. This
allows the programmer to see the input HPGL commands and
the PostScript output. The new AA command also puts out
many of its computations.
NOTIMP: Output all HGPL commands that are unknown. If you don't
want this list, turn off this compiler option.
SYSV: Many AT&T System V Unix systems don't have rint(). This
option will use the very simple one that I included.
4. The HPGL Absolute Arc (AA) command has been implemented. The Arc
Relative (AR) one has not (yet). See the new routine arcps.c for
further comments on what was done.
The default line sizes have been changed. See the man page for the complete
list.
Notes on fourth enhancement (hpgl2ps v2.1):
==============================================================================
Basically, I did very little to this version, except some fine tuning to:
1) make printouts of unsupported calls with NOTIMP print out on
separate lines, for clearer output,
2) change some of the casts to prevent warnings on the stricter 2.5.8 gcc
compiler, and
3) Include the ieee library in the Makefile as an option, for those compilers
which might have the problem with the broken strtod (floatconv.c)
linux library call. It looks as if Sun may have the same problem?
4) remove the 'Not implemented: LB' error message. It looks as if hpgl2ps
does implement LB, but I can't get ahold of the previous enhancer to
check this.
5) enhance the Makefile a bit, including renaming the man pages from
*.man to *.1 for easier/clearer installation, adding man installation
and uninstall, and hinging hpgl2ps from libroland.a, as well as making
testfiles.
6) add a '-v' flag for version number. There are so many versions of this
package floating around that major/minor version numbers should help
someone who is doing an archie/ftp/WWW search to figure out which is the
latest.
7) Do general cleanup (insert #include's, extern's, reformat with function
declarations and new arguments, fix a labelling bug, etc.) so that
the code will compile with no warnings, even with '-Wall' compiler
flag on gcc, and so that the code is strictly ansi compatible.
Basically, I could not get hpgl2ps to reliably produce the same
printout on one machine as the other (Linux and Ultrix). It does
now (at least for me). Also, it doesn't print out spurious warnings
about things which haven't been implemented yet, which have.
8) I also removed the SYSV definition. That definition was around only
for SYSV people who needed to have rint() (normally from math.h)
defined for them. But theoretically, everyone should use the same
rint, AND since (as of this date, anyway) I can find no POSIX
definition for rint, AND our use here is pretty simple, AND I was
getting error messages about implicit declarations, AND our machine
returns a double, (instead of just an int, as expected here), AND it
has this wierd rule about returning an even number if
|rint(x)-x|=1/2, I just decided to rename this one 'local_rint' and
that way we all have the same thing.
9) Moved all the *.c hp modules (arcps.c plotdot.c, etc.) into one module
(hplib.c) for easier porting (primarily makefile problems with Borland).
Also, the labelling is still not yet completely stable/reliable. This is
why I put in the -w and -h command-line options, as well as -f option,
so that the user can 'tweek' their output, as desired.
Finally, thanks *very* much to Dan Saunders at the University of Idaho
for helping me after days of frustration by patiently explaining the
broken float conversion call. It's nice to know there are people
around who a)know what they're doing, and b)don't mind talking to
people who don't. :)
=====
Jeff Stern <jstern@eclectic.ss.uci.edu>
95/4/19
hpgl2ps-2.2/README.UNX 100644 0 0 26572 5745535244 12415 0 ustar root root UNIX INSTALLATION:
=================
1) cp makefile.unx Makefile
2) Follow the instructions in the Makefile for setting your variables
for your machine and setup.
3) Type 'make'. This should run without warnings or errors, even if
you've compiled with -Wall. Upon successful completion of the
executables, make will construct four test files (with suffix of
.ps) automatically. Compare these to their *.ps1 counterparts I
provide (via 'ls'/'dir' or 'cmp'/'fc' or actual printout): Check
that your *.ps files are reasonably close the the *.ps1 files. They
should be only slightly different, owing to decimal point rounding
variation. If you use MS-DOS, your file sizes will be even more
different, owing I believe to the carriage returns in the postscript
output. But they should still be in roughly the same ballpark.
4) If you want to install the 2 executables and the 2 man
pages somewhere else, then su to root (if you are going to install
them in some global system area, not just your own bin directory
under your home directory) and type 'make install'. You may want to
run 'makewhatis' (or whatever program your system uses) to update
your man pages.
TO RUN:
=====================
You can try out your converter programs by running them on the sample
test HPGL and DXY files. For instance, test1h.hpg is an hpgl
file. Convert it to Postscript and save it in a file called
test1.ps by running the program this way:
hpgl2ps test1h.hpg > test1h.ps
You can compare your test1h.ps with the postscript version I made,
'test1h.ps1'.
Now, if you have a Postscript printer, you can print out your
file by typing:
lpr test1h.ps
Alternatively, if you want to save a step from the above two
commands, you can omit the step to make a file, and just pipe the
converter's output right into the printer, instead. Type:
hpgl2ps test1h.hpg | lpr
NOTES:
=====
/* hpgl2ps.pckd - enhanced version */
/* hpgl2ps.ucb - Further enhanced version */
/* hpgl2ps.mlb - Enhanced even further */
/* hpgl2ps v2.1 - Cleaned up for warnings, bugs, ported to DOS. */
There are two filters in this package which are based on the Roland
plotter command set.
1. DXY: A simple command set which is used with all DXY plotters
2. RD-GL: This command set is a superset of the HP (Hewlet Packard)
graphics language.
Not all the commands of DXY or RD-GL (HPGL) are implemented (approx 95%
are) and those commands that are not are skipped and a warning given.
It is very easy to add to this filter if a particular unimplemented
command is desired.
If you wish to implement a command go to the relevant portion in the
command switch "dxycom.c" or "hpglcom.c" and call an appropriate user
written procedure. (You will need a good knowledge of writing
PostScript programs)
The filters use the the procedure "getopt" which is used to interpret
command line options and arguments and is normally available on 4.3 bsd
and Sys V Unix. For those sites running 4.1 or 4.2 it may be available
as a local library and must be written into the Makefile.
IF YOU DONT HAVE GETOPT YOU WILL HAVE REWRITE THE CODE THAT INTERPRETS
COMMAND LINE OPTIONS AND ARGUMENTS.
NOTE 1: The method of writing text is not fully compatible with HPGL
and will be changed at a later date.
NOTE 2: The PostScript macros are written into a C procedure to allow
each filter to be a single stand alone program. These macros can easily
be incorporated into other filter programs.
I have written some test procedures for the testing of each filter they
are "test1.hpgl" for hpgl2ps and "test1.dxy" for dxy2ps.
Don McCormick.
-------------------------
Notes on first enhancement:
Support for user defined characters added by
Gerald William Kokodyniak B.A.Sc. M.A.Sc.
University of Toronto, Department of Mechanical Engineering
-------------------------
Notes on second enhancement:
Support for Scaling, tickmarks, and better user defined characters
added by Gordon Jacobs, (Ph.D., since we're into titles above)
University of California, Berkeley in July 1989.
Mods were made ONLY for the hpgl2ps program and are not guaranteed
to work for dxy2ps. HP-GL code from the Tektronix DSA 602
Digitizing Signal Analyzer (scope) were used as a test.
Laserwriter output was compared directly with plots from a
HP7550A plotter reading the same HP-GL file.
Support for scaling was added.
The Scaling involves re-setting the coordinate
system by re-calculating the XSCALE and YSCALE numbers and adding
an offset to the origin. The offset had to be added to all files
that make use of the scaling parameters.
Tick marks were added with tick.c. Uses relative draw commands
to make the tick marks and adds two global variables which are
the tick length as a percentage of the overall dimensions.
The parser was changed. The SIGNED_NUMERIC macro recognized a comma
as a valid character which does not make sense. The HP-GL code from
the DSA 602 often contains a mnemonic followed by a comma, but with
no parameters. This is valid code although most sources will not
place a comma unless optional parameters actually follow. The comma
was removed as a valid SIGNED_NUMERIC character and the function
getval() was modified to read all trailing commas and spaces. In this way
the parser works for both the standard and odd case mentioned above.
The user defined character routine was modified heavily. Original
function did not take into account the angle of characters. The
new function reads the current angle of characters and orients
the user defined character in the same way. The scaling, which was
originally huge for some reason now is dynamically set to a
proportion of the size of regular text character. The linewidth
of the user defined character is arbitrarily set to 0.25mm and
then the restored to the previous value. This width seems to fit
the "linewidth" of the characters in the postscript helvetica
font sized for the DSA 602 output.
The default paper size is changed to be 8.5 x 11 inch paper with
command line options added to support all others.
The command line options -w and -h were added because the relative
scaling of fonts with the "SR" HP-GL command, while implemented
correctly, gives much smaller character sizes than the HP7550A plotter.
The defaults were set empirically to match plotter output.
The sizes in viewport.c were modified to get correct positioning
on the 8.5 x 11 paper when compared to a plot directly from the
HP7550A on the same type of paper.
The textps() routine was modified to move the position pointers to
the end of a string when a string is drawn. This was commented out
in the code that I received, but needed to be restored for the
user defined character to be in the correct place. The results
match the HP plotter for the same code.
----------------------
Notes on third enhancement:
All changes pertain to HPGL stuff only.
The removale of the comma in the SIGNED_NUMBER function was incorrect.
The problem was that some programs put out a comma after the PD command
and before the set of numbers. This problem was fixed when the parser
was enhanced. For some reason the change mentioned above in the previous
enhancement didn't work when the comma was followed by valid numbers.
The hpglcom.c parser was changed so that:
1. All of the known HPGL commands (1984 HP 7580 plotter manual) have
been added to the parser list, making it easier for someone to
implement a command.
2. All unknown commands had the data following that command, up until
the next command, dumped. This cleaned up the parser problem that
I was seeing.
3. Three new compilable options have been added:
DEBUG: When turned on, all PostScript output (after the macros)
is put out on stderr, along with the HPGL commands. This
allows the programmer to see the input HPGL commands and
the PostScript output. The new AA command also puts out
many of its computations.
NOTIMP: Output all HGPL commands that are unknown. If you don't
want this list, turn off this compiler option.
SYSV: Many AT&T System V Unix systems don't have rint(). This
option will use the very simple one that I included.
4. The HPGL Absolute Arc (AA) command has been implemented. The Arc
Relative (AR) one has not (yet). See the new routine arcps.c for
further comments on what was done.
The default line sizes have been changed. See the man page for the complete
list.
Notes on fourth enhancement (hpgl2ps v2.1):
==============================================================================
Basically, I did very little to this version, except some fine tuning to:
1) make printouts of unsupported calls with NOTIMP print out on
separate lines, for clearer output,
2) change some of the casts to prevent warnings on the stricter 2.5.8 gcc
compiler, and
3) Include the ieee library in the Makefile as an option, for those compilers
which might have the problem with the broken strtod (floatconv.c)
linux library call. It looks as if Sun may have the same problem?
4) remove the 'Not implemented: LB' error message. It looks as if hpgl2ps
does implement LB, but I can't get ahold of the previous enhancer to
check this.
5) enhance the Makefile a bit, including renaming the man pages from
*.man to *.1 for easier/clearer installation, adding man installation
and uninstall, and hinging hpgl2ps from libroland.a, as well as making
testfiles.
6) add a '-v' flag for version number. There are so many versions of this
package floating around that major/minor version numbers should help
someone who is doing an archie/ftp/WWW search to figure out which is the
latest.
7) Do general cleanup (insert #include's, extern's, reformat with function
declarations and new arguments, fix a labelling bug, etc.) so that
the code will compile with no warnings, even with '-Wall' compiler
flag on gcc, and so that the code is strictly ansi compatible.
Basically, I could not get hpgl2ps to reliably produce the same
printout on one machine as the other (Linux and Ultrix). It does
now (at least for me). Also, it doesn't print out spurious warnings
about things which haven't been implemented yet, which have.
8) I also removed the SYSV definition. That definition was around only
for SYSV people who needed to have rint() (normally from math.h)
defined for them. But theoretically, everyone should use the same
rint, AND since (as of this date, anyway) I can find no POSIX
definition for rint, AND our use here is pretty simple, AND I was
getting error messages about implicit declarations, AND our machine
returns a double, (instead of just an int, as expected here), AND it
has this wierd rule about returning an even number if
|rint(x)-x|=1/2, I just decided to rename this one 'local_rint' and
that way we all have the same thing.
9) Moved all the *.c hp modules (arcps.c plotdot.c, etc.) into one module
(hplib.c) for easier porting (primarily makefile problems with Borland).
Also, the labelling is still not yet completely stable/reliable. This is
why I put in the -w and -h command-line options, as well as -f option,
so that the user can 'tweek' their output, as desired.
Finally, thanks *very* much to Dan Saunders at the University of Idaho
for helping me after days of frustration by patiently explaining the
broken float conversion call. It's nice to know there are people
around who a)know what they're doing, and b)don't mind talking to
people who don't. :)
=====
Jeff Stern <jstern@eclectic.ss.uci.edu>
95/4/19
hpgl2ps-2.2/defn.h 100644 0 0 7571 6546523043 12121 0 ustar root root /*
*
* The following definations allow for the efficient
* translation of DXY and RD-GL codes to PostScript code
*
*/
#include <stdio.h>
#include <math.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#define CR '\015'
#define LF '\012'
#define SPACE '\040'
/* the definition below was modified by Gordon Jacobs to remove
* the validity of a comma in a Signed Numeric quantity. The
* definition below is more accurate and the comma is now removed
* after reading the digit in getval()
*/
#define SIGNED_NUMERIC (ungetc(( ch = getc(stream)),stream) != EOF ) &&\
(((ch>='0') && (ch<='9')) || (ch=='-') || (ch=='+')\
|| (ch==' ') || (ch == '.'))
/* The debug stuff was added to trace what is going on during the conversion
* process to PostScript.
*/
#ifdef DEBUG
#define debugp(x) {fprintf x; (void) fflush(stderr);}
#else
#define debugp(x)
#endif
#ifdef NOTIMP
#define notimp(x) {fprintf x; fprintf(stderr, "\n"); (void) fflush(stderr);}
#else
#define notimp(x)
#endif
#define CIRCLE 21 /* DXY Circle */
#define RCIRCLE 22 /* DXY Relative Circle */
#define CCIRCLE 23 /* DXY Centered Circle */
#define ACIRCLE 24 /* DXY Arc plus Circle */
#define SCIRCLE 25 /* DXY Segment Circle */
#define RDGLCIRCLE 26 /* RD-GL Circle */
#define ARCA 27 /* HPGL Absolute Arc */
#define ARCR 28 /* HPGL Relative Arc */
#define TEXT 31
#define MARK 32
#define LINETYPE 41
#define LINESCALE 42
#define LINE_TYPE_SCALE 43
#define XTICK 0
#define YTICK 1
/*
* Files to open if any
*/
FILE *stream;
FILE *fopen();
/*
* Plotting Parameters that will contain the necessary PostScript
* commands to plot (see dxy2ps.c for the initialisation) and
* ps_macros.c for the plotting macros).
*/
char *MOVE;
char *RMOVE;
char *DRAW;
char *RDRAW;
char *ADRAW;
char *AARC;
char *RARC;
/*
* Definition of "ch" used in SIGNED_NUMERIC
*/
char ch;
/*
* Define the function getval() which returns a real number.
*/
float getval();
/*
* Scaling parameters used for translation from DXY and RD-GL
* coordinate sytem to the PostScript coordinate system which
* has been defined in millimeters. (See above)
*/
float SCALE;
float XSCALE;
float YSCALE;
float xmax, xmin;
float ymax, ymin;
float psxmax,psymax; /* max postscript dimensions */
float tlp,tln; /* HP-GL tick length parameters */
float FONT_H_MULT; /* fudge factor for font height */
float FONT_W_MULT; /* fudge factor for font width */
/*
* End of line terminator (RD-GL / HP-GL)
*/
char EOL;
/*
* PostScript Coordinate parameters
*/
float lastXmove;
float lastYmove;
float absX;
float absY;
float offX,offY; /* used for Scale command */
float xval;
float yval;
float xoffset, yoffset;
/*
* Extra parameters
*/
float char_angle;
float char_height;
float char_width;
float char_space;
float char_slant;
char font[40];
char symbol;
int dcount;
/*
* Degree radian conversion parameter ie: deg_rad = asin(1) / 90.0;
* ( Defined in dxy2ps.c or rdgl2ps.c )
*/
float deg_rad;
/*
* Line / pen size parameter (max 9 sizes)
*/
float pen_size[9];
int pen_number;
/*
* Paper size (ie A3 or A4) and Mode (HPGL or DXY)
*/
char *PaperSize;
char *Mode;
/*
* Flags
*/
int LANDSCAPE;
int DRAW_FLAG;
int PLOTABS;
int PLOTARC;
int PENDOWN;
int SETDOT; /* HP-GL commands only */
int SYMBOL; /* HP-GL commands only */
void arcps(int type);
void circle(int type);
void changesizes(char sizebuf[50]);
void dxycom(char op);
void end_draw(void);
float getval(void);
void hpglcom(char op1);
void dumpit(int x);
void dumpcomma(void);
void linesize(void);
void linetype(int line);
int local_rint(double x);
void manualfeed(int arg);
void plotcoords(void);
void plotdot(char *type);
void plotinit(void);
void plotps(char *type);
void ps_macros(void);
void rectangle(void);
void textps(int type);
void tick(int type);
void userdefchar(void);
float theMagnitude(float x, float y);
float theAngle(float x, float y);
void viewport(void);
void modify_viewport(void);
hpgl2ps-2.2/dosstuff/ 40755 0 0 0 5745537002 12562 5 ustar root root hpgl2ps-2.2/dosstuff/dxy2ps.exe 100644 0 0 224530 5745522126 14662 0 ustar root root MZX @ . { >