Skip to content

Commit

Permalink
Generate IEEE1364-2000 line directives.
Browse files Browse the repository at this point in the history
  • Loading branch information
steve committed Oct 30, 2001
1 parent 40e7bc2 commit 9505b58
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions ivlpp/ivlpp.txt
Expand Up @@ -49,7 +49,7 @@ valid options include:
flags as needed.

-L
Generate #line directives. The ivl compiler understands
Generate `line directives. The ivl compiler understands
these directives and uses them to keep track of the
current line of the original source file. This makes error
messages more meaningful.
Expand Down Expand Up @@ -89,17 +89,17 @@ proper will not reflect the actual line numbers in the source file.
To handle this situation, the preprocessor can generate line
directives. These directives are lines of the form:

#line <name> <num>
`line <num> <name> <level>

where <name> is the file name in double-quotes and <num> is the line
number in the file. The parser changes the filename and line number
counters in such a way that the next line is line number <num>+1 in
counters in such a way that the next line is line number <num> in
the file named <name>. For example:

#line "foo.vl" 5
`line 6 "foo.vl" 0
// I am on line 6 in file foo.vl.

The preprocessor generates a #line directive every time it switches
files. That includes starting an included file (#line "foo.vlh" 0) or
The preprocessor generates a `line directive every time it switches
files. That includes starting an included file (`line 1 "foo.vlh" 1) or
returning to the including file.

14 changes: 7 additions & 7 deletions ivlpp/lexor.lex
Expand Up @@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: lexor.lex,v 1.26 2001/10/30 20:48:55 steve Exp $"
#ident "$Id: lexor.lex,v 1.27 2001/10/30 21:53:27 steve Exp $"
#endif

# include "config.h"
Expand Down Expand Up @@ -495,7 +495,7 @@ static void def_undefine()
static void output_init()
{
if (line_direct_flag)
fprintf(yyout, "#line \"%s\" 0\n", istack->path);
fprintf(yyout, "`line 1 \"%s\" 0\n", istack->path);
}

static void include_filename()
Expand Down Expand Up @@ -539,8 +539,8 @@ static void do_include()
yy_switch_to_buffer(yy_new_buffer(istack->file, YY_BUF_SIZE));

if (line_direct_flag && istack->path)
fprintf(yyout, "\n#line \"%s\" %u\n",
istack->path, istack->lineno);
fprintf(yyout, "\n`line %u \"%s\" 1\n",
istack->lineno+1, istack->path);
}

/*
Expand Down Expand Up @@ -592,7 +592,7 @@ static int yywrap()
}

if (line_direct_flag)
fprintf(yyout, "\n#line \"%s\" 0\n", istack->path);
fprintf(yyout, "\n`line 1 \"%s\" 0\n", istack->path);

yyrestart(istack->file);
return 0;
Expand All @@ -605,8 +605,8 @@ static int yywrap()
yy_switch_to_buffer(istack->yybs);

if (line_direct_flag && istack->path && !line_mask_flag)
fprintf(yyout, "\n#line \"%s\" %u\n",
istack->path, istack->lineno);
fprintf(yyout, "\n`line %u \"%s\" 2\n",
istack->lineno+1, istack->path);

return 0;
}
Expand Down

0 comments on commit 9505b58

Please sign in to comment.