Debian Codegraph @

macos/ZipLib.h

raw
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 ZipLib.h
12
13 This header-files is global to the project ZipLib.
14
15 ---------------------------------------------------------------------------*/
16
17
18
19 /*****************************************************************************/
20 /* Macros, typedefs */
21 /*****************************************************************************/
22
23 #define MACOS
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 #undef putc
36
37 #ifndef ZCONST
38 # define ZCONST const
39 #endif
40
41 #define NAME_MAX 1024
42
43
44 /*****************************************************************************/
45 /* Includes standard headers */
46 /*****************************************************************************/
47 #include <ansi_prefix.mac.h>
48 #include <stdio.h>
49 #include <TextUtils.h>
50 #include <Folders.h>
51 #include <Aliases.h>
52 #include <Resources.h>
53 #include <Gestalt.h>
54 #include <Traps.h>
55 #include <Processes.h>
56 #include <MacWindows.h>
57
58
59 /* Many things are different for mac-users, so we need
60 special mac functions :-) */
61 int Zmacstat (const char *path, struct stat *buf);
62 #define stat(path, bufPtr) Zmacstat(path, bufPtr)
63 #define lstat(path, bufPtr) Zmacstat(path, bufPtr)
64
65 int fprintf(FILE *file, const char *format, ...);
66 int printf(const char *format, ...);
67 void perror(const char *parm1);
68
69
70
71 /*
72 #define MAC_DEBUG 1
73 #define DEBUG 1
74 */
75
76
77 #ifdef MAC_DEBUG
78 #define LOG_DEBUG 7 /* debug-level messages */
79 int Print2Syslog(UInt8 priority, const char *format, ...);
80 #include <ctype.h>
81
82
83 #define Notify(msg) \
84 { \
85 (void)Print2Syslog(LOG_DEBUG, "%s (file: %s line: %d)", \
86 msg, __FILE__, __LINE__); \
87 }
88
89
90
91
92 #define Assert_it(cond,msg,kind) \
93 { \
94 if (!(cond)) \
95 { \
96 (void)Print2Syslog(LOG_DEBUG,"%s failed: [%s] cond: [%s] (file: %s line: %d)", \
97 kind, msg, #cond, __FILE__, __LINE__); \
98 } \
99 }
100
101
102
103
104
105 #define AssertBool(b,msg) Assert_it (((b) == TRUE) || ((b) == FALSE),(msg),("AssertBool "))
106
107
108
109 #define AssertStr(s,msg) \
110 { \
111 int s_i = 0; \
112 Assert_it ((s),(msg),("1. AssertStr ")); \
113 while ((s)[s_i]) { \
114 Assert_it ((!iscntrl((s)[s_i]) || ((s)[s_i] == 0x0A) || \
115 ((s)[s_i] == 0x0D)),(s),("2. AssertStr ")); \
116 s_i++; \
117 } \
118 }
119
120
121
122 #define AssertTime(t,msg) Assert_it (((t).tm_sec >= 0) && ((t).tm_sec < 62) && \
123 ((t).tm_min >= 0) && ((t).tm_min < 60) && \
124 ((t).tm_hour >= 0) && ((t).tm_hour < 24) && \
125 ((t).tm_mday >= 1) && ((t).tm_mday < 32) && \
126 ((t).tm_mon >= 0) && ((t).tm_mon < 12) && \
127 ((t).tm_wday >= 0) && ((t).tm_wday < 7) && \
128 ((t).tm_yday >= 0) && ((t).tm_yday < 366),(msg),("AssertStr "))
129
130
131
132 #define AssertIntRange(myvalue,minimum,maximum, msg) Assert_it ( \
133 ((myvalue) >= (minimum)) && ((myvalue) <= (maximum)), msg,("AssertIntRange "))
134
135
136
137
138 #define AssertStrNoOverlap(str1,str2,msg) \
139 { \
140 long s_i = 0; \
141 AssertStr((str1),(msg)) \
142 AssertStr((str2),(msg)) \
143 if ((str1) < (str2)) \
144 { \
145 s_i = strlen((str2)); \
146 Assert_it ( (((str1) + s_i) < (str2)),(msg),("AssertStrNoOverlap ")); \
147 } \
148 else \
149 { \
150 s_i = strlen((str1)); \
151 Assert_it ( (((str2) + s_i) < (str1)),(msg),("AssertStrNoOverlap ")); \
152 } \
153 } \
154
155
156
157
158 #else
159 #define Assert_it(cond,msg,kind)
160 #define AssertBool(b,msg)
161 #define AssertStr(s,msg)
162 #define AssertTime(t,msg)
163 #define AssertIntRange(myvalue,minimum,maximum,msg)
164 #define AssertStrNoOverlap(str1,str2,msg)
165 #endif
166