1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/*
Copyright 1990-2008 Light Infocon Tecnologia S/A
Este arquivo é parte do programa LightBase - Banco de Dados Textual Documental
O LightBase é um software livre; você pode redistribui-lo e/ou modifica-lo dentro
dos termos da Licença Pública Geral GNU como publicada pela Fundação do Software
Livre (FSF); na versão 2 da Licença.
Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO
EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes.
Você deve ter recebido uma cópia da Licença Pública Geral GNU versao 2, sob o
título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do
Software Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* _ALAssertFailure is the function called by AL_ASSERT() and
* AL_ASSERT_OBJECT() when their assertion fails.
*/
void AL_CFUNCTION ;
/*
* In the non-debug versions, both of these macros basically go away.
* The only difficulty is trying to avoid having the compilers generate
* error messages when they see this code. Maybe in NDEBUG mode I could
* change these to inline functions that do nothing?
*/
/*
* In debug mode, AL_ASSERT() tests the condition, and generates
* an abort with an error message when the condition fails.
*/
\
/*
* I can only call IsBadWritePtr() if TOOLHELP.DLL is available. As far
* as I know, it won't be available with any of the DOS Extenders
* The only way we have access to TOOLHELP.DLL is if we are *really*
* running under Windows, not some bogus imitation.
*/
/*
* AL_ASSERT_OBJECT() is a great macro. It is used to test the
* validity of an object. This is a two step process. First,
* we make sure we are dealing with a good pointer. If not, an
* asserting error is triggered. This is much better than the
* GPF you would normally get from a bad pointer. Next, we
* test the GoodTag() macro, which verifies that this is
* a properly constructed object from the specified class. Of
* course, in NDEBUG mode this all goes away.
*
*/
/*
* I had to change the name of the arguments to this macro in order
* to avoid a Sun CC warning message. The arguments were originally
* named "pointer" and "class". I got a couple of warning messages
* telling me that "macro substitutions not performed in strings", like
* anyone is going to think that...
*/
? \
\
: \
/*
* The AL_CLASS_TAG() macro assigns a new debug class and data
* member to each of the classes in ArchiveLib. Each of these
* debug classes uses a special integer tag (stored in the data member)
* to uniquely identify itself. These are the integer values of
* these integers.
*/
;
/*
* AL_CLASS_TAG( x ) is a macro that is used to help debug
* ArchiveLib. The insertion of this macro in a class definition
* adds a new data member and member function to the class. The
* data member is an object of a class uniquely created by the
* macro. The reason the data member is a class object instead
* of a simple integer or character tag is this: By making it a
* class object, we can automatically assign it a valid value
* when constructed, and an invalid value when destroyed.
*
* The member function added to the class is called GoodTag().
* Once you have added AL_CLASS_TAG( x ) to your class definition,
* you can call object.GoodTag() anytime you want. It will return
* a true value only if the data member has the correct value,
*
* We make use of this function in AL_ASSERT_OBJECT(). It
* checks the value of this object frequently in member functions
* and destructors, generating an assertion failure if the object
* doesn't look like the correct type.
*
* Note that the ASSERT_OBJECT() statements generate no code when the
* library is compiled with NDEBUG, so this class will not be
* generating much low overhead. However, the data member will
* still be taking up a single byte in each instance.
*
* If you want to eliminate class tags, this line in will do it
* You will save one byte per instance. The best way to accomplish this
* is to define the macro in ALCUSTOM.H, then rebuild the library with
* macro AL_CUSTOM defined in your project. After you build this new
* version of the library, you must absolutely, positively, be sure
* that you continue to use AL_CUSTOM and ALCUSTOM.H when working
* with the library. If you don't, your library and your application
* will think that most classes in ArchiveLib are different sizes, and
* *nothing* will work.
*
*#define AL_CLASS_TAG( x ) int GoodTag(){ return 1; }
*/
public : \
unsigned char mucTagVal; \
} mMyTag; \
int AL_PROTO { return 1; }
/* #if defined( NDEBUG ) && !defined( AL_CLASS_TAG ) */
public : \
AL_PROTO _ALTag## \
AL_PROTO ~_ALTag## \
unsigned char mucTagVal; \
} mMyTag; \
int AL_PROTO { return mMyTag.mucTagVal == x; }
/* #if !defined( NDEBUG ) && !defined( AL_CLASS_TAG ) */
/* #ifndef __DEBUG_H */