Thread View: comp.lang.postscript
4 messages
4 total messages
Started by Jonathan Monsarrat
Mon, 24 Aug 1992 02:35
Compiling PostScript code
Author: Jonathan Monsarrat
Date: Mon, 24 Aug 1992 02:35
Date: Mon, 24 Aug 1992 02:35
31 lines
1070 bytes
1070 bytes
I really like to use names of more than 5 letters and put foolish
things like whitespace between my PostScript commands.
Is there a "PostScript Compiler" that generates compressed PS from
big ol' whitespace-filled long-named PS?
For example, the below routine would be transformed
% This function does some cool stuff
/MyFunctionMapper
{
/elvis 2 def
/manilow 3 def
/berry 4 def
/jackson elvis manilow add berry add def
jackson
} bind def
Into this:
/d /def load def
/A{/e 2 d /m 3 d /b 4 d /j e m add b add d j} bind d
Although I suppose a REALLY GREAT compiler might just compiler this into:
9
Thanks.
-Jon Monsarrat
PS love { HONK } if
Re: Compiling PostScript code
Author: Jim DeLaHunt
Date: Fri, 28 Aug 1992 03:21
Date: Fri, 28 Aug 1992 03:21
39 lines
1560 bytes
1560 bytes
In article <1992Aug24.023510.25470@cs.brown.edu> jgm@cs.brown.edu (Jonathan Monsarrat) writes:
>Is there a "PostScript Compiler" that generates compressed PS from
>big ol' whitespace-filled long-named PS?
Do you have a C compiler available? Use its preprocessor to macro-
substitute short names for long ones. To use your example:
/d /def load def
#define def d
#define MyFunctionMapper A
#define elvis e
/* etc.... */
% This function does some cool stuff
/MyFunctionMapper
{
/elvis 2 def % etc....
/jackson elvis manilow add berry add def
jackson
} bind def
After C pre-processing you'd have:
/d /def load def
% This function does some cool stuff
/A
{
/e 2 d % etc....
/j e m add b add d
j
} bind d
PackPS could then get rid of the comments and whitespace for you.
I've used this technique on a major PostScript language project and it has
worked great!
--Jim DeLaHunt, Developer Support, Adobe Systems Incorporated
delahunt@adobe.com ...!{apple,decwrl}!adobe!delahunt +1-415-962-3790
Re: Compiling PostScript code
Author: Peter da Silva
Date: Fri, 28 Aug 1992 12:41
Date: Fri, 28 Aug 1992 12:41
25 lines
1580 bytes
1580 bytes
In article <1992Aug28.032106.28216@adobe.com> delahunt@adobe.com (Jim DeLaHunt) writes:
>In article <1992Aug24.023510.25470@cs.brown.edu> jgm@cs.brown.edu (Jonathan Monsarrat) writes:
>>Is there a "PostScript Compiler" that generates compressed PS from
>>big ol' whitespace-filled long-named PS?
>Do you have a C compiler available? Use its preprocessor to macro-
>substitute short names for long ones.
I would recommend against that. The problem is that cpp "knows" about C, and
different implementations may do different things if the input isn't valid C.
For example, some tokenize to C tokens on input (like one I used on a DEC20)
and will make a complete hash of things:
(This is a "string" "like this"\367)
Might become:
( This is a "stringlike this" ? 367 )
Use sed, or m4, or some other generalised text processing or macro tool.
--
`-_-'
Have you hugged your wolf today? 'U`
Peter da Silva, Taronga Park BBS, Houston, TX +1 713 568 0480/1032
Re: Compiling PostScript code
Author: Stan Chesnutt
Date: Sat, 29 Aug 1992 01:21
Date: Sat, 29 Aug 1992 01:21
24 lines
1281 bytes
1281 bytes
In article <1992Aug28.032106.28216@adobe.com> delahunt@adobe.com (Jim DeLaHunt) writes:
>Do you have a C compiler available? Use its preprocessor to macro-
>substitute short names for long ones. To use your example:
>
>/d /def load def
>#define def d
>
>#define MyFunctionMapper A
>#define elvis e
>/* etc.... */
Be careful with this approach, as the C preprocessor will perform
substitutions (macro conversions) upon PostScript strings, which are
delimited by parentheses. You may get your text strings (incorrectly)
shortened.
C-preprocessor substitution stops at a C-string boundary, which is
the double-quote.
Stan
--
-----------------------------------------------------------------------------
Stan Chesnutt, Adobe Systems chesnutt@adobe.com {sun|decwrl}!adobe!chesnutt
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads