mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
nfa: delete largely-unused struct LimExNFABase
This commit is contained in:
parent
093029b5d1
commit
a9fddbc400
@ -99,24 +99,6 @@ enum LimExSquash {
|
|||||||
LIMEX_SQUASH_REPORT = 3 //!< squash when report is raised
|
LIMEX_SQUASH_REPORT = 3 //!< squash when report is raised
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LimExNFABase {
|
|
||||||
u8 reachMap[N_CHARS];
|
|
||||||
u32 reachSize;
|
|
||||||
u32 accelCount;
|
|
||||||
u32 accelTableOffset;
|
|
||||||
u32 accelAuxCount;
|
|
||||||
u32 accelAuxOffset;
|
|
||||||
u32 acceptCount;
|
|
||||||
u32 acceptOffset;
|
|
||||||
u32 acceptEodCount;
|
|
||||||
u32 acceptEodOffset;
|
|
||||||
u32 exceptionCount;
|
|
||||||
u32 exceptionOffset;
|
|
||||||
u32 exReportOffset;
|
|
||||||
u32 repeatCount;
|
|
||||||
u32 repeatOffset;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* uniform looking types for the macros */
|
/* uniform looking types for the macros */
|
||||||
typedef u8 u_8;
|
typedef u8 u_8;
|
||||||
typedef u16 u_16;
|
typedef u16 u_16;
|
||||||
@ -137,7 +119,7 @@ struct NFAException##size { \
|
|||||||
u8 trigger; /**< from enum LimExTrigger */ \
|
u8 trigger; /**< from enum LimExTrigger */ \
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
struct LimExNFA##size { /* MUST align with LimExNFABase */ \
|
struct LimExNFA##size { \
|
||||||
u8 reachMap[N_CHARS]; /**< map of char -> entry in reach[] */ \
|
u8 reachMap[N_CHARS]; /**< map of char -> entry in reach[] */ \
|
||||||
u32 reachSize; /**< number of reach masks */ \
|
u32 reachSize; /**< number of reach masks */ \
|
||||||
u32 accelCount; /**< number of entries in accel table */ \
|
u32 accelCount; /**< number of entries in accel table */ \
|
||||||
|
@ -78,7 +78,7 @@ struct DISPATCH_BY_NFA_TYPE_INT<sfunc, rv_t, arg_t, INVALID_NFA> {
|
|||||||
decltype(arg), (NFAEngineType)0>::doOp(i, arg)
|
decltype(arg), (NFAEngineType)0>::doOp(i, arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef bool (*has_accel_fn)(const NFA *nfa);
|
typedef bool (*nfa_dispatch_fn)(const NFA *nfa);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static
|
static
|
||||||
@ -87,8 +87,37 @@ bool has_accel_limex(const NFA *nfa) {
|
|||||||
return limex->accelCount;
|
return limex->accelCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
static
|
static
|
||||||
bool has_accel_generic(const NFA *) {
|
bool has_repeats_limex(const NFA *nfa) {
|
||||||
|
const T *limex = (const T *)getImplNfa(nfa);
|
||||||
|
return limex->repeatCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
static
|
||||||
|
bool has_repeats_other_than_firsts_limex(const NFA *nfa) {
|
||||||
|
const T *limex = (const T *)getImplNfa(nfa);
|
||||||
|
const char *ptr = (const char *)limex;
|
||||||
|
|
||||||
|
const u32 *repeatOffset = (const u32 *)(ptr + limex->repeatOffset);
|
||||||
|
|
||||||
|
for (u32 i = 0; i < limex->repeatCount; i++) {
|
||||||
|
u32 offset = repeatOffset[i];
|
||||||
|
const NFARepeatInfo *info = (const NFARepeatInfo *)(ptr + offset);
|
||||||
|
const RepeatInfo *repeat =
|
||||||
|
(const RepeatInfo *)((const char *)info + sizeof(*info));
|
||||||
|
if (repeat->type != REPEAT_FIRST) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
bool dispatch_false(const NFA *) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,13 +175,20 @@ enum NFACategory {NFA_LIMEX, NFA_OTHER};
|
|||||||
static const NFACategory category = NFA_LIMEX; \
|
static const NFACategory category = NFA_LIMEX; \
|
||||||
typedef LimExNFA##mlt_size implNFA_t; \
|
typedef LimExNFA##mlt_size implNFA_t; \
|
||||||
typedef u_##mlt_size tableRow_t; \
|
typedef u_##mlt_size tableRow_t; \
|
||||||
static const has_accel_fn has_accel; \
|
static const nfa_dispatch_fn has_accel; \
|
||||||
|
static const nfa_dispatch_fn has_repeats; \
|
||||||
|
static const nfa_dispatch_fn has_repeats_other_than_firsts; \
|
||||||
static const u32 stateAlign = \
|
static const u32 stateAlign = \
|
||||||
MAX(alignof(tableRow_t), alignof(RepeatControl)); \
|
MAX(alignof(tableRow_t), alignof(RepeatControl)); \
|
||||||
static const bool fast = mlt_size <= 64; \
|
static const bool fast = mlt_size <= 64; \
|
||||||
}; \
|
}; \
|
||||||
const has_accel_fn NFATraits<LIMEX_NFA_##mlt_size>::has_accel \
|
const nfa_dispatch_fn NFATraits<LIMEX_NFA_##mlt_size>::has_accel \
|
||||||
= has_accel_limex<LimExNFA##mlt_size>; \
|
= has_accel_limex<LimExNFA##mlt_size>; \
|
||||||
|
const nfa_dispatch_fn NFATraits<LIMEX_NFA_##mlt_size>::has_repeats \
|
||||||
|
= has_repeats_limex<LimExNFA##mlt_size>; \
|
||||||
|
const nfa_dispatch_fn \
|
||||||
|
NFATraits<LIMEX_NFA_##mlt_size>::has_repeats_other_than_firsts \
|
||||||
|
= has_repeats_other_than_firsts_limex<LimExNFA##mlt_size>; \
|
||||||
DO_IF_DUMP_SUPPORT( \
|
DO_IF_DUMP_SUPPORT( \
|
||||||
const char *NFATraits<LIMEX_NFA_##mlt_size>::name \
|
const char *NFATraits<LIMEX_NFA_##mlt_size>::name \
|
||||||
= "LimEx "#mlt_size; \
|
= "LimEx "#mlt_size; \
|
||||||
@ -173,9 +209,13 @@ template<> struct NFATraits<MCCLELLAN_NFA_8> {
|
|||||||
static const NFACategory category = NFA_OTHER;
|
static const NFACategory category = NFA_OTHER;
|
||||||
static const u32 stateAlign = 1;
|
static const u32 stateAlign = 1;
|
||||||
static const bool fast = true;
|
static const bool fast = true;
|
||||||
static const has_accel_fn has_accel;
|
static const nfa_dispatch_fn has_accel;
|
||||||
|
static const nfa_dispatch_fn has_repeats;
|
||||||
|
static const nfa_dispatch_fn has_repeats_other_than_firsts;
|
||||||
};
|
};
|
||||||
const has_accel_fn NFATraits<MCCLELLAN_NFA_8>::has_accel = has_accel_dfa;
|
const nfa_dispatch_fn NFATraits<MCCLELLAN_NFA_8>::has_accel = has_accel_dfa;
|
||||||
|
const nfa_dispatch_fn NFATraits<MCCLELLAN_NFA_8>::has_repeats = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<MCCLELLAN_NFA_8>::has_repeats_other_than_firsts = dispatch_false;
|
||||||
#if defined(DUMP_SUPPORT)
|
#if defined(DUMP_SUPPORT)
|
||||||
const char *NFATraits<MCCLELLAN_NFA_8>::name = "McClellan 8";
|
const char *NFATraits<MCCLELLAN_NFA_8>::name = "McClellan 8";
|
||||||
#endif
|
#endif
|
||||||
@ -185,9 +225,13 @@ template<> struct NFATraits<MCCLELLAN_NFA_16> {
|
|||||||
static const NFACategory category = NFA_OTHER;
|
static const NFACategory category = NFA_OTHER;
|
||||||
static const u32 stateAlign = 2;
|
static const u32 stateAlign = 2;
|
||||||
static const bool fast = true;
|
static const bool fast = true;
|
||||||
static const has_accel_fn has_accel;
|
static const nfa_dispatch_fn has_accel;
|
||||||
|
static const nfa_dispatch_fn has_repeats;
|
||||||
|
static const nfa_dispatch_fn has_repeats_other_than_firsts;
|
||||||
};
|
};
|
||||||
const has_accel_fn NFATraits<MCCLELLAN_NFA_16>::has_accel = has_accel_dfa;
|
const nfa_dispatch_fn NFATraits<MCCLELLAN_NFA_16>::has_accel = has_accel_dfa;
|
||||||
|
const nfa_dispatch_fn NFATraits<MCCLELLAN_NFA_16>::has_repeats = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<MCCLELLAN_NFA_16>::has_repeats_other_than_firsts = dispatch_false;
|
||||||
#if defined(DUMP_SUPPORT)
|
#if defined(DUMP_SUPPORT)
|
||||||
const char *NFATraits<MCCLELLAN_NFA_16>::name = "McClellan 16";
|
const char *NFATraits<MCCLELLAN_NFA_16>::name = "McClellan 16";
|
||||||
#endif
|
#endif
|
||||||
@ -197,9 +241,13 @@ template<> struct NFATraits<GOUGH_NFA_8> {
|
|||||||
static const NFACategory category = NFA_OTHER;
|
static const NFACategory category = NFA_OTHER;
|
||||||
static const u32 stateAlign = 8;
|
static const u32 stateAlign = 8;
|
||||||
static const bool fast = true;
|
static const bool fast = true;
|
||||||
static const has_accel_fn has_accel;
|
static const nfa_dispatch_fn has_accel;
|
||||||
|
static const nfa_dispatch_fn has_repeats;
|
||||||
|
static const nfa_dispatch_fn has_repeats_other_than_firsts;
|
||||||
};
|
};
|
||||||
const has_accel_fn NFATraits<GOUGH_NFA_8>::has_accel = has_accel_dfa;
|
const nfa_dispatch_fn NFATraits<GOUGH_NFA_8>::has_accel = has_accel_dfa;
|
||||||
|
const nfa_dispatch_fn NFATraits<GOUGH_NFA_8>::has_repeats = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<GOUGH_NFA_8>::has_repeats_other_than_firsts = dispatch_false;
|
||||||
#if defined(DUMP_SUPPORT)
|
#if defined(DUMP_SUPPORT)
|
||||||
const char *NFATraits<GOUGH_NFA_8>::name = "Goughfish 8";
|
const char *NFATraits<GOUGH_NFA_8>::name = "Goughfish 8";
|
||||||
#endif
|
#endif
|
||||||
@ -209,9 +257,13 @@ template<> struct NFATraits<GOUGH_NFA_16> {
|
|||||||
static const NFACategory category = NFA_OTHER;
|
static const NFACategory category = NFA_OTHER;
|
||||||
static const u32 stateAlign = 8;
|
static const u32 stateAlign = 8;
|
||||||
static const bool fast = true;
|
static const bool fast = true;
|
||||||
static const has_accel_fn has_accel;
|
static const nfa_dispatch_fn has_accel;
|
||||||
|
static const nfa_dispatch_fn has_repeats;
|
||||||
|
static const nfa_dispatch_fn has_repeats_other_than_firsts;
|
||||||
};
|
};
|
||||||
const has_accel_fn NFATraits<GOUGH_NFA_16>::has_accel = has_accel_dfa;
|
const nfa_dispatch_fn NFATraits<GOUGH_NFA_16>::has_accel = has_accel_dfa;
|
||||||
|
const nfa_dispatch_fn NFATraits<GOUGH_NFA_16>::has_repeats = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<GOUGH_NFA_16>::has_repeats_other_than_firsts = dispatch_false;
|
||||||
#if defined(DUMP_SUPPORT)
|
#if defined(DUMP_SUPPORT)
|
||||||
const char *NFATraits<GOUGH_NFA_16>::name = "Goughfish 16";
|
const char *NFATraits<GOUGH_NFA_16>::name = "Goughfish 16";
|
||||||
#endif
|
#endif
|
||||||
@ -221,9 +273,13 @@ template<> struct NFATraits<MPV_NFA_0> {
|
|||||||
static const NFACategory category = NFA_OTHER;
|
static const NFACategory category = NFA_OTHER;
|
||||||
static const u32 stateAlign = 8;
|
static const u32 stateAlign = 8;
|
||||||
static const bool fast = true;
|
static const bool fast = true;
|
||||||
static const has_accel_fn has_accel;
|
static const nfa_dispatch_fn has_accel;
|
||||||
|
static const nfa_dispatch_fn has_repeats;
|
||||||
|
static const nfa_dispatch_fn has_repeats_other_than_firsts;
|
||||||
};
|
};
|
||||||
const has_accel_fn NFATraits<MPV_NFA_0>::has_accel = has_accel_generic;
|
const nfa_dispatch_fn NFATraits<MPV_NFA_0>::has_accel = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<MPV_NFA_0>::has_repeats = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<MPV_NFA_0>::has_repeats_other_than_firsts = dispatch_false;
|
||||||
#if defined(DUMP_SUPPORT)
|
#if defined(DUMP_SUPPORT)
|
||||||
const char *NFATraits<MPV_NFA_0>::name = "Mega-Puff-Vac";
|
const char *NFATraits<MPV_NFA_0>::name = "Mega-Puff-Vac";
|
||||||
#endif
|
#endif
|
||||||
@ -233,9 +289,13 @@ template<> struct NFATraits<CASTLE_NFA_0> {
|
|||||||
static const NFACategory category = NFA_OTHER;
|
static const NFACategory category = NFA_OTHER;
|
||||||
static const u32 stateAlign = 8;
|
static const u32 stateAlign = 8;
|
||||||
static const bool fast = true;
|
static const bool fast = true;
|
||||||
static const has_accel_fn has_accel;
|
static const nfa_dispatch_fn has_accel;
|
||||||
|
static const nfa_dispatch_fn has_repeats;
|
||||||
|
static const nfa_dispatch_fn has_repeats_other_than_firsts;
|
||||||
};
|
};
|
||||||
const has_accel_fn NFATraits<CASTLE_NFA_0>::has_accel = has_accel_generic;
|
const nfa_dispatch_fn NFATraits<CASTLE_NFA_0>::has_accel = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<CASTLE_NFA_0>::has_repeats = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<CASTLE_NFA_0>::has_repeats_other_than_firsts = dispatch_false;
|
||||||
#if defined(DUMP_SUPPORT)
|
#if defined(DUMP_SUPPORT)
|
||||||
const char *NFATraits<CASTLE_NFA_0>::name = "Castle";
|
const char *NFATraits<CASTLE_NFA_0>::name = "Castle";
|
||||||
#endif
|
#endif
|
||||||
@ -245,9 +305,13 @@ template<> struct NFATraits<LBR_NFA_Dot> {
|
|||||||
static const NFACategory category = NFA_OTHER;
|
static const NFACategory category = NFA_OTHER;
|
||||||
static const u32 stateAlign = 8;
|
static const u32 stateAlign = 8;
|
||||||
static const bool fast = true;
|
static const bool fast = true;
|
||||||
static const has_accel_fn has_accel;
|
static const nfa_dispatch_fn has_accel;
|
||||||
|
static const nfa_dispatch_fn has_repeats;
|
||||||
|
static const nfa_dispatch_fn has_repeats_other_than_firsts;
|
||||||
};
|
};
|
||||||
const has_accel_fn NFATraits<LBR_NFA_Dot>::has_accel = has_accel_generic;
|
const nfa_dispatch_fn NFATraits<LBR_NFA_Dot>::has_accel = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<LBR_NFA_Dot>::has_repeats = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<LBR_NFA_Dot>::has_repeats_other_than_firsts = dispatch_false;
|
||||||
#if defined(DUMP_SUPPORT)
|
#if defined(DUMP_SUPPORT)
|
||||||
const char *NFATraits<LBR_NFA_Dot>::name = "Lim Bounded Repeat (D)";
|
const char *NFATraits<LBR_NFA_Dot>::name = "Lim Bounded Repeat (D)";
|
||||||
#endif
|
#endif
|
||||||
@ -257,9 +321,13 @@ template<> struct NFATraits<LBR_NFA_Verm> {
|
|||||||
static const NFACategory category = NFA_OTHER;
|
static const NFACategory category = NFA_OTHER;
|
||||||
static const u32 stateAlign = 8;
|
static const u32 stateAlign = 8;
|
||||||
static const bool fast = true;
|
static const bool fast = true;
|
||||||
static const has_accel_fn has_accel;
|
static const nfa_dispatch_fn has_accel;
|
||||||
|
static const nfa_dispatch_fn has_repeats;
|
||||||
|
static const nfa_dispatch_fn has_repeats_other_than_firsts;
|
||||||
};
|
};
|
||||||
const has_accel_fn NFATraits<LBR_NFA_Verm>::has_accel = has_accel_generic;
|
const nfa_dispatch_fn NFATraits<LBR_NFA_Verm>::has_accel = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<LBR_NFA_Verm>::has_repeats = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<LBR_NFA_Verm>::has_repeats_other_than_firsts = dispatch_false;
|
||||||
#if defined(DUMP_SUPPORT)
|
#if defined(DUMP_SUPPORT)
|
||||||
const char *NFATraits<LBR_NFA_Verm>::name = "Lim Bounded Repeat (V)";
|
const char *NFATraits<LBR_NFA_Verm>::name = "Lim Bounded Repeat (V)";
|
||||||
#endif
|
#endif
|
||||||
@ -269,9 +337,13 @@ template<> struct NFATraits<LBR_NFA_NVerm> {
|
|||||||
static const NFACategory category = NFA_OTHER;
|
static const NFACategory category = NFA_OTHER;
|
||||||
static const u32 stateAlign = 8;
|
static const u32 stateAlign = 8;
|
||||||
static const bool fast = true;
|
static const bool fast = true;
|
||||||
static const has_accel_fn has_accel;
|
static const nfa_dispatch_fn has_accel;
|
||||||
|
static const nfa_dispatch_fn has_repeats;
|
||||||
|
static const nfa_dispatch_fn has_repeats_other_than_firsts;
|
||||||
};
|
};
|
||||||
const has_accel_fn NFATraits<LBR_NFA_NVerm>::has_accel = has_accel_generic;
|
const nfa_dispatch_fn NFATraits<LBR_NFA_NVerm>::has_accel = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<LBR_NFA_NVerm>::has_repeats = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<LBR_NFA_NVerm>::has_repeats_other_than_firsts = dispatch_false;
|
||||||
#if defined(DUMP_SUPPORT)
|
#if defined(DUMP_SUPPORT)
|
||||||
const char *NFATraits<LBR_NFA_NVerm>::name = "Lim Bounded Repeat (NV)";
|
const char *NFATraits<LBR_NFA_NVerm>::name = "Lim Bounded Repeat (NV)";
|
||||||
#endif
|
#endif
|
||||||
@ -281,9 +353,13 @@ template<> struct NFATraits<LBR_NFA_Shuf> {
|
|||||||
static const NFACategory category = NFA_OTHER;
|
static const NFACategory category = NFA_OTHER;
|
||||||
static const u32 stateAlign = 8;
|
static const u32 stateAlign = 8;
|
||||||
static const bool fast = true;
|
static const bool fast = true;
|
||||||
static const has_accel_fn has_accel;
|
static const nfa_dispatch_fn has_accel;
|
||||||
|
static const nfa_dispatch_fn has_repeats;
|
||||||
|
static const nfa_dispatch_fn has_repeats_other_than_firsts;
|
||||||
};
|
};
|
||||||
const has_accel_fn NFATraits<LBR_NFA_Shuf>::has_accel = has_accel_generic;
|
const nfa_dispatch_fn NFATraits<LBR_NFA_Shuf>::has_accel = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<LBR_NFA_Shuf>::has_repeats = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<LBR_NFA_Shuf>::has_repeats_other_than_firsts = dispatch_false;
|
||||||
#if defined(DUMP_SUPPORT)
|
#if defined(DUMP_SUPPORT)
|
||||||
const char *NFATraits<LBR_NFA_Shuf>::name = "Lim Bounded Repeat (S)";
|
const char *NFATraits<LBR_NFA_Shuf>::name = "Lim Bounded Repeat (S)";
|
||||||
#endif
|
#endif
|
||||||
@ -293,9 +369,13 @@ template<> struct NFATraits<LBR_NFA_Truf> {
|
|||||||
static const NFACategory category = NFA_OTHER;
|
static const NFACategory category = NFA_OTHER;
|
||||||
static const u32 stateAlign = 8;
|
static const u32 stateAlign = 8;
|
||||||
static const bool fast = true;
|
static const bool fast = true;
|
||||||
static const has_accel_fn has_accel;
|
static const nfa_dispatch_fn has_accel;
|
||||||
|
static const nfa_dispatch_fn has_repeats;
|
||||||
|
static const nfa_dispatch_fn has_repeats_other_than_firsts;
|
||||||
};
|
};
|
||||||
const has_accel_fn NFATraits<LBR_NFA_Truf>::has_accel = has_accel_generic;
|
const nfa_dispatch_fn NFATraits<LBR_NFA_Truf>::has_accel = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<LBR_NFA_Truf>::has_repeats = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<LBR_NFA_Truf>::has_repeats_other_than_firsts = dispatch_false;
|
||||||
#if defined(DUMP_SUPPORT)
|
#if defined(DUMP_SUPPORT)
|
||||||
const char *NFATraits<LBR_NFA_Truf>::name = "Lim Bounded Repeat (M)";
|
const char *NFATraits<LBR_NFA_Truf>::name = "Lim Bounded Repeat (M)";
|
||||||
#endif
|
#endif
|
||||||
@ -305,9 +385,13 @@ template<> struct NFATraits<TAMARAMA_NFA_0> {
|
|||||||
static const NFACategory category = NFA_OTHER;
|
static const NFACategory category = NFA_OTHER;
|
||||||
static const u32 stateAlign = 32;
|
static const u32 stateAlign = 32;
|
||||||
static const bool fast = true;
|
static const bool fast = true;
|
||||||
static const has_accel_fn has_accel;
|
static const nfa_dispatch_fn has_accel;
|
||||||
|
static const nfa_dispatch_fn has_repeats;
|
||||||
|
static const nfa_dispatch_fn has_repeats_other_than_firsts;
|
||||||
};
|
};
|
||||||
const has_accel_fn NFATraits<TAMARAMA_NFA_0>::has_accel = has_accel_generic;
|
const nfa_dispatch_fn NFATraits<TAMARAMA_NFA_0>::has_accel = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<TAMARAMA_NFA_0>::has_repeats = dispatch_false;
|
||||||
|
const nfa_dispatch_fn NFATraits<TAMARAMA_NFA_0>::has_repeats_other_than_firsts = dispatch_false;
|
||||||
#if defined(DUMP_SUPPORT)
|
#if defined(DUMP_SUPPORT)
|
||||||
const char *NFATraits<TAMARAMA_NFA_0>::name = "Tamarama";
|
const char *NFATraits<TAMARAMA_NFA_0>::name = "Tamarama";
|
||||||
#endif
|
#endif
|
||||||
@ -362,42 +446,39 @@ struct is_limex {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
template<NFAEngineType t>
|
||||||
|
struct has_repeats_other_than_firsts_dispatch {
|
||||||
|
static nfa_dispatch_fn call(const void *) {
|
||||||
|
return NFATraits<t>::has_repeats_other_than_firsts;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
bool has_bounded_repeats_other_than_firsts(const NFA &nfa) {
|
bool has_bounded_repeats_other_than_firsts(const NFA &nfa) {
|
||||||
if (!DISPATCH_BY_NFA_TYPE((NFAEngineType)nfa.type, is_limex, &nfa)) {
|
return DISPATCH_BY_NFA_TYPE((NFAEngineType)nfa.type,
|
||||||
return false;
|
has_repeats_other_than_firsts_dispatch,
|
||||||
|
&nfa)(&nfa);
|
||||||
}
|
}
|
||||||
|
|
||||||
const LimExNFABase *limex = (const LimExNFABase *)getImplNfa(&nfa);
|
namespace {
|
||||||
const char *ptr = (const char *)limex;
|
template<NFAEngineType t>
|
||||||
|
struct has_repeats_dispatch {
|
||||||
const u32 *repeatOffset = (const u32 *)(ptr + limex->repeatOffset);
|
static nfa_dispatch_fn call(const void *) {
|
||||||
|
return NFATraits<t>::has_repeats;
|
||||||
for (u32 i = 0; i < limex->repeatCount; i++) {
|
|
||||||
u32 offset = repeatOffset[i];
|
|
||||||
const NFARepeatInfo *info = (const NFARepeatInfo *)(ptr + offset);
|
|
||||||
const RepeatInfo *repeat =
|
|
||||||
(const RepeatInfo *)((const char *)info + sizeof(*info));
|
|
||||||
if (repeat->type != REPEAT_FIRST) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_bounded_repeats(const NFA &nfa) {
|
bool has_bounded_repeats(const NFA &nfa) {
|
||||||
if (!DISPATCH_BY_NFA_TYPE((NFAEngineType)nfa.type, is_limex, &nfa)) {
|
return DISPATCH_BY_NFA_TYPE((NFAEngineType)nfa.type, has_repeats_dispatch,
|
||||||
return false;
|
&nfa)(&nfa);
|
||||||
}
|
|
||||||
|
|
||||||
const LimExNFABase *limex = (const LimExNFABase *)getImplNfa(&nfa);
|
|
||||||
return limex->repeatCount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
template<NFAEngineType t>
|
template<NFAEngineType t>
|
||||||
struct has_accel_dispatch {
|
struct has_accel_dispatch {
|
||||||
static has_accel_fn call(const void *) {
|
static nfa_dispatch_fn call(const void *) {
|
||||||
return NFATraits<t>::has_accel;
|
return NFATraits<t>::has_accel;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -405,8 +486,7 @@ struct has_accel_dispatch {
|
|||||||
|
|
||||||
bool has_accel(const NFA &nfa) {
|
bool has_accel(const NFA &nfa) {
|
||||||
return DISPATCH_BY_NFA_TYPE((NFAEngineType)nfa.type, has_accel_dispatch,
|
return DISPATCH_BY_NFA_TYPE((NFAEngineType)nfa.type, has_accel_dispatch,
|
||||||
&nfa)
|
&nfa)(&nfa);
|
||||||
(&nfa);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool requires_decompress_key(const NFA &nfa) {
|
bool requires_decompress_key(const NFA &nfa) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user