assert(pc >= pc_base);
assert((size_t)(pc - pc_base) < t->size);
const u8 code = *(const u8 *)pc;
- assert(code <= ROSE_INSTR_END);
+ assert(code <= LAST_ROSE_INSTRUCTION);
switch ((enum RoseInstructionCode)code) {
+ PROGRAM_CASE(END) {
+ DEBUG_PRINTF("finished\n");
+ return HWLM_CONTINUE_MATCHING;
+ }
+ PROGRAM_NEXT_INSTRUCTION
+
PROGRAM_CASE(ANCHORED_DELAY) {
if (in_anchored && end > t->floatingMinLiteralMatchOffset) {
DEBUG_PRINTF("delay until playback\n");
}
}
PROGRAM_NEXT_INSTRUCTION
-
- PROGRAM_CASE(END) {
- DEBUG_PRINTF("finished\n");
- return HWLM_CONTINUE_MATCHING;
- }
- PROGRAM_NEXT_INSTRUCTION
}
}
const char *pc_base = pc;
for (;;) {
u8 code = *(const u8 *)pc;
- assert(code <= ROSE_INSTR_END);
+ assert(code <= LAST_ROSE_INSTRUCTION);
const size_t offset = pc - pc_base;
switch (code) {
+ PROGRAM_CASE(END) { return; }
+ PROGRAM_NEXT_INSTRUCTION
+
PROGRAM_CASE(ANCHORED_DELAY) {
os << " groups 0x" << std::hex << ri->groups << std::dec
<< endl;
PROGRAM_CASE(MATCHER_EOD) {}
PROGRAM_NEXT_INSTRUCTION
- PROGRAM_CASE(END) { return; }
- PROGRAM_NEXT_INSTRUCTION
-
default:
os << " UNKNOWN (code " << int{code} << ")" << endl;
os << " <stopping>" << endl;
/** \brief Role program instruction opcodes. */
enum RoseInstructionCode {
+ ROSE_INSTR_END, //!< End of program.
ROSE_INSTR_ANCHORED_DELAY, //!< Delay until after anchored matcher.
ROSE_INSTR_CHECK_LIT_EARLY, //!< Skip matches before floating min offset.
ROSE_INSTR_CHECK_GROUPS, //!< Check that literal groups are on.
/** \brief Run the EOD-anchored HWLM literal matcher. */
ROSE_INSTR_MATCHER_EOD,
- ROSE_INSTR_END //!< End of program.
+ LAST_ROSE_INSTRUCTION = ROSE_INSTR_MATCHER_EOD //!< Sentinel.
+};
+
+struct ROSE_STRUCT_END {
+ u8 code; //!< From enum RoseInstructionCode.
};
struct ROSE_STRUCT_ANCHORED_DELAY {
u8 code; //!< From enum RoseInstructionCode.
};
-struct ROSE_STRUCT_END {
- u8 code; //!< From enum RoseInstructionCode.
-};
-
#endif // ROSE_ROSE_PROGRAM_H