- if (streq(cond->symbol, symbol)) {
- if (cond->inverse)
- return NOT_COMPILED;
- else
- return COMPILED;
- }
- /* Unknown symbol, assume undefined. */
- if (cond->inverse)
- return COMPILED;
- return NOT_COMPILED;
-
- default: /* Unknown. */
- return MAYBE_COMPILED;
+ if (cond->inverse == !sym->value)
+ ret = COMPILED;
+ else
+ ret = NOT_COMPILED;
+ break;
+
+ default:
+ abort();
+ }
+
+ /* If parent didn't know, NO == NO, but YES == MAYBE. */
+ if (parent == MAYBE_COMPILED && ret == COMPILED)
+ ret = MAYBE_COMPILED;
+ return ret;
+}
+
+static void add_symbol(struct list_head *head,
+ const char *symbol, const unsigned int *value)
+{
+ struct symbol *sym = talloc(head, struct symbol);
+ sym->name = symbol;
+ sym->value = value;
+ list_add(head, &sym->list);
+}
+
+enum line_compiled get_ccan_line_pp(struct pp_conditions *cond,
+ const char *symbol,
+ const unsigned int *value,
+ ...)
+{
+ enum line_compiled ret;
+ struct list_head *head;
+ va_list ap;
+
+ head = talloc(NULL, struct list_head);
+ list_head_init(head);
+
+ va_start(ap, value);
+ add_symbol(head, symbol, value);
+
+ while ((symbol = va_arg(ap, const char *)) != NULL) {
+ value = va_arg(ap, const unsigned int *);
+ add_symbol(head, symbol, value);