Bro script documentation framework checkpoint

* New bro runtime options: -Z or --doc-scripts enables documentation mode
* New BroDoc, BroBifDoc, and BroDocObj interfaces to support script
  documentation
* Modifications to the bro scanner (scan.l) to get it to keep track of
  which script is being scanned/parsed and which document is being generated
* Modifications to scan.l and the bro parser (parse.y) to produce/consume
  script comments denoted with "##"
* Documentation is currently generated for the following
** Script author
** Script summary
** @load's
** capture_filters
** modules (namespaces)

Most of the remaining framework/infrastructure work should be in extracting
the interesting BroObj objects as the parser sees them and better formatting
the reST documents.
This commit is contained in:
Jon Siwek 2011-02-25 15:30:18 -06:00
parent 4b77164e04
commit 30209b56bb
10 changed files with 644 additions and 3 deletions

35
src/BroDocObj.cc Normal file
View file

@ -0,0 +1,35 @@
#include <cstdio>
#include <string>
#include <list>
#include "Obj.h"
#include "BroDocObj.h"
BroDocObj::BroDocObj(const BroObj* obj,
std::list<std::string>*& reST,
bool exported)
{
broObj = obj;
isExported = exported;
reST_doc_strings = reST;
reST = 0;
}
BroDocObj::~BroDocObj()
{
delete reST_doc_strings;
}
void BroDocObj::WriteReST(FILE* file) const
{
if ( reST_doc_strings )
{
std::list<std::string>::const_iterator it;
for ( it = reST_doc_strings->begin();
it != reST_doc_strings->end(); ++it)
fprintf(file, "%s\n", it->c_str());
}
ODesc desc;
broObj->Describe(&desc);
fprintf(file, "%s\n", desc.Description());
}