mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-19 10:34:25 +03:00
have single dump function per engine
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include "ue2common.h"
|
||||
#include "util/charreach.h"
|
||||
#include "util/dump_charclass.h"
|
||||
#include "util/dump_util.h"
|
||||
#include "util/unaligned.h"
|
||||
|
||||
#include <cctype>
|
||||
@@ -259,8 +260,8 @@ void dumpTransitions(const NFA *nfa, FILE *f,
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
|
||||
void nfaExecGough8_dumpDot(const struct NFA *nfa, FILE *f,
|
||||
UNUSED const string &base) {
|
||||
static
|
||||
void nfaExecGough8_dumpDot(const struct NFA *nfa, FILE *f) {
|
||||
assert(nfa->type == GOUGH_NFA_8);
|
||||
const mcclellan *m = (const mcclellan *)getImplNfa(nfa);
|
||||
|
||||
@@ -279,6 +280,7 @@ void nfaExecGough8_dumpDot(const struct NFA *nfa, FILE *f,
|
||||
fprintf(f, "}\n");
|
||||
}
|
||||
|
||||
static
|
||||
void nfaExecGough8_dumpText(const struct NFA *nfa, FILE *f) {
|
||||
|
||||
assert(nfa->type == GOUGH_NFA_8);
|
||||
@@ -303,8 +305,8 @@ void nfaExecGough8_dumpText(const struct NFA *nfa, FILE *f) {
|
||||
dumpTextReverse(nfa, f);
|
||||
}
|
||||
|
||||
void nfaExecGough16_dumpDot(const struct NFA *nfa, FILE *f,
|
||||
UNUSED const string &base) {
|
||||
static
|
||||
void nfaExecGough16_dumpDot(const struct NFA *nfa, FILE *f) {
|
||||
assert(nfa->type == GOUGH_NFA_16);
|
||||
const mcclellan *m = (const mcclellan *)getImplNfa(nfa);
|
||||
|
||||
@@ -323,6 +325,7 @@ void nfaExecGough16_dumpDot(const struct NFA *nfa, FILE *f,
|
||||
fprintf(f, "}\n");
|
||||
}
|
||||
|
||||
static
|
||||
void nfaExecGough16_dumpText(const struct NFA *nfa, FILE *f) {
|
||||
assert(nfa->type == GOUGH_NFA_16);
|
||||
const mcclellan *m = (const mcclellan *)getImplNfa(nfa);
|
||||
@@ -348,4 +351,24 @@ void nfaExecGough16_dumpText(const struct NFA *nfa, FILE *f) {
|
||||
dumpTextReverse(nfa, f);
|
||||
}
|
||||
|
||||
void nfaExecGough16_dump(const NFA *nfa, const string &base) {
|
||||
assert(nfa->type == GOUGH_NFA_16);
|
||||
FILE *f = fopen_or_throw((base + ".txt").c_str(), "w");
|
||||
nfaExecGough16_dumpText(nfa, f);
|
||||
fclose(f);
|
||||
f = fopen_or_throw((base + ".dot").c_str(), "w");
|
||||
nfaExecGough16_dumpDot(nfa, f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void nfaExecGough8_dump(const NFA *nfa, const string &base) {
|
||||
assert(nfa->type == GOUGH_NFA_8);
|
||||
FILE *f = fopen_or_throw((base + ".txt").c_str(), "w");
|
||||
nfaExecGough8_dumpText(nfa, f);
|
||||
fclose(f);
|
||||
f = fopen_or_throw((base + ".dot").c_str(), "w");
|
||||
nfaExecGough8_dumpDot(nfa, f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
} // namespace ue2
|
||||
|
||||
Reference in New Issue
Block a user