Trig functions moved to smlua_math_utils.c for autodoc and macros reused for relevant functions #345
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is more of a suggestion than a finalized ultra-professional implementation.
As it currently stands sins(), coss(), and atan2s() are all functions exposed to the game's Lua API. Despite this, they are ignored by the autogen for documentation as the macros are declared as explicit lua functions in smlua_functions.c. Normally, for a few functions this would be okay (still not ideal) however, smlua_math_utils.c already features re-definitions (as functions) for the min, max, and sqr macros from math_util.h.
This PR seeks to unify these two clashing ideas by integrating the macros into smlua_math_utils.c by creating functional wrappers for all relevant macros which are friendly with the autodoc generation. This prevents the copying of already written code while also allowing for the documentation to be properly generated for sins(), and coss(). In addition to this, atan2s() was allowed in the autogen script to be included in the function documentation as its already exposed due to its prototype (and thus does not need an explicit declaration in smlua_functions.c).
I would love suggestions for a better implementation and am willing to contribute and fix any issues with this solution.