wdc-utils/expression.h

35 lines
569 B
C
Raw Normal View History

2017-01-07 18:04:13 +00:00
#ifndef __expression_h__
#define __expression_h__
#include <stdint.h>
#include <vector>
2017-01-09 01:17:10 +00:00
#include "optional.h"
2017-01-07 18:04:13 +00:00
struct expr {
expr(int t = 0, uint32_t v = 0, uint32_t s = 0)
: tag(t), value(v), section(s)
{}
int tag = 0;
uint32_t value = 0;
unsigned section = 0;
};
struct expression {
unsigned section = 0;
uint32_t offset = 0;
uint8_t size = 0;
uint8_t relative = false;
bool undefined = false;
std::vector<expr> stack;
};
2017-01-09 01:17:10 +00:00
optional<uint32_t> evaluate_expression(expression &e, bool force = false);
2017-01-07 18:04:13 +00:00
bool simplify_expression(expression &e);
#endif