mirror of
https://github.com/Kiritow/OpenComputerScripts.git
synced 2024-03-22 13:10:46 +08:00
remove debug outputs
This commit is contained in:
parent
0249584133
commit
01ee8127b9
|
@ -1,4 +1,4 @@
|
||||||
-- LibComp
|
-- LibCompress
|
||||||
-- Another version of libhuffman for general purpose
|
-- Another version of libhuffman for general purpose
|
||||||
-- Created by Kiritow
|
-- Created by Kiritow
|
||||||
-- Use Lua 5.3 feature
|
-- Use Lua 5.3 feature
|
||||||
|
@ -12,7 +12,6 @@ local BitWriter
|
||||||
BitWriter={
|
BitWriter={
|
||||||
_newobj_mt={
|
_newobj_mt={
|
||||||
["__index"]=function(tb,key)
|
["__index"]=function(tb,key)
|
||||||
-- print("BitWriter.__index called: ",tb,key)
|
|
||||||
if(type(key)=="string" and key~="new" and key:sub(1,1)~="_") then
|
if(type(key)=="string" and key~="new" and key:sub(1,1)~="_") then
|
||||||
return BitWriter[key]
|
return BitWriter[key]
|
||||||
end
|
end
|
||||||
|
@ -95,8 +94,6 @@ BitReader={
|
||||||
},
|
},
|
||||||
|
|
||||||
new=function(in_buffer,in_padlen)
|
new=function(in_buffer,in_padlen)
|
||||||
print("BitReader created: buffer len ",in_buffer:len()," pad len",in_padlen)
|
|
||||||
|
|
||||||
local this={}
|
local this={}
|
||||||
this.buffer=in_buffer
|
this.buffer=in_buffer
|
||||||
this.padlen=in_padlen
|
this.padlen=in_padlen
|
||||||
|
@ -125,7 +122,6 @@ BitReader={
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
this.cached=this.cached-1
|
this.cached=this.cached-1
|
||||||
return (this.working & ( 1 << (this.cached) )) > 0 and 1 or 0
|
return (this.working & ( 1 << (this.cached) )) > 0 and 1 or 0
|
||||||
end,
|
end,
|
||||||
|
@ -150,8 +146,6 @@ BitReader={
|
||||||
-- "A" --> 65 --> 0x41 --> "01000001"
|
-- "A" --> 65 --> 0x41 --> "01000001"
|
||||||
local function charToBitStr(c)
|
local function charToBitStr(c)
|
||||||
local n=c:byte(1)
|
local n=c:byte(1)
|
||||||
-- print("charToBitStr: ",c,n)
|
|
||||||
|
|
||||||
local vtb={
|
local vtb={
|
||||||
"0001","0010","0011","0100",
|
"0001","0010","0011","0100",
|
||||||
"0101","0110","0111","1000",
|
"0101","0110","0111","1000",
|
||||||
|
@ -198,7 +192,6 @@ local function hdef(data)
|
||||||
writer:pushbit(1)
|
writer:pushbit(1)
|
||||||
writer:pushbits(charToBitStr(node[1]))
|
writer:pushbits(charToBitStr(node[1]))
|
||||||
dic[node[1]]=prefix
|
dic[node[1]]=prefix
|
||||||
print(node[1] .. " --> " .. prefix)
|
|
||||||
else
|
else
|
||||||
writer:pushbit(0)
|
writer:pushbit(0)
|
||||||
if(node.L) then
|
if(node.L) then
|
||||||
|
@ -232,7 +225,6 @@ local function hinf(data)
|
||||||
local flag=reader:nextbit()
|
local flag=reader:nextbit()
|
||||||
if(flag==1) then
|
if(flag==1) then
|
||||||
xdic[prefix]=reader:nextchar()
|
xdic[prefix]=reader:nextchar()
|
||||||
print(prefix .. " --> " .. xdic[prefix])
|
|
||||||
else
|
else
|
||||||
_decode_tree(prefix .. "0")
|
_decode_tree(prefix .. "0")
|
||||||
_decode_tree(prefix .. "1")
|
_decode_tree(prefix .. "1")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user