2018-12-27 21:26:11 +08:00
|
|
|
m4_divert(-1)m4_dnl
|
|
|
|
#
|
|
|
|
# BIRD -- Converting instructions trees to instruction lines
|
|
|
|
#
|
|
|
|
# (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')
|
|
|
|
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(INST_FLUSH, `m4_ifdef([[INST_NAME]], [[
|
|
|
|
m4_divert(1)
|
|
|
|
case INST_NAME():
|
|
|
|
#define what ((const struct f_inst_]]INST_NAME()[[ *) &(what_->i_]]INST_NAME()[[))
|
|
|
|
m4_undivert(2)
|
2019-01-21 16:17:54 +08:00
|
|
|
#undef what
|
2019-02-06 21:41:39 +08:00
|
|
|
dest->items[pos].fi_code = what_->fi_code;
|
|
|
|
dest->items[pos].lineno = what_->lineno;
|
|
|
|
break;
|
|
|
|
m4_divert(-1)
|
|
|
|
]])')
|
|
|
|
m4_define(INST, `INST_FLUSH()m4_define([[INST_NAME]], [[$1]])')
|
|
|
|
|
|
|
|
m4_define(ARG, `m4_divert(2)pos = postfixify(dest, what->f$1, pos);
|
2018-12-27 21:26:11 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(ARG_ANY, `m4_divert(2)pos = postfixify(dest, what->f$1, pos);
|
2018-12-27 21:26:11 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(LINE, `m4_divert(2)dest->items[pos].lines[$2] = f_postfixify(what->f$1);
|
2018-12-27 21:26:11 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(LINEP, `m4_divert(2)dest->items[pos].lines[$2] = what->fl$1;
|
2018-12-27 21:26:11 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(SYMBOL, `m4_divert(2)dest->items[pos].sym = what->sym;
|
2018-12-27 21:26:11 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(VALI, `m4_divert(2)dest->items[pos].val = what->vali;
|
2018-12-27 21:26:11 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(VALP, `m4_divert(2)dest->items[pos].val = *(what->valp);
|
2018-12-27 21:26:11 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(VAR, `m4_divert(2)dest->items[pos].vp = (dest->items[pos].sym = what->sym)->def;
|
2018-12-27 21:26:11 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(FRET, `m4_divert(2)dest->items[pos].fret = what->fret;
|
2018-12-27 21:26:11 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(ECS, `m4_divert(2)dest->items[pos].ecs = what->ecs;
|
2019-01-21 16:17:54 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(RTC, `m4_divert(2)dest->items[pos].rtc = what->rtc;
|
2018-12-27 21:26:11 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(STATIC_ATTR, `m4_divert(2)dest->items[pos].sa = what->sa;
|
2018-12-27 21:26:11 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(DYNAMIC_ATTR, `m4_divert(2)dest->items[pos].da = what->da;
|
2018-12-27 21:26:11 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(COUNT, `m4_divert(2)dest->items[pos].count = what->count;
|
2019-01-21 16:17:54 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(TREE, `m4_divert(2)dest->items[pos].tree = what->tree;
|
2019-01-21 16:17:54 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(STRING, `m4_divert(2)dest->items[pos].s = what->s;
|
2018-12-27 21:26:11 +08:00
|
|
|
m4_divert(-1)')
|
2019-02-06 21:41:39 +08:00
|
|
|
m4_define(POSTFIXIFY, `m4_divert(2)$1m4_divert(-1)')
|
2018-12-27 21:26:11 +08:00
|
|
|
|
|
|
|
m4_m4wrap(`
|
2019-02-06 21:41:39 +08:00
|
|
|
INST_FLUSH()
|
2018-12-27 21:26:11 +08:00
|
|
|
m4_divert(0)DNL
|
|
|
|
m4_undivert(1)
|
2019-02-06 21:41:39 +08:00
|
|
|
|
|
|
|
default: bug( "Unknown instruction %d (%c)", what_->fi_code, what_->fi_code & 0xff);
|
2018-12-27 21:26:11 +08:00
|
|
|
')
|
|
|
|
|
|
|
|
m4_changequote([[,]])
|