summaryrefslogtreecommitdiffstats
path: root/Doc/tools
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-05-01 17:25:04 (GMT)
committerFred Drake <fdrake@acm.org>2002-05-01 17:25:04 (GMT)
commit56aa6280f6d6b6813bfba0dc1d56987d4c2fb336 (patch)
treea1e9e37879955c5613cfc401415bc2dd5217749a /Doc/tools
parenta65375c3e35b150e764658532923cb36a85d3e9e (diff)
downloadcpython-56aa6280f6d6b6813bfba0dc1d56987d4c2fb336.zip
cpython-56aa6280f6d6b6813bfba0dc1d56987d4c2fb336.tar.gz
cpython-56aa6280f6d6b6813bfba0dc1d56987d4c2fb336.tar.bz2
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. ;-(
Diffstat (limited to 'Doc/tools')
-rwxr-xr-xDoc/tools/findcsyms37
1 files changed, 33 insertions, 4 deletions
diff --git a/Doc/tools/findcsyms b/Doc/tools/findcsyms
index cffc237..ac9b754 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<sym>[^{]*)\}"),
+ matcher(r"\\cfuncline\{[^{]*\}\{(?P<sym>[^{]*)\}"),
+ matcher(r"\\begin\{ctypedesc\}(\[[^{]*\])?\{(?P<sym>[^{]*)\}"),
+ matcher(r"\\begin\{cvardesc\}\{[^{]*\}\{(?P<sym>[^{]*)\}"),
+ matcher(r"\\begin\{cmemberdesc\}\{[^{]*\}\{(?P<sym>[^{]*)\}"),
+ matcher(r"\\cmemberline\{[^{]*\}\{(?P<sym>[^{]*)\}"),
+ matcher(r"\\begin\{csimplemacrodesc\}\{(?P<sym>[^{]*)\}"),
+ ]
+
+
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 = []