Hi, i triyng to processate the next line of code:
But the symbols "a", "b", "c" and "d" are not defined in the code. When i try to compare a symbol:
Fasm G shows me (for example) "symbol 'a' is undefined or out of scope". But my intention is define this symbol after, because i need use it in an expression.
I am new with this macro-proccessor and i dont known exactly how i need use it. This is my code until now...
macro print text*
local s
s = text
display s,13,10
end macro
macro inc? symbol,step:1
symbol = symbol + step
end macro
macro parse_var_line return,line&
local buffer,last,needdatatype,varcount,item
;return.COUNT_MEMBER = return.COUNT_MEMBER or 0
;return.SCAN_MEMBER = return.COUNT_MEMBER
last = 0
needdatatype = 0
varcount = 0
define buffer line
while 1
; Splits on tokens and put one in "item".
match f rest,buffer
redefine item f
define buffer rest
else
match f,buffer
last = 1
end match
end match
; To evade code duplication inside of "matchs", i write the "item" verification here.
; Item can't be comparated with anything, because is not defined.
if item eq symbol
if needdatatype = 1
;if item eq DWORD
; return.member#return.COUNT_MEMBER#.type = `DWORD
;end if
repeat return.COUNT_MEMBER i:return.SCAN_MEMBER
return.member#i#.type = `item
end repeat
needdatatype = 0
else
return.member#return.COUNT_MEMBER#.name = `item
inc varcount
end if
else if item eq ,
inc return.COUNT_MEMBER
else if item = @
return.member#return.COUNT_MEMBER#.ispointer = 1
else if item = :
needdatatype = 1
end if
if last = 1
break
end if
end while
end macro
define G_VARS
G_VARS.COUNT_MEMBER = 0
G_VARS.SCAN_MEMBER = 0
macro var? line&
parse_var_line G_VARS,line
end macro
; Code to process.
var a,b,c:DWORD
; Shows in console the number of members or "variables" defined.
print "0"+G_VARS.COUNT_MEMBER
; Shows variable names.
repeat G_VARS.COUNT_MEMBER
print G_VARS.member#%#.name
end repeat
Edit: I tried to use "defined", but the "item" symbol can be a (for example) comma (,) and this makes an error.
Sorry for my bad english. And thanks for your help.