summaryrefslogtreecommitdiff
path: root/src/expr.h
blob: 5795e8b70e1cb0bcec89c370dca6adc995dfa05e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef ANIMTOOL_EXPR_H_
#define ANIMTOOL_EXPR_H_

#include "op.h"
#include "source.h"

enum expr_type
{
    EXPR_NUMBER,
    EXPR_OP,
    EXPR_TIME,
};

struct expr
{
    struct range loc;
    enum expr_type type;
    union {
        double number;
        struct {
            enum op_type type;
            array(struct expr) args;
        } op;
    };
};

double expr_eval(struct expr *expr, double time);
void expr_free(struct expr *expr);
void expr_copy(struct expr *dst, struct expr *src);

#endif