Friday, June 22, 2007

PostScript libraries

I've been writing some PostScript lately, such as matrix multiplication routines: things that really belong in a library. So I spent a good chunk of time today writing some software for preparing postscript files to be libraries. I wrote a Perl script `curdle` which takes a PostScript file as input and compresses it to a binary encoding with no comments and minimal spaces. At some point I'll add a script which will rename long internal variable names (as directed by comments). Once the file is compacted, it can be run through encode85 (which I found on some random FTP site) and put into a resource file a big block of gibberish, which is then either included automatically by the PostScript viewer, or else pasted at the top of the PostScript file which includes it. In any case, it should help significantly with PostScript library version control. Especially when I automate the resource part and include a "built on" date in the header.

If you're interested you can get the most up-to-date version of it with darcs (or just browse to this directory):

darcs get http://www.physics.cornell.edu/~shicks/darcs/pslib/