Deprecate bro_int_t and bro_uint_t

This commit is contained in:
Tim Wojtulewicz 2022-06-28 15:32:26 -07:00
parent d066013793
commit f624c18383
67 changed files with 331 additions and 320 deletions

View file

@ -32,7 +32,7 @@
// find optimization opportunities, including inlining.
//
// For some Zeek scripting types, we use their natural C++ counterparts,
// such as "bro_uint_t" for "count" values. In the source code these
// such as "zeek_uint_t" for "count" values. In the source code these
// are referred to as "native" types. Other types, like tables, keep
// their interpreter-equivalent type (e.g., TableVal). These are dealt
// with almost entirely using IntrusivePtr's. The few exceptions (i.e.,
@ -899,7 +899,7 @@ private:
//
// "Native" types are those Zeek scripting types that we support
// using low-level C++ types (like "bro_uint_t" for "count").
// using low-level C++ types (like "zeek_uint_t" for "count").
// Types that we instead support using some form of ValPtr
// representation are "non-native".
bool IsNativeType(const TypePtr& t) const;

View file

@ -216,8 +216,8 @@ void CPPCompile::GenProlog()
NL();
const_info[TYPE_BOOL] = CreateConstInitInfo("Bool", "ValPtr", "bool");
const_info[TYPE_INT] = CreateConstInitInfo("Int", "ValPtr", "bro_int_t");
const_info[TYPE_COUNT] = CreateConstInitInfo("Count", "ValPtr", "bro_uint_t");
const_info[TYPE_INT] = CreateConstInitInfo("Int", "ValPtr", "zeek_int_t");
const_info[TYPE_COUNT] = CreateConstInitInfo("Count", "ValPtr", "zeek_uint_t");
const_info[TYPE_DOUBLE] = CreateConstInitInfo("Double", "ValPtr", "double");
const_info[TYPE_TIME] = CreateConstInitInfo("Time", "ValPtr", "double");
const_info[TYPE_INTERVAL] = CreateConstInitInfo("Interval", "ValPtr", "double");

View file

@ -666,10 +666,10 @@ string CPPCompile::GenArithCoerceExpr(const Expr* e, GenType gt)
switch ( t->InternalType() )
{
case TYPE_INTERNAL_INT:
cast_name = "bro_int_t";
cast_name = "zeek_int_t";
break;
case TYPE_INTERNAL_UNSIGNED:
cast_name = "bro_uint_t";
cast_name = "zeek_uint_t";
break;
case TYPE_INTERNAL_DOUBLE:
cast_name = "double";

View file

@ -392,7 +392,7 @@ public:
}
private:
bro_uint_t p;
zeek_uint_t p;
};
// Abstract class for compound items (those defined in terms of other items).

View file

@ -195,7 +195,7 @@ inline PatternValPtr re_append__CPP(const PatternValPtr& p1, const PatternValPtr
extern ValPtr schedule__CPP(double dt, EventHandlerPtr event, std::vector<ValPtr> args);
// Simple helper functions for supporting absolute value.
inline bro_uint_t iabs__CPP(bro_int_t v)
inline zeek_uint_t iabs__CPP(zeek_int_t v)
{
return v < 0 ? -v : v;
}
@ -207,28 +207,28 @@ inline double fabs__CPP(double v)
// The following operations are provided using functions to support
// error checking/reporting.
inline bro_int_t idiv__CPP(bro_int_t v1, bro_int_t v2)
inline zeek_int_t idiv__CPP(zeek_int_t v1, zeek_int_t v2)
{
if ( v2 == 0 )
reporter->CPPRuntimeError("division by zero");
return v1 / v2;
}
inline bro_int_t imod__CPP(bro_int_t v1, bro_int_t v2)
inline zeek_int_t imod__CPP(zeek_int_t v1, zeek_int_t v2)
{
if ( v2 == 0 )
reporter->CPPRuntimeError("modulo by zero");
return v1 % v2;
}
inline bro_uint_t udiv__CPP(bro_uint_t v1, bro_uint_t v2)
inline zeek_uint_t udiv__CPP(zeek_uint_t v1, zeek_uint_t v2)
{
if ( v2 == 0 )
reporter->CPPRuntimeError("division by zero");
return v1 / v2;
}
inline bro_uint_t umod__CPP(bro_uint_t v1, bro_uint_t v2)
inline zeek_uint_t umod__CPP(zeek_uint_t v1, zeek_uint_t v2)
{
if ( v2 == 0 )
reporter->CPPRuntimeError("modulo by zero");

View file

@ -83,8 +83,8 @@ extern VectorValPtr vector_select__CPP(const VectorValPtr& v1, VectorValPtr v2,
extern VectorValPtr vector_coerce_to__CPP(const VectorValPtr& v, const TypePtr& targ);
// Similar coercion, but works for v having perhaps not the correct type.
extern VectorValPtr vec_coerce_to_bro_int_t__CPP(const VectorValPtr& v, TypePtr targ);
extern VectorValPtr vec_coerce_to_bro_uint_t__CPP(const VectorValPtr& v, TypePtr targ);
extern VectorValPtr vec_coerce_to_zeek_int_t__CPP(const VectorValPtr& v, TypePtr targ);
extern VectorValPtr vec_coerce_to_zeek_uint_t__CPP(const VectorValPtr& v, TypePtr targ);
extern VectorValPtr vec_coerce_to_double__CPP(const VectorValPtr& v, TypePtr targ);
// A dummy function used during code generation for unsupported operations

View file

@ -161,17 +161,17 @@ const char* CPPCompile::TypeName(const TypePtr& t)
case TYPE_BOOL:
return "bool";
case TYPE_COUNT:
return "bro_uint_t";
return "zeek_uint_t";
case TYPE_DOUBLE:
return "double";
case TYPE_ENUM:
return "int";
case TYPE_INT:
return "bro_int_t";
return "zeek_int_t";
case TYPE_INTERVAL:
return "double";
case TYPE_PORT:
return "bro_uint_t";
return "zeek_uint_t";
case TYPE_TIME:
return "double";
case TYPE_VOID: