maybe this can be useful for pb 5.11, on windows 32 :
Code: Select all
;
;mar 2013 - DrGolf/Zaphod
;
;JCALG1 r5.xx
;(c)1999-2011 Jeremy Collake
;http://www.bitsum.com
;
EnableExplicit
;
Structure JCALG1_Info
MajorRev.i
MinorRev.i
FastDecompressorSize.i
SmallDecompressorSize.i
EndStructure
;
Import "jcalg1_static.lib"
JCALG1_GetInfo(*info)
JCALG1_Compress.i(*Source, jLength.i, *Destination, WindowSize.i, *Allocm, *Deallocm, *jCallback, bDisableChecksum.i)
JCALG1_GetNeededBufferSize.i(nSize.i)
JCALG1_Decompress_Fast.i(*Source, *Destination)
JCALG1_Decompress_Small.i(*Source, *Destination)
JCALG1_GetUncompressedSizeOfCompressedBlock.i(*pBlock)
EndImport
;
;////////////////////////
;JCALG functions
Procedure.i AllocFunc(sze.i)
ProcedureReturn AllocateMemory(sze)
EndProcedure
;
Procedure.i DeallocFunc(*pbuffer)
If *pbuffer
FreeMemory(*pbuffer)
EndIf
ProcedureReturn #True
EndProcedure
;
Procedure.i CallbackFunc(source.i, dest.i)
;false stop / true continue
ProcedureReturn #True
EndProcedure
;////////////////////////
;
;=========================
;infos
Define info.jcalg1_info
jcalg1_getinfo(info)
Debug Str(info\MajorRev)+"."+Str(info\MinorRev)
;
;=========================
;compress
Define.s f,g
;>>>>>>>>>>>>>>>>>>>>fill correct file name
f="aaaa.xls"
g=f+".pak"
Debug CRC32FileFingerprint(f)
;
Define.i sz,dz,rez
Define *buf,*cmp
If OpenFile(0,f)<>0
sz=Lof(0)
*buf=AllocateMemory(sz)
ReadData(0,*buf,sz)
CloseFile(0)
;
dz=JCALG1_GetNeededBufferSize(*buf)
*cmp=AllocateMemory(dz)
;
rez=JCALG1_Compress(*buf, sz, *cmp, 1024, @allocfunc(), @deallocfunc(), @callbackfunc(), #True)
FreeMemory(*buf)
;
If rez<>0
If OpenFile(0,g)<>0
WriteData(0,*cmp,rez)
CloseFile(0)
Debug "compress done"
EndIf
;
EndIf
FreeMemory(*cmp)
;
EndIf
;
;=========================
;uncompress
;>>>>>>>>>>>>>>>>>>>>>>>>>fill correct file name
f="aaaa.xls.pak"
g="aaaad.xls"
;
If OpenFile(0,f)<>0
sz=Lof(0)
*buf=AllocateMemory(sz)
ReadData(0,*buf,sz)
CloseFile(0)
;
rez=JCALG1_GetUncompressedSizeOfCompressedBlock(*buf)
*cmp=AllocateMemory(rez)
;
dz=JCALG1_Decompress_Fast(*buf, *cmp)
FreeMemory(*buf)
;
If dz<>0
If OpenFile(0,g)<>0
WriteData(0,*cmp,dz)
CloseFile(0)
Debug"decompress done"
Debug CRC32FileFingerprint(g)
EndIf
EndIf
FreeMemory(*cmp)
;
EndIf