Feature request: support for & operator in macros

Started by japheth, May 13, 2007, 07:34:18 AM

Previous topic - Next topic

japheth

Hello,

would be great if PoASM supports the "&" operator in macros. Example:


VMMCall macro name_
    int 20h
    dw VMM_&name_
    dw 1
    endm


currently PoASm complains:
  error: invalid use of 'VMM_'.
  error: invalid use of '&'.

The purpose of '&' in the example above is to use the <name_> argument without a preceding/trailing white space character. It is supported by MASM and TASM.

Regards

Japheth



Pelle

You should be able to use:
VMM_ # name_

The & operator is a bit of a mess, so I rather ignore it...
/Pelle

japheth


> You should be able to use:
> VMM_ # name_

Thanks for the hint! It works. However, there is a catch (although it's more a MASM bug):

You cannot code:

VMMCall macro name_
    int 20h
ifndef __POASM__
    dw VMM_&name_
else
    dw VMM_ # name_
endif
    dw 1
    endm


because MASM's macro parser complains about the '#' (invalid character in file). Apparently the inactive code is not totally ignored by MASM. So it has to be done this way:


ifndef __POASM__
VMMCall macro name_
    int 20h
    dw VMM_&name_
    dw 1
    endm
else
VMMCall macro name_
    int 20h
    dw VMM_ # name_
    dw 1
    endm
endif


This style significantly bloats the include files, especially if larger macros are used.

Regards

Japheth

Pelle

OK, I see. I just don't like that & is also a binary operator ('AND') - this complicate a few things...
/Pelle