Skip to main content
October 30, 2013
Question

Save/restore in PostScript

  • October 30, 2013
  • 1 reply
  • 1237 views

Hi,

I'm student of SPbSU. I have the work "Compiling PostScript's programs into Java byte-code" in this year.
Can anyone explain, how does save/restore work with composite objects? How does "save" do the snapshot, when many composite objects share the same value. Does it change references?  How does PostScript restore their references afterwards ?  It is necessary to understand because it's not clear how to realize these operators in Java.

Thanks,
Artur.

This topic has been closed for replies.

1 reply

Legend
October 31, 2013

You have an interesting challenge. The definition of the effect of save is in the PostScript Language Reference. There are no rules about how it is done. Because composite objects are large, they are not usually actually duplicated. There are a number of possible implementations, but one possibility is to store as part of the composite definition the level to which it belongs, then duplicate-on-write. You would probably need to implement your own primitive objects as classes, for all PostScript object types, rather than use the direct Java implementation because every type of PostScript object has special properties not available to Java (e.g. literal/executable). Really, you are writing a PostScript interpreter, be aware that this is likely to be many years of work.