GUI: Dead kittens.
[gnumeric.git] / src / expr-impl.h
blobe155f13f804b33928cb5af0e51b4dc7b82c804b9
1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 #ifndef _GNM_EXPR_IMPL_H_
3 # define _GNM_EXPR_IMPL_H_
5 #include "gnumeric.h"
6 #include "numbers.h"
7 #include "parse-util.h"
10 G_BEGIN_DECLS
12 struct _GnmExprConstant {
13 guint8 oper;
14 GnmValue const *value;
17 struct _GnmExprFunction {
18 guint8 oper;
19 int argc;
20 GnmFunc *func;
21 GnmExprConstPtr *argv;
24 struct _GnmExprUnary {
25 guint8 oper;
26 GnmExpr const *value;
29 struct _GnmExprBinary {
30 guint8 oper;
31 GnmExpr const *value_a;
32 GnmExpr const *value_b;
35 /* We could break this out into multiple types to be more space efficient */
36 struct _GnmExprName {
37 guint8 oper;
38 Sheet *optional_scope;
39 Workbook *optional_wb_scope;
40 GnmNamedExpr *name;
43 struct _GnmExprCellRef {
44 guint8 oper;
45 GnmCellRef ref;
48 struct _GnmExprArrayCorner {
49 guint8 oper;
50 guint32 cols, rows;
51 GnmValue *value; /* Last array result */
52 GnmExpr const *expr; /* Real Expression */
54 struct _GnmExprArrayElem {
55 guint8 oper;
56 guint32 x, y;
59 struct _GnmExprSet {
60 guint8 oper;
61 int argc;
62 GnmExprConstPtr *argv;
65 union _GnmExpr {
66 GnmExprConstant constant;
67 GnmExprFunction func;
68 GnmExprUnary unary;
69 GnmExprBinary binary;
70 GnmExprName name;
71 GnmExprCellRef cellref;
72 GnmExprArrayCorner array_corner;
73 GnmExprArrayElem array_elem;
74 GnmExprSet set;
77 #define GNM_EXPR_GET_OPER(e_) (0 ? (e_) == (GnmExpr const *)0 : (GnmExprOp)*(guint8*)(e_))
79 #define gnm_expr_constant_init(expr, val) \
80 do { \
81 (expr)->oper = GNM_EXPR_OP_CONSTANT; \
82 (expr)->value = val; \
83 } while (0)
86 struct _GnmExprSharer {
87 GHashTable *exprs;
89 int nodes_in, nodes_stored, nodes_killed;
90 unsigned ref_count;
94 G_END_DECLS
96 #endif /* _GNM_EXPR_IMPL_H_ */