mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
Move a few smaller files to zeek namespaces
This commit is contained in:
parent
812ac5536d
commit
db36688bf0
32 changed files with 335 additions and 193 deletions
58
src/Stmt.cc
58
src/Stmt.cc
|
@ -21,7 +21,9 @@
|
|||
#include "logging/Manager.h"
|
||||
#include "logging/logging.bif.h"
|
||||
|
||||
const char* stmt_name(BroStmtTag t)
|
||||
namespace zeek::detail {
|
||||
|
||||
const char* stmt_name(StmtTag t)
|
||||
{
|
||||
static const char* stmt_names[int(NUM_STMTS)] = {
|
||||
"alarm", // Does no longer exist, but kept for keeping enums consistent.
|
||||
|
@ -35,9 +37,7 @@ const char* stmt_name(BroStmtTag t)
|
|||
return stmt_names[int(t)];
|
||||
}
|
||||
|
||||
namespace zeek::detail {
|
||||
|
||||
Stmt::Stmt(BroStmtTag arg_tag)
|
||||
Stmt::Stmt(StmtTag arg_tag)
|
||||
{
|
||||
tag = arg_tag;
|
||||
breakpoint_count = 0;
|
||||
|
@ -151,7 +151,7 @@ void Stmt::AccessStats(ODesc* d) const
|
|||
}
|
||||
}
|
||||
|
||||
ExprListStmt::ExprListStmt(BroStmtTag t, ListExprPtr arg_l)
|
||||
ExprListStmt::ExprListStmt(StmtTag t, ListExprPtr arg_l)
|
||||
: Stmt(t), l(std::move(arg_l))
|
||||
{
|
||||
const expr_list& e = l->Exprs();
|
||||
|
@ -167,7 +167,7 @@ ExprListStmt::ExprListStmt(BroStmtTag t, ListExprPtr arg_l)
|
|||
|
||||
ExprListStmt::~ExprListStmt() = default;
|
||||
|
||||
ValPtr ExprListStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
||||
ValPtr ExprListStmt::Exec(Frame* f, StmtFlowType& flow) const
|
||||
{
|
||||
last_access = zeek::net::network_time;
|
||||
flow = FLOW_NEXT;
|
||||
|
@ -239,7 +239,7 @@ static void print_log(const std::vector<ValPtr>& vals)
|
|||
}
|
||||
|
||||
ValPtr PrintStmt::DoExec(std::vector<ValPtr> vals,
|
||||
stmt_flow_type& /* flow */) const
|
||||
StmtFlowType& /* flow */) const
|
||||
{
|
||||
RegisterAccess();
|
||||
|
||||
|
@ -316,7 +316,7 @@ ExprStmt::ExprStmt(ExprPtr arg_e) : Stmt(STMT_EXPR), e(std::move(arg_e))
|
|||
SetLocationInfo(e->GetLocationInfo());
|
||||
}
|
||||
|
||||
ExprStmt::ExprStmt(BroStmtTag t, ExprPtr arg_e) : Stmt(t), e(std::move(arg_e))
|
||||
ExprStmt::ExprStmt(StmtTag t, ExprPtr arg_e) : Stmt(t), e(std::move(arg_e))
|
||||
{
|
||||
if ( e )
|
||||
SetLocationInfo(e->GetLocationInfo());
|
||||
|
@ -324,7 +324,7 @@ ExprStmt::ExprStmt(BroStmtTag t, ExprPtr arg_e) : Stmt(t), e(std::move(arg_e))
|
|||
|
||||
ExprStmt::~ExprStmt() = default;
|
||||
|
||||
ValPtr ExprStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
||||
ValPtr ExprStmt::Exec(Frame* f, StmtFlowType& flow) const
|
||||
{
|
||||
RegisterAccess();
|
||||
flow = FLOW_NEXT;
|
||||
|
@ -337,7 +337,7 @@ ValPtr ExprStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ValPtr ExprStmt::DoExec(Frame* /* f */, Val* /* v */, stmt_flow_type& /* flow */) const
|
||||
ValPtr ExprStmt::DoExec(Frame* /* f */, Val* /* v */, StmtFlowType& /* flow */) const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ IfStmt::IfStmt(ExprPtr test,
|
|||
|
||||
IfStmt::~IfStmt() = default;
|
||||
|
||||
ValPtr IfStmt::DoExec(Frame* f, Val* v, stmt_flow_type& flow) const
|
||||
ValPtr IfStmt::DoExec(Frame* f, Val* v, StmtFlowType& flow) const
|
||||
{
|
||||
// Treat 0 as false, but don't require 1 for true.
|
||||
Stmt* do_stmt = v->IsZero() ? s2.get() : s1.get();
|
||||
|
@ -467,7 +467,7 @@ TraversalCode IfStmt::Traverse(TraversalCallback* cb) const
|
|||
HANDLE_TC_STMT_POST(tc);
|
||||
}
|
||||
|
||||
static BroStmtTag get_last_stmt_tag(const Stmt* stmt)
|
||||
static StmtTag get_last_stmt_tag(const Stmt* stmt)
|
||||
{
|
||||
if ( ! stmt )
|
||||
return STMT_NULL;
|
||||
|
@ -489,7 +489,7 @@ Case::Case(ListExprPtr arg_expr_cases, id_list* arg_type_cases,
|
|||
: expr_cases(std::move(arg_expr_cases)), type_cases(arg_type_cases),
|
||||
s(std::move(arg_s))
|
||||
{
|
||||
BroStmtTag t = get_last_stmt_tag(Body());
|
||||
StmtTag t = get_last_stmt_tag(Body());
|
||||
|
||||
if ( t != STMT_BREAK && t != STMT_FALLTHROUGH && t != STMT_RETURN )
|
||||
Error("case block must end in break/fallthrough/return statement");
|
||||
|
@ -817,7 +817,7 @@ std::pair<int, ID*> SwitchStmt::FindCaseLabelMatch(const Val* v) const
|
|||
return std::make_pair(label_idx, label_id);
|
||||
}
|
||||
|
||||
ValPtr SwitchStmt::DoExec(Frame* f, Val* v, stmt_flow_type& flow) const
|
||||
ValPtr SwitchStmt::DoExec(Frame* f, Val* v, StmtFlowType& flow) const
|
||||
{
|
||||
ValPtr rval;
|
||||
|
||||
|
@ -913,7 +913,7 @@ bool AddStmt::IsPure() const
|
|||
return false;
|
||||
}
|
||||
|
||||
ValPtr AddStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
||||
ValPtr AddStmt::Exec(Frame* f, StmtFlowType& flow) const
|
||||
{
|
||||
RegisterAccess();
|
||||
flow = FLOW_NEXT;
|
||||
|
@ -949,7 +949,7 @@ bool DelStmt::IsPure() const
|
|||
return false;
|
||||
}
|
||||
|
||||
ValPtr DelStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
||||
ValPtr DelStmt::Exec(Frame* f, StmtFlowType& flow) const
|
||||
{
|
||||
RegisterAccess();
|
||||
flow = FLOW_NEXT;
|
||||
|
@ -975,7 +975,7 @@ EventStmt::EventStmt(EventExprPtr arg_e)
|
|||
{
|
||||
}
|
||||
|
||||
ValPtr EventStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
||||
ValPtr EventStmt::Exec(Frame* f, StmtFlowType& flow) const
|
||||
{
|
||||
RegisterAccess();
|
||||
auto args = eval_list(f, event_expr->Args());
|
||||
|
@ -1052,7 +1052,7 @@ TraversalCode WhileStmt::Traverse(TraversalCallback* cb) const
|
|||
HANDLE_TC_STMT_POST(tc);
|
||||
}
|
||||
|
||||
ValPtr WhileStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
||||
ValPtr WhileStmt::Exec(Frame* f, StmtFlowType& flow) const
|
||||
{
|
||||
RegisterAccess();
|
||||
flow = FLOW_NEXT;
|
||||
|
@ -1195,7 +1195,7 @@ ForStmt::~ForStmt()
|
|||
delete loop_vars;
|
||||
}
|
||||
|
||||
ValPtr ForStmt::DoExec(Frame* f, Val* v, stmt_flow_type& flow) const
|
||||
ValPtr ForStmt::DoExec(Frame* f, Val* v, StmtFlowType& flow) const
|
||||
{
|
||||
ValPtr ret;
|
||||
|
||||
|
@ -1353,7 +1353,7 @@ TraversalCode ForStmt::Traverse(TraversalCallback* cb) const
|
|||
HANDLE_TC_STMT_POST(tc);
|
||||
}
|
||||
|
||||
ValPtr NextStmt::Exec(Frame* /* f */, stmt_flow_type& flow) const
|
||||
ValPtr NextStmt::Exec(Frame* /* f */, StmtFlowType& flow) const
|
||||
{
|
||||
RegisterAccess();
|
||||
flow = FLOW_LOOP;
|
||||
|
@ -1380,7 +1380,7 @@ TraversalCode NextStmt::Traverse(TraversalCallback* cb) const
|
|||
HANDLE_TC_STMT_POST(tc);
|
||||
}
|
||||
|
||||
ValPtr BreakStmt::Exec(Frame* /* f */, stmt_flow_type& flow) const
|
||||
ValPtr BreakStmt::Exec(Frame* /* f */, StmtFlowType& flow) const
|
||||
{
|
||||
RegisterAccess();
|
||||
flow = FLOW_BREAK;
|
||||
|
@ -1407,7 +1407,7 @@ TraversalCode BreakStmt::Traverse(TraversalCallback* cb) const
|
|||
HANDLE_TC_STMT_POST(tc);
|
||||
}
|
||||
|
||||
ValPtr FallthroughStmt::Exec(Frame* /* f */, stmt_flow_type& flow) const
|
||||
ValPtr FallthroughStmt::Exec(Frame* /* f */, StmtFlowType& flow) const
|
||||
{
|
||||
RegisterAccess();
|
||||
flow = FLOW_FALLTHROUGH;
|
||||
|
@ -1478,7 +1478,7 @@ ReturnStmt::ReturnStmt(ExprPtr arg_e)
|
|||
}
|
||||
}
|
||||
|
||||
ValPtr ReturnStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
||||
ValPtr ReturnStmt::Exec(Frame* f, StmtFlowType& flow) const
|
||||
{
|
||||
RegisterAccess();
|
||||
flow = FLOW_RETURN;
|
||||
|
@ -1517,7 +1517,7 @@ StmtList::~StmtList()
|
|||
Unref(stmt);
|
||||
}
|
||||
|
||||
ValPtr StmtList::Exec(Frame* f, stmt_flow_type& flow) const
|
||||
ValPtr StmtList::Exec(Frame* f, StmtFlowType& flow) const
|
||||
{
|
||||
RegisterAccess();
|
||||
flow = FLOW_NEXT;
|
||||
|
@ -1596,7 +1596,7 @@ TraversalCode StmtList::Traverse(TraversalCallback* cb) const
|
|||
HANDLE_TC_STMT_POST(tc);
|
||||
}
|
||||
|
||||
ValPtr EventBodyList::Exec(Frame* f, stmt_flow_type& flow) const
|
||||
ValPtr EventBodyList::Exec(Frame* f, StmtFlowType& flow) const
|
||||
{
|
||||
RegisterAccess();
|
||||
flow = FLOW_NEXT;
|
||||
|
@ -1621,7 +1621,7 @@ ValPtr EventBodyList::Exec(Frame* f, stmt_flow_type& flow) const
|
|||
}
|
||||
|
||||
// Simulate a return so the hooks operate properly.
|
||||
stmt_flow_type ft = FLOW_RETURN;
|
||||
StmtFlowType ft = FLOW_RETURN;
|
||||
(void) post_execute_stmt(f->GetNextStmt(), f, nullptr, &ft);
|
||||
|
||||
return nullptr;
|
||||
|
@ -1662,7 +1662,7 @@ InitStmt::InitStmt(std::vector<IDPtr> arg_inits) : Stmt(STMT_INIT)
|
|||
SetLocationInfo(inits[0]->GetLocationInfo());
|
||||
}
|
||||
|
||||
ValPtr InitStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
||||
ValPtr InitStmt::Exec(Frame* f, StmtFlowType& flow) const
|
||||
{
|
||||
RegisterAccess();
|
||||
flow = FLOW_NEXT;
|
||||
|
@ -1727,7 +1727,7 @@ TraversalCode InitStmt::Traverse(TraversalCallback* cb) const
|
|||
HANDLE_TC_STMT_POST(tc);
|
||||
}
|
||||
|
||||
ValPtr NullStmt::Exec(Frame* /* f */, stmt_flow_type& flow) const
|
||||
ValPtr NullStmt::Exec(Frame* /* f */, StmtFlowType& flow) const
|
||||
{
|
||||
RegisterAccess();
|
||||
flow = FLOW_NEXT;
|
||||
|
@ -1782,7 +1782,7 @@ WhenStmt::WhenStmt(ExprPtr arg_cond,
|
|||
|
||||
WhenStmt::~WhenStmt() = default;
|
||||
|
||||
ValPtr WhenStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
||||
ValPtr WhenStmt::Exec(Frame* f, StmtFlowType& flow) const
|
||||
{
|
||||
RegisterAccess();
|
||||
flow = FLOW_NEXT;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue