| 697 | */ |
| 698 | |
| 699 | static void |
| 700 | ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */ |
| 701 | { |
| 702 | int i; /* Looping var */ |
| 703 | ppd_const_t *oldconst; /* Current UIConstraints data */ |
| 704 | ppd_attr_t *constattr; /* Current cupsUIConstraints attribute */ |
| 705 | _ppd_cups_uiconsts_t *consts; /* Current cupsUIConstraints data */ |
| 706 | _ppd_cups_uiconst_t *constptr; /* Current constraint */ |
| 707 | ppd_group_t *installable; /* Installable options group */ |
| 708 | const char *vptr; /* Pointer into constraint value */ |
| 709 | char option[PPD_MAX_NAME], /* Option name/MainKeyword */ |
| 710 | choice[PPD_MAX_NAME], /* Choice/OptionKeyword */ |
| 711 | *ptr; /* Pointer into option or choice */ |
| 712 | |
| 713 | |
| 714 | DEBUG_printf(("7ppd_load_constraints(ppd=%p)", ppd)); |
| 715 | |
| 716 | /* |
| 717 | * Create an array to hold the constraint data... |
| 718 | */ |
| 719 | |
| 720 | ppd->cups_uiconstraints = cupsArrayNew(NULL, NULL); |
| 721 | |
| 722 | /* |
| 723 | * Find the installable options group if it exists... |
| 724 | */ |
| 725 | |
| 726 | for (i = ppd->num_groups, installable = ppd->groups; |
| 727 | i > 0; |
| 728 | i --, installable ++) |
| 729 | if (!_cups_strcasecmp(installable->name, "InstallableOptions")) |
| 730 | break; |
| 731 | |
| 732 | if (i <= 0) |
| 733 | installable = NULL; |
| 734 | |
| 735 | /* |
| 736 | * Load old-style [Non]UIConstraints data... |
| 737 | */ |
| 738 | |
| 739 | for (i = ppd->num_consts, oldconst = ppd->consts; i > 0; i --, oldconst ++) |
| 740 | { |
| 741 | /* |
| 742 | * Weed out nearby duplicates, since the PPD spec requires that you |
| 743 | * define both "*Foo foo *Bar bar" and "*Bar bar *Foo foo"... |
| 744 | */ |
| 745 | |
| 746 | if (i > 1 && |
| 747 | !_cups_strcasecmp(oldconst[0].option1, oldconst[1].option2) && |
| 748 | !_cups_strcasecmp(oldconst[0].choice1, oldconst[1].choice2) && |
| 749 | !_cups_strcasecmp(oldconst[0].option2, oldconst[1].option1) && |
| 750 | !_cups_strcasecmp(oldconst[0].choice2, oldconst[1].choice1)) |
| 751 | continue; |
| 752 | |
| 753 | /* |
| 754 | * Allocate memory... |
| 755 | */ |
| 756 |
no test coverage detected