]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
-quiet option for nesdoc
authoridgay <idgay>
Fri, 2 May 2008 20:49:44 +0000 (20:49 +0000)
committeridgay <idgay>
Fri, 2 May 2008 20:49:44 +0000 (20:49 +0000)
support/make/appdoc.extra
support/make/docs.extra
tools/tinyos/ncc/nesdoc-py/archive.py
tools/tinyos/ncc/nesdoc-py/genhtml.py
tools/tinyos/ncc/nesdoc.1
tools/tinyos/ncc/nesdoc.in

index 7d29e818074ee9aee212b7d75808842072f715ea..0e7500c1fc07b3a84692d12af4799c492cef0405 100644 (file)
@@ -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)
index 767382275a3d05d5b3e444abcb068eeaa27360e5..07e5113c01d26664457af4ac382f89eb66f4eb73 100644 (file)
@@ -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
index 74b63689b7b18a20d4f90d37b2b192b75df9f63f..99f4cda3f5a7d427798729a8642b40d055e45342 100644 (file)
@@ -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)
index ef717888d62ff9ed06b67f72ad4a63c84c19b3f4..4f4886de117de1cd4000797ecdfeb8cc5c02422e 100644 (file)
@@ -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)
index ebb56493e11abd8431492f0508715fc0becd2cb8..03e7c67ffcd1bb1464d42dfc186643b372c6c249 100644 (file)
@@ -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
index 47a731de3daa21977550d753db5dbd4ad116d4e4..9d8aa3d4a26058dab4a3a27fb7d157d709137097 100644 (file)
@@ -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;