mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 09:38:19 +00:00
Bro's doc mode now terminates after processing bro_init but before net_run
Generated script reST documentation is also written out at this time instead of at the end of lexical scanning. The persistence serializer will no longer write out Bro's state to the .state directory when in doc mode.
This commit is contained in:
parent
481a1d097b
commit
d919ebed58
2 changed files with 15 additions and 12 deletions
14
src/main.cc
14
src/main.cc
|
@ -47,6 +47,8 @@ extern "C" void OPENSSL_add_all_algorithms_conf(void);
|
||||||
#include "Stats.h"
|
#include "Stats.h"
|
||||||
#include "ConnCompressor.h"
|
#include "ConnCompressor.h"
|
||||||
#include "DPM.h"
|
#include "DPM.h"
|
||||||
|
#include "BroDoc.h"
|
||||||
|
#include <list>
|
||||||
|
|
||||||
#include "binpac_bro.h"
|
#include "binpac_bro.h"
|
||||||
|
|
||||||
|
@ -94,6 +96,7 @@ int do_notice_analysis = 0;
|
||||||
int rule_bench = 0;
|
int rule_bench = 0;
|
||||||
int print_loaded_scripts = 0;
|
int print_loaded_scripts = 0;
|
||||||
int generate_documentation = 0;
|
int generate_documentation = 0;
|
||||||
|
extern std::list<BroDoc*> docs_generated;
|
||||||
SecondaryPath* secondary_path = 0;
|
SecondaryPath* secondary_path = 0;
|
||||||
ConnCompressor* conn_compressor = 0;
|
ConnCompressor* conn_compressor = 0;
|
||||||
extern char version[];
|
extern char version[];
|
||||||
|
@ -971,6 +974,17 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
mgr.Drain();
|
mgr.Drain();
|
||||||
|
|
||||||
|
if ( generate_documentation )
|
||||||
|
{
|
||||||
|
std::list<BroDoc*>::iterator it;
|
||||||
|
for ( it = docs_generated.begin(); it != docs_generated.end(); ++it )
|
||||||
|
(*it)->WriteDocFile();
|
||||||
|
for ( it = docs_generated.begin(); it != docs_generated.end(); ++it )
|
||||||
|
delete *it;
|
||||||
|
terminate_bro();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
have_pending_timers = ! reading_traces && timer_mgr->Size() > 0;
|
have_pending_timers = ! reading_traces && timer_mgr->Size() > 0;
|
||||||
|
|
||||||
if ( io_sources.Size() > 0 || have_pending_timers )
|
if ( io_sources.Size() > 0 || have_pending_timers )
|
||||||
|
|
13
src/scan.l
13
src/scan.l
|
@ -58,7 +58,7 @@ char last_tok[128];
|
||||||
static PList(char) files_scanned;
|
static PList(char) files_scanned;
|
||||||
|
|
||||||
// reST documents that we've created (or have at least opened so far).
|
// reST documents that we've created (or have at least opened so far).
|
||||||
static std::list<BroDoc*> docs_generated;
|
std::list<BroDoc*> docs_generated;
|
||||||
|
|
||||||
// reST comments (those starting with ##) seen so far.
|
// reST comments (those starting with ##) seen so far.
|
||||||
std::list<std::string>* reST_doc_comments = 0;
|
std::list<std::string>* reST_doc_comments = 0;
|
||||||
|
@ -877,18 +877,7 @@ int yywrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( generate_documentation )
|
if ( generate_documentation )
|
||||||
{
|
|
||||||
std::list<BroDoc*>::iterator it;
|
|
||||||
|
|
||||||
for ( it = docs_generated.begin(); it != docs_generated.end(); ++it )
|
|
||||||
{
|
|
||||||
(*it)->WriteDocFile();
|
|
||||||
delete *it;
|
|
||||||
}
|
|
||||||
|
|
||||||
docs_generated.clear();
|
|
||||||
clear_reST_doc_comments();
|
clear_reST_doc_comments();
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise, we are done.
|
// Otherwise, we are done.
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue