Rev | Line | |
---|
[8] | 1 | /* BDD error and argument checking routines */ |
---|
| 2 | |
---|
| 3 | |
---|
| 4 | #include <stdio.h> |
---|
| 5 | #include <stdarg.h> |
---|
| 6 | #include "bddint.h" |
---|
| 7 | |
---|
| 8 | #if STDC_HEADERS |
---|
| 9 | # include <stdlib.h> |
---|
| 10 | #else |
---|
| 11 | # if defined(__STDC__) |
---|
| 12 | extern void exit(int); |
---|
| 13 | # else |
---|
| 14 | extern void exit(); |
---|
| 15 | # endif |
---|
| 16 | #endif |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | /* cmu_bdd_warning(message) prints a warning and returns. */ |
---|
| 20 | |
---|
| 21 | void |
---|
| 22 | cmu_bdd_warning(char *message) |
---|
| 23 | { |
---|
| 24 | fprintf(stderr, "BDD library: warning: %s\n", message); |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | /* cmu_bdd_fatal(message) prints an error message and exits. */ |
---|
| 29 | |
---|
| 30 | void |
---|
| 31 | cmu_bdd_fatal(char *message) |
---|
| 32 | { |
---|
| 33 | fprintf(stderr, "BDD library: error: %s\n", message); |
---|
| 34 | exit(1); |
---|
| 35 | /* NOTREACHED */ |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | int |
---|
| 40 | bdd_check_arguments(int count, ...) |
---|
| 41 | { |
---|
| 42 | int all_valid; |
---|
| 43 | va_list ap; |
---|
| 44 | bdd f; |
---|
| 45 | |
---|
| 46 | va_start(ap, count); |
---|
| 47 | all_valid=1; |
---|
| 48 | while (count) |
---|
| 49 | { |
---|
| 50 | f=va_arg(ap, bdd); |
---|
| 51 | { |
---|
| 52 | BDD_SETUP(f); |
---|
| 53 | if (!f) |
---|
| 54 | all_valid=0; |
---|
| 55 | else if (BDD_REFS(f) == 0) |
---|
| 56 | cmu_bdd_fatal("bdd_check_arguments: argument has zero references"); |
---|
| 57 | } |
---|
| 58 | --count; |
---|
| 59 | } |
---|
| 60 | return (all_valid); |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | void |
---|
| 65 | bdd_check_array(bdd *fs) |
---|
| 66 | { |
---|
| 67 | while (*fs) |
---|
| 68 | { |
---|
| 69 | bdd_check_arguments(1, *fs); |
---|
| 70 | ++fs; |
---|
| 71 | } |
---|
| 72 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.