defining params, I would like to be able to cast data types.
For example (byte) 1 or simply byte 1 to a dword-sized variable.
This is the simplest example, but stretches to complex custom data types
For instance, I have string.ucs2 data type which converts string value to UCS-2. The part of data type casting macro is as follows:
match (type) v, value
length = $
Unfortunately, this breaks passing evaluated values like ( CONST shl 8 ) + 2
Adding match (=type?) v, value for each data type is obviously not an option, but checks like
throw error "extra characters on line"
How can I solve this?
Tomasz, maybe "extra characters on line" error should not be thrown at all when in IF param, simply returning false to allow further processing?
Joined: 16 Jun 2003
Location: Kraków, Poland
Allowing a freeform text in the arguments to IF is a can of worms that I wanted to avoid in case of fasmg, so IF only allows proper expressions and processing of freeform parameters is left to MATCH.
And your problem is really devious, too - considering that symbols like "byte" are actually numeric constants. So for example "(byte) +1" is a valid numeric expression with value 2, because it is the same as "(1)+1".
You could try making some symbolic definitions that you could then detect with MATCH:
cast.byteequ ++1-- match (x) v, arg
match ++sz--, cast.x
size = sz
value = v
value = arg
value = arg
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