From 9505b586bffe3a2098b6f76a47523bada95baa4f Mon Sep 17 00:00:00 2001 From: steve Date: Tue, 30 Oct 2001 21:53:27 +0000 Subject: [PATCH] Generate IEEE1364-2000 line directives. --- ivlpp/ivlpp.txt | 12 ++++++------ ivlpp/lexor.lex | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ivlpp/ivlpp.txt b/ivlpp/ivlpp.txt index 7f0d263b96..937fe0ce5b 100644 --- a/ivlpp/ivlpp.txt +++ b/ivlpp/ivlpp.txt @@ -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. @@ -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 + `line where is the file name in double-quotes and 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 +1 in +counters in such a way that the next line is line number in the file named . 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. diff --git a/ivlpp/lexor.lex b/ivlpp/lexor.lex index 60c1a77357..9dd9351687 100644 --- a/ivlpp/lexor.lex +++ b/ivlpp/lexor.lex @@ -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" @@ -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() @@ -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); } /* @@ -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; @@ -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; }