[comp.text] Eroff

etan@tellab5.tellabs.com (Nate Stelton) (05/30/90)

When using a PostScript-importing command in eroff (such as .cS), is there a
way to make troff interpret a variable that is inserted into the PostScript
code segment.  I tried to do this, but apparently troff will strictly ignore
anything in the code. Does anyone know how to get around this to insert (for
example) \n% as the current page number?

Nate Stelton

bobs (Bob Stayton, Yoyodoc) (06/07/90)

In article <2697@tellab5.tellabs.com> etan@tellab5.tellabs.com (Nate Stelton) writes:
>
>When using a PostScript-importing command in eroff (such as .cS), is there a
>way to make troff interpret a variable that is inserted into the PostScript
>code segment.  I tried to do this, but apparently troff will strictly ignore
>anything in the code. Does anyone know how to get around this to insert (for
>example) \n% as the current page number?

With macros like .cS that call an external Postscript file,
troff never sees the Postscript code.  Troff produces
a ditroff file that also has just a reference to the
external Postscript filename.  The PS code is inserted 
by the eps postprocessor that converts ditroff to
Postscript.

The following method may not work for your needs if you are
trying to insert a picture file, but it is a general technique
for passing parameter values from a troff file.

When I want to pass parameters to a Postscript procedure, I
define the PS procedure in a file called prolog, and then add this
line to the top of my troff macro file:

\!!prologcode@/u/lib/prolog

This adds my procedure to the eroff prolog.  Then I access the
PS procedure like this from my troff file:

\X'code="\\\\*(BW \\\\n(B3 \\\\n(B2 psprocedure"' 

The BW is a define string, B3 and B2 are number
registers, and psprocedure is the name of my procedure,
which expects three values on the stack.
Since this is processed by troff, the correct string and
number values are substituted before \X is executed.

bobs
Bob Stayton                                 425 Encinal Street
Technical Publications                      Santa Cruz, CA  95060
The Santa Cruz Operation, Inc.              (408) 425-7222
                                            ...!uunet!sco!bobs
/* I don't speak for my company and they don't speak for me. */