Top   Types   Functions   Classes   Options   Index   Sources 

erwin/defaults.h


  1  /* -*- Mode: C -*- */
  2  /* Author: Henrik Theiling
  3   * Description:
  4   *       The Erwin library for standard data structures and algorithms.
  5   *
  6   *       This file is included by the implementation of the data
  7   *       structures to get default definitions of important macros
  8   *       if the user did not provide them.  For many standard types,
  9   *       it is obvious how they should be hashed and compared.  This
 10   *       is defined here.
 11   *
 12   *       DO NOT INCLUDE THIS FILE IN YOUR APPLICATION!  THAT WILL BREAK
 13   *       THE #INCLUSION ORDER.
 14   *
 15   * @@Begin: Licencing and Copying@@
 16   * 
 17   * Copyright (c) Henrik Theiling
 18   * Licence Version 2, Special Version for Erwin.
 19   * 
 20   * The term 'this software' used in the following, additional to its
 21   * usual usage, also includes the instantiated source files generated by
 22   * tools of this package.
 23   * 
 24   * This software is provided 'as-is', without warranty of any kind,
 25   * express or implied.  In no event will the authors or copyright holders
 26   * be held liable for any damages arising from the use of this software.
 27   * 
 28   * Permission is granted to anyone to use this software for any purpose,
 29   * including commercial applications, and to alter it and redistribute it
 30   * freely, subject to the following restrictions:
 31   * 
 32   * 1. The origin of this software must not be misrepresented; you must
 33   * not claim that you wrote the original software. If you use this
 34   * software in a product, an acknowledgment in the product documentation
 35   * would be appreciated.
 36   * 
 37   * 2. Altered source versions must be plainly marked as such, and must
 38   * not be misrepresented as being the original software.
 39   * 
 40   * 3. You must not use any of the names of the authors or copyright
 41   * holders of the original software for advertising or publicity
 42   * pertaining to distribution without specific, written prior permission.
 43   * 
 44   * 4. If you change this software and redistribute parts or all of it in
 45   * any form, you must make the source code of the altered version of this
 46   * software available.  As an exception, files that were generated by
 47   * tools of this package may be used freely, including modification.
 48   * 
 49   * 5. This notice must not be removed or altered from any source
 50   * distribution.
 51   * 
 52   * This licence is governed by the Laws of Germany.  Disputes shall be
 53   * settled by Saarbruecken City Court.
 54   * 
 55   * @@End: Licencing and Copying@@
 56   *
 57   */
 58  
 59  #ifdef ERWIN_DEBUG_INCLUDE
 60  #warning "Including defaults.h."
 61  #endif
 62  
 63  #ifndef Global_ERWIN_DEFAULTS_H
 64  #define Global_ERWIN_DEFAULTS_H
 65  
 66  #ifdef ERWIN_DEBUG_INCLUDE
 67  #warning "First inclusion of defaults.h."
 68  #endif
 69  
 70  /* Provide hash values and comparisons for simple types.
 71   * Please note that there are no defaults for char *, since
 72   * you have to choose whether it is case sensitive. */
 73  
 74  #define ?Global_ERWIN_DEFAULT_CMP(X,Y)     (((X) < (Y)) ? -1 : (((X) > (Y)) ? 1 : 0))
 75  #define ?Global_ERWIN_DEFAULT_EQUAL(X,Y)   ((X) == (Y))
 76  
 77  #define ?Global_ERWIN_INT_SUBCMP(X,Y)      (((int)(X)) - ((int)(Y)))
 78     /* Only works if sizeof(X) < sizeof(int)! */
 79  
 80  #define ?Global_ERWIN_DEFAULT_HASH_RAW(X)  Global_HASHVAL_CAST(X)
 81  
 82  /* compat: */
 83  #define ?Global_ERWIN_DEFAULT_HASHVAL Global_ERWIN_DEFAULT_HASH_RAW
 84  
 85  
 86  /* Lexical comparisons: */
 87  
 88  #define ?Global_ERWIN_LEXICAL_CMP(RESULT,T,X,Y,V) \
 89             ((((RESULT) = T##_CMP((X),(Y))) != 0) ? (RESULT) : (V))
 90    /* For comparisons of structs.
 91     * RESULT is a local variable that may be used for computations.
 92     *
 93     * It would be better to declare the variable in a macro, but this is not possible
 94     * in standard C.
 95     */
 96  
 97  
 98  /* Unrolled for some depth.  These also all need a local variable `result'! */
 99  #define ?Global_ERWIN_LEXICAL_CMP1(R,T1,X1,Y1)      \
100              Global_ERWIN_LEXICAL_CMP(R, T1,X1,Y1, 0)
101  
102  #define ?Global_ERWIN_LEXICAL_CMP2(R, T1,X1,Y1, T2,X2,Y2) \
103              Global_ERWIN_LEXICAL_CMP(R, T1,X1,Y1,         \
104                  Global_ERWIN_LEXICAL_CMP1(R, T2,X2,Y2))
105     /* usage:
106      * int something_compare (something const *a, something const *b)
107      * {
108      *     int result;
109      *     return ERWIN_LEXICAL_CMP2 (result,
110      *               STRING_CASE, a->name, b->name,
111      *               INT,         a->age,  b->age);
112      * }
113      */
114  
115  #define ?Global_ERWIN_LEXICAL_CMP3(R, T1,X1,Y1, T2,X2,Y2, T3,X3,Y3) \
116              Global_ERWIN_LEXICAL_CMP(R, T1, X1, Y1,                 \
117                  Global_ERWIN_LEXICAL_CMP2(R, T2,X2,Y2, T3,X3,Y3))
118  
119  #define ?Global_ERWIN_LEXICAL_CMP4(R, T1,X1,Y1, T2,X2,Y2, T3,X3,Y3, T4,X4,Y4) \
120              Global_ERWIN_LEXICAL_CMP(R, T1, X1, Y1,                           \
121                  Global_ERWIN_LEXICAL_CMP3(R, T2,X2,Y2, T3,X3,Y3, T4,X4,Y4))
122  
123  #define ?Global_ERWIN_LEXICAL_CMP5(R, T1,X1,Y1, T2,X2,Y2, T3,X3,Y3, T4,X4,Y4, T5,X5,Y5) \
124              Global_ERWIN_LEXICAL_CMP(R, T1,X1,Y1,                                       \
125                  Global_ERWIN_LEXICAL_CMP4(R, T2,X2,Y2, T3,X3,Y3, T4,X4,Y4, T5,X5,Y5))
126  
127  #define ?Global_ERWIN_LEXICAL_CMP6(R, T1,X1,Y1, T2,X2,Y2, T3,X3,Y3, T4,X4,Y4, T5,X5,Y5, T6,X6,Y6) \
128              Global_ERWIN_LEXICAL_CMP(R, T1,X1,Y1,                                                 \
129                  Global_ERWIN_LEXICAL_CMP5(R, T2,X2,Y2, T3,X3,Y3, T4,X4,Y4, T5,X5,Y5,              \
130                                               T6,X6,Y6))
131  
132  #define ?Global_ERWIN_LEXICAL_CMP7(R, T1,X1,Y1, T2,X2,Y2, T3,X3,Y3, T4,X4,Y4, T5,X5,Y5, \
133                                       T6,X6,Y6, T7,X7,Y7)                                \
134              Global_ERWIN_LEXICAL_CMP(R, T1,X1, Y1,                                      \
135                  Global_ERWIN_LEXICAL_CMP6(R, T2,X2,Y2, T3,X3,Y3, T4,X4,Y4, T5,X5,Y5,    \
136                                               T6,X6,Y6, T7,X7,Y7))
137  
138  #define ?Global_ERWIN_LEXICAL_CMP8(R, T1,X1,Y1, T2,X2,Y2, T3,X3,Y3, T4,X4,Y4, T5,X5,Y5, \
139                                       T6,X6,Y6, T7,X7,Y7, T8,X8,Y8)                      \
140              Global_ERWIN_LEXICAL_CMP(R, T1, X1, Y1,                                     \
141                  Global_ERWIN_LEXICAL_CMP7(R, T2,X2,Y2, T3,X3,Y3, T4,X4,Y4, T5,X5,Y5,    \
142                                               T6,X6,Y6, T7,X7,Y7, T8,X8,Y8))
143  
144  #define ?Global_ERWIN_LEXICAL_CMP9(R, T1,X1,Y1, T2,X2,Y2, T3,X3,Y3, T4,X4,Y4, T5,X5,Y5, \
145                                       T6,X6,Y6, T7,X7,Y7, T8,X8,Y8, T9,X9,Y9)            \
146              Global_ERWIN_LEXICAL_CMP(R, T1, X1, Y1,                                     \
147                  Global_ERWIN_LEXICAL_CMP8(R, T2,X2,Y2, T3,X3,Y3, T4,X4,Y4, T5,X5,Y5,    \
148                                               T6,X6,Y6, T7,X7,Y7, T8,X8,Y8, T9,X9,Y9))
149  
150  /* ********************************************************************** */
151  
152  #define ?Global_ERWIN_LEXICAL_CMP_THIS(R,O,T1,M1,V)           \
153              Global_ERWIN_LEXICAL_CMP(R, T1, M1, (O).M1, V)
154    /* For comparisons of classes */
155  
156  /* unrolled: */
157  #define ?Global_ERWIN_LEXICAL_CMP_THIS1(R,O,T1,M1)   \
158              Global_ERWIN_LEXICAL_CMP1(R, T1, M1, (O).M1)
159  
160  #define ?Global_ERWIN_LEXICAL_CMP_THIS2(R,O,T1,M1,T2,M2) \
161              Global_ERWIN_LEXICAL_CMP2(R, T1,M1,(O).M1, T2,M2,(O).M2)
162  
163  #define ?Global_ERWIN_LEXICAL_CMP_THIS3(R,O,T1,M1,T2,M2,T3,M3) \
164              Global_ERWIN_LEXICAL_CMP3(                         \
165                  R, T1,M1,(O).M1, T2,M2,(O).M2, T3,M3,(O).M3)
166  
167  #define ?Global_ERWIN_LEXICAL_CMP_THIS4(R,O,T1,M1,T2,M2,T3,M3,T4,M4)       \
168              Global_ERWIN_LEXICAL_CMP4(                                     \
169                  R, T1,M1,(O).M1, T2,M2,(O).M2, T3,M3,(O).M3, T4,M4,(O).M4)
170  
171  #define ?Global_ERWIN_LEXICAL_CMP_THIS5(R,O,T1,M1,T2,M2,T3,M3,T4,M4,T5,M5)               \
172              Global_ERWIN_LEXICAL_CMP5(                                                   \
173                  R, T1,M1,(O).M1, T2,M2,(O).M2, T3,M3,(O).M3, T4,M4,(O).M4, T5,M5,(O).M5)
174  
175  #define ?Global_ERWIN_LEXICAL_CMP_THIS6(R,O,T1,M1,T2,M2,T3,M3,T4,M4,T5,M5,T6,M6)         \
176              Global_ERWIN_LEXICAL_CMP6(                                                   \
177                  R, T1,M1,(O).M1, T2,M2,(O).M2, T3,M3,(O).M3, T4,M4,(O).M4, T5,M5,(O).M5, \
178                  T6,M6,(O).M6)
179  
180  #define ?Global_ERWIN_LEXICAL_CMP_THIS7(R,O,T1,M1,T2,M2,T3,M3,T4,M4,T5,M5,T6,M6,T7,M7)   \
181              Global_ERWIN_LEXICAL_CMP7(                                                   \
182                  R, T1,M1,(O).M1, T2,M2,(O).M2, T3,M3,(O).M3, T4,M4,(O).M4, T5,M5,(O).M5, \
183                  T6,M6,(O).M6, T7,M7,(O).M7)
184  
185  #define ?Global_ERWIN_LEXICAL_CMP_THIS8(R,O,T1,M1,T2,M2,T3,M3,T4,M4,T5,M5,T6,M6,T7,M7,T8,M8) \
186              Global_ERWIN_LEXICAL_CMP8(                                                       \
187                  R, T1,M1,(O).M1, T2,M2,(O).M2, T3,M3,(O).M3, T4,M4,(O).M4, T5,M5,(O).M5,     \
188                  T6,M6,(O).M6, T7,M7,(O).M7, T8,M8,(O).M8)
189  
190  #define ?Global_ERWIN_LEXICAL_CMP_THIS9(R,O,T1,M1,T2,M2,T3,M3,T4,M4,T5,M5,T6,M6,T7,M7,T8,M8,T9,M9) \
191              Global_ERWIN_LEXICAL_CMP9(                                                             \
192                  R, T1,M1,(O).M1, T2,M2,(O).M2, T3,M3,(O).M3, T4,M4,(O).M4, T5,M5,(O).M5,           \
193                  T6,M6,(O).M6, T7,M7,(O).M7, T8,M8,(O).M8, T9,M9,(O).M9)
194  
195  /* ********************************************************************** */
196  
197  #define ?Global_ERWIN_WRAP_NULL_CMP(X,Y,V) \
198            ((X) == NULL ? ((Y) == NULL ? 0 : -1) : ((Y) == NULL ? 1 : (V)))
199    /* This checks X and Y to be non-zero before evaluating the real
200     * comparison value V.  NULL pointers are assumed to be smaller than
201     * anything else.
202     *
203     * This is the table of values:
204     *      X         Y          result
205     *      NULL      NULL       0
206     *      NULL      non-NULL   -1
207     *      non-NULL  NULL       +1
208     *      non-NULL  non-NULL   V
209     */
210  
211  /* EQUAL */
212  /* _EQUAL: mostly redundant, but:
213   * The definitions of EQUAL are for compilers that do not understand and optimise
214   * CMP(X,Y) == 0, and for unsigned types that generate a warning when compared
215   * with 0 (since x < 0 is  always false).
216   *
217   * If _CMP is defined but not _EQUAL, we must use _CMP instead.
218   *
219   * Unfortunately, this is now very long. :-(
220   */
221  
222  #define ?Global_ERWIN_POINTER_EQUAL(X,Y)            Global_ERWIN_DEFAULT_EQUAL(X,Y)
223  
224  #define ?Global_ERWIN_INT_EQUAL(X,Y)                (??Global_ERWIN_INT_CMP(X,Y) == 0)
225  #define ?Global_ERWIN_INT_EQUAL(X,Y)                Global_ERWIN_DEFAULT_EQUAL(X,Y)
226  
227  #define ?Global_BOOL_EQUAL(X,Y)                     (??Global_BOOL_CMP(X,Y) == 0)
228  #define ?Global_BOOL_EQUAL(X,Y)                     Global_ERWIN_DEFAULT_EQUAL(X,Y)
229  
230  /* This type used to be called Global_ERWIN_BOOL.  Now it is ERWIN_BOOL. */
231  #define ?Global_Global_ERWIN_BOOL_EQUAL(X,Y)        (??Global_Global_ERWIN_BOOL_CMP(X,Y) == 0)
232  #define ?Global_Global_ERWIN_BOOL_EQUAL             Global_BOOL_EQUAL
233  
234  #define ?Global_ERWIN_BOOL_EQUAL(X,Y)               (??Global_ERWIN_BOOL_CMP(X,Y) == 0)
235  #define ?Global_ERWIN_BOOL_EQUAL                    Global_BOOL_EQUAL
236  
237  #define ?Global_CHAR_EQUAL(X,Y)                     (??Global_CHAR_CMP(X,Y) == 0)
238  #define ?Global_CHAR_EQUAL(X,Y)                     Global_ERWIN_INT_EQUAL(X,Y)
239  
240  #define ?Global_UNSIGNED_CHAR_EQUAL(X,Y)            (??Global_UNSIGNED_CHAR_CMP(X,Y) == 0)
241  #define ?Global_UNSIGNED_CHAR_EQUAL                 Global_CHAR_EQUAL
242  
243  #define ?Global_SIGNED_CHAR_EQUAL(X,Y)              (??Global_SIGNED_CHAR_CMP(X,Y) == 0)
244  #define ?Global_SIGNED_CHAR_EQUAL                   Global_CHAR_EQUAL
245  
246  #define ?Global_CHAR_CASE_EQUAL(X,Y)                (??Global_CHAR_CASE_CMP(X,Y) == 0)
247  #define ?Global_CHAR_CASE_EQUAL(X,Y)  \
248                      Global_CHAR_EQUAL(Global_char_to_lower(X),Global_char_to_lower(Y))
249  
250  #define ?Global_UNSIGNED_CHAR_CASE_EQUAL(X,Y)       (??Global_UNSIGNED_CHAR_CASE_CMP(X,Y) == 0)
251  #define ?Global_UNSIGNED_CHAR_CASE_EQUAL            Global_CHAR_CASE_EQUAL
252  
253  #define ?Global_SIGNED_CHAR_CASE_EQUAL(X,Y)         (??Global_SIGNED_CHAR_CASE_CMP(X,Y) == 0)
254  #define ?Global_SIGNED_CHAR_CASE_EQUAL              Global_CHAR_CASE_EQUAL
255  
256  #define ?Global_SHORT_EQUAL(X,Y)                    (??Global_SHORT_CMP(X,Y) == 0)
257  #define ?Global_SHORT_EQUAL(X,Y)                    Global_ERWIN_INT_EQUAL(X,Y)
258  
259  #define ?Global_SHORT_INT_EQUAL(X,Y)                (??Global_SHORT_INT_CMP(X,Y) == 0)
260  #define ?Global_SHORT_INT_EQUAL                     Global_SHORT_EQUAL
261  
262  #define ?Global_UNSIGNED_SHORT_EQUAL(X,Y)           (??Global_UNSIGNED_SHORT_CMP(X,Y) == 0)
263  #define ?Global_UNSIGNED_SHORT_EQUAL                Global_SHORT_EQUAL
264  
265  #define ?Global_UNSIGNED_SHORT_INT_EQUAL(X,Y)       (??Global_UNSIGNED_SHORT_INT_CMP(X,Y) == 0)
266  #define ?Global_UNSIGNED_SHORT_INT_EQUAL            Global_SHORT_EQUAL
267  
268  #define ?Global_INT_EQUAL(X,Y)                      (??Global_INT_CMP(X,Y) == 0)
269  #define ?Global_INT_EQUAL(X,Y)                      Global_ERWIN_INT_EQUAL(X,Y)
270  
271  #define ?Global_UNSIGNED_EQUAL(X,Y)                 (??Global_UNSIGNED_CMP(X,Y) == 0)
272  #define ?Global_UNSIGNED_EQUAL                      Global_INT_EQUAL
273  
274  #define ?Global_UNSIGNED_INT_EQUAL(X,Y)             (??Global_UNSIGNED_INT_CMP(X,Y) == 0)
275  #define ?Global_UNSIGNED_INT_EQUAL                  Global_INT_EQUAL
276  
277  #define ?Global_LONG_EQUAL(X,Y)                     (??Global_LONG_CMP(X,Y) == 0)
278  #define ?Global_LONG_EQUAL(X,Y)                     Global_ERWIN_DEFAULT_EQUAL(X,Y)
279  
280  #define ?Global_LONG_INT_EQUAL(X,Y)                 (??Global_LONG_INT_CMP(X,Y) == 0)
281  #define ?Global_LONG_INT_EQUAL                      Global_LONG_EQUAL
282  
283  #define ?Global_UNSIGNED_LONG_EQUAL(X,Y)            (??Global_UNSIGNED_LONG_CMP(X,Y) == 0)
284  #define ?Global_UNSIGNED_LONG_EQUAL                 Global_LONG_EQUAL
285  
286  #define ?Global_UNSIGNED_LONG_INT_EQUAL(X,Y)        (??Global_UNSIGNED_LONG_INT_CMP(X,Y) == 0)
287  #define ?Global_UNSIGNED_LONG_INT_EQUAL             Global_LONG_EQUAL
288  
289  #define ?Global_ERWIN_LONG_LONG_EQUAL(X,Y)          (??Global_ERWIN_LONG_LONG_CMP(X,Y) == 0)
290  #define ?Global_ERWIN_LONG_LONG_EQUAL(X,Y)          Global_ERWIN_DEFAULT_EQUAL(X,Y)
291  
292  #define ?Global_ERWIN_UNSIGNED_LONG_LONG_EQUAL(X,Y) (??Global_ERWIN_UNSIGNED_LONG_LONG_CMP(X,Y)==0)
293  #define ?Global_ERWIN_UNSIGNED_LONG_LONG_EQUAL      Global_ERWIN_LONG_LONG_EQUAL
294  
295  #define ?Global_ERWIN_U8_EQUAL(X,Y)                 (??Global_ERWIN_U8_CMP(X,Y) == 0)
296  #define ?Global_ERWIN_U8_EQUAL                      Global_ERWIN_DEFAULT_EQUAL
297  
298  #define ?Global_ERWIN_U16_EQUAL(X,Y)                (??Global_ERWIN_U16_CMP(X,Y) == 0)
299  #define ?Global_ERWIN_U16_EQUAL                     Global_ERWIN_DEFAULT_EQUAL
300  
301  #define ?Global_ERWIN_U32_EQUAL(X,Y)                (??Global_ERWIN_U32_CMP(X,Y) == 0)
302  #define ?Global_ERWIN_U32_EQUAL                     Global_ERWIN_DEFAULT_EQUAL
303  
304  #define ?Global_ERWIN_U64_EQUAL(X,Y)                (??Global_ERWIN_U64_CMP(X,Y) == 0)
305  #define ?Global_ERWIN_U64_EQUAL                     Global_ERWIN_DEFAULT_EQUAL
306  
307  #define ?Global_ERWIN_S8_EQUAL(X,Y)                 (??Global_ERWIN_S8_CMP(X,Y) == 0)
308  #define ?Global_ERWIN_S8_EQUAL                      Global_ERWIN_DEFAULT_EQUAL
309  
310  #define ?Global_ERWIN_S16_EQUAL(X,Y)                (??Global_ERWIN_S16_CMP(X,Y) == 0)
311  #define ?Global_ERWIN_S16_EQUAL                     Global_ERWIN_DEFAULT_EQUAL
312  
313  #define ?Global_ERWIN_S32_EQUAL(X,Y)                (??Global_ERWIN_S32_CMP(X,Y) == 0)
314  #define ?Global_ERWIN_S32_EQUAL                     Global_ERWIN_DEFAULT_EQUAL
315  
316  #define ?Global_ERWIN_S64_EQUAL(X,Y)                (??Global_ERWIN_S64_CMP(X,Y) == 0)
317  #define ?Global_ERWIN_S64_EQUAL                     Global_ERWIN_DEFAULT_EQUAL
318  
319  #define ?Global_FLOAT_EQUAL(X,Y)                    (??Global_FLOAT_CMP(X,Y) == 0)
320  #define ?Global_FLOAT_EQUAL(X,Y)                    Global_ERWIN_DEFAULT_EQUAL(X,Y)
321  
322  #define ?Global_DOUBLE_EQUAL(X,Y)                   (??Global_DOUBLE_CMP(X,Y) == 0)
323  #define ?Global_DOUBLE_EQUAL(X,Y)                   Global_ERWIN_DEFAULT_EQUAL(X,Y)
324  
325  #define ?Global_LONG_DOUBLE_EQUAL(X,Y)              (??Global_LONG_DOUBLE_CMP(X,Y) == 0)
326  #define ?Global_LONG_DOUBLE_EQUAL(X,Y)              Global_ERWIN_DEFAULT_EQUAL(X,Y)
327  
328  /* equal for void*: */
329  #define ?Global_VOIDP_EQUAL(X,Y)                    (??Global_VOIDP_CMP(X,Y) == 0)
330  #define ?Global_VOIDP_EQUAL(X,Y)                    Global_ERWIN_POINTER_EQUAL(X,Y)
331  
332  #define ?Global_VOID_P_EQUAL(X,Y)                   (??Global_VOID_P_CMP(X,Y) == 0)
333  #define ?Global_VOID_P_EQUAL                        Global_VOIDP_EQUAL
334  
335  #define ?Global_CONST_VOIDP_EQUAL(X,Y)              (??Global_CONST_VOIDP_CMP(X,Y) == 0)
336  #define ?Global_CONST_VOIDP_EQUAL                   Global_VOIDP_EQUAL
337  
338  #define ?Global_CONST_VOID_P_EQUAL(X,Y)             (??Global_CONST_VOID_P_CMP(X,Y) == 0)
339  #define ?Global_CONST_VOID_P_EQUAL                  Global_VOIDP_EQUAL
340  
341  #define ?Global_VOIDP_CONST_EQUAL(X,Y)              (??Global_VOIDP_CONST_CMP(X,Y) == 0)
342  #define ?Global_VOIDP_CONST_EQUAL                   Global_VOIDP_EQUAL
343  
344  #define ?Global_VOID_CONST_P_EQUAL(X,Y)             (??Global_VOID_CONST_P_CMP(X,Y) == 0)
345  #define ?Global_VOID_CONST_P_EQUAL                  Global_VOIDP_EQUAL
346  
347  /* ********************************************************************** */
348  /* CMP */
349  #define ?Global_ERWIN_POINTER_CMP(X,Y)              Global_PTRINT_CMP( \
350                                                          (ERWIN_PTRINT)(X),(ERWIN_PTRINT)(Y))
351  
352  /* For special types: */
353  #define ?Global_ERWIN_INT_CMP                       Global_ERWIN_DEFAULT_CMP
354  #define ?Global_ERWIN_UNSIGNED_CMP                  Global_ERWIN_DEFAULT_CMP
355  
356  #define ?Global_BOOL_CMP                            Global_ERWIN_INT_SUBCMP
357  /* This type used to be called Global_ERWIN_BOOL.  Now it is ERWIN_BOOL. */
358  #define ?Global_Global_ERWIN_BOOL_CMP               Global_BOOL_CMP
359  #define ?Global_ERWIN_BOOL_CMP                      Global_BOOL_CMP
360  
361  #define ?Global_CHAR_CMP                            Global_ERWIN_INT_SUBCMP
362  #define ?Global_UNSIGNED_CHAR_CMP                   Global_ERWIN_INT_SUBCMP
363  #define ?Global_SIGNED_CHAR_CMP                     Global_ERWIN_INT_SUBCMP
364  
365  #define ?Global_CHAR_CASE_CMP(X,Y)  \
366                      Global_CHAR_CMP(Global_char_to_lower(X),Global_char_to_lower(Y))
367  #define ?Global_UNSIGNED_CHAR_CASE_CMP              Global_CHAR_CASE_CMP
368  #define ?Global_SIGNED_CHAR_CASE_CMP                Global_CHAR_CASE_CMP
369  
370  #define ?Global_SHORT_CMP                           Global_ERWIN_INT_SUBCMP
371  #define ?Global_UNSIGNED_SHORT_CMP                  Global_ERWIN_INT_SUBCMP
372  #define ?Global_SHORT_INT_CMP                       Global_ERWIN_SHORT_CMP
373  #define ?Global_UNSIGNED_SHORT_INT_CMP              Global_ERWIN_UNSIGNED_SHORT_CMP
374  
375  #define ?Global_INT_CMP                             Global_ERWIN_INT_CMP
376  #define ?Global_UNSIGNED_CMP                        Global_ERWIN_UNSIGNED_CMP
377  #define ?Global_UNSIGNED_INT_CMP                    Global_UNSIGNED_CMP
378  
379  #define ?Global_LONG_CMP                            Global_ERWIN_DEFAULT_CMP
380  #define ?Global_UNSIGNED_LONG_CMP                   Global_ERWIN_DEFAULT_CMP
381  #define ?Global_LONG_INT_CMP                        Global_LONG_CMP
382  #define ?Global_UNSIGNED_LONG_INT_CMP               Global_UNSIGNED_LONG_CMP
383  
384  #define ?Global_ERWIN_LONG_LONG_CMP                 Global_ERWIN_DEFAULT_CMP
385  #define ?Global_ERWIN_UNSIGNED_LONG_LONG_CMP        Global_ERWIN_DEFAULT_CMP
386  
387  #define ?Global_ERWIN_S8_CMP                        Global_ERWIN_SIGNED_CHAR_CMP
388  #define ?Global_ERWIN_U8_CMP                        Global_ERWIN_UNSIGNED_CHAR_CMP
389  
390  #define ?Global_ERWIN_S16_CMP                       Global_ERWIN_SHORT_CMP
391  #define ?Global_ERWIN_U16_CMP                       Global_ERWIN_UNSIGNED_SHORT_CMP
392  
393  #define ?Global_ERWIN_S32_CMP                       Global_ERWIN_DEFAULT_CMP
394  #define ?Global_ERWIN_U32_CMP                       Global_ERWIN_DEFAULT_CMP
395  
396  #define ?Global_ERWIN_S64_CMP                       Global_ERWIN_DEFAULT_CMP
397  #define ?Global_ERWIN_U64_CMP                       Global_ERWIN_DEFAULT_CMP
398  
399  #define ?Global_FLOAT_CMP                           Global_ERWIN_DEFAULT_CMP
400  
401  #define ?Global_DOUBLE_CMP                          Global_ERWIN_DEFAULT_CMP
402  
403  #define ?Global_LONG_DOUBLE_CMP                     Global_ERWIN_DEFAULT_CMP
404  
405  #define ?Global_STRING_CMP                          Global_string_cmp
406  
407  #define ?Global_STRING_CASE_CMP                     Global_string_case_cmp
408  
409  /* cmp for void*: */
410  #define ?Global_VOIDP_CMP                           Global_ERWIN_POINTER_CMP
411  #define ?Global_VOID_P_CMP                          Global_VOIDP_CMP
412  #define ?Global_CONST_VOIDP_CMP                     Global_VOIDP_CMP
413  #define ?Global_CONST_VOID_P_CMP                    Global_VOIDP_CMP
414  #define ?Global_VOIDP_CONST_CMP                     Global_VOIDP_CMP
415  #define ?Global_VOID_CONST_P_CMP                    Global_VOIDP_CMP
416  
417  /* constant zero for void*: */
418  #define ?Global_VOIDP_CONSTANT_ZERO 1
419  #define ?Global_CONST_VOIDP_CONSTANT_ZERO 1
420  #define ?Global_VOIDP_CONST_CONSTANT_ZERO 1
421  #define ?Global_VOID_P_CONSTANT_ZERO 1
422  #define ?Global_CONST_VOID_P_CONSTANT_ZERO 1
423  #define ?Global_VOID_P_CONST_CONSTANT_ZERO 1
424  
425  /* ********************************************************************** */
426  /* HASH */
427  /* Hashing (most functions are in map.(c,h)) */
428  #define ?Global_ERWIN_POINTER_HASH(X)               Global_voidp_hash((void*)(X))
429  
430  #define ?Global_CHAR_HASH(X)                        Global_char_hash(X)
431  #define ?Global_UNSIGNED_CHAR_HASH                  Global_CHAR_HASH
432  #define ?Global_SIGNED_CHAR_HASH                    Global_CHAR_HASH
433  
434  #define ?Global_CHAR_CASE_HASH(X)                   Global_char_case_hash(X)
435  #define ?Global_UNSIGNED_CHAR_CASE_HASH             Global_CHAR_CASE_HASH
436  #define ?Global_SIGNED_CHAR_CASE_HASH               Global_CHAR_CASE_HASH
437  
438  #define ?Global_BOOL_HASH                           Global_CHAR_HASH
439  #define ?Global_Global_ERWIN_BOOL_HASH              Global_CHAR_HASH
440  #define ?Global_ERWIN_BOOL_HASH                     Global_CHAR_HASH
441  
442  #define ?Global_SHORT_HASH(X)                       Global_short_hash(X)
443  #define ?Global_UNSIGNED_SHORT_HASH                 Global_SHORT_HASH
444  #define ?Global_UNSIGNED_SHORT_INT_HASH             Global_SHORT_HASH
445  
446  #define ?Global_INT_HASH(X)                         Global_int_hash(X)
447  #define ?Global_UNSIGNED_HASH                       Global_INT_HASH
448  #define ?Global_UNSIGNED_INT_HASH                   Global_INT_HASH
449  
450  #define ?Global_LONG_HASH(X)                        Global_long_hash(X)
451  #define ?Global_UNSIGNED_LONG_HASH                  Global_LONG_HASH
452  #define ?Global_UNSIGNED_LONG_INT_HASH              Global_LONG_HASH
453  
454  #define ?Global_ERWIN_LONG_LONG_HASH(X)             (((Global_hashval_t)(X)) + Global_long_hash(X))
455  #define ?Global_ERWIN_UNSIGNED_LONG_LONG_HASH       Global_ERWIN_LONG_LONG_HASH
456  
457  #define ?Global_STRING_HASH(X)                      Global_string_hash(X)
458  
459  #define ?Global_STRING_CASE_HASH(X)                 Global_string_case_hash(X)
460  
461  #define ?Global_VOIDP_HASH(X)                       Global_ERWIN_POINTER_HASH(X)
462  #define ?Global_VOID_P_HASH                         Global_VOIDP_HASH
463  #define ?Global_CONST_VOIDP_HASH                    Global_VOIDP_HASH
464  #define ?Global_CONST_VOID_P_HASH                   Global_VOIDP_HASH
465  #define ?Global_VOIDP_CONST_HASH                    Global_VOIDP_HASH
466  #define ?Global_VOID_CONST_P_HASH                   Global_VOIDP_HASH
467  
468  /* ********************************************************************** */
469  /* Printing of basic types.  This is handy for debugging (it is only
470   * needed in dump(). */
471  
472  #define ?Global_BOOL_PRINT(F,X)                     fputs((X) ? "true" : "false", (F))
473  #define ?Global_Global_ERWIN_BOOL_PRINT             Global_BOOL_PRINT
474  #define ?Global_ERWIN_BOOL_PRINT                    Global_BOOL_PRINT
475  
476  #define ?Global_INT_PRINT(F,X)                      fprintf((F), "%d", (X))
477  
478  #define ?Global_SHORT_PRINT                         Global_INT_PRINT
479  
480  #define ?Global_UNSIGNED_PRINT(F,X)                 fprintf((F), "%u", (X))
481  #define ?Global_UNSIGNED_INT_PRINT                  Global_UNSIGNED_PRINT
482                                                      
483  #define ?Global_UNSIGNED_SHORT_PRINT                Global_UNSIGNED_PRINT
484                                                      
485  #define ?Global_LONG_PRINT(F,X)                     fprintf((F), "%ld", (X))
486                                                      
487  #define ?Global_UNSIGNED_LONG_PRINT(F,X)            fprintf((F), "%lu", (X))
488                                                      
489  #define ?Global_DOUBLE_PRINT(F,X)                   fprintf((F), "%g", (X))
490                                                      
491  #define ?Global_FLOAT_PRINT                         Global_DOUBLE_PRINT
492  
493  /* No `long long' printing (yet).  It is not portable. */
494  /* No `long double' printing.  It is not portable. */
495  #define ?Global_VOID_P_PRINT(F,X)                   fprintf((F), "%p", (X))
496  #define ?Global_CONST_VOID_P_PRINT                  Global_VOID_P_PRINT
497  #define ?Global_VOID_CONST_P_PRINT                  Global_VOID_P_PRINT
498  
499  #define ?Global_CHAR_P_PRINT(F,X) \
500          if (X == NULL) fprintf((F), "NULL"); else fprintf ((F), "%p:`%s'", (X), (X))
501  
502  #define ?Global_CONST_CHAR_P_PRINT                  Global_CHAR_P_PRINT
503  #define ?Global_CHAR_CONST_P_PRINT                  Global_CHAR_P_PRINT
504  
505  #define ?Global_CHAR_PRINT(F,X)                     fprintf ((F), "%d:`%c'", (X), (X))
506  
507  #define ?Global_SIGNED_CHAR_PRINT                   Global_CHAR_PRINT
508  #define ?Global_UNSIGNED_CHAR_PRINT                 Global_CHAR_PRINT
509  
510  /* ********************************************************************** */
511  
512  #define ?Global_VOIDP_CONSTANT_ZERO        1
513  #define ?Global_CONST_VOIDP_CONSTANT_ZERO  1
514  #define ?Global_VOIDP_CONST_CONSTANT_ZERO  1
515  #define ?Global_VOID_P_CONSTANT_ZERO       1
516  #define ?Global_CONST_VOID_P_CONSTANT_ZERO 1
517  #define ?Global_VOID_P_CONST_CONSTANT_ZERO 1
518  
519  #define ?Global_CHARP_CONSTANT_ZERO        1
520  #define ?Global_CONST_CHARP_CONSTANT_ZERO  1
521  #define ?Global_CHAR_CONSTP_CONSTANT_ZERO  1
522  #define ?Global_CHAR_P_CONSTANT_ZERO       1
523  #define ?Global_CONST_CHAR_P_CONSTANT_ZERO 1
524  #define ?Global_CHAR_CONST_P_CONSTANT_ZERO 1
525  
526  
527  #endif /* defined(Global_ERWIN_DEFAULTS_H) */
528  

Index

Stoppt die Vorratsdatenspeicherung
November 26th, 2007
Comments? Suggestions? Corrections? You can drop me a line.
zpentrabvagiktu@theiling.de
Schwerpunktpraxis