News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Nested Macros don't go

Started by slaxor, August 25, 2006, 07:03:29 PM

Previous topic - Next topic

slaxor

Hi, I REALLY like GoAsm! Thanks!

I see that alot of people don't like macros here (I'm not a huge fan really) but I recently had a problem with nested macros.  They don't seem to work.  I did a search for macros in this forum and didnt find much.  I made a macro for error reporting because I got tired of typing identical code over and over.  But I also wanted a seperate error reporting macro for debugging and for 'release'.  Here is my code if you are curious:

#if DEBUG > 0
#define BM_ERROR(%a) INVOKE SHOW_ERROR, @line, @filecur, %a
#else
#define BM_ERROR(%a) INVOKE SHOW_ERROR, %a
#endif

#define TEST_ERROR(z) TEST EAX, EAX \
JNZ >         \
BM_ERROR(z) \
:

The SHOW_ERROR frame/function just displays a message box.

Here is the error copied from RadASM:
Misplaced quoted string:-
INVOKE SHOW_ERROR, @line, @filecur, 'Unable to allocate network handler'('Unable to allocate network handler')


I like the idea of using macros to test or report errors because if I can think of a better way to test/show errors I can just change the macros.  I skimmed the GoAsm manual but found no mention of nested macros.  Am I doing something wrong?  If not, will this ever be implemented in the future?

By the way, when TEST_ERROR's argument was named %a, the third argument to SHOW_ERROR came out as %a in the error message.  This problem isn't a big deal really I can just have TEST_ERROR not display a line number and filename.  I was just curious.

Thanks.  Take care.

jorgon

Hi Slaxor

Would you kindly confirm that the line which appears as:-
TESTEAX,EAX
is actually
TEST  EAX, EAX

Also would you mind posting an example of the implementation of the macro, ie. the TEST_ERROR line?

It looks as though there is some problem with picking up the string passed as an argument to TEST_ERROR

Meanwhile I confirm that GoAsm does support nested macros.

Thanks
Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)