Lines Matching refs:ppd

30 #include "ppd-private.h"
74 static ppd_attr_t *ppd_add_attr(ppd_file_t *ppd, const char *name,
78 static ppd_size_t *ppd_add_size(ppd_file_t *ppd, const char *name);
85 static void ppd_free_filters(ppd_file_t *ppd);
88 static ppd_coption_t *ppd_get_coption(ppd_file_t *ppd, const char *name);
92 static ppd_group_t *ppd_get_group(ppd_file_t *ppd, const char *name,
108 static int ppd_update_filters(ppd_file_t *ppd,
117 ppdClose(ppd_file_t *ppd) /* I - PPD file record */
132 if (!ppd)
139 _cupsStrFree(ppd->lang_encoding);
140 _cupsStrFree(ppd->nickname);
141 if (ppd->patches)
142 free(ppd->patches);
143 _cupsStrFree(ppd->jcl_begin);
144 _cupsStrFree(ppd->jcl_end);
145 _cupsStrFree(ppd->jcl_ps);
151 if (ppd->num_emulations > 0)
153 for (i = ppd->num_emulations, emul = ppd->emulations; i > 0; i --, emul ++)
159 ppd_free(ppd->emulations);
166 if (ppd->num_groups > 0)
168 for (i = ppd->num_groups, group = ppd->groups; i > 0; i --, group ++)
171 ppd_free(ppd->groups);
174 cupsArrayDelete(ppd->options);
175 cupsArrayDelete(ppd->marked);
181 if (ppd->num_sizes > 0)
182 ppd_free(ppd->sizes);
188 if (ppd->num_consts > 0)
189 ppd_free(ppd->consts);
195 ppd_free_filters(ppd);
201 if (ppd->num_fonts > 0)
203 for (i = ppd->num_fonts, font = ppd->fonts; i > 0; i --, font ++)
206 ppd_free(ppd->fonts);
213 if (ppd->num_profiles > 0)
214 ppd_free(ppd->profiles);
220 if (ppd->num_attrs > 0)
222 for (i = ppd->num_attrs, attr = ppd->attrs; i > 0; i --, attr ++)
228 ppd_free(ppd->attrs);
231 cupsArrayDelete(ppd->sorted_attrs);
237 for (coption = (ppd_coption_t *)cupsArrayFirst(ppd->coptions);
239 coption = (ppd_coption_t *)cupsArrayNext(ppd->coptions))
265 cupsArrayDelete(ppd->coptions);
271 if (ppd->cups_uiconstraints)
276 for (consts = (_ppd_cups_uiconsts_t *)cupsArrayFirst(ppd->cups_uiconstraints);
278 consts = (_ppd_cups_uiconsts_t *)cupsArrayNext(ppd->cups_uiconstraints))
284 cupsArrayDelete(ppd->cups_uiconstraints);
291 if (ppd->cache)
292 _ppdCacheDestroy(ppd->cache);
298 ppd_free(ppd);
446 ppd_file_t *ppd; /* PPD file record */
650 if ((ppd = calloc(1, sizeof(ppd_file_t))) == NULL)
660 ppd->language_level = 2;
661 ppd->color_device = 0;
662 ppd->colorspace = PPD_CS_N;
663 ppd->landscape = -90;
664 ppd->coptions = cupsArrayNew((cups_array_func_t)ppd_compare_coptions,
783 if ((group = ppd_get_group(ppd, "General", _("General"), pg,
817 for (j = 0; j < ppd->num_attrs; j ++)
818 if (!strncmp(ppd->attrs[j]->name, "Default", 7) &&
819 !strcmp(ppd->attrs[j]->name + 7, keyword) &&
820 ppd->attrs[j]->value)
823 option->keyword, ppd->attrs[j]->value));
824 strlcpy(option->defchoice, ppd->attrs[j]->value,
845 ppd->language_level = atoi(string);
852 ppd->lang_encoding = _cupsStrAlloc("UTF-8");
856 ppd->lang_version = string;
858 ppd->manufacturer = string;
860 ppd->modelname = string;
862 ppd->protocols = string;
864 ppd->pcfilename = string;
873 ppd->nickname = _cupsStrAlloc((char *)utf8);
876 ppd->nickname = _cupsStrAlloc(string);
879 ppd->product = string;
881 ppd->shortnickname = string;
883 ppd->ttrasterizer = string;
886 ppd->jcl_begin = _cupsStrAlloc(string);
887 ppd_decode(ppd->jcl_begin); /* Decode quoted string */
891 ppd->jcl_end = _cupsStrAlloc(string);
892 ppd_decode(ppd->jcl_end); /* Decode quoted string */
896 ppd->jcl_ps = _cupsStrAlloc(string);
897 ppd_decode(ppd->jcl_ps); /* Decode quoted string */
900 ppd->accurate_screens = !strcmp(string, "True");
902 ppd->color_device = !strcmp(string, "True");
904 ppd->contone_only = !strcmp(string, "True");
906 ppd->flip_duplex = !strcmp(string, "True");
908 ppd->manual_copies = !strcmp(string, "True");
910 ppd->model_number = atoi(string);
913 if (ppd->num_profiles == 0)
916 profile = realloc(ppd->profiles, sizeof(ppd_profile_t) * (size_t)(ppd->num_profiles + 1));
925 ppd->profiles = profile;
926 profile += ppd->num_profiles;
927 ppd->num_profiles ++;
947 if (ppd->num_filters == 0)
950 filter = realloc(ppd->filters, sizeof(char *) * (size_t)(ppd->num_filters + 1));
959 ppd->filters = filter;
960 filter += ppd->num_filters;
961 ppd->num_filters ++;
970 ppd->throughput = atoi(string);
977 if (ppd->num_fonts == 0)
980 tempfonts = (char **)realloc(ppd->fonts, sizeof(char *) * (size_t)(ppd->num_fonts + 1));
989 ppd->fonts = tempfonts;
990 ppd->fonts[ppd->num_fonts] = _cupsStrAlloc(name);
991 ppd->num_fonts ++;
1007 if ((coption = ppd_get_coption(ppd, keyword + 11)) == NULL)
1099 ppd->custom_min[0] = cparam->minimum.custom_points;
1100 ppd->custom_max[0] = cparam->maximum.custom_points;
1104 ppd->custom_min[1] = cparam->minimum.custom_points;
1105 ppd->custom_max[1] = cparam->maximum.custom_points;
1112 ppd->custom_margins[i] = (float)_cupsStrScand(sptr, &sptr, loc);
1124 if (!ppd_get_coption(ppd, keyword + 6))
1134 custom_option = ppdFindOption(ppd, keyword + 6);
1171 ppd->variable_sizes = 1;
1173 ppd_add_size(ppd, "Custom");
1178 custom_option = ppdFindOption(ppd, "PageRegion");
1200 ppd->landscape = -90;
1202 ppd->landscape = 90;
1214 ppd->num_emulations = count;
1215 if ((ppd->emulations = calloc((size_t)count, sizeof(ppd_emul_t))) == NULL)
1224 for (nameptr = ppd->emulations[i].name;
1227 if (nameptr < (ppd->emulations[i].name + sizeof(ppd->emulations[i].name) - 1))
1240 for (i = 0; i < ppd->num_emulations; i ++)
1241 if (!strcmp(keyword + 14, ppd->emulations[i].name))
1243 ppd->emulations[i].start = string;
1251 for (i = 0; i < ppd->num_emulations; i ++)
1252 if (!strcmp(keyword + 13, ppd->emulations[i].name))
1254 ppd->emulations[i].stop = string;
1291 if (ppd->patches == NULL)
1292 ppd->patches = strdup(string);
1295 temp = realloc(ppd->patches, strlen(ppd->patches) +
1304 ppd->patches = temp;
1306 memcpy(ppd->patches + strlen(ppd->patches), string, strlen(string) + 1);
1341 if ((group = ppd_get_group(ppd, "General", _("General"), pg,
1378 for (j = 0; j < ppd->num_attrs; j ++)
1379 if (!strncmp(ppd->attrs[j]->name, "Default", 7) &&
1380 !strcmp(ppd->attrs[j]->name + 7, name) &&
1381 ppd->attrs[j]->value)
1384 option->keyword, ppd->attrs[j]->value));
1385 strlcpy(option->defchoice, ppd->attrs[j]->value,
1424 if ((custom_attr = ppdFindAttr(ppd, custom_name, "True")) != NULL)
1459 group = ppd_get_group(ppd, "JCL", _("JCL"), pg, encoding);
1497 for (j = 0; j < ppd->num_attrs; j ++)
1498 if (!strncmp(ppd->attrs[j]->name, "Default", 7) &&
1499 !strcmp(ppd->attrs[j]->name + 7, name) &&
1500 ppd->attrs[j]->value)
1503 option->keyword, ppd->attrs[j]->value));
1504 strlcpy(option->defchoice, ppd->attrs[j]->value,
1528 if ((custom_attr = ppdFindAttr(ppd, custom_name, "True")) != NULL)
1591 group = ppd_get_group(ppd, string, sptr, pg, encoding);
1642 for (i = ppd->num_groups, gtemp = ppd->groups; i > 0; i --, gtemp ++)
1687 ppd->colorspace = PPD_CS_CMY;
1689 ppd->colorspace = PPD_CS_CMYK;
1691 ppd->colorspace = PPD_CS_RGB;
1693 ppd->colorspace = PPD_CS_RGBK;
1695 ppd->colorspace = PPD_CS_N;
1697 ppd->colorspace = PPD_CS_GRAY;
1720 if ((toption = ppdFindOption(ppd, keyword + 7)) != NULL)
1736 if (ppd->num_consts == 0)
1739 constraint = realloc(ppd->consts, (size_t)(ppd->num_consts + 2) * sizeof(ppd_const_t));
1748 ppd->consts = constraint;
1749 constraint += ppd->num_consts;
1750 ppd->num_consts ++;
1909 if ((size = ppdPageSize(ppd, name)) == NULL)
1910 size = ppd_add_size(ppd, name);
1931 if ((size = ppdPageSize(ppd, name)) == NULL)
1932 size = ppd_add_size(ppd, name);
1966 if (ppdPageSize(ppd, name) == NULL)
1967 ppd_add_size(ppd, name);
2004 ppd_add_attr(ppd, keyword, name, text, string);
2037 ppdClose(ppd);
2046 if (!ppd_update_filters(ppd, pg))
2048 ppdClose(ppd);
2058 ppd->options = cupsArrayNew2((cups_array_func_t)ppd_compare_options, NULL,
2062 for (i = ppd->num_groups, group = ppd->groups;
2073 cupsArrayAdd(ppd->options, option);
2078 if ((coption = ppdFindCustomOption(ppd, option->keyword)) != NULL)
2087 ppd->marked = cupsArrayNew((cups_array_func_t)ppd_compare_choices, NULL);
2093 return (ppd);
2104 ppdClose(ppd);
2117 ppd_file_t *ppd; /* PPD file record */
2132 ppd = _ppdOpen(cf, _PPD_LOCALIZATION_DEFAULT);
2140 return (ppd);
2165 ppd_file_t *ppd; /* PPD file record */
2193 ppd = ppdOpen2(fp);
2200 ppd = NULL;
2203 return (ppd);
2216 ppd_file_t *ppd; /* PPD file record */
2244 ppd = _ppdOpen(fp, localization);
2251 ppd = NULL;
2254 return (ppd);
2291 ppd_add_attr(ppd_file_t *ppd, /* I - PPD file data */
2305 if (ppd == NULL || name == NULL || spec == NULL)
2312 if (!ppd->sorted_attrs)
2313 ppd->sorted_attrs = cupsArrayNew((cups_array_func_t)ppd_compare_attrs,
2320 if (ppd->num_attrs == 0)
2323 ptr = realloc(ppd->attrs, (size_t)(ppd->num_attrs + 1) * sizeof(ppd_attr_t *));
2328 ppd->attrs = ptr;
2329 ptr += ppd->num_attrs;
2336 ppd->num_attrs ++;
2351 cupsArrayAdd(ppd->sorted_attrs, temp);
2396 ppd_add_size(ppd_file_t *ppd, /* I - PPD file */
2402 if (ppd->num_sizes == 0)
2405 size = realloc(ppd->sizes, sizeof(ppd_size_t) * (size_t)(ppd->num_sizes + 1));
2410 ppd->sizes = size;
2411 size += ppd->num_sizes;
2412 ppd->num_sizes ++;
2531 ppd_free_filters(ppd_file_t *ppd) /* I - PPD file */
2537 if (ppd->num_filters > 0)
2539 for (i = ppd->num_filters, filter = ppd->filters; i > 0; i --, filter ++)
2542 ppd_free(ppd->filters);
2544 ppd->num_filters = 0;
2545 ppd->filters = NULL;
2614 ppd_get_coption(ppd_file_t *ppd, /* I - PPD file */
2624 if ((copt = ppdFindCustomOption(ppd, name)) != NULL)
2638 cupsArrayAdd(ppd->coptions, copt);
2696 ppd_get_group(ppd_file_t *ppd, /* I - PPD file */
2706 DEBUG_printf(("7ppd_get_group(ppd=%p, name=\"%s\", text=\"%s\", cg=%p)",
2707 ppd, name, text, pg));
2709 for (i = ppd->num_groups, group = ppd->groups; i > 0; i --, group ++)
2724 if (ppd->num_groups == 0)
2727 group = realloc(ppd->groups, (size_t)(ppd->num_groups + 1) * sizeof(ppd_group_t));
2736 ppd->groups = group;
2737 group += ppd->num_groups;
2738 ppd->num_groups ++;
3362 ppd_update_filters(ppd_file_t *ppd, /* I - PPD file */
3377 DEBUG_printf(("4ppd_update_filters(ppd=%p, cg=%p)", ppd, pg));
3383 if ((attr = ppdFindAttr(ppd, "cupsFilter2", NULL)) == NULL)
3393 ppd_free_filters(ppd);
3446 if (ppd->num_filters == 0)
3449 filter = realloc(ppd->filters, sizeof(char *) * (size_t)(ppd->num_filters + 1));
3459 ppd->filters = filter;
3460 filter += ppd->num_filters;
3461 ppd->num_filters ++;
3465 while ((attr = ppdFindNextAttr(ppd, "cupsFilter2", NULL)) != NULL);