static rose_inline void runSmallWriteEngine(const struct SmallWriteEngine *smwr, struct hs_scratch *scratch) { assert(smwr); assert(scratch); const u8 *buffer = scratch->core_info.buf; size_t length = scratch->core_info.len; DEBUG_PRINTF("USING SMALL WRITE\n"); if (length <= smwr->start_offset) { DEBUG_PRINTF("too short\n"); return; } const struct NFA *nfa = getSmwrNfa(smwr); const struct RoseEngine *rose = scratch->core_info.rose; size_t local_alen = length - smwr->start_offset; const u8 *local_buffer = buffer + smwr->start_offset; assert(isMcClellanType(nfa->type)); if (nfa->type == MCCLELLAN_NFA_8) { nfaExecMcClellan8_B(nfa, smwr->start_offset, local_buffer, local_alen, selectAdaptor(rose), scratch); } else { nfaExecMcClellan16_B(nfa, smwr->start_offset, local_buffer, local_alen, selectAdaptor(rose), scratch); } }
static rose_inline void runAnchoredTableBlock(const struct RoseEngine *t, const void *atable, struct hs_scratch *scratch) { const u8 *buffer = scratch->core_info.buf; size_t length = scratch->core_info.len; size_t alen = MIN(length, t->anchoredDistance); const struct anchored_matcher_info *curr = atable; DEBUG_PRINTF("BEGIN ANCHORED (over %zu/%zu)\n", alen, length); do { const struct NFA *nfa = (const struct NFA *)((const char *)curr + sizeof(*curr)); assert(t->anchoredDistance > curr->anchoredMinDistance); if (length >= curr->anchoredMinDistance) { size_t local_alen = alen - curr->anchoredMinDistance; const u8 *local_buffer = buffer + curr->anchoredMinDistance; DEBUG_PRINTF("--anchored nfa (+%u)\n", curr->anchoredMinDistance); assert(isMcClellanType(nfa->type)); if (nfa->type == MCCLELLAN_NFA_8) { nfaExecMcClellan8_B(nfa, curr->anchoredMinDistance, local_buffer, local_alen, roseAnchoredCallback, &scratch->tctxt); } else { nfaExecMcClellan16_B(nfa, curr->anchoredMinDistance, local_buffer, local_alen, roseAnchoredCallback, &scratch->tctxt); } } if (!curr->next_offset) { break; } curr = (const void *)((const char *)curr + curr->next_offset); } while (1); }