From 0db4a5e0d45709a9c5d8d19f9e234221197bf3bb Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 23 Jun 2008 12:11:35 +0000 Subject: [PATCH] 2008-06-23 14:08 UTC+0200 Viktor Szakats (harbour.01 syenar hu) - hbziparch/make_b32_dll.bat - hbziparch/make_b32_dll.mak - hbziparch/doc * hbziparch/Makefile * hbziparch/common.mak * hbziparch/hbziparc.c * hbziparch/hbziparc.h - hbziparch/zipcomp.cpp + hbziparch/hbzipcom.cpp - hbziparch/zipnew.cpp + hbziparch/hbzipnew.cpp - Docs integrated into source. - Removed .dll building batch files (highly redundant, non-maintained and probably non-working), so now the make system is fully standard. If .dll generation is that important, we will have to add it to the central contrib make files, so that we can use it for all contribs. * Renamed some files so separate ZipArch and Harbour parts. * Cleanups, renames (statics, globals), warning fixes, deleted unneeded stuff, some functions made static. ; This is still a mess. ; NOTE: Since there is no sample or test program, neither do I use this contrib, I couldn't test any of these changes. Please test. (if you have test code, upload it to hbziparch/tests) --- harbour/ChangeLog | 28 + harbour/contrib/hbziparch/Makefile | 5 +- harbour/contrib/hbziparch/common.mak | 4 +- harbour/contrib/hbziparch/doc/zipnew.txt | 728 ---------------- harbour/contrib/hbziparch/hbziparc.c | 805 ++++++++++++++++-- harbour/contrib/hbziparch/hbziparc.h | 79 +- .../hbziparch/{zipcomp.cpp => hbzipcom.cpp} | 88 +- .../hbziparch/{zipnew.cpp => hbzipnew.cpp} | 120 +-- harbour/contrib/hbziparch/make_b32_dll.bat | 43 - harbour/contrib/hbziparch/make_b32_dll.mak | 187 ---- 10 files changed, 891 insertions(+), 1196 deletions(-) delete mode 100644 harbour/contrib/hbziparch/doc/zipnew.txt rename harbour/contrib/hbziparch/{zipcomp.cpp => hbzipcom.cpp} (89%) rename harbour/contrib/hbziparch/{zipnew.cpp => hbzipnew.cpp} (93%) delete mode 100644 harbour/contrib/hbziparch/make_b32_dll.bat delete mode 100644 harbour/contrib/hbziparch/make_b32_dll.mak diff --git a/harbour/ChangeLog b/harbour/ChangeLog index af443b15f8..56d9a12924 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,34 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-06-23 14:08 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + - hbziparch/make_b32_dll.bat + - hbziparch/make_b32_dll.mak + - hbziparch/doc + * hbziparch/Makefile + * hbziparch/common.mak + * hbziparch/hbziparc.c + * hbziparch/hbziparc.h + - hbziparch/zipcomp.cpp + + hbziparch/hbzipcom.cpp + - hbziparch/zipnew.cpp + + hbziparch/hbzipnew.cpp + - Docs integrated into source. + - Removed .dll building batch files (highly redundant, + non-maintained and probably non-working), so now the make + system is fully standard. If .dll generation is that + important, we will have to add it to the central + contrib make files, so that we can use it for + all contribs. + * Renamed some files so separate ZipArch and Harbour parts. + * Cleanups, renames (statics, globals), warning fixes, + deleted unneeded stuff, some functions made static. + ; This is still a mess. + ; NOTE: Since there is no sample or test program, neither + do I use this contrib, I couldn't test any of these + changes. Please test. + (if you have test code, upload it to hbziparch/tests) + 2008-06-23 10:45 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/hbziparch/make_b32_dll.mak * contrib/hbziparch/make_b32.bat diff --git a/harbour/contrib/hbziparch/Makefile b/harbour/contrib/hbziparch/Makefile index 57e523d9cf..2a6166149d 100644 --- a/harbour/contrib/hbziparch/Makefile +++ b/harbour/contrib/hbziparch/Makefile @@ -11,17 +11,18 @@ C_SOURCES = \ hbcomprs.c \ CPP_SOURCES = \ + hbzipnew.cpp \ + hbzipcom.cpp \ + / stdafx.cpp \ ziparchive.cpp \ zipautobuffer.cpp \ zipcentraldir.cpp \ - zipcomp.cpp \ zipcompatibility.cpp \ zipexception.cpp \ zipfile.cpp \ zipfileheader.cpp \ zipmemfile.cpp \ - zipnew.cpp \ zipplatformcomm.cpp \ zipstorage.cpp \ ZipString.cpp diff --git a/harbour/contrib/hbziparch/common.mak b/harbour/contrib/hbziparch/common.mak index a2ea6cd7a3..0cfdefc1d5 100644 --- a/harbour/contrib/hbziparch/common.mak +++ b/harbour/contrib/hbziparch/common.mak @@ -8,6 +8,8 @@ LIB_PATH = $(LIB_DIR)$(LIBNAME)$(LIBEXT) LIB_OBJS = \ $(OBJ_DIR)hbziparc$(OBJEXT) \ + $(OBJ_DIR)hbzipnew$(OBJEXT) \ + $(OBJ_DIR)hbzipcom$(OBJEXT) \ $(OBJ_DIR)hbcomprs$(OBJEXT) \ $(OBJ_DIR)ziparchive$(OBJEXT) \ $(OBJ_DIR)ZipPlatform_win$(OBJEXT) \ @@ -18,8 +20,6 @@ LIB_OBJS = \ $(OBJ_DIR)zipmemfile$(OBJEXT) \ $(OBJ_DIR)zipfileheader$(OBJEXT) \ $(OBJ_DIR)zipfile$(OBJEXT) \ - $(OBJ_DIR)zipnew$(OBJEXT) \ - $(OBJ_DIR)zipcomp$(OBJEXT) \ $(OBJ_DIR)zipexception$(OBJEXT) \ $(OBJ_DIR)zipcompatibility$(OBJEXT) \ $(OBJ_DIR)zipcentraldir$(OBJEXT) \ diff --git a/harbour/contrib/hbziparch/doc/zipnew.txt b/harbour/contrib/hbziparch/doc/zipnew.txt deleted file mode 100644 index 558b3c3d27..0000000000 --- a/harbour/contrib/hbziparch/doc/zipnew.txt +++ /dev/null @@ -1,728 +0,0 @@ -/* - * $DOC$ - * $FUNCNAME$ - * HB_ZIPFILE() - * $CATEGORY$ - * Zip Functions - * $ONELINER$ - * Create a zip file - * $SYNTAX$ - * HB_ZIPFILE( , | , , - * , , , , , - * ) ---> lCompress - * $ARGUMENTS$ - * Name of the zip file to create - * - * Name of a file to Compress, Drive and/or path - * can be used - * _or_ - * An array containing files to compress, Drive and/or path - * can be used - * - * Compression level ranging from 0 to 9 - * - * Code block to execute while compressing - * - * Toggle to overwrite the file if exists - * - * Password to encrypt the files - * - * Toggle to store the path or not - * - * Toggle to store the Drive letter and path or not - * - * Code block for File Progress - * $RETURNS$ - * .t. if file was create, otherwise .f. - * $DESCRIPTION$ - * This function creates a zip file named . If the extension - * is omitted, .ZIP will be assumed. If the second parameter is a - * character string, this file will be added to the zip file. If the - * second parameter is an array, all file names contained in - * will be compressed. - * - * If is used, it determines the compression type where 0 means - * no compression and 9 means best compression. - * - * If is used, every time the file is opened to compress it - * will evaluate bBlock. Parameters of bBlock are cFile and nPos. - * - * If is used, it toggles to overwrite or not the existing - * file. Default is to overwrite the file,otherwise if is false - * the new files are added to the . - * - * If is used, all files that are added to the archive are encrypted - * with the password. - * - * If is used, it tells the path should also be stored with - * the file name. Default is false. - * - * If is used, it tells thats the Drive and path should also be stored - * with the file name. Default is false. - * - * If is used, an Code block is evaluated, showing the total - * of that file has being processed. - * The codeblock must be defined as follow {|nPos,nTotal| GaugeUpdate(aGauge1,(nPos/nTotal))} - * - * $EXAMPLES$ - * FUNCTION MAIN() - * - * IF HB_ZIPFILE( "TEST.ZIP", "TEST.PRG" ) - * qout( "File was successfully created" ) - * ENDIF - * - * IF HB_ZIPFILE( "TEST1.ZIP", { "TEST.PRG", "c:\windows\win.ini" } ) - * qout( "File was successfully created" ) - * ENDIF - * - * IF HB_ZIPFILE( "TEST2.ZIP", { "TEST.PRG", "c:\windows\win.ini" }, 9, {|cFile,nPos,| qout(cFile) } ) - * qout( "File was successfully created" ) - * ENDIF - * - * aFiles := { "TEST.PRG", "c:\windows\win.ini" } - * nLen := Len( aFiles ) - * aGauge := GaugeNew( 5, 5, 7, 40, "W/B", "W+/B" , "²" ) - * GaugeDisplay( aGauge ) - * HB_ZIPFILE( "test33.zip", aFiles, 9, {|cFile,nPos| GaugeUpdate( aGauge, nPos/nLen ) },, "hello" ) - * Return Nil - * $STATUS$ - * R - * $COMPLIANCE$ - * This function is a Harbour extension - * $PLATFORMS$ - * All - * $FILES$ - * Library is hbzip.lib - * $END$ - */ - -/* - * $DOC$ - * $FUNCNAME$ - * HB_UNZIPFILE() - * $CATEGORY$ - * Zip Functions - * $ONELINER$ - * Unzip a compressed file - * $SYNTAX$ - * HB_UNZIPFILE( , , , , , - * | , ) ---> lCompress - * $ARGUMENTS$ - * Name of the zip file to extract - * - * Code block to execute while extracting - * - * Toggle to create directory if needed - * - * Password to use to extract files - * - * Path to extract the files to - mandatory - * - * | A File or Array of files to extract - mandatory - * - * Code block for File Progress - * $RETURNS$ - * .t. if all file was successfully restored, otherwise .f. - * $DESCRIPTION$ - * This function restores all files contained inside the . - * If the extension is omitted, .ZIP will be assumed. If a file already - * exists, it will be overwritten. - * - * If is used, every time the file is opened to compress it - * will evaluate bBlock. Parameters of bBlock are cFile and nPos. - * - * The is a mandatory parameter. Set to ".\" to extract to the - * current directory - * - * If or are not provided, no files will be extracted! - * Make sure you provide the file or files you want extracted - * - * If is used, an Code block is evaluated, showing the total - * of that file has being processed. - * The codeblock must be defined as follow {|nPos,nTotal| GaugeUpdate(aGauge1,(nPos/nTotal))} - * $EXAMPLES$ - * FUNCTION MAIN() - * - * aExtract := hb_GetFilesInZip( "TEST.ZIP" ) // extract all files in zip - * IF HB_UNZIPFILE( "TEST.ZIP",,,, ".\", aExtract ) - * qout("File was successfully extracted") - * ENDIF - * - * aExtract := hb_GetFilesInZip( "TEST2.ZIP" ) // extract all files in zip - * IF HB_UNZIPFILE( "TEST2.ZIP", {|cFile| qout( cFile ) },,, ".\", aExtract ) - * qout("File was successfully extracted") - * ENDIF - * Return Nil - * $STATUS$ - * R - * $COMPLIANCE$ - * This function is a Harbour extension - * $PLATFORMS$ - * All - * $FILES$ - * Library is hbzip.lib - * $END$ - */ - -/* - * $DOC$ - * $FUNCNAME$ - * HB_GETUNZIPFILE() - * $CATEGORY$ - * Zip Functions - * $ONELINER$ - * Gets the number of files that are in the zipfile - * $SYNTAX$ - * HB_GETUNZIPFILE( ) ---> nNumber - * $ARGUMENTS$ - * Name of the zip file - * $RETURNS$ - * The number of files contained inside the zipfile - * $DESCRIPTION$ - * This function returns the number of files that is stored in the zipfile. - * The purpose for this function is to use in conjunction with the - * HB_UNZIPFILE() function, so you can use returned result in the code - * block. See example below. - * $EXAMPLES$ - * FUNCTION MAIN() - * Local nFiles := HB_GETUNZIPFILE( "test.zip" ) - * - * if nFiles > 0 - * ? "This files Contains ", nfiles - * endif - * - * Return Nil - * - * Here is an example of How to use HB_GETUNZIPFILE() in conjunction - * with HB_UNZIPFILE() - * - * Function Main() - * Local aGauge, nLen - * - * aGauge := GaugeNew( 5, 5, 7, 40, "W/B", "W+/B" ,"²" ) - * GaugeDisplay( aGauge ) - * nLen := HB_GETUNZIPFILE( "test22" ) - * HB_UNZIPFILE( "test22", {|cFile,nPos| GaugeUpdate( aGauge, nPos/nLen ), qout(cFile) }, .t. ) - * Return Nil - * $STATUS$ - * R - * $COMPLIANCE$ - * This function is a Harbour extension - * $PLATFORMS$ - * All - * $FILES$ - * Library is hbzip.lib - * $END$ - */ - -/* - * $DOC$ - * $FUNCNAME$ - * HB_ZIPFILEBYTDSPAN() - * $CATEGORY$ - * Zip Functions - * $ONELINER$ - * Create a zip file - * $SYNTAX$ - * HB_ZIPFILEBYTDSPAN( , | , , - * , , , , , , - * ) ---> lCompress - * $ARGUMENTS$ - * Name of the zip file - * - * Name of a file to Compress, Drive and/or path - * can be used - * _or_ - * An array containing files to compress, Drive and/or path - * can be used - * - * Compression level ranging from 0 to 9 - * - * Code block to execute while compressing - * - * Toggle to overwrite the file if exists - * - * Password to encrypt the files - * - * Size of the archive, in bytes. Default is 1457664 bytes - * - * Toggle to store the path or not - * - * Toggle to store the Drive letter and path or not - * - * Code block for File Progress - * $RETURNS$ - * .t. if file was create, otherwise .f. - * $DESCRIPTION$ - * This function creates a zip file named . If the extension - * is omitted, .ZIP will be assumed. If the second parameter is a - * character string, this file will be added to the zip file. If the - * second parameter is an array, all file names contained in - * will be compressed. - * - * If is used, it determines the compression type where 0 means - * no compression and 9 means best compression. - * - * If is used, every time the file is opened to compress it - * will evaluate bBlock. Parameters of bBlock are cFile and nPos. - * - * If is used, it toggles to overwrite or not the existing - * file. Default is to overwrite the file, otherwise if is - * false the new files are added to the . - * - * If is used, it tells thats the path should also be stored ' - * with the file name. Default is false. - * - * If is used, it tells thats the Drive and path should also - * be stored with the file name. Default is false. - * - * If is used, an Code block is evaluated, showing the total - * of that file has being processed. - * The codeblock must be defined as follow {|nPos,nTotal| GaugeUpdate(aGauge1,(nPos/nTotal))} - * $EXAMPLES$ - * FUNCTION MAIN() - * - * IF HB_ZIPFILEBYTDSPAN( "TEST.ZIP", "TEST.PRG" ) - * qout( "File was successfully created" ) - * ENDIF - * - * IF HB_ZIPFILEBYTDSPAN( "TEST1.ZIP", { "TEST.PRG", "c:\windows\win.ini" } ) - * qout( "File was successfully created" ) - * ENDIF - * - * IF HB_ZIPFILEBYTDSPAN( "TEST2.ZIP", { "TEST.PRG", "c:\windows\win.ini" }, 9, {|nPos,cFile| qout(cFile) }, "hello",, 521421 ) - * qout("File was successfully created" ) - * ENDIF - * - * aFiles := { "TEST.PRG", "c:\windows\win.ini" } - * nLen := Len( aFiles ) - * aGauge := GaugeNew( 5, 5, 7, 40, "W/B", "W+/B", "²" ) - * GaugeDisplay( aGauge ) - * HB_ZIPFILEBYTDSPAN( "test33.zip", aFiles, 9, {|cFile,nPos| GaugeUpdate( aGauge, nPos/nLen) },, "hello",, 6585452 ) - * Return Nil - * $STATUS$ - * R - * $COMPLIANCE$ - * This function is a Harbour extension - * $PLATFORMS$ - * All - * $FILES$ - * Library is hbzip.lib - * $END$ - */ - - -/* - * $DOC$ - * $FUNCNAME$ - * HB_ZIPFILEBYPKSPAN() - * $CATEGORY$ - * Zip Functions - * $ONELINER$ - * Create a zip file on removable media - * $SYNTAX$ - * HB_ZIPFILEBYPKSPAN( , | , , - * , , , , , - * ) ---> lCompress - * $ARGUMENTS$ - * Name of the zip file - * - * Name of a file to Compress, Drive and/or path - * can be used - * _or_ - * An array containing files to compress, Drive and/or path - * can be used - * - * Compression level ranging from 0 to 9 - * - * Code block to execute while compressing - * - * Toggle to overwrite the file if exists - * - * Password to encrypt the files - * - * Toggle to store the path or not - * - * Toggle to store the Drive letter and path or not - * - * Code block for File Progress - * $RETURNS$ - * .t. if file was create, otherwise .f. - * $DESCRIPTION$ - * This function creates a zip file named . If the extension - * is omitted, .ZIP will be assumed. If the second parameter is a - * character string, this file will be added to the zip file. If the - * second parameter is an array, all file names contained in - * will be compressed. Also, the use of this function is for creating - * backup in removable media like an floppy drive/zip drive. - * - * If is used, it determines the compression type where 0 means - * no compression and 9 means best compression. - * - * If is used, every time the file is opened to compress it - * will evaluate bBlock. Parameters of bBlock are cFile and nPos. - * - * If is used , it toggles to overwrite or not the existing - * file. Default is to overwrite the file, otherwise if is false - * the new files are added to the . - * - * If is used, all files that are added to the archive are encrypted - * with the password. - * - * If is used, it tells thats the path should also be stored with - * the file name. Default is false. - * - * If is used, it tells thats the Drive and path should also be stored - * with the file name. Default is false. - * - * If is used, an Code block is evaluated, showing the total - * of that file has being processed. - * The codeblock must be defined as follow {|nPos,nTotal| GaugeUpdate(aGauge1,(nPos/nTotal))} - * - * Before calling this function, Set an Changedisk codeblock by calling - * the HB_SETDISKZIP(). - * $EXAMPLES$ - * FUNCTION MAIN() - * - * hb_setdiskzip( {|nDisk| Alert( "Please insert disk no " + Str( nDisk, 3 ) ) } ) - * - * IF HB_ZIPFILEBYPKSPAN( "a:\TEST.ZIP", "TEST.PRG" ) - * qout( "File was successfully created" ) - * ENDIF - * - * IF HB_ZIPFILEBYPKSPAN( "a:\TEST1.ZIP", { "TEST.PRG", "c:\windows\win.ini" } ) - * qout( "File was successfully created" ) - * ENDIF - * - * IF HB_ZIPFILEBYPKSPAN( "TEST2.ZIP", { "TEST.PRG", "c:\windows\win.ini"}, 9, {|nPos,cFile| qout(cFile) } ) - * qout( "File was successfully created" ) - * ENDIF - * - * aFiles := { "TEST.PRG", "c:\windows\win.ini" } - * nLen := Len( aFiles ) - * aGauge := GaugeNew( 5, 5, 7, 40, "W/B", "W+/B", "²" ) - * GaugeDisplay( aGauge ) - * HB_ZIPFILEBYPKSPAN( "f:\test33.zip", aFiles, 9, {|cFile,nPos| GaugeUpdate( aGauge, nPos/nLen ) },, "hello" ) - * // assuming f:\ is a Zip Drive - * Return Nil - * $STATUS$ - * R - * $COMPLIANCE$ - * This function is a Harbour extension - * $PLATFORMS$ - * All - * $FILES$ - * Library is hbzip.lib - * $END$ - */ - -/* $DOC$ - * $FUNCNAME$ - * HB_SETDISKZIP() - * $CATEGORY$ - * Zip Functions - * $ONELINER$ - * Set an codeblock for disk changes - * $SYNTAX$ - * HB_SETDISKZIP( ) ---> TRUE - * $ARGUMENTS$ - * an Code block that contains an function that will be performed - * when the need of changing disk are need. - * $RETURNS$ - * It always returns True - * $DESCRIPTION$ - * This function will set an codeblock that will be evaluated every time - * that an changedisk event is necessary. receives nDisk as a - * code block param that corresponds to the diskette number to be processed. - * - * Set this function before opening archives that are in removable media. - * This block will be released, when the caller finish it job. - * $EXAMPLES$ - * HB_SETDISKZIP( {|nDisk| Alert( "Please insert disk no " + Str( nDisk, 3 ) ) } ) - * $COMPLIANCE$ - * This function is a Harbour extension - * $PLATFORMS$ - * All - * $FILES$ - * Library is hbzip.lib - * $END$ - */ - -/* $DOC$ - * $FUNCNAME$ - * HB_ZIPDELETEFILES() - * $CATEGORY$ - * Zip Functions - * $ONELINER$ - * Delete files from an zip archive - * $SYNTAX$ - * HB_ZIPDELETEFILES( , | | ) --> - * $ARGUMENTS$ - * The name of the zip files from where the files will be deleted - * - * An File to be removed - * _or_ - * An Array of Files to be removed - * _or_ - * The Position of the file to be removed - * $RETURNS$ - * If the files are deleted, it will return .T.; otherwise - * it will return .f. in the following cases: Spanned Archives; the file(s) - * could not be found in the zip file. - * $DESCRIPTION$ - * This function removes files from an Zip archive. - * $EXAMPLES$ - * ? "has the file zipnew.i been deleted ", if( HB_ZIPDELETEFILES( "\test23.zip", "zipnew.i" ), "Yes", "No" ) - * $STATUS$ - * R - * $COMPLIANCE$ - * This function is a Harbour extension - * $PLATFORMS$ - * All - * $FILES$ - * Library is hbzip.lib - * $END$ - */ - -/* $DOC$ - * $FUNCNAME$ - * HB_ZIPTESTPK() - * $CATEGORY$ - * Zip Functions - * $ONELINER$ - * Test pkSpanned zip files - * $SYNTAX$ - * HB_ZIPTESTPK( ) --> - * $ARGUMENTS$ - * File to be tested. - * $RETURNS$ - * A code that tells if the current disk is the last of a - * pkSpanned disk set. - * $DESCRIPTION$ - * This function tests if the disk inserted is the last disk of an backup - * set or not. - * It will return the follow return code when an error is found - * - * - * Error code Meaning - * 114 Incorrect Disk - * 103 No Call back was set with HB_SETDISKZIP() - *
- * - * Call this function to determine if the disk inserted is the correct - * one before any other function. - * $EXAMPLES$ - * if HB_ZIPTESTPK( "a:\test22.zip" ) == 114 - * ? "Invalid Diskette" - * endif - * $STATUS$ - * R - * $COMPLIANCE$ - * This function is a Harbour extension - * $PLATFORMS$ - * All - * $FILES$ - * Library is hbzip.lib - * $END$ - */ - -/* $DOC$ - * $FUNCNAME$ - * HB_GETZIPCOMMENT() - * $CATEGORY$ - * Zip Functions - * $ONELINER$ - * Return the comment of an zip file - * $SYNTAX$ - * HB_GETZIPCOMMENT( ) --> - * $ARGUMENTS$ - * File to get the comment from - * $RETURNS$ - * The comment that was stored in - * $DESCRIPTION$ - * This function receives a valid zip file name as parameter, - * and returns the global comment stored within. - * $EXAMPLES$ - * ? "The comment in test.zip is ", HB_GETZIPCOMMENT( "test.zip" ) - * $STATUS$ - * R - * $COMPLIANCE$ - * This function is a Harbour extension - * $PLATFORMS$ - * All - * $FILES$ - * Library is hbzip.lib - * $END$ - */ - -/* $DOC$ - * $FUNCNAME$ - * HB_SETZIPCOMMENT() - * $CATEGORY$ - * Zip Functions - * $ONELINER$ - * Set an Zip archive Comment - * $SYNTAX$ - * HB_SETZIPCOMMENT( ) --> Nil - * $ARGUMENTS$ - * Comment to add to the zip archive - * $RETURNS$ - * this function always return NIL - * $DESCRIPTION$ - * This function stored an global comment to an zip archive. - * It should be called before any of the compression functions. - * $EXAMPLES$ - * HB_SETZIPCOMMENT( "This is an Test" ) - * hb_zipfile( "test.zip", { "\windows\ios.ini", "\windows\win.ini" } ) - * $STATUS$ - * R - * $COMPLIANCE$ - * This function is a Harbour extension - * $PLATFORMS$ - * All - * $FILES$ - * Library is hbzip.lib - * $END$ - */ - -/* $DOC$ - * $FUNCNAME$ - * HB_SETBUFFER() - * $CATEGORY$ - * Zip Functions - * $ONELINER$ - * - * $SYNTAX$ - * HB_SETBUFFER( [], [], [] ) --> Nil - * $ARGUMENTS$ - * The size of the write buffer. - * - * The size of the extract buffer. - * - * The size of the read buffer. - * $RETURNS$ - * This function always returns NIL. - * $DESCRIPTION$ - * This function set the size of the internal buffers for write/extract/read - * operation - * - * If the size of the buffer is smaller then the default, the function - * will automatically use the default values, which are 65535/16384/32768 - * respectively. - * - * This function be called before any of the compression/decompression - * functions. - * $EXAMPLES$ - * HB_SETBUFFER( 100000, 115214, 65242 ) - * $STATUS$ - * R - * $COMPLIANCE$ - * This function is a Harbour extension - * $PLATFORMS$ - * All - * $FILES$ - * Library is hbzip.lib - * $END$ - */ - -/* - * $DOC$ - * $FUNCNAME$ - * HB_GETUNRARFILE() - * $CATEGORY$ - * Zip Functions - * $ONELINER$ - * Gets the number of files that are in the RAR file - * $SYNTAX$ - * HB_GETUNRARFILE( ) ---> nNumber - * $ARGUMENTS$ - * Name of the rar file - * $RETURNS$ - * The number of files contained inside the RAR file - * $DESCRIPTION$ - * This function returns the number of files that is stored in the RAR file. - * $EXAMPLES$ - * FUNCTION MAIN() - * Local nFiles := HB_GETUNRARFILE( "test.rar" ) - * - * if nFiles > 0 - * ? "This files contains ", nFiles - * endif - * - * Return Nil - * $STATUS$ - * R - * $COMPLIANCE$ - * This function is a Harbour extension - * $PLATFORMS$ - * All - * $FILES$ - * Library is hbzip.lib - * $END$ - */ -/* - * $DOC$ - * $FUNCNAME$ - * HB_UNZIPFILEINDEX() - * $CATEGORY$ - * Zip Functions - * $ONELINER$ - * Unzip a compressed file referenced by it number in the zipfile - * $SYNTAX$ - * HB_UNZIPFILE( , , , , , - * | , ) ---> lCompress - * $ARGUMENTS$ - * Name of the zip file - * - * Code block to execute while compressing - * - * Toggle to create directory if needed - * - * Password to use to extract files - * - * Path to extract the files to - mandatory. - * - * | A File or Array of files position to extract - mandatory - * - * Code block for File Progress - * $RETURNS$ - * .t. if all file was successfully restored, otherwise .f. - * $DESCRIPTION$ - * This function restores all files contained inside the . - * If the extension is omitted, .ZIP will be assumed. If a file already - * exists, it will be overwritten. - * - * If is used, every time the file is opened to compress it - * will evaluate bBlock. Parameters of bBlock are cFile and nPos. - * - * The is a mandatory parameter. Set to ".\" to extract to the - * current dir - * - * If or are not provided, no files will be extracted! - * Make sure you provide the file or files you want extracted - * - * If is used, an Code block is evaluated, showing the total - * of that file has being processed. - * The codeblock must be defined as follow {|nPos,nTotal| GaugeUpdate(aGauge1,(nPos/nTotal))} - * $EXAMPLES$ - * FUNCTION MAIN() - * - * IF HB_UNZIPFILEINDEX( "TEST.ZIP",,,, ".\", 1 ) - * qout( "File was successfully created" ) - * ENDIF - * - * IF HB_UNZIPFILEINDEX( "TEST2.ZIP", {|cFile|, qout(cFile) },,, ".\", { 1, 2 } ) - * qout( "File was successfully created" ) - * ENDIF - * - * Return Nil - * $STATUS$ - * R - * $COMPLIANCE$ - * This function is a Harbour extension - * $PLATFORMS$ - * All - * $FILES$ - * Library is hbzip.lib - * $END$ - */ diff --git a/harbour/contrib/hbziparch/hbziparc.c b/harbour/contrib/hbziparch/hbziparc.c index 9ca85c1daa..2d59035be8 100644 --- a/harbour/contrib/hbziparch/hbziparc.c +++ b/harbour/contrib/hbziparch/hbziparc.c @@ -62,15 +62,17 @@ #include #endif -extern PHB_ITEM ZipArray; +extern void hb_fsDirectory( PHB_ITEM pDir, char* szSkleton, char* szAttributes, BOOL bDirOnly, BOOL bFullPath ); -static PHB_ITEM FileToZip; -static PHB_ITEM ExcludeFile; -static PHB_ITEM UnzipFiles; -static PHB_ITEM DelZip; -static PHB_ITEM FileAttribs; +static PHB_ITEM s_FileToZip; +static PHB_ITEM s_ExcludeFile; +static PHB_ITEM s_UnzipFiles; +static PHB_ITEM s_DelZip; +static PHB_ITEM s_FileAttribs; -PHB_ITEM ChangeDiskBlock; +PHB_ITEM hbza_ChangeDiskBlock; +PHB_ITEM hbza_pProgressInfo = NULL; +PHB_ITEM hbza_ZipArray; #define FA_RDONLY 1 /* R */ #define FA_HIDDEN 2 /* H */ @@ -80,27 +82,36 @@ PHB_ITEM ChangeDiskBlock; #define FA_ARCH 32 /* A */ #define FA_NORMAL 128 -extern void hb_fsDirectory( PHB_ITEM pDir, char* szSkleton, char* szAttributes, BOOL bDirOnly, BOOL bFullPath ); - #if defined(HB_OS_LINUX) -extern int GetFileAttributes( char *szEntry ); -extern void SetFileAttributes( char * szEntry, ULONG ulAttr ); + +static int GetFileAttributes( char * szEntry ) +{ + struct stat sStat; + stat( szEntry, &sStat ); + return (int) sStat.st_mode; +} + +static void SetFileAttributes( char * szEntry, ULONG ulAttr) +{ + chmod(szEntry,ulAttr); +} + #endif static void ResetAttribs( void ) { - ULONG ulAtt, ulZipLen = hb_arrayLen(FileToZip); + ULONG ulAtt, ulZipLen = hb_arrayLen(s_FileToZip); for( ulAtt = 0; ulAtt < ulZipLen; ulAtt ++ ) { - char *szFile = hb_arrayGetC( FileToZip, ulAtt + 1 ); - int iAttr = hb_arrayGetNI( FileAttribs, ulAtt + 1 ); + char *szFile = hb_arrayGetC( s_FileToZip, ulAtt + 1 ); + int iAttr = hb_arrayGetNI( s_FileAttribs, ulAtt + 1 ); SetFileAttributes( szFile, iAttr ); hb_xfree( szFile ); } - hb_itemRelease( FileAttribs ); - hb_itemRelease( FileToZip ); + hb_itemRelease( s_FileAttribs ); + hb_itemRelease( s_FileToZip ); } static void UnzipCreateArray( char *szSkleton, int uiOption) @@ -110,13 +121,13 @@ static void UnzipCreateArray( char *szSkleton, int uiOption) PHB_ITEM pZipEntry; PHB_ITEM Temp; BOOL bOkAdd; - int ulLen = hb_arrayLen(ZipArray); + int ulLen = hb_arrayLen(hbza_ZipArray); char sRegEx[ _POSIX_PATH_MAX + _POSIX_PATH_MAX ]; for ( ul = 0 ; ul < ulLen; ul ++ ) { bOkAdd = TRUE; - pZipEntry = hb_arrayGetItemPtr( ZipArray, ul + 1 ); + pZipEntry = hb_arrayGetItemPtr( hbza_ZipArray, ul + 1 ); szEntry = hb_arrayGetC( pZipEntry, 1 ); if ( szSkleton ) @@ -150,13 +161,13 @@ static void UnzipCreateArray( char *szSkleton, int uiOption) if ( uiOption == 1 ) { Temp = hb_itemNew( NULL ) ; - hb_arrayAddForward( UnzipFiles, hb_itemPutC( Temp, szEntry ) ); + hb_arrayAddForward( s_UnzipFiles, hb_itemPutC( Temp, szEntry ) ); hb_itemRelease( Temp ); } else { Temp = hb_itemNew( NULL ) ; - hb_arrayAddForward( DelZip, hb_itemPutC( Temp, szEntry ) ); + hb_arrayAddForward( s_DelZip, hb_itemPutC( Temp, szEntry ) ); hb_itemRelease( Temp ); } } @@ -169,11 +180,11 @@ static BOOL ZipTestExclude ( char *szEntry ) { int uiEx; BOOL bNotFound = TRUE; - int uiExLen = hb_arrayLen(ExcludeFile); + int uiExLen = hb_arrayLen(s_ExcludeFile); for ( uiEx = 0; uiEx < uiExLen; uiEx ++ ) { - char *szExclude = hb_arrayGetC( ExcludeFile, uiEx + 1 ); + char *szExclude = hb_arrayGetC( s_ExcludeFile, uiEx + 1 ); if ( strcmp ( szExclude, hb_strupr( szEntry ) ) == 0 ) { hb_xfree( szExclude ); @@ -190,7 +201,7 @@ static void ZipCreateExclude( PHB_ITEM pExclude ) { PHB_ITEM ExTmp; - ExcludeFile = hb_itemArrayNew(0); + s_ExcludeFile = hb_itemArrayNew(0); if( pExclude == NULL ) { @@ -225,7 +236,7 @@ static void ZipCreateExclude( PHB_ITEM pExclude ) if( szEntry ) { ExTmp = hb_itemPutC( NULL, hb_strupr( szEntry ) ); - hb_arrayAddForward( ExcludeFile, ExTmp ); + hb_arrayAddForward( s_ExcludeFile, ExTmp ); hb_xfree( szEntry ); hb_itemRelease( ExTmp ); } @@ -236,7 +247,7 @@ static void ZipCreateExclude( PHB_ITEM pExclude ) else { ExTmp = hb_itemPutC( NULL, hb_itemGetCPtr( pExclude ) ); - hb_arrayAddForward( ExcludeFile, ExTmp ); + hb_arrayAddForward( s_ExcludeFile, ExTmp ); hb_itemRelease( ExTmp ) ; } } @@ -274,7 +285,7 @@ static void ZipCreateExclude( PHB_ITEM pExclude ) pDirEntry = hb_arrayGetItemPtr( WildFile, uiW + 1 ); szEntry = hb_arrayGetC( pDirEntry, 1 ); ExTmp = hb_itemNew( NULL); - hb_arrayAddForward( ExcludeFile, hb_itemPutC( ExTmp, szEntry )); + hb_arrayAddForward( s_ExcludeFile, hb_itemPutC( ExTmp, szEntry )); hb_itemRelease( ExTmp ); hb_xfree( szEntry ); } @@ -282,7 +293,7 @@ static void ZipCreateExclude( PHB_ITEM pExclude ) else { ExTmp = hb_itemNew( NULL); - hb_arrayAddForward( ExcludeFile, hb_itemPutC( ExTmp, szExclude )); + hb_arrayAddForward( s_ExcludeFile, hb_itemPutC( ExTmp, szExclude )); hb_itemRelease( ExTmp ); } @@ -300,10 +311,10 @@ static void ZipCreateArray( PHB_ITEM pParam, BYTE *pCurDir, BOOL bFullPath ) PHB_ITEM WildFile = hb_itemNew( NULL ); int ul, ulLen, ulArr, ulLenArr; - FileToZip = hb_itemArrayNew(0); - FileAttribs = hb_itemArrayNew(0); + s_FileToZip = hb_itemArrayNew(0); + s_FileAttribs = hb_itemArrayNew(0); - if( pParam->type == HB_IT_STRING ) + if( HB_IS_STRING( pParam ) ) { TempArray = hb_itemArrayNew( 0 ); Temp = hb_itemPutC( NULL, hb_itemGetCPtr( pParam ) ); @@ -364,10 +375,10 @@ static void ZipCreateArray( PHB_ITEM pParam, BYTE *pCurDir, BOOL bFullPath ) if ( ZipTestExclude ( szEntry ) ) { Temp= hb_itemNew(NULL); - hb_arrayAddForward( FileToZip, hb_itemPutC( Temp, szEntry ) ); + hb_arrayAddForward( s_FileToZip, hb_itemPutC( Temp, szEntry ) ); hb_itemRelease( Temp ) ; Temp= hb_itemNew(NULL); - hb_arrayAddForward( FileAttribs, hb_itemPutNI( Temp, GetFileAttributes( szEntry ) ) ); + hb_arrayAddForward( s_FileAttribs, hb_itemPutNI( Temp, GetFileAttributes( szEntry ) ) ); hb_itemRelease( Temp ) ; #if defined(HB_OS_LINUX) SetFileAttributes( szEntry, 0777 ); @@ -396,10 +407,10 @@ static void ZipCreateArray( PHB_ITEM pParam, BYTE *pCurDir, BOOL bFullPath ) else { Temp = hb_itemPutC( NULL, szArrEntry ) ; - hb_arrayAddForward( FileToZip, Temp ); + hb_arrayAddForward( s_FileToZip, Temp ); hb_itemRelease( Temp ) ; Temp = hb_itemPutNI( NULL, GetFileAttributes( szArrEntry ) ); - hb_arrayAddForward( FileAttribs, Temp ); + hb_arrayAddForward( s_FileAttribs, Temp ); hb_itemRelease( Temp ) ; #if defined(HB_OS_LINUX) @@ -417,6 +428,104 @@ static void ZipCreateArray( PHB_ITEM pParam, BYTE *pCurDir, BOOL bFullPath ) hb_itemRelease( TempArray ); } +/* + * $DOC$ + * $FUNCNAME$ + * HB_ZIPFILE() + * $CATEGORY$ + * Zip Functions + * $ONELINER$ + * Create a zip file + * $SYNTAX$ + * HB_ZIPFILE( , | , , + * , , , , , + * ) ---> lCompress + * $ARGUMENTS$ + * Name of the zip file to create + * + * Name of a file to Compress, Drive and/or path + * can be used + * _or_ + * An array containing files to compress, Drive and/or path + * can be used + * + * Compression level ranging from 0 to 9 + * + * Code block to execute while compressing + * + * Toggle to overwrite the file if exists + * + * Password to encrypt the files + * + * Toggle to store the path or not + * + * Toggle to store the Drive letter and path or not + * + * Code block for File Progress + * $RETURNS$ + * .t. if file was create, otherwise .f. + * $DESCRIPTION$ + * This function creates a zip file named . If the extension + * is omitted, .ZIP will be assumed. If the second parameter is a + * character string, this file will be added to the zip file. If the + * second parameter is an array, all file names contained in + * will be compressed. + * + * If is used, it determines the compression type where 0 means + * no compression and 9 means best compression. + * + * If is used, every time the file is opened to compress it + * will evaluate bBlock. Parameters of bBlock are cFile and nPos. + * + * If is used, it toggles to overwrite or not the existing + * file. Default is to overwrite the file,otherwise if is false + * the new files are added to the . + * + * If is used, all files that are added to the archive are encrypted + * with the password. + * + * If is used, it tells the path should also be stored with + * the file name. Default is false. + * + * If is used, it tells thats the Drive and path should also be stored + * with the file name. Default is false. + * + * If is used, an Code block is evaluated, showing the total + * of that file has being processed. + * The codeblock must be defined as follow {|nPos,nTotal| GaugeUpdate(aGauge1,(nPos/nTotal))} + * + * $EXAMPLES$ + * FUNCTION MAIN() + * + * IF HB_ZIPFILE( "TEST.ZIP", "TEST.PRG" ) + * qout( "File was successfully created" ) + * ENDIF + * + * IF HB_ZIPFILE( "TEST1.ZIP", { "TEST.PRG", "c:\windows\win.ini" } ) + * qout( "File was successfully created" ) + * ENDIF + * + * IF HB_ZIPFILE( "TEST2.ZIP", { "TEST.PRG", "c:\windows\win.ini" }, 9, {|cFile,nPos,| qout(cFile) } ) + * qout( "File was successfully created" ) + * ENDIF + * + * aFiles := { "TEST.PRG", "c:\windows\win.ini" } + * nLen := Len( aFiles ) + * aGauge := GaugeNew( 5, 5, 7, 40, "W/B", "W+/B" , "²" ) + * GaugeDisplay( aGauge ) + * HB_ZIPFILE( "test33.zip", aFiles, 9, {|cFile,nPos| GaugeUpdate( aGauge, nPos/nLen ) },, "hello" ) + * Return Nil + * $STATUS$ + * R + * $COMPLIANCE$ + * This function is a Harbour extension + * $PLATFORMS$ + * All + * $FILES$ + * Library is hbzip.lib + * $END$ + */ + HB_FUNC( HB_ZIPFILE ) { BOOL bRet = FALSE; @@ -475,11 +584,11 @@ HB_FUNC( HB_ZIPFILE ) hb_xfree( pCurDir) ; szZipFileName = hb___CheckFile( szFile ); - if ( hb_arrayLen(FileToZip) > 0 ) + if ( hb_arrayLen(s_FileToZip) > 0 ) { PHB_ITEM pProgress = ISBLOCK( 9 ) ? hb_itemNew( hb_param( 9, HB_IT_BLOCK ) ) : hb_itemNew( NULL ); bRet = hb_CompressFile( szZipFileName, - FileToZip, + s_FileToZip, ISNUM( 3 ) ? hb_parni( 3 ) : ( -1 ), hb_param( 4, HB_IT_BLOCK ), ISLOG( 5 ) ? hb_parl( 5 ) : 0, @@ -492,7 +601,7 @@ HB_FUNC( HB_ZIPFILE ) } hb_xfree( szZipFileName ); - hb_itemRelease(ExcludeFile); + hb_itemRelease(s_ExcludeFile); } } @@ -544,6 +653,102 @@ HB_FUNC( HB_GETFILECOUNT ) hb_retni( iRet ); } +/* + * $DOC$ + * $FUNCNAME$ + * HB_ZIPFILEBYTDSPAN() + * $CATEGORY$ + * Zip Functions + * $ONELINER$ + * Create a zip file + * $SYNTAX$ + * HB_ZIPFILEBYTDSPAN( , | , , + * , , , , , , + * ) ---> lCompress + * $ARGUMENTS$ + * Name of the zip file + * + * Name of a file to Compress, Drive and/or path + * can be used + * _or_ + * An array containing files to compress, Drive and/or path + * can be used + * + * Compression level ranging from 0 to 9 + * + * Code block to execute while compressing + * + * Toggle to overwrite the file if exists + * + * Password to encrypt the files + * + * Size of the archive, in bytes. Default is 1457664 bytes + * + * Toggle to store the path or not + * + * Toggle to store the Drive letter and path or not + * + * Code block for File Progress + * $RETURNS$ + * .t. if file was create, otherwise .f. + * $DESCRIPTION$ + * This function creates a zip file named . If the extension + * is omitted, .ZIP will be assumed. If the second parameter is a + * character string, this file will be added to the zip file. If the + * second parameter is an array, all file names contained in + * will be compressed. + * + * If is used, it determines the compression type where 0 means + * no compression and 9 means best compression. + * + * If is used, every time the file is opened to compress it + * will evaluate bBlock. Parameters of bBlock are cFile and nPos. + * + * If is used, it toggles to overwrite or not the existing + * file. Default is to overwrite the file, otherwise if is + * false the new files are added to the . + * + * If is used, it tells thats the path should also be stored ' + * with the file name. Default is false. + * + * If is used, it tells thats the Drive and path should also + * be stored with the file name. Default is false. + * + * If is used, an Code block is evaluated, showing the total + * of that file has being processed. + * The codeblock must be defined as follow {|nPos,nTotal| GaugeUpdate(aGauge1,(nPos/nTotal))} + * $EXAMPLES$ + * FUNCTION MAIN() + * + * IF HB_ZIPFILEBYTDSPAN( "TEST.ZIP", "TEST.PRG" ) + * qout( "File was successfully created" ) + * ENDIF + * + * IF HB_ZIPFILEBYTDSPAN( "TEST1.ZIP", { "TEST.PRG", "c:\windows\win.ini" } ) + * qout( "File was successfully created" ) + * ENDIF + * + * IF HB_ZIPFILEBYTDSPAN( "TEST2.ZIP", { "TEST.PRG", "c:\windows\win.ini" }, 9, {|nPos,cFile| qout(cFile) }, "hello",, 521421 ) + * qout("File was successfully created" ) + * ENDIF + * + * aFiles := { "TEST.PRG", "c:\windows\win.ini" } + * nLen := Len( aFiles ) + * aGauge := GaugeNew( 5, 5, 7, 40, "W/B", "W+/B", "²" ) + * GaugeDisplay( aGauge ) + * HB_ZIPFILEBYTDSPAN( "test33.zip", aFiles, 9, {|cFile,nPos| GaugeUpdate( aGauge, nPos/nLen) },, "hello",, 6585452 ) + * Return Nil + * $STATUS$ + * R + * $COMPLIANCE$ + * This function is a Harbour extension + * $PLATFORMS$ + * All + * $FILES$ + * Library is hbzip.lib + * $END$ + */ + HB_FUNC( HB_ZIPFILEBYTDSPAN ) { BOOL bRet = FALSE; @@ -592,11 +797,11 @@ HB_FUNC( HB_ZIPFILEBYTDSPAN ) hb_xfree( pCurDir ) ; /* by JGS */ szZipFileName = hb___CheckFile( szFile ); - if ( hb_arrayLen(FileToZip) > 0 ) + if ( hb_arrayLen(s_FileToZip) > 0 ) { PHB_ITEM pProgress = ISBLOCK( 10 ) ? hb_itemNew( hb_param( 10, HB_IT_BLOCK ) ) : hb_itemNew( NULL ); bRet = hb_CmpTdSpan( szZipFileName, - FileToZip, + s_FileToZip, ISNUM( 3 ) ? hb_parni( 3 ) : ( -1 ), hb_param( 4, HB_IT_BLOCK ), ISLOG( 5 ) ? hb_parl( 5 ) : 0, @@ -610,13 +815,117 @@ HB_FUNC( HB_ZIPFILEBYTDSPAN ) } hb_xfree( szZipFileName ); - hb_itemRelease(ExcludeFile); + hb_itemRelease(s_ExcludeFile); } } hb_retl( bRet ); } +/* + * $DOC$ + * $FUNCNAME$ + * HB_ZIPFILEBYPKSPAN() + * $CATEGORY$ + * Zip Functions + * $ONELINER$ + * Create a zip file on removable media + * $SYNTAX$ + * HB_ZIPFILEBYPKSPAN( , | , , + * , , , , , + * ) ---> lCompress + * $ARGUMENTS$ + * Name of the zip file + * + * Name of a file to Compress, Drive and/or path + * can be used + * _or_ + * An array containing files to compress, Drive and/or path + * can be used + * + * Compression level ranging from 0 to 9 + * + * Code block to execute while compressing + * + * Toggle to overwrite the file if exists + * + * Password to encrypt the files + * + * Toggle to store the path or not + * + * Toggle to store the Drive letter and path or not + * + * Code block for File Progress + * $RETURNS$ + * .t. if file was create, otherwise .f. + * $DESCRIPTION$ + * This function creates a zip file named . If the extension + * is omitted, .ZIP will be assumed. If the second parameter is a + * character string, this file will be added to the zip file. If the + * second parameter is an array, all file names contained in + * will be compressed. Also, the use of this function is for creating + * backup in removable media like an floppy drive/zip drive. + * + * If is used, it determines the compression type where 0 means + * no compression and 9 means best compression. + * + * If is used, every time the file is opened to compress it + * will evaluate bBlock. Parameters of bBlock are cFile and nPos. + * + * If is used , it toggles to overwrite or not the existing + * file. Default is to overwrite the file, otherwise if is false + * the new files are added to the . + * + * If is used, all files that are added to the archive are encrypted + * with the password. + * + * If is used, it tells thats the path should also be stored with + * the file name. Default is false. + * + * If is used, it tells thats the Drive and path should also be stored + * with the file name. Default is false. + * + * If is used, an Code block is evaluated, showing the total + * of that file has being processed. + * The codeblock must be defined as follow {|nPos,nTotal| GaugeUpdate(aGauge1,(nPos/nTotal))} + * + * Before calling this function, Set an Changedisk codeblock by calling + * the HB_SETDISKZIP(). + * $EXAMPLES$ + * FUNCTION MAIN() + * + * hb_setdiskzip( {|nDisk| Alert( "Please insert disk no " + Str( nDisk, 3 ) ) } ) + * + * IF HB_ZIPFILEBYPKSPAN( "a:\TEST.ZIP", "TEST.PRG" ) + * qout( "File was successfully created" ) + * ENDIF + * + * IF HB_ZIPFILEBYPKSPAN( "a:\TEST1.ZIP", { "TEST.PRG", "c:\windows\win.ini" } ) + * qout( "File was successfully created" ) + * ENDIF + * + * IF HB_ZIPFILEBYPKSPAN( "TEST2.ZIP", { "TEST.PRG", "c:\windows\win.ini"}, 9, {|nPos,cFile| qout(cFile) } ) + * qout( "File was successfully created" ) + * ENDIF + * + * aFiles := { "TEST.PRG", "c:\windows\win.ini" } + * nLen := Len( aFiles ) + * aGauge := GaugeNew( 5, 5, 7, 40, "W/B", "W+/B", "²" ) + * GaugeDisplay( aGauge ) + * HB_ZIPFILEBYPKSPAN( "f:\test33.zip", aFiles, 9, {|cFile,nPos| GaugeUpdate( aGauge, nPos/nLen ) },, "hello" ) + * // assuming f:\ is a Zip Drive + * Return Nil + * $STATUS$ + * R + * $COMPLIANCE$ + * This function is a Harbour extension + * $PLATFORMS$ + * All + * $FILES$ + * Library is hbzip.lib + * $END$ + */ + HB_FUNC( HB_ZIPFILEBYPKSPAN ) { BOOL bRet = FALSE; @@ -667,11 +976,11 @@ HB_FUNC( HB_ZIPFILEBYPKSPAN ) /* by JGS */ szZipFileName = hb___CheckFile( szFile ); - if ( hb_arrayLen(FileToZip) > 0 ) + if ( hb_arrayLen(s_FileToZip) > 0 ) { PHB_ITEM pProgress = ISBLOCK( 9 ) ? hb_itemNew( hb_param( 9, HB_IT_BLOCK ) ) : hb_itemNew( NULL ); bRet = hb_CmpPkSpan( szZipFileName, - FileToZip, + s_FileToZip, ISNUM( 3 ) ? hb_parni( 3 ) : ( -1 ), hb_param( 4, HB_IT_BLOCK ), ISLOG( 5 ) ? hb_parl( 5 ) : 0, @@ -684,13 +993,81 @@ HB_FUNC( HB_ZIPFILEBYPKSPAN ) } hb_xfree( szZipFileName ); - hb_itemRelease(ExcludeFile); + hb_itemRelease(s_ExcludeFile); } } hb_retl( bRet ); } +/* + * $DOC$ + * $FUNCNAME$ + * HB_UNZIPFILE() + * $CATEGORY$ + * Zip Functions + * $ONELINER$ + * Unzip a compressed file + * $SYNTAX$ + * HB_UNZIPFILE( , , , , , + * | , ) ---> lCompress + * $ARGUMENTS$ + * Name of the zip file to extract + * + * Code block to execute while extracting + * + * Toggle to create directory if needed + * + * Password to use to extract files + * + * Path to extract the files to - mandatory + * + * | A File or Array of files to extract - mandatory + * + * Code block for File Progress + * $RETURNS$ + * .t. if all file was successfully restored, otherwise .f. + * $DESCRIPTION$ + * This function restores all files contained inside the . + * If the extension is omitted, .ZIP will be assumed. If a file already + * exists, it will be overwritten. + * + * If is used, every time the file is opened to compress it + * will evaluate bBlock. Parameters of bBlock are cFile and nPos. + * + * The is a mandatory parameter. Set to ".\" to extract to the + * current directory + * + * If or are not provided, no files will be extracted! + * Make sure you provide the file or files you want extracted + * + * If is used, an Code block is evaluated, showing the total + * of that file has being processed. + * The codeblock must be defined as follow {|nPos,nTotal| GaugeUpdate(aGauge1,(nPos/nTotal))} + * $EXAMPLES$ + * FUNCTION MAIN() + * + * aExtract := hb_GetFilesInZip( "TEST.ZIP" ) // extract all files in zip + * IF HB_UNZIPFILE( "TEST.ZIP",,,, ".\", aExtract ) + * qout("File was successfully extracted") + * ENDIF + * + * aExtract := hb_GetFilesInZip( "TEST2.ZIP" ) // extract all files in zip + * IF HB_UNZIPFILE( "TEST2.ZIP", {|cFile| qout( cFile ) },,, ".\", aExtract ) + * qout("File was successfully extracted") + * ENDIF + * Return Nil + * $STATUS$ + * R + * $COMPLIANCE$ + * This function is a Harbour extension + * $PLATFORMS$ + * All + * $FILES$ + * Library is hbzip.lib + * $END$ + */ + HB_FUNC( HB_UNZIPFILE ) { BOOL bRet = FALSE; @@ -707,7 +1084,7 @@ HB_FUNC( HB_UNZIPFILE ) strcpy( szFile, hb_parc( 1 ) ); szZipFileName = hb___CheckFile( szFile ); - UnzipFiles = hb_itemArrayNew(0); + s_UnzipFiles = hb_itemArrayNew(0); if( hb_TestForPKS( szZipFileName ) <=0 ) { @@ -742,7 +1119,7 @@ HB_FUNC( HB_UNZIPFILE ) //s.r. change "*.*" to "*" because file without extension were ignored UnzipCreateArray( (char*) "*", 1 ); } - if ( hb_arrayLen(UnzipFiles) > 0 ) + if ( hb_arrayLen(s_UnzipFiles) > 0 ) { PHB_ITEM pProgress = ISBLOCK( 7 ) ? hb_itemNew( hb_param( 7 , HB_IT_BLOCK ) ) : hb_itemNew( NULL ); bRet = hb_UnzipSel( szZipFileName, @@ -750,28 +1127,96 @@ HB_FUNC( HB_UNZIPFILE ) ISLOG( 3 ) ? hb_parl( 3 ) : 0, ISCHAR( 4 ) ? hb_parc( 4 ) : NULL, ISCHAR( 5 ) ? hb_parc( 5 ) : ".\\", - UnzipFiles, + s_UnzipFiles, pProgress ); hb_itemRelease( pProgress ); } hb_xfree( szZipFileName ); - hb_itemRelease( UnzipFiles ); + hb_itemRelease( s_UnzipFiles ); hb_fsChDir( pCurDir ) ; hb_xfree( pCurDir ) ; - hb_itemClear( ZipArray ); - hb_itemRelease( ZipArray ); + hb_itemClear( hbza_ZipArray ); + hb_itemRelease( hbza_ZipArray ); } } hb_retl( bRet ); } +/* $DOC$ + * $FUNCNAME$ + * HB_SETDISKZIP() + * $CATEGORY$ + * Zip Functions + * $ONELINER$ + * Set an codeblock for disk changes + * $SYNTAX$ + * HB_SETDISKZIP( ) ---> TRUE + * $ARGUMENTS$ + * an Code block that contains an function that will be performed + * when the need of changing disk are need. + * $RETURNS$ + * It always returns True + * $DESCRIPTION$ + * This function will set an codeblock that will be evaluated every time + * that an changedisk event is necessary. receives nDisk as a + * code block param that corresponds to the diskette number to be processed. + * + * Set this function before opening archives that are in removable media. + * This block will be released, when the caller finish it job. + * $EXAMPLES$ + * HB_SETDISKZIP( {|nDisk| Alert( "Please insert disk no " + Str( nDisk, 3 ) ) } ) + * $COMPLIANCE$ + * This function is a Harbour extension + * $PLATFORMS$ + * All + * $FILES$ + * Library is hbzip.lib + * $END$ + */ + HB_FUNC( HB_SETDISKZIP ) { hb_retl( hb___SetCallbackFunc( hb_param( 1, HB_IT_BLOCK ) ) ); } +/* $DOC$ + * $FUNCNAME$ + * HB_ZIPDELETEFILES() + * $CATEGORY$ + * Zip Functions + * $ONELINER$ + * Delete files from an zip archive + * $SYNTAX$ + * HB_ZIPDELETEFILES( , | | ) --> + * $ARGUMENTS$ + * The name of the zip files from where the files will be deleted + * + * An File to be removed + * _or_ + * An Array of Files to be removed + * _or_ + * The Position of the file to be removed + * $RETURNS$ + * If the files are deleted, it will return .T.; otherwise + * it will return .f. in the following cases: Spanned Archives; the file(s) + * could not be found in the zip file. + * $DESCRIPTION$ + * This function removes files from an Zip archive. + * $EXAMPLES$ + * ? "has the file zipnew.i been deleted ", if( HB_ZIPDELETEFILES( "\test23.zip", "zipnew.i" ), "Yes", "No" ) + * $STATUS$ + * R + * $COMPLIANCE$ + * This function is a Harbour extension + * $PLATFORMS$ + * All + * $FILES$ + * Library is hbzip.lib + * $END$ + */ + HB_FUNC( HB_ZIPDELETEFILES ) { BOOL bRet = FALSE; @@ -780,7 +1225,7 @@ HB_FUNC( HB_ZIPDELETEFILES ) { PHB_ITEM pDelZip = hb_param( 2, HB_IT_STRING | HB_IT_ARRAY | HB_IT_NUMERIC ); - DelZip = hb_itemArrayNew(0); + s_DelZip = hb_itemArrayNew(0); if ( pDelZip ) { @@ -792,13 +1237,13 @@ HB_FUNC( HB_ZIPDELETEFILES ) szZipFileName = hb___CheckFile( szFile ); hb___GetFileNamesFromZip( szZipFileName, TRUE ); - ulLen = hb_arrayLen(ZipArray); + ulLen = hb_arrayLen(hbza_ZipArray); if ( !ulLen ) { hb_xfree( szZipFileName ); - hb_itemClear( ZipArray ); - hb_itemRelease( ZipArray ); + hb_itemClear( hbza_ZipArray ); + hb_itemRelease( hbza_ZipArray ); hb_retl ( bRet ); return; } @@ -840,33 +1285,75 @@ HB_FUNC( HB_ZIPDELETEFILES ) if( iIndex > 0 && iIndex <= ulLen ) { - PHB_ITEM pZipEntry = hb_arrayGetItemPtr( ZipArray, iIndex ); + PHB_ITEM pZipEntry = hb_arrayGetItemPtr( hbza_ZipArray, iIndex ); char* szEntry = hb_arrayGetC( pZipEntry, 1 ); Temp = hb_itemNew(NULL); - hb_arrayAddForward( DelZip, hb_itemPutC( Temp, szEntry ) ); + hb_arrayAddForward( s_DelZip, hb_itemPutC( Temp, szEntry ) ); hb_xfree( szEntry ); hb_itemRelease( Temp ); } } - if ( hb_arrayLen(DelZip) > 0 ) + if ( hb_arrayLen(s_DelZip) > 0 ) { bRet = hb_DeleteSel( szZipFileName, - DelZip, + s_DelZip, ISLOG( 3 ) ? hb_parl( 3 ) : 0 ); } hb_xfree(szZipFileName); - hb_itemClear( ZipArray ); - hb_itemRelease( ZipArray ); + hb_itemClear( hbza_ZipArray ); + hb_itemRelease( hbza_ZipArray ); } - hb_itemRelease( DelZip ); + hb_itemRelease( s_DelZip ); } hb_retl( bRet ); } +/* $DOC$ + * $FUNCNAME$ + * HB_ZIPTESTPK() + * $CATEGORY$ + * Zip Functions + * $ONELINER$ + * Test pkSpanned zip files + * $SYNTAX$ + * HB_ZIPTESTPK( ) --> + * $ARGUMENTS$ + * File to be tested. + * $RETURNS$ + * A code that tells if the current disk is the last of a + * pkSpanned disk set. + * $DESCRIPTION$ + * This function tests if the disk inserted is the last disk of an backup + * set or not. + * It will return the follow return code when an error is found + * + * + * Error code Meaning + * 114 Incorrect Disk + * 103 No Call back was set with HB_SETDISKZIP() + *
+ * + * Call this function to determine if the disk inserted is the correct + * one before any other function. + * $EXAMPLES$ + * if HB_ZIPTESTPK( "a:\test22.zip" ) == 114 + * ? "Invalid Diskette" + * endif + * $STATUS$ + * R + * $COMPLIANCE$ + * This function is a Harbour extension + * $PLATFORMS$ + * All + * $FILES$ + * Library is hbzip.lib + * $END$ + */ + HB_FUNC( HB_ZIPTESTPK ) { char szFile[ _POSIX_PATH_MAX ]; @@ -880,22 +1367,188 @@ HB_FUNC( HB_ZIPTESTPK ) hb_xfree(szZipFileName); } +/* $DOC$ + * $FUNCNAME$ + * HB_SETBUFFER() + * $CATEGORY$ + * Zip Functions + * $ONELINER$ + * + * $SYNTAX$ + * HB_SETBUFFER( [], [], [] ) --> Nil + * $ARGUMENTS$ + * The size of the write buffer. + * + * The size of the extract buffer. + * + * The size of the read buffer. + * $RETURNS$ + * This function always returns NIL. + * $DESCRIPTION$ + * This function set the size of the internal buffers for write/extract/read + * operation + * + * If the size of the buffer is smaller then the default, the function + * will automatically use the default values, which are 65535/16384/32768 + * respectively. + * + * This function be called before any of the compression/decompression + * functions. + * $EXAMPLES$ + * HB_SETBUFFER( 100000, 115214, 65242 ) + * $STATUS$ + * R + * $COMPLIANCE$ + * This function is a Harbour extension + * $PLATFORMS$ + * All + * $FILES$ + * Library is hbzip.lib + * $END$ + */ + HB_FUNC( HB_SETBUFFER ) { hb_SetZipBuff( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 )); } +/* $DOC$ + * $FUNCNAME$ + * HB_SETZIPCOMMENT() + * $CATEGORY$ + * Zip Functions + * $ONELINER$ + * Set an Zip archive Comment + * $SYNTAX$ + * HB_SETZIPCOMMENT( ) --> Nil + * $ARGUMENTS$ + * Comment to add to the zip archive + * $RETURNS$ + * this function always return NIL + * $DESCRIPTION$ + * This function stored an global comment to an zip archive. + * It should be called before any of the compression functions. + * $EXAMPLES$ + * HB_SETZIPCOMMENT( "This is an Test" ) + * hb_zipfile( "test.zip", { "\windows\ios.ini", "\windows\win.ini" } ) + * $STATUS$ + * R + * $COMPLIANCE$ + * This function is a Harbour extension + * $PLATFORMS$ + * All + * $FILES$ + * Library is hbzip.lib + * $END$ + */ + HB_FUNC( HB_SETZIPCOMMENT ) { hb_SetZipComment( hb_parc( 1 ) ); } +/* $DOC$ + * $FUNCNAME$ + * HB_GETZIPCOMMENT() + * $CATEGORY$ + * Zip Functions + * $ONELINER$ + * Return the comment of an zip file + * $SYNTAX$ + * HB_GETZIPCOMMENT( ) --> + * $ARGUMENTS$ + * File to get the comment from + * $RETURNS$ + * The comment that was stored in + * $DESCRIPTION$ + * This function receives a valid zip file name as parameter, + * and returns the global comment stored within. + * $EXAMPLES$ + * ? "The comment in test.zip is ", HB_GETZIPCOMMENT( "test.zip" ) + * $STATUS$ + * R + * $COMPLIANCE$ + * This function is a Harbour extension + * $PLATFORMS$ + * All + * $FILES$ + * Library is hbzip.lib + * $END$ + */ + HB_FUNC( HB_GETZIPCOMMENT ) { char *szComment=( char* )hb_GetZipComment( hb_parc( 1 ) ); hb_retcAdopt( szComment ); } +/* + * $DOC$ + * $FUNCNAME$ + * HB_UNZIPFILEINDEX() + * $CATEGORY$ + * Zip Functions + * $ONELINER$ + * Unzip a compressed file referenced by it number in the zipfile + * $SYNTAX$ + * HB_UNZIPFILE( , , , , , + * | , ) ---> lCompress + * $ARGUMENTS$ + * Name of the zip file + * + * Code block to execute while compressing + * + * Toggle to create directory if needed + * + * Password to use to extract files + * + * Path to extract the files to - mandatory. + * + * | A File or Array of files position to extract - mandatory + * + * Code block for File Progress + * $RETURNS$ + * .t. if all file was successfully restored, otherwise .f. + * $DESCRIPTION$ + * This function restores all files contained inside the . + * If the extension is omitted, .ZIP will be assumed. If a file already + * exists, it will be overwritten. + * + * If is used, every time the file is opened to compress it + * will evaluate bBlock. Parameters of bBlock are cFile and nPos. + * + * The is a mandatory parameter. Set to ".\" to extract to the + * current dir + * + * If or are not provided, no files will be extracted! + * Make sure you provide the file or files you want extracted + * + * If is used, an Code block is evaluated, showing the total + * of that file has being processed. + * The codeblock must be defined as follow {|nPos,nTotal| GaugeUpdate(aGauge1,(nPos/nTotal))} + * $EXAMPLES$ + * FUNCTION MAIN() + * + * IF HB_UNZIPFILEINDEX( "TEST.ZIP",,,, ".\", 1 ) + * qout( "File was successfully created" ) + * ENDIF + * + * IF HB_UNZIPFILEINDEX( "TEST2.ZIP", {|cFile|, qout(cFile) },,, ".\", { 1, 2 } ) + * qout( "File was successfully created" ) + * ENDIF + * + * Return Nil + * $STATUS$ + * R + * $COMPLIANCE$ + * This function is a Harbour extension + * $PLATFORMS$ + * All + * $FILES$ + * Library is hbzip.lib + * $END$ + */ + HB_FUNC( HB_UNZIPFILEINDEX ) { BOOL bRet = FALSE; @@ -917,7 +1570,7 @@ HB_FUNC( HB_UNZIPFILEINDEX ) szZipFileName = hb___CheckFile( szFile ); hb___GetFileNamesFromZip( szZipFileName, TRUE ); - ulLen = hb_arrayLen(ZipArray); + ulLen = hb_arrayLen(hbza_ZipArray); if ( HB_IS_NUMERIC ( pDelZip ) ) { @@ -962,8 +1615,8 @@ HB_FUNC( HB_UNZIPFILEINDEX ) hb_itemRelease( DelZip ); hb_xfree( szZipFileName ); - hb_itemClear( ZipArray ); - hb_itemRelease( ZipArray ); + hb_itemClear( hbza_ZipArray ); + hb_itemRelease( hbza_ZipArray ); } } @@ -990,12 +1643,12 @@ HB_FUNC( TRANSFERFROMZIP ) hb_param( 3, HB_IT_ARRAY ) ) ); } -HB_FUNC(SETZIPREADONLY) +HB_FUNC( SETZIPREADONLY ) { hb_SetZipReadOnly( hb_parl( 1 ) ); } -HB_FUNC(HB_UNZIPALLFILE) +HB_FUNC(HB_UNZIPALLFILE) { if ( ! ISCHAR(6) && ! ISARRAY(6) ) { @@ -1018,25 +1671,9 @@ HB_FUNC(HB_UNZIPALLFILE) HB_FUNC_EXIT( HBZIPCLEANUP ) { - if( ChangeDiskBlock ) + if( hbza_ChangeDiskBlock ) { - hb_itemRelease( ChangeDiskBlock ); - ChangeDiskBlock = NULL; + hb_itemRelease( hbza_ChangeDiskBlock ); + hbza_ChangeDiskBlock = NULL; } } - -#if defined(HB_OS_LINUX) - -int GetFileAttributes( char *szEntry ) -{ - struct stat sStat; - stat( szEntry, &sStat ); - return (int) sStat.st_mode; -} - -void SetFileAttributes( char * szEntry,ULONG ulAttr) -{ - chmod(szEntry,ulAttr); -} - -#endif diff --git a/harbour/contrib/hbziparch/hbziparc.h b/harbour/contrib/hbziparch/hbziparc.h index 9c05655124..3940f11e8d 100644 --- a/harbour/contrib/hbziparch/hbziparc.h +++ b/harbour/contrib/hbziparch/hbziparc.h @@ -56,14 +56,10 @@ #define HB_OS_WIN_32_USED -#include "hbvmopt.h" #include "hbapi.h" -#include "hbstack.h" #include "hbapiitm.h" #include "hbapierr.h" -#include "hbapicls.h" #include "hbapifs.h" -/* #include "hbapigt.h" */ #include "hbvm.h" #if defined(__GNUC__) && !defined(__MINGW32__) @@ -92,16 +88,17 @@ HB_EXTERN_BEGIN #define Time 7 #define Crc32 8 #define Attr 9 -#define WRITEBUFFERSIZE (16384) -#define MAXFILENAME (256) +#define WRITEBUFFERSIZE 16384 +#define MAXFILENAME 256 -typedef struct _HB_ZIP_INTERNAL{ -int iWrite; -int iExtract; -int iRead; -char * szComment; -int iReadOnly ; -PHB_ITEM pItem; +typedef struct _HB_ZIP_INTERNAL +{ + int iWrite; + int iExtract; + int iRead; + char * szComment; + int iReadOnly; + PHB_ITEM pItem; } HB_ZIP_INTERNAL,* PHB_ZIP_INTERNAL,* HB_ZIP_INTERNAL_PTR; #ifndef LPCTSTR @@ -109,34 +106,34 @@ typedef const char *LPCSTR; typedef LPCSTR LPCTSTR; #endif -extern char *hb___CheckFile( char * szFile); -extern unsigned long GetCurrentFileSize( LPCTSTR szFile); +extern PHB_ITEM hbza_ZipArray; +extern PHB_ITEM hbza_ChangeDiskBlock; +extern PHB_ITEM hbza_pProgressInfo; -extern PHB_ITEM hb___GetFileNamesFromZip(char *szFile,BOOL iMode); - -extern int hb_CmpPkSpan(char *szFile,PHB_ITEM pArray,int iCompLevel,PHB_ITEM pBlock,BOOL bOverWrite,char *szPassWord,BOOL bPath,BOOL bDrive,PHB_ITEM pProgress); -extern BOOL hb_TransferFilesFromzip(char *szSource,char *szDest,PHB_ITEM pArray); -extern char *hb_getPassWord(char *szName); -extern int hb___GetNumberofFilestoUnzip(char *szFile); -extern int hb___SetCallbackFunc(PHB_ITEM pFunc); -extern int hb_CmpTdSpan(char *szFile,PHB_ITEM pArray,int iCompLevel,PHB_ITEM pBlock,BOOL bOverWrite,char *szPassWord,int iSpanSize ,BOOL bPath ,BOOL bDrive,PHB_ITEM pProgress); - -extern int hb_CompressFile(char *szFile,PHB_ITEM pArray,int iCompLevel,PHB_ITEM pBlock,BOOL bOverWrite,char *szPassWord,BOOL bPath,BOOL bDrive,PHB_ITEM pProgress); -extern int hb_UnzipSel(char *szFile,PHB_ITEM pBlock,BOOL bWithPath,char *szPassWord,const char *szPath,PHB_ITEM pArray,PHB_ITEM pProgress); -extern int hb_UnzipSelIndex(char *szFile,PHB_ITEM pBlock,BOOL bWithPath,char *szPassWord,char *szPath,PHB_ITEM pSelArray,PHB_ITEM pProgress); -extern int hb_DeleteSel(char *szFile,PHB_ITEM pArray,BOOL bCase); -extern int hb_TestForPKS(char *szFile); -extern void hb_SetZipBuff(int a,int b,int c); -extern void hb_SetZipComment(char *szComment); -extern const char *hb_GetZipComment(char *szFile); -extern BOOL hb_IsPassWord(char *szName); -extern int hb_UnzipAll(char *szFile,PHB_ITEM pBlock,BOOL bWithPath,char *szPassWord,char *pbyBuffer,PHB_ITEM pDiskBlock,PHB_ITEM pProgress); -/* - -extern BOOL hb_SaveZipFileFromMemory(char *szFile); -extern BOOL hb_CreateZipInMemory(char *szFileToCompress,char *szFile); -*/ -extern void hb_SetZipReadOnly(BOOL bRead); +extern char * hb___CheckFile( char * szFile); +extern PHB_ITEM hb___GetFileNamesFromZip(char *szFile,BOOL iMode); +extern int hb_CmpPkSpan(char *szFile,PHB_ITEM pArray,int iCompLevel,PHB_ITEM pBlock,BOOL bOverWrite,char *szPassWord,BOOL bPath,BOOL bDrive,PHB_ITEM pProgress); +extern BOOL hb_TransferFilesFromzip(char *szSource,char *szDest,PHB_ITEM pArray); +extern char * hb_getPassWord(char *szName); +extern int hb___GetNumberofFilestoUnzip(char *szFile); +extern int hb___SetCallbackFunc(PHB_ITEM pFunc); +extern int hb_CmpTdSpan(char *szFile,PHB_ITEM pArray,int iCompLevel,PHB_ITEM pBlock,BOOL bOverWrite,char *szPassWord,int iSpanSize ,BOOL bPath ,BOOL bDrive,PHB_ITEM pProgress); +extern int hb_CompressFile(char *szFile,PHB_ITEM pArray,int iCompLevel,PHB_ITEM pBlock,BOOL bOverWrite,char *szPassWord,BOOL bPath,BOOL bDrive,PHB_ITEM pProgress); +extern int hb_UnzipSel(char *szFile,PHB_ITEM pBlock,BOOL bWithPath,char *szPassWord,const char *szPath,PHB_ITEM pArray,PHB_ITEM pProgress); +extern int hb_UnzipSelIndex(char *szFile,PHB_ITEM pBlock,BOOL bWithPath,char *szPassWord,char *szPath,PHB_ITEM pSelArray,PHB_ITEM pProgress); +extern int hb_DeleteSel(char *szFile,PHB_ITEM pArray,BOOL bCase); +extern int hb_TestForPKS(char *szFile); +extern void hb_SetZipBuff(int a,int b,int c); +extern void hb_SetZipComment(char *szComment); +extern const char * hb_GetZipComment(char *szFile); +extern BOOL hb_IsPassWord(char *szName); +extern int hb_UnzipAll(char *szFile,PHB_ITEM pBlock,BOOL bWithPath,char *szPassWord,char *pbyBuffer,PHB_ITEM pDiskBlock,PHB_ITEM pProgress); +/* +extern BOOL hb_SaveZipFileFromMemory(char *szFile); +extern BOOL hb_CreateZipInMemory(char *szFileToCompress,char *szFile); +*/ +extern void hb_SetZipReadOnly(BOOL bRead); HB_EXTERN_END -#endif /* HB_APIEXT_H_ */ + +#endif /* HB_APIZLIB_H_ */ diff --git a/harbour/contrib/hbziparch/zipcomp.cpp b/harbour/contrib/hbziparch/hbzipcom.cpp similarity index 89% rename from harbour/contrib/hbziparch/zipcomp.cpp rename to harbour/contrib/hbziparch/hbzipcom.cpp index 63afc08fee..eccc9cfe3c 100644 --- a/harbour/contrib/hbziparch/zipcomp.cpp +++ b/harbour/contrib/hbziparch/hbzipcom.cpp @@ -54,11 +54,6 @@ #include "hbziparc.h" -//extern PHB_ITEM ZipArray; -PHB_ITEM pDiskStatus = NULL; -PHB_ITEM pProgressInfo = NULL; -extern PHB_ITEM ChangeDiskBlock; - #ifdef __cplusplus extern "C" { #endif @@ -73,7 +68,7 @@ class SpanCallbackc : public CZipSpanCallback { PHB_ITEM Disk=hb_itemPutNL( NULL, m_uDiskNeeded ); - hb_vmEvalBlockV( ChangeDiskBlock, 1, Disk ); + hb_vmEvalBlockV( hbza_ChangeDiskBlock, 1, Disk ); hb_itemRelease( Disk ); return TRUE; @@ -87,7 +82,7 @@ class SpanActionCallbackc : public CZipActionCallback PHB_ITEM Disk =hb_itemPutNL(NULL, m_uTotalSoFar ), Total=hb_itemPutNL( NULL, m_uTotalToDo ); - hb_vmEvalBlockV( pProgressInfo, 2, Disk,Total); + hb_vmEvalBlockV( hbza_pProgressInfo, 2, Disk,Total); hb_itemRelease( Disk ); hb_itemRelease( Total ); @@ -96,6 +91,52 @@ class SpanActionCallbackc : public CZipActionCallback } }; +static DWORD hb_GetCurrentFileSize( LPCTSTR szFile ) +#if defined( HB_OS_WIN_32 ) || defined( __MINGW32__ ) +{ + DWORD dwFlags = FILE_ATTRIBUTE_ARCHIVE; + HANDLE hFind; + WIN32_FIND_DATA hFilesFind; + + hFind = FindFirstFile( szFile, &hFilesFind ); + + if ( hFind != INVALID_HANDLE_VALUE ) + { + if ( dwFlags & hFilesFind.dwFileAttributes ) + { + if( hFilesFind.nFileSizeHigh>0 ) + { + return ( ( hFilesFind.nFileSizeHigh*MAXDWORD )+hFilesFind.nFileSizeLow ); + } + else + { + return ( hFilesFind.nFileSizeLow ); + } + + } + } + + FindClose( hFind ); + + return ( DWORD ) -1; + +} +#elif defined( __GNUC__ ) +{ + USHORT ushbMask = 63; + USHORT usFileAttr = HB_FA_ARCHIVE; + struct stat sStat; + + if ( stat( szFile, &sStat ) != -1 ) + { + return sStat.st_size; + } + + return -1; +} + +#endif + int hb_CompressFile( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBlock, BOOL bOverWrite, char *szPassWord, BOOL bPath, BOOL bDrive, PHB_ITEM pProgress ) { ULONG ulCount; @@ -103,7 +144,7 @@ int hb_CompressFile( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBl char *szDummyLower ; char *szFileLower = hb_strdup((char *)szFile) ; BOOL bFileExist = hb_fsFile( ( BYTE* )szFile ); - BOOL bAdded = FALSE; + BOOL bAdded; BOOL bReturn = TRUE; DWORD dwSize; @@ -152,14 +193,14 @@ int hb_CompressFile( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBl if ( HB_IS_BLOCK( pProgress ) ) { - pProgressInfo = pProgress; + hbza_pProgressInfo = pProgress; szZip.SetCallback( &spanac ); } for ( ulCount = 1; ( ulCount <= hb_arrayLen( pArray ) ) ;ulCount++ ) { szDummy = ( char * ) hb_arrayGetCPtr( pArray, ulCount ) ; - dwSize = GetCurrentFileSize( szDummy ); + dwSize = hb_GetCurrentFileSize( szDummy ); bAdded = FALSE; szDummyLower = hb_strdup( (char *)szDummy ) ; @@ -189,7 +230,7 @@ int hb_CompressFile( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBl if ( bPath && !bAdded ) { szZip.AddNewFile( szDummy, iCompLevel, true, CZipArchive::zipsmSafeSmart, 65536 ); - bAdded = TRUE; + // bAdded = TRUE; } else if ( !bDrive && !bPath && !bAdded ) { @@ -217,8 +258,6 @@ int hb_CompressFile( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBl catch( ... ){} return ( int ) bReturn; - - } int hb_CmpTdSpan( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBlock, BOOL bOverWrite, char *szPassWord, int iSpanSize, BOOL bPath, BOOL bDrive, PHB_ITEM pProgress ) @@ -226,7 +265,7 @@ int hb_CmpTdSpan( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBlock ULONG ulCount; const char *szDummy; DWORD dwSize; - BOOL bAdded = FALSE; + BOOL bAdded; BOOL bReturn = TRUE; BOOL bFileExist = hb_fsFile( ( BYTE* )szFile ); @@ -278,14 +317,14 @@ int hb_CmpTdSpan( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBlock if ( HB_IS_BLOCK( pProgress ) ) { - pProgressInfo = pProgress; + hbza_pProgressInfo = pProgress; szZip.SetCallback( &spanac ); } for ( ulCount = 1;( ulCount<= hb_arrayLen( pArray ) ) ;ulCount++ ) { szDummy = ( char * )hb_arrayGetCPtr( pArray, ulCount ) ; - dwSize = GetCurrentFileSize( szDummy ); + dwSize = hb_GetCurrentFileSize( szDummy ); bAdded = FALSE; @@ -307,7 +346,7 @@ int hb_CmpTdSpan( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBlock if ( bPath && !bAdded ) { szZip.AddNewFile( szDummy, iCompLevel, true, CZipArchive::zipsmSafeSmart, 65536 ); - bAdded = TRUE; + // bAdded = TRUE; } else if ( !bDrive && !bPath && !bAdded ) { @@ -343,7 +382,7 @@ bool hb_SetProgressofTdSpan( DWORD a, int iSoFar, void* pData ){ HB_SYMBOL_UNUSED( pData ); - hb_vmEvalBlockV( pProgressInfo, 2, Disk, Total); + hb_vmEvalBlockV( hbza_pProgressInfo, 2, Disk, Total); hb_itemRelease( Disk ); hb_itemRelease( Total ); @@ -395,13 +434,13 @@ int hb_CompressFileStd( char *szFile, char *szFiletoCompress, int iCompLevel, PH if ( HB_IS_BLOCK( pProgress ) ) { - pProgressInfo = pProgress; + hbza_pProgressInfo = pProgress; szZip.SetCallback( &spanac ); } try { - dwSize = GetCurrentFileSize( szFiletoCompress ); + dwSize = hb_GetCurrentFileSize( szFiletoCompress ); if ( dwSize != (DWORD) -1 ) { @@ -438,7 +477,7 @@ int hb_CompressFileStd( char *szFile, char *szFiletoCompress, int iCompLevel, PH } else { - bAdded = TRUE; + // bAdded = TRUE; } } else if ( !bDrive && !bPath && !bAdded ) @@ -471,7 +510,6 @@ int hb_CompressFileStd( char *szFile, char *szFiletoCompress, int iCompLevel, PH int hb_CmpTdSpanStd( char *szFile, char * szFiletoCompress, int iCompLevel, PHB_ITEM pBlock, BOOL bOverWrite, char *szPassWord, int iSpanSize, BOOL bPath, BOOL bDrive, PHB_ITEM pProgress ) { - DWORD dwSize; BOOL bAdded = FALSE; BOOL bReturn = TRUE; BOOL bFileExist = hb_fsFile( ( BYTE* )szFile ); @@ -520,7 +558,7 @@ int hb_CmpTdSpanStd( char *szFile, char * szFiletoCompress, int iCompLevel, PHB_ if ( HB_IS_BLOCK( pProgress ) ) { - pProgressInfo = pProgress; + hbza_pProgressInfo = pProgress; szZip.SetCallback( &spanac ); } if ( bReturn ) @@ -532,8 +570,6 @@ int hb_CmpTdSpanStd( char *szFile, char * szFiletoCompress, int iCompLevel, PHB_ szZip.SetPassword( szPassWord ); } - dwSize = GetCurrentFileSize( szFiletoCompress ); - if( pBlock != NULL ) { PHB_ITEM FileName=hb_itemPutC( NULL, szFiletoCompress ) ; @@ -566,7 +602,7 @@ int hb_CmpTdSpanStd( char *szFile, char * szFiletoCompress, int iCompLevel, PHB_ } else { - bAdded = TRUE; + // bAdded = TRUE; } } else if ( !bDrive && !bPath && !bAdded ) diff --git a/harbour/contrib/hbziparch/zipnew.cpp b/harbour/contrib/hbziparch/hbzipnew.cpp similarity index 93% rename from harbour/contrib/hbziparch/zipnew.cpp rename to harbour/contrib/hbziparch/hbzipnew.cpp index 8e6301e675..941657cb3f 100644 --- a/harbour/contrib/hbziparch/zipnew.cpp +++ b/harbour/contrib/hbziparch/hbzipnew.cpp @@ -53,11 +53,6 @@ #include "hbziparc.h" #include "hbapifs.h" -PHB_ITEM ZipArray; - -extern PHB_ITEM ChangeDiskBlock; -extern PHB_ITEM pProgressInfo; - int hb_CheckSpanMode( char * szFile ); #ifdef __cplusplus @@ -77,7 +72,7 @@ class SpanCallback : public CZipSpanCallback { PHB_ITEM Disk = hb_itemPutNL( NULL, m_uDiskNeeded ) ; - hb_vmEvalBlockV( ChangeDiskBlock, 1, Disk); + hb_vmEvalBlockV( hbza_ChangeDiskBlock, 1, Disk); hb_itemRelease( Disk ); @@ -92,7 +87,7 @@ class SpanActionCallback : public CZipActionCallback PHB_ITEM Disk = hb_itemPutNL( NULL , m_uTotalSoFar ), Total= hb_itemPutNL( NULL, m_uTotalToDo ); - hb_vmEvalBlockV( pProgressInfo, 2, Disk, Total); + hb_vmEvalBlockV( hbza_pProgressInfo, 2, Disk, Total); hb_itemRelease( Disk ); hb_itemRelease( Total ); @@ -156,7 +151,7 @@ int hb_CmpPkSpan( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBlock if ( HB_IS_BLOCK( pProgress ) ) { - pProgressInfo = pProgress; + hbza_pProgressInfo = pProgress; szZip.SetCallback( &spanac ); } @@ -181,7 +176,7 @@ int hb_CmpPkSpan( char *szFile, PHB_ITEM pArray, int iCompLevel, PHB_ITEM pBlock if ( bPath && !bAdded ) { szZip.AddNewFile( szDummy, iCompLevel, true, CZipArchive::zipsmSafeSmart, 65536 ); - bAdded = true; + // bAdded = true; } else if ( !bDrive && !bPath && !bAdded ) { @@ -248,8 +243,8 @@ PHB_ITEM hb___GetFileNamesFromZip( char *szFile, BOOL iMode ) { iNumberOfFiles = szZip.GetCount(); - ZipArray = hb_itemNew(NULL); - hb_arrayNew( ZipArray, iNumberOfFiles ); + hbza_ZipArray = hb_itemNew(NULL); + hb_arrayNew( hbza_ZipArray, iNumberOfFiles ); time_t theTime; tm *SzTime; @@ -377,7 +372,7 @@ PHB_ITEM hb___GetFileNamesFromZip( char *szFile, BOOL iMode ) Item = hb_itemNew( NULL ); hb_arraySetForward( TempArray, Attr, hb_itemPutCL( Item, szAttr, 5 )); hb_itemRelease( Item ); - hb_arraySetForward( ZipArray, ulCount+1, TempArray ); + hb_arraySetForward( hbza_ZipArray, ulCount+1, TempArray ); hb_itemRelease( TempArray ); } @@ -387,7 +382,7 @@ PHB_ITEM hb___GetFileNamesFromZip( char *szFile, BOOL iMode ) CZipString szTempString = ( LPCTSTR )fh.GetFileName( ); szFileNameInZip = ( const char * )szTempString; Item = hb_itemNew( NULL ); - hb_arraySetForward( ZipArray, ulCount+1, hb_itemPutC( Item, ( char * ) szFileNameInZip )); + hb_arraySetForward( hbza_ZipArray, ulCount+1, hb_itemPutC( Item, ( char * ) szFileNameInZip )); hb_itemRelease( Item ); } @@ -397,7 +392,7 @@ PHB_ITEM hb___GetFileNamesFromZip( char *szFile, BOOL iMode ) szZip.Close( ); - return ZipArray; + return hbza_ZipArray; } char *hb___CheckFile( char * szFile ) @@ -485,20 +480,20 @@ int hb___GetNumberofFilestoUnzip( char *szFile ) int hb___SetCallbackFunc( PHB_ITEM pFunc ) { - //ChangeDiskBlock.type = HB_IT_NIL; - if ( ChangeDiskBlock ) + //hbza_ChangeDiskBlock.type = HB_IT_NIL; + if ( hbza_ChangeDiskBlock ) { - hb_itemRelease( ChangeDiskBlock ); - ChangeDiskBlock = NULL; + hb_itemRelease( hbza_ChangeDiskBlock ); + hbza_ChangeDiskBlock = NULL; } - ChangeDiskBlock = hb_itemNew(NULL); + hbza_ChangeDiskBlock = hb_itemNew(NULL); if( pFunc ) { - hb_itemCopy( ChangeDiskBlock, pFunc ); + hb_itemCopy( hbza_ChangeDiskBlock, pFunc ); } -// pZipI.pItem = ChangeDiskBlock; +// pZipI.pItem = hbza_ChangeDiskBlock; return ( int ) true; } @@ -509,7 +504,7 @@ bool hb_SetCallBack( DWORD iNumber, int, void* pData ) HB_SYMBOL_UNUSED( pData ); - hb_vmEvalBlockV( ChangeDiskBlock, 1, Disk); + hb_vmEvalBlockV( hbza_ChangeDiskBlock, 1, Disk); hb_itemRelease( Disk ); @@ -523,6 +518,8 @@ int hb_DeleteSel( char *szFile, PHB_ITEM pArray, BOOL bCase ) CZipArchive szZip; CZipStringArray aFiles; + HB_SYMBOL_UNUSED( bCase ); + try { switch(hb_CheckSpanMode( szFile )) @@ -574,7 +571,7 @@ int hb_UnzipSel( char *szFile, PHB_ITEM pBlock, BOOL lWithPath, char *szPassWord if ( HB_IS_BLOCK( pProgress ) ) { - pProgressInfo = pProgress; + hbza_pProgressInfo = pProgress; szZip.SetCallback( &spanac ); } @@ -800,7 +797,7 @@ int hb_UnzipSelIndex( char *szFile, PHB_ITEM pBlock, BOOL lWithPath, char *szPas if ( HB_IS_BLOCK( pProgress ) ) { - pProgressInfo = pProgress; + hbza_pProgressInfo = pProgress; szZip.SetCallback( &spanac ); } @@ -953,78 +950,35 @@ BOOL hb_TransferFilesFromzip( char *szSource, char *szDest, PHB_ITEM pArray ) return FALSE; } -DWORD GetCurrentFileSize( LPCTSTR szFile ) -#if defined( HB_OS_WIN_32 ) || defined( __MINGW32__ ) -{ - DWORD dwFlags = FILE_ATTRIBUTE_ARCHIVE; - HANDLE hFind; - WIN32_FIND_DATA hFilesFind; - - hFind = FindFirstFile( szFile, &hFilesFind ); - - if ( hFind != INVALID_HANDLE_VALUE ) - { - if ( dwFlags & hFilesFind.dwFileAttributes ) - { - if( hFilesFind.nFileSizeHigh>0 ) - { - return ( ( hFilesFind.nFileSizeHigh*MAXDWORD )+hFilesFind.nFileSizeLow ); - } - else - { - return ( hFilesFind.nFileSizeLow ); - } - - } - } - - FindClose( hFind ); - - return ( DWORD ) -1; - -} -#elif defined( __GNUC__ ) -{ - USHORT ushbMask = 63; - USHORT usFileAttr = HB_FA_ARCHIVE; - struct stat sStat; - - if ( stat( szFile, &sStat ) != -1 ) - { - return sStat.st_size; - } - - return -1; -} - -#endif - int hb_UnzipAll(char *szFile,PHB_ITEM pBlock, BOOL bWithPath,char *szPassWord,char *pbyBuffer,PHB_ITEM pDiskBlock,PHB_ITEM pProgress) { -bool iReturn=true; -uLong uiCount=0; -int iCause=0; -int iMode=true; -CZipArchive szZip; -BOOL bChange=FALSE; + bool iReturn = true; + uLong uiCount = 0; +// int iCause = 0; + int iMode = true; + CZipArchive szZip; + BOOL bChange = FALSE; SpanCallback span; SpanActionCallback spanac; char * szPath = (char*) hb_xgrab( _POSIX_PATH_MAX + 1 ); BOOL bFreePath = TRUE; + HB_SYMBOL_UNUSED( pDiskBlock ); if ( HB_IS_BLOCK( pProgress ) ) { - pProgressInfo = pProgress; + hbza_pProgressInfo = pProgress; szZip.SetCallback( &spanac ); } - if (szPassWord != NULL){ - szZip.SetPassword(szPassWord); - } - iMode=hb_CheckSpanMode(szFile); + if (szPassWord != NULL ) + { + szZip.SetPassword(szPassWord); + } + + iMode=hb_CheckSpanMode(szFile); try { if(iMode==0) { @@ -1046,7 +1000,7 @@ BOOL bChange=FALSE; } } catch (CZipException &e) { - iCause=e.m_iCause ; + // iCause=e.m_iCause ; } if (iReturn) { @@ -1117,7 +1071,7 @@ BOOL bChange=FALSE; catch ( CZipException& e ) { szZip.CloseFile( NULL, true); - iCause=e.m_iCause ; + // iCause=e.m_iCause ; } if(bChange) { diff --git a/harbour/contrib/hbziparch/make_b32_dll.bat b/harbour/contrib/hbziparch/make_b32_dll.bat deleted file mode 100644 index 3976962904..0000000000 --- a/harbour/contrib/hbziparch/make_b32_dll.bat +++ /dev/null @@ -1,43 +0,0 @@ -@echo off -REM -REM $Id$ -REM -REM - -rem --------------------------------------------------------------- - -rem Save the user value, force silent file overwrite with COPY -rem (not all Windows versions support the COPY /Y flag) -set HB_ORGENV_COPYCMD=%COPYCMD% -set COPYCMD=/Y - -if "%1" == "clean" goto CLEAN -if "%1" == "CLEAN" goto CLEAN - -if not exist obj\dll md obj\dll -if not exist obj\dll\b32 md obj\dll\b32 - -:BUILD - - make -fmake_b32_dll.mak %1 %2 %3 > make_b32_dll.log - if errorlevel 1 goto notepad make_b32_dll.log - -:BUILD_OK - - if exist hdll.tmp del hdll.tmp - if exist ..\..\lib\b32\hbziparchdll.dll implib ..\..\lib\b32\hbziparchdll.lib ..\..\lib\b32\hbziparchdll.dll > nul - if exist ..\..\lib\b32\hbziparchdll.dll copy ..\..\lib\b32\hbziparchdll.dll ..\..\lib > nul - if exist ..\..\lib\b32\hbziparchdll.lib copy ..\..\lib\b32\hbziparchdll.lib ..\..\lib > nul - - goto EXIT - -:CLEAN - - if exist dll_b32.log del dll_b32.log - -:EXIT - -rem --------------------------------------------------------------- - -rem Restore user value -set COPYCMD=%HB_ORGENV_COPYCMD% diff --git a/harbour/contrib/hbziparch/make_b32_dll.mak b/harbour/contrib/hbziparch/make_b32_dll.mak deleted file mode 100644 index f4677d606a..0000000000 --- a/harbour/contrib/hbziparch/make_b32_dll.mak +++ /dev/null @@ -1,187 +0,0 @@ -# -# $Id$ -# -# ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -# ³ general definition ³Û -# ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ -# ßßßßßßßßßßßßßßßßßßßßßßß -# BIN_DIR is defined in dll_55.bat, please adjust accordingly - -CC = bcc32 - -# ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -# ³ source directory ³Û -# ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ -# ßßßßßßßßßßßßßßßßßßßß -# This is standard per repository - -COMMON_DIR = . - -# ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -# ³ obj file output directory ³Û -# ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ -# ßßßßßßßßßßßßßßßßßßßßßßßßßßßßß -# Please adjust according to your environment - -OBJ_DIR = obj\dll\b32 - -# ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -# ³ include directory ³Û -# ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ -# ßßßßßßßßßßßßßßßßßßßßß - -INCLUDE_DIR = include;..\..\include; - -# ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -# ³ compiler flags ³Û -# ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ -# ßßßßßßßßßßßßßßßßßß - - -C_USR = -tW -D__WIN32__ -D__EXPORT__ -CLIBFLAGS = $(C_USR) -a8 -OS -O2 -6 -c -I$(INCLUDE_DIR) -d -w- - -# ÚÄÄÄÄÄÄÄÄ¿ -# ³ output ³Û -# ÀÄÄÄÄÄÄÄÄÙÛ -# ßßßßßßßßßß -# Please adjust according to your environment - -HARBOUR_DLL = ..\..\lib\b32\hbziparchdll.dll - -# ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -# ³ HARBOUR_DLL rules ³Û -# ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ -# ßßßßßßßßßßßßßßßßßßßßß - -HARBOUR_DLL_OBJS = \ - $(OBJ_DIR)\hbziparc.obj\ - $(OBJ_DIR)\hbcomprs.obj\ - $(OBJ_DIR)\ziparchive.obj\ - $(OBJ_DIR)\ZipPlatform_win.obj\ - $(OBJ_DIR)\zipstorage.obj\ - $(OBJ_DIR)\zipstring.obj\ - $(OBJ_DIR)\zipplatformcomm.obj\ - $(OBJ_DIR)\ZipPathComponent_win.obj\ - $(OBJ_DIR)\zipmemfile.obj\ - $(OBJ_DIR)\zipfileheader.obj\ - $(OBJ_DIR)\zipfile.obj\ - $(OBJ_DIR)\zipnew.obj\ - $(OBJ_DIR)\zipcomp.obj\ - $(OBJ_DIR)\zipexception.obj\ - $(OBJ_DIR)\zipcompatibility.obj\ - $(OBJ_DIR)\zipcentraldir.obj\ - $(OBJ_DIR)\zipautobuffer.obj\ - $(OBJ_DIR)\stdafx.obj - - -# ÚÄÄÄÄÄÄÄÄÄ¿ -# ³ project ³Û -# ÀÄÄÄÄÄÄÄÄÄÙÛ -# ßßßßßßßßßßß - -all: \ - $(HARBOUR_DLL) - -CLEAN: - -@if exist $(HARBOUR_DLL) del $(HARBOUR_DLL) >nul - -@if exist ..\..\lib\b32\hbziparchdll.tds del ..\..\lib\b32\hbziparchdll.tds >nul - -@if exist ..\..\lib\b32\hbziparchdll.map del ..\..\lib\b32\hbziparchdll.map >nul - -@if exist $(OBJ_DIR)\*.obj del $(OBJ_DIR)\*.obj >nul - -@if exist $(OBJ_DIR)\*.c del $(OBJ_DIR)\*.c >nul - -@if exist $(OBJ_DIR)\*.h del $(OBJ_DIR)\*.h >nul - -# ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -# ³ Library dependencies and build rules ³Û -# ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ -# ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß - -$(HARBOUR_DLL) : \ - $(HARBOUR_DLL_OBJS) - -# ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -# ³ HARBOUR_DLL linking ³Û -# ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ -# ßßßßßßßßßßßßßßßßßßßßßßß - echo. $(OBJ_DIR)\hbziparc.obj + > hdll.tmp - echo. $(OBJ_DIR)\hbcomprs.obj + >> hdll.tmp - echo. $(OBJ_DIR)\ziparchive.obj + >> hdll.tmp - echo. $(OBJ_DIR)\ZipPlatform_win.obj + >> hdll.tmp - echo. $(OBJ_DIR)\zipstorage.obj + >> hdll.tmp - echo. $(OBJ_DIR)\zipstring.obj + >> hdll.tmp - echo. $(OBJ_DIR)\zipplatformcomm.obj + >> hdll.tmp - echo. $(OBJ_DIR)\ZipPathComponent_win.obj + >> hdll.tmp - echo. $(OBJ_DIR)\zipmemfile.obj + >> hdll.tmp - echo. $(OBJ_DIR)\zipfileheader.obj + >> hdll.tmp - echo. $(OBJ_DIR)\zipfile.obj + >> hdll.tmp - echo. $(OBJ_DIR)\zipnew.obj + >> hdll.tmp - echo. $(OBJ_DIR)\zipcomp.obj + >> hdll.tmp - echo. $(OBJ_DIR)\zipexception.obj + >> hdll.tmp - echo. $(OBJ_DIR)\zipcompatibility.obj + >> hdll.tmp - echo. $(OBJ_DIR)\zipcentraldir.obj + >> hdll.tmp - echo. $(OBJ_DIR)\zipautobuffer.obj + >> hdll.tmp - echo. $(OBJ_DIR)\stdafx.obj + >> hdll.tmp - echo. c0d32w.obj, + >> hdll.tmp - echo. $(HARBOUR_DLL), + >> hdll.tmp - echo. , + >> hdll.tmp - echo. cw32.lib + >> hdll.tmp - echo. ..\..\lib\harbour.lib + >> hdll.tmp - echo. import32.lib + >> hdll.tmp - echo. uuid.lib >> hdll.tmp - ILINK32 -aa -Tpd -Gn @hdll.tmp - -# ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -# ³ object file creation ³Û -# ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ -# ßßßßßßßßßßßßßßßßßßßßßßßß - -$(OBJ_DIR)\hbziparc.obj : $(COMMON_DIR)\hbziparc.c - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\ziparchive.obj : $(COMMON_DIR)\ziparchive.cpp - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\ZipPlatform_win.obj : $(COMMON_DIR)\ZipPlatform_win.cpp - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\zipstorage.obj : $(COMMON_DIR)\zipstorage.cpp - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\zipstring.obj : $(COMMON_DIR)\zipstring.cpp - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\zipplatformcomm.obj : $(COMMON_DIR)\zipplatformcomm.cpp - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\ZipPathComponent_win.obj : $(COMMON_DIR)\ZipPathComponent_win.cpp - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\zipmemfile.obj : $(COMMON_DIR)\zipmemfile.cpp - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\zipfileheader.obj : $(COMMON_DIR)\zipfileheader.cpp - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\zipfile.obj : $(COMMON_DIR)\zipfile.cpp - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\zipnew.obj : $(COMMON_DIR)\zipnew.cpp - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\zipcomp.obj : $(COMMON_DIR)\zipcomp.cpp - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\zipexception.obj : $(COMMON_DIR)\zipexception.cpp - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\zipcompatibility.obj : $(COMMON_DIR)\zipcompatibility.cpp - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\zipcentraldir.obj : $(COMMON_DIR)\zipcentraldir.cpp - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\zipautobuffer.obj : $(COMMON_DIR)\zipautobuffer.cpp - $(CC) $(CLIBFLAGS) -o$@ $** - -$(OBJ_DIR)\stdafx.obj : $(COMMON_DIR)\stdafx.cpp - $(CC) $(CLIBFLAGS) -o$@ $**