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