| <<<Back 1 day (to 2018/08/05) | 20180806 |
rnissl | Hi kens, PS forms work ;-) | 14:33.04 |
kens | Cool | 14:33.17 |
rnissl | just a minor implementation issue of execform | 14:33.36 |
kens | Remember, PDF forms are *not* preserved liek this, so if you round trip PS->PDF->PDF then you will get an explosion in size | 14:33.46 |
rnissl | if form dict is in global memory, /Implementation cannot be created by execform when setglobal is false | 14:34.25 |
| execform fails with invalid access error | 14:34.50 |
kens | That's true, because you can't store a local object in global VM | 14:34.58 |
rnissl | the reference manual doesn't tell anything about how that case is to be implemented | 14:35.50 |
| but /Implementation shall even be able to be created by execform when dict is already readonly | 14:36.31 |
kens | Hmmm | 14:36.43 |
| readonly only prevents *PostScript* from writing to the dictionary, not the interpreter itself | 14:37.06 |
rnissl | so I think, execform should take care to adjust the allocation mode for /Implementation according to dict | 14:37.12 |
kens | But you still can't put a locally created object in a global VM object | 14:37.26 |
| rnissl: No, its up to you to get the VM state correct. | 14:37.37 |
| Why are you allocating the form dictionary in global VM anyway ? | 14:38.02 |
rnissl | yes, but it's execform which creates the local object to be put into /Implementation key | 14:38.02 |
kens | Yes, which means that you need to have the allocation mode correct at the time you execute execform | 14:38.29 |
rnissl | sure, in that way I got it working but it is less user friendly | 14:38.58 |
kens | Nobody ever accused PostScript of being user friendly | 14:39.15 |
| And surely the user friendly approach is to allocate the form dictionary in local VM as well | 14:39.36 |
| In general you should not mess with global VM | 14:39.44 |
rnissl | I played with findresource an it will either return a user or global object, depending on where it was created for example by defineresource | 14:40.13 |
kens | Well you got it working, so lets not worry about it :) | 14:40.56 |
rnissl | so one would first need to figure out the allocation mode of the dict, adjust setglobal, run execform and revert setglobal | 14:40.58 |
kens | I'm baffled as to why you have a form dictionary defined in global VM | 14:41.30 |
rnissl | I haven't read anything about having to so, so I guess, execform should take care of creating /Implementation accordingly | 14:42.45 |
kens | No, its generally up to you to get the VM allocation mode correct. | 14:43.15 |
| execform isn't allowed to change the VM allocation mode | 14:43.28 |
| That could lead to unexpected results. | 14:43.38 |
rnissl | why global VM: the form is defined on page 1 and reused on all following pages | 14:43.42 |
kens | How can I answer that ? I haven't seen your program | 14:45.28 |
| But in general, Ghostscript's form handlign normally works, though its not commonly used in PostScript programs | 14:45.57 |
rnissl | this is the answer to your question, why I allocate the forms dict in global VM. | 14:46.18 |
kens | Then I didn't understand the answer | 14:46.40 |
| You don't need to allocate the form dict in global VM just because you are using it on multiple pages | 14:46.57 |
| Or you shouldn't have to, anyway | 14:47.16 |
rnissl | ok, I must admit, in this special case there is a save restore pair around my code. | 14:48.08 |
kens | Then you probably don't want to do that | 14:48.34 |
rnissl | so without global vm, my resource won't persist | 14:48.41 |
kens | You shoudl put the form definition outside the save and restore | 14:48.44 |
| And if you don't, and define the form in global VM, then you must make sure teh VM allocation mode is global when executing the form | 14:49.13 |
| In short; don't use global VM without a really good reason | 14:49.32 |
| If you think you need to use VM then you probably need to rethink your program design | 14:49.55 |
| There can be good reasons for using global VM of course, but they are unusual | 14:50.16 |
rnissl | and if PaintProc relies on beeing executed in local memory, I have to switch it back there and restore it before leaving PaintProc -- that's how I solved it | 14:50.28 |
kens | And if you do, then its up to you to make sure the allocation mode is correct throughout your program | 14:50.33 |
rnissl | ok, let's put it short -- I've found a working solution, although I find execform's behaviour inconvenient when used in combination with findresource | 14:54.13 |
kens | Well, as I say, that's really down to you using global VM, that has implications throughout the PostScript interpreter | 14:54.49 |
rnissl | thanks for your support kens, bye. | 14:55.44 |
kens | |NP bb | 14:55.54 |
| Forward 1 day (to 2018/08/07)>>> | |