2
Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
4
See the accompanying file LICENSE, version 2000-Apr-09 or later
5
(the contents of which are also included in unzip.h) for terms of use.
6
If, for some reason, all these files are missing, the Info-ZIP license
7
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
9
/*---------------------------------------------------------------------------
13
This header-files is global to the project Unzip Sioux.
15
---------------------------------------------------------------------------*/
17
/*****************************************************************************/
18
/* Macros, typedefs */
19
/*****************************************************************************/
32
/*****************************************************************************/
33
/* Includes standard headers */
34
/*****************************************************************************/
35
#include <ansi_prefix.mac.h>
36
#include <TextUtils.h>
39
#include <Resources.h>
42
#include <Processes.h>
43
#include <MacWindows.h>
45
#include <ToolUtils.h>
48
#include <StandardFile.h>
56
#define LOG_DEBUG 7 /* debug-level messages */
57
int Print2Syslog(UInt8 priority, const char *format, ...);
63
(void)Print2Syslog(LOG_DEBUG, "%s (file: %s line: %d)", \
64
msg, __FILE__, __LINE__); \
69
#define Assert_it(cond,msg,kind) \
73
(void)Print2Syslog(LOG_DEBUG, "%s failed: [%s] cond: [%s] (file: %s line: %d)", \
74
kind, msg, #cond, __FILE__, __LINE__); \
80
#define AssertBool(b,msg) \
81
Assert_it (((b) == TRUE) || ((b) == FALSE),(msg),("AssertBool "))
85
#define AssertStr(s,msg) \
88
Assert_it ((s),(msg),("1. AssertStr ")); \
90
Assert_it ((!iscntrl((s)[s_i]) || ((s)[s_i] == 0x0A) || \
91
((s)[s_i] == 0x0D)),(s),("2. AssertStr ")); \
98
#define AssertTime(t,msg) \
99
Assert_it (((t).tm_sec >= 0) && ((t).tm_sec < 62) && \
100
((t).tm_min >= 0) && ((t).tm_min < 60) && \
101
((t).tm_hour >= 0) && ((t).tm_hour < 24) && \
102
((t).tm_mday >= 1) && ((t).tm_mday < 32) && \
103
((t).tm_mon >= 0) && ((t).tm_mon < 12) && \
104
((t).tm_wday >= 0) && ((t).tm_wday < 7) && \
105
((t).tm_yday >= 0) && ((t).tm_yday < 366),(msg),("AssertStr "))
109
#define AssertIntRange(myvalue,minimum,maximum, msg) \
110
Assert_it (((myvalue) >= (minimum)) && ((myvalue) <= (maximum)), \
111
msg,("AssertIntRange "))
115
#define AssertStrNoOverlap(str1,str2,msg) \
118
AssertStr((str1),(msg)) \
119
AssertStr((str2),(msg)) \
120
if ((str1) < (str2)) \
122
s_i = strlen((str2)); \
123
Assert_it ( (((str1) + s_i) < (str2)),(msg),("AssertStrNoOverlap ")); \
127
s_i = strlen((str1)); \
128
Assert_it ( (((str2) + s_i) < (str1)),(msg),("AssertStrNoOverlap ")); \
135
#else /* !MAC_DEBUG */
136
#define Assert_it(cond,msg,kind)
137
#define AssertBool(b,msg)
138
#define AssertStr(s,msg)
139
#define AssertTime(t,msg)
140
#define AssertIntRange(myvalue,minimum,maximum,msg)
141
#define AssertStrNoOverlap(str1,str2,msg)
142
#endif /* ?MAC_DEBUG */