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 162 163 164 165 166 167
|
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
/*---------------------------------------------------------------------------
ZipSx.h
This header-files is global to the project ZipSioux.
---------------------------------------------------------------------------*/
/*****************************************************************************/
/* Macros, typedefs */
/*****************************************************************************/
#define MACOS
#define USE_SIOUX
#define MACZIP
#define OLDROUTINENAMES 0 /* use new function names only */
#define OLDROUTINELOCATIONS 0 /* use new headerlocations only */
#define SystemSevenOrLater 1 /* Runs only on System 7.0 or later */
/* 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
#ifndef ZCONST
# define ZCONST const
#endif
#define NAME_MAX 1024
/*****************************************************************************/
/* Includes standard headers */
/*****************************************************************************/
#include <ansi_prefix.mac.h>
#include <stdio.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>
/* Many things are different for mac-users, so we need
special mac functions :-) */
int Zmacstat (const char *path, struct stat *buf);
#define stat(path, bufPtr) Zmacstat(path, bufPtr)
#define lstat(path, bufPtr) Zmacstat(path, bufPtr)
int fprintf(FILE *file, const char *format, ...);
int printf(const char *format, ...);
void perror(const char *parm1);
/*
#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
#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
|