flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > BUG: Macro Processing Error?

Author
Thread Post new topic Reply to topic
kidscracker



Joined: 29 Oct 2004
Posts: 46
Location: Peru
kidscracker
Well I've been learning the macro sintaxis for the last 2 weeks, and can't find a workaround for this problem. I define a constant with a value, depending the value of this constant I define some macros in my include files, here is the code:
Code:
format PE GUI 4.0
entry start

UNICODE EQU     TRUE

include '%fasminc%164\win32w.inc'
    


The win32w.inc is:
Code:
; Win32 programming headers (WideChar)
include 'macro/struct.inc'
include 'macro/proc32.inc'
include 'macro/com32.inc'
include 'macro/import32.inc'
include 'macro/export.inc'
include 'macro/resource.inc'

struc CHAR val { match any, val \{ . du val \}
                 match , val \{ . du ? \} }

include 'equates/kernel32.inc'
include 'equates/user32.inc'
include 'equates/gdi32.inc'
include 'equates/comctl32.inc'     ;<--- My modified include
include 'equates/comdlg32.inc'
include 'equates/shell32.inc'
include 'equates/wsock32.inc'
    

at the top of the comctl32.inc I've put this code to define or not the constant for a correct process, but It acts randomly with errors.
The code:
Code:
IF ~defined UNICODE
        display "UNICODE not defined,defining as FALSE",0Dh,0Ah
        match any,UNICODE {UNICODE      EQU        FALSE}
;        match ,UNICODE {UNICODE      EQU        FALSE}
END IF

match =FALSE ,UNICODE {display "UNICODE defined as FALSE",0Dh,0Ah}
match =TRUE  ,UNICODE {display "UNICODE defined as TRUE",0Dh,0Ah} 

WM_MESSAGEA = 100
WM_MESSAGEW = 200
IF UNICODE
WM_MESSAGE = WM_MESSAGEW
ELSE
WM_MESSAGE = WM_MESSAGEA
END IF
    


I've used "match any", and "match ", but they works fine only once, then I must change from one to the other,It's crazy!!!.

Try with that sequence:
1. Use "match any" and copile, without defining UNICODE [OK]
2. Define UNICODE as TRUE and copile, during the copilation it says that UNICODE is defined as false, not as TRUE!!! this is one error. [ERROR]
3. Now use "match " and copile, now it says that UNICODE is defined as TRUE, works fine!!! [OK]
4. Copile again, but without defining UNICODE, it shows an error when i use UNICODE, it's not defined!!! [ERROR]

I've tried to give you all the sequence, why does it happen? i need help.
Thanx in advance.
Post 11 Oct 2005, 17:08
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
"if" is not a preprocessor directive, read FAQ
Post 11 Oct 2005, 17:14
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
kidscracker



Joined: 29 Oct 2004
Posts: 46
Location: Peru
kidscracker
So a possible solution wil be...??? may be there's one no ?
Post 11 Oct 2005, 17:26
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
read about match directive in the manual.
Post 11 Oct 2005, 17:41
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7712
Location: Kraków, Poland
Tomasz Grysztar
Use "UNICODE = TRUE" instead of "UNICODE EQU TRUE" and then:
Code:
IF ~defined UNICODE | defined @f
        display "UNICODE not defined,defining as FALSE",0Dh,0Ah
        @@: UNICODE = FALSE
END IF

WM_MESSAGEA = 100
WM_MESSAGEW = 200
IF UNICODE
WM_MESSAGE = WM_MESSAGEW
ELSE
WM_MESSAGE = WM_MESSAGEA
END IF    

I suggest reading the sections 2.2 and 2.3 of manual carefully. And remember that preprocessor (described in 2.3) does its all job before the multi-pass assembler and its control directives (described in 2.2) come in. I have extended section 2.3.7 to cover this.
Post 11 Oct 2005, 22:36
View user's profile Send private message Visit poster's website 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-2020, Tomasz Grysztar.

Powered by rwasa.