diff --git a/direct/src/directscripts/gendocs.py b/direct/src/directscripts/gendocs.py
index a531dd4ff5..fbf0206378 100644
--- a/direct/src/directscripts/gendocs.py
+++ b/direct/src/directscripts/gendocs.py
@@ -1,13 +1,47 @@
########################################################################
#
-# Documentation generator for panda. There are three
-# major subsystems:
+# Documentation generator for panda.
#
-# * The module that reads interrogate databases.
+# How to use this module:
#
-# * The module that reads python source-files.
+# from direct.directscripts import gendocs
+# gendocs.generate(version, indir, directdir, docdir, header, footer, urlprefix, urlsuffix)
#
-# *
+# - version is the panda version number
+#
+# - indir is the name of a directory containing the "xxx.in"
+# files that interrogate generates. No slash at end.
+#
+# - directdir is the name of a directory containing the
+# source code for "direct." No slash at end.
+#
+# - docdir is the name of a directory into which HTML files
+# will be emitted. No slash at end.
+#
+# - header is a string that will be placed at the front of
+# every HTML page.
+#
+# - footer is a string that will be placed at the end of
+# every HTML page.
+#
+# - urlprefix is a string that will be appended to the front of
+# every URL.
+#
+# - urlsuffix is a string that will be appended to the end of
+# every URL.
+#
+########################################################################
+#
+# The major subsystems are:
+#
+# * The module that loads interrogate databases.
+#
+# * The module that loads python parse-trees.
+#
+# * The "code database", which provides a single access point
+# for both interrogate databases and python parse trees.
+#
+# * The HTML generator.
#
########################################################################
@@ -75,8 +109,8 @@ def textToHTML(comment,sep,delsection=None):
total = total + sec + "
\n"
return total
-def linkToPage(page, text):
- return '' + text + ''
+def linkTo(link, text):
+ return '' + text + ''
def convertToPythonFn(fn):
result = ""
@@ -90,19 +124,6 @@ def convertToPythonFn(fn):
lastc = c
return result
-def getPandaVersion():
- try:
- f = file("dtool/PandaVersion.pp","r")
- pattern = re.compile('^[ \t]*[#][ \t]*define[ \t]+PANDA_VERSION[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)')
- for line in f:
- match = pattern.match(line,0)
- if (match):
- version = match.group(1)+"."+match.group(2)+"."+match.group(3)
- break
- f.close()
- except: sys.exit("Cannot read version number from dtool/PandaVersion.pp")
- return version
-
########################################################################
#
# Interrogate Database Tokenizer
@@ -611,24 +632,10 @@ CLASS_RENAME_DICT = {
########################################################################
#
-# Main Program
+# HTML generation
#
########################################################################
-def getCodeDatabase():
- ignore = {}
- ignore["__init__.py"] = 1
- ignore["direct/src/directscripts"] = 1
- ignore["direct/src/extensions"] = 1
- ignore["direct/src/extensions_native"] = 1
- ignore["direct/src/ffi"] = 1
- cxxfiles = []
- pyfiles = []
- findFiles("built/pandac/input", ".in", ignore, cxxfiles)
- findFiles("direct", ".py", ignore, pyfiles)
- return CodeDatabase(cxxfiles, pyfiles)
-
-
def generateFunctionDocs(code, method):
name = code.getFunctionName(method)
proto = code.getFunctionPrototype(method)
@@ -641,8 +648,33 @@ def generateFunctionDocs(code, method):
chunk = chunk + "\n"
return chunk
-def generateDocs(code):
- dir = "built/pandac/docs"
+def generateLinkTable(table, cols, urlprefix, urlsuffix):
+ table = table[:]
+ column = (len(table)+cols-1)/cols
+ percent = 100 / cols
+ for i in range(cols): table.append("")
+ result = '
| ' + linkTo(urlprefix+slot+urlsuffix,slot) + " | " + result = result + "