Compare commits

...

5 Commits

Author SHA1 Message Date
Alexander Afanasyev bb96dc1e3b Avoid c++11 syntax 2015-06-15 14:33:10 -07:00
Alexander Afanasyev 0ff3592dca core: Extend utils/print-introspected-doxygen to print available LogComponents 2015-01-17 20:35:17 -08:00
Alexander Afanasyev ae7e6f1b0d core: Give ability to generate subset of documentation by utils/print-introspected-doxygen 2015-01-17 20:35:09 -08:00
Alexander Afanasyev 977b36c935 build: Avoid deprecated method in src/wscript 2015-01-17 20:34:54 -08:00
Spyridon Mastorakis 2cdce1f5e1 bindings: Update wscript to compile with the new version of pybindgen. 2015-01-17 20:30:04 -08:00
6 changed files with 83 additions and 12 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ from waflib.Errors import WafError
# after = TaskGen.after
## https://launchpad.net/pybindgen/
REQUIRED_PYBINDGEN_VERSION = (0, 17, 0, 876)
REQUIRED_PYBINDGEN_VERSION = (0, 17, 0, 887)
REQUIRED_PYGCCXML_VERSION = (0, 9, 5)
RUN_ME=-3
+3 -4
View File
@@ -16,15 +16,14 @@
#include "ns3/core-module.h"
NS_LOG_COMPONENT_DEFINE ("ScratchSimulator");
// NS_LOG_COMPONENT_DEFINE ("ScratchSimulator");
using namespace ns3;
int
main (int argc, char *argv[])
{
NS_LOG_UNCOND ("Scratch Simulator");
// NS_LOG_UNCOND ("Scratch Simulator");
Simulator::Run ();
Simulator::Destroy ();
LogComponentPrintList();
}
+10 -1
View File
@@ -55,7 +55,16 @@ ComponentList *GetComponentList (void)
return &components;
}
std::vector<std::string>
GetLogComponents()
{
std::vector<std::string> retval;
for (ComponentList::const_iterator i = GetComponentList()->begin(); i != GetComponentList()->end(); ++i)
{
retval.push_back(i->first);
}
return retval;
}
PrintList::PrintList ()
{
+10
View File
@@ -25,6 +25,7 @@
#include <iostream>
#include <stdint.h>
#include <map>
#include <vector>
#include "log-macros-enabled.h"
#include "log-macros-disabled.h"
@@ -245,6 +246,15 @@ namespace ns3 {
*/
void LogComponentPrintList (void);
/**
* \ingroup logging
*
* Get the list of available logging components that can be used with
* the NS_LOG environment variable
*/
std::vector<std::string>
GetLogComponents();
typedef void (*LogTimePrinter)(std::ostream &os);
typedef void (*LogNodePrinter)(std::ostream &os);
+5 -4
View File
@@ -468,8 +468,9 @@ class ns3header_task(Task.Task):
def __str__(self):
"string to display to the user"
env = self.env
src_str = ' '.join([a.nice_path(env) for a in self.inputs])
tgt_str = ' '.join([a.nice_path(env) for a in self.outputs])
src_str = ' '.join([a.path_from(a.ctx.launch_node()) for a in self.inputs])
tgt_str = ' '.join([a.path_from(a.ctx.launch_node()) for a in self.outputs])
if self.outputs: sep = ' -> '
else: sep = ''
if self.mode == 'remove':
@@ -547,8 +548,8 @@ class gen_ns3_module_header_task(Task.Task):
def __str__(self):
"string to display to the user"
env = self.env
src_str = ' '.join([a.nice_path(env) for a in self.inputs])
tgt_str = ' '.join([a.nice_path(env) for a in self.outputs])
src_str = ' '.join([a.path_from(a.ctx.launch_node()) for a in self.inputs])
tgt_str = ' '.join([a.path_from(a.ctx.launch_node()) for a in self.outputs])
if self.outputs: sep = ' -> '
else: sep = ''
if self.mode == 'remove':
+54 -2
View File
@@ -37,6 +37,7 @@ namespace
std::string pageAttributeList; ///< start Attributes list
std::string pageGlobalValueList; ///< start GlobalValue page
std::string pageTraceSourceList; ///< start Trace sources page
std::string pageLogComponentsList; ///< start Log components page
std::string listStart; ///< start unordered list
std::string listStop; ///< end unordered list
std::string listLineStart; ///< start unordered list item
@@ -409,17 +410,22 @@ PrintHelp (const char *program_name)
<< std::endl
<< "Options:" << std::endl
<< " --help : print these options" << std::endl
<< " --output-text : format output as plain text" << std::endl;
<< " --output-text : format output as plain text" << std::endl
<< " --log : print out also list of log components" << std::endl
<< " --group <group> : print information only for this group" << std::endl;
}
int main (int argc, char *argv[])
{
bool outputText = false;
char *programName = argv[0];
std::string group = "";
bool logComponents = false;
argv++;
argc--;
while (*argv != 0)
while (argc > 0 && *argv != 0)
{
char *arg = *argv;
@@ -432,6 +438,21 @@ int main (int argc, char *argv[])
{
outputText = true;
}
else if (strcmp(arg, "--log") == 0)
{
logComponents = true;
}
else if (strcmp(arg, "--group") == 0)
{
argv ++;
argc --;
if (argc == 0 || argv == 0)
{
PrintHelp (programName);
return 0;
}
group = *argv;
}
else
{
// un-recognized command-line argument
@@ -439,6 +460,7 @@ int main (int argc, char *argv[])
return 0;
}
argv++;
argc--;
}
if (outputText)
@@ -462,6 +484,7 @@ int main (int argc, char *argv[])
pageAttributeList = "";
pageGlobalValueList = "";
pageTraceSourceList = "";
pageLogComponentsList = "";
listStart = "";
listStop = "";
listLineStart = " * ";
@@ -490,6 +513,7 @@ int main (int argc, char *argv[])
pageAttributeList = "\\page AttributesList ";
pageGlobalValueList = "\\page GlobalValueList ";
pageTraceSourceList = "\\page TraceSourceList ";
pageLogComponentsList = "\\page LogComponentList ";
listStart = "<ul>";
listStop = "</ul>";
listLineStart = "<li>";
@@ -544,6 +568,11 @@ int main (int argc, char *argv[])
continue;
}
if (group != "" && tid.GetGroupName () != group)
{
continue;
}
// Capitalize all of letters in the name so that it sorts
// correctly in the map.
std::string name = tid.GetName ();
@@ -671,6 +700,12 @@ int main (int argc, char *argv[])
{
continue;
}
if (group != "" && tid.GetGroupName () != group)
{
continue;
}
std::cout << boldStart << tid.GetName ()
<< boldStop << breakHtmlOnly << std::endl
<< listStart << std::endl;
@@ -739,5 +774,22 @@ int main (int argc, char *argv[])
<< commentStop << std::endl;
std::cout << commentStart
<< pageLogComponentsList << "All LogComponents\n"
<< std::endl
<< listStart << std::endl;
std::vector<std::string> comps = GetLogComponents();
for (std::vector<std::string>::const_iterator logComponent = comps.begin(); logComponent != comps.end(); ++logComponent)
{
std::cout << indentHtmlOnly
<< listLineStart
<< boldStart
<< *logComponent
<< boldStop
<< listLineStop << std::endl;
}
std::cout << listStop << std::endl
<< commentStop << std::endl;
return 0;
}