Skip to content

Add misc headerdocs#117

Open
sam-stajnko wants to merge 10 commits intothoth-tech:mainfrom
sam-stajnko:add_misc_headerdocs
Open

Add misc headerdocs#117
sam-stajnko wants to merge 10 commits intothoth-tech:mainfrom
sam-stajnko:add_misc_headerdocs

Conversation

@sam-stajnko
Copy link

Description

If you have ever looked at the header files (.h) in the core-sdk folder, you might've noticed the attribute tags above some of the function declarations. These are called 'HeaderDocs' attributes and they are used by the translator when the source code is translated from C++ into the different target languages such as Python, C# and Pascal. There are four different attributes that you should be aware of:

  • class: this is the class that you want to have the function as a method.
  • method: when the function is added to the class as a method, this will be the method name.
  • suffix: if multiple overloads exist for the function, this is used to distinguish them from one another.
  • self: when looking at the signature of the function, self is the parameter in the argument that you want to be the class.

Many functions in the Splashkit Core Library are missing attributes in the header documentation and therefore, the translator is failing to generate methods for the C# implementation. To fix this, I have searched through the repository for functions that are missing attributes in the header file and then added the attributes. This has been done for the following miscellaneous functions:

  • music_valid
  • message_connection
  • sound_effect_valid
  • update_animation
  • create_animation
  • has_animation_named
  • http_response_to_string
  • save_response_to_file

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as
    expected)
  • Documentation (update or new)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can
reproduce. Please also list any relevant details for your test configuration

To test this pull request, you can run the translator and check the generated C# source code and api.json. The file api.json lists the signatures of all generated functions so by looking for the functions where header documentation has been added, it should be easy to find out if they are being successfully added as methods to their relevant class.

If you don't want to run the translator, you don't have to. I have run the translator in one of my commits but I reverted the changes afterwards. Therefore, simply go through the commit history and find the one that is named "Generate Files".

As a word of caution, I don't think the generator has been run on the main repo for a while so there is probably a lot of generated material that isn't related to this pull request.

Testing Checklist

  • Tested by checking api.json after running translator
  • Tested by checking generated C# source code after running translator

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have requested a review from ... on the Pull Request

Copy link

@Oliver-Quail Oliver-Quail left a comment

Choose a reason for hiding this comment

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

Hi @sam-stajnko,

I have tested this locally and have no issues. I approve this PR

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Type of Change

This change is a bug fix to fix some issues with generating methods for c# does this by adding headers

Code Readability

The code is readable and clear especially when looked at with correct documentation to clarify what each header does.

Maintainability

The code improves maintainabilty by adding the missing headers for the methods making it in line with the other headerdocs

Code Simplicity

The code is fairly simple to understand it just follows the same principles of the other headerfiles

Edge Cases

this shouldn't have any edge cases as it just fixes some issues with generation of translations

Test Thoroughness

I tested this by building, running the unit tests and tests then running the translator to check that it worked which it did seem to.

Backward Compatibility

this shouldn't cause any issues with backward compatibility

Performance Considerations

this will cause generation to be longer just because it will be generating more not really an issue, its implemented as well as it can be

Security Concerns

No major security concerns from this

Dependencies

no new dependencies

Documentation

changes are well documented and clear with what they change in the header files

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