home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume29
/
psutils
/
patch02
next >
Wrap
Text File
|
1992-04-15
|
15KB
|
437 lines
Newsgroups: comp.sources.misc
From: ajcd@dcs.ed.ac.uk (Angus Duggan)
Subject: v29i077: psutils - Postscript document manipulation tools, Patch02
Message-ID: <1992Apr16.032058.26805@sparky.imd.sterling.com>
X-Md4-Signature: 5d49c11419f668f19875a3488dec3934
Date: Thu, 16 Apr 1992 03:20:58 GMT
Approved: kent@sparky.imd.sterling.com
Submitted-by: ajcd@dcs.ed.ac.uk (Angus Duggan)
Posting-number: Volume 29, Issue 77
Archive-name: psutils/patch02
Environment: UNIX
Patch-To: psutils: Volume 22, Issue 87-88
Here's a minor bugfix patch to my PostScript utilities package (volumes 22
and 23). A new script is included, fixwpps, which fixes WordPerfect documents
so that they can be used with the package (I don't know if this script will
work in all cases - it was tested on one example document), and also fixes
pstops so that it accepts negative offsets.
A statement of the status of this software has also been included, to clarify
the position for people wanting to include any of it in other packages.
a.
--
Angus Duggan, Department of Computer Science, | I'm pink, therefore I'm Spam.
University of Edinburgh, JCMB, | JANET: ajcd@uk.ac.ed.dcs
The King's Buildings, Mayfield Road, | VOICE: (UK) 031 650 5126
Edinburgh, EH9 3JZ, Scotland. | OR: ajcd%dcs.ed.ac.uk@nsfnet-relay.ac.uk
diff -crN psutils.old/LICENSE psutils/LICENSE
*** psutils.old/LICENSE
--- psutils/LICENSE Wed Mar 25 15:04:55 1992
***************
*** 0 ****
--- 1,36 ----
+
+ PS Utilities Package
+
+ The constituent files of this package listed below are copyright (C) 1991,1992
+ Angus J. C. Duggan.
+
+ Makefile README buffer.c epsffit.c fixfmps
+ fixmacps fixpspps getafm magic.c psbook.1
+ psbook.c psnup psnup.1 psselect.1 psselect.c
+ pstops.1 pstops.c psutil.c psutil.h showchar
+
+ They may be copied and used for any purpose (including distribution as part of
+ a for-profit product), provided:
+
+ 1) The original attribution of the programs is clearly displayed in the product
+ and/or documentation, even if the programs are modified and/or renamed as
+ part of the product.
+
+ 2) The original source code of the programs is provided free of charge (except
+ for reasonable distribution costs). For a definition of reasonable
+ distribution costs, see the Gnu General Public License or Larry Wall's
+ Artistic License (provided with the Perl 4 kit). The GPL and Artistic
+ License in NO WAY affect this license; they are merely used as examples of
+ the spirit in which it is intended.
+
+ 3) These programs are provided "as-is". No warranty or guarantee of their
+ fitness for any particular task is provided. Use of these programs is
+ completely at your own risk.
+
+ Basically, I don't mind how you use the programs so long as you acknowledge
+ the author, and give people the originals if they want them.
+
+ The included files appledict.ps, and appledict.ps.uue are (to the best of my
+ knowledge) copyright Apple Computer, Inc.
+
+ AJCD 25/3/92
diff -crN psutils.old/README psutils/README
*** psutils.old/README Wed Apr 8 10:32:25 1992
--- psutils/README Wed Apr 8 10:37:23 1992
***************
*** 1,4 ****
! PostScript Utilities Angus Duggan 3 September 1991
This shar file contains some utilities for manipulating PostScript documents.
Page selection and rearrangement are supported, including arrangement into
--- 1,4 ----
! PostScript Utilities Angus Duggan 7 April 1992
This shar file contains some utilities for manipulating PostScript documents.
Page selection and rearrangement are supported, including arrangement into
***************
*** 12,38 ****
FILES
The files contained are:
- -rw-r--r-- 1 ajcd 643 Jul 12 10:34 Makefile
- -rw-r--r-- 1 ajcd 2819 Sep 3 10:35 README
- -rw-r--r-- 1 ajcd 42765 Sep 3 10:07 appledict.ps.uue
- -rw-r--r-- 1 ajcd 3673 Jul 12 10:34 epsffit.c
- -rwxr-xr-x 1 ajcd 359 Jul 16 15:21 fixfmps
- -rwxr-xr-x 1 ajcd 1042 Jul 16 15:21 fixmacps
- -rwxr-xr-x 1 ajcd 1165 Jul 16 15:21 fixpspps
- -rwxr-xr-x 1 ajcd 4706 Sep 3 10:22 getafm
- -rw-r--r-- 1 ajcd 1066 Jul 12 10:34 psbook.1
- -rw-r--r-- 1 ajcd 1990 Jul 12 10:34 psbook.c
- -rwxr-xr-x 1 ajcd 2113 Jul 12 10:34 psnup
- -rw-r--r-- 1 ajcd 2146 Jul 12 10:34 psnup.1
- -rw-r--r-- 1 ajcd 1509 Jul 12 10:34 psselect.1
- -rw-r--r-- 1 ajcd 4621 Jul 12 10:34 psselect.c
- -rw-r--r-- 1 ajcd 3227 Jul 12 10:34 pstops.1
- -rw-r--r-- 1 ajcd 9273 Jul 12 10:34 pstops.c
- -rw-r--r-- 1 ajcd 5220 Jul 12 10:34 psutil.c
- -rw-r--r-- 1 ajcd 663 Jul 12 10:34 psutil.h
- -rwxr-xr-x 1 ajcd 2472 Sep 3 10:38 showchar
-
PROGRAMS
psbook rearranges pages into signatures
--- 12,39 ----
FILES
The files contained are:
+ -rw-r--r-- 1 ajcd 1665 Mar 25 15:04 LICENSE
+ -rw-r--r-- 1 ajcd 643 Apr 7 19:13 Makefile
+ -rw-r--r-- 1 ajcd 3044 Apr 8 10:36 README
+ -rw-r--r-- 1 ajcd 31017 Jul 16 1991 appledict.ps
+ -rw-r--r-- 1 ajcd 3673 Jul 12 1991 epsffit.c
+ -rwxr-xr-x 1 ajcd 362 Apr 7 19:51 fixfmps
+ -rwxr-xr-x 1 ajcd 1082 Apr 7 19:51 fixmacps
+ -rwxr-xr-x 1 ajcd 1165 Jul 16 1991 fixpspps
+ -rwxr-xr-x 1 ajcd 525 Apr 7 19:52 fixwpps
+ -rwxr-xr-x 1 ajcd 4706 Sep 3 1991 getafm
+ -rw-r--r-- 1 ajcd 1066 Jul 12 1991 psbook.1
+ -rw-r--r-- 1 ajcd 1990 Jul 12 1991 psbook.c
+ -rwxr-xr-x 1 ajcd 2113 Jul 12 1991 psnup
+ -rw-r--r-- 1 ajcd 2152 Sep 5 1991 psnup.1
+ -rw-r--r-- 1 ajcd 1509 Jul 12 1991 psselect.1
+ -rw-r--r-- 1 ajcd 4621 Jul 12 1991 psselect.c
+ -rw-r--r-- 1 ajcd 3209 Mar 23 09:48 pstops.1
+ -rw-r--r-- 1 ajcd 9416 Apr 7 19:27 pstops.c
+ -rw-r--r-- 1 ajcd 5270 Apr 7 19:01 psutil.c
+ -rw-r--r-- 1 ajcd 682 Sep 5 1991 psutil.h
+ -rwxr-xr-x 1 ajcd 2552 Sep 5 1991 showchar
PROGRAMS
psbook rearranges pages into signatures
***************
*** 50,67 ****
getafm (sh) outputs PostScript to retrieve AFM file from printer
showchar (sh) outputs PostScript to draw a character with metric info
fixfmps (perl) filter to fix framemaker documents so that psselect etc. work
fixmacps (perl) filter to fix Macintosh documents with saner version of md
fixpspps (perl) filter to fix PSPrint PostScript so that psselect etc. work
INSTALLATION
! UUdecode appledict.ps.uue, edit Makefile to put in required CFLAGS (SYSV for
! System V machines), "make", and install files in appropriate places.
BUGS
The utilities don't check for PS-Adobe-?.? conformance; they assume documents
conform. Utilities need an extra save/restore around whole document on a
! SPARCPrinter, because of bugs in the xnews server.
Bug fixes and suggestions to ajcd@dcs.ed.ac.uk
--- 51,70 ----
getafm (sh) outputs PostScript to retrieve AFM file from printer
showchar (sh) outputs PostScript to draw a character with metric info
fixfmps (perl) filter to fix framemaker documents so that psselect etc. work
+ fixwpps (perl) filter to fix WordPerfect documents so that psselect etc. work
fixmacps (perl) filter to fix Macintosh documents with saner version of md
fixpspps (perl) filter to fix PSPrint PostScript so that psselect etc. work
INSTALLATION
! UUdecode appledict.ps.uue (if supplied encoded), edit Makefile to put in
! required CFLAGS (SYSV for System V machines), "make", and install files in
! appropriate places.
BUGS
The utilities don't check for PS-Adobe-?.? conformance; they assume documents
conform. Utilities need an extra save/restore around whole document on a
! SPARCPrinter with NeWSPrint 1.0, because of bugs in the xnews server.
Bug fixes and suggestions to ajcd@dcs.ed.ac.uk
diff -crN psutils.old/fixfmps psutils/fixfmps
*** psutils.old/fixfmps Wed Apr 8 10:32:26 1992
--- psutils/fixfmps Tue Apr 7 19:51:26 1992
***************
*** 1,5 ****
#!/usr/local/bin/perl
! # fmps: get conforming PostScript out of FrameMaker file
# move all FMDEFINEFONTs to start of pages
%fonts=();
--- 1,5 ----
#!/usr/local/bin/perl
! # fixfmps: get conforming PostScript out of FrameMaker file
# move all FMDEFINEFONTs to start of pages
%fonts=();
diff -crN psutils.old/fixmacps psutils/fixmacps
*** psutils.old/fixmacps Wed Apr 8 10:32:27 1992
--- psutils/fixmacps Tue Apr 7 19:51:59 1992
***************
*** 1,4 ****
--- 1,5 ----
#!/usr/local/bin/perl
+ # fixmacps: swap to sanitised appledict
$line = 0; # keep line count
$sane = "appledict.ps";
diff -crN psutils.old/fixwpps psutils/fixwpps
*** psutils.old/fixwpps
--- psutils/fixwpps Tue Apr 7 19:52:23 1992
***************
*** 0 ****
--- 1,22 ----
+ #!/usr/local/bin/perl
+ # fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file
+
+ $page = 1;
+ while (<>) {
+ s/(_[a-zA-Z]+)([0-9]+)/\1 \2/g;
+ if (/^_bp/) {
+ print STDOUT "%%Page: $page $page\n";
+ print STDOUT $_;
+ $page++;
+ } elsif (/^([^\/].*\S.*)(_bp.*)/) {
+ print STDOUT "$1\n";
+ print STDOUT "%%Page: $page $page\n";
+ print STDOUT "$2\n";
+ $page++;
+ } elsif (/^_ed/) {
+ print STDOUT "%%Trailer:\n";
+ print STDOUT $_;
+ } else {
+ print STDOUT $_;
+ }
+ }
diff -crN psutils.old/pstops.1 psutils/pstops.1
*** psutils.old/pstops.1 Wed Apr 8 10:32:28 1992
--- psutils/pstops.1 Mon Mar 23 09:48:13 1992
***************
*** 1,6 ****
.TH PSTOPS 1
.SH NAME
! pstops \- select pages from a PostScript file
.SH SYNOPSIS
.B pstops
[
--- 1,6 ----
.TH PSTOPS 1
.SH NAME
! pstops \- shuffle pages in a PostScript file
.SH SYNOPSIS
.B pstops
[
***************
*** 60,66 ****
.I xoff
and
.I yoff
! shift the page by the specified (positive) amount.
.I xoff
and
.I yoff
--- 60,66 ----
.I xoff
and
.I yoff
! shift the page by the specified amount.
.I xoff
and
.I yoff
***************
*** 116,122 ****
sheet (of A4 paper), the pagespec to use is:
.sp
.ce
! 2:0L@0.7(21cm,0)+1L@0.7(21cm,14.85cm)
.sp
To select all of the odd pages in reverse order, use:
.sp
--- 116,122 ----
sheet (of A4 paper), the pagespec to use is:
.sp
.ce
! 2:0L@.7(21cm,0)+1L@.7(21cm,14.85cm)
.sp
To select all of the odd pages in reverse order, use:
.sp
***************
*** 126,137 ****
To re-arrange pages for printing 2-up booklets, use
.sp
.ce
! 4:-3L@0.7(21cm,0)+0L@0.7(21cm,14.85cm)
.sp
for the front sides, and
.sp
.ce
! 4:1L@0.7(21cm,0)+-2L@0.7(21cm,14.85cm)
.sp
for the reverse sides (or join them with a comma for duplex printing).
.SH AUTHOR
--- 126,137 ----
To re-arrange pages for printing 2-up booklets, use
.sp
.ce
! 4:-3L@.7(21cm,0)+0L@.7(21cm,14.85cm)
.sp
for the front sides, and
.sp
.ce
! 4:1L@.7(21cm,0)+-2L@.7(21cm,14.85cm)
.sp
for the reverse sides (or join them with a comma for duplex printing).
.SH AUTHOR
diff -crN psutils.old/pstops.c psutils/pstops.c
*** psutils.old/pstops.c Wed Apr 8 10:32:29 1992
--- psutils/pstops.c Tue Apr 7 19:27:33 1992
***************
*** 70,79 ****
double parsedouble(sp)
char **sp;
{
! int n = parseint(sp);
char *s = *sp;
int d = 0, frac = 1;
if (*s == '.') {
*sp = ++s;
for (; isdigit(*s); s++) {
--- 70,85 ----
double parsedouble(sp)
char **sp;
{
! int n = 0, neg = 1;
char *s = *sp;
int d = 0, frac = 1;
+ if (*s == '-') {
+ neg = -1;
+ *sp = ++s;
+ }
+ for (;isdigit(*s); s++)
+ n = n*10 + (*s-'0');
if (*s == '.') {
*sp = ++s;
for (; isdigit(*s); s++) {
***************
*** 80,89 ****
d = d*10 + (*s-'0');
frac *= 10;
}
- if (*sp == s) specusage();
}
*sp = s;
! return ((double)n+(double)d/frac);
}
double parsedimen(sp)
--- 86,95 ----
d = d*10 + (*s-'0');
frac *= 10;
}
}
+ if (*sp == s) specusage();
*sp = s;
! return (neg*((double)n+(double)d/frac));
}
double parsedimen(sp)
***************
*** 269,275 ****
writestring(" bind def}{pop}ifelse}{pop}ifelse}forall\n");
writestring("[/letter/legal/executivepage/a4/a4small/b5/com10envelope\n");
writestring(" /monarchenvelope/c5envelope/dlenvelope/lettersmall/note\n");
! writestring(" /folio/quarto/a5]{dup where{exch{}put}{pop}ifelse}forall\n");
writestring("/lcvx{dup load dup type dup/operatortype eq{pop exch pop}\n");
writestring(" {/arraytype eq{dup xcheck{exch pop aload pop}\n");
writestring(" {pop cvx}ifelse}{pop cvx}ifelse}ifelse}bind def\n");
--- 275,282 ----
writestring(" bind def}{pop}ifelse}{pop}ifelse}forall\n");
writestring("[/letter/legal/executivepage/a4/a4small/b5/com10envelope\n");
writestring(" /monarchenvelope/c5envelope/dlenvelope/lettersmall/note\n");
! writestring(" /folio/quarto/a5]{dup where{dup wcheck{exch{}put}\n");
! writestring(" {pop{}def}ifelse}{pop}ifelse}forall\n");
writestring("/lcvx{dup load dup type dup/operatortype eq{pop exch pop}\n");
writestring(" {/arraytype eq{dup xcheck{exch pop aload pop}\n");
writestring(" {pop cvx}ifelse}{pop cvx}ifelse}ifelse}bind def\n");
***************
*** 302,310 ****
writestring("%%EndProcSet\n");
writeprolog();
for (thispg = 0; thispg < maxpage; thispg += modulo) {
! int ppp, add_last = 0;
struct pagespec *ps;
! for (ppp = 0, ps = specs; ps != NULL; ppp++, ps = ps->next) {
int actualpg;
int add_next = ((ps->flags & ADD_NEXT) != 0);
if (ps->reversed)
--- 309,317 ----
writestring("%%EndProcSet\n");
writeprolog();
for (thispg = 0; thispg < maxpage; thispg += modulo) {
! int add_last = 0;
struct pagespec *ps;
! for (ps = specs; ps != NULL; ps = ps->next) {
int actualpg;
int add_next = ((ps->flags & ADD_NEXT) != 0);
if (ps->reversed)
diff -crN psutils.old/psutil.c psutils/psutil.c
*** psutils.old/psutil.c Wed Apr 8 10:32:30 1992
--- psutils/psutil.c Tue Apr 7 19:01:46 1992
***************
*** 110,116 ****
}
} else if (headerlen == 0 && buffer[1] != '!')
headerlen = ftell(infile)-strlen(buffer);
! }
pageptr[pages] = ftell(infile);
}
--- 110,117 ----
}
} else if (headerlen == 0 && buffer[1] != '!')
headerlen = ftell(infile)-strlen(buffer);
! } else if (headerlen == 0)
! headerlen = ftell(infile)-strlen(buffer);
pageptr[pages] = ftell(infile);
}
exit 0 # Just in case...