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

Function write_options

filter/pstops.c:3327–3397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3325 */
3326
3327static void
3328write_options(
3329 pstops_doc_t *doc, /* I - Document */
3330 ppd_file_t *ppd, /* I - PPD file */
3331 int num_options, /* I - Number of options */
3332 cups_option_t *options) /* I - Options */
3333{
3334 int i; /* Looping var */
3335 ppd_option_t *option; /* PPD option */
3336 float min_order; /* Minimum OrderDependency value */
3337 char *doc_setup, /* DocumentSetup commands to send */
3338 *any_setup; /* AnySetup commands to send */
3339
3340
3341 /*
3342 * Figure out the minimum OrderDependency value...
3343 */
3344
3345 if ((option = ppdFindOption(ppd, "PageRegion")) != NULL)
3346 min_order = option->order;
3347 else
3348 min_order = 999.0f;
3349
3350 for (i = 0; i < num_options; i ++)
3351 if ((option = ppdFindOption(ppd, options[i].name)) != NULL &&
3352 option->order < min_order)
3353 min_order = option->order;
3354
3355 /*
3356 * Mark and extract them...
3357 */
3358
3359 cupsMarkOptions(ppd, num_options, options);
3360
3361 doc_setup = ppdEmitString(ppd, PPD_ORDER_DOCUMENT, min_order);
3362 any_setup = ppdEmitString(ppd, PPD_ORDER_ANY, min_order);
3363
3364 /*
3365 * Then send them out...
3366 */
3367
3368 if (doc->number_up > 1)
3369 {
3370 /*
3371 * Temporarily restore setpagedevice so we can set the options...
3372 */
3373
3374 doc_puts(doc, "userdict/setpagedevice/CUPSsetpagedevice load put\n");
3375 }
3376
3377 if (doc_setup)
3378 {
3379 doc_puts(doc, doc_setup);
3380 free(doc_setup);
3381 }
3382
3383 if (any_setup)
3384 {

Callers 2

copy_pageFunction · 0.85
copy_setupFunction · 0.85

Calls 4

ppdFindOptionFunction · 0.85
cupsMarkOptionsFunction · 0.85
ppdEmitStringFunction · 0.85
doc_putsFunction · 0.85

Tested by

no test coverage detected