MCPcopy Create free account
hub / github.com/OpenPrinting/cups / _ppdCacheGetFinishingValues

Function _ppdCacheGetFinishingValues

cups/ppd-cache.c:2274–2351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2272 */
2273
2274int /* O - Number of finishings values */
2275_ppdCacheGetFinishingValues(
2276 ppd_file_t *ppd, /* I - Marked PPD file */
2277 _ppd_cache_t *pc, /* I - PPD cache and mapping data */
2278 int max_values, /* I - Maximum number of finishings values */
2279 int *values) /* O - Finishings values */
2280{
2281 int i, /* Looping var */
2282 num_values = 0; /* Number of values */
2283 _pwg_finishings_t *f; /* Current finishings option */
2284 cups_option_t *option; /* Current option */
2285 ppd_choice_t *choice; /* Marked PPD choice */
2286
2287
2288 /*
2289 * Range check input...
2290 */
2291
2292 DEBUG_printf(("_ppdCacheGetFinishingValues(ppd=%p, pc=%p, max_values=%d, values=%p)", ppd, pc, max_values, values));
2293
2294 if (!ppd || !pc || max_values < 1 || !values)
2295 {
2296 DEBUG_puts("_ppdCacheGetFinishingValues: Bad arguments, returning 0.");
2297 return (0);
2298 }
2299 else if (!pc->finishings)
2300 {
2301 DEBUG_puts("_ppdCacheGetFinishingValues: No finishings support, returning 0.");
2302 return (0);
2303 }
2304
2305 /*
2306 * Go through the finishings options and see what is set...
2307 */
2308
2309 for (f = (_pwg_finishings_t *)cupsArrayFirst(pc->finishings);
2310 f;
2311 f = (_pwg_finishings_t *)cupsArrayNext(pc->finishings))
2312 {
2313 DEBUG_printf(("_ppdCacheGetFinishingValues: Checking %d (%s)", (int)f->value, ippEnumString("finishings", (int)f->value)));
2314
2315 for (i = f->num_options, option = f->options; i > 0; i --, option ++)
2316 {
2317 DEBUG_printf(("_ppdCacheGetFinishingValues: %s=%s?", option->name, option->value));
2318
2319 if ((choice = ppdFindMarkedChoice(ppd, option->name)) == NULL || _cups_strcasecmp(option->value, choice->choice))
2320 {
2321 DEBUG_puts("_ppdCacheGetFinishingValues: NO");
2322 break;
2323 }
2324 }
2325
2326 if (i == 0)
2327 {
2328 DEBUG_printf(("_ppdCacheGetFinishingValues: Adding %d (%s)", (int)f->value, ippEnumString("finishings", (int)f->value)));
2329
2330 values[num_values ++] = (int)f->value;
2331

Callers 2

_cupsConvertOptionsFunction · 0.85
mainFunction · 0.85

Calls 5

cupsArrayFirstFunction · 0.85
cupsArrayNextFunction · 0.85
ippEnumStringFunction · 0.85
ppdFindMarkedChoiceFunction · 0.85
_cups_strcasecmpFunction · 0.85

Tested by 1

mainFunction · 0.68