|
@ -2,6 +2,7 @@ |
|
|
#include "analyse.h" |
|
|
#include "analyse.h" |
|
|
|
|
|
|
|
|
#include <iostream> |
|
|
#include <iostream> |
|
|
|
|
|
#include "raw_code.h" |
|
|
|
|
|
|
|
|
Core Analyse::new_core() { |
|
|
Core Analyse::new_core() { |
|
|
return Core( |
|
|
return Core( |
|
@ -11,6 +12,20 @@ Core Analyse::new_core() { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Analyse::backtrack(uint64_t code) { |
|
|
|
|
|
|
|
|
|
|
|
// backtrack start at code
|
|
|
|
|
|
std::cout << "start backtrack" << std::endl; |
|
|
|
|
|
|
|
|
|
|
|
std::cout << RawCode(code).dump_case() << std::endl; |
|
|
|
|
|
std::cout << "src size: " << cases[code].src.size() << std::endl; |
|
|
|
|
|
|
|
|
|
|
|
auto last_1 = cases[code].src.front(); |
|
|
|
|
|
std::cout << RawCode(last_1->code).dump_case() << std::endl; |
|
|
|
|
|
std::cout << "src size: " << last_1->src.size() << std::endl; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void Analyse::start_analyse(uint64_t code) { |
|
|
void Analyse::start_analyse(uint64_t code) { |
|
|
|
|
|
|
|
|
auto core = new_core(); |
|
|
auto core = new_core(); |
|
@ -24,6 +39,7 @@ void Analyse::start_analyse(uint64_t code) { |
|
|
.code = code, |
|
|
.code = code, |
|
|
.mask = 0, |
|
|
.mask = 0, |
|
|
.step = 0, |
|
|
.step = 0, |
|
|
|
|
|
// .highlight = false,
|
|
|
// .src = std::move(std::list<analyse_t*>{}),
|
|
|
// .src = std::move(std::list<analyse_t*>{}),
|
|
|
}).first->second); |
|
|
}).first->second); |
|
|
|
|
|
|
|
@ -40,39 +56,41 @@ void Analyse::start_analyse(uint64_t code) { |
|
|
void Analyse::new_case(uint64_t code, uint64_t mask) { |
|
|
void Analyse::new_case(uint64_t code, uint64_t mask) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto temp = cases.emplace(code, analyse_t { |
|
|
// auto temp = cases.emplace(code, analyse_t {
|
|
|
.code = code, |
|
|
// .code = code,
|
|
|
.mask = mask, |
|
|
// .mask = mask,
|
|
|
.step = cache.front()->step + 1, |
|
|
// .step = cache.front()->step + 1,
|
|
|
.src = std::move(std::list<analyse_t*>{cache.front()}) |
|
|
// .src = std::move(std::list<analyse_t*>{cache.front()})
|
|
|
}); |
|
|
// });
|
|
|
|
|
|
//
|
|
|
|
|
|
// if (temp.second) {
|
|
|
|
|
|
// cache.emplace(&temp.first->second);
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// temp.first->second.mask |= mask;
|
|
|
|
|
|
//
|
|
|
|
|
|
// if (temp.first->second.step != cache.front()->step) {
|
|
|
|
|
|
// temp.first->second.src.push_back(cache.front());
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
if (temp.second) { |
|
|
auto current = cases.find(code); |
|
|
cache.emplace(&temp.first->second); |
|
|
if (current != cases.end()) { // find existed case
|
|
|
} else { |
|
|
current->second.mask |= mask; // update mask info
|
|
|
temp.first->second.mask |= mask; |
|
|
|
|
|
|
|
|
|
|
|
if (temp.first->second.step != cache.front()->step) { |
|
|
if (current->second.step != cache.front()->step) { |
|
|
temp.first->second.src.push_back(cache.front()); |
|
|
current->second.src.push_back(cache.front()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// auto current = cases.find(code);
|
|
|
cache.emplace(&cases.emplace(code, analyse_t { |
|
|
// if (current != cases.end()) { // find existed case
|
|
|
.code = code, |
|
|
// current->second.mask |= mask; // update mask info
|
|
|
.mask = mask, |
|
|
//
|
|
|
.step = cache.front()->step + 1, |
|
|
// if (current->second.step != cache.front()->step) {
|
|
|
// .highlight = false,
|
|
|
// current->second.src.push_back(cache.front());
|
|
|
.src = std::move(std::list<analyse_t*>{cache.front()}), |
|
|
// }
|
|
|
}).first->second); |
|
|
//
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// cache.emplace(&cases.emplace(code, analyse_t {
|
|
|
|
|
|
// .code = code,
|
|
|
|
|
|
// .mask = mask,
|
|
|
|
|
|
// .step = cache.front()->step + 1,
|
|
|
|
|
|
// .src = std::move(std::list<analyse_t*>{cache.front()}),
|
|
|
|
|
|
// }).first->second);
|
|
|
|
|
|
} |
|
|
} |
|
|