X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ovsdb%2Fovsdb-doc.in;h=b325b263283bd924bbe7ce497078ca34999991e6;hb=09eda55c4a3ef0215fea797c73cc2ba5778af8ca;hp=9e0a318d2b9fb41366cae87e4d77d0589029fa7d;hpb=c94238565522c51a117a7f89fecaabd2605b7c66;p=openvswitch diff --git a/ovsdb/ovsdb-doc.in b/ovsdb/ovsdb-doc.in index 9e0a318d..b325b263 100755 --- a/ovsdb/ovsdb-doc.in +++ b/ovsdb/ovsdb-doc.in @@ -136,6 +136,8 @@ def typeAndConstraintsToNroff(column): constraints = column.type.constraintsToEnglish(escapeNroffLiteral) if constraints: type += ", " + constraints + if column.unique: + type += " (must be unique within table)" return type def columnToNroff(columnName, column, node): @@ -177,7 +179,7 @@ def tableSummaryToNroff(summary, level=0): s = "" for type, name, arg in summary: if type == 'column': - + s += "%s\\fB%s\\fR\tT{\n%s\nT}\n" % ( r'\ \ ' * level, name, typeAndConstraintsToNroff(arg)) else: @@ -221,11 +223,11 @@ Column Type def docsToNroff(schemaFile, xmlFile, erFile, title=None): schema = ovs.db.schema.DbSchema.from_json(ovs.json.from_file(schemaFile)) doc = xml.dom.minidom.parse(xmlFile).documentElement - + schemaDate = os.stat(schemaFile).st_mtime xmlDate = os.stat(xmlFile).st_mtime d = date.fromtimestamp(max(schemaDate, xmlDate)) - + if title == None: title = schema.name @@ -286,20 +288,25 @@ Table Purpose if erFile: s += """ +.if !'\*[.T]'ascii' \{ .sp 1 .SH "TABLE RELATIONSHIPS" .PP The following diagram shows the relationship among tables in the -database. Each node represents a table. Each edge leads from the +database. Each node represents a table. Tables that are part of the +``root set'' are shown with double borders. Each edge leads from the table that contains it and points to the table that its value -represents. Edges are labeled with their column names. +represents. Edges are labeled with their column names, followed by a +constraint on the number of allowed values: \\fB?\\fR for zero or one, +\\fB*\\fR for zero or more, \\fB+\\fR for one or more. Thick lines +represent strong references; thin lines represent weak references. .RS -1in """ erStream = open(erFile, "r") for line in erStream: s += line + '\n' erStream.close() - s += ".RE\n" + s += ".RE\\}\n" for node in tableNodes: s += tableToNroff(schema, node) + "\n" @@ -344,19 +351,19 @@ if __name__ == "__main__": print "ovsdb-doc (Open vSwitch) @VERSION@" else: sys.exit(0) - + if len(args) != 2: sys.stderr.write("%s: exactly 2 non-option arguments required " "(use --help for help)\n" % argv0) sys.exit(1) - + # XXX we should warn about undocumented tables or columns s = docsToNroff(args[0], args[1], er_diagram) for line in s.split("\n"): line = line.strip() if len(line): print line - + except error.Error, e: sys.stderr.write("%s: %s\n" % (argv0, e.msg)) sys.exit(1)