2012-05-21 05:04:41 +03:00
|
|
|
/*
|
|
|
|
* relop.h - Relational operators
|
|
|
|
*
|
|
|
|
* Copyright 2012 by Werner Almesberger
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef RELOP_H
|
|
|
|
#define RELOP_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
2012-05-31 18:33:52 +03:00
|
|
|
enum relop_idx {
|
|
|
|
idx_lt = 0,
|
|
|
|
idx_le = 1,
|
|
|
|
idx_eq = 2,
|
|
|
|
idx_ge = 3,
|
|
|
|
idx_gt = 4,
|
|
|
|
idx_n = 5
|
|
|
|
};
|
|
|
|
|
2012-05-21 05:04:41 +03:00
|
|
|
enum relop {
|
2012-05-31 18:33:52 +03:00
|
|
|
rel_lt = 1 << idx_lt,
|
|
|
|
rel_le = 1 << idx_le,
|
|
|
|
rel_eq = 1 << idx_eq,
|
|
|
|
rel_ge = 1 << idx_ge,
|
|
|
|
rel_gt = 1 << idx_gt,
|
2012-05-21 05:04:41 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-05-31 18:33:52 +03:00
|
|
|
/*
|
|
|
|
* relop_implies checks whether, for all X: (X opb A) -> (X opa B)
|
|
|
|
*/
|
|
|
|
|
|
|
|
int relop_implies(enum relop opa, enum relop opb, const void *a, const void *b,
|
|
|
|
int (*cmp)(const void *a, enum relop op, const void *b, const void *user),
|
|
|
|
const void *user);
|
2012-05-21 05:04:41 +03:00
|
|
|
void dump_relop(FILE *file, enum relop op);
|
|
|
|
|
|
|
|
#endif /* !RELOP_H */
|