git-svn-id: svn://ultimatepp.org/upp/trunk@11155 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2017-06-11 07:30:46 +00:00
parent b833a3a94b
commit 4f099403d9

View file

@ -8,6 +8,31 @@ void Delta(Vector<dword>& data)
data[i] -= data[i - 1] - 127;
}
String Encode(const Vector<dword>& data)
{
DDUMP(data.GetCount());
String r;
dword prev = 0;
int l = 0;
for(dword v : data) {
dword val = v - prev + 127;
if(val < 255)
r.Cat(val);
else {
r.Cat(255);
r.Cat(val);
r.Cat(val >> 8);
r.Cat(val >> 16);
r.Cat(val >> 24);
l++;
}
prev = v;
}
DDUMP(l);
DDUMP(r.GetCount());
return r;
}
CONSOLE_APP_MAIN
{
FileIn in(GetDataFile("UnicodeData.txt"));
@ -16,25 +41,42 @@ CONSOLE_APP_MAIN
Vector<String> h = Split(in.GetLine(), ';', false);
if(h.GetCount() > 14) {
dword cde = ScanInt(h[0], NULL, 16);
DDUMPC(h);
Vector<String> comb;
comb.AppendRange(FilterRange(Split(h[5], ' '), [] (const String& x) { return x[0] != '<'; }));
if(comb.GetCount() > 1) {
DLOG(h[0] << " -> " << comb[0] << ' ' << comb[1]);
// DLOG(h[0] << " -> " << comb[0] << ' ' << comb[1]);
code.Add(cde);
comb1.Add(ScanInt(comb[0], NULL, 16));
comb2.Add(ScanInt(comb[0], NULL, 16));
comb2.Add(ScanInt(comb[1], NULL, 16));
}
dword other = Nvl(ScanInt(Nvl(h[12], h[13]), NULL, 16));
if(other) {
DUMP(other);
DUMP(h);
// DUMP(other);
// DUMP(h);
ercode.Add(cde);
er.Add(other);
}
}
}
DDUMP(code.GetCount());
String h = Encode(code);
DDUMP(h.GetCount());
// DUMPHEX(h);
h << Encode(comb1);
DDUMP(h.GetCount());
// DUMPHEX(h);
h << Encode(comb2);
DDUMP(h.GetCount());
DUMPHEX(h);
DDUMP(ZCompress(h).GetCount());
DDUMP(FastCompress(h).GetCount());
#if 0
Delta(code);
Delta(comb1);
Delta(comb2);
@ -65,4 +107,5 @@ CONSOLE_APP_MAIN
DUMP(h.GetCount());
DUMP(ZCompress(h).GetCount());
}
#endif
}