From 56aa6280f6d6b6813bfba0dc1d56987d4c2fb336 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Wed, 1 May 2002 17:25:04 +0000 Subject: [PATCH] list_documented_items(): Basic implementation. This still does not work well since ctags does not do a good job with the Python headers, appearantly due to the DL_IMPORT macro. ;-( --- Doc/tools/findcsyms | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/Doc/tools/findcsyms b/Doc/tools/findcsyms index cffc2373609..ac9b754259f 100755 --- a/Doc/tools/findcsyms +++ b/Doc/tools/findcsyms @@ -2,6 +2,7 @@ import errno import os +import re import sys if __name__ == "__main__": @@ -25,10 +26,38 @@ def list_headers(): return [fn for fn in os.listdir(incdir) if fn.endswith(".h") and fn not in EXCLUDES] + +def matcher(pattern): + return re.compile(pattern).match + +MATCHERS = [ + matcher(r"\\begin\{cfuncdesc\}\{[^{]*\}\{(?P[^{]*)\}"), + matcher(r"\\cfuncline\{[^{]*\}\{(?P[^{]*)\}"), + matcher(r"\\begin\{ctypedesc\}(\[[^{]*\])?\{(?P[^{]*)\}"), + matcher(r"\\begin\{cvardesc\}\{[^{]*\}\{(?P[^{]*)\}"), + matcher(r"\\begin\{cmemberdesc\}\{[^{]*\}\{(?P[^{]*)\}"), + matcher(r"\\cmemberline\{[^{]*\}\{(?P[^{]*)\}"), + matcher(r"\\begin\{csimplemacrodesc\}\{(?P[^{]*)\}"), + ] + + def list_documented_items(): """Return a list of everything that's already documented.""" - docdir = os.path.join(srcdir, "Doc") - return [] + apidir = os.path.join(srcdir, "Doc", "api") + files = [fn for fn in os.listdir(apidir) if fn.endswith(".tex")] + L = [] + for fn in files: + fullname = os.path.join(apidir, fn) + for line in open(fullname): + line = line.lstrip() + if not line.startswith("\\"): + continue + for matcher in MATCHERS: + m = matcher(line) + if m: + L.append(m.group("sym")) + break + return L def split_documented(all, documented): """Split the list of all symbols into documented and undocumented @@ -70,8 +99,8 @@ def main(): headers = list_headers() documented = list_documented_items() - cmd = ("ctags -f - --file-scope=no --c-types=-mv " - "-Istaticforward -Istatichere " + cmd = ("ctags -f - --file-scope=no --c-types=dgpstux " + "-Istaticforward -Istatichere=static " + _spcjoin(headers)) fp = os.popen(cmd) L = []