[comp.lang.postscript] PS -> C code

xiao@gpu.utcs.utoronto.ca (Yan Xiao) (07/18/90)

Does anybody out there in postscript land have the program that transforms
Postscript to C, or know where I can find?

I once saw a posting about such a ps to C transformer, but I did not follow
up.

Any help is appreciated, and I will summerize the result if anything positive
comes up.

xiao

skdutta@cs.tamu.edu (Saumen K Dutta) (07/19/90)

>Does anybody out there in postscript land have the program that transforms
>Postscript to C, or know where I can find?
>
>I once saw a posting about such a ps to C transformer, but I did not follow
>up.
>
>Any help is appreciated, and I will summerize the result if anything positive
>comes up.

When every machine/system uses a different graphics library/model how can there
be a universal postscript to C transformer?. 

If such a thing exist even in limited domain (or a partial transformer)
I am interested in it. Please send me a mail too!
--
     _                                   ||Internet: skdutta@cssun.tamu.edu  
    (   /_     _ /   --/-/- _            ||Bitnet : skd8107@tamvenus.bitnet 
   __)_/(_____(_/_(_/_(_(__(_/_______    ||Uucp : uunet!cssun.tamu.edu!skdutta
                                 ..      ||Yellnet: (409) 846-8803

woody@chinacat.Unicom.COM (Woody Baker @ Eagle Signal) (07/19/90)

While I'n not aware of any ps to 'C' converters, I have done a bit of
experimenting along the line of creating postscript programs in 'C'.
Basicaly, I wrote a short program that read in a postscript file line
at a time, and wrapped printf () statements around each line.  When it
got done, there was a 'C' program consisting of lines of printf's.
Then I went in and modified the lines that needed variables such that
the printf's would generate lines of postscript with substitued variables.
I did this first with BASIC.  The technique is powerful and works.

In addition, I created a set of routines (a small number) that bear the
same names as postscript primatives, as well as routines to draw boxes etc.
These functions take parameters and generate postscript code.  Since
'C' (mercifully) is not a RPN language, you do have some difficulty with
parameters, but it turns out that you can create routines that are essentialy
the same in functionality as ps routines.  This drasticaly eases the
creation of programs that produce postscript code.

example

curveto(x1,y1,x2,y2,x3,y3) /* assumes a current point is set already */
int x1,y1,x2,y2,x3,y3;
{
	printf("%d %d %d %d %d %d curveto ",x1,y1,x2,y2,x3,y3);

}

etc, etc.

Cheers
Woody

glenn@heaven.woodside.ca.us (Glenn Reid) (07/19/90)

In article <1990Jul18.002555.13464@gpu.utcs.utoronto.ca> xiao@gpu.utcs.utoronto.ca (Yan Xiao) writes:
>Does anybody out there in postscript land have the program that transforms
>Postscript to C, or know where I can find?

Just out of curiosity, what on earth do you have that's written in
PostScript that you wish were written in C?

Although, come to think of it, that just about describes my Distillery
program :-)

/Glenn

-- 
 Glenn Reid				PostScript/NeXT consultant
 glenn@heaven.woodside.ca.us		Independent Software Developer
 ..{adobe,next}!heaven!glenn		415-851-1785

wolit@cbnewsm.att.com (Jan Wolitzky) (07/19/90)

See "InScript -- a C-like preprocessor for PostScript,"
Jakob Gonczarowski and On G. Paradise, Electronic Publishing,
2(3), pp 157 - 167, October, 1989.

-- 
Jan Wolitzky, AT&T Bell Labs, Murray Hill, NJ; 201 582-2998
    att!mhuxd!wolit or jan.wolitzky@att.com
(Affiliation given for identification purposes only)

glenn@heaven.woodside.ca.us (Glenn Reid) (07/20/90)

In article <1990Jul19.152926.18868@cbnewsm.att.com> wolit@cbnewsm.att.com (Jan Wolitzky) writes:
>See "InScript -- a C-like preprocessor for PostScript,"
>Jakob Gonczarowski and On G. Paradise, Electronic Publishing,
>2(3), pp 157 - 167, October, 1989.

That goes the other way, as I recall.  InScript generates PostScript
from C-like constructs, not the other way around.  It uses PostScript
as a kind of assembly language :-)

-- 
 Glenn Reid				PostScript/NeXT consultant
 glenn@heaven.woodside.ca.us		Independent Software Developer
 ..{adobe,next}!heaven!glenn		415-851-1785