static type call(A0& a0, I const& indices) { return boost::proto::make_expr<tag::function_,container::domain> ( boost::reference_wrapper<A0>(a0) , function_index(indices, a0.extent(), meta::as_<typename A0::indexes_type>()) ); }
void log_call(uint32_t to, uint32_t from){ int32_t i,j; /* If no map file has been loaded, skip trace */ if((!map_info.num_functions) || (!map_info.log)) return; i = function_index(to); if(i>=0){ call_depth++; fprintf(map_info.log, "[%08x] ", from); for(j=0;j<call_depth;j++){ fprintf(map_info.log, ". "); } fprintf(map_info.log, "%s{\n", map_info.fn_name[i]); } }
void log_ret(uint32_t to, uint32_t from){ int32_t i,j; /* If no map file has been loaded, skip trace */ if((!map_info.num_functions) || (!map_info.log)) return; if(call_depth>0){ fprintf(map_info.log, "[%08x] ", from); for(j=0;j<call_depth;j++){ fprintf(map_info.log, ". "); } fprintf(map_info.log, "}\n"); call_depth--; } else{ i = function_index(to); if(i>=0){ fprintf(map_info.log, "[%08x] %s\n", from, map_info.fn_name[i]); } else{ fprintf(map_info.log, "[%08x] %08x\n", from, to); } } }
int l_variables_context::get_function_id(l_function* f_context,l_syntactic_tree::function_def_node* c_node) { return get_table_id(f_context,function_index(c_node)); }
//function def void l_variables_context::visit(l_function* fun,l_syntactic_tree::function_def_node* node) { //alloc new function l_function* new_fun = &m_vm->get_new_function(); //add data node->m_data = (void*)(m_vm->get_count_of_functions()-1); //add variable node if(!node->m_variable) { static int anonim_function_id = 0; node->m_variable = l_syntactic_tree::variable ("$" "_anonymous" "_function[" +std::to_string(++anonim_function_id) +"]" ); } //... visit(fun, node->m_variable); //alloc variable add_into_table(fun, l_variable((l_function_id)(m_vm->get_count_of_functions()-1)), function_index(node)); //n args new_fun->m_args_size = (unsigned int) node->m_args.size(); //args... for(l_syntactic_tree::variable_node* variable : node->m_args) { add_variable_into_table(new_fun, variable); is_not_upper_value(new_fun, variable); } //args list if(node->m_name_args_list) { //add last variable add_variable_into_table(new_fun, node->m_name_args_list); is_not_upper_value(new_fun, node->m_name_args_list); //have args list new_fun->m_have_args_list = true; } //staments for(l_syntactic_tree::node* st : node->m_staments) { visit(new_fun,st); } }