Skip to content

docs: Refactor, enhance and uniformize ogsf docstrings #6130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 29, 2025

Conversation

echoix
Copy link
Member

@echoix echoix commented Jul 28, 2025

All of this started by my wanting to know what the "color value" int was, and if the color of gvstyle was referring to the same concept. So I dug a bit, and ended up making the information available rendered in doxygen, or injected new knowledge into the docstrings.

First, there's the file lib/ogsf/gsdrape.c and lib/ogsf/gs_util.c that I went and interpreted the code to add the parameter directions [in], [out], or [in,out]. Since it was like a sudoku, the related functions had to be annotated too, when known, in order to fill out more.

For lib/ogsf/gs_util.c, I also interpreted the code to indicate if the arrays were for 2D vectors or 3D vectors.

For lib/ogsf/gsd_objs.c, the main part of the work of this PR, I completely refactored the docs, making them uniform. I started out with AI to rewrite one single docstring, then completly overhauled it by the end when adapting it for each of the functions. I also asked Copilot for the docs of one function that wasn't documented and hard to understand, then I rewrote 80%+ of it to tune and enhance it. I was surprised by how close it got.

Finally, for include/grass/ogsf.h, I formatted the docstrings of the typedef's fields so that they:

  1. appear in the Doxygen docs.
  2. Short info shows up in the summary table before the longer docs below
  3. Are correctly parsed even by IDEs, and less ambiguous.

That third goal is why, after many trials and errors, opted for using /** @brief bla bla bla */ above the member to document, more standard and used by other tools, rather than a doxygen-specific advanced syntax that would allow attaching a documentation comment to a code preceding it, rather than following it. Being able to hover around when coding is almost as important and useful to me, as firing up the developper's documentation online to find the same info.

Lots of screenshots!

For example:
Before:
image

After:
image

Before:
image
image

After:
image
image

Before & after:
image
image
image
image

echoix added 4 commits July 28, 2025 01:28
…oxygen rendering and also correct parsing inside IDEs.

Adding `@brief` makes that text visible in the summary table place near the begining, instead of only below in the docs for that field.
Only using `/** foo bar */` shows up in the docs for that field below, but not near the begining.
@echoix echoix requested a review from petrasovaa July 28, 2025 02:08
@github-actions github-actions bot added C Related code is in C libraries labels Jul 28, 2025
@echoix echoix changed the title docs(lib/ogsf): Refactor, enhance and uniformize ogsf docstrings docs(ogsf): Refactor, enhance and uniformize ogsf docstrings Jul 28, 2025
@echoix echoix changed the title docs(ogsf): Refactor, enhance and uniformize ogsf docstrings docs: Refactor, enhance and uniformize ogsf docstrings Jul 28, 2025
Copy link
Contributor

@petrasovaa petrasovaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@echoix echoix enabled auto-merge (squash) July 29, 2025 11:49
@echoix echoix merged commit 7469244 into OSGeo:main Jul 29, 2025
27 checks passed
@echoix echoix deleted the doxygen-docs-fix-07-ogsf branch July 29, 2025 11:57
@github-actions github-actions bot added this to the 8.5.0 milestone Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants