Hello, me again !
I need a data compressor.
I try to use JCALG1.
I try to make a wrap to his DLL but that crash.
The function getinfo work.
The dll is downloadable here : http://www.CollakeSoftware.com (http://www.CollakeSoftware.com)
Someone can help ??
$use "jcalg1.lib"
type JCALG1_Info
def MajorRev : INT
def MinorRev : Int
def FastDecompressorSize: Int
def SmallDecompressorSize: Int
ENDTYPE
DECLARE IMPORT, JCALG1_GetInfo(Info as JCALG1_Info)
declare IMPORT, JCALG1_Compress(Source: Pointer, Length: Int, Destination: Pointer, WindowSize: Int, Allocm:pointer, Deallocm:pointer, Callback:pointer, bDisableChecksum: Int),Int
DECLARE IMPORT, JCALG1_Decompress_Fast(Source:pointer, Destination: Pointer),Int
declare AllocFunc(size:word),pointer
declare DeallocFunc(mymem:pointer)
declare CallbackFunc(source:word,dest:word),INT
'
sub AllocFunc(size:word),pointer
DEF mymem as pointer
mymem=new(word,size)
return mymem
ENDSUB
'
sub DeallocFunc(mymem as pointer)
delete mymem
ENDSUB
'
sub CallbackFunc(source:word,dest: word),INT
return true
ENDSUB
'
def info :jcalg1_info
OPENCONSOLE
'jcalg1_getinfo(info)
'print info.majorrev
'print info.minorrev
'
def f :string
f=getstartpath+"test.xls"
'
def myfile :bfile
def sz:INT
DEF buf,dest:pointer
if OPENFILE(myfile,f,"R")=0
sz=len(myfile)
buf=new(word,sz)
read(myfile,buf)
CLOSEFILE myfile
'
dest=new(word,sz+4)
'
JCALG1_Compress(buf, sz, Dest, 1024, &allocfunc, &deallocfunc, &callbackfunc, 0)
'
delete buf
delete dest
'
ENDIF
'
WAITCON
CLOSECONSOLE
END
Hello,
Here is the portage to JCALG1.dll for EB.
What is JCALG1 ? :
Quote
Synopsis
JCALG1 is a small, open-source, LZSS derived compression library.
Features
Coded in 100% 32bit x86 assembly language for maximum performance and minimum size.
Good compression ratio, typically much better than ZIP's deflate.
Extremely small and fast decompressor.
Adjustable window size to allow for faster compression at the cost of compression ratio.
Decompression requires no memory, other than the destination buffer.
Easy integration with any application.
Free!
All is in the zip file : jcalg1.eba, jcalg1.dll and jcalg1.lib to include in the libs dir of EB.
Warning : for testing the source, fill correct path and file name for file compress/decompress.
It works ok.
i used it on a mp3 file and it compressed it quite fast.