other minor tweaks - doc generation should still be broken
[plcapi.git] / doc / DocBookLocal.py
old mode 100644 (file)
new mode 100755 (executable)
index a01ad6c..2bed21a
@@ -1,8 +1,27 @@
+#!/usr/bin/env python
 
 from PLC.API import PLCAPI
+from PLC.Faults import PLCInvalidAPIMethod
+from DocBook import DocBook
+import sys
 
-def get_func_list(methods = None):
-       api = PLCAPI(None)
-       if not methods:
-           methods = api.methods
-       return [api.callable(method) for method in methods]
+api = PLCAPI(None)
+methods = api.all_methods
+methods.sort()
+good_apis = []
+bad_apis = []
+for method in methods:
+    try:
+        good_api = api.callable(method)
+        good_apis.append(good_api)
+    except PLCInvalidAPIMethod as exc:
+        bad_apis.append((method, exc))
+
+DocBook(good_apis).Process()
+
+if bad_apis:
+    sys.stderr.write("UNEXPECTED: There are %d non-callable methods:\n"
+                     % (len(bad_apis)))
+    for method, exc in bad_apis:
+        sys.stderr.write("\tmethod=<%s> exc=%s\n" % (method, exc))
+    sys.exit(-1)