Add a MU_TRANSLATE_ENUM to define translations between related but different enums
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
No file or test is named. Start by locating the existing MU_DEFINE_ENUM implementation and its usage patterns, then determine how a translation macro can generate the shown function and handle unknown values. Done means related enum values translate as specified, with the declared default used for unmapped values.
Written by the indexing model from the issue text.
Description
for example,
#define MODULE_A_STATUS_VALUES \
MODULE_A_OK, \
MODULE_A_FAILED, \
MODULE_A_SPECIFIC_FAILURE
MU_DEFINE_ENUM(MODULE_A_STATUS, MODULE_A_STATUS_VALUES);
#define MODULE_B_STATUS_VALUES \
MODULE_B_FAILED, \
MODULE_B_OK, \
MODULE_B_CANCELED
MU_DEFINE_ENUM(MODULE_B_STATUS, MODULE_B_STATUS_VALUES);
May want to translate between MODULE_A_STATUS and MODULE_B_STATUS
// generates MODULE_A_STATUS_translate_to_MODULE_B_STATUS
MU_DEFINE_ENUM_TRANSLATION(
MODULE_A_STATUS /*from*/, MODULE_B_STATUS /*to*/, MODULE_B_FAILED /*default for unknown values*/,
MODULE_A_OK, MODULE_B_OK,
MODULE_A_FAILED, MODULE_B_FAILED,
MODULE_A_SPECIFIC_FAILURE, MODULE_B_FAILED);
MODULE_B_STATUS do_module_a_work(void)
{
MODULE_A_STATUS result = foo();
MODULE_B_STATUS converted = MODULE_A_STATUS_translate_to_MODULE_B_STATUS(result);
return converted;
}
- Dominant language
- C
- Stars
- 8
- Forks
- 17
- Avg merge
- 31m
- Merged PRs (30d)
- 5
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Azure/macro-utils-c
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
Azure/macro-utils-c#216 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 58/100
Azure/macro-utils-c#152 ·
-
MU_ENUM_VALUE_COUNT is misleadingMay be free again @dcristoloveanu claimed this 2556 days ago, and no pull request is open. Open
Azure/macro-utils-c#31 · 1 assignee ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Azure/macro-utils-c#28 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Azure/macro-utils-c#27 ·
All issues in Azure/macro-utils-c
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
test/command failure with filtered `listxattr` syscallPossibly taken @Kiskae claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100