MCPcopy Index your code
hub / github.com/GJDuck/e9patch / makeMacroEntry

Function makeMacroEntry

src/e9patch/e9json.cpp:599–650  ·  view source on GitHub ↗

* Create a MACRO template entry. */

Source from the content-addressed store, hash-verified

597 * Create a MACRO template entry.
598 */
599static Entry makeMacroEntry(const char *macro)
600{
601 Entry entry;
602 entry.kind = ENTRY_MACRO;
603 entry.length = 0;
604 entry.macro = nullptr;
605
606 // Check for built-in macros:
607 switch (macro[1])
608 {
609 case 'B':
610 if (strcmp(macro, "$BREAK") == 0)
611 {
612 entry.kind = ENTRY_BREAK;
613 entry.optimize = true;
614 return entry;
615 }
616 break;
617 case 'b':
618 if (strcmp(macro, "$bytes") == 0)
619 {
620 entry.kind = ENTRY_INSTR_BYTES;
621 return entry;
622 }
623 else if (strcmp(macro, "$break") == 0)
624 {
625 entry.kind = ENTRY_BREAK;
626 return entry;
627 }
628 break;
629 case 'i':
630 if (strcmp(macro, "$instr") == 0)
631 {
632 entry.kind = ENTRY_INSTR;
633 return entry;
634 }
635 break;
636 case 't':
637 if (strcmp(macro, "$take") == 0)
638 {
639 entry.kind = ENTRY_TAKE;
640 return entry;
641 }
642 break;
643 default:
644 break;
645 }
646
647 // User-define macro:
648 entry.macro = dupString(macro);
649 return entry;
650}
651
652/*
653 * Create a LABEL template entry.

Callers 1

parseTrampolineFunction · 0.85

Calls 2

strcmpFunction · 0.85
dupStringFunction · 0.85

Tested by

no test coverage detected