include_run


README

The PostScript language includes the run keyword, which allows one file to be invoked from within another. This is similar to, for example, the require instruction in Perl.

Of course, this means that any PostScript which uses the run keyword can only be viewed if the invoked file exists on the filesystem; therefore before that PostScript can be printed, e-mailed elsewhere, or converted to PDF to be put on a website, the run statement must be removed and the contents of the invoked file must be inserted. include_run performs this task.

If a file is invoked by more than one run statement it only gets included once; this behaviour is also similar to the require instruction in Perl.

To install:   go to www.pjb.com.au/comp/free/include_run and save the file to your local disc.
Edit the first line if necessary to reflect where perl is installed on your system,
make it executable, and move it to some directory in your $PATH . . .


NAME

include_run - Include all run-files into a PostScript file


SYNOPSIS

 $ grep run foo.ps
 (/home/wherever/ps/lib/a_library.ps) run
 $ include_run foo.ps | lpr
 $ include_run foo.ps | mail -s 'Here is foo.ps' fred@bloggs.org
 $ include_run foo.ps | gs -q -sDEVICE=pdfwrite -sOutputFile=foo.pdf -


DESCRIPTION

The PostScript language includes the run keyword, which allows one file to be invoked from within another. This is similar to, for example, the require instruction in Perl.

Of course, this means that any PostScript which uses the run keyword can only be viewed if the invoked file exists on the filesystem; therefore before the PostScript can be printed, e-mailed elsewhere, or converted to PDF to be put on a website, the run statement must be removed and the contents of the invoked file must be included. include_run performs this task.

If a file is invoked by more than one run statement it only gets included once; this behaviour is also similar to the require instruction in Perl.

include_run does recurse; in other words, the invoked file can itself use a run statement.


RESTRICTIONS

In order to dodge the general PostScript-parsing problem, the filename must be a literal string, enclosed in brackets (), and must be followed by its run statement; include_run can not cope with even slightly obfuscated PostScript.


BUGS

If a valid (...) run command is part of a literal string, it will get included anyway. It could be argued that this is a feature, but in fact it's a bug.


AUTHOR

Peter J Billam www.pjb.com.au/comp/contact.html


SEE ALSO

See also


CHANGES

20030613 Include all run-files into a PostScript file
20030613 will now recurse

Back to P J B Computing or to www.pjb.com.au . . .