Commit 26f7c40a authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(prot_a_selection.check_implemented): New method.

(prot_a_selection.all_names): New method.
(lexer.__init__): Check that the same number isn't used twice in
	asyncs-numbered.tmp.  Read miscs-numbered.tmp.
(lexer.toplevel_bye): Check that all implemented misc-infos are
	documented, and vice versa.
parent 238bf028
......@@ -110,6 +110,17 @@ class prot_a_selection(prot_a_type):
self.__used_tailnames[tailname] = o
def check_implemented(self, imp_nr, imp_name):
if not self.__used_names.has_key(imp_name):
return "``%s'' implemented but not documented" % imp_name
if self.__used_names[imp_name][0] != imp_nr:
return "``%s'' implemented as %s but documented as %s" % (
imp_name, repr(imp_nr), repr(self.__used_names[imp_name][0]))
return None
def all_names(self):
return self.__used_names.keys()
def use_recurse(self):
for (number, name, tailname, tail_type, is_array) in self.__fields:
......@@ -236,10 +247,34 @@ class lexer:
self.__implemented_asyncs = {}
n = {}
f = open("asyncs-numbered.tmp", "r")
for line in f.readlines():
[nr, name] = line.split(" ")
self.__implemented_asyncs[name.strip()] = nr
name = name.strip()
if n.has_key(nr):
sys.stderr.write("../src/server/async.h:1:enum async:"
" number %s used for both %s and %s\n" % (
nr, n[nr], name))
n[nr] = name
self.__implemented_asyncs[name] = nr
self.__implemented_miscs = {}
n = {}
f = open("miscs-numbered.tmp", "r")
for line in f.readlines():
[nr, name] = line.split(" ")
nr = int(nr)
name = name.strip()
if n.has_key(nr):
sys.stderr.write("../src/include/kom-types.h:1:enum info_type:"
" number %s used for both %s and %s\n" % (
nr, n[nr], name))
n[nr] = name
self.__implemented_miscs[name] = nr
def run(self):
......@@ -573,6 +608,16 @@ class lexer:
"asynchronous message ``%s'' not documented" % req)
# Check misc-info stuff.
for name, nr in self.__implemented_miscs.items():
err = defined_types['Misc-Info'].check_implemented(nr, name)
if err:
self.error(self.__reader.line_no(), "Misc-info " + err)
for name in defined_types['Misc-Info'].all_names():
if not self.__implemented_miscs.has_key(name):
"Misc-info ``%s'' not implemented." % name)
# This is the normal exit of the program. It isn't nice to hide
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment