Commits

mcc committed dfe9646

Doxygen: More arg description

  • Participants
  • Parent commits 55755c7

Comments (0)

Files changed (1)

File package/make_doxygen.py

 	tfile = open(filename, "w")
 	tfile.write(str)
 	tfile.close()
-	
+
+class Arg:
+	def __init__(self):
+		self.name = None
+		self.type = None
+		self.default = None
+		self.description = None
+
 class Meth:
 	def __init__(self):
 		self.name = None
 		self.args = []
-		self.argdesc = {}
 		self.description = None
 		self.poison = False
 	
 			m.description = descriptionUnder(member, "briefdescription")
 			m.poison = m.name.startswith("~") or m.name.startswith("operator")
 			for arg in findChild(member, "declname"): # Safe?
-				m.args += [mashText(arg).strip()]
+				a = Arg()
+				a.name = mashText(arg).strip()
+				try:
+					a.type = mashText(findChild(arg.parentNode, "type", False).next())
+				except StopIteration:
+					pass
+				try:
+					a.default = mashText(findChild(arg.parentNode, "defval", False).next())
+				except StopIteration:
+					pass
+				m.args += [a]
 			for ddesc in findChild(member, "detaileddescription", False):
 				for item in findChild(ddesc, "parameteritem"):
 					try:
 						argname = mashText(findChild(item, "parametername").next()).strip()
 						argdescription = mashText(findChild(item, "parameterdescription").next()).strip()
-						m.argdesc[argname] = argdescription
+						for a in m.args:
+							if a.name == argname:
+								a.description = argdescription
 					except StopIteration:
 						pass
 			if m.name not in o.methods:
 				print mfile
 				mstr = ""
 				mstr += "%s:%s(" % (o.name, _m)
-				mstr += ", ".join(m.args)
+				mstr += ", ".join([a.name for a in m.args])
 				mstr += ")\n";
 				if m.description:
 					mstr += "%s\n" % m.description
 				if m.args:
 					mstr += "\nArguments:"
 					for arg in m.args:
-						mstr += "\n\t%s" % arg
-						if arg in m.argdesc:
-							mstr += "\n%s" % m.argdesc[arg]
+						mstr += "\n\t"
+						if arg.type:
+							mstr += "%s " % arg.type
+						mstr += "%s" % arg.name
+						if arg.default:
+							mstr += " (optional; default %s)" % arg.default
+						if arg.description:
+							mstr += "\n%s" % arg.description
 				dump(mfile, mstr)
 
 dump(path_for([base, "classes.txt"]), "Known classes: %s" % ", ".join(savedobj))