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