even more debug output added

This commit is contained in:
FeralChild64 committed 2020-06-25 18:37:33 +02:00
1 parent e442fa366f
commit cba3a8949f
1 file changed
+23 -16
+23 -16
View File
@@ -616,6 +616,8 @@ void DictEncoder::extractWords(std::vector<std::string> &candidateList)
int32_t DictEncoder::evaluateCandidate(std::string &candidate) int32_t DictEncoder::evaluateCandidate(std::string &candidate)
{ {
// XXX it looks like this is not 100% right - debug the algorithm if dictionary compression is reintroduced
// Build the score - find how much bytes can be spared by extracting this particular candidate // Build the score - find how much bytes can be spared by extracting this particular candidate
// Limited size of the dictionary is taken into consideration // Limited size of the dictionary is taken into consideration
@@ -1548,31 +1550,34 @@ void DataSet::prepareOutput_packed(std::ostringstream &stream,
{ {
if (lastStr != LastStr::NONE) stream << std::endl; if (lastStr != LastStr::NONE) stream << std::endl;
// Output the label - as a comment
if (stringEntryList.type != ListType::DICTIONARY) if (stringEntryList.type != ListType::DICTIONARY)
{ {
stream << "\t// IDX__" << stringEntryList.list[idxString].alias << std::endl; stream << "\t// IDX__" << stringEntryList.list[idxString].alias << std::endl;
} }
if (!isCompressionLvl2(stringEntryList)) // Output the source string - as a comment
stream << "\t// '";
for (auto &character : stringEntryList.list[idxString].string)
{ {
stream << "\t// '"; if (character >= 32 && character <= 132 && character != 39 && character != 34)
for (auto &character : stringEntryList.list[idxString].string)
{ {
if (character >= 32 && character <= 132 && character != 39 && character != 34) stream << character;
{ }
stream << character; else if (character == 13)
} {
else if (character == 13) stream << "<return>";
{ }
stream << "<return>"; else
} {
else stream << "_";
{
stream << "_";
}
} }
stream << "'" << std::endl;
} }
stream << "'" << std::endl;
// Output the encoding
stream << "\t.byte "; stream << "\t.byte ";
@@ -1630,6 +1635,8 @@ void DataSet::prepareOutput()
const auto &stringEntryList = stringEntryLists[idx]; const auto &stringEntryList = stringEntryLists[idx];
const auto &stringEncodedList = stringEncodedLists[idx]; const auto &stringEncodedList = stringEncodedLists[idx];
if (stringEncodedList.empty()) continue;
// Export labels for the current list // Export labels for the current list
prepareOutput_labels(stream, stringEntryList, stringEncodedList); prepareOutput_labels(stream, stringEntryList, stringEncodedList);