4 ms·
I'm a fan of M4, and I don't know what these are doing but it surely looks too complex. You have defines within defines and OMG just an extract .. (just a sn
by throwaway_pdp09 7y ago
I'm a fan of M4, and I don't know what these are doing but it surely looks too complex. You have defines within defines and OMG just an extract
.. (just a snip follows)
`define(`_'''$`'1```_LENGTH',strlenc(''$`'2``))'dnl
`; "''$`'2``"'
`ifdef(`PB3', ''$`'1```: calltable($4, $1, estr('''$`'2```))dnl
return',dnl
`table '''$`'1```#, [dec2pbhex(cstr('''$`'2```))]
'''$`'1```: loadaddr($2, $3, _'''$`'1```_STR)
jump __`'$5`'_handler
_'''$`'1```_STR: load&return $1, '''$`'1```#')'
)')'
I have to ask if this is right, or whether a parser would have been a whole lot less work. Credit for your skillz, but that looks like so much pain.
- kevin_thibedeau 7y agoThese are macros that generate user configurable codegen macros. I couldn't hard code register assignments so everything dynamically generated is prepared with these monstrosities. They also can't have fixed names since some need to be invoked multiple times with different parameters. FWIW I didn't intend for things to go this far. I just started with some simple macros and it snowballed.