v20i018: dvi - C++ DVI filter for HP LaserJets, Patch01
Parag Patel
parag at hpsdeb.sde.hp.com
Fri May 24 05:35:42 AEST 1991
Submitted-by: Parag Patel <parag at hpsdeb.sde.hp.com>
Posting-number: Volume 20, Issue 18
Archive-name: dvi/patch01
Patch-To: dvi: Volume 19, Issue 64-66
This is the first bug-fix release for dvi. The following is a list of
modifications contained in this patch:
- dvi has been ported to Sparc - minor ifdef needed,
- version string was slightly modified so say_hello() in
main.C works,
- also looks for fonts such as /path/cmr7.300pk and cmr7.300gf,
- Makefile was modified to allow overriding the default font
search path.
To apply this patch cd to the dvi source directory, unshar this file
and the "patch < patch-1.6-1.7".
-- Parag
---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 05/23/1991 17:49 UTC by parag at hpsdeb
# Source directory /users/parag/tools/tex/dvi/VERSIONS
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 10794 -rw-r--r-- patch-1.6-1.7
#
# ============= patch-1.6-1.7 ==============
if test -f 'patch-1.6-1.7' -a X"$1" != X"-c"; then
echo 'x - skipping patch-1.6-1.7 (File already exists)'
else
sed 's/^X//' << 'SHAR_EOF' > 'patch-1.6-1.7' &&
*** tmp/Makefile Thu May 9 13:25:23 1991
--- Makefile Mon May 20 19:05:45 1991
***************
*** 1,5
X # Copyright (c) 1991 by Parag Patel. All Rights Reserved.
! # $Header: Makefile,v 1.22 91/05/09 14:25:22 hmgr Exp $
X
X CXX = CC
X .SUFFIXES: .C
X
--- 1,5 -----
X # Copyright (c) 1991 by Parag Patel. All Rights Reserved.
! # $Header: Makefile,v 1.24 91/05/20 20:05:44 hmgr Exp $
X
X CXX = CC
X .SUFFIXES: .C
***************
*** 7,13
X $(CXX) $(CFLAGS) -c $<
X
X # other system-dependent options - use only one of the -D<sys> macros:
! #CFLAGS = -O -DBSD -DMSDOS
X CFLAGS = -g
X LIBS = -lm
X
X
--- 7,17 -----
X $(CXX) $(CFLAGS) -c $<
X
X # other system-dependent options - use only one of the -D<sys> macros:
! # -DBSD for BSD derivatives
! # -DMSDOS for Zortech C++ - also run "make msdos-files"
! # -DFREE_TAKES_CHAR if you have a free(char*) instead of free(void*)
! # -DHP2686_FPATH=/path1:/path2:...
! # to modify the default font search path
X CFLAGS = -g
X LIBS = -lm
X
*** tmp/README Fri Feb 22 15:31:52 1991
--- README Thu May 23 10:45:10 1991
***************
*** 1,4
! $Header: README,v 1.10 91/02/22 16:31:45 hmgr Exp $
X
X Copyright (c) 1991 by Parag Patel. All Rights Reserved.
X You can do what you wish with this as long as
X
--- 1,4 -----
! $Header: README,v 1.15 91/05/23 11:45:11 hmgr Exp $
X
X Copyright (c) 1991 by Parag Patel. All Rights Reserved.
X You can do what you wish with this as long as
***************
*** 9,20
X software. It is completely unsupported. You're on your own.
X
X
! This is version 1.4 of my TeX DVI filter. I'd written it about 4 years
! ago since, at that time, the only LaserJet DVI filters available to me
! were in Pascal and ungodly slow. Anyway, it's been pointed out to me
! that "dvi" still one of the better DVIs around, so I figured it was time
! to get off my duff and make it available to the world at large. Or at
! small - I'm not picky.
X
X The man-page lists all the pertinent details, but here's some
X highlights:
X
--- 9,20 -----
X software. It is completely unsupported. You're on your own.
X
X
! This is the TeX DVI filter which I'd written it about 4 years ago when,
! at that time, the only LaserJet DVI filters available to me were in
! Pascal and ungodly slow. Anyway, it's been pointed out to me that "dvi"
! still one of the better DVIs around, so I figured it was time to get off
! my duff and make it available to the world at large. Or at small - I'm
! not picky.
X
X The man-page lists all the pertinent details, but here's some
X highlights:
***************
*** 47,57
X among other things.)
X
X Dvi currently compiles right up on HP-UX 7.0, 6.5, and 6.2 (s300s or
! s800s), BSD4.3 (Tahoe) on hp300 hardware, and Zortech C++ on MSDOS. I
! use AT&T's C++ 2.0 (cfront) and not G++ on all my Unix boxes. I do NOT
! use C++ streams, but do use stdio. I have NO idea how much work it'll
! take to get it running on other systems or using G++, but it shouldn't
! be too hard.
X
X
X Anyway, just type "make" to build a debug version of "dvi". Then copy
X
--- 47,57 -----
X among other things.)
X
X Dvi currently compiles right up on HP-UX 7.0, 6.5, and 6.2 (s300s or
! s800s), BSD4.3 (Tahoe) on hp300 hardware, Zortech C++ on MSDOS, and
! Sparc. I use AT&T's C++ 2.0 (cfront) and not G++ on all my Unix boxes.
! I do NOT use C++ streams, but do use stdio. I have NO idea how much
! work it'll take to get it running on other systems or using G++, but it
! shouldn't be too hard.
X
X
X Anyway, just type "make" to build a debug version of "dvi". Then copy
***************
*** 57,63
X Anyway, just type "make" to build a debug version of "dvi". Then copy
X "dvi" and "dvi.1" to whatever names and whatever places you want them.
X You will have to define -DMSDOS or -DBSD in the Makefile if you are on
! those systems.
X
X Use "make ljdump" to build the "ljdump" program. This is useful for
X debugging dvi by converting PCL to a semi-human-readable dump.
X
--- 57,63 -----
X Anyway, just type "make" to build a debug version of "dvi". Then copy
X "dvi" and "dvi.1" to whatever names and whatever places you want them.
X You will have to define -DMSDOS or -DBSD in the Makefile if you are on
! those systems. My Sparc also needed -DFREE_TAKES_CHAR.
X
X Use "make ljdump" to build the "ljdump" program. This is useful for
X debugging dvi by converting PCL to a semi-human-readable dump.
***************
*** 74,76
X
X
X -- Parag Patel <parag at sde.hp.com>
X
--- 74,89 -----
X
X
X -- Parag Patel <parag at sde.hp.com>
+
+
+
+ --------------------REVISION-INFO----------------------
+
+ 1.6 released on HP INTERX Contrib Tape and comp.sources.misc
+
+ 1.7 first bug-fix release
+ files modified: Makefile README extern.h main.C readfont.C hp2686.h
+ ported to Sparc - minor ifdef needed
+ version string slightly modified so say_hello() in main.C works
+ also look for fonts such as /path/cmr7.300pk and cmr7.300gf
+ allow overriding default font search path from Makefile
*** tmp/extern.h Fri Feb 22 14:59:13 1991
--- extern.h Fri May 17 15:28:16 1991
***************
*** 1,5
X // Copyright (c) 1991 by Parag Patel. All Rights Reserved.
! // $Header: extern.h,v 1.24 91/02/22 15:59:02 hmgr Exp $
X
X // externs for various LaserJet+ DVI filter functions
X //
X
--- 1,5 -----
X // Copyright (c) 1991 by Parag Patel. All Rights Reserved.
! // $Header: extern.h,v 1.25 91/05/17 16:28:17 hmgr Exp $
X
X // externs for various LaserJet+ DVI filter functions
X //
***************
*** 91,97
X // convienient inlines - these would otherwise would have to go elsewhere
X
X inline char *strnew(size_t len) { return (char*)malloc(len + 1); }
! inline void strfree(char *s) { if (s != NULL) free((void *)s); }
X inline char *strdup(const char *s)
X { return s != NULL ? strcpy((char*)malloc(strlen(s) + 1), s) : NULL; }
X inline boolean streq(const char *s1, const char *s2)
X
--- 91,101 -----
X // convienient inlines - these would otherwise would have to go elsewhere
X
X inline char *strnew(size_t len) { return (char*)malloc(len + 1); }
! #if FREE_TAKES_CHAR
! inline void strfree(const char *s) { if (s != NULL) free((char *)s); }
! #else
! inline void strfree(const char *s) { if (s != NULL) free((const void *)s); }
! #endif
X inline char *strdup(const char *s)
X { return s != NULL ? strcpy((char*)malloc(strlen(s) + 1), s) : NULL; }
X inline boolean streq(const char *s1, const char *s2)
*** tmp/main.C Tue Apr 2 16:50:35 1991
--- main.C Fri May 17 15:28:21 1991
***************
*** 1,5
X // Copyright (c) 1991 by Parag Patel. All Rights Reserved.
! static const char rcsid[] = "$Header: main.C,v 1.31 91/04/02 17:50:33 hmgr Exp $";
X
X // TeX DVI filter main() - just parses arguments and calls functions
X //
X
--- 1,5 -----
X // Copyright (c) 1991 by Parag Patel. All Rights Reserved.
! static const char rcsid[] = "$Header: main.C,v 1.32 91/05/17 16:28:22 hmgr Exp $";
X
X // TeX DVI filter main() - just parses arguments and calls functions
X //
***************
*** 7,13
X
X #include "defs.h"
X
! static char *const whatid = "@(#) dvi 1.6 (02 April 1991)";
X
X static void say_hello()
X {
X
--- 7,13 -----
X
X #include "defs.h"
X
! static char *const whatid = "@(#)dvi 1.7 (02 April 1991)";
X
X static void say_hello()
X {
*** tmp/readfont.C Tue Apr 2 16:50:29 1991
--- readfont.C Mon May 20 15:12:45 1991
***************
*** 1,5
X // Copyright (c) 1991 by Parag Patel. All Rights Reserved.
! static const char rcsid[] = "$Header: readfont.C,v 1.21 91/04/02 17:50:26 hmgr Exp $";
X
X // read font data from the METAFONT GF (generic font) files
X //
X
--- 1,5 -----
X // Copyright (c) 1991 by Parag Patel. All Rights Reserved.
! static const char rcsid[] = "$Header: readfont.C,v 1.22 91/05/20 16:12:46 hmgr Exp $";
X
X // read font data from the METAFONT GF (generic font) files
X //
***************
*** 31,36
X static char buf[MAXPATHLEN + 1];
X sprintf(buf, "%s/%s/%s%s", dir, mag, base, ext);
X char *path = buf;
X FILE *fp = fopen(path, F_READ);
X if (fp == NULL)
X return FALSE;
X
--- 31,38 -----
X static char buf[MAXPATHLEN + 1];
X sprintf(buf, "%s/%s/%s%s", dir, mag, base, ext);
X char *path = buf;
+
+ debug(3, "looking for font file %s", path);
X FILE *fp = fopen(path, F_READ);
X if (fp == NULL)
X return FALSE;
***************
*** 109,114
X if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
X return;
X if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ""))
X return;
X }
X quit("Cannot find font file \"%s\" (at or near magnification %ld.%03ld) anywhere",
X
--- 111,124 -----
X if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
X return;
X if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ""))
+ return;
+
+ char ext[30];
+ sprintf(ext, ".%dpk", RESOLUTION);
+ if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
+ return;
+ sprintf(ext, ".%dgf", RESOLUTION);
+ if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
X return;
X }
X quit("Cannot find font file \"%s\" (at or near magnification %ld.%03ld) anywhere",
*** tmp/hp2686.h Fri Feb 22 14:58:59 1991
--- hp2686.h Mon May 20 19:05:50 1991
***************
*** 1,5
X // Copyright (c) 1991 by Parag Patel. All Rights Reserved.
! // $Header: hp2686.h,v 1.13 91/02/22 15:58:47 hmgr Exp $
X
X // HP2686 LaserJet+ device-specific definitions.
X // The LaserJet+ Reference Manual should be consulted for more
X
--- 1,5 -----
X // Copyright (c) 1991 by Parag Patel. All Rights Reserved.
! // $Header: hp2686.h,v 1.14 91/05/20 20:05:52 hmgr Exp $
X
X // HP2686 LaserJet+ device-specific definitions.
X // The LaserJet+ Reference Manual should be consulted for more
***************
*** 37,42
X void rule(double v, double h);
X };
X
X #define HP2686_FPATH "/usr/lib/tex/fontbits/laser:/usr/lib/tex/fnt:/usr/local/tex/fontbits/laser"
X
X // about 1 inch from both margins - tweaked until TeX test comes out right
X
--- 37,43 -----
X void rule(double v, double h);
X };
X
+ #ifndef HP2686_FPATH
X #define HP2686_FPATH "/usr/lib/tex/fontbits/laser:/usr/lib/tex/fnt:/usr/local/tex/fontbits/laser"
X #endif
X
***************
*** 38,43
X };
X
X #define HP2686_FPATH "/usr/lib/tex/fontbits/laser:/usr/lib/tex/fnt:/usr/local/tex/fontbits/laser"
X
X // about 1 inch from both margins - tweaked until TeX test comes out right
X // when printed to a LaserJet - lots of fun with unprintable regions!
X
--- 39,45 -----
X
X #ifndef HP2686_FPATH
X #define HP2686_FPATH "/usr/lib/tex/fontbits/laser:/usr/lib/tex/fnt:/usr/local/tex/fontbits/laser"
+ #endif
X
X // about 1 inch from both margins - tweaked until TeX test comes out right
X // when printed to a LaserJet - lots of fun with unprintable regions!
SHAR_EOF
chmod 0644 patch-1.6-1.7 ||
echo 'restore of patch-1.6-1.7 failed'
Wc_c="`wc -c < 'patch-1.6-1.7'`"
test 10794 -eq "$Wc_c" ||
echo 'patch-1.6-1.7: original size 10794, current size' "$Wc_c"
fi
exit 0
exit 0 # Just in case...
--
Kent Landfield INTERNET: kent at sparky.IMD.Sterling.COM
Sterling Software, IMD UUCP: uunet!sparky!kent
Phone: (402) 291-8300 FAX: (402) 291-4362
Please send comp.sources.misc-related mail to kent at uunet.uu.net.
More information about the Comp.sources.misc
mailing list