| 942 | */ |
| 943 | |
| 944 | static cups_array_t * /* O - Array of active constraints */ |
| 945 | ppd_test_constraints( |
| 946 | ppd_file_t *ppd, /* I - PPD file */ |
| 947 | const char *option, /* I - Current option */ |
| 948 | const char *choice, /* I - Current choice */ |
| 949 | int num_options, /* I - Number of additional options */ |
| 950 | cups_option_t *options, /* I - Additional options */ |
| 951 | int which) /* I - Which constraints to test */ |
| 952 | { |
| 953 | int i; /* Looping var */ |
| 954 | _ppd_cups_uiconsts_t *consts; /* Current constraints */ |
| 955 | _ppd_cups_uiconst_t *constptr; /* Current constraint */ |
| 956 | ppd_choice_t key, /* Search key */ |
| 957 | *marked; /* Marked choice */ |
| 958 | cups_array_t *active = NULL; /* Active constraints */ |
| 959 | const char *value, /* Current value */ |
| 960 | *firstvalue; /* AP_FIRSTPAGE_Keyword value */ |
| 961 | char firstpage[255]; /* AP_FIRSTPAGE_Keyword string */ |
| 962 | |
| 963 | |
| 964 | DEBUG_printf(("7ppd_test_constraints(ppd=%p, option=\"%s\", choice=\"%s\", " |
| 965 | "num_options=%d, options=%p, which=%d)", ppd, option, choice, |
| 966 | num_options, options, which)); |
| 967 | |
| 968 | if (!ppd->cups_uiconstraints) |
| 969 | ppd_load_constraints(ppd); |
| 970 | |
| 971 | DEBUG_printf(("9ppd_test_constraints: %d constraints!", |
| 972 | cupsArrayCount(ppd->cups_uiconstraints))); |
| 973 | |
| 974 | cupsArraySave(ppd->marked); |
| 975 | |
| 976 | for (consts = (_ppd_cups_uiconsts_t *)cupsArrayFirst(ppd->cups_uiconstraints); |
| 977 | consts; |
| 978 | consts = (_ppd_cups_uiconsts_t *)cupsArrayNext(ppd->cups_uiconstraints)) |
| 979 | { |
| 980 | DEBUG_printf(("9ppd_test_constraints: installable=%d, resolver=\"%s\", " |
| 981 | "num_constraints=%d option1=\"%s\", choice1=\"%s\", " |
| 982 | "option2=\"%s\", choice2=\"%s\", ...", |
| 983 | consts->installable, consts->resolver, consts->num_constraints, |
| 984 | consts->constraints[0].option->keyword, |
| 985 | consts->constraints[0].choice ? |
| 986 | consts->constraints[0].choice->choice : "", |
| 987 | consts->constraints[1].option->keyword, |
| 988 | consts->constraints[1].choice ? |
| 989 | consts->constraints[1].choice->choice : "")); |
| 990 | |
| 991 | if (consts->installable && which < _PPD_INSTALLABLE_CONSTRAINTS) |
| 992 | continue; /* Skip installable option constraint */ |
| 993 | |
| 994 | if (!consts->installable && which == _PPD_INSTALLABLE_CONSTRAINTS) |
| 995 | continue; /* Skip non-installable option constraint */ |
| 996 | |
| 997 | if ((which == _PPD_OPTION_CONSTRAINTS || which == _PPD_INSTALLABLE_CONSTRAINTS) && option) |
| 998 | { |
| 999 | /* |
| 1000 | * Skip constraints that do not involve the current option... |
| 1001 | */ |
no test coverage detected