Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!purdue!decwrl!adobe!greid From: greid@adobe.com (Glenn Reid) Newsgroups: comp.lang.postscript Subject: Re: PS libraries Message-ID: <775@adobe.UUCP> Date: 24 Apr 89 19:27:48 GMT References: <2994@daisy.UUCP> Sender: news@adobe.COM Reply-To: greid@adobe.COM (Glenn Reid) Organization: Adobe Systems Incorporated, Mountain View Lines: 62 In article <2994@daisy.UUCP> cplai@daisy.UUCP (Chung-Pang Lai) writes: > >Just like a C program, we can use predefined functions by #include >and many many other packages. C is a compiled language, the unresolved >references to the external routines are handled by the linker. In an >interpretive language like PS, the unresolved references can be handled >by a preprocessor and the functions' definition is downloaded to the printer >before the job is. If the preprocessor is well written, it will include >only the function needed and hence reduce the download time to the printer. This is a good idea, of course. >Imagine if you need to print 10 Adobe illustrator files, the Adobe prolog >is inside each file and hence is download to the printer 10 times. However, >if Adobe release an Illustrator library, and the Illustrator program only >output the script portion, then the files are much much smaller and the >printing is much faster because the prolog is down load only once. >e.g. cat Illust.lib pic1.art ... pic10.art I did this very thing when writing a book that used Illustrator drawings. >Seem like this can be done without any modification to the language. Perhaps >a %%include meta-comment can be added to the conforming PS standard. It is >just a matter of changing the coding convention. It's already there. When was the last time you read through it? >Why wasn't it done? Did I miss something? Yes, you did. Look at the %%IncludeFile, %%ExecuteFile, %%IncludeProcSet, %%BeginFile, %%EndFile, %%BeginProcSet, %%EndProcSet, %%BeginSetup, %%EndSetup, and %%EndProlog comments. They all contribute to this idea. The hardest part about this is that PostScript programmers notoriously neglect this kind of possibility. For example, consider the following piece of code, which, despite the comments, you can't factor into one prologue plus more than one instance of the script. It's pretty common: %!PS-Adobe-2.0 %%EndComments /myprog save def %%BeginProcSet: prologue 1.0 0 /proc1 { a b c } def /proc2 { a b 2 div c 2 mul } bind def %%EndProcSet: prologue 1.0 0 %%EndProlog %%Page: 1 1 (whatever) proc1 proc2 %%Trailer myprog restore %%EOF Since the "save" is done inside the prologue, and the restore is done at the end of the document, it will only work once. Incidentally, that makes the file NON-CONFORMING, despite the comments that claim that it is a conforming document. Anyway, it is all a good idea and worth doing. Glenn Reid Adobe Systems