ENH: Changed WriteConfiguration to non-const so it can do error checking. Added parsing and output of a name for each WrapperSet generated from a CABLE_WRAP command.

This commit is contained in:
Brad King 2001-04-26 15:27:38 -04:00
parent 2c1fb789d7
commit 61d2314989
11 changed files with 49 additions and 15 deletions

View File

@ -23,7 +23,7 @@
* Write the CABLE configuration code to define this InstantiationSet.
* This includes the "class" keyword to do class template instantiations.
*/
void cmCableInstantiateClassCommand::WriteConfiguration() const
bool cmCableInstantiateClassCommand::WriteConfiguration()
{
std::ostream& os = m_CableData->GetOutputStream();
cmCableData::Indentation indent = m_CableData->GetIndentation();
@ -46,4 +46,6 @@ void cmCableInstantiateClassCommand::WriteConfiguration() const
os << "</Element>" << std::endl;
}
os << indent << "</InstantiationSet>" << std::endl;
return true;
}

View File

@ -63,7 +63,7 @@ public:
"template classes (not functions, operators, etc).";
}
virtual void WriteConfiguration() const;
virtual bool WriteConfiguration();
cmTypeMacro(cmCableInstantiateClassCommand, cmCableInstantiateCommand);
protected:

View File

@ -22,7 +22,7 @@
/**
* Write the CABLE configuration code to define this InstantiationSet.
*/
void cmCableInstantiateCommand::WriteConfiguration() const
bool cmCableInstantiateCommand::WriteConfiguration()
{
std::ostream& os = m_CableData->GetOutputStream();
cmCableData::Indentation indent = m_CableData->GetIndentation();
@ -45,4 +45,6 @@ void cmCableInstantiateCommand::WriteConfiguration() const
os << "</Element>" << std::endl;
}
os << indent << "</InstantiationSet>" << std::endl;
return true;
}

View File

@ -62,7 +62,7 @@ public:
"template non-classes (functions, operators, etc).";
}
virtual void WriteConfiguration() const;
virtual bool WriteConfiguration();
cmTypeMacro(cmCableInstantiateCommand, cmCablePackageCommand);
protected:

View File

@ -100,6 +100,7 @@ bool cmCablePackageCommand::Invoke(std::vector<std::string>& args)
// Add custom rules to the makefile to generate this package's source
// files.
{
std::string command = "${CABLE}";
m_Makefile->ExpandVariablesInString(command);
std::vector<std::string> depends;
@ -115,6 +116,27 @@ bool cmCablePackageCommand::Invoke(std::vector<std::string>& args)
command.c_str(),
depends,
outputs, m_TargetName.c_str());
}
// Add custom rules to the makefile to generate this package's xml files.
{
std::string command = "${GCCXML}";
m_Makefile->ExpandVariablesInString(command);
std::vector<std::string> depends;
depends.push_back(command);
std::string input = "Cxx/"+m_PackageName+"_cxx.cxx";
std::string output = "Cxx/"+m_PackageName+"_cxx.xml";
command = "\""+command+"\" ${CXX_FLAGS} -fsyntax-only -fxml=" + output + " -c " + input;
std::vector<std::string> outputs;
outputs.push_back("Cxx/"+m_PackageName+"_cxx.xml");
// A rule for the package's source files.
m_Makefile->AddCustomCommand(input.c_str(),
command.c_str(),
depends,
outputs, m_TargetName.c_str());
}
// add the source list to the target
m_Makefile->GetTargets()[m_TargetName.c_str()].GetSourceLists().push_back(m_PackageName);

View File

@ -36,7 +36,5 @@ bool cmCablePackageEntryCommand::Invoke(std::vector<std::string>& args)
}
// Write this command's configuration.
this->WriteConfiguration();
return true;
return this->WriteConfiguration();
}

View File

@ -42,7 +42,7 @@ public:
cmTypeMacro(cmCablePackageEntryCommand, cmCableCommand);
virtual void WriteConfiguration() const =0;
virtual bool WriteConfiguration() =0;
protected:
typedef std::vector<std::string> Entries;

View File

@ -45,7 +45,7 @@ void cmCableSourceFilesCommand::FinalPass()
* Write the CABLE configuration code to indicate header dependencies for
* a package.
*/
void cmCableSourceFilesCommand::WriteConfiguration() const
bool cmCableSourceFilesCommand::WriteConfiguration()
{
std::ostream& os = m_CableData->GetOutputStream();
cmCableData::Indentation indent = m_CableData->GetIndentation();
@ -77,6 +77,8 @@ void cmCableSourceFilesCommand::WriteConfiguration() const
}
}
os << indent << "</Headers>" << std::endl;
return true;
}

View File

@ -67,7 +67,7 @@ public:
"Generates a Package's Headers block in the CABLE configuration.";
}
virtual void WriteConfiguration() const;
virtual bool WriteConfiguration();
bool SourceFileExists(const std::string&) const;
cmTypeMacro(cmCableSourceFilesCommand, cmCableCommand);

View File

@ -19,16 +19,22 @@
/**
* Write the CABLE configuration code to define this WrapperSet.
*/
void cmCableWrapCommand::WriteConfiguration() const
bool cmCableWrapCommand::WriteConfiguration()
{
if(m_Entries.size() < 2)
{
this->SetError("called with incorrect number of arguments");
return false;
}
std::ostream& os = m_CableData->GetOutputStream();
cmCableData::Indentation indent = m_CableData->GetIndentation();
cmRegularExpression needCdataBlock("[&<>]");
os << indent << "<WrapperSet>" << std::endl;
for(Entries::const_iterator e = m_Entries.begin();
e != m_Entries.end(); ++e)
Entries::const_iterator e = m_Entries.begin();
os << indent << "<WrapperSet name=\"" << e->c_str() << "\">" << std::endl;
for(++e;e != m_Entries.end(); ++e)
{
os << indent << " <Element>";
if(needCdataBlock.find(e->c_str()))
@ -42,4 +48,6 @@ void cmCableWrapCommand::WriteConfiguration() const
os << "</Element>" << std::endl;
}
os << indent << "</WrapperSet>" << std::endl;
return true;
}

View File

@ -59,7 +59,7 @@ public:
"Generates a WrapSet in the CABLE configuration.";
}
virtual void WriteConfiguration() const;
virtual bool WriteConfiguration();
cmTypeMacro(cmCableWrapCommand, cmCablePackageCommand);
};