I want to expand a macro parameter into both a label and a string. It's for a forth interpreter where I want to pass the name of a 'word' to a macro once, and have that name expand into both a label and a string. For instance, the expansion of defword foo
should include both foo:
and db 'foo'
I've found a way to do it, but it's rather weird, is two macros, and produces a warning, "unterminated string" on the first macro. This is a simplified form:
%xdefine q '
%macro defword 1
%1: db %[q]%1%[q],13,10
%1len equ $-%1
%endmacro
Is there a 'proper' way to do this?