From: idgay Date: Fri, 19 Sep 2008 22:08:28 +0000 (+0000) Subject: minor cleanup/-topdir bug fix X-Git-Tag: rc_6_tinyos_2_1_1~618 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=70f9a9313b4d762749811d170ebda4a3109878df minor cleanup/-topdir bug fix --- diff --git a/tools/tinyos/ncc/nesdoc-py/archive.py b/tools/tinyos/ncc/nesdoc-py/archive.py index 4fcc05b1..88fba77e 100644 --- a/tools/tinyos/ncc/nesdoc-py/archive.py +++ b/tools/tinyos/ncc/nesdoc-py/archive.py @@ -70,7 +70,7 @@ def packagename(elem): loc = elem.getAttribute("loc") colon = index(loc, ":") filename = canonicalise(loc[colon + 1:]) - for dir in topdirs: + for dir in topdir: dirlen = len(dir) if filename[0:dirlen] == dir: filename = filename[dirlen:] @@ -104,14 +104,32 @@ def canonicalisedir(dirname): return dirname # option processing. See usage string for details. -(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) +def process_opts(argv): + options = { + "topdir": (True, lambda (x): topdir + [canonicalisedir(x)]), + "preserve": (False, lambda x: True), + "app": (False, lambda x: True), + "quiet": (False, lambda x: True), + } + getopt_args = [] + for p in options: + globals()[p] = False + opt = p + if options[p][0]: + opt += "=" + getopt_args += [ opt ] + (opts, args) = getopt(argv, "", getopt_args) + topdir = [] + highlight = "" + for o, a in opts: + opt = o[2:] + globals()[opt] = options[opt][1](a) + return args + +args = process_opts(argv[1:]) if len(args) != 1: usage() + exit(2) repository = args[0] try: diff --git a/tools/tinyos/ncc/nesdoc.1 b/tools/tinyos/ncc/nesdoc.1 index 03e7c67f..ba4b0631 100644 --- a/tools/tinyos/ncc/nesdoc.1 +++ b/tools/tinyos/ncc/nesdoc.1 @@ -12,7 +12,7 @@ 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-quiet\fR] [\fB-target=\fIplatform\fR] [\fB-topdir=\fIdirectory\fR] + [\fB-new\fR] [\fB-quiet\fR] [\fB-target=\fIplatform\fR] [\fB-topdir=\fIdirectory\fR] [\fB-app\fR] [\fIncc-options\fR] \fIfiles...\fR TinyOS 2.x: generate nesdoc HTML pages: @@ -77,7 +77,10 @@ Specify directory paths that should be stripped from the source file names when generating "package names" for the documentation files. The directory above \fBTOSDIR\fR is automatically added, so this option is only needed for directories outside the main TinyOS distribution. - +.TP +\fB-app\fR +Also generate a graph for the whole application in the current directory - +this is useful to check the wiring of a particular application. .SH SEE ALSO .IR ncc (1) diff --git a/tools/tinyos/ncc/nesdoc.in b/tools/tinyos/ncc/nesdoc.in index eaad3cbd..8c76fbc4 100644 --- a/tools/tinyos/ncc/nesdoc.in +++ b/tools/tinyos/ncc/nesdoc.in @@ -68,7 +68,7 @@ for ($i = 0; $i <= $#ARGV; $i++) { $_ = $ARGV[$i]; if (/^-/) { if (/^-topdir=(.*)/) { - push @archive_args, $1; + push @archive_args, "--topdir=$1"; $strip = 1; } elsif (/^--version$/) {