The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: RedXVII on March 28, 2007, 10:17:36 PM

Title: specify LOCAL in macro
Post by: RedXVII on March 28, 2007, 10:17:36 PM
im making a complicated MACRO but would like to be able to specify/add a local variable of a proc in a macro, see below for a simplified idea of what i want to do. Thanks for any help  :U

MAKELOCAL MACRO name, type
  .code
  LOCAL name:type
ENDM


Myfunction proc coffee:DWORD, carrots:DWORD
  LOCAL chips:DWORD
  LOCAL beans:DWORD
  MAKELOCAL toffees, DWORD
  MAKELOCAL window, RECT
  mov eax, coffee
  mov toffees, eax
  ;... etc
Myfunction endp
Title: Re: specify LOCAL in macro
Post by: RedXVII on March 28, 2007, 10:32:54 PM
just did it, the & sign was needed. Wow, im suprised that works, the more i use masm the more i realise how powerful these macros are. Im impressed it works without fuss too, if this were a C or C++ program, i'd be burried under 1000 lines of errors by now  :lol

Thanks anyway  :U

MAKELOCAL MACRO name, type
  .code
  LOCAL &name:&type
ENDM


Myfunction proc coffee:DWORD, carrots:DWORD
  LOCAL chips:DWORD
  LOCAL beans:DWORD
  MAKELOCAL toffees, DWORD
  MAKELOCAL window, RECT
  mov eax, coffee
  mov toffees, eax
  ;... etc
Myfunction endp