[comp.sys.next] pswrap problems

jl3p+@andrew.cmu.edu (James Ting Lui) (02/28/91)

I have been experimenting with pswrap and postscript.
My driver application executes the following:

    printf( "JUNK!\n" );
    dojunk(3.14159);

and my pswrap code contains:

    defineps dojunk( float junk )
    (***)
    junk
    (*** junk ***)
    pstack
    clear
    endps

Not too complicated:  PI is passed to dojunk() which
then puts it on the stack and is printed out on my terminal.

When this is run, however, my result is this:

    JUNK!
    DPS client library error: PostScript program error, DPSContext 124150
    %%[ Error: undefinedresult; OffendingCommand: bin obj seq, type=128,
  elements=3, size=28 ]%%
    (*** junk *** )
    3.14159
    (***)
    DPS client library error: Invalid tag in returned object, DPSContext
    124150, data 1141552
    DPS client library error: Invalid tag in returned object, DPSContext
124150, data 1141092

I don't understand what all the errors are about.
Someone please help me on this.

Thanks a lot,
  -- Jim

wiml@milton.u.washington.edu (William Lewis) (02/28/91)

In article <Qbn4CxC00WBM81_YVm@andrew.cmu.edu> jl3p+@andrew.cmu.edu (James Ting Lui) writes:
>    defineps dojunk( float junk )
>    (***)
>    junk
>    (*** junk ***)
>    pstack
>    clear
>    endps

   (leads to)

>    DPS client library error: PostScript program error, DPSContext 124150
>    %%[ Error: undefinedresult; OffendingCommand: bin obj seq, type=128,
>  elements=3, size=28 ]%%


      Basically, the trouble is that pswrapped functions aren't supposed
to send anything back on stdout. The manual says this somewhere. What's 
probably happening is that the binary object sequence containing the
results of "pstack" are interpreted by the unwary C half of the pswrap
as being some sort of return data, causing confusion & wreaking havoc.



-- 
 wiml@milton.acs.washington.edu       Seattle, Washington   
     (William Lewis)   |  47 41' 15" N   122 42' 58" W  
 "Just remember, wherever you go ... you're stuck there."