Nasm preprocessor - again
anonymous coward
nasm64developer at yahoo.com
Sun Sep 17 00:14:25 PDT 2006
> [NASM PP vs YAPP]
Fwiw, attached find the part of the NASM64 user
manual that describes the NASM64 preprocessor.
As for the problem in question -- it's a result
of the traditional NASM preprocessor not doing
mmac nesting properly in do_directive(). To fix
it, one needs something like this...
if ( defining ) {
if (
i == PP_MACRO || i == PP_MACRO1 || i == PP_MACRO2 ||
i == PP_IMACRO || i == PP_IMACRO1 || i == PP_IMACRO2
) {
nested_mac_count++;
return ( FALSE );
} else if ( nested_mac_count > 0 ) {
if ( i == PP_ENDMACRO ) {
nested_mac_count--;
return ( FALSE );
}
}
if ( !defining->name ) {
if ( i == PP_REP || i == PP_REPTOK || i == PP_REPSTR ) {
nested_rep_count++;
return ( FALSE );
} else if ( nested_rep_count > 0 ) {
if ( i == PP_ENDREP ) {
nested_rep_count--;
return ( FALSE );
}
}
}
}
...at the start of said function, between...
if (defining && i != PP_MACRO && i != PP_IMACRO &&
i != PP_ENDMACRO && i != PP_ENDM &&
(defining->name || (i != PP_ENDREP && i != PP_REP))) {
return NO_DIRECTIVE_FOUND;
}
...and...
if (j != -2) {
error(ERR_NONFATAL, "unknown preprocessor directive `%s'",
tline->text);
return NO_DIRECTIVE_FOUND; /* didn't get it */
}
Enjoy.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nasm64_pp.txt
Url: http://cvs.tortall.net/pipermail/yasm-devel/attachments/20060917/6f01af82/attachment-0001.txt
More information about the yasm-devel
mailing list