made newer installer that does not require tar stuff
This commit is contained in:
1 parent
df62414229
commit
7deefc83ca
107 files changed
+648
-353
No files matched your search
@@ -0,0 +1 @@
|
||||
local a;do local b="1.0.0-release"local c="LibDeflate "..b.." Copyright (C) 2018 Haoqian He.".." License GPLv3+: GNU GPL version 3 or later"if LibStub then local d,e="LibDeflate",-1;local f,g=LibStub:GetLibrary(d,true)if f and g and g>=e then return f else a=LibStub:NewLibrary(d,b)end else a={}end;a._VERSION=b;a._COPYRIGHT=c end;local assert=assert;local error=error;local pairs=pairs;local h=string.byte;local i=string.char;local j=string.find;local k=string.gsub;local l=string.sub;local m=table.concat;local n=table.sort;local tostring=tostring;local type=type;local o={}local p={}local q={}local r={}local s={}local t={}local u={}local v={}local w={}local x={3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258}local y={0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}local z={[0]=1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577}local A={[0]=0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}local B={16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}local C;local D;local E;local F;local G;local H;local I;local J;for K=0,255 do p[K]=i(K)end;do local L=1;for K=0,32 do o[K]=L;L=L*2 end end;for K=1,9 do q[K]={}for M=0,o[K+1]-1 do local N=0;local O=M;for P=1,K do N=N-N%2+((N%2==1 or O%2==1)and 1 or 0)O=(O-O%2)/2;N=N*2 end;q[K][M]=(N-N%2)/2 end end;do local Q=18;local R=16;local S=265;local T=1;for U=3,258 do if U<=10 then r[U]=U+254;t[U]=0 elseif U==258 then r[U]=285;t[U]=0 else if U>Q then Q=Q+R;R=R*2;S=S+4;T=T+1 end;local V=U-Q-1+R/2;r[U]=(V-V%(R/8))/(R/8)+S;t[U]=T;s[U]=V%(R/8)end end end;do u[1]=0;u[2]=1;w[1]=0;w[2]=0;local Q=3;local R=4;local W=2;local T=0;for X=3,256 do if X>R then Q=Q*2;R=R*2;W=W+2;T=T+1 end;u[X]=X<=Q and W or W+1;w[X]=T<0 and 0 or T;if R>=8 then v[X]=(X-R/2-1)%(R/4)end end end;local Y,Z,_,a0,a1;if bit~=nil then Y=bit.band;Z=bit.bnot;_=bit.bxor;a0=bit.blshift;a1=bit.blogic_rshift elseif bit32~=nil then Y=bit32.band;Z=bit32.bnot;_=bit32.bxor;a0=bit32.lshift;a1=bit32.rshift else _=function(Q,R)local a2=0;for K=32,0,-1 do local a3=2^K;local a4=false;local a5=false;if Q==0 then a2=a2+R;break end;if R==0 then a2=a2+Q;break end;if Q>=a3 then a4=true;Q=Q-a3 end;if R>=a3 then a5=true;R=R-a3 end;if not(a4 and a5)and(a4 or a5)then a2=a2+a3 end end;return a2 end;a0=function(a6,a7)local a8=a6*2^a7;return a8%2^32 end;a1=function(a6,a9)local a8=a6/2^a9;return math.floor(a8)end;Y=function(Q,R)local aa,S=1,0;while Q>0 and R>0 do local ab,ac=Q%2,R%2;if ab+ac>1 then S=S+aa end;Q,R,aa=(Q-ab)/2,(R-ac)/2,aa*2 end;return S end;Z=function(ad)return bxor(ad,2^(bits or floor(log(ad,2)))-1)end end;local ae=0xEDB88320;local function af(ag)local ah={}local V=setmetatable({},ah)function ah:__index(ai)local aj=ag(ai)V[ai]=aj;return aj end;return V end;local ak=af(function(K)local al=K;for P=1,8 do local R=Y(al,1)al=a1(al,1)if R==1 then al=_(al,ae)end end;return al end)local function am(an,al)al=Z(al or 0)local ao=a1(al,8)local ap=ak[_(al%256,an)]return Z(_(ao,ap))end;local function aq(ar,al)al=al or 0;for K=1,#ar do al=am(ar:byte(K),al)end;return al end;function a:CRC32(ar,al)if type(ar)=='string'then return aq(ar,al)else return am(ar,al)end end;function a:Adler32(as)if type(as)~="string"then error(("Usage: LibDeflate:Adler32(str):".." 'str' - string expected got '%s'."):format(type(as)),2)end;local at=#as;local K=1;local Q=1;local R=0;while K<=at-15 do local au,av,aw,ax,ay,az,aA,aB,aC,aD,aE,aF,aG,aH,aI,aJ=h(as,K,K+15)R=(R+16*Q+16*au+15*av+14*aw+13*ax+12*ay+11*az+10*aA+9*aB+8*aC+7*aD+6*aE+5*aF+4*aG+3*aH+2*aI+aJ)%65521;Q=(Q+au+av+aw+ax+ay+az+aA+aB+aC+aD+aE+aF+aG+aH+aI+aJ)%65521;K=K+16 end;while K<=at do local ad=h(as,K,K)Q=(Q+ad)%65521;R=(R+Q)%65521;K=K+1 end;return(R*65536+Q)%4294967296 end;local function aK(aL,aM)return aL%4294967296==aM%4294967296 end;function a:CreateDictionary(as,at,aN)if type(as)~="string"then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." 'str' - string expected got '%s'."):format(type(as)),2)end;if type(at)~="number"then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." 'strlen' - number expected got '%s'."):format(type(at)),2)end;if type(aN)~="number"then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." 'adler32' - number expected got '%s'."):format(type(aN)),2)end;if at~=#as then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." 'strlen' does not match the actual length of 'str'.".." 'strlen': %u, '#str': %u .".." Please check if 'str' is modified unintentionally."):format(at,#as))end;if at==0 then error("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." 'str' - Empty string is not allowed.",2)end;if at>32768 then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".." 'str' - string longer than 32768 bytes is not allowed.".." Got %d bytes."):format(at),2)end;local aO=self:Adler32(as)if not aK(aN,aO)then error(("Usage: LibDeflate:CreateDictionary(str, strlen, adler32):".Line truncated
|
||||
@@ -0,0 +1,9 @@
|
||||
local deflate=require("LibDeflate")
|
||||
local lib={}
|
||||
lib.compress=function(data)
|
||||
return deflate:CompressDeflate(data)
|
||||
end
|
||||
lib.decompress=function(data)
|
||||
return deflate:DecompressDeflate(data)
|
||||
end
|
||||
return lib
|
||||
Reference in new issue
Block a user