mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/topic/vern/CPP-workflow2'
* origin/topic/vern/CPP-workflow2: low-level coding style fixes support for standalone compiled scripts to export globals with module qualifiers updates for documentation of functionality for compiling scripts to C++ fixes for standalone C++ scripts making types & variables/functions available fixed bug limiting availability of load_CPP() BiF updates to development helper scripts to support new workflow simpler workflow for -O gen-C++ ; also some hooks for -O gen-standalone-C++ ReplaceBody now deletes a body if the replacement is nil removal of can't-actually-be-executed code
This commit is contained in:
commit
0b342b7bfa
26 changed files with 335 additions and 124 deletions
24
src/Func.cc
24
src/Func.cc
|
@ -332,8 +332,11 @@ ScriptFunc::ScriptFunc(std::string _name, FuncTypePtr ft,
|
|||
|
||||
sort(bodies.begin(), bodies.end());
|
||||
|
||||
current_body = bodies[0].stmts;
|
||||
current_priority = bodies[0].priority;
|
||||
if ( ! bodies.empty() )
|
||||
{
|
||||
current_body = bodies[0].stmts;
|
||||
current_priority = bodies[0].priority;
|
||||
}
|
||||
}
|
||||
|
||||
ScriptFunc::~ScriptFunc()
|
||||
|
@ -579,15 +582,21 @@ void ScriptFunc::ReplaceBody(const StmtPtr& old_body, StmtPtr new_body)
|
|||
{
|
||||
bool found_it = false;
|
||||
|
||||
for ( auto& body : bodies )
|
||||
if ( body.stmts.get() == old_body.get() )
|
||||
for ( auto body = bodies.begin(); body != bodies.end(); ++body )
|
||||
if ( body->stmts.get() == old_body.get() )
|
||||
{
|
||||
body.stmts = new_body;
|
||||
current_priority = body.priority;
|
||||
if ( new_body )
|
||||
{
|
||||
body->stmts = new_body;
|
||||
current_priority = body->priority;
|
||||
}
|
||||
else
|
||||
bodies.erase(body);
|
||||
|
||||
found_it = true;
|
||||
break;
|
||||
}
|
||||
|
||||
ASSERT(found_it);
|
||||
current_body = new_body;
|
||||
}
|
||||
|
||||
|
@ -1049,6 +1058,7 @@ void init_primary_bifs()
|
|||
#include "option.bif.func_init"
|
||||
#include "supervisor.bif.func_init"
|
||||
#include "packet_analysis.bif.func_init"
|
||||
#include "CPP-load.bif.func_init"
|
||||
|
||||
init_builtin_types();
|
||||
did_builtin_init = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue