| 566 | */ |
| 567 | |
| 568 | int /* O - Number of conflicts found */ |
| 569 | ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */ |
| 570 | { |
| 571 | int i, /* Looping variable */ |
| 572 | conflicts; /* Number of conflicts */ |
| 573 | cups_array_t *active; /* Active conflicts */ |
| 574 | _ppd_cups_uiconsts_t *c; /* Current constraints */ |
| 575 | _ppd_cups_uiconst_t *cptr; /* Current constraint */ |
| 576 | ppd_option_t *o; /* Current option */ |
| 577 | |
| 578 | |
| 579 | if (!ppd) |
| 580 | return (0); |
| 581 | |
| 582 | /* |
| 583 | * Clear all conflicts... |
| 584 | */ |
| 585 | |
| 586 | cupsArraySave(ppd->options); |
| 587 | |
| 588 | for (o = ppdFirstOption(ppd); o; o = ppdNextOption(ppd)) |
| 589 | o->conflicted = 0; |
| 590 | |
| 591 | cupsArrayRestore(ppd->options); |
| 592 | |
| 593 | /* |
| 594 | * Test for conflicts... |
| 595 | */ |
| 596 | |
| 597 | active = ppd_test_constraints(ppd, NULL, NULL, 0, NULL, |
| 598 | _PPD_ALL_CONSTRAINTS); |
| 599 | conflicts = cupsArrayCount(active); |
| 600 | |
| 601 | /* |
| 602 | * Loop through all of the UI constraints and flag any options |
| 603 | * that conflict... |
| 604 | */ |
| 605 | |
| 606 | for (c = (_ppd_cups_uiconsts_t *)cupsArrayFirst(active); |
| 607 | c; |
| 608 | c = (_ppd_cups_uiconsts_t *)cupsArrayNext(active)) |
| 609 | { |
| 610 | for (i = c->num_constraints, cptr = c->constraints; |
| 611 | i > 0; |
| 612 | i --, cptr ++) |
| 613 | cptr->option->conflicted = 1; |
| 614 | } |
| 615 | |
| 616 | cupsArrayDelete(active); |
| 617 | |
| 618 | /* |
| 619 | * Return the number of conflicts found... |
| 620 | */ |
| 621 | |
| 622 | return (conflicts); |
| 623 | } |
| 624 | |
| 625 | |