当前位置: 首页>>代码示例>>C++>>正文


C++ POETCode::get_fileinfo方法代码示例

本文整理汇总了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;
      }
   }
}
开发者ID:Federico2014,项目名称:edg4x-rose,代码行数:75,代码来源:poet_AST.cpp


注:本文中的POETCode::get_fileinfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。