mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
tabify
This commit is contained in:
parent
a0fa5758a6
commit
bb8d6bca67
1 changed files with 27 additions and 29 deletions
56
src/Type.cc
56
src/Type.cc
|
@ -847,36 +847,34 @@ TableVal* RecordType::GetRecordFieldsVal(const RecordVal* rv) const
|
|||
if ( ft->Tag() == TYPE_RECORD )
|
||||
nr->Assign(0, new StringVal("record " + ft->GetName()));
|
||||
else if ( ft->Tag() == TYPE_VECTOR )
|
||||
{
|
||||
string s = "vector[";
|
||||
s += type_name(ft->YieldType()->Tag());
|
||||
s += "]";
|
||||
nr->Assign(0, new StringVal(s));
|
||||
}
|
||||
{
|
||||
string s = fmt("vector of %s", ft->YieldType()->Tag());
|
||||
nr->Assign(0, new StringVal(s));
|
||||
}
|
||||
else if ( ft->Tag() == TYPE_TABLE )
|
||||
{
|
||||
string s;
|
||||
if ( ft->IsSet() )
|
||||
s = "set[";
|
||||
else
|
||||
s = "table[";
|
||||
const type_list* tl = ((const IndexType*) ft)->IndexTypes();
|
||||
loop_over_list(*tl, i)
|
||||
{
|
||||
if ( i > 0 )
|
||||
s += ",";
|
||||
s += type_name((*tl)[i]->Tag());
|
||||
}
|
||||
s += "]";
|
||||
if ( ft->YieldType() )
|
||||
{
|
||||
s += " of ";
|
||||
s += type_name(ft->YieldType()->Tag());
|
||||
}
|
||||
nr->Assign(0, new StringVal(s));
|
||||
}
|
||||
else
|
||||
nr->Assign(0, new StringVal(type_name(ft->Tag())));
|
||||
{
|
||||
string s;
|
||||
if ( ft->IsSet() )
|
||||
s = "set[";
|
||||
else
|
||||
s = "table[";
|
||||
const type_list* tl = ((const IndexType*) ft)->IndexTypes();
|
||||
loop_over_list(*tl, i)
|
||||
{
|
||||
if ( i > 0 )
|
||||
s += ",";
|
||||
s += type_name((*tl)[i]->Tag());
|
||||
}
|
||||
s += "]";
|
||||
if ( ft->YieldType() )
|
||||
{
|
||||
s += " of ";
|
||||
s += type_name(ft->YieldType()->Tag());
|
||||
}
|
||||
nr->Assign(0, new StringVal(s));
|
||||
}
|
||||
else
|
||||
nr->Assign(0, new StringVal(type_name(ft->Tag())));
|
||||
|
||||
nr->Assign(1, val_mgr->GetBool(logged));
|
||||
nr->Assign(2, fv);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue