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