Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss
Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Better fix for parser "bug" in pmars 0.9.2

4 views
Skip to first unread message

newton

unread,
Feb 23, 2009, 9:47:28 AM2/23/09
to
This is a better pmars patch to correctly parse \ in comments...
(should also apply to pmars versions 0.8.6, 0.9.2-5 etc)

In asm.c change it to something like...

----- etc -----
/*
* Read characters until newline or EOF encountered. newline is
* excluded. Need to be non-strict boolean evaluation
*/
*buf = '\0';
i = 0; /* pointer to line buffer start */
// fixes by WTN 2/23/09 to make paperone marcia13 jackinthebox
// and other warriors that use \ in comments work properly.
int commentfound = FALSE;
do {
if (fgets(buf + i, MAXALLCHAR - i, infp)) {
for (; buf[i]; i++) {
if (buf[i] == ';') commentfound = TRUE;
if (buf[i] == '\n' || buf[i] == '\r')
break;
}
buf[i] = 0;
if (buf[i - 1] == '\\' && commentfound == FALSE) {
/* line continued */
// end WTN changes
conLine = TRUE;
buf[--i] = 0; /* reset */
} else
conLine = FALSE;
----- etc -----

If a line contains ";" the \ at the end of a line is
ignored, otherwise used as a continuation character.
Briefly tested, seems to work, but others should validate
these changes, for I'm not really a C programmer, just a
user who hacks C programs into submission as needed.

Terry

0 new messages