コード例 #1
0
void FASTtoSgConverter::convert_MainProgram(FAST::MainProgram* main_program)
{
#if PRINT_FAST_CONVERTER
   printf("FASTtoSgConverter::convert_MainProgram \n");
#endif

   SgUntypedProgramHeaderDeclaration* sg_program;

   std::string label;
   std::string name;
   SgToken::ROSE_Fortran_Keywords keyword;

   SgUntypedExpression* sg_null_expr = new SgUntypedExpression(SgToken::FORTRAN_NULL);

   SgUntypedType* sg_type = new SgUntypedType("void",sg_null_expr/*type_kind*/,false,false,false,true/*is_intrinsic*/,false,false,
                                                     sg_null_expr/*char_length*/,"",false/*char_length_is_string*/,SgUntypedType::e_void);

   FAST::ProgramStmt*    programStmt    = main_program->getProgramStmt();
   FAST::Scope*          programScope   = main_program->getScope();
   FAST::ContainsStmt*   containsStmt   = main_program->getContainsStmt();
   FAST::EndProgramStmt* endProgramStmt = main_program->getEndProgramStmt();

// convert EndProgramStmt first as constructor arguments are readily available
   label   = endProgramStmt->getLabel();
   keyword = SgToken::FORTRAN_END_PROGRAM;
   name    = endProgramStmt->getName();
   SgUntypedNamedStatement* sg_end_stmt = new SgUntypedNamedStatement(label,keyword,name);

// convert ProgramStmt
   label   = programStmt->getLabel();
   keyword = SgToken::FORTRAN_PROGRAM;
   name    = programStmt->getName();

// convert arguments
   SgUntypedInitializedNameList*      sg_params = new SgUntypedInitializedNameList();

// convert scope
   SgUntypedDeclarationStatementList* sg_decls  = new SgUntypedDeclarationStatementList();
   SgUntypedStatementList*            sg_stmts  = new SgUntypedStatementList();
   SgUntypedFunctionDeclarationList*  sg_funcs  = new SgUntypedFunctionDeclarationList();

   convert_scope_lists(programScope, sg_decls, sg_stmts, sg_funcs);

   SgUntypedFunctionScope* sg_function_scope = new SgUntypedFunctionScope(label,keyword,sg_decls,sg_stmts,sg_funcs);

// convert MainProgram
   sg_program = new SgUntypedProgramHeaderDeclaration(label,keyword,name,sg_params,sg_type,sg_function_scope,sg_end_stmt);

// add program to the global scope
   get_scope()->get_function_list()->get_func_list().push_back(sg_program);
   ROSE_ASSERT(get_scope()->get_function_list()->get_func_list().size() > 0);
}
コード例 #2
0
void lib_test_client::draw(visualizer &d, draw_scope &scope)
{
    auto draw_vertex = [&] (my_graph::vertex_id id, int frame) 
    {
        coord<int> vert_coord = scope.world2screen(pgraph_->get_vertex(id).get_data().c);
        coord<int> eps (frame, frame);
        d.draw_rect(vert_coord - eps, vert_coord + eps);
    };

    d.set_bg_color(0, 0, 0);

    d.set_color(64, 64, 64);
    d.draw_buffers(g_desc.vb, 0, pgraph_->v_count(), g_desc.ib, 0, pgraph_->e_count());

    if (start_.is_initialized())
    {
        d.set_color(255, 0, 0);
        draw_vertex(*start_, 2);
    }
    if (end_.is_initialized())
    {
        d.set_color(255, 255, 0);
        draw_vertex(*end_, 2);
    }
    if (selected_.is_initialized())
    {
        d.set_color(0, 255, 0);
        draw_vertex(*selected_, 3);
    }
    d.set_color(255, 255, 255);
    draw_vertex(87909, 3);

    if (!path_.empty())
    {
        d.set_color(255, 255, 255);
        vis_coord last = path_[0];
        for (size_t i = 1; i < path_.size(); ++i)
        {
            d.draw_line(get_scope().world2screen(last), 
                        get_scope().world2screen(path_[i]));
            last = path_[i];
        }
    }

}
コード例 #3
0
void reach_client::on_mouse_move(int x, int y)
{
    mouse_coords_world_ = get_scope().screen2world(coord<int>(x, y));

    if (selecting_)
        square2_ = mouse_coords_world_;

    base_visualizer_client::on_mouse_move(x, y);
}
コード例 #4
0
void lib_test_client::on_mouse_down(int x, int y, int button)
{
    //boost::optional<my_graph::vertex_id> hover = //get_vertex(*pgraph_, coord<int>(x, y));
    if (button == 0)
    {
        vertex_id hover = get_vertex_by_coord(get_scope().screen2world(vis_coord(x, y)));
        selected_.reset(hover);
    }
    base_visualizer_client::on_mouse_down(x, y, button);
}
コード例 #5
0
ファイル: hotkeys.hpp プロジェクト: dodikk/iWesnoth
 bool is_in_active_scope() const {
     return is_scope_active(get_scope());
 }