See changelog 2000-07-24 22:00 GMT -3
This commit is contained in:
@@ -1,3 +1,24 @@
|
||||
2000-07-25 22:00 GMT -3 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
-contrib/hbzlib/zipfile1.C
|
||||
+contrib/hbzlib/zipfile.c
|
||||
*Renamed to match linux
|
||||
-contrib/hbzlib/makefile
|
||||
+contrib/hbzlib/Makefile
|
||||
*Renamed to match linux
|
||||
-contrib/hbzlib/zlibapi.c
|
||||
+contrib/hbzlib/zlibapi.c
|
||||
*Renamed to match linux
|
||||
*contrib/hbzlib/makefile.bc
|
||||
+Added tzipfile.prg reference and test2.exe reference
|
||||
+contrib/hbzlib/test2.prg
|
||||
*Test file for tzipfile Class
|
||||
+contrib/hbzlib/tzipfile.prg
|
||||
*Tzipfile Class
|
||||
+contrib/hbzlib/tzipfile.ch
|
||||
*Command for tZipClass
|
||||
*contrib/hbzlib/zipfile2.c
|
||||
*some enhacements to hb___GetFilesNamesFromZip()
|
||||
|
||||
2000-07-25 00:53 UTC+0100 Victor Szakats <info@szelvesz.hu>
|
||||
|
||||
* source/vm/itemapi.c
|
||||
|
||||
@@ -36,18 +36,26 @@
|
||||
|
||||
#ifndef HB_APIZLIB_H_
|
||||
#define HB_APIZLIB_H_
|
||||
#include "hbsetup.h"
|
||||
#include "hbapi.h"
|
||||
#include "hbapiitm.h"
|
||||
#include "hbapifs.h"
|
||||
#include "hbapigt.h"
|
||||
#include "hbvmpub.h"
|
||||
#include "hbvm.h"
|
||||
#include <hbsetup.h>
|
||||
#include <hbapi.h>
|
||||
#include <hbapiitm.h>
|
||||
#include <hbapifs.h>
|
||||
#include <hbapigt.h>
|
||||
#include <hbvmpub.h>
|
||||
#include <hbvm.h>
|
||||
#include "zip.h"
|
||||
#include "unzip.h"
|
||||
#if defined(HB_EXTERN_C)
|
||||
extern "C" {
|
||||
#endif
|
||||
#define filePos 1
|
||||
#define Lenght 2
|
||||
#define Method 3
|
||||
#define Size 4
|
||||
#define Ratio 5
|
||||
#define Date 6
|
||||
#define Time 7
|
||||
#define Crc32 8
|
||||
|
||||
extern uLong hb___filetime(char *f, tm_zip *tmzip, uLong *dt);
|
||||
extern char *hb___CheckFile( char * szFile);
|
||||
@@ -58,7 +66,7 @@ extern int hb___ExtractCurrentFile(unzFile uf,BOOL popt_extract_without_path,BOO
|
||||
extern void hb____ChangeFileDate(char *filename,uLong dosdate,tm_unz tmu_date);
|
||||
extern int hb___MakeDir(char *szNewDirectory);
|
||||
extern int hb___GetNumbersofFilestoUnzip(char *szFile);
|
||||
extern PHB_ITEM hb___GetFilesNamesFromZip(char *szFile);
|
||||
extern PHB_ITEM hb___GetFilesNamesFromZip(char *szFile,BOOL iMode);
|
||||
#if defined(HB_EXTERN_C)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -60,15 +60,20 @@ LDFLAGS = $(LDFLAGS)
|
||||
|
||||
ZLIB_LIB = $(LIB_DIR)\zlib.lib
|
||||
ZLIB_EXE = $(ZLIB_DIR)\test.exe
|
||||
ZLIB_EXE2 = $(ZLIB_DIR)\test2.exe
|
||||
ZLIB_BOR_DLL = $(ZLIB_DIR)\hbzlib.dll
|
||||
ZLIB_BOR_DEF = $(LIB_DIR)\zlib.def
|
||||
ZLIB_BOR_LIB = $(LIB_DIR)\zlib_bor.lib
|
||||
ZLIB_LIB_OBJS = \
|
||||
$(OBJ_DIR)\zipfile1.obj \
|
||||
$(OBJ_DIR)\zipfile2.obj \
|
||||
$(OBJ_DIR)\zlibapi.obj
|
||||
$(OBJ_DIR)\zlibapi.obj \
|
||||
$(OBJ_DIR)\tzipfile.obj
|
||||
ZLIB_EXE_OBJS = \
|
||||
$(OBJ_DIR)\test.obj
|
||||
ZLIB_EXE2_OBJS = \
|
||||
$(OBJ_DIR)\test2.obj
|
||||
|
||||
ZLIB_DEF_OBJ = $(ZLIB_DIR)\hbzlib.dll
|
||||
ZLIB_BOR_LIB_OBJ = $(LIB_DIR)\zlib.def
|
||||
|
||||
@@ -77,12 +82,13 @@ all: \
|
||||
$(ZLIB_BOR_DEF) \
|
||||
$(ZLIB_BOR_LIB) \
|
||||
$(ZLIB_EXE_OBJS) \
|
||||
$(ZLIB_EXE)
|
||||
|
||||
$(ZLIB_EXE2_OBJS) \
|
||||
$(ZLIB_EXE) \
|
||||
$(ZLIB_EXE2)
|
||||
$(ZLIB_LIB) = $(ZLIB_LIB_OBJS)
|
||||
|
||||
$(ZLIB_EXE) = $(ZLIB_EXE_OBJS)
|
||||
|
||||
$(ZLIB_EXE2) = $(ZLIB_EXE2_OBJS)
|
||||
$(ZLIB_BOR_DEF) = $(ZLIB_DEF_OBJ)
|
||||
|
||||
$(ZLIB_BOR_LIB) = $(ZLIB_BOR_LIB_OBJ)
|
||||
@@ -101,6 +107,12 @@ $(OBJ_DIR)\zlibapi.obj : $(ZLIB_DIR)\zlibapi.c
|
||||
$(CC) -c -v $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(ZLIB_LIB) $(ARFLAGS) -+$@,,
|
||||
|
||||
$(OBJ_DIR)\tzipfile.c : $(ZLIB_DIR)\tzipfile.prg
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
|
||||
|
||||
$(OBJ_DIR)\tzipfile.obj : $(OBJ_DIR)\tzipfile.c
|
||||
$(CC) -c $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(ZLIB_LIB) $(ARFLAGS) -+$@,,
|
||||
$(ZLIB_BOR_DEF) : $(ZLIB_DEF_OBJ)
|
||||
$(ID) $(LIB_DIR)\zlib.def $(ZLIB_DIR)\hbzlib.dll
|
||||
|
||||
@@ -136,3 +148,32 @@ $(OBJ_DIR)\test.obj : $(OBJ_DIR)\test.c
|
||||
$(CC) -c $(CLIBFLAGS) -o$@ $**
|
||||
|
||||
|
||||
$(ZLIB_EXE2) : $(ZLIB_EXE2_OBJS)
|
||||
|
||||
echo. $(CFLAGS) > make.tmp
|
||||
echo. -M -e$(ZLIB_EXE) >> make.tmp
|
||||
echo. -I$(INCLUDE_DIR) >> make.tmp
|
||||
echo. $(OBJ_DIR)\test2.obj >> make.tmp
|
||||
echo. $(SAMPLES_LIB) >> make.tmp
|
||||
echo. $(ZLIB_LIB) >> make.tmp
|
||||
echo. $(ZLIB_BOR_LIB) >> make.tmp
|
||||
echo. $(PP_LIB) >> make.tmp
|
||||
echo. $(COMMON_LIB) >> make.tmp
|
||||
echo. $(VM_LIB) >> make.tmp
|
||||
echo. $(RTL_LIB) >> make.tmp
|
||||
echo. $(HB_GT_LIB) >> make.tmp
|
||||
echo. $(LANG_LIB) >> make.tmp
|
||||
echo. $(RDD_LIB) >> make.tmp
|
||||
echo. $(MACRO_LIB) >> make.tmp
|
||||
echo. $(DBFNTX_LIB) >> make.tmp
|
||||
echo. $(DBFCDX_LIB) >> make.tmp
|
||||
$(CC) @make.tmp
|
||||
del make.tmp
|
||||
|
||||
$(OBJ_DIR)\test2.c : $(ZLIB_DIR)\test2.prg
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
|
||||
|
||||
$(OBJ_DIR)\test2.obj : $(OBJ_DIR)\test2.c
|
||||
$(CC) -c $(CLIBFLAGS) -o$@ $**
|
||||
|
||||
|
||||
|
||||
41
harbour/contrib/hbzlib/test2.prg
Normal file
41
harbour/contrib/hbzlib/test2.prg
Normal file
@@ -0,0 +1,41 @@
|
||||
#define B_BOXLINES "ÚÄ¿³ÙÄÀ³"
|
||||
#include 'tzipfile.ch'
|
||||
Function Main()
|
||||
Local aArray,x,oZip
|
||||
|
||||
local aDir:=Directory("*.h")
|
||||
local afiles:={}
|
||||
local nLen
|
||||
local aGauge
|
||||
CLS
|
||||
Create ZipFile oZip file "test9658.zip" BLOCK {|cFile| qOut(cFile)} COMPRESS
|
||||
For x:=1 to len(aDir)
|
||||
Add file adir[x,1] to oZip
|
||||
// aadd(afiles,adir[x,1])
|
||||
next
|
||||
Activate zip oZip
|
||||
?
|
||||
? "Number of Files in this Zipfile",oZip:GetNumberofFiles()
|
||||
/*
|
||||
nLen=len(afiles)
|
||||
aGauge := GaugeNew( 5, 5, 7,40 , "W/B", "W+/B" ,'²')
|
||||
GaugeDisplay( aGauge )
|
||||
Hb_ZIPFILE('test12.zip',afiles,8,{|cFile,nPos| GaugeUpdate(aGauge,nPos/nLen)})
|
||||
Hb_ZIPFILE('test22.zip',afiles,8,{|nPos,cFile| qout(cFile)})
|
||||
|
||||
hb_zipfile('test22.zip',{'data/','data/hbdoc.obj','data/genhtm.obj'},8)
|
||||
inkey(0)
|
||||
|
||||
local aGauge,nLen
|
||||
aGauge := GaugeNew( 5, 5, 7,40 , "W/B", "W+/B" ,'²')
|
||||
GaugeDisplay( aGauge )
|
||||
x:= HB_GETUNZIPFILE('test22.zip')
|
||||
? "number of files in zip",x
|
||||
aArray:=HB_GETFILESINZIP('test22.zip')
|
||||
for x:=1 to len(aArray)
|
||||
? aArray[x]
|
||||
next
|
||||
nlen:=HB_GETUNZIPFILE('test22.zip')
|
||||
hb_UNZIPFILE('test22.zip',{|cFile,nPos| GaugeUpdate(aGauge,nPos/nLen),qout(cFile)},.T.)
|
||||
*/
|
||||
RETURN nil
|
||||
9
harbour/contrib/hbzlib/tzipfile.ch
Normal file
9
harbour/contrib/hbzlib/tzipfile.ch
Normal file
@@ -0,0 +1,9 @@
|
||||
#xtranslate CREATE ZIPFILE <oZip> File <cFile> [METHOD <nMeth> ] [BLOCK <bBlock>] ;
|
||||
[<over: OVERWRITE>] [<comp:COMPRESS>] => ;
|
||||
<oZip> :=tZipFile():New(<cFile>,<nMeth>,<{bBlock}>,<.comp.>,<.over.>)
|
||||
#xtranslate ADD FILE <cFile> to <oZip> => <oZip>:AddFile(<cFile>)
|
||||
#xtranslate ACTIVATE ZIP <oZip> => <oZip>:DoCompress()
|
||||
#xtranslate ACTIVATE UNZIP <oZip> => <oZip>:DoUnzip()
|
||||
#xtranslate GET FILELIST <oZip> => <oZip>:Getlist()
|
||||
#xtranslate SHOW FILELIST <oZip> => <oZip>:ShowList()
|
||||
|
||||
99
harbour/contrib/hbzlib/tzipfile.prg
Normal file
99
harbour/contrib/hbzlib/tzipfile.prg
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Tzipfile Class
|
||||
*
|
||||
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include 'hbclass.ch'
|
||||
#include 'common.ch'
|
||||
|
||||
CLASS tZipFile
|
||||
data cFile as CHARACTER init ""
|
||||
Data aFiles as ARRAY init {}
|
||||
Data aList as ARRAY init {}
|
||||
Data bBlock as CODEBLOCK init {||NIL}
|
||||
Data lOverwrite as LOGICAL init .f.
|
||||
Data nCompMethod as NUMERIC init 8
|
||||
Method New(cFile,nMethod,bBlock,lCompress,lOverwrite)
|
||||
Method DoCompress()
|
||||
Method DoUnzip()
|
||||
method AddFile(cFile)
|
||||
Method GetNumberofFiles()
|
||||
Method GetList()
|
||||
Method ShowList()
|
||||
ENDCLASS
|
||||
Method New(cFile,nMethod,bBlock,lCompress,lOverwrite) CLASS tZipFile
|
||||
default lCompress to .t.
|
||||
Default lOverWrite to .T.
|
||||
if lCompress
|
||||
Default nMethod to 8
|
||||
Endif
|
||||
::cFile := cFile
|
||||
::nCompMethod := nMethod
|
||||
::lOverWrite := lOverWrite
|
||||
::aFiles := {}
|
||||
::bBlock := bBlock
|
||||
return Self
|
||||
Method AddFile(cFile) CLASS tZipFile
|
||||
if cFile != NIL
|
||||
aadd(::aFiles,cFile)
|
||||
endif
|
||||
return Self
|
||||
|
||||
Method GetList() CLASS tZipFile
|
||||
::aList := {}
|
||||
::aList := HB_GETFILESINZIP(::cFile)
|
||||
return Self
|
||||
Method ShowList() CLASS tZipFile
|
||||
local x
|
||||
For x:=1 to len(::aList)
|
||||
qout(::aList[x])
|
||||
next
|
||||
return Self
|
||||
|
||||
Method GetNumberofFiles() CLASS tZipFile
|
||||
Local nFiles
|
||||
nFiles:=HB_GETUNZIPFILE(::cFile)
|
||||
return nFiles
|
||||
|
||||
Method doCompress() CLASS tZipFile
|
||||
if HB_ZIPFILE(::cFile,::aFiles, ::nCompMethod,::bBlock,::lOverWrite)
|
||||
Return .T.
|
||||
endif
|
||||
Return .F.
|
||||
|
||||
Method DoUnzip() CLASS tZipFile
|
||||
IF HB_UNZIPFILE(::cFile,::bBlock,1)
|
||||
Return .t.
|
||||
endif
|
||||
return .f.
|
||||
Reference in New Issue
Block a user