Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Add a MU_TRANSLATE_ENUM to define translations between related but different enums

Open
#33 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
c
Domain
tooling

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure/macro-utils-c

All issues in Azure/macro-utils-c

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.