1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
|
/*
Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 2000-Apr-09 or later
(the contents of which are also included in unzip.h) for terms of use.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
/*---------------------------------------------------------------------------
UnZpLib.h
This header-files is global to the project UnZpLib.
---------------------------------------------------------------------------*/
/*****************************************************************************/
/* Macros, typedefs */
/*****************************************************************************/
#define MacStaticLib
#define MACUNZIP
/* These functions are defined as a macro instead of a function.
so we have to undefine them for replacing (see printf.c) */
#undef getc
#undef getchar
#undef putchar
#undef putc
#ifndef TRUE
#define TRUE 1
#endif /* TRUE */
#ifndef FALSE
#define FALSE 0
#endif /* FALSE */
/*
#define DEBUG_TIME
*/
#define USE_EF_UT_TIME
/* since we have no TZ environment variable on Macs
this option must be disabled */
#undef IZ_CHECK_TZ
/*****************************************************************************/
/* Includes standard headers */
/*****************************************************************************/
#include <ansi_prefix.mac.h>
#include <TextUtils.h>
#include <Folders.h>
#include <Aliases.h>
#include <Resources.h>
#include <Gestalt.h>
#include <Traps.h>
#include <Processes.h>
#include <MacWindows.h>
#include <Fonts.h>
#include <ToolUtils.h>
#include <Dialogs.h>
#include <Devices.h>
#include <StandardFile.h>
/*
#define MAC_DEBUG 1
*/
#ifdef MAC_DEBUG
#define LOG_DEBUG 7 /* debug-level messages */
int Print2Syslog(UInt8 priority, const char *format, ...);
#include <ctype.h>
#define Notify(msg) \
{ \
(void)Print2Syslog(LOG_DEBUG, "%s (file: %s line: %d)", \
msg, __FILE__, __LINE__); \
}
#define Assert_it(cond,msg,kind) \
{ \
if (!(cond)) \
{ \
(void)Print2Syslog(LOG_DEBUG, "%s failed: [%s] cond: [%s] (file: %s line: %d)", \
kind, msg, #cond, __FILE__, __LINE__); \
} \
}
#define AssertBool(b,msg) \
Assert_it (((b) == TRUE) || ((b) == FALSE),(msg),("AssertBool "))
#define AssertStr(s,msg) \
{ \
int s_i = 0; \
Assert_it ((s),(msg),("1. AssertStr ")); \
while ((s)[s_i]) { \
Assert_it ((!iscntrl((s)[s_i]) || ((s)[s_i] == 0x0A) || \
((s)[s_i] == 0x0D)),(s),("2. AssertStr ")); \
s_i++; \
} \
}
#define AssertTime(t,msg) \
Assert_it (((t).tm_sec >= 0) && ((t).tm_sec < 62) && \
((t).tm_min >= 0) && ((t).tm_min < 60) && \
((t).tm_hour >= 0) && ((t).tm_hour < 24) && \
((t).tm_mday >= 1) && ((t).tm_mday < 32) && \
((t).tm_mon >= 0) && ((t).tm_mon < 12) && \
((t).tm_wday >= 0) && ((t).tm_wday < 7) && \
((t).tm_yday >= 0) && ((t).tm_yday < 366),(msg),("AssertStr "))
#define AssertIntRange(myvalue,minimum,maximum, msg) \
Assert_it (((myvalue) >= (minimum)) && ((myvalue) <= (maximum)), \
msg,("AssertIntRange "))
#define AssertStrNoOverlap(str1,str2,msg) \
{ \
long s_i = 0; \
AssertStr((str1),(msg)) \
AssertStr((str2),(msg)) \
if ((str1) < (str2)) \
{ \
s_i = strlen((str2)); \
Assert_it ( (((str1) + s_i) < (str2)),(msg),("AssertStrNoOverlap ")); \
} \
else \
{ \
s_i = strlen((str1)); \
Assert_it ( (((str2) + s_i) < (str1)),(msg),("AssertStrNoOverlap ")); \
} \
} \
#else /* !MAC_DEBUG */
#define Assert_it(cond,msg,kind)
#define AssertBool(b,msg)
#define AssertStr(s,msg)
#define AssertTime(t,msg)
#define AssertIntRange(myvalue,minimum,maximum,msg)
#define AssertStrNoOverlap(str1,str2,msg)
#endif /* ?MAC_DEBUG */
|