From: idgay Date: Fri, 2 May 2008 20:49:44 +0000 (+0000) Subject: -quiet option for nesdoc X-Git-Tag: release_tinyos_2_1_0_0~433 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=fd4eb0b1c65fa7582078af7f0c4950be59c72f6d -quiet option for nesdoc --- diff --git a/support/make/appdoc.extra b/support/make/appdoc.extra index 7d29e818..0e7500c1 100644 --- a/support/make/appdoc.extra +++ b/support/make/appdoc.extra @@ -9,9 +9,13 @@ endif BUILD_DEPS = appdoc_ +ifeq ($(filter quiet,$(APPDOC)),quiet) +QUIET = -quiet +endif + appdoc_: FORCE @echo " Making application documentation for $(COMPONENT) on $(PLATFORM)" # first generate the xml files - nesdoc -o build $(NESDOC_FLAGS) $(PFLAGS) $(CFLAGS) $(COMPONENT).nc -app + nesdoc -o build $(NESDOC_FLAGS) $(PFLAGS) $(CFLAGS) $(COMPONENT).nc -app $(QUIET) # generate html from the xml files - nesdoc -o build -html -target=$(PLATFORM) + nesdoc -o build -html -target=$(PLATFORM) $(QUIET) diff --git a/support/make/docs.extra b/support/make/docs.extra index 76738227..07e5113c 100644 --- a/support/make/docs.extra +++ b/support/make/docs.extra @@ -23,13 +23,17 @@ ifeq ($(filter preserve,$(DOCS)),preserve) PFLAGS += -preserve endif +ifeq ($(filter quiet,$(DOCS)),quiet) +QUIET = -quiet +endif + BUILD_DEPS = docs_ docs_: FORCE @echo " Making documentation for $(COMPONENT) on $(PLATFORM)" # first generate the xml files - nesdoc -o $(DOCDIR) $(NESDOC_FLAGS) $(PFLAGS) $(CFLAGS) $(COMPONENT).nc + nesdoc -o $(DOCDIR) $(NESDOC_FLAGS) $(PFLAGS) $(CFLAGS) $(QUIET) $(COMPONENT).nc ifneq ($(filter nohtml,$(DOCS)),nohtml) # generate html from the xml files - nesdoc -o $(DOCDIR) -html -target=$(PLATFORM) $(DOCS) + nesdoc -o $(DOCDIR) -html $(QUIET) -target=$(PLATFORM) endif diff --git a/tools/tinyos/ncc/nesdoc-py/archive.py b/tools/tinyos/ncc/nesdoc-py/archive.py index 74b63689..99f4cda3 100644 --- a/tools/tinyos/ncc/nesdoc-py/archive.py +++ b/tools/tinyos/ncc/nesdoc-py/archive.py @@ -54,13 +54,14 @@ def get1(x, tag): return check(xml_tagfind(x, tag)) def usage(): - print "Usage: %s [-t dir] [--topdir dir] [--preserve] [--app] repository" % argv[0] + print "Usage: %s [-t dir] [--topdir dir] [--preserve] [--app] [--quiet] repository" % argv[0] print " where -t/--topdir specify prefixes to remove from file names" print " to create nice, package-like names for interface and components" print " (based on their full filename)." print " If --preserve is specified, existing XML files are preserved." print " If --app is specified, a page for this application is created in the" print " current directory." + print " If --quiet is specified, the program is less verbose." print " The XML input is read from stdin." # Return package name for elem, or None if no valid name is found @@ -103,10 +104,11 @@ def canonicalisedir(dirname): return dirname # option processing. See usage string for details. -(opts, args) = getopt(argv[1:], "t:", [ "topdir=", "preserve", "app" ]) -topopts = filter(lambda (x): x[0] != "--preserve" and x[0] != "--app", opts) +(opts, args) = getopt(argv[1:], "t:", [ "topdir=", "preserve", "app", "quiet" ]) +topopts = filter(lambda (x): x[0] != "--preserve" and x[0] != "--app" and x[0] != "--quiet", opts) preserve = filter(lambda(x): x[0] == "--preserve", opts) != [] app = filter(lambda(x): x[0] == "--app", opts) != [] +quiet = filter(lambda(x): x[0] == "--quiet", opts) != [] topdirs = map(lambda (x): canonicalisedir(x[1]), topopts) if len(args) != 1: usage() @@ -215,7 +217,8 @@ for x in interfacedefs.getElementsByTagName("interfacedef"): filename = "interfaces/%s.xml" % nicename if preserve and os.path.exists(filename): continue - # print "interface %s (%s)" % (name, nicename) + if not quiet: + print "interface %s (%s)" % (name, nicename) doc = creator.createDocument(None, None, None) copy = x.cloneNode(True) doc.appendChild(copy) @@ -233,8 +236,8 @@ for x in components.getElementsByTagName("component"): filename = "components/%s.xml" % nicename if preserve and os.path.exists(filename): continue - - # print "component %s (%s)" % (name, nicename) + if not quiet: + print "component %s (%s)" % (name, nicename) doc = creator.createDocument(None, None, None) # copy component and create its specification copy = x.cloneNode(True) diff --git a/tools/tinyos/ncc/nesdoc-py/genhtml.py b/tools/tinyos/ncc/nesdoc-py/genhtml.py index ef717888..4f4886de 100644 --- a/tools/tinyos/ncc/nesdoc-py/genhtml.py +++ b/tools/tinyos/ncc/nesdoc-py/genhtml.py @@ -51,7 +51,13 @@ register_doctag("return", return_doctag) # Generate HTML files, and a global index for all interfaces and components # in the specified repository -repository = argv[1] +if argv[1] == "--quiet": + repository = argv[2] + quiet = True +else: + repository = argv[1] + quiet = False + try: chdir(repository) @@ -75,14 +81,16 @@ except OSError: for intf in intffiles: if search("\\.xml$", intf): - #stderr.write("interface " + intf + "\n") + if not quiet: + stderr.write("interface " + intf + "\n") ixml = parse("interfaces/" + intf) generate_interface(ixml.documentElement) ixml.unlink() for comp in compfiles: if search("\\.xml$", comp): - #stderr.write("component " + comp + "\n") + if not quiet: + stderr.write("component " + comp + "\n") ixml = parse("components/" + comp) generate_component_graph(ixml.documentElement) generate_component(ixml.documentElement) diff --git a/tools/tinyos/ncc/nesdoc.1 b/tools/tinyos/ncc/nesdoc.1 index ebb56493..03e7c67f 100644 --- a/tools/tinyos/ncc/nesdoc.1 +++ b/tools/tinyos/ncc/nesdoc.1 @@ -12,12 +12,13 @@ TinyOS 1.x usage: TinyOS 2.x: collect documentation from a program: .br \fBnesdoc\fR -o \fIdocumentation-directory\fR [\fB-preserve\fR] - [\fB-new\fR] [\fB-target=\fIplatform\fR] [\fB-topdir=\fIdirectory\fR] - [\fIncc-options\fR] \fIfiles...\fR + [\fB-new\fR] [\fB-quiet\fR] [\fB-target=\fIplatform\fR] [\fB-topdir=\fIdirectory\fR] + [\fIncc-options\fR] \fIfiles...\fR TinyOS 2.x: generate nesdoc HTML pages: .br -\fBnesdoc\fR -o \fIdocumentation-directory\fR [\fB-new\fR] [\fB-target=\fIplatform\fR] \fB-html\fR +\fBnesdoc\fR -o \fIdocumentation-directory\fR \fB-html\fR + [\fB-new\fR] [\fB-quiet\fR] [\fB-target=\fIplatform\fR] .SH DESCRIPTION @@ -68,6 +69,9 @@ Generate HTML pages for all the nesdoc information collected in \fB-new\fR Force the use of the new nesdoc even when using a TinyOS 1.x source tree. .TP +\fB-quiet\fR +Don't print informational messages. +.TP \fB-topdir=\fIdir\fR Specify directory paths that should be stripped from the source file names when generating "package names" for the documentation files. The directory diff --git a/tools/tinyos/ncc/nesdoc.in b/tools/tinyos/ncc/nesdoc.in index 47a731de..9d8aa3d4 100644 --- a/tools/tinyos/ncc/nesdoc.in +++ b/tools/tinyos/ncc/nesdoc.in @@ -97,6 +97,10 @@ for ($i = 0; $i <= $#ARGV; $i++) { $app = 1; $strip = 1; } + elsif (/^-quiet$/) { + $quiet = 1; + $strip = 1; + } } push @ncc_args, $_ if !$strip; } @@ -117,7 +121,11 @@ else { } if ($genhtml) { - execorfail($python, "$libprogs/nesdoc/genhtml.py", $docdir) + push @html_args, $python; + push @html_args, "$libprogs/nesdoc/genhtml.py"; + push @html_args, "--quiet" if $quiet; + push @html_args, $docdir; + execorfail(@html_args); } # Collecting nesdoc data. Run ncc, then process the results with @@ -150,6 +158,7 @@ chomp $toscontainer; push @archive_args, "--topdir=$toscontainer"; push @archive_args, "--preserve" if $preserve; push @archive_args, "--app" if $app; +push @archive_args, "--quiet" if $quiet; push @archive_args, "$docdir"; unshift @archive_args, "$libprogs/nesdoc/archive.py"; unshift @archive_args, $python;