flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > problem passing a struc to a macro

Author
Thread Post new topic Reply to topic
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 06 May 2005, 01:43
Hi, I'm new in FASM and I have a problem passing a struc to a macro.

This is the macro:
Code:
macro doRect hDC, rc
{
  invoke Rectangle, [hDC],\    ; handle of device context
                    rc.left,\  ; x-coord. of bounding rectangle's upper-left corner
                    rc.top,\   ; y-coord. of bounding rectangle's upper-left corner
                    rc.right,\ ; x-coord. of bounding rectangle's lower-right corner
                    rc.bottom  ; y-coord. of bounding rectangle's lower-right corner
}
    


And the problem is when I use the macro in this way:

doRect, hDC, rect

FASM throws "Error: undefined symbol"; "instruction: push rc.bottom"

The problem is that rc is not replaced by rect but if I put a space between rc and . then FASM replace correctly but again an error "Error: undefined symbol" "instruction: push rect .bottom"

What can I do to fix it?
Post 06 May 2005, 01:43
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 06 May 2005, 04:56
Code:
macro doRect hDC, rc
{
  invoke Rectangle, [hDC],\
                    rc#.left,\
                    rc#.top,\
                    rc#.right,\
                    rc#.bottom
}    
Post 06 May 2005, 04:56
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 06 May 2005, 14:13
remember that in fasm "." character is normal part of name, like any letter or digit, not operator to separate structure members. Looking like such operator is only kind-of standard and behavior of "struc" macrodirective.

And since "." is normal part of name, FASM has seen "rc.left" symbol, which isn't equal with "rc" and so it wasnt replaced.
Post 06 May 2005, 14:13
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 06 May 2005, 14:26
Thanks to both, I tested the code of Privalov and it works fine Very Happy

Vid thanks for your reply, I did not know what you say about the dot.
Post 06 May 2005, 14:26
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 06 May 2005, 16:46
BTW, fasm's syntax highlighting (applied also on this forum) shows you this fact - the special characters (which split words) are shown in blue, and dot isn't.
Post 06 May 2005, 16:46
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 06 May 2005, 20:46
ahp, good point Razz

thanks again Privalov
Post 06 May 2005, 20:46
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.