have single dump function per engine

This commit is contained in:
Alex Coyte
2016-11-02 10:36:24 +11:00
committed by Matthew Barr
parent 71ff480b77
commit 32c826e9c6
23 changed files with 262 additions and 207 deletions

View File

@@ -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