mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
fixes for -O gen-standalone-C++
This commit is contained in:
parent
d5e7db1070
commit
3b3cea799b
2 changed files with 6 additions and 20 deletions
|
@ -39,8 +39,5 @@ function load_CPP%(h: count%): bool
|
||||||
// compiled scripts.
|
// compiled scripts.
|
||||||
detail::standalone_activations.push_back(cb->second);
|
detail::standalone_activations.push_back(cb->second);
|
||||||
|
|
||||||
// Proceed with activation.
|
|
||||||
(*detail::CPP_init_hook)();
|
|
||||||
|
|
||||||
return zeek::val_mgr->True();
|
return zeek::val_mgr->True();
|
||||||
%}
|
%}
|
||||||
|
|
|
@ -213,17 +213,11 @@ void CPPCompile::GenStandaloneActivation()
|
||||||
{
|
{
|
||||||
NL();
|
NL();
|
||||||
|
|
||||||
#if 0
|
|
||||||
Emit("void standalone_activation__CPP()");
|
Emit("void standalone_activation__CPP()");
|
||||||
StartBlock();
|
StartBlock();
|
||||||
for ( auto& a : activations )
|
|
||||||
Emit(a);
|
|
||||||
EndBlock();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
Emit("finish_init__CPP();");
|
||||||
NL();
|
NL();
|
||||||
Emit("void standalone_init__CPP()");
|
|
||||||
StartBlock();
|
|
||||||
|
|
||||||
// For events and hooks, we need to add each compiled body *unless*
|
// For events and hooks, we need to add each compiled body *unless*
|
||||||
// it's already there (which could be the case if the standalone
|
// it's already there (which could be the case if the standalone
|
||||||
|
@ -283,10 +277,14 @@ void CPPCompile::GenStandaloneActivation()
|
||||||
GenTypeName(ft), hashes);
|
GenTypeName(ft), hashes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EndBlock();
|
||||||
|
|
||||||
NL();
|
NL();
|
||||||
|
Emit("void standalone_init__CPP()");
|
||||||
|
StartBlock();
|
||||||
|
Emit("init__CPP();");
|
||||||
Emit("CPP_activation_funcs.push_back(standalone_activation__CPP);");
|
Emit("CPP_activation_funcs.push_back(standalone_activation__CPP);");
|
||||||
Emit("CPP_activation_hook = activate__CPPs;");
|
Emit("CPP_activation_hook = activate__CPPs;");
|
||||||
|
|
||||||
EndBlock();
|
EndBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,15 +298,6 @@ void CPPCompile::GenLoad()
|
||||||
|
|
||||||
Emit("register_scripts__CPP(%s, standalone_init__CPP);", Fmt(total_hash));
|
Emit("register_scripts__CPP(%s, standalone_init__CPP);", Fmt(total_hash));
|
||||||
|
|
||||||
// Spit out the placeholder script, and any associated module
|
|
||||||
// definitions.
|
|
||||||
for ( const auto& m : module_names )
|
|
||||||
if ( m != "GLOBAL" )
|
|
||||||
printf("module %s;\n", m.c_str());
|
|
||||||
|
|
||||||
if ( module_names.size() > 0 )
|
|
||||||
printf("module GLOBAL;\n\n");
|
|
||||||
|
|
||||||
printf("global init_CPP_%llu = load_CPP(%llu);\n", total_hash, total_hash);
|
printf("global init_CPP_%llu = load_CPP(%llu);\n", total_hash, total_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue