本文整理汇总了C++中POETCode::get_fileinfo方法的典型用法代码示例。如果您正苦于以下问题:C++ POETCode::get_fileinfo方法的具体用法?C++ POETCode::get_fileinfo怎么用?C++ POETCode::get_fileinfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类POETCode
的用法示例。
在下文中一共展示了POETCode::get_fileinfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write
void POETProgram:: write_to_file(std::ostream& out)
{
int lineNo=0;
for (std::list<POETProgram*>::const_iterator
pincludeFiles = includeFiles.begin();
pincludeFiles!=includeFiles.end(); ++pincludeFiles) {
POETProgram* cur = (*pincludeFiles);
out << "include " << cur->get_filename() << "\n";
++lineNo;
}
for (const_iterator pdef = define.begin(); pdef != define.end(); ++pdef) {
POETCode* cur = *pdef;
const FileInfo* curFile = cur->get_fileinfo();
if (curFile != 0) {
while (lineNo < curFile->get_lineno()) {
out << "\n"; ++lineNo;
}
}
switch (cur->get_enum())
{
case SRC_WRITE_OUTPUT: case SRC_READ_INPUT: case SRC_PARAM_DECL:
case SRC_TRACE_DECL:
out << cur->toString(DEBUG_NO_VAR) << "\n"; ++lineNo; break;
case SRC_CVAR:
{
CodeVar* cvar = static_cast<CodeVar*>(cur);
out << "<code " << cvar->toString();
const CodeDefSave& def = codeDef[cvar];
unsigned par_size = def.par_type.size();
if (par_size > 0) {
out << " pars=(";
for (unsigned i = 0; i < par_size; ++i)
{
const LocalVarSave& par_save = def.par_type[i];
assert(par_save.lvar != 0);
out << par_save.lvar->get_entry().get_name();
if (par_save.restr != 0)
out << ":" << par_save.restr->toString(DEBUG_NO_VAR);
if (i < par_size) out << ",";
}
out << ")";
}
CvarSymbolTable::Entry cvar_entry = cvar->get_entry();
for (unsigned i = 0; i < cvar_entry.attr_size(); ++i) {
LocalVar* v = cvar_entry.get_attr(i);
out << " " << v->get_entry().get_name()->toString(OUTPUT_NO_DEBUG) << "=" << v->get_entry().get_code()->toString(DEBUG_NO_VAR);
}
out << "/>\n";++lineNo;
break;
}
case SRC_LVAR:
{
LocalVar* cur_var = static_cast<LocalVar*>(cur);
switch (cur_var->get_entry().get_entry_type())
{
case LVAR_TUNE:
out << "<define " << cur->toString(OUTPUT_NO_DEBUG) << "/>\n";
++lineNo;
break;
default:
std::cerr << "Something is wrong. Unexpected var decl at global scope: " << cur->toString(DEBUG_OUTPUT) << "\n";
assert(0);
}
break;
}
case SRC_EVAL: // eval command
if (dynamic_cast<POETCondExp*>(cur) != 0)
out << "<cond ";
else out << "<eval ";
Write_POET_Exp write(out,6);
lineNo += write(cur);
out << "/>\n"; ++lineNo;
}
}
}