luser-dr00g / xpost

A PostScript interpreter in C
Other
93 stars 12 forks source link

Dictionaries should store access level in VM to fit postscript semantics #9

Closed GoogleCodeExporter closed 7 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. 1 dict dup readonly pop
2. /a 1 put
3. should trigger an /invalidaccess error

What is the expected output? What do you see instead?

Dictionaries (and files) have the same access in all shared copies 
of the object. So the access functions in xpost_object.c should store the 
access level in vm with the data so it is shared.

Please use labels and text to provide additional information.

Original issue reported on code.google.com by luser.droog on 30 Oct 2013 at 9:21

GoogleCodeExporter commented 9 years ago
This may take a bit of thought as to how to do it nicely. It may need to wait 
until xpost_dict is moved to the library. It will require overriding the normal 
behavior of xpost_object_get/set_access() with a new function that looks up the 
dict's metadata in vm.

The (only) model (I can think of) is the way the free-list allocator overrides 
the memory-table allocator, by adding a function-pointer, a flag, and a 
registration function. files will also need to use this access semantics, I 
think. So I think the override functions should also specify the object type 
that should use this function. So, perhaps it should be a vector of 
function-pointers, predefined to use the default access get/set pair, but 
automatically called through the table.

Original comment by luser.droog on 18 Jan 2014 at 7:58

GoogleCodeExporter commented 9 years ago
I've implemented the shared access field in VM. 

But I did not add the invalidaccess error, because then xpost can't load 
systemdict.

I must be setting it to readonly too early somewhere.

Original comment by luser.droog on 22 Feb 2015 at 9:04

luser-dr00g commented 7 years ago

This is long fixed. There is a specific exception in the PLRM for userdict to be defined in systemdict, which otherwise violates the locals in globals prohibition.