Added functions to search for things that are missing in the docs, or that
are no longer in the code
This commit is contained in:
parent
306507e550
commit
191607dbe4
2 changed files with 66 additions and 0 deletions
doc/scripts
47
doc/scripts/findlua.py
Executable file
47
doc/scripts/findlua.py
Executable file
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env python
|
||||
"Output all lua functions defined in the Stratagus source code."
|
||||
|
||||
import os
|
||||
import os, sys
|
||||
from stat import *
|
||||
|
||||
# where to find the other stratagus tools
|
||||
toolpath = os.path.dirname(sys.argv[0]) + '/'
|
||||
|
||||
def walktree(top, callback):
|
||||
'''recursively descend the directory tree rooted at top,
|
||||
calling the callback function for each regular file'''
|
||||
|
||||
for f in os.listdir(top):
|
||||
pathname = os.path.join(top, f)
|
||||
mode = os.stat(pathname)[ST_MODE]
|
||||
if S_ISDIR(mode):
|
||||
# It's a directory, recurse into it
|
||||
walktree(pathname, callback)
|
||||
elif S_ISREG(mode):
|
||||
# It's a file, call the callback function
|
||||
callback(pathname)
|
||||
else:
|
||||
# Unknown file type, print a message
|
||||
print 'Skipping %s' % pathname
|
||||
|
||||
commands = []
|
||||
reffiles = {}
|
||||
|
||||
def visitfile(file):
|
||||
#print 'visiting', file
|
||||
if file.endswith('.c'):
|
||||
for line in open(file).read().split('\n'):
|
||||
if not line.startswith('//'):
|
||||
for part in line.split('lua_register(Lua, "')[1:]:
|
||||
command = part.split('"')[0]
|
||||
commands.append(command)
|
||||
reffiles[command] = file
|
||||
|
||||
if __name__ == '__main__':
|
||||
walktree(sys.argv[1], visitfile)
|
||||
|
||||
commands.sort()
|
||||
for command in commands:
|
||||
print command
|
||||
|
19
doc/scripts/showindex.py
Executable file
19
doc/scripts/showindex.py
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env python
|
||||
"Update the command index in ccl-index.html."
|
||||
|
||||
import os
|
||||
|
||||
commands = []
|
||||
reffiles = {}
|
||||
|
||||
for infile in os.listdir('.'):
|
||||
if not infile.endswith('.html'): continue
|
||||
for part in open(infile).read().split('<a name="')[1:]:
|
||||
command = part.split('"')[0]
|
||||
commands.append(command)
|
||||
reffiles[command] = infile
|
||||
|
||||
commands.sort()
|
||||
|
||||
for command in commands:
|
||||
print command
|
Loading…
Add table
Reference in a new issue