X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=blobdiff_plain;f=tools%2Fautodoc.py;fp=tools%2Fautodoc.py;h=e95f563a5bf2737e08026f2ae739efc69c9c9c34;hp=0000000000000000000000000000000000000000;hb=0400a5a6479398d82526785c18c0df8bc8b92dce;hpb=d17e10da972ce5776c60b4c317267c6abe0e1ead diff --git a/tools/autodoc.py b/tools/autodoc.py new file mode 100644 index 0000000..e95f563 --- /dev/null +++ b/tools/autodoc.py @@ -0,0 +1,70 @@ +# +# Structure AutoDocumentator for ircu. +# 26/02/2000 --Gte +# +# Creates a 'structs.html', containing HTML Table definitions +# for all structures encountered in *.h in the current directory. +# +# $Id: autodoc.py,v 1.1 2000-03-18 05:20:30 bleep Exp $ + +import string, fnmatch, os + +def parse(filename): + OutFile = open('structs.html', 'a') + OutFile.write("

"+filename+"

") + stage = 1 + try: + IncFile = open(filename, 'r') + line = IncFile.readline() + + while line != "": + line = string.replace(line,"\n","") # Stript out LF's. + splitline = string.split(line, " ") + try: + if ((stage == 2) & (splitline[0] == "};")): + OutFile.write("

"+"\n") + stage = 1 + if (stage == 2): + # Begin reading member information. + declr = string.split(string.strip(line), ";", 1) + comment = string.replace(declr[1], "*", "") + comment = string.replace(comment, "/", "") + + OutFile.write("\n") + OutFile.write(""+string.strip(declr[0])+"\n") + if (declr[1][-1] == "/"): + OutFile.write(""+string.strip(comment)+"\n") + else: + # Loop until end of comment string. + while (declr[-1] != "/"): + line = IncFile.readline() + line = string.replace(line,"\n","") # Stript out LF's. + declr = string.strip(line) + comment = comment + line + comment = string.replace(comment, "*", "") + comment = string.replace(comment, "/", "") + OutFile.write(""+string.strip(comment)+"\n") + OutFile.write("\n") + + if ((splitline[0] == "struct") & (splitline[2] == "{") & (stage == 1)): + # We've found a "Standard" structure definition. + OutFile.write("Structure table for: \""+splitline[1]+"\"

\n") + OutFile.write("") + # Now, carry on until we encounter a "};". + stage = 2 + except IndexError: + pass + line = IncFile.readline() + + IncFile.close + OutFile.write("
") + + except IOError: + print("** Error, File does not exist.") + OutFile.close + +files = os.listdir(".") +files.sort() +for file in files: + if (fnmatch.fnmatch(file, "*.h")): + parse(file)
VariableDescription