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

Function ppdEmitString

cups/ppd-emit.c:604–1107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602 */
603
604char * /* O - String containing option code or @code NULL@ if there is no option code */
605ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
606 ppd_section_t section, /* I - Section to write */
607 float min_order) /* I - Lowest OrderDependency */
608{
609 int i, j, /* Looping vars */
610 count; /* Number of choices */
611 ppd_choice_t **choices; /* Choices */
612 ppd_size_t *size; /* Custom page size */
613 ppd_coption_t *coption; /* Custom option */
614 ppd_cparam_t *cparam; /* Custom parameter */
615 size_t bufsize; /* Size of string buffer needed */
616 char *buffer, /* String buffer */
617 *bufptr, /* Pointer into buffer */
618 *bufend; /* End of buffer */
619 struct lconv *loc; /* Locale data */
620
621
622 DEBUG_printf(("ppdEmitString(ppd=%p, section=%d, min_order=%f)",
623 ppd, section, min_order));
624
625 /*
626 * Range check input...
627 */
628
629 if (!ppd)
630 return (NULL);
631
632 /*
633 * Use PageSize or PageRegion as required...
634 */
635
636 ppd_handle_media(ppd);
637
638 /*
639 * Collect the options we need to emit...
640 */
641
642 if ((count = ppdCollect2(ppd, section, min_order, &choices)) == 0)
643 return (NULL);
644
645 /*
646 * Count the number of bytes that are required to hold all of the
647 * option code...
648 */
649
650 for (i = 0, bufsize = 1; i < count; i ++)
651 {
652 if (section == PPD_ORDER_JCL)
653 {
654 if (!_cups_strcasecmp(choices[i]->choice, "Custom") &&
655 (coption = ppdFindCustomOption(ppd, choices[i]->option->keyword))
656 != NULL)
657 {
658 /*
659 * Add space to account for custom parameter substitution...
660 */
661

Callers 8

copy_pageFunction · 0.85
do_prologFunction · 0.85
do_setupFunction · 0.85
write_optionsFunction · 0.85
mainFunction · 0.85
_cupsRasterInterpretPPDFunction · 0.85
ppdEmitAfterOrderFunction · 0.85
ppdEmitFdFunction · 0.85

Calls 12

ppd_handle_mediaFunction · 0.85
ppdCollect2Function · 0.85
_cups_strcasecmpFunction · 0.85
ppdFindCustomOptionFunction · 0.85
cupsArrayFirstFunction · 0.85
cupsArrayNextFunction · 0.85
_cupsStrFormatdFunction · 0.85
ppdPageSizeFunction · 0.85
ppdFindAttrFunction · 0.85
cupsArrayNewFunction · 0.85
cupsArrayAddFunction · 0.85
cupsArrayDeleteFunction · 0.85

Tested by 1

mainFunction · 0.68