Bug 692600 - Parameters are not being sent to device driver via setpagedevice in git version
Summary: Parameters are not being sent to device driver via setpagedevice in git version
Status: NOTIFIED WORKSFORME
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Client API (show other bugs)
Version: master
Hardware: PC Windows XP
: P2 normal
Assignee: Ray Johnston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-14 16:58 UTC by Leonid Lukomskij
Modified: 2011-11-09 18:18 UTC (History)
0 users

See Also:
Customer: 582
Word Size: ---


Attachments
my get_params and put params (787 bytes, text/plain)
2011-10-14 17:33 UTC, Leonid Lukomskij
Details
put_params.c (455 bytes, text/x-csrc)
2011-10-14 18:41 UTC, Ray Johnston
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Leonid Lukomskij 2011-10-14 16:58:53 UTC
You fixed several bugs reported by me.

So I built git version and tried to work with it.

But I found problem with parameters sending to device driver.

I set param in my prefix in follow fashion:

<</MyParam 1>> setpagedevice

I get param in my device driver via param_read_int

But I never get 1 - param is always 0.
Comment 1 Ray Johnston 2011-10-14 17:10:42 UTC
Please attach your custom 'get_params' and 'put_params'. Without this we can't
help.
Comment 2 Leonid Lukomskij 2011-10-14 17:33:54 UTC
Created attachment 8010 [details]
my get_params and put params

This code worked with previous versions of gs, but doesn't work with git
Comment 3 Ray Johnston 2011-10-14 18:41:59 UTC
Created attachment 8011 [details]
put_params.c

I don't see any obvious reason why "Thinning" shouldn't make it through to as
a custom parameter. However, 'put_params' is not supposed to change the device
unless ALL of the setting is successful (per the setpagedevice spec), so I
recommend changing your put_params to something like the attached. This only
sets the parameter AFTER the call to gdev_prn_put_params succeeds.
Comment 4 Leonid Lukomskij 2011-10-18 12:37:16 UTC
So I made what you suggest. But I still have problems. 

On second call of my put_params gdev_prn_put_params (this is first call in my function now) returns -21.

As the result interpretation stops with error

Unrecoverable error: undefined in .putdeviceprops

What does this mean?
Comment 5 Leonid Lukomskij 2011-10-18 12:37:44 UTC
So I made what you suggest. But I still have problems. 

On second call of my put_params gdev_prn_put_params (this is first call in my function now) returns -21.

As the result interpretation stops with error

Unrecoverable error: undefined in .putdeviceprops

What does this mean?
Comment 6 Ray Johnston 2011-10-20 01:40:05 UTC
I'll have a look into this. Keeping it as a 'bug' for now.
Comment 7 Ray Johnston 2011-10-20 16:46:29 UTC
Please re-run the -21 (undefined) error with:
   -dSETPDDEBUG -dOSTACKPRINT -dESTACKPRINT
and attach the log.
Comment 8 Leonid Lukomskij 2011-10-21 16:00:37 UTC
I added these parameters to the GS DLL call, but I don't have any additional output in log.

Can problem be that I don't use command line but use gs dll as is?
Comment 9 Ray Johnston 2011-10-21 19:13:48 UTC
The problem may be that your application isn't collecting the stdout.

Do you have a call to gsapi_set_stdio ??? If so, do your functions write the
data to a file that you can capture ??? See the usage examples in psi/dwmainc.c

We can't do much without the requested information from stdout and stderr.
Comment 10 Leonid Lukomskij 2011-10-24 16:11:01 UTC
My applications collects stdout, but it doesn't contain any output.

Actually I found place where error -21 is. This is function ref_param_read_commit. It seems it requires all parameters to be read. But my (custom) parameters was not read => error.

So I have impression that it's incorrect to call gdev_prn_put_params before custom params reading.

So we are in the very beginning
Comment 11 Ray Johnston 2011-10-24 16:19:14 UTC
As I described in comment #3, you collect your additional parameters BEFORE
calling gdev_prn_put_params, but NOT apply the changes in case the call
to gdev_prn_put_params encounters an error. Only after gdev_prn_put_params
returns >=0 should you change the values that actually affect your custom
device. Until then the values should be kept in temporary variables in your
put_params function.
Comment 12 Leonid Lukomskij 2011-10-24 17:00:09 UTC
So I actually do this, but I never get my parameter, I get 0 in any cases.
Comment 13 Ray Johnston 2011-10-24 17:53:49 UTC
There must be an error in your invocation of the
   <</MyParam 1>> setpagedevice

Note that parameters are case sensitive. Until you can get the output from
-dSETPDDEBUG there is nothing we can do.
Comment 14 Ray Johnston 2011-11-03 20:11:44 UTC
No new information, so closing as WORKSFORME. Please re-open if you get the log files.