Skip to content

Simplify classifying ERFA function arguments in Argument.inout_state#255

Merged
avalentino merged 1 commit into
liberfa:mainfrom
eerovaher:args-classification
May 26, 2026
Merged

Simplify classifying ERFA function arguments in Argument.inout_state#255
avalentino merged 1 commit into
liberfa:mainfrom
eerovaher:args-classification

Conversation

@eerovaher

Copy link
Copy Markdown
Contributor

Some of the ERFA C function arguments are only read from (pyerfa calls these "in" arguments), others are only written to ("out" arguments) and some are both read from and written to ("inout" arguments). Because it is impossible to tell how an argument is used from a C function's declaration, the FunctionDoc class in erfa_generator has to parse the doc comments to perform the classification.

In two ERFA functions an argument is meant to be a struct with some fields that are only read from and others that are only written to. For pyerfa it is an "inout" argument, but the ERFA doc comments list it as both an "in" and an "out" argument, not as an "inout" argument. FunctionDoc has so far dealt with this by merging "inout" arguments with both "in" and "out" arguments and the Argument.inout_state property has to disentangle them. In this PR FunctionDoc keeps all three argument categories separate and the two unusual ERFA functions are handled explicitly. Most importantly their names are written down, which makes it much simpler to look up why there is a special case for them.

Some of the ERFA C function arguments are only read from (`pyerfa` calls
these "in" arguments), others are only written to ("out" arguments) and
some are both read from and written to ("inout" arguments). Because it
is impossible to tell how an argument is used from a C function's
declaration, the `FunctionDoc` class in `erfa_generator` has to parse
the doc comments to perform the classification.

In two ERFA functions an argument is meant to be a struct with some
fields that are only read from and others that are only written to. For
`pyerfa` it is an "inout" argument, but the ERFA doc comments list it as
both an "in" and an "out" argument, not as an "inout" argument.
`FunctionDoc` has so far dealt with this by merging "inout" arguments
with both "in" and "out" arguments and the `Argument.inout_state`
property has had to disentangle them. Now `FunctionDoc` keeps all three
argument categories separate and the two unusual ERFA functions are
handled explicitly. Most importantly their names are now written down,
which makes it much simpler to look up why there is a special case for
them.
@avalentino avalentino merged commit c6bd529 into liberfa:main May 26, 2026
28 checks passed
@eerovaher eerovaher deleted the args-classification branch May 26, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants