Added an option -l to rlgen-cd which inhibits the the writing of #line
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Fri, 9 Mar 2007 20:16:12 +0000 (20:16 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Fri, 9 Mar 2007 20:16:12 +0000 (20:16 +0000)
directives.

git-svn-id: http://svn.complang.org/ragel/trunk@128 052ea7fc-9027-0410-9066-f65837a77df0

ChangeLog
doc/ragel-guide.tex
doc/rlgen-cd.1.in
rlgen-cd/fsmcodegen.cpp
rlgen-cd/main.cpp
rlgen-cd/rlgen-cd.h

index 7e114f8..2c31b9a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 For Next Release
 ================
+ -Added an option -l to rlgen-cd which inhibits the writing of #line
+  directives.
  -Added a new syntax for verbose embeddings. This adds parentheses: 
       $from(action_name);
   Verbose embeddings without parentheses can make code difficult to read
index 3f22592..61e2a0b 100644 (file)
@@ -441,10 +441,7 @@ compatibility. Though in the past this has not always held true: changes that
 break code have crept into minor version number changes. Typically, the
 documentation lags behind the development in the interest of documenting only
 the lasting features. The latest changes are always documented in the ChangeLog
-file. As Ragel stabilizes, which is expected in the 5.x line, the version
-numbering rules will become more strict and the documentation will become more
-plentiful.
-
+file. 
 
 \chapter{Constructing State Machines}
 
index c312158..33cc088 100644 (file)
@@ -39,9 +39,12 @@ Use it with the frontend options -C or -D.
 .BR \-h ", " \-H ", " \-? ", " \-\-help
 Display help and exit.
 .TP
-.BR \-v 
+.BR \-v
 Display version information and exit.
 .TP
+.BR \-l
+Inhibit the writing of #line directives in generated code.
+.TP
 .B \-o " file"
 Write output to file. If -o is not given, a default file name is chosen by
 replacing the suffix of the input. For source files ending in .rh the suffix .h
index b1e4929..edc06e5 100644 (file)
@@ -38,6 +38,9 @@ using std::endl;
 
 void lineDirective( ostream &out, char *fileName, int line )
 {
+       if ( noLineDirectives )
+               out << "/* ";
+
        /* Write the preprocessor line info for to the input file. */
        out << "#line " << line  << " \"";
        for ( char *pc = fileName; *pc != 0; pc++ ) {
@@ -46,7 +49,12 @@ void lineDirective( ostream &out, char *fileName, int line )
                else
                        out << *pc;
        }
-       out << "\"\n";
+       out << '"';
+
+       if ( noLineDirectives )
+               out << " */";
+
+       out << '\n';
 }
 
 void genLineDirective( ostream &out )
index 4f87454..899b27e 100644 (file)
@@ -65,6 +65,7 @@ char *outputFileName = 0;
 bool graphvizDone = false;
 
 int numSplitPartitions = 0;
+bool noLineDirectives = false;
 bool printPrintables = false;
 
 /* Print a summary of the options. */
@@ -76,6 +77,8 @@ void usage()
 "   -h, -H, -?, --help    Print this usage and exit\n"
 "   -v, --version         Print version information and exit\n"
 "   -o <file>             Write output to <file>\n"
+"code generation options:\n"
+"   -l                    Inhibit writing of #line directives\n"
 "generated code style:\n"
 "   -T0                   Table driven FSM (default)\n"
 "   -T1                   Faster table driven FSM\n"
@@ -239,7 +242,7 @@ CodeGenData *makeCodeGen( char *sourceFileName, char *fsmName,
 /* Main, process args and call yyparse to start scanning input. */
 int main(int argc, char **argv)
 {
-       ParamCheck pc("o:T:F:G:P:vHh?-:", argc, argv);
+       ParamCheck pc("-:Hh?vlo:T:F:G:P:", argc, argv);
        char *xmlInputFileName = 0;
 
        while ( pc.check() ) {
@@ -258,6 +261,10 @@ int main(int argc, char **argv)
                                }
                                break;
 
+                       case 'l':
+                               noLineDirectives = true;
+                               break;
+
                        /* Code style. */
                        case 'T':
                                if ( pc.parameterArg[0] == '0' )
index af5b1e2..93acd99 100644 (file)
@@ -45,12 +45,15 @@ enum CodeStyleEnum
 
 extern CodeStyleEnum codeStyle;
 
+
 /* IO filenames and stream. */
-extern bool printPrintables;
 extern bool graphvizDone;
 
 extern int gblErrorCount;
+
+/* Options. */
 extern int numSplitPartitions;
+extern bool noLineDirectives;
 
 std::ostream &error();