mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 19:48:20 +00:00
Fix generated script docs displaying functions twice.
A function prototype can be declared separately from where it's defined; the doc framework should now recognize them as the same and combine reST documentation associated with either case if both are present.
This commit is contained in:
parent
94ac3f3c23
commit
090ce2d03c
4 changed files with 104 additions and 19 deletions
|
@ -180,7 +180,7 @@ void BroDoc::WriteStringList(const char* format,
|
|||
WriteToDoc(last_format, last->c_str());
|
||||
}
|
||||
|
||||
void BroDoc::WriteBroDocObjList(const std::list<const BroDocObj*>& l,
|
||||
void BroDoc::WriteBroDocObjList(const BroDocObjList& l,
|
||||
bool wantPublic,
|
||||
const char* heading,
|
||||
char underline) const
|
||||
|
@ -205,16 +205,37 @@ void BroDoc::WriteBroDocObjList(const std::list<const BroDocObj*>& l,
|
|||
}
|
||||
}
|
||||
|
||||
void BroDoc::WriteBroDocObjList(const std::list<const BroDocObj*>& l,
|
||||
void BroDoc::WriteBroDocObjList(const BroDocObjMap& m,
|
||||
bool wantPublic,
|
||||
const char* heading,
|
||||
char underline) const
|
||||
{
|
||||
BroDocObjMap::const_iterator it;
|
||||
BroDocObjList l;
|
||||
for ( it = m.begin(); it != m.end(); ++it ) l.push_back(it->second);
|
||||
WriteBroDocObjList(l, wantPublic, heading, underline);
|
||||
}
|
||||
|
||||
void BroDoc::WriteBroDocObjList(const BroDocObjList& l,
|
||||
const char* heading,
|
||||
char underline) const
|
||||
{
|
||||
WriteSectionHeading(heading, underline);
|
||||
std::list<const BroDocObj*>::const_iterator it;
|
||||
BroDocObjList::const_iterator it;
|
||||
for ( it = l.begin(); it != l.end(); ++it )
|
||||
(*it)->WriteReST(reST_file);
|
||||
}
|
||||
|
||||
void BroDoc::WriteBroDocObjList(const BroDocObjMap& m,
|
||||
const char* heading,
|
||||
char underline) const
|
||||
{
|
||||
BroDocObjMap::const_iterator it;
|
||||
BroDocObjList l;
|
||||
for ( it = m.begin(); it != m.end(); ++it ) l.push_back(it->second);
|
||||
WriteBroDocObjList(l, heading, underline);
|
||||
}
|
||||
|
||||
void BroDoc::WriteToDoc(const char* format, ...) const
|
||||
{
|
||||
va_list argp;
|
||||
|
@ -232,10 +253,25 @@ void BroDoc::WriteSectionHeading(const char* heading, char underline) const
|
|||
WriteToDoc("\n");
|
||||
}
|
||||
|
||||
void BroDoc::FreeBroDocObjPtrList(std::list<const BroDocObj*>& l)
|
||||
void BroDoc::FreeBroDocObjPtrList(BroDocObjList& l)
|
||||
{
|
||||
std::list<const BroDocObj*>::iterator it;
|
||||
for ( it = l.begin(); it != l.end(); ++it )
|
||||
for ( BroDocObjList::const_iterator it = l.begin(); it != l.end(); ++it )
|
||||
delete *it;
|
||||
l.clear();
|
||||
}
|
||||
|
||||
void BroDoc::FreeBroDocObjPtrList(BroDocObjMap& l)
|
||||
{
|
||||
for ( BroDocObjMap::const_iterator it = l.begin(); it != l.end(); ++it )
|
||||
delete it->second;
|
||||
l.clear();
|
||||
}
|
||||
|
||||
void BroDoc::AddFunction(BroDocObj* o)
|
||||
{
|
||||
BroDocObjMap::const_iterator it = functions.find(o->Name());
|
||||
if ( it == functions.end() )
|
||||
functions[o->Name()] = o;
|
||||
else
|
||||
functions[o->Name()]->Combine(o);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue