Ejemplo n.º 1
0
VariableSymbol *build_initialized_variable(
        SuifEnv *env,
	const LString &name,
	DataType *type,
	ValueBlock *vb,
	bool make_static) {
    TypeBuilder *tb = (TypeBuilder *)
        env->get_object_factory(TypeBuilder::get_class_name());
    FileSetBlock *fsb = env->get_file_set_block();
    suif_assert_message(fsb->get_file_block_count() == 1,("File is ambiguous"));
    FileBlock *fb = fsb->get_file_block(0);
    
    BasicSymbolTable *symtab = to<BasicSymbolTable>(fb->get_symbol_table());
    DefinitionBlock *def  = fb->get_definition_block ();
    QualifiedType *q_type = tb->get_qualified_type(type);

    VariableSymbol *var = create_variable_symbol(
                env,q_type, name, false );
    symtab->append_symbol_table_object(var);
    VariableDefinition *vardef =
            create_variable_definition(env,var,type->get_bit_alignment(),
					vb,make_static);
    def->append_variable_definition(vardef);
    return var;
    }
Ejemplo n.º 2
0
list<ProcedureSymbol*> *
get_procedure_list(FileSetBlock *file_set,
                   bool flag_exported,
                   bool flag_static,
                   bool flag_nested,
                   bool flag_def_only)
{
  list<ProcedureSymbol*> *procs = new list<ProcedureSymbol*>;
  FileSetBlock *fsb = file_set;

  // no file_set_block sepcified
  if (!fsb) return procs;

  // =============== exported procedures ================
  if (flag_exported)
    add_to_procedure_list(procs,
                          fsb->get_external_symbol_table(), flag_def_only);

  // =============== static procedures ==================
  if (flag_static) {
    // add the symbols in the static fileset symbol table
    add_to_procedure_list(procs,
                          fsb->get_file_set_symbol_table(), flag_def_only);
    // iterate over the files and add their symbol tables
    for (int i = 0; i < fsb->get_file_block_count(); ++i) {
      FileBlock *file_block = fsb->get_file_block(i);
      add_to_procedure_list(procs,
                            file_block->get_symbol_table(), flag_def_only);
    }
  }

  // =============== nested procedures ==================
  if ( flag_nested ) {
    // iterate over the files
    for (int i=0; i < fsb->get_file_block_count(); ++i) {
      FileBlock *file_block = fsb->get_file_block(i);
      DefinitionBlock * def_block = file_block->get_definition_block();
      // iterate over the procedures
      s_count_t count = def_block->get_procedure_definition_count();
      for (s_count_t proc_counter=0; proc_counter < count; ++proc_counter) {
        ProcedureDefinition *proc = def_block->get_procedure_definition(i);
        add_to_procedure_list(procs, proc, flag_def_only );
      }
    }
  }
  return procs;
}
Ejemplo n.º 3
0
/*--------------------------------------------------------------------
 * add_std_fse_menu
 *
 */
void
add_std_fse_menu(vmenu* root_menu, char* parent_menu)
{
  /* file set entry submenu */
  FileSetBlock *fsb = suif_env->get_file_set_block();
  if (!fsb) return;
  for (int i = 0; i < fsb->get_file_block_count(); ++i) {
    FileBlock *file = fsb->get_file_block(i);
    binding *b = new binding((bfun) &do_show_fse, file);
    const char* name = file->get_source_file_name().c_str();    
    root_menu->add_command(b, parent_menu, name ? name : "<no name>" );
  }
}