Home | History | Annotate | Download | only in cups

Lines Matching refs:pc

56     _ppd_cache_t    *pc,		/* I - PPD cache info */
89 if (pc->password && (password = cupsGetOption("job-password", num_options, options)) != NULL && ippGetOperation(request) != IPP_OP_VALIDATE_JOB)
121 if (pc->account_id)
130 if (pc->accounting_user_id)
139 for (mandatory = (const char *)cupsArrayFirst(pc->mandatory); mandatory; mandatory = (const char *)cupsArrayNext(pc->mandatory))
202 media_source = _ppdCacheGetSource(pc, cupsGetOption("InputSlot", num_options, options));
203 media_type = _ppdCacheGetType(pc, cupsGetOption("MediaType", num_options, options));
204 size = _ppdCacheGetSize(pc, keyword);
247 keyword = _ppdCacheGetBin(pc, choice->choice);
291 else if (pc->sides_option && (choice = ppdFindMarkedChoice(ppd, pc->sides_option)) != NULL)
293 if (!_cups_strcasecmp(choice->choice, pc->sides_1sided))
295 else if (!_cups_strcasecmp(choice->choice, pc->sides_2sided_long))
297 if (!_cups_strcasecmp(choice->choice, pc->sides_2sided_short))
366 num_finishings = _ppdCacheGetFinishingValues(pc, num_options, options, (int)(sizeof(finishings) / sizeof(finishings[0])), finishings);
399 _ppd_cache_t *pc; /* PWG mapping data */
477 if ((pc = calloc(1, sizeof(_ppd_cache_t))) == NULL)
484 pc->max_copies = 9999;
510 if (!pc->filters)
511 pc->filters = cupsArrayNew3(NULL, NULL, NULL, 0,
515 cupsArrayAdd(pc->filters, value);
519 if (!pc->prefilters)
520 pc->prefilters = cupsArrayNew3(NULL, NULL, NULL, 0,
524 cupsArrayAdd(pc->prefilters, value);
528 pc->product = _cupsStrAlloc(value);
532 pc->single_file = !_cups_strcasecmp(value, "true");
602 if ((pc->bins = calloc((size_t)num_bins, sizeof(pwg_map_t))) == NULL)
619 if (pc->num_bins >= num_bins)
627 map = pc->bins + pc->num_bins;
631 pc->num_bins ++;
652 if ((pc->sizes = calloc((size_t)num_sizes, sizeof(pwg_size_t))) == NULL)
663 if (pc->num_sizes >= num_sizes)
671 size = pc->sizes + pc->num_sizes;
686 pc->num_sizes ++;
690 if (pc->custom_max_width > 0)
698 if (sscanf(value, "%d%d%d%d%d%d%d%d", &(pc->custom_max_width),
699 &(pc->custom_max_length), &(pc->custom_min_width),
700 &(pc->custom_min_length), &(pc->custom_size.left),
701 &(pc->custom_size.bottom), &(pc->custom_size.right),
702 &(pc->custom_size.top)) != 8)
711 pc->custom_max_width, pc->custom_max_length, NULL);
712 pc->custom_max_keyword = _cupsStrAlloc(pwg_keyword);
715 pc->custom_min_width, pc->custom_min_length, NULL);
716 pc->custom_min_keyword = _cupsStrAlloc(pwg_keyword);
720 pc->source_option = _cupsStrAlloc(value);
740 if ((pc->sources = calloc((size_t)num_sources, sizeof(pwg_map_t))) == NULL)
758 if (pc->num_sources >= num_sources)
766 map = pc->sources + pc->num_sources;
770 pc->num_sources ++;
789 if ((pc->types = calloc((size_t)num_types, sizeof(pwg_map_t))) == NULL)
807 if (pc->num_types >= num_types)
815 map = pc->types + pc->num_types;
819 pc->num_types ++;
842 pc->num_presets[print_color_mode][print_quality] =
844 pc->presets[print_color_mode] + print_quality);
847 pc->sides_option = _cupsStrAlloc(value);
849 pc->sides_1sided = _cupsStrAlloc(value);
851 pc->sides_2sided_long = _cupsStrAlloc(value);
853 pc->sides_2sided_short = _cupsStrAlloc(value);
856 if (!pc->finishings)
857 pc->finishings =
869 cupsArrayAdd(pc->finishings, finishings);
872 pc->max_copies = atoi(value);
874 pc->charge_info_uri = _cupsStrAlloc(value);
876 pc->account_id = !_cups_strcasecmp(value, "true");
878 pc->accounting_user_id = !_cups_strcasecmp(value, "true");
880 pc->password = _cupsStrAlloc(value);
883 if (pc->mandatory)
884 _cupsArrayAddStrings(pc->mandatory, value, ' ');
886 pc->mandatory = _cupsArrayNewStrings(value, ' ');
890 if (!pc->support_files)
891 pc->support_files = cupsArrayNew3(NULL, NULL, NULL, 0,
895 cupsArrayAdd(pc->support_files, value);
904 if (pc->num_sizes < num_sizes)
907 pc->num_sizes, num_sizes));
912 if (pc->num_sources < num_sources)
915 pc->num_sources, num_sources));
920 if (pc->num_types < num_types)
923 pc->num_types, num_types));
930 return (pc);
939 _ppdCacheDestroy(pc);
959 _ppd_cache_t *pc; /* PWG mapping data */
1014 if ((pc = calloc(1, sizeof(_ppd_cache_t))) == NULL)
1026 if ((pc->sizes = calloc((size_t)ppd->num_sizes, sizeof(pwg_size_t))) == NULL)
1033 for (i = ppd->num_sizes, pwg_size = pc->sizes, ppd_size = ppd->sizes;
1054 for (j = 0; j < pc->num_sizes; j ++)
1055 if (!strcmp(pc->sizes[j].map.pwg, pwg_media->pwg))
1109 for (k = pc->num_sizes, similar = 0, old_size = pc->sizes, new_size = NULL;
1146 pc->num_sizes ++;
1176 pc->custom_max_keyword = _cupsStrAlloc(pwg_keyword);
1177 pc->custom_max_width = PWG_FROM_POINTS(ppd->custom_max[0]);
1178 pc->custom_max_length = PWG_FROM_POINTS(ppd->custom_max[1]);
1183 pc->custom_min_keyword = _cupsStrAlloc(pwg_keyword);
1184 pc->custom_min_width = PWG_FROM_POINTS(ppd->custom_min[0]);
1185 pc->custom_min_length = PWG_FROM_POINTS(ppd->custom_min[1]);
1187 pc->custom_size.left = PWG_FROM_POINTS(ppd->custom_margins[0]);
1188 pc->custom_size.bottom = PWG_FROM_POINTS(ppd->custom_margins[1]);
1189 pc->custom_size.right = PWG_FROM_POINTS(ppd->custom_margins[2]);
1190 pc->custom_size.top = PWG_FROM_POINTS(ppd->custom_margins[3]);
1202 pc->source_option = _cupsStrAlloc(input_slot->keyword);
1204 if ((pc->sources = calloc((size_t)input_slot->num_choices, sizeof(pwg_map_t))) == NULL)
1211 pc->num_sources = input_slot->num_choices;
1214 map = pc->sources;
1265 if ((pc->types = calloc((size_t)media_type->num_choices, sizeof(pwg_map_t))) == NULL)
1272 pc->num_types = media_type->num_choices;
1275 map = pc->types;
1329 if ((pc->bins = calloc((size_t)output_bin->num_choices, sizeof(pwg_map_t))) == NULL)
1336 pc->num_bins = output_bin->num_choices;
1339 map = pc->bins;
1436 if (!pc->num_presets[pwg_print_color_mode][pwg_print_quality])
1437 pc->num_presets[pwg_print_color_mode][pwg_print_quality] =
1439 pc->presets[pwg_print_color_mode] +
1448 if (!pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][_PWG_PRINT_QUALITY_DRAFT] &&
1449 !pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][_PWG_PRINT_QUALITY_NORMAL] &&
1450 !pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][_PWG_PRINT_QUALITY_HIGH])
1504 if (pc->num_presets[_PWG_PRINT_COLOR_MODE_COLOR][pwg_print_quality])
1510 num_options = pc->num_presets[_PWG_PRINT_COLOR_MODE_COLOR]
1517 coption = pc->presets[_PWG_PRINT_COLOR_MODE_COLOR]
1526 pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][pwg_print_quality] =
1528 pc->presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][pwg_print_quality] =
1539 pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][pwg_print_quality] =
1541 pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME]
1543 pc->presets[_PWG_PRINT_COLOR_MODE_MONOCHROME] +
1561 pc->sides_option = _cupsStrAlloc(duplex->keyword);
1568 !_cups_strcasecmp(choice->choice, "False")) && !pc->sides_1sided)
1569 pc->sides_1sided = _cupsStrAlloc(choice->choice);
1572 !_cups_strcasecmp(choice->choice, "Top")) && !pc->sides_2sided_long)
1573 pc->sides_2sided_long = _cupsStrAlloc(choice->choice);
1577 !pc->sides_2sided_short)
1578 pc->sides_2sided_short = _cupsStrAlloc(choice->choice);
1586 pc->filters = cupsArrayNew3(NULL, NULL, NULL, 0,
1590 cupsArrayAdd(pc->filters,
1597 cupsArrayAdd(pc->filters, ppd_attr->value);
1604 cupsArrayAdd(pc->filters, ppd->filters[i]);
1607 cupsArrayAdd(pc->filters, "application/vnd.cups-postscript 0 -");
1613 for (filter = (const char *)cupsArrayFirst(pc->filters);
1615 filter = (const char *)cupsArrayNext(pc->filters))
1630 for (filter = (const char *)cupsArrayFirst(pc->filters);
1632 filter = (const char *)cupsArrayNext(pc->filters))
1638 cupsArrayAdd(pc->filters,
1645 pc->prefilters = cupsArrayNew3(NULL, NULL, NULL, 0,
1651 cupsArrayAdd(pc->prefilters, ppd_attr->value);
1657 pc->single_file = !_cups_strcasecmp(ppd_attr->value, "true");
1664 pc->product = _cupsStrAlloc(ppd->product);
1676 pc->finishings = cupsArrayNew3((cups_array_func_t)pwg_compare_finishings,
1690 cupsArrayAdd(pc->finishings, finishings);
1703 pc->finishings = cupsArrayNew3((cups_array_func_t)pwg_compare_finishings, NULL, NULL, 0, NULL, (cups_afree_func_t)pwg_free_finishings);
1712 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_TOP_LEFT, "StapleLocation", "SinglePortrait");
1714 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_TOP_LEFT, "StapleLocation", "UpperLeft");
1716 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_TOP_RIGHT, "StapleLocation", "UpperRight");
1718 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_BOTTOM_LEFT, "StapleLocation", "SingleLandscape");
1720 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_STAPLE_DUAL_LEFT, "StapleLocation", "DualLandscape");
1730 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_DUAL_LEFT, "RIPunch", "Left2");
1732 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_TRIPLE_LEFT, "RIPunch", "Left3");
1734 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_QUAD_LEFT, "RIPunch", "Left4");
1736 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_DUAL_RIGHT, "RIPunch", "Right2");
1738 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_TRIPLE_RIGHT, "RIPunch", "Right3");
1740 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_QUAD_RIGHT, "RIPunch", "Right4");
1742 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_DUAL_TOP, "RIPunch", "Upper2");
1744 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_TRIPLE_TOP, "RIPunch", "Upper3");
1746 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_PUNCH_QUAD_TOP, "RIPunch", "Upper4");
1756 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_LEFT, "BindEdge", "Left");
1758 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_RIGHT, "BindEdge", "Right");
1760 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_TOP, "BindEdge", "Top");
1762 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_BIND_BOTTOM, "BindEdge", "Bottom");
1772 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_Z, "FoldType", "ZFold");
1774 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_HALF, "FoldType", "Saddle");
1776 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_DOUBLE_GATE, "FoldType", "DoubleGate");
1778 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_LEFT_GATE, "FoldType", "LeftGate");
1780 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_RIGHT_GATE, "FoldType", "RightGate");
1782 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_LETTER, "FoldType", "Letter");
1784 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_POSTER, "FoldType", "XFold");
1794 pwg_add_finishing(pc->finishings, IPP_FINISHINGS_FOLD_LETTER, "RIFoldType", "OutsideTwoFold");
1797 if (cupsArrayCount(pc->finishings) == 0)
1799 cupsArrayDelete(pc->finishings);
1800 pc->finishings = NULL;
1809 pc->max_copies = atoi(ppd_attr->value);
1811 pc->max_copies = 1;
1813 pc->max_copies = 9999;
1821 pc->charge_info_uri = _cupsStrAlloc(ppd_attr->value);
1824 pc->account_id = !_cups_strcasecmp(ppd_attr->value, "true");
1827 pc->accounting_user_id = !_cups_strcasecmp(ppd_attr->value, "true");
1830 pc->password = _cupsStrAlloc(ppd_attr->value);
1833 pc->mandatory = _cupsArrayNewStrings(ppd_attr->value, ' ');
1839 pc->support_files = cupsArrayNew3(NULL, NULL, NULL, 0,
1846 cupsArrayAdd(pc->support_files, ppd_attr->value);
1849 cupsArrayAdd(pc->support_files, ppd_attr->value);
1855 return (pc);
1864 _ppdCacheDestroy(pc);
1875 _ppdCacheDestroy(_ppd_cache_t *pc) /* I - PPD cache and mapping data */
1886 if (!pc)
1893 if (pc->bins)
1895 for (i = pc->num_bins, map = pc->bins; i > 0; i --, map ++)
1901 free(pc->bins);
1904 if (pc->sizes)
1906 for (i = pc->num_sizes, size = pc->sizes; i > 0; i --, size ++)
1912 free(pc->sizes);
1915 if (pc->source_option)
1916 _cupsStrFree(pc->source_option);
1918 if (pc->sources)
1920 for (i = pc->num_sources, map = pc->sources; i > 0; i --, map ++)
1926 free(pc->sources);
1929 if (pc->types)
1931 for (i = pc->num_types, map = pc->types; i > 0; i --, map ++)
1937 free(pc->types);
1940 if (pc->custom_max_keyword)
1941 _cupsStrFree(pc->custom_max_keyword);
1943 if (pc->custom_min_keyword)
1944 _cupsStrFree(pc->custom_min_keyword);
1946 _cupsStrFree(pc->product);
1947 cupsArrayDelete(pc->filters);
1948 cupsArrayDelete(pc->prefilters);
1949 cupsArrayDelete(pc->finishings);
1951 _cupsStrFree(pc->charge_info_uri);
1952 _cupsStrFree(pc->password);
1954 cupsArrayDelete(pc->mandatory);
1956 cupsArrayDelete(pc->support_files);
1958 free(pc);
1969 _ppd_cache_t *pc, /* I - PPD cache and mapping data */
1979 if (!pc || !output_bin)
1987 for (i = 0; i < pc->num_bins; i ++)
1988 if (!_cups_strcasecmp(output_bin, pc->bins[i].ppd))
1989 return (pc->bins[i].pwg);
2002 _ppd_cache_t *pc, /* I - PPD cache and mapping data */
2019 if (!pc || cupsArrayCount(pc->finishings) == 0 || !options ||
2035 if ((f = cupsArrayFind(pc->finishings, &key)) != NULL)
2049 if ((f = cupsArrayFind(pc->finishings, &key)) != NULL)
2070 _ppd_cache_t *pc, /* I - PPD cache and mapping data */
2087 DEBUG_printf(("_ppdCacheGetFinishingValues(pc=%p, num_options=%d, options=%p, max_values=%d, values=%p)", pc, num_options, options, max_values, values));
2089 if (!pc || max_values < 1 || !values)
2094 else if (!pc->finishings)
2104 for (f = (_pwg_finishings_t *)cupsArrayFirst(pc->finishings);
2106 f = (_pwg_finishings_t *)cupsArrayNext(pc->finishings))
2157 _ppd_cache_t *pc, /* I - PPD cache and mapping data */
2165 if (!pc || pc->num_sources == 0 || (!job && !keyword))
2206 for (i = 0; i < pc->num_sources; i ++)
2207 if (!_cups_strcasecmp(keyword, pc->sources[i].pwg))
2208 return (pc->sources[i].ppd);
2222 _ppd_cache_t *pc, /* I - PPD cache and mapping data */
2230 if (!pc || pc->num_types == 0 || (!job && !keyword))
2260 for (i = 0; i < pc->num_types; i ++)
2261 if (!_cups_strcasecmp(keyword, pc->types[i].pwg))
2262 return (pc->types[i].ppd);
2276 _ppd_cache_t *pc, /* I - PPD cache and mapping data */
2286 if (!pc || !output_bin)
2294 for (i = 0; i < pc->num_bins; i ++)
2295 if (!_cups_strcasecmp(output_bin, pc->bins[i].pwg))
2296 return (pc->bins[i].ppd);
2309 _ppd_cache_t *pc, /* I - PPD cache and mapping data */
2330 DEBUG_printf(("_ppdCacheGetPageSize(pc=%p, job=%p, keyword=\"%s\", exact=%p)",
2331 pc, job, keyword, exact));
2337 if (!pc || (!job && !keyword))
2378 for (i = pc->num_sizes, size = pc->sizes; i > 0; i --, size ++)
2381 (int)(size - pc->sizes), size->map.pwg, size->map.ppd));
2436 for (i = pc->num_sizes, size = pc->sizes; i > 0; i --, size ++)
2500 if (jobsize.width >= pc->custom_min_width &&
2501 jobsize.width <= pc->custom_max_width &&
2502 jobsize.length >= pc->custom_min_length &&
2503 jobsize.length <= pc->custom_max_length)
2509 snprintf(pc->custom_ppd_size, sizeof(pc->custom_ppd_size), "Custom.%dx%d",
2514 dleft = pc->custom_size.left - jobsize.left;
2515 dright = pc->custom_size.right - jobsize.right;
2516 dtop = pc->custom_size.top - jobsize.top;
2517 dbottom = pc->custom_size.bottom - jobsize.bottom;
2527 pc->custom_ppd_size));
2529 return (pc->custom_ppd_size);
2548 _ppd_cache_t *pc, /* I - PPD cache and mapping data */
2560 if (!pc || !page_size)
2620 pc->custom_size.width = (int)w;
2621 pc->custom_size.length = (int)l;
2623 return (&(pc->custom_size));
2630 for (i = pc->num_sizes, size = pc->sizes; i > 0; i --, size ++)
2645 pc->custom_size.width = media->width;
2646 pc->custom_size.length = media->length;
2648 return (&(pc->custom_size));
2662 _ppd_cache_t *pc, /* I - PPD cache and mapping data */
2673 if (!pc || !input_slot)
2676 for (i = pc->num_sources, source = pc->sources; i > 0; i --, source ++)
2691 _ppd_cache_t *pc, /* I - PPD cache and mapping data */
2702 if (!pc || !media_type)
2705 for (i = pc->num_types, type = pc->types; i > 0; i --, type ++)
2719 _ppd_cache_t *pc, /* I - PPD cache and mapping data */
2737 if (!pc || !filename)
2764 if (pc->num_bins > 0)
2766 cupsFilePrintf(fp, "NumBins %d\n", pc->num_bins);
2767 for (i = pc->num_bins, map = pc->bins; i > 0; i --, map ++)
2775 cupsFilePrintf(fp, "NumSizes %d\n", pc->num_sizes);
2776 for (i = pc->num_sizes, size = pc->sizes; i > 0; i --, size ++)
2780 if (pc->custom_max_width > 0)
2782 pc->custom_max_width, pc->custom_max_length,
2783 pc->custom_min_width, pc->custom_min_length,
2784 pc->custom_size.left, pc->custom_size.bottom,
2785 pc->custom_size.right, pc->custom_size.top);
2791 if (pc->source_option)
2792 cupsFilePrintf(fp, "SourceOption %s\n", pc->source_option);
2794 if (pc->num_sources > 0)
2796 cupsFilePrintf(fp, "NumSources %d\n", pc->num_sources);
2797 for (i = pc->num_sources, map = pc->sources; i > 0; i --, map ++)
2805 if (pc->num_types > 0)
2807 cupsFilePrintf(fp, "NumTypes %d\n", pc->num_types);
2808 for (i = pc->num_types, map = pc->types; i > 0; i --, map ++)
2818 if (pc->num_presets[i][j])
2821 for (k = pc->num_presets[i][j], option = pc->presets[i][j];
2832 if (pc->sides_option)
2833 cupsFilePrintf(fp, "SidesOption %s\n", pc->sides_option);
2835 if (pc->sides_1sided)
2836 cupsFilePrintf(fp, "Sides1Sided %s\n", pc->sides_1sided);
2838 if (pc->sides_2sided_long)
2839 cupsFilePrintf(fp, "Sides2SidedLong %s\n", pc->sides_2sided_long);
2841 if (pc->sides_2sided_short)
2842 cupsFilePrintf(fp, "Sides2SidedShort %s\n", pc->sides_2sided_short);
2848 if (pc->product)
2849 cupsFilePutConf(fp, "Product", pc->product);
2851 for (value = (const char *)cupsArrayFirst(pc->filters);
2853 value = (const char *)cupsArrayNext(pc->filters))
2856 for (value = (const char *)cupsArrayFirst(pc->prefilters);
2858 value = (const char *)cupsArrayNext(pc->prefilters))
2861 cupsFilePrintf(fp, "SingleFile %s\n", pc->single_file ? "true" : "false");
2867 for (f = (_pwg_finishings_t *)cupsArrayFirst(pc->finishings);
2869 f = (_pwg_finishings_t *)cupsArrayNext(pc->finishings))
2881 cupsFilePrintf(fp, "MaxCopies %d\n", pc->max_copies);
2887 if (pc->charge_info_uri)
2888 cupsFilePutConf(fp, "ChargeInfoURI", pc->charge_info_uri);
2890 cupsFilePrintf(fp, "AccountId %s\n", pc->account_id ? "true" : "false");
2892 pc->accounting_user_id ? "true" : "false");
2894 if (pc->password)
2895 cupsFilePutConf(fp, "Password", pc->password);
2897 for (value = (char *)cupsArrayFirst(pc->mandatory);
2899 value = (char *)cupsArrayNext(pc->mandatory))
2906 for (value = (char *)cupsArrayFirst(pc->support_files);
2908 value = (char *)cupsArrayNext(pc->support_files))