Bug 687375 - Add early parameter validation.
Summary: Add early parameter validation.
Status: RESOLVED WONTFIX
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: General (show other bugs)
Version: master
Hardware: All All
: P5 enhancement
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-21 13:57 UTC by Alex Cherepanov
Modified: 2013-06-12 09:03 UTC (History)
3 users (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Cherepanov 2004-03-21 13:57:18 UTC
Current way of passing options to PS programs ( -d -s ) doesn't
check the name of the defined variable and its value. This is a 
source of easily preventable user errors and support costs. 

GS can define new options ( or reuse -D -S ) to reject unknown
variable names and validate the values. This can be easily done
by running a program associated with the name from a spacial dictionary.
Comment 1 Ray Johnston 2004-03-24 10:20:05 UTC
In the existing command line processing, the parameters for devices
are open ended this would be difficult or impossible.

We have talked about coming up with a new, better command line handler
where we could organize the device parameters separate from parameters
that are intended to affect the interpreter.

When we do this, the checking and error messages for command line 
options for 'ngs' can take this into account.
Comment 2 Alex Cherepanov 2004-03-24 11:23:57 UTC
'ngs' may happen even after PostScript debugger. The proposed approach
can be implemented in days and cover all the supported devices.
The old -d -s should not be changed or removed.
Comment 3 leonardo 2006-07-18 13:17:36 UTC
I agree with Alex that a dictionary of handlers would work excellent, but I do 
not agree that it's a work for days. 

The most complicated problem here is that PS code handles parameters in 
Postscript, and devices do in C. To install a handler from C we either need a 
special interface for devices to add PS code (which won't work for the PCL 
interpreter), or a way for devices to associate a C code to the parameter 
handler in Postscript (which again won't work for PCL interperetr).

Thus Ray's suggestion "organize the device parameters separate from parameters
that are intended to affect the interpreter" becomes the first step. I guess it 
should be something like this :

   -sDEVICE=pdfwrite(EmbedAllFonts=false,AlwaysEmbed=
[false,/Helvetica],RotatePages=/None) 

and we get another big problem with the syntax.

Thus2 the dictionary of handlers isn't a dictionary, or at least it isn't a 
Postscript dictionary. It may be a list of [key, procedure] pairs, 
where 'procedure' is either C code or PS code. If it is a PS code, the argument 
list processor will implement Postscript callouts.

Well, all this may be done in few monthes. 
Comment 4 Alex Cherepanov 2006-07-18 13:56:52 UTC
A complete solution may be rather difficult to implement but I still think
that a useful partial validation can be done as a week-end hack.

Comment 5 Shailesh Mistry 2011-07-11 19:34:41 UTC
Enhancement still missing in Ghostscript 9.03
Comment 6 Ken Sharp 2013-06-12 09:03:10 UTC
After 9 years, I think we should just close this. The thread doesn't contain any real useful suggestions (though there are allusions to some  ideas), there isn't a patch and we've managed OK in the interim.

If we still want to improve command line processing then someone should take it up as a project.