本文整理汇总了C++中Listing::Write方法的典型用法代码示例。如果您正苦于以下问题:C++ Listing::Write方法的具体用法?C++ Listing::Write怎么用?C++ Listing::Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Listing
的用法示例。
在下文中一共展示了Listing::Write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
int AsmMain::Run(int argc, char *argv[])
{
int rv = 0;
Utils::banner(argv[0]);
CmdSwitchFile internalConfig(SwitchParser);
std::string configName = Utils::QualifiedFile(argv[0], ".cfg");
std::fstream configTest(configName.c_str(), std::ios::in);
if (configTest != NULL)
{
configTest.close();
if (!internalConfig.Parse(configName.c_str()))
Utils::fatal("Corrupt configuration file");
}
if (!SwitchParser.Parse(&argc, argv) || (argc == 1 && File.GetCount() <= 1))
{
Utils::usage(argv[0], usageText);
}
CmdFiles files(argv+1);
if (File.GetValue())
files.Add(File.GetValue() + 1);
if (files.GetSize() > 1 && OutputFile.GetValue().size())
Utils::fatal("Cannot specify output file for multiple input files");
std::string sysSrchPth;
std::string srchPth;
if (includePath.GetValue().size())
{
size_t n = includePath.GetValue().find_first_of(';');
if (n == std::string::npos)
{
sysSrchPth = includePath.GetValue();
}
else
{
sysSrchPth = includePath.GetValue().substr(0, n);
srchPth = includePath.GetValue().substr(n+1);
}
}
for (CmdFiles::FileNameIterator it = files.FileNameBegin(); it != files.FileNameEnd(); ++it)
{
std::string inName = (*it)->c_str();
int npos = inName.find_last_of(".");
if (npos == std::string::npos || npos && inName[npos-1] == '.' || (npos != inName.size()-1 && inName[npos+1] == CmdFiles::DIR_SEP[0]))
{
inName = Utils::QualifiedFile( (*it)->c_str(), ".asm");
}
PreProcessor pp(inName, srchPth, sysSrchPth,
false, false, '%', false, false, true);
int n = Defines.GetCount();
for (int i=0; i < n; i++)
{
CmdSwitchDefine::define *v = Defines.GetValue(i);
pp.Define(v->name, v->value, false);
}
std::string outName;
if (OutputFile.GetValue().size() != 0)
outName = OutputFile.GetValue();
else
outName = Utils::QualifiedFile( (*it)->c_str(), ".o");
if (PreprocessOnly.GetValue())
{
std::string working = Utils::QualifiedFile((*it)->c_str(), ".i");
std::fstream out(working.c_str(), std::ios::out);
if (out == NULL)
{
Utils::fatal(std::string(std::string("Could not open ") + working.c_str() + " for write.").c_str());
}
else
{
while (pp.GetLine(working))
{
CheckAssign(working, pp);
out << working << std::endl;
}
}
out.close();
}
else
{
Listing listing;
AsmFile asmFile(pp, CaseInsensitive.GetValue(), listing);
if (asmFile.Read())
{
if (!asmFile.Write(outName, inName) || Errors::ErrorCount())
{
rv = 1;
}
else if (CreateListFile.GetValue())
{
std::string listingName = Utils::QualifiedFile( (*it)->c_str(), ".lst");
if (!listing.Write(listingName, inName, CreateListFile.GetValue('m')))
{
rv = 1;
}
}
}
else
{
rv = 1;
}
if (rv)
//.........这里部分代码省略.........