mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Move various elements into ID.h and zeek::id namespace
* A handful of generic/useful/common global type pointers that used to be in NetVar.h * Lookup functions that used to be Var.h
This commit is contained in:
parent
9210d443d3
commit
a5762c12cc
84 changed files with 578 additions and 568 deletions
72
src/Var.h
72
src/Var.h
|
@ -40,88 +40,32 @@ extern void end_func(IntrusivePtr<Stmt> body);
|
|||
// Gather all IDs referenced inside a body that aren't part of a given scope.
|
||||
extern id_list gather_outer_ids(Scope* scope, Stmt* body);
|
||||
|
||||
[[deprecated("Remove in v4.1. Use zeek::lookup_val().")]]
|
||||
[[deprecated("Remove in v4.1. Use zeek::id::lookup_val().")]]
|
||||
extern Val* internal_val(const char* name);
|
||||
|
||||
[[deprecated("Remove in v4.1. Use zeek::lookup_const().")]]
|
||||
[[deprecated("Remove in v4.1. Use zeek::id::lookup_const().")]]
|
||||
extern Val* internal_const_val(const char* name); // internal error if not const
|
||||
|
||||
[[deprecated("Remove in v4.1. Use lookup_ID() or zeek::lookup_val().")]]
|
||||
[[deprecated("Remove in v4.1. Use zeek::id::lookup() or zeek::id::lookup_val().")]]
|
||||
extern Val* opt_internal_val(const char* name); // returns nil if not defined
|
||||
|
||||
extern double opt_internal_double(const char* name);
|
||||
extern bro_int_t opt_internal_int(const char* name);
|
||||
extern bro_uint_t opt_internal_unsigned(const char* name);
|
||||
[[deprecated("Remove in v4.1. Use lookup_ID() or zeek::lookup_val().")]]
|
||||
[[deprecated("Remove in v4.1. Use zeek::id::lookup() or zeek::id::lookup_val().")]]
|
||||
extern StringVal* opt_internal_string(const char* name);
|
||||
[[deprecated("Remove in v4.1. Use lookup_ID() or zeek::lookup_val().")]]
|
||||
[[deprecated("Remove in v4.1. Use zeek::id::lookup() or zeek::id::lookup_val().")]]
|
||||
extern TableVal* opt_internal_table(const char* name); // nil if not defined
|
||||
|
||||
[[deprecated("Remove in v4.1. Use lookup_ID(), zeek::lookup_val(), and/or TableVal::ToPureListVal().")]]
|
||||
[[deprecated("Remove in v4.1. Use zeek::id::lookup(), zeek::id::lookup_val(), and/or TableVal::ToPureListVal().")]]
|
||||
extern ListVal* internal_list_val(const char* name);
|
||||
|
||||
[[deprecated("Remove in v4.1. Use zeek::lookup_type().")]]
|
||||
[[deprecated("Remove in v4.1. Use zeek::id::lookup_type().")]]
|
||||
extern BroType* internal_type(const char* name);
|
||||
|
||||
[[deprecated("Remove in v4.1. Use zeek::lookup_func().")]]
|
||||
[[deprecated("Remove in v4.1. Use zeek::id::lookup_func().")]]
|
||||
extern Func* internal_func(const char* name);
|
||||
|
||||
extern EventHandlerPtr internal_handler(const char* name);
|
||||
|
||||
extern int signal_val; // 0 if no signal pending
|
||||
|
||||
namespace zeek {
|
||||
|
||||
/**
|
||||
* Lookup an ID by its name and return its type. A fatal occurs if the ID
|
||||
* does not exist.
|
||||
* @param name The identifier name to lookup
|
||||
* @return The type of the identifier.
|
||||
*/
|
||||
const IntrusivePtr<BroType>& lookup_type(const char* name);
|
||||
|
||||
/**
|
||||
* Lookup an ID by its name and return its type (as cast to @c T).
|
||||
* A fatal occurs if the ID does not exist.
|
||||
* @param name The identifier name to lookup
|
||||
* @return The type of the identifier.
|
||||
*/
|
||||
template<class T>
|
||||
IntrusivePtr<T> lookup_type(const char* name)
|
||||
{ return cast_intrusive<T>(lookup_type(name)); }
|
||||
|
||||
/**
|
||||
* Lookup an ID by its name and return its value. A fatal occurs if the ID
|
||||
* does not exist.
|
||||
* @param name The identifier name to lookup
|
||||
* @return The current value of the identifier
|
||||
*/
|
||||
const IntrusivePtr<Val>& lookup_val(const char* name);
|
||||
|
||||
/**
|
||||
* Lookup an ID by its name and return its value (as cast to @c T).
|
||||
* A fatal occurs if the ID does not exist.
|
||||
* @param name The identifier name to lookup
|
||||
* @return The current value of the identifier.
|
||||
*/
|
||||
template<class T>
|
||||
IntrusivePtr<T> lookup_val(const char* name)
|
||||
{ return cast_intrusive<T>(lookup_val(name)); }
|
||||
|
||||
/**
|
||||
* Lookup an ID by its name and return its value. A fatal occurs if the ID
|
||||
* does not exist or if it is not "const".
|
||||
* @param name The identifier name to lookup
|
||||
* @return The current value of the identifier
|
||||
*/
|
||||
const IntrusivePtr<Val>& lookup_const(const char* name);
|
||||
|
||||
/**
|
||||
* Lookup an ID by its name and return the function it references.
|
||||
* A fatal occurs if the ID does not exist or if it is not a function.
|
||||
* @param name The identifier name to lookup
|
||||
* @return The current function value the identifier references.
|
||||
*/
|
||||
IntrusivePtr<Func> lookup_func(const char* name);
|
||||
|
||||
} // namespace zeek
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue