the same time. Allocate the stream when the code generator is allocated, but
open the output after the reduced machine is fully built, just before the
write.
git-svn-id: http://svn.complang.org/ragel/trunk@735
052ea7fc-9027-0410-9066-
f65837a77df0
if ( outputFileName != 0 ) {
/* Create the filter on the output and open it. */
outFilter = new output_filter( outputFileName );
- outFilter->open( outputFileName, ios::out|ios::trunc );
- if ( !outFilter->is_open() ) {
- error() << "error opening " << outputFileName << " for writing" << endl;
- exit(1);
- }
/* Open the output stream, attaching it to the filter. */
outStream = new ostream( outFilter );
if ( outputFileName != 0 ) {
/* Create the filter on the output and open it. */
outFilter = new output_filter( outputFileName );
- outFilter->open( outputFileName, ios::out|ios::trunc );
- if ( !outFilter->is_open() ) {
- error() << "error opening " << outputFileName << " for writing" << endl;
- exit(1);
- }
/* Open the output stream, attaching it to the filter. */
outStream = new ostream( outFilter );
if ( outputFileName != 0 ) {
/* Create the filter on the output and open it. */
outFilter = new output_filter( outputFileName );
- outFilter->open( outputFileName, ios::out|ios::trunc );
- if ( !outFilter->is_open() ) {
- error() << "error opening " << outputFileName << " for writing" << endl;
- exit(1);
- }
/* Open the output stream, attaching it to the filter. */
outStream = new ostream( outFilter );
using std::cout;
using std::cerr;
using std::endl;
+using std::ios;
void InputData::generateSpecificReduced()
{
}
}
+void InputData::openOutput2()
+{
+ if ( outFilter != 0 ) {
+ outFilter->open( outputFileName, ios::out|ios::trunc );
+ if ( !outFilter->is_open() ) {
+ error() << "error opening " << outputFileName << " for writing" << endl;
+ exit(1);
+ }
+ }
+}
+
void InputData::prepareMachineGen()
{
/* No machine spec or machine name given. Generate everything. */
void writeOutput();
void generateSpecificReduced();
void openOutput();
+ void openOutput2();
void generateReduced();
void prepareMachineGen();
};
if ( outputFileName != 0 ) {
/* Create the filter on the output and open it. */
outFilter = new output_filter( outputFileName );
- outFilter->open( outputFileName, ios::out|ios::trunc );
- if ( !outFilter->is_open() ) {
- error() << "error opening " << outputFileName << " for writing" << endl;
- exit(1);
- }
/* Open the output stream, attaching it to the filter. */
outStream = new ostream( outFilter );
if ( gblErrorCount > 0 )
exit(1);
+ inputData.openOutput2();
inputData.writeOutput();
/* Close the input and the intermediate file. */
if ( outputFileName != 0 ) {
/* Create the filter on the output and open it. */
outFilter = new output_filter( outputFileName );
- outFilter->open( outputFileName, ios::out|ios::trunc );
- if ( !outFilter->is_open() ) {
- error() << "error opening " << outputFileName << " for writing" << endl;
- exit(1);
- }
/* Open the output stream, attaching it to the filter. */
outStream = new ostream( outFilter );