#define TKEYWORD99(token) return (options.std_c99 ? token : check_type())
-extern int lineno, column;
extern char *filename;
-
-/* global definitions */
-char *currFname;
-int mylineno = 1;
+extern int lineno;
+int column = 0; /* current column */
/* local definitions */
static struct dbuf_s asmbuff; /* reusable _asm buffer */
static int checkCurrFile (const char *s)
{
- int lNum;
- char *tptr;
+ int lNum;
+ char *tptr;
- /* skip '#' character */
- if (*s++ != '#')
- return 0;
+ /* skip '#' character */
+ if (*s++ != '#')
+ return 0;
- /* check if this is a #line
- this is not standard and can be removed in the future */
+ /* check if this is a #line
+ this is not standard and can be removed in the future */
#define LINE_STR "line"
#define LINE_LEN ((sizeof LINE_STR) - 1)
return 0;
s = tptr;
+ /* adjust the line number */
+ lineno = lNum;
+
/* now see if we have a file name */
while (*s != '"' && *s)
++s;
- /* if we don't have a filename then */
- /* set the current line number to */
- /* line number if printFlag is on */
- if (!*s) {
- lineno = mylineno = lNum;
- return 0;
- }
+ if (!*s)
+ {
+ /* no file name: return */
+ return 0;
+ }
- /* if we have a filename then check */
- /* if it is "standard in" if yes then */
- /* get the currentfile name info */
+ /* skip the double quote */
++s;
- /* in c1mode fullSrcFileName is NULL */
+ /* get the file name and see if it is different from current one.
+ in c1mode fullSrcFileName is NULL */
if (fullSrcFileName &&
- strncmp(s, fullSrcFileName, strlen(fullSrcFileName)) == 0)
+ strncmp(s, fullSrcFileName, strlen(fullSrcFileName)) == 0 && fullSrcFileName[strlen(fullSrcFileName) - 1] == '"')
{
- lineno = mylineno = lNum;
- currFname = fullSrcFileName;
+ filename = fullSrcFileName;
}
else
{
/* find the end of the filename */
while (*s && *s != '"')
++s;
- currFname = Safe_malloc(s - sb + 1);
- memcpy(currFname, sb, s - sb);
- currFname[s - sb] = '\0';
- lineno = mylineno = lNum;
+
+ filename = Safe_malloc(s - sb + 1);
+ memcpy(filename, sb, s - sb);
+ filename[s - sb] = '\0';
}
- filename = currFname;
return 0;
}
-int column = 0;
-int plineIdx =0;
-
static void count(void)
{
int i;
if (yytext[i] == '\n')
{
column = 0;
- lineno = ++mylineno;
+ ++lineno;
}
else
if (yytext[i] == '\t')
if ((ch = input()) == '\n')
{
/* \<newline> is a continuator */
- lineno = ++mylineno;
+ ++lineno;
column = 0;
}
else
/* if new line we have a new line break, which is illegal */
werror(W_NEWLINE_IN_STRING);
dbuf_append_char(&dbuf, '\n');
- lineno = ++mylineno;
+ ++lineno;
column = 0;
break;
}
else
{
- lineno = ++mylineno;
+ ++lineno;
column = 0;
}
break;
case '\n':
- lineno = ++mylineno;
+ ++lineno;
column = 0;
break;
if (ch == '\n')
{
- lineno = ++mylineno;
+ ++lineno;
column = 0;
}
if(options.vc_err_style)
fprintf(stderr, "\n%s(%d) : %s: token -> '%s' ; column %d\n",
- filename, mylineno, s, yytext, column);
+ filename, lineno, s, yytext, column);
else
fprintf(stderr, "\n%s:%d: %s: token -> '%s' ; column %d\n",
- filename, mylineno, s ,yytext, column);
+ filename, lineno, s ,yytext, column);
fatalError++;
return 0;