summaryrefslogtreecommitdiff
path: root/filter/struct.m4
blob: 7af28cfd8ac87f8035bb02b55f19722a476890c1 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
m4_divert(-1)m4_dnl
#
#	BIRD -- Definition of per-instruction structures
#
#	(c) 2018 Maria Matejka <mq@jmq.cz>
#
#	Can be freely distributed and used under the terms of the GNU GPL.
#

# Common aliases
m4_define(DNL, `m4_dnl')

m4_define(INST_FLUSH, `m4_ifdef([[INST_NAME]], [[
m4_divert(1)
struct f_inst_[[]]INST_NAME() {
m4_undivert(2)
};
m4_divert(3)
struct f_inst_[[]]INST_NAME() i_[[]]INST_NAME();
m4_divert(-1)
]])')
m4_define(INST, `INST_FLUSH()m4_define([[INST_NAME]], [[$1]])')

m4_define(ARG, `m4_divert(2)const struct f_inst *f$1;
m4_divert(-1)')
m4_define(ARG_ANY, `m4_divert(2)const struct f_inst *f$1;
m4_divert(-1)')
m4_define(LINE, `m4_divert(2)const struct f_inst *f$1;
m4_divert(-1)')
m4_define(LINEP, `m4_divert(2)const struct f_line *fl$1;
m4_divert(-1)')
m4_define(SYMBOL, `m4_divert(2)const struct symbol *sym;
m4_divert(-1)')
m4_define(VALI, `m4_divert(2)struct f_val vali;
m4_divert(-1)')
m4_define(VALP, `m4_divert(2)const struct f_val *valp;
m4_divert(-1)')
m4_define(VAR, `VALP()SYMBOL()')
m4_define(FRET, `m4_divert(2)enum filter_return fret;
m4_divert(-1)')
m4_define(ECS, `m4_divert(2)enum ec_subtype ecs;
m4_divert(-1)')
m4_define(RTC, `m4_divert(2)const struct rtable_config *rtc;
m4_divert(-1)')
m4_define(STATIC_ATTR, `m4_divert(2)struct f_static_attr sa;
m4_divert(-1)')
m4_define(DYNAMIC_ATTR, `m4_divert(2)struct f_dynamic_attr da;
m4_divert(-1)')
m4_define(COUNT, `m4_divert(2)uint count;
m4_divert(-1)')
m4_define(TREE, `m4_divert(2)const struct f_tree *tree;
m4_divert(-1)')
m4_define(STRING, `m4_divert(2)const char *s;
m4_divert(-1)')
m4_define(STRUCT, `m4_divert(2)$1
m4_divert(-1)')

m4_m4wrap(`
INST_FLUSH()
m4_divert(0)DNL
m4_undivert(1)

struct f_inst {
  const struct f_inst *next;		/* Next instruction */
  enum f_instruction_code fi_code;	/* Instruction code */
  int lineno;				/* Line number */
  union {
    m4_undivert(3)
  };
};
')

m4_changequote([[,]])