Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!chinacat!woody From: woody@chinacat.Unicom.COM (Woody Baker @ Eagle Signal) Newsgroups: comp.lang.postscript Subject: Re: PS -> C code Summary: well... Message-ID: <1409@chinacat.Unicom.COM> Date: 19 Jul 90 04:13:22 GMT References: <1990Jul18.002555.13464@gpu.utcs.utoronto.ca> <6676@helios.TAMU.EDU> Organization: a guest of Unicom Systems Development, Austin Lines: 32 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