Documentation folder reorganization

This commit is contained in:
Serge Lamikhov-Center
2023-12-29 18:15:57 +02:00
parent 30b212d42c
commit 4814a41132
38 changed files with 173 additions and 394 deletions
+1
View File
@@ -173,6 +173,7 @@ autom4te.cache
doc/html
doc/xml
docs/_build
# =========================
# Misc
+2 -2
View File
@@ -7,7 +7,7 @@ build:
python:
install:
- requirements: doc/readthedocs/requirements.txt
- requirements: docs/requirements.txt
sphinx:
configuration: doc/readthedocs/conf.py
configuration: docs/conf.py
+20
View File
@@ -146,4 +146,24 @@ if(IS_TOP_PROJECT)
DESTINATION share/docs/${PROJECT_NAME})
include(CPack)
find_package(Doxygen)
if (DOXYGEN_FOUND)
# set input and output files
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.out)
# request to configure the file
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
message("Doxygen build started")
# Note: do not put "ALL" - this builds docs together with application EVERY TIME!
add_custom_target( docs
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM )
else (DOXYGEN_FOUND)
message("Doxygen need to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND)
endif()
-364
View File
@@ -1,364 +0,0 @@
# test documentation build configuration file, created by
# sphinx-quickstart on Sun Jun 26 00:00:43 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import sys, os, subprocess, re, glob
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
# 'sphinx.ext.todo',
# 'sphinx.ext.graphviz',
# 'breathe',
# 'recommonmark',
]
# Add any paths that contain templates here, relative to this directory.
# templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = {
# '.rst': 'restructuredtext',
# '.txt': 'markdown',
# '.md': 'markdown',
# }
# The encoding of source files.
#
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index_'
# General information about the project.
project = u'COFFI'
# copyright = u'2016, test'
# author = u'test'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
# version = u'test'
# The full version, including alpha/beta/rc tags.
# release = u'test'
# Get the version from ../../configure.ac
version = re.sub(r'[\s\S]*COFFI_VERSION.*?([\d\.]+)[\s\S]*', r'\1', open('../../coffi/coffi_version.hpp').read())
release = version
# Write the version to a doxygen configuration file
open('../version.doxyfile', 'w').write('PROJECT_NUMBER = "%s"\n' % version)
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#
# today = ''
#
# Else, today_fmt is used as the format for a strftime call.
#
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# These patterns also affect html_static_path and html_extra_path
# exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
# pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
# todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# html_theme = 'nature'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
# html_title = u'test vtest'
# A shorter title for the navigation bar. Default is the same as html_title.
#
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#
# html_logo = None
# The name of an image file (relative to this directory) to use as a favicon of
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ['../html']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
html_extra_path = ['../html']
# If not None, a 'Last updated on:' timestamp is inserted at every page
# bottom, using the given strftime format.
# The empty string is equivalent to '%b %d, %Y'.
#
# html_last_updated_fmt = None
# Custom sidebar templates, maps document names to template names.
#
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#
# html_additional_pages = {}
# If false, no module index is generated.
#
# html_domain_indices = True
# If false, no index is generated.
#
# html_use_index = True
# If true, the index is split into individual pages for each letter.
#
# html_split_index = False
# If true, links to the reST sources are added to the pages.
#
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
#
# html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# 'ja' uses this config value.
# 'zh' user can custom change `jieba` dictionary path.
#
# html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#
# html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'COFFI'
# -- Options for LaTeX output ---------------------------------------------
# latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
# }
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
# latex_documents = [
# (master_doc, 'test.tex', u'test Documentation',
# u'test', 'manual'),
# ]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#
# latex_logo = None
# If true, show page references after internal links.
#
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
#
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
#
# latex_appendices = []
# If false, no module index is generated.
#
# latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
# man_pages = [
# (master_doc, 'test', u'test Documentation',
# [author], 1)
# ]
# If true, show URL addresses after external links.
#
# man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
# texinfo_documents = [
# (master_doc, 'test', u'test Documentation',
# author, 'test', 'One line description of project.',
# 'Miscellaneous'),
# ]
# Documents to append as an appendix to all manuals.
#
# texinfo_appendices = []
# If false, no module index is generated.
#
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#
# texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#
# texinfo_no_detailmenu = False
# -- Options for breathe --------------------------------------------------
# breathe_projects = { 'COFFI': './xml' }
# breathe_default_project = 'COFFI'
def run_doxygen(app):
'''Run the doxygen command'''
try:
run_mod(app)
# Note: last time I checked, Read the Docs was running Doxygen version 1.8.13 (package version in ubuntu bionic)
retcode = subprocess.call('doxygen', shell = True, cwd = '..')
if retcode < 0:
sys.stderr.write('doxygen terminated by signal %s' % (-retcode))
except OSError as e:
sys.stderr.write('doxygen execution failed: %s' % e)
def run_mod(app):
'''Replace "replacebyfile" in the *.m_o_d files by the file contents'''
for mod in glob.glob('../*.m_o_d'):
txt = open(mod).read()
for include in re.findall(r'^[ \t]*replacebyfile[ \t]+.*$', txt, re.MULTILINE):
include_file = re.sub(r'[ \t]*replacebyfile[ \t]+(.*?)[ \t]*', r'\1', include)
repl = open(os.path.join(os.path.dirname(mod), include_file)).read()
txt = txt.replace(include, repl)
md = mod.replace('.m_o_d', '.md')
headerline = '<!-- This file is generated from %s by the script conf.py, DO NOT MODIFY! -->' % mod.replace('\\', '/')
txt = re.sub(r'^(\s*[\\\\@](?:main)?page .*$)', r'\1\n' + headerline, txt, flags = re.MULTILINE)
open(md, 'w').write(txt)
def setup(app):
# Add hook for building doxygen xml when needed
app.connect('builder-inited', run_doxygen)
View File
+25 -25
View File
@@ -38,7 +38,7 @@ PROJECT_NAME = COFFI
# could be handy for archiving the generated documentation or if some version
# control system is used.
@INCLUDE = version.doxyfile
@INCLUDE = ../docs/version.doxyfile
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
@@ -58,7 +58,7 @@ PROJECT_LOGO =
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
OUTPUT_DIRECTORY = .
OUTPUT_DIRECTORY = _build
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
@@ -866,12 +866,12 @@ WARN_LOGFILE =
# Note: If this tag is empty the current directory is searched.
INPUT = ../coffi \
mainpage.md \
copying.md \
get_started.md \
examples.md \
extdoc.md \
api.md
../docs/mainpage.md \
../docs/copying.md \
../docs/get_started.md \
../docs/examples.md \
../docs/extdoc.md \
../docs/api.md
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -993,7 +993,7 @@ EXCLUDE_SYMBOLS = build_info
# command).
EXAMPLE_PATH = ../examples \
static
../docs/static
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
@@ -1013,7 +1013,7 @@ EXAMPLE_RECURSIVE = NO
# that contain images that are to be included in the documentation (see the
# \image command).
IMAGE_PATH = static
IMAGE_PATH = ../docs/static
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
@@ -1069,7 +1069,7 @@ FILTER_SOURCE_PATTERNS =
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.
USE_MDFILE_AS_MAINPAGE = mainpage.md
USE_MDFILE_AS_MAINPAGE = ../docs/mainpage.md
#---------------------------------------------------------------------------
# Configuration options related to source browsing
@@ -1256,7 +1256,7 @@ HTML_FILE_EXTENSION = .html
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_HEADER = static/header.html
HTML_HEADER = ../docs/static/header.html
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
@@ -1266,7 +1266,7 @@ HTML_HEADER = static/header.html
# that doxygen normally uses.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FOOTER = static/footer.html
HTML_FOOTER = ../docs/static/footer.html
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
# sheet that is used by each HTML page. It can be used to fine-tune the look of
@@ -1291,7 +1291,7 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_STYLESHEET = static/custom.css
HTML_EXTRA_STYLESHEET = ../docs/static/custom.css
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@@ -1301,16 +1301,16 @@ HTML_EXTRA_STYLESHEET = static/custom.css
# files will be copied as-is; there are no commands or markers available.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_FILES = pecoff_v11.pdf \
peering_inside_pe.pdf \
pe_checksum_algorithm.pdf \
pe_format_in_depth_look_part1.pdf \
pe_format_in_depth_look_part2.pdf \
spraao8.pdf \
static/hello.png \
static/github.png \
static/readthedocs.png \
static/sourceforge.png
HTML_EXTRA_FILES = ../docs/external/pecoff_v11.pdf \
../docs/external/peering_inside_pe.pdf \
../docs/external/pe_checksum_algorithm.pdf \
../docs/external/pe_format_in_depth_look_part1.pdf \
../docs/external/pe_format_in_depth_look_part2.pdf \
../docs/external/spraao8.pdf \
../docs/static/hello.png \
../docs/static/github.png \
../docs/static/readthedocs.png \
../docs/static/sourceforge.png
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
@@ -2111,7 +2111,7 @@ MAN_LINKS = NO
# captures the structure of the code including all documentation.
# The default value is: NO.
GENERATE_XML = NO
GENERATE_XML = YES
# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+20
View File
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
View File
+60
View File
@@ -0,0 +1,60 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import sys, os, subprocess, re, glob
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'COFFI'
version = re.sub(r'[\s\S]*COFFI_VERSION.*?([\d\.]+)[\s\S]*', r'\1', open('../coffi/coffi_version.hpp').read())
release = version
language = 'en'
open('../version.doxyfile', 'w').write('PROJECT_NUMBER = "%s"\n' % version)
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = []
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
master_doc = 'index_'
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'alabaster'
html_static_path = ['static']
def run_doxygen(app):
'''Run the doxygen command'''
try:
run_mod(app)
retcode = subprocess.call('doxygen Doxyfile.in', shell = True, cwd = '.')
if retcode < 0:
sys.stderr.write('doxygen terminated by signal %s' % (-retcode))
except OSError as e:
sys.stderr.write('doxygen execution failed: %s' % e)
def run_mod(app):
'''Replace "replacebyfile" in the *.m_o_d files by the file contents'''
for mod in glob.glob('*.m_o_d'):
txt = open(mod).read()
for include in re.findall(r'^[ \t]*replacebyfile[ \t]+.*$', txt, re.MULTILINE):
include_file = re.sub(r'[ \t]*replacebyfile[ \t]+(.*?)[ \t]*', r'\1', include)
repl = open(os.path.join(os.path.dirname(mod), include_file)).read()
txt = txt.replace(include, repl)
md = mod.replace('.m_o_d', '.md')
headerline = '<!-- This file is generated from %s by the script conf.py, DO NOT MODIFY! -->' % mod.replace('\\', '/')
txt = re.sub(r'^(\s*[\\\\@](?:main)?page .*$)', r'\1\n' + headerline, txt, flags = re.MULTILINE)
open(md, 'w').write(txt)
def setup(app):
# Add hook for building doxygen xml when needed
app.connect('builder-inited', run_doxygen)
+1 -1
View File
@@ -1,5 +1,5 @@
@page copying License
<!-- This file is generated from ../copying.m_o_d by the script conf.py, DO NOT MODIFY! -->
<!-- This file is generated from copying.m_o_d by the script conf.py, DO NOT MODIFY! -->
<!-- This file is transformed into a *.md file by the conf.py script -->
+1 -1
View File
@@ -15,7 +15,7 @@ This page presents some useful external documentation sources, especially specif
- [An In-Depth Look into the Win32 PE File Format, Part 1](https://bytepointer.com/resources/pietrek_in_depth_look_into_pe_format_pt2.htm) \[[cached PDF version](pe_format_in_depth_look_part2.pdf)\]
- [The PE Checksum Algorithm](https://bytepointer.com/resources/microsoft_pe_checksum_algo_distilled.htm) \[[cached PDF version](pe_checksum_algorithm.pdf)\]
- [The `BYTE*` resources](https://bytepointer.com/resources/index.htm)
- [Tiny PE](http://www.phreedom.org/research/tinype/)\[[cached HTML version](Tiny%20PE.html)]]
- [Tiny PE](http://www.phreedom.org/research/tinype/) \[[cached HTML version](Tiny%20PE.html)]]
@section extdoc_ti The Texas Instruments COFF format
View File
View File
+1 -1
View File
@@ -1,5 +1,5 @@
@mainpage COFFI - Tutorial and User Manual
<!-- This file is generated from ../mainpage.m_o_d by the script conf.py, DO NOT MODIFY! -->
<!-- This file is generated from mainpage.m_o_d by the script conf.py, DO NOT MODIFY! -->
<!-- This file is transformed into a *.md file by the conf.py script -->
+35
View File
@@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)
if "%1" == "" goto help
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd
View File
View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 477 B

After

Width:  |  Height:  |  Size: 477 B

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

+6
View File
@@ -0,0 +1,6 @@
- Thanks to Oliver Schneider who implemented the writer part of the COFFI library. He also wrote the most part of the documentation
- Thanks to Oliver K. Ernst, who is providing step by step instructions for building Doxygen and Sphinx documents
https://medium.com/@oliver.k.ernst/c-documentation-with-doxygen-cmake-sphinx-breathe-for-those-of-use-who-are-totally-lost-7d555386fe13
https://medium.com/@oliver.k.ernst/c-documentation-with-doxygen-cmake-sphinx-breathe-for-those-of-use-who-are-totally-lost-part-2-21f4fb1abd9f
https://medium.com/@oliver.k.ernst/c-documentation-with-doxygen-cmake-sphinx-breathe-for-those-of-use-who-are-totally-lost-part-3-d20549d3b01f
+1
View File
@@ -0,0 +1 @@
PROJECT_NUMBER = "1.2"