mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
tracking of event groups for compilation to standalone-C++
This commit is contained in:
parent
b25a844210
commit
973cc00c42
17 changed files with 155 additions and 69 deletions
|
@ -365,13 +365,19 @@ void CPPCompile::RegisterCompiledBody(const string& f) {
|
|||
ASSERT(fi != func_index.end());
|
||||
auto type_signature = casting_index[fi->second];
|
||||
|
||||
auto h = body_hashes[f];
|
||||
auto p = body_priorities[f];
|
||||
auto loc = body_locs[f];
|
||||
auto body_info = Fmt(p) + ", " + Fmt(h) + ", \"" + loc->FileName() + " (C++)\", " + Fmt(loc->FirstLine());
|
||||
const auto& bi = body_info[f];
|
||||
auto body_info =
|
||||
Fmt(bi.priority) + ", " + Fmt(bi.hash) + ", \"" + bi.loc->FileName() + " (C++)\", " + Fmt(bi.loc->FirstLine());
|
||||
|
||||
Emit("\tCPP_RegisterBody(\"%s\", (void*) %s, %s, %s, std::vector<std::string>(%s)),", f, f, Fmt(type_signature),
|
||||
body_info, events);
|
||||
string module_group = "\"" + bi.module + "\"";
|
||||
|
||||
string attr_groups = "{";
|
||||
for ( const auto& g : bi.groups )
|
||||
attr_groups += " \"" + g + "\",";
|
||||
attr_groups += " }";
|
||||
|
||||
Emit("\tCPP_RegisterBody(\"%s\", (void*) %s, %s, %s, std::vector<std::string>(%s), %s, %s),", f, f,
|
||||
Fmt(type_signature), body_info, events, module_group, attr_groups);
|
||||
}
|
||||
|
||||
void CPPCompile::GenEpilog() {
|
||||
|
@ -555,8 +561,12 @@ void CPPCompile::GenRegisterBodies() {
|
|||
"auto f = make_intrusive<CPPDynStmt>(b.func_name.c_str(), b.func, b.type_signature, "
|
||||
"b.filename, b.line_num);");
|
||||
|
||||
auto reg = standalone ? "register_standalone_body" : "register_body";
|
||||
Emit("%s__CPP(f, b.priority, b.h, b.events, finish_init__CPP);", reg);
|
||||
if ( standalone )
|
||||
Emit(
|
||||
"register_standalone_body__CPP(f, b.priority, b.h, b.events, b.module_group, b.attr_groups, "
|
||||
"finish_init__CPP);");
|
||||
else
|
||||
Emit("register_body__CPP(f, b.priority, b.h, b.events, finish_init__CPP);");
|
||||
EndBlock();
|
||||
|
||||
EndBlock();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue