Hi ppl,

I am having trouble with converting something from C to FASM:

#define _IOC(dir,type,nr,size) \
(((dir)  << _IOC_DIRSHIFT) | \
((type) << _IOC_TYPESHIFT) | \
((nr)   << _IOC_NRSHIFT) | \
((size) << _IOC_SIZESHIFT))

#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(size))

#define TEST _IOR('t', 90, 4)


Basically I want to make the FASM variant as close to C as possible:

macro _IOC dir,type,nr,size
{((dir shl _IOC_DIRSHIFT) or (type shl _IOC_TYPESHIFT) or (nr shl _IOC_NRSHIFT) or (size shl _IOC_SIZESHIFT))}

macro _IOR type, nr, size {_IOC _IOC_READ, type, nr, size}

TEST equ (_IOR 't', 90, 4)     ;  <---    the problem.


Is there any way to make FASM to assign a result of a macro instead of the macro invoking string?
Or any other way to convert this? I suspect that I am taking a completely wrong direction here... Saw somewhere same thing being done differently, but forgot where or how  :sad:

Posted on 2006-08-28 15:24:31 by arafel
Hmmm, good question... the FASM macro system doesn't have an equivalent to MASM's "EXITM"... but I'm pretty green with fasm macros. You might have a better chance of decent replies on the FASM board :)
Posted on 2006-08-28 17:30:19 by f0dder

You might have a better chance of decent replies on the FASM board :)


Yep, I guess I should overcome my laziness and finally register there. :)
Posted on 2006-08-29 04:01:16 by arafel