]>
git.ipfire.org Git - thirdparty/cups.git/blob - cups/extended.c
2 * "$Id: extended.c 4494 2005-02-18 02:18:11Z mike $"
4 * Extended option routines for the Common UNIX Printing System (CUPS).
6 * Copyright 1997-2005 by Easy Software Products, all rights reserved.
8 * These coded instructions, statements, and computer programs are the
9 * property of Easy Software Products and are protected by Federal
10 * copyright law. Distribution and use rights are outlined in the file
11 * "LICENSE.txt" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636 USA
20 * Voice: (301) 373-9600
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
24 * PostScript is a trademark of Adobe Systems, Inc.
26 * This file is subject to the Apple OS-Developed Software exception.
30 * ppdFindExtOption() - Return a pointer to the extended option.
31 * ppdMarkCurve() - Mark an extended curve option.
32 * ppdMarkGamma() - Mark an extended gamma option.
33 * ppdMarkInteger() - Mark an extended integer option.
34 * ppdMarkIntegerArray() - Mark an extended integer array option.
35 * ppdMarkReal() - Mark an extended real option.
36 * ppdMarkRealArray() - Mark an extended real array option.
37 * ppdMarkText() - Mark an extended text option.
41 * Include necessary headers...
53 static void ppd_unmark_choices(ppd_option_t
*option
);
57 * 'ppdFindExtOption()' - Return a pointer to the extended option.
60 ppd_ext_option_t
* /* O - Pointer to option or NULL */
61 ppdFindExtOption(ppd_file_t
*ppd
, /* I - PPD file data */
62 const char *option
) /* I - Option/Keyword name */
64 int i
; /* Looping var */
65 ppd_ext_option_t
**o
; /* Pointer to option */
68 if (ppd
== NULL
|| option
== NULL
)
71 for (i
= ppd
->num_extended
, o
= ppd
->extended
; i
> 0; i
--, o
++)
72 if (strcasecmp(o
[0]->keyword
, option
) == 0)
80 * 'ppdFindExtParam()' - Find an extended parameter.
83 ppd_ext_param_t
* /* O - Parameter or NULL */
84 ppdFindExtParam(ppd_ext_option_t
*opt
, /* I - Option */
85 const char *param
)/* I - Parameter name */
87 int i
; /* Looping var */
88 ppd_ext_param_t
**p
; /* Pointer to parameter */
91 if (opt
== NULL
|| param
== NULL
)
94 for (i
= opt
->num_params
, p
= opt
->params
; i
> 0; i
--, p
++)
95 if (strcasecmp(p
[0]->keyword
, param
) == 0)
103 * 'ppdMarkCurve()' - Mark an extended curve option.
106 int /* O - Number of conflicts */
107 ppdMarkCurve(ppd_file_t
*ppd
, /* I - PPD file */
108 const char *keyword
, /* I - Option name */
109 const char *param
, /* I - Parameter name */
110 float low
, /* I - Lower (start) value */
111 float high
, /* I - Upper (end) value */
112 float gvalue
) /* I - Gamma value for range */
114 ppd_ext_option_t
*o
; /* Extended option */
115 ppd_ext_param_t
*p
; /* Extended parameter */
118 if ((o
= ppdFindExtOption(ppd
, keyword
)) == NULL
)
121 if ((p
= ppdFindExtParam(o
, param
)) == NULL
)
124 ppd_unmark_choices(o
->option
);
126 return (ppdConflicts(ppd
));
131 * 'ppdMarkGamma()' - Mark an extended gamma option.
134 int /* O - Number of conflicts */
135 ppdMarkGamma(ppd_file_t
*ppd
, /* I - PPD file */
136 const char *keyword
, /* I - Option name */
137 const char *param
, /* I - Parameter name */
138 float gvalue
) /* I - Gamma value */
140 ppd_ext_option_t
*o
; /* Extended option */
141 ppd_ext_param_t
*p
; /* Extended parameter */
144 if ((o
= ppdFindExtOption(ppd
, keyword
)) == NULL
)
147 if ((p
= ppdFindExtParam(o
, param
)) == NULL
)
150 ppd_unmark_choices(o
->option
);
152 return (ppdConflicts(ppd
));
157 * 'ppdMarkInteger()' - Mark an extended integer option.
160 int /* O - Number of conflicts */
161 ppdMarkInteger(ppd_file_t
*ppd
, /* I - PPD file */
162 const char *keyword
, /* I - Option name */
163 const char *param
, /* I - Parameter name */
164 int value
) /* I - Option value */
166 ppd_ext_option_t
*o
; /* Extended option */
167 ppd_ext_param_t
*p
; /* Extended parameter */
170 if ((o
= ppdFindExtOption(ppd
, keyword
)) == NULL
)
173 if ((p
= ppdFindExtParam(o
, param
)) == NULL
)
176 ppd_unmark_choices(o
->option
);
178 return (ppdConflicts(ppd
));
183 * 'ppdMarkIntegerArray()' - Mark an extended integer array option.
186 int /* O - Number of conflicts */
187 ppdMarkIntegerArray(ppd_file_t
*ppd
, /* I - PPD file */
188 const char *keyword
,/* I - Option name */
189 const char *param
, /* I - Parameter name */
191 /* I - Number of values */
192 const int *values
) /* I - Values */
194 ppd_ext_option_t
*o
; /* Extended option */
195 ppd_ext_param_t
*p
; /* Extended parameter */
198 if ((o
= ppdFindExtOption(ppd
, keyword
)) == NULL
)
201 if ((p
= ppdFindExtParam(o
, param
)) == NULL
)
204 ppd_unmark_choices(o
->option
);
206 return (ppdConflicts(ppd
));
211 * 'ppdMarkReal()' - Mark an extended real option.
214 int /* O - Number of conflicts */
215 ppdMarkReal(ppd_file_t
*ppd
, /* I - PPD file */
216 const char *keyword
, /* I - Option name */
217 const char *param
, /* I - Parameter name */
218 float value
) /* I - Option value */
220 ppd_ext_option_t
*o
; /* Extended option */
221 ppd_ext_param_t
*p
; /* Extended parameter */
224 if ((o
= ppdFindExtOption(ppd
, keyword
)) == NULL
)
227 if ((p
= ppdFindExtParam(o
, param
)) == NULL
)
230 ppd_unmark_choices(o
->option
);
232 return (ppdConflicts(ppd
));
237 * 'ppdMarkRealArray()' - Mark an extended real array option.
240 int /* O - Number of conflicts */
241 ppdMarkRealArray(ppd_file_t
*ppd
, /* I - PPD file */
242 const char *keyword
, /* I - Option name */
243 const char *param
, /* I - Parameter name */
244 int num_values
,/* I - Number of values */
245 const float *values
) /* I - Values */
247 ppd_ext_option_t
*o
; /* Extended option */
248 ppd_ext_param_t
*p
; /* Extended parameter */
251 if ((o
= ppdFindExtOption(ppd
, keyword
)) == NULL
)
254 if ((p
= ppdFindExtParam(o
, param
)) == NULL
)
257 ppd_unmark_choices(o
->option
);
259 return (ppdConflicts(ppd
));
264 * 'ppdMarkText()' - Mark an extended text option.
267 int /* O - Number of conflicts */
268 ppdMarkText(ppd_file_t
*ppd
, /* I - PPD file */
269 const char *keyword
, /* I - Option name */
270 const char *param
, /* I - Parameter name */
271 const char *value
) /* I - Option value */
273 ppd_ext_option_t
*o
; /* Extended option */
274 ppd_ext_param_t
*p
; /* Extended parameter */
277 if ((o
= ppdFindExtOption(ppd
, keyword
)) == NULL
)
280 if ((p
= ppdFindExtParam(o
, param
)) == NULL
)
283 ppd_unmark_choices(o
->option
);
285 return (ppdConflicts(ppd
));
290 * 'ppd_unmark_choices()' - Unmark all "canned" choices.
294 ppd_unmark_choices(ppd_option_t
*option
)/* I - Option choice */
296 int i
; /* Looping var */
297 ppd_choice_t
*c
; /* Current choice */
300 for (i
= option
->num_choices
, c
= option
->choices
; i
> 0; i
--, c
++)
306 * End of "$Id: extended.c 4494 2005-02-18 02:18:11Z mike $".