From 37ea5ecd404e45c0d636972f7aecc8a8b083ec00 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 8 Nov 2026 07:11:36 +0000 Subject: [PATCH] Docs: add an API reference made by Doxygen The docs workflow installs Doxygen, and the MkDocs hook runs it after the site is built, writing the reference to api/ with the site's colors and logo. The nav links to it. Signed-off-by: Claude Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01B82eRTLG3jxEW8av9GuXpG --- .docs/.gitignore | 1 + .docs/Doxyfile | 9 ++++++ .docs/Doxyfile.base | 55 +++++++++++++++++++++++++++++++++++++ .docs/base.yml | 2 ++ .docs/hooks.py | 25 +++++++++++++++++ .github/workflows/docs.yml | 1 + docs/assets/logo-48.png | Bin 0 -> 2004 bytes mkdocs.yml | 2 ++ 8 files changed, 95 insertions(+) create mode 100644 .docs/.gitignore create mode 100644 .docs/Doxyfile create mode 100644 .docs/Doxyfile.base create mode 100644 docs/assets/logo-48.png diff --git a/.docs/.gitignore b/.docs/.gitignore new file mode 100644 index 0000000..c18dd8d --- /dev/null +++ b/.docs/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/.docs/Doxyfile b/.docs/Doxyfile new file mode 100644 index 0000000..34d6f35 --- /dev/null +++ b/.docs/Doxyfile @@ -0,0 +1,9 @@ +# The API reference of the documentation site (api/), run by .docs/hooks.py +# from the repository's root after `mkdocs build`. +@INCLUDE = .docs/Doxyfile.base +PROJECT_NAME = "Atari SDK" +PROJECT_BRIEF = "osbind, GEM AES and VDI, and Native Features" +INPUT = include \ + gem +FILE_PATTERNS = *.h *.c +OPTIMIZE_OUTPUT_FOR_C = YES diff --git a/.docs/Doxyfile.base b/.docs/Doxyfile.base new file mode 100644 index 0000000..e5ecb16 --- /dev/null +++ b/.docs/Doxyfile.base @@ -0,0 +1,55 @@ +# Doxygen settings shared by the clang-retro sites' API references. +# Each repository's .docs/Doxyfile includes this one and sets PROJECT_NAME, +# INPUT and the rest; .docs/hooks.py runs it after `mkdocs build` and puts +# the HTML in /api/. + +OUTPUT_DIRECTORY = $(RETRO_API_OUT) +HTML_OUTPUT = api +CREATE_SUBDIRS = NO +GENERATE_HTML = YES +GENERATE_LATEX = NO +GENERATE_TREEVIEW = YES +SEARCHENGINE = YES +SERVER_BASED_SEARCH = NO +QUIET = YES +WARNINGS = NO +WARN_IF_UNDOCUMENTED = NO +WARN_IF_DOC_ERROR = NO +WARN_NO_PARAMDOC = NO + +RECURSIVE = YES +EXTRACT_ALL = YES +EXTRACT_STATIC = YES +EXTRACT_PRIVATE = NO +EXTRACT_LOCAL_CLASSES = YES +SOURCE_BROWSER = YES +STRIP_CODE_COMMENTS = NO +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +VERBATIM_HEADERS = YES +JAVADOC_AUTOBRIEF = YES +QT_AUTOBRIEF = YES +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = $(RETRO_ROOT) +STRIP_FROM_INC_PATH = $(RETRO_ROOT) +SORT_MEMBER_DOCS = NO +HAVE_DOT = NO +EXCLUDE_PATTERNS = */tests/* */test/* */examples/* */demos/* */site/* + +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +# The 16-bit and Toolbox keywords, so declarations parse as plain C. +PREDEFINED = __far= __near= __huge= _far= _near= _huge= \ + __pascal= _pascal= __export= _export= \ + __loadds= _loadds= __interrupt= _interrupt= \ + __cdecl= _cdecl= __stdcall= __attribute__(x)= \ + __declspec(x)= pascal= DOXYGEN + +HTML_COLORSTYLE = TOGGLE +HTML_COLORSTYLE_HUE = 135 +HTML_COLORSTYLE_SAT = 120 +HTML_COLORSTYLE_GAMMA = 90 +HTML_DYNAMIC_SECTIONS = YES +PROJECT_LOGO = $(RETRO_DOCS)/assets/logo-48.png diff --git a/.docs/base.yml b/.docs/base.yml index 6be945a..e235ac1 100644 --- a/.docs/base.yml +++ b/.docs/base.yml @@ -68,6 +68,8 @@ markdown_extensions: validation: nav: omitted_files: info + # The API reference (api/) is made by doxygen after the site. + not_found: info links: not_found: warn anchors: info diff --git a/.docs/hooks.py b/.docs/hooks.py index f4f60fb..beda228 100644 --- a/.docs/hooks.py +++ b/.docs/hooks.py @@ -28,10 +28,16 @@ # branch: main # pages: repository files shown as site pages # README.md: index.md +# doxygen: .docs/Doxyfile an API reference built into /api/ +# after the site (from the root; needs +# doxygen, else it is left out with a note) +import logging import os import posixpath import re +import shutil +import subprocess from mkdocs.exceptions import PluginError @@ -41,6 +47,7 @@ _HEADING = re.compile(r'^(#{1,6})\s+(.*?)\s*#*\s*$') _LINK = re.compile(r'(!?)\[((?:[^\[\]]|\[[^\]]*\])*)\]\(\s*]+)>?(\s+"[^"]*")?\s*\)') _settings = {} +log = logging.getLogger("mkdocs.hooks.retro") def on_config(config): @@ -177,3 +184,21 @@ def on_page_markdown(markdown, page, config, files): last = m.end() parts.append(_fix_links(markdown[last:], page_path, page_path)) return "".join(parts) + + +def on_post_build(config): + doxyfile = _settings.get("doxygen") + if not doxyfile: + return + if shutil.which("doxygen") is None: + log.info("doxygen is not installed: the API reference (api/) is left out") + return + env = dict(os.environ, + RETRO_API_OUT=os.path.abspath(config.site_dir), + RETRO_ROOT=_settings["root"], + RETRO_DOCS=os.path.abspath(config.docs_dir)) + result = subprocess.run(["doxygen", doxyfile], cwd=_settings["root"], env=env, + capture_output=True, text=True) + if result.returncode != 0: + raise PluginError(f"doxygen {doxyfile} failed:\n{result.stderr}") + log.info("API reference written to %s", os.path.join(config.site_dir, "api")) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4ab7a27..41e46f6 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -36,6 +36,7 @@ jobs: python-version: '3.12' cache: pip cache-dependency-path: .docs/requirements.txt + - run: sudo apt-get install -y --no-install-recommends doxygen - run: pip install -r .docs/requirements.txt - run: mkdocs build --strict - name: Is GitHub Pages on? diff --git a/docs/assets/logo-48.png b/docs/assets/logo-48.png new file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