diff --git a/doc/scripts/findlua.py b/doc/scripts/findlua.py new file mode 100755 index 000000000..72650ffff --- /dev/null +++ b/doc/scripts/findlua.py @@ -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 + diff --git a/doc/scripts/showindex.py b/doc/scripts/showindex.py new file mode 100755 index 000000000..6c3d1639e --- /dev/null +++ b/doc/scripts/showindex.py @@ -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