mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 21:18:20 +00:00
the bulk of the compiler
This commit is contained in:
parent
158e82a2c1
commit
863be9436b
40 changed files with 7730 additions and 0 deletions
40
src/script_opt/CPP/CPP-load.bif
Normal file
40
src/script_opt/CPP/CPP-load.bif
Normal file
|
@ -0,0 +1,40 @@
|
|||
##! Definitions of built-in functions related to loading compiled-to-C++
|
||||
##! scripts.
|
||||
|
||||
|
||||
%%{ // C segment
|
||||
|
||||
#include "zeek/Reporter.h"
|
||||
#include "zeek/script_opt/ScriptOpt.h"
|
||||
#include "zeek/script_opt/CPP/Func.h"
|
||||
|
||||
%%}
|
||||
|
||||
## Activates the compile-to-C++ scripts associated with the given hash.
|
||||
##
|
||||
## h: Hash of the set of C++ scripts.
|
||||
##
|
||||
## Returns: True if it was present and loaded, false if not.
|
||||
##
|
||||
function load_CPP%(h: count%): bool
|
||||
%{
|
||||
auto cb = detail::standalone_callbacks.find(h);
|
||||
|
||||
if ( cb == detail::standalone_callbacks.end() )
|
||||
{
|
||||
reporter->Error("load of non-existing C++ code (%llu)", h);
|
||||
return zeek::val_mgr->False();
|
||||
}
|
||||
|
||||
// Ensure that any compiled scripts are used. If instead
|
||||
// the AST is used, then when we activate the standalone
|
||||
// scripts, they won't be able to avoid installing redundant
|
||||
// event handlers.
|
||||
detail::analysis_options.use_CPP = true;
|
||||
|
||||
// Mark this script as one we should activate after loading
|
||||
// compiled scripts.
|
||||
detail::standalone_activations.push_back(cb->second);
|
||||
|
||||
return zeek::val_mgr->True();
|
||||
%}
|
Loading…
Add table
Add a link
Reference in a new issue