mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 17:56:50 -06:00
The PostScript Language Reference (3rd ed., §3.7.3 "Save and Restore") has `restore` reset composite objects in local VM to their values at the `save`. The reader only restored the graphics state, so dictionary entries changed between `save` and `restore` stayed changed: a program that counts its open saves in a dictionary and refuses to go past a depth stopped after that many saves in sequence, and the file fell back to its preview. EPS files with many images, each drawn between `save` and `restore`, are a likely case of #505; its reporter hasn't sent a file, so this is part of it. - While a `save` is open, `def`, `store`, `put`, `undef` and dictionary `copy` keep each entry's old value in a journal (counted against the memory budget); `restore` undoes it, newest change first, down to its save. A save restored already, itself or through an outer one, is no longer valid (`invalidrestore`, §3.7.3). - `cachestatus` reports a device's cache sizes (chapter 8) instead of zeros: its last value, the most bytes one cached glyph may take, is what programs divide by. - Tests (programs written from the reference): 100 saves counted in a dictionary under a depth limit, each dictionary change undone, saves restored twice, `cachestatus`'s glyph limit. Mutation-checked: without the journal or with a zero `cachestatus` the test fails. The import fuzz vocabulary has saves and restores around dictionary changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>