diff options
| author | Rusty Wagner <rusty@vector35.com> | 2017-02-10 16:42:12 -0500 |
|---|---|---|
| committer | Rusty Wagner <rusty@vector35.com> | 2017-02-10 16:42:12 -0500 |
| commit | 4b988c0d24c8d8c8dc67485f3aaeb7106eb4af18 (patch) | |
| tree | 2cd7242ff78a8f92cc268b2ccb7afc69734d9f6b /api-docs | |
| parent | 8c42dabe92340b4d342f3b4e7594fb70f1890e41 (diff) | |
| parent | f8687791c32688a78b5e6667b2af9689816e41af (diff) | |
Merge branch 'dev'
Diffstat (limited to 'api-docs')
| -rw-r--r-- | api-docs/Makefile | 3 | ||||
| -rw-r--r-- | api-docs/source/conf.py | 72 | ||||
| -rw-r--r-- | api-docs/source/old-index.rst (renamed from api-docs/source/index.rst) | 0 | ||||
| -rw-r--r-- | api-docs/source/python.rst | 73 |
4 files changed, 68 insertions, 80 deletions
diff --git a/api-docs/Makefile b/api-docs/Makefile index 4092950c..fe751410 100644 --- a/api-docs/Makefile +++ b/api-docs/Makefile @@ -6,6 +6,7 @@ SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = build +SOURCEDIR = source # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 @@ -47,6 +48,8 @@ help: .PHONY: clean clean: rm -rf $(BUILDDIR)/* + rm $(SOURCEDIR)/binaryninja.*.rst + rm $(SOURCEDIR)/python.rst .PHONY: html html: diff --git a/api-docs/source/conf.py b/api-docs/source/conf.py index ac6042b4..c87cb114 100644 --- a/api-docs/source/conf.py +++ b/api-docs/source/conf.py @@ -19,15 +19,73 @@ import os import sys import platform +import inspect if (platform.system() == "Darwin"): - bnpath=os.path.join(os.path.abspath('.'), "..", "..", "..", "ui", "binaryninja.app", "Contents", "Resources", "python") + bnpath=os.path.join(os.path.abspath('.'), "..", "..", "..", "ui", "binaryninja.app", "Contents", "Resources", "python") else: - bnpath=os.path.join(os.path.abspath('.'), "..", "..", "..", "ui", "python") + bnpath=os.path.join(os.path.abspath('.'), "..", "..", "..", "ui", "python") sys.path.insert(0, bnpath) import binaryninja +def modulelist(modulename): + modules = inspect.getmembers(modulename, inspect.ismodule) + return filter(lambda x: x[0] not in ("abc", "ctypes", "core", "struct", "sys", "_binaryninjacore", "traceback", "code", "enum", "json", "threading", "startup", "associateddatastore"), modules) + + +def classlist(module): + members = inspect.getmembers(module, inspect.isclass) + if module.__name__ != "binaryninja.enums": + members = filter(lambda x: type(x[1]) != binaryninja.enum.EnumMeta, members) + members.extend(inspect.getmembers(module, inspect.isfunction)) + return map(lambda x: x[0], filter(lambda x: not x[0].startswith("_"), members)) + + +def generaterst(): + pythonrst = open("index.rst", "w") + pythonrst.write('''Binary Ninja Python API Documentation +===================================== + +.. toctree:: + :maxdepth: 2 + +''') + + for modulename, module in modulelist(binaryninja): + filename = 'binaryninja.{module}-module.rst'.format(module=modulename) + pythonrst.write(' {module} <{filename}>\n'.format(module=modulename, filename=filename)) + modulefile = open(filename, "w") + modulefile.write('''{module} module +===================== + +.. autosummary:: + :toctree: + +'''.format(module=modulename)) + + for classname in classlist(module): + modulefile.write(" binaryninja.{module}.{classname}\n".format(module=modulename, classname=classname)) + + modulefile.write('''\n.. toctree:: + :maxdepth: 2\n''') + + modulefile.write('''\n\n.. automodule:: binaryninja.{module} + :members: + :undoc-members: + :show-inheritance:'''.format(module=modulename)) + modulefile.close() + + pythonrst.write('''.. automodule:: binaryninja + :members: + :undoc-members: + :show-inheritance: +''') + pythonrst.close() + + +generaterst() + # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. @@ -50,7 +108,7 @@ extensions = [ ] autosummary_generate = True -autodoc_member_order = 'groupwise' +#autodoc_member_order = 'groupwise' breathe_projects = { "BinaryNinja": "../../xml/" } breathe_projects_source = { @@ -72,7 +130,7 @@ source_suffix = '.rst' # source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'python' +master_doc = 'index' # General information about the project. project = u'Binary Ninja API' @@ -121,7 +179,7 @@ exclude_patterns = [] # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # -add_module_names = False +add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. @@ -211,7 +269,7 @@ html_static_path = ['_static'] # If false, no module index is generated. # -html_domain_indices = False +html_domain_indices = True # If false, no index is generated. # @@ -223,7 +281,7 @@ html_split_index = False # If true, links to the reST sources are added to the pages. # -html_show_sourcelink = False +html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # diff --git a/api-docs/source/index.rst b/api-docs/source/old-index.rst index 355d6901..355d6901 100644 --- a/api-docs/source/index.rst +++ b/api-docs/source/old-index.rst diff --git a/api-docs/source/python.rst b/api-docs/source/python.rst deleted file mode 100644 index 5e299535..00000000 --- a/api-docs/source/python.rst +++ /dev/null @@ -1,73 +0,0 @@ -Binary Ninja Python API Documentation -===================================== - -.. currentmodule:: binaryninja -.. autosummary:: - :toctree: - - AnalysisCompletionEvent - AnalysisProgress - Architecture - BasicBlock - BasicBlockEdge - BinaryDataNotification - BinaryDataNotificationCallbacks - BinaryReader - BinaryView - BinaryViewType - BinaryWriter - CallingConvention - CoreFileAccessor - DataBuffer - DataVariable - DisassemblySettings - DisassemblyTextLine - Enumeration - EnumerationMember - FileAccessor - Function - FunctionGraph - FunctionGraphBlock - FunctionGraphEdge - FunctionRecognizer - IndirectBranchInfo - InstructionBranch - InstructionInfo - InstructionTextToken - LinearDisassemblyLine - LinearDisassemblyPosition - LookupTableEntry - LowLevelILBasicBlock - LowLevelILExpr - LowLevelILFunction - LowLevelILInstruction - LowLevelILLabel - NavigationHandler - Platform - PluginCommand - PluginCommandContext - ReferenceSource - RegisterInfo - RegisterValue - StackVariable - StackVariableReference - StringReference - Structure - StructureMember - Symbol - Transform - TransformParameter - Type - TypeParserResult - UndoAction - UpdateChannel - UpdateProgressCallback - UpdateVersion - -.. toctree:: - :maxdepth: 2 - -.. automodule:: binaryninja - :members: - :undoc-members: - :show-inheritance: |
