Subversion Repositories autosfx

Rev

Blame | Last modification | View Log | RSS feed

  1. #ifndef _DZ_ERRS_H_
  2. #define _DZ_ERRS_H_
  3. /*
  4.  
  5.   Copyright (c) 1990-2007 Info-ZIP.  All rights reserved.
  6.  
  7.   See the accompanying file LICENSE, version 2007-Mar-4 or later
  8.   (the contents of which are also included in zip.h) for terms of use.
  9.   If, for some reason, all these files are missing, the Info-ZIP license
  10.   also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
  11.  
  12.   parts Copyright (C) 1997 Mike White, Eric W. Engler
  13. ************************************************************************
  14.  Copyright (C) 2009, 2010  by Russell J. Peters, Roger Aelbrecht
  15.  
  16.    This file is part of TZipMaster Version 1.9.
  17.  
  18.     TZipMaster is free software: you can redistribute it and/or modify
  19.     it under the terms of the GNU Lesser General Public License as published by
  20.     the Free Software Foundation, either version 3 of the License, or
  21.     (at your option) any later version.
  22.  
  23.     TZipMaster is distributed in the hope that it will be useful,
  24.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  25.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  26.     GNU Lesser General Public License for more details.
  27.  
  28.     You should have received a copy of the GNU Lesser General Public License
  29.     along with TZipMaster.  If not, see <http://www.gnu.org/licenses/>.
  30.  
  31.     contact: problems@delphizip.org (include ZipMaster in the subject).
  32.     updates: http://www.delphizip.org
  33.     DelphiZip maillist subscribe at http://www.freelists.org/list/delphizip
  34. ************************************************************************/
  35. //#include "DllMsg.h"
  36.  
  37. #define DZ_ERR_GOOD   0  // ZEN_OK
  38. #define DZ_ERR_CANCELLED  1
  39. #define DZ_ERR_ABORT   2
  40. #define DZ_ERR_CALLBACK  3
  41. #define DZ_ERR_MEMORY   4
  42. #define DZ_ERR_STRUCT   5
  43. #define DZ_ERR_ERROR   6
  44. #define DZ_ERR_PASSWORD_FAIL  7
  45. #define DZ_ERR_PASSWORD_CANCEL 8
  46. #define DZ_ERR_INVAL_ZIP      9  // ZEN_FORM PK_BADERR
  47. #define DZ_ERR_NO_CENTRAL     10  // UEN_EOF01
  48. #define DZ_ERR_ZIP_EOF        11  // ZEN_EOF
  49. #define DZ_ERR_ZIP_END        12  // UEN_EOF02
  50. #define DZ_ERR_ZIP_NOOPEN     13
  51. #define DZ_ERR_ZIP_MULTI      14
  52. #define DZ_ERR_NOT_FOUND      15
  53. #define DZ_ERR_LOGIC_ERROR    16  // ZEN_LOGIC
  54. #define DZ_ERR_NOTHING_TO_DO  17  // ZEN_NONE
  55. #define DZ_ERR_BAD_OPTIONS    18  // ZEN_PARM
  56. #define DZ_ERR_TEMP_FAILED    19  // ZEN_TEMP
  57. #define DZ_ERR_NO_FILE_OPEN   20  // ZEN_OPEN
  58. #define DZ_ERR_ERROR_READ     21  // ZEN_READ
  59. #define DZ_ERR_ERROR_CREATE   22  // ZEN_CREAT
  60. #define DZ_ERR_ERROR_WRITE    23  // ZEN_WRITE
  61. #define DZ_ERR_ERROR_SEEK     24
  62. #define DZ_ERR_EMPTY_ZIP      25
  63. #define DZ_ERR_INVAL_NAME     26
  64. #define DZ_ERR_GENERAL        27  // PK_ERR
  65. #define DZ_ERR_MISS           28  // ZEN_MISS UEN_MISC03
  66. #define DZ_ERR_WARNING        29  // PK_WARN
  67. #define DZ_ERR_ERROR_DELETE   30  // PK_NODEL
  68. #define DZ_ERR_FATAL_IMPORT   31
  69. #define DZ_ERR_SKIPPING       32
  70. #define DZ_ERR_LOCKED         33
  71. #define DZ_ERR_DENIED         34
  72. #define DZ_ERR_DUPNAME        35
  73. #define DZ_ERR_SKIPPED            36
  74.  
  75. //#define DZ_RES_BASE           4000
  76. //#define DZ_ERR_MISS     ((signed char)-1)
  77. //#define DZ_ERR_FIX_MISS(x) ((DZ_ERR(x)==DZ_ERR_MISS)?(x&0x7FFFFF00L)|DZ_ERR_SKIPPING:x)
  78.  
  79. #ifndef _DZ_RES_ONLY
  80.  
  81. /*    Message code format
  82. 0FFF FFFF  LLLL LLLL   LLLL MTTT  EEEE EEEE  {31 .. 0}
  83. F = file number (7 bits = 128 files)
  84. L = line number (12 bits=4096 lines)
  85. M = message instead of error string
  86. T = type  (3 bits=8)
  87. E = error/string code (8 bits = 256 errors)
  88. */
  89.  
  90. const DZM_MessageBit = 0x800;    // mask for buffer bit
  91. // t = type, e = error
  92. #define DZ_MESSAGE(t, e) ((t&0xF00) | e)
  93. #define DZ_MSG(x) (x & 0xff)
  94. #define DZ_MSGTYP(x) (x & 0x700)
  95. const DZM_General = 0x000;
  96. const DZM_Error   = 0x600;      // 1 1 x (E... is identifier)
  97. const DZM_Warning = 0x400;      // 1 0 x
  98. const DZM_Trace   = 0x300;  // 0 1 1
  99. const DZM_Verbose = 0x100;      // 0 0 1
  100. const DZM_Message = 0x200;  // 0 1 0 (E... is identifier)
  101.  
  102. // t = type, e = error
  103. #define DZ_ERROR(t, e) ((_DZ_FILE_ << 24) | (__LINE__ << 12) | DZ_MESSAGE(t, e))
  104. //#define DZ_ERR(x) ((signed char)(x & 0xff))
  105. #define DZ_ERR(x) (x & 0xff)
  106.  
  107. #define IMSG      (DZ_ERROR(DZM_General, 0))
  108. #define IWARNING  (DZ_ERROR(DZM_Warning, 0))
  109. #define IERROR    (DZ_ERROR(DZM_Error, 0))
  110. #define IVERBOSE  (DZ_ERROR(DZM_Verbose, 0))
  111. #define ITRACE    (DZ_ERROR(DZM_Trace, 0))
  112. #define IDIAG     (DZ_ERROR(DZM_Trace, 0))
  113.  
  114. #define diag(m) \
  115.     if (Verbose < 0)    \
  116.         Notify(ITRACE, (m))
  117. // files
  118. #define DZ_COMMON_CPP   1
  119. #define DZ_CRC32_CPP    2
  120. #define DZ_CRCTAB_CPP   3
  121. #define DZ_CRYPT_CPP    4
  122. #define DZ_DZFRAME_CPP  5
  123. #define DZ_DZOPER_CPP   6
  124. #define DZ_ENTER_CPP    7
  125. #define DZ_HELPERS_CPP  8
  126. #define DZ_INGMTCH_CPP  9
  127. #define DZ_UINFLATE_CPP 10
  128. #define DZ_UNZCRYPT_CPP 11
  129. #define DZ_UNZEXEC_CPP  12
  130. #define DZ_UNZFIO_CPP   13
  131. #define DZ_UNZINF_CPP   14
  132. #define DZ_UNZOP_CPP    15
  133. #define DZ_UNZPROC_CPP  16
  134. #define DZ_UNZSS_CPP    17
  135. #define DZ_UNZSUP_CPP   18
  136. #define DZ_UNZWIN32_CPP 19
  137. #define DZ_UNZXPLODE_CPP 20
  138. #define DZ_UNZXTRCT_CPP 21
  139. #define DZ_UTIL_CPP     22
  140. #define DZ_ZBITS_CPP    23
  141. #define DZ_ZCRYPT_CPP   24
  142. #define DZ_ZDEFLATE_CPP 25
  143. #define DZ_ZIPDFLT_CPP  26
  144. #define DZ_ZIPFILE_CPP  27
  145. #define DZ_ZIPFIO_CPP   28
  146. #define DZ_ZIPFNC_CPP   29
  147. #define DZ_ZIPMAIN_CPP  30
  148. #define DZ_ZIPOP_CPP    31
  149. #define DZ_ZIPPRC_CPP   32
  150. #define DZ_ZIPREAD_CPP  33
  151. #define DZ_ZIPSEL_CPP   34
  152. #define DZ_ZIPSS_CPP    35
  153. #define DZ_ZIPUP_CPP    36
  154. #define DZ_ZIPWIN32_CPP 37
  155. #define DZ_ZMATCH_CPP   38
  156. #define DZ_ZSTRINGS_CPP 39
  157. #define DZ_ZTREES_CPP   40
  158. #define DZ_DZIMPORT_CPP 41
  159. #define DZ_DZ_STRW_CPP  42
  160. #define DZ_DZRAW_CPP    43
  161.  
  162.  
  163. #define DZ_ERM_CANCELLED        DZ_ERROR(DZM_Error, DZ_ERR_CANCELLED)
  164. #define DZ_ERM_MEMORY           DZ_ERROR(DZM_Error, DZ_ERR_MEMORY)
  165. #define DZ_ERM_PASSWORD_FAIL    DZ_ERROR(DZM_Error, DZ_ERR_PASSWORD_FAIL)
  166. #define DZ_ERM_PASSWORD_CANCEL  DZ_ERROR(DZM_Error, DZ_ERR_PASSWORD_CANCEL)
  167. #define DZ_ERM_INVAL_ZIP        DZ_ERROR(DZM_Error, DZ_ERR_INVAL_ZIP)
  168. #define DZ_ERM_NO_CENTRAL       DZ_ERROR(DZM_Error, DZ_ERR_NO_CENTRAL)
  169. #define DZ_ERM_ZIP_EOF          DZ_ERROR(DZM_Error, DZ_ERR_ZIP_EOF)
  170. #define DZ_ERM_ZIP_END          DZ_ERROR(DZM_Error, DZ_ERR_ZIP_END)
  171. #define DZ_ERM_ZIP_NOOPEN       DZ_ERROR(DZM_Error, DZ_ERR_ZIP_NOOPEN)
  172. #define DZ_ERM_ZIP_MULTI        DZ_ERROR(DZM_Error, DZ_ERR_ZIP_MULTI)
  173. #define DZ_ERM_ABORT            DZ_ERROR(DZM_Error, DZ_ERR_ABORT)
  174. #define DZ_ERM_NOT_FOUND        DZ_ERROR(DZM_Error, DZ_ERR_NOT_FOUND)
  175. #define DZ_ERM_LOGIC_ERROR      DZ_ERROR(DZM_Error, DZ_ERR_LOGIC_ERROR)
  176. #define DZ_ERM_NOTHING_TO_DO    DZ_ERROR(DZM_Error, DZ_ERR_NOTHING_TO_DO)
  177. #define DZ_ERM_BAD_OPTIONS      DZ_ERROR(DZM_Error, DZ_ERR_BAD_OPTIONS)
  178. #define DZ_ERM_TEMP_FAILED      DZ_ERROR(DZM_Error, DZ_ERR_TEMP_FAILED)
  179. #define DZ_ERM_NO_FILE_OPEN     DZ_ERROR(DZM_Error, DZ_ERR_NO_FILE_OPEN)
  180. #define DZ_ERM_ERROR_READ       DZ_ERROR(DZM_Error, DZ_ERR_ERROR_READ)
  181. #define DZ_ERM_ERROR_CREATE     DZ_ERROR(DZM_Error, DZ_ERR_ERROR_CREATE)
  182. #define DZ_ERM_ERROR_WRITE      DZ_ERROR(DZM_Error, DZ_ERR_ERROR_WRITE)
  183. #define DZ_ERM_ERROR_SEEK       DZ_ERROR(DZM_Error, DZ_ERR_ERROR_SEEK)
  184. #define DZ_ERM_EMPTY_ZIP        DZ_ERROR(DZM_Error, DZ_ERR_EMPTY_ZIP)
  185. #define DZ_ERM_INVAL_NAME       DZ_ERROR(DZM_Error, DZ_ERR_INVAL_NAME)
  186. #define DZ_ERM_ERROR            DZ_ERROR(DZM_Error, DZ_ERR_ERROR)
  187. #define DZ_ERM_SKIPPING         DZ_ERROR(DZM_Error, DZ_ERR_SKIPPING)
  188. #define DZ_ERM_GENERAL          DZ_ERROR(DZM_Error, DZ_ERR_GENERAL)
  189. #define DZ_ERM_MISS             DZ_ERROR(DZM_Error, DZ_ERR_MISS)
  190. #define DZ_ERM_SKIPPED          DZ_ERROR(DZM_Error, DZ_ERR_SKIPPED)
  191.  
  192. #define DZ_ERM_WARNING          DZ_ERROR(DZM_Warning, DZ_ERR_WARNING)
  193. #define DZ_ERM_ERROR_DELETE     DZ_ERROR(DZM_Error, DZ_ERR_ERROR_DELETE)  
  194. #define DZ_ERM_FATAL_IMPORT     DZ_ERROR(DZM_Error, DZ_ERR_FATAL_IMPORT)
  195. #define DZ_ERM_LOCKED           DZ_ERROR(DZM_Error, DZ_ERR_LOCKED)
  196. #define DZ_ERM_DENIED           DZ_ERROR(DZM_Error, DZ_ERR_DENIED)
  197. #define DZ_ERM_DUPNAME          DZ_ERROR(DZM_Error, DZ_ERR_DUPNAME)
  198.  
  199. #define DZ_MSG_ERROR 37
  200. #define DZ_MSG_SKIPPING 38
  201. #define DZ_MSG_ADDED    39
  202. #define DZ_MSG_EXTRACTED 40
  203. #define DZ_MSG_TESTED  41
  204.  
  205. //#include <exception>
  206.  
  207. class DZFatalException//: public exception()
  208. {
  209.     protected:
  210.         const TCHAR *fEMsg;
  211.         int fENo;
  212.  
  213.     public:
  214.         DZFatalException(int no = 0, const TCHAR *msg = NULL): fEMsg(msg), fENo(no)
  215.         {
  216.             ;
  217.         }
  218.  
  219.                 __property int ErrNo = {read = fENo};
  220.         __property const TCHAR *Msg = {read = fEMsg};
  221. };
  222.  
  223. // gives message
  224.  
  225. class DZException: public DZFatalException
  226. {
  227.     public:
  228.         DZException(int no, const TCHAR *msg = NULL):  DZFatalException(no, msg) {}
  229. };
  230.  
  231. //class DZAbort: public DZException
  232. //{
  233. //    public:
  234. //        DZAbort(int no): DZException(no, _T("User Abort")) {}
  235. //};
  236.  
  237. #endif
  238. #endif
  239.  
  240.