本文整理汇总了C++中ModuleSubSystem类的典型用法代码示例。如果您正苦于以下问题:C++ ModuleSubSystem类的具体用法?C++ ModuleSubSystem怎么用?C++ ModuleSubSystem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModuleSubSystem类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_default_location_module
String ErrorSubSystem::get_location(const SuifObject *obj) const {
if (obj == NULL) return emptyString;
LString style = get_default_location_module();
if (style == emptyLString) {
return(obj->getClassName());
}
ModuleSubSystem *ms = get_suif_env()->get_module_subsystem();
Module *module = ms->retrieve_module(style);
LString location_iface = "get_object_location";
if (!module->supports_interface(location_iface))
{
return(obj->getClassName());
}
LocationDispatch pfunc =
(LocationDispatch)module->get_interface(location_iface);
//TODO:
#ifdef MSVC
if((int)pfunc==0x1)pfunc=NULL;
#endif
if (pfunc)
{
return ((*pfunc)(obj).print_to_string());
}
else
{
// cerr << "installed location style"
// << style.c_str() << "has no valid print function" << endl;
return(obj->getClassName());
}
}
示例2: to_cstring
String to_cstring(const SuifObject *obj) {
if (obj == NULL) return("(nil)");
SuifEnv* suif_env = obj->get_suif_env();
ModuleSubSystem *ms = suif_env->get_module_subsystem();
CPrintStyleModule* cprint = (CPrintStyleModule*)
ms->retrieve_module("cprint");
suif_assert_message(cprint, ("CPrintStyleModule is not loaded"));
return cprint->print_to_string(obj);
}
示例3: init_utils
extern "C" void init_utils(SuifEnv *s) {
s->require_module("basicnodes");
s->require_module("suifnodes");
s->require_module("typebuilder");
s->require_module("suifcloning");
ModuleSubSystem *ms = s->get_module_subsystem();
if (!ms->is_available("constant_folding_table")) {
ms->register_module(new FoldTable(s));
}
}
示例4: get_suif_env
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void SuifPrinterModule::initialize()
{
Module::initialize();
// register as a listener
ModuleSubSystem *ms = get_suif_env()->get_module_subsystem();
ms->register_interface_listener(this, "print_init");
// ms->register_interface_producer(this, "print");
set_interface("print", (Address)SuifPrinterModule::print_dispatch);
init();
}
示例5: init_print_styles
extern "C" void EXPORT init_print_styles(SuifEnv* suif)
{
suif->require_module("basicnodes");
suif->require_module("suifnodes");
ModuleSubSystem* mSubSystem = suif->get_module_subsystem();
if (!mSubSystem->retrieve_module(CPrintStyleModule::get_class_name())) {
Module *m = new CPrintStyleModule(suif);
mSubSystem -> register_module(m);
//suif->get_print_subsystem()->set_default_print_style(m->get_module_name());
}
}
示例6: init_s2c
extern "C" void init_s2c(SuifEnv *suif_env) {
suif_env->require_module("suifnodes");
suif_env->require_module("cfenodes");
suif_env->require_module("suifpasses");
ModuleSubSystem* mSubSystem = suif_env->get_module_subsystem();
if (!mSubSystem->retrieve_module("s2c")) {
mSubSystem -> register_module( new S2CPass( suif_env ) );
}
}
示例7: init_ex1
extern "C" void
init_ex1(SuifEnv *suif_env)
{
static bool init_done = false;
if (init_done)
return;
init_done = true;
ModuleSubSystem *mSubSystem = suif_env->get_module_subsystem();
mSubSystem->register_module(new Ex1SuifPass(suif_env));
// initialize the libraries required by this OPI pass
init_suifpasses(suif_env);
init_machine(suif_env);
}
示例8: init_m2a
extern "C" void
init_m2a(SuifEnv *suif_env)
{
static bool init_done = false;
if (init_done)
return;
init_done = true;
ModuleSubSystem *mSubSystem = suif_env->get_module_subsystem();
mSubSystem->register_module(new M2aSuifPass(suif_env));
init_suifpasses(suif_env);
init_machine(suif_env);
init_suifvm(suif_env);
}
示例9: main
int
main(int argc, char* argv[])
{
// initialize the environment
SuifEnv* suif_env = new SuifEnv;
suif_env->init();
init_ex5(suif_env);
// transform the input arguments into a stream of input tokens
TokenStream token_stream(argc, argv);
// execute the Module "ex5"
ModuleSubSystem* mSubSystem = suif_env->get_module_subsystem();
mSubSystem->execute("ex5", &token_stream);
delete suif_env;
return 0;
}
示例10: init_suifprinter
//----------------------------------------------------------------------------
extern "C" void EXPORT init_suifprinter(SuifEnv* suif)
{
suif->require_module("suifpasses");
// These are needed by the cprint style
suif->require_module("basicnodes");
suif->require_module("suifnodes");
ModuleSubSystem* mSubSystem = suif->get_module_subsystem();
if (!mSubSystem->retrieve_module(SuifPrinterModule::ClassName)) {
Module *m = new SuifPrinterModule(suif);
mSubSystem -> register_module(m);
suif->get_print_subsystem()->set_default_print_style(m->get_module_name());
m = new CPrintStyleModule(suif);
mSubSystem -> register_module(m);
init_suifprinter_extras(suif);
m = new IdPrinter(suif);
mSubSystem -> register_module(m);
m = new MCPrintStyleModule(suif);
mSubSystem -> register_module(m);
}
}
示例11: init_transforms
extern "C" void init_transforms(SuifEnv *suif_env) {
ModuleSubSystem *ms = suif_env->get_module_subsystem();
suif_env->require_module("typebuilder");
suif_env->require_module("suifnodes");
suif_env->require_module("cfenodes");
suif_env->require_module("suifcloning");
suif_env->require_module("cfeutils");
suif_env->require_module("suifpasses");
suif_env->require_module("suiflocation");
suif_env->require_module("utils");
// init_typebuilder(suif_env);
/*
static boolean init_done = FALSE;
if (init_done)
return;
init_done = TRUE;
enter_suif(argc, argv);
enter_suifpasses(argc, argv);
*/
/*
ms->register_module(new make_empty_file_set_symbol_table_pass());
*/
ms->register_module(new NameAllSymbolsPass(suif_env));
ms->register_module(new AvoidExternCollisions(suif_env));
ms->register_module(new AvoidFileScopeCollisions(suif_env));
ms->register_module(new PaddingPass(suif_env));
ms->register_module(new StructPaddingPass(suif_env));
ms->register_module(new CombinedPass(suif_env));
ms->register_module(new CallExpressionDismantlerPass(suif_env));
ms->register_module(new FieldBuilderPass(suif_env));
ms->register_module(new MultiDimArrayDismantlerPass(suif_env));
ms->register_module(new NonConstBoundDismantlerPass(suif_env));
ms->register_module(new SetAddrTakenPass(suif_env));
ms->register_module(new DismantleEmptyScopeStatements(suif_env));
ms->register_module(new DismantleCallArguments(suif_env));
ms->register_module(new DismantleMultiEntryScopeStatements(suif_env));
/* DEW */
// This is in usefulpasses
//ms->register_module(new UnownedPass(suif_env));
ms->register_module(
new walker_based_module<if_statement_walker>(
suif_env, "dismantle_if_statements",
"Dismantle IfStatements to Branches and Jumps"));
ms->register_module(
new walker_based_module<while_statement_walker>(
suif_env, "dismantle_while_statements",
"Dismantle all WhileStatements to Branches and Jumps"));
ms->register_module(
new walker_based_module<do_while_statement_walker>(
suif_env, "dismantle_do_while_statements",
"Dismantle all DoWhileStatements to Branches and Jumps"));
ms->register_module(
new walker_based_module<for_statement_walker>(
suif_env, "dismantle_for_statements",
"Dismantle all ForStatements to Branches and Jumps"));
ms->register_module(
new walker_based_module<c_for_statement_walker>(
suif_env, "dismantle_c_for_statements",
"Dismantle all CForStatements"));
ms->register_module(
new walker_based_module<scope_statement_walker>(
suif_env, "dismantle_scope_statements",
"Dismantle all ScopeStatements and move their symbols"));
ms->register_module(
new walker_based_module<multi_way_branch_statement_walker>(
suif_env, "dismantle_multi_way_branch_statements",
"Dismantle all MultiWayBranchStatements to Branches and Jumps"));
ms->register_module( new ArrayReferenceDismantlerPass(suif_env));
// A number of the expression dismantlers were not implemented in SUIFX, so they are grouped at
// the end of the list here
ms->register_module(
new walker_based_module<field_access_expression_walker>(
suif_env, "dismantle_field_access_expressions",
"Dismantle all FieldAccessExpressions to pointer arithmetic"));
/*
ms->register_module(
new walker_based_module<call_expression_walker>(
suif_env, "dismantle_call_expressions"));
*/
// A multi-way branch re-organiser
ms->register_module(
new walker_based_module<multi_way_branch_statement_compactor>(
suif_env, "compact_multi_way_branch_statements",
"convert multi-way branches to IfStatements with dense multi-way branches"));
ms->register_module(new AvoidLabelCollisions(suif_env));
ms->register_module(new RepeatValueBlockBuilderPass(suif_env));
// ms->register_module(new walker_based_module<extract_fields_expression_walker>(suif_env, "dismantle_extract_fields_expressions"));
// ms->register_module(new walker_based_module<extract_elements_expression_walker>(suif_env, "dismantle_extract_elements_expressions"));
// ms->register_module(new walker_based_module<byte_size_of_expression_walker>(suif_env, "dismantle_byte_size_of_expressions"));
//.........这里部分代码省略.........