dataExpr(0),
wantComplete(0),
hasLongestMatch(false),
- hasEnd(true),
- dataPrefix(true),
- writeFirstFinal(true),
- writeErr(true),
- writeCS(true)
+ noEnd(false),
+ noPrefix(false),
+ noFinal(false),
+ noError(false),
+ noCS(false)
{}
setValueLimits();
}
+void CodeGenData::write_option_error( InputLoc &loc, char *arg )
+{
+ source_warning(loc) << "unrecognized write option \"" << arg << "\"" << endl;
+}
+
void CodeGenData::writeStatement( InputLoc &loc, int nargs, char **args )
{
/* FIXME: This should be moved to the virtual functions in the code
* generators.
*
* Force a newline. */
- out << "\n";
+ out << '\n';
genLineDirective( out );
if ( strcmp( args[0], "data" ) == 0 ) {
for ( int i = 1; i < nargs; i++ ) {
if ( strcmp( args[i], "noerror" ) == 0 )
- writeErr = false;
+ noError = true;
else if ( strcmp( args[i], "noprefix" ) == 0 )
- dataPrefix = false;
+ noPrefix = true;
else if ( strcmp( args[i], "nofinal" ) == 0 )
- writeFirstFinal = false;
- else {
- source_warning(loc) << "unrecognized write option \"" <<
- args[i] << "\"" << endl;
- }
+ noFinal = true;
+ else
+ write_option_error( loc, args[i] );
}
writeData();
}
else if ( strcmp( args[0], "init" ) == 0 ) {
for ( int i = 1; i < nargs; i++ ) {
if ( strcmp( args[i], "nocs" ) == 0 )
- writeCS = false;
- else {
- source_warning(loc) << "unrecognized write option \"" <<
- args[i] << "\"" << endl;
- }
+ noCS = true;
+ else
+ write_option_error( loc, args[i] );
}
writeInit();
}
else if ( strcmp( args[0], "exec" ) == 0 ) {
for ( int i = 1; i < nargs; i++ ) {
if ( strcmp( args[i], "noend" ) == 0 )
- hasEnd = false;
- else {
- source_warning(loc) << "unrecognized write option \"" <<
- args[i] << "\"" << endl;
- }
+ noEnd = true;
+ else
+ write_option_error( loc, args[i] );
}
writeExec();
}
else if ( strcmp( args[0], "exports" ) == 0 ) {
- for ( int i = 1; i < nargs; i++ ) {
- source_warning(loc) << "unrecognized write option \"" <<
- args[i] << "\"" << endl;
- }
+ for ( int i = 1; i < nargs; i++ )
+ write_option_error( loc, args[i] );
writeExports();
}
+ else if ( strcmp( args[0], "start" ) == 0 ) {
+ for ( int i = 1; i < nargs; i++ )
+ write_option_error( loc, args[i] );
+ writeStart();
+ }
+ else if ( strcmp( args[0], "first_final" ) == 0 ) {
+ for ( int i = 1; i < nargs; i++ )
+ write_option_error( loc, args[i] );
+ writeFirstFinal();
+ }
+ else if ( strcmp( args[0], "error" ) == 0 ) {
+ for ( int i = 1; i < nargs; i++ )
+ write_option_error( loc, args[i] );
+ writeError();
+ }
else {
/* EMIT An error here. */
source_error(loc) << "unrecognized write command \"" <<