Skip to content

introduction of macroArg command#1481

Open
mhantsch wants to merge 160 commits intoUltimateHackingKeyboard:masterfrom
mhantsch:master
Open

introduction of macroArg command#1481
mhantsch wants to merge 160 commits intoUltimateHackingKeyboard:masterfrom
mhantsch:master

Conversation

@mhantsch
Copy link
Copy Markdown
Contributor

@mhantsch mhantsch commented Feb 6, 2026

macroArg declaration command, introduction of argument types, parsing of $macroArg.name and $macroArg.number, processing of $macroArg values for typed values of int, float, bool, string, keyid and (modded) scancode (=shortcut), in addition to backwards-compatible behaviour for any type.

&macroArg syntax is left unmodified by this PR.

The PR also contains some cleanup / refactoring (mainly in str_utils) but also a few other places to improve consistent code style and ensure consistent safety checks of context bounds.

User manual and reference docs have been updated as well.

kareltucek and others added 30 commits January 29, 2026 15:02
…eyboard/fix/gperf-arg-expansion

Fix gperf token vs argument expansion bug.
Maximilian Hantsch and others added 3 commits March 4, 2026 17:27
…ut already.

Also, moving additional bit into existing bitfield in macro_state_t to avoid additional alignment bytes to next 4-aligned boundary.
@mhantsch mhantsch marked this pull request as ready for review March 5, 2026 08:36
mhantsch and others added 22 commits March 5, 2026 11:23
Merge branch 'UltimateHackingKeyboard:master' into macroArgs-declarations
improved safety of context boundary check
//skip labels
ConsumeAnyToken(ctx);
if (ctx->at == ctx->end && IsEnd(ctx)) {
// TODO: why not just IsEnd() in this condition?
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Much faster.

Copy link
Copy Markdown
Collaborator

@kareltucek kareltucek left a comment

Choose a reason for hiding this comment

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

Just a quick peek and some replies to some questions.

I am generally missing documentation, but we can talk about all that I guess.


macro_result_t Macros_ProcessSetLedTxtCommand(parser_context_t* ctx)
{
// TODO: I guess ATTR_UNUSED is not correct here?
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Indeed probably no longer needed.

const char* end1 = IdentifierEnd(ctx);
const lookup_record_t* record = lookup(0, lookup_size-1, ctx->at, end1);

// TODO: WHY this second attempt with dot??
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Because there are abbreviations like rightModule.leftButton.

}

CTX_COPY(bakCtx, *ctx);
// TODO: Is this needed at all? Looks like something left over
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Probably left over, yes.

{
// TODO: would there be any way to trace the current position down the
// context stack and report it here?
Macros_ReportErrorNum("Unexpected variable type:", type, NULL);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You mean the expansion stack? That should be reported automatically.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I mean, if the context is provided. Migrate it to a more modern Macros_Report.* format that takes ctx pointer.

} string_type_t;
// new code:

static char consumeExpressionCharOfInt(const macro_variable_t* variable, uint16_t* idx);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do I understand correctly that you have here just copied the code so that you have an original reference for coding?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants