mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-29 11:16:29 +03:00
nfa: standardise callback start, end naming
This commit is contained in:
committed by
Matthew Barr
parent
cf9e40ae1c
commit
9f98f4c7b2
@@ -281,15 +281,14 @@ restart:
|
||||
|
||||
/* for use by mpv (chained) only */
|
||||
static
|
||||
int roseNfaFinalBlastAdaptor(u64a som, u64a offset, ReportID id,
|
||||
void *context) {
|
||||
int roseNfaFinalBlastAdaptor(u64a start, u64a end, ReportID id, void *context) {
|
||||
struct hs_scratch *scratch = context;
|
||||
assert(scratch && scratch->magic == SCRATCH_MAGIC);
|
||||
const struct RoseEngine *t = scratch->core_info.rose;
|
||||
|
||||
DEBUG_PRINTF("masky got himself a blasted match @%llu id %u !woot!\n",
|
||||
offset, id);
|
||||
DEBUG_PRINTF("id=%u matched at [%llu,%llu]\n", id, start, end);
|
||||
|
||||
int cb_rv = roseNfaRunProgram(t, scratch, som, offset, id, 1);
|
||||
int cb_rv = roseNfaRunProgram(t, scratch, start, end, id, 1);
|
||||
if (cb_rv == MO_HALT_MATCHING) {
|
||||
return MO_HALT_MATCHING;
|
||||
} else if (cb_rv == ROSE_CONTINUE_MATCHING_NO_EXHAUST) {
|
||||
@@ -449,35 +448,35 @@ char in_mpv(const struct RoseEngine *rose, const struct hs_scratch *scratch) {
|
||||
}
|
||||
|
||||
static
|
||||
int roseNfaBlastAdaptor(u64a som, u64a offset, ReportID id, void *context) {
|
||||
int roseNfaBlastAdaptor(u64a start, u64a end, ReportID id, void *context) {
|
||||
struct hs_scratch *scratch = context;
|
||||
struct RoseContext *tctxt = &scratch->tctxt;
|
||||
assert(scratch && scratch->magic == SCRATCH_MAGIC);
|
||||
const struct RoseEngine *t = scratch->core_info.rose;
|
||||
|
||||
DEBUG_PRINTF("masky got himself a blasted match @%llu id %u !woot!\n",
|
||||
offset, id);
|
||||
DEBUG_PRINTF("id=%u matched at [%llu,%llu]\n", id, start, end);
|
||||
|
||||
const char from_mpv = in_mpv(t, scratch);
|
||||
int cb_rv = roseNfaRunProgram(t, scratch, som, offset, id, from_mpv);
|
||||
int cb_rv = roseNfaRunProgram(t, scratch, start, end, id, from_mpv);
|
||||
if (cb_rv == MO_HALT_MATCHING) {
|
||||
return MO_HALT_MATCHING;
|
||||
} else if (cb_rv == ROSE_CONTINUE_MATCHING_NO_EXHAUST) {
|
||||
return MO_CONTINUE_MATCHING;
|
||||
} else {
|
||||
assert(cb_rv == MO_CONTINUE_MATCHING);
|
||||
return !roseSuffixIsExhausted(t, tctxt->curr_qi,
|
||||
return !roseSuffixIsExhausted(t, scratch->tctxt.curr_qi,
|
||||
scratch->core_info.exhaustionVector);
|
||||
}
|
||||
}
|
||||
|
||||
int roseNfaAdaptor(u64a from_offset, u64a offset, ReportID id,
|
||||
void *context) {
|
||||
int roseNfaAdaptor(u64a start, u64a end, ReportID id, void *context) {
|
||||
struct hs_scratch *scratch = context;
|
||||
DEBUG_PRINTF("masky got himself a match @%llu id %u !woot!\n", offset, id);
|
||||
assert(scratch && scratch->magic == SCRATCH_MAGIC);
|
||||
|
||||
DEBUG_PRINTF("id=%u matched at [%llu,%llu]\n", id, start, end);
|
||||
|
||||
/* must be a external report as haig cannot directly participate in chain */
|
||||
return roseNfaRunProgram(scratch->core_info.rose, scratch, from_offset,
|
||||
offset, id, 0);
|
||||
return roseNfaRunProgram(scratch->core_info.rose, scratch, start, end, id,
|
||||
0);
|
||||
}
|
||||
|
||||
static really_inline
|
||||
|
@@ -211,8 +211,9 @@ event_enqueued:
|
||||
return HWLM_CONTINUE_MATCHING;
|
||||
}
|
||||
|
||||
int roseAnchoredCallback(u64a som, u64a end, u32 id, void *ctx) {
|
||||
int roseAnchoredCallback(u64a start, u64a end, u32 id, void *ctx) {
|
||||
struct hs_scratch *scratch = ctx;
|
||||
assert(scratch && scratch->magic == SCRATCH_MAGIC);
|
||||
struct RoseContext *tctxt = &scratch->tctxt;
|
||||
struct core_info *ci = &scratch->core_info;
|
||||
const struct RoseEngine *t = ci->rose;
|
||||
@@ -244,7 +245,7 @@ int roseAnchoredCallback(u64a som, u64a end, u32 id, void *ctx) {
|
||||
const u32 *programs = getByOffset(t, t->litProgramOffset);
|
||||
assert(id < t->literalCount);
|
||||
const u8 flags = ROSE_PROG_FLAG_IN_ANCHORED;
|
||||
if (roseRunProgram(t, scratch, programs[id], som, real_end, match_len,
|
||||
if (roseRunProgram(t, scratch, programs[id], start, real_end, match_len,
|
||||
flags) == HWLM_TERMINATE_MATCHING) {
|
||||
assert(can_stop_matching(scratch));
|
||||
DEBUG_PRINTF("caller requested termination\n");
|
||||
@@ -647,11 +648,12 @@ int roseRunBoundaryProgram(const struct RoseEngine *rose, u32 program,
|
||||
return MO_CONTINUE_MATCHING;
|
||||
}
|
||||
|
||||
int roseReportAdaptor(u64a som, u64a offset, ReportID id, void *context) {
|
||||
DEBUG_PRINTF("som=%llu, offset=%llu, id=%u\n", som, offset, id);
|
||||
int roseReportAdaptor(u64a start, u64a end, ReportID id, void *context) {
|
||||
struct hs_scratch *scratch = context;
|
||||
assert(scratch && scratch->magic == SCRATCH_MAGIC);
|
||||
|
||||
DEBUG_PRINTF("id=%u matched at [%llu,%llu]\n", id, start, end);
|
||||
|
||||
const struct RoseEngine *rose = scratch->core_info.rose;
|
||||
|
||||
// Our match ID is the program offset.
|
||||
@@ -659,7 +661,7 @@ int roseReportAdaptor(u64a som, u64a offset, ReportID id, void *context) {
|
||||
const size_t match_len = 0; // Unused in this path.
|
||||
const u8 flags = ROSE_PROG_FLAG_SKIP_MPV_CATCHUP;
|
||||
hwlmcb_rv_t rv =
|
||||
roseRunProgram(rose, scratch, program, som, offset, match_len, flags);
|
||||
roseRunProgram(rose, scratch, program, start, end, match_len, flags);
|
||||
if (rv == HWLM_TERMINATE_MATCHING) {
|
||||
return MO_HALT_MATCHING;
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@
|
||||
|
||||
/* Callbacks, defined in catchup.c */
|
||||
|
||||
int roseNfaAdaptor(u64a from_offset, u64a offset, ReportID id, void *context);
|
||||
int roseNfaAdaptor(u64a start, u64a end, ReportID id, void *context);
|
||||
|
||||
/* Callbacks, defined in match.c */
|
||||
|
||||
@@ -56,7 +56,7 @@ hwlmcb_rv_t roseCallback(size_t start, size_t end, u32 id, void *ctx);
|
||||
hwlmcb_rv_t roseFloatingCallback(size_t start, size_t end, u32 id, void *ctx);
|
||||
hwlmcb_rv_t roseDelayRebuildCallback(size_t start, size_t end, u32 id,
|
||||
void *ctx);
|
||||
int roseAnchoredCallback(u64a som, u64a end, u32 id, void *ctx);
|
||||
int roseAnchoredCallback(u64a start, u64a end, u32 id, void *ctx);
|
||||
|
||||
/* Common code, used all over Rose runtime */
|
||||
|
||||
|
@@ -33,10 +33,11 @@
|
||||
|
||||
#include "program_runtime.h"
|
||||
|
||||
int roseNfaEarliestSom(u64a from_offset, UNUSED u64a offset, UNUSED ReportID id,
|
||||
int roseNfaEarliestSom(u64a start, UNUSED u64a end, UNUSED ReportID id,
|
||||
void *context) {
|
||||
assert(context);
|
||||
u64a *som = context;
|
||||
*som = MIN(*som, from_offset);
|
||||
*som = MIN(*som, start);
|
||||
return MO_CONTINUE_MATCHING;
|
||||
}
|
||||
|
||||
|
@@ -702,8 +702,8 @@ int roseCheckLookaround(const struct RoseEngine *t,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int roseNfaEarliestSom(u64a from_offset, u64a offset, ReportID id,
|
||||
void *context);
|
||||
int roseNfaEarliestSom(u64a start, u64a end, ReportID id, void *context);
|
||||
|
||||
static rose_inline
|
||||
u64a roseGetHaigSom(const struct RoseEngine *t, struct hs_scratch *scratch,
|
||||
const u32 qi, UNUSED const u32 leftfixLag) {
|
||||
|
@@ -49,7 +49,7 @@ void roseStreamEodExec(const struct RoseEngine *t, u64a offset,
|
||||
hwlmcb_rv_t rosePureLiteralCallback(size_t start, size_t end, u32 id,
|
||||
void *context);
|
||||
|
||||
int roseReportAdaptor(u64a som, u64a offset, ReportID id, void *context);
|
||||
int roseReportAdaptor(u64a start, u64a end, ReportID id, void *context);
|
||||
|
||||
int roseRunBoundaryProgram(const struct RoseEngine *rose, u32 program,
|
||||
u64a stream_offset, struct hs_scratch *scratch);
|
||||
|
Reference in New Issue
Block a user