Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6725 siemargl 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
  UnZp.h
12
 
13
  This header-files is global to the project Unzip 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.
25
so 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
/*****************************************************************************/
39
/*  Includes standard headers                                                */
40
/*****************************************************************************/
41
#include 
42
#include 
43
#include 
44
#include 
45
#include 
46
#include 
47
#include 
48
#include 
49
#include 
50
#include 
51
#include 
52
#include 
53
#include 
54
#include 
55
 
56
 
57
 
58
 
59
/*
60
#define MAC_DEBUG  1
61
 */
62
 
63
 
64
#ifdef MAC_DEBUG
65
#define LOG_DEBUG   7   /* debug-level messages */
66
int Print2Syslog(UInt8 priority, const char *format, ...);
67
#include 
68
 
69
 
70
#define Notify(msg)                                             \
71
    {                                                           \
72
    (void)Print2Syslog(LOG_DEBUG, "%s (file: %s line: %d)",     \
73
                       msg, __FILE__, __LINE__);                \
74
    }
75
 
76
 
77
 
78
#define Assert_it(cond,msg,kind)                                    \
79
    {                                                               \
80
    if (!(cond))                                                    \
81
        {                                                           \
82
        (void)Print2Syslog(LOG_DEBUG, "%s failed: [%s] cond: [%s] (file: %s line: %d)", \
83
                           kind, msg, #cond, __FILE__, __LINE__);   \
84
        }                                                           \
85
    }
86
 
87
 
88
 
89
#define AssertBool(b,msg) \
90
    Assert_it (((b) == TRUE) || ((b) == FALSE),(msg),("AssertBool "))
91
 
92
 
93
 
94
#define AssertStr(s,msg)                                            \
95
    {                                                               \
96
        int s_i = 0;                                                \
97
        Assert_it ((s),(msg),("1. AssertStr "));                    \
98
        while ((s)[s_i]) {                                          \
99
            Assert_it ((!iscntrl((s)[s_i]) || ((s)[s_i] == 0x0A) || \
100
                       ((s)[s_i] == 0x0D)),(s),("2. AssertStr "));  \
101
            s_i++;                                                  \
102
        }                                                           \
103
    }
104
 
105
 
106
 
107
#define AssertTime(t,msg) \
108
    Assert_it (((t).tm_sec  >=  0) && ((t).tm_sec  < 62) &&   \
109
               ((t).tm_min  >=  0) && ((t).tm_min  < 60) &&   \
110
               ((t).tm_hour >=  0) && ((t).tm_hour < 24) &&   \
111
               ((t).tm_mday >=  1) && ((t).tm_mday < 32) &&   \
112
               ((t).tm_mon  >=  0) && ((t).tm_mon  < 12) &&   \
113
               ((t).tm_wday >=  0) && ((t).tm_wday < 7)  &&   \
114
               ((t).tm_yday >=  0) && ((t).tm_yday < 366),(msg),("AssertStr "))
115
 
116
 
117
 
118
#define AssertIntRange(myvalue,minimum,maximum, msg) \
119
    Assert_it (((myvalue) >= (minimum)) && ((myvalue) <= (maximum)), \
120
               msg,("AssertIntRange "))
121
 
122
 
123
 
124
#define AssertStrNoOverlap(str1,str2,msg)                           \
125
    {                                                               \
126
        long s_i = 0;                                               \
127
        AssertStr((str1),(msg))                                     \
128
        AssertStr((str2),(msg))                                     \
129
        if ((str1) < (str2))                                        \
130
            {                                                       \
131
            s_i = strlen((str2));                                   \
132
            Assert_it ( (((str1) + s_i) < (str2)),(msg),("AssertStrNoOverlap "));   \
133
            }                                                       \
134
        else                                                        \
135
            {                                                       \
136
            s_i = strlen((str1));                                   \
137
            Assert_it ( (((str2) + s_i) < (str1)),(msg),("AssertStrNoOverlap "));   \
138
            }                                                       \
139
    }                                                               \
140
 
141
 
142
 
143
 
144
#else /* !MAC_DEBUG */
145
#define Assert_it(cond,msg,kind)
146
#define AssertBool(b,msg)
147
#define AssertStr(s,msg)
148
#define AssertTime(t,msg)
149
#define AssertIntRange(myvalue,minimum,maximum,msg)
150
#define AssertStrNoOverlap(str1,str2,msg)
151
#endif /* ?MAC_DEBUG */