NO

Author Topic: Feature request: support for & operator in macros  (Read 7279 times)

japheth

  • Guest
Feature request: support for & operator in macros
« on: May 13, 2007, 07:34:18 AM »
Hello,

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

Code: [Select]
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



Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: Feature request: support for & operator in macros
« Reply #1 on: June 05, 2007, 09:44:05 AM »
You should be able to use:
VMM_ # name_

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

japheth

  • Guest
Re: Feature request: support for & operator in macros
« Reply #2 on: June 05, 2007, 11:45:16 AM »

> 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:
Code: [Select]
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:

Code: [Select]
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

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: Feature request: support for & operator in macros
« Reply #3 on: June 07, 2007, 08:25:41 PM »
OK, I see. I just don't like that & is also a binary operator ('AND') - this complicate a few things...
/Pelle