home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / db02_src.zip / ordcomp.h < prev    next >
C/C++ Source or Header  |  1993-11-05  |  2KB  |  69 lines

  1. /**************************************************************************
  2.  * Source Id :
  3.  *
  4.  * $Id: ordcomp.h,v 1.2 1993/09/27 01:15:44 kevinl Exp $
  5.  *-------------------------------------------------------------------------
  6.  * Project Notes :
  7.  *
  8.  *  Diamond Base
  9.  *  ============
  10.  *      A solid database implementation, spurred on by the continuing
  11.  *  Metal (Lead) Base saga.
  12.  *
  13.  *  Project Team :
  14.  *        A. Davison
  15.  *        K. Lentin
  16.  *        D. Platt
  17.  *
  18.  *    Project Commenced : 05-02-1993
  19.  *
  20.  *-------------------------------------------------------------------------
  21.  *  Module Notes :
  22.  *     The comparison macros.
  23.  *
  24.  *  Original Author :
  25.  *        Daz stole them from Kev and domesticated them.
  26.  *
  27.  *-------------------------------------------------------------------------
  28.  * Revision History:
  29.  *
  30.  * $Log: ordcomp.h,v $
  31.  * Revision 1.2  1993/09/27  01:15:44  kevinl
  32.  * Changed ORD_COMPARE to use < and >
  33.  *
  34.  * Revision 1.1  1993/09/26  16:06:20  darrenp
  35.  * Initial revision
  36.  *
  37.  **************************************************************************/
  38.  
  39. #ifndef __ORD_COMPARE_H
  40. #define __ORD_COMPARE_H
  41.  
  42. #define ORD_COMPARE(t) \
  43.     inline long compare_##t(pKeyType k1, pKeyType k2) \
  44.     { \
  45.         t _t1 = *((t *)k1); \
  46.         t _t2 = *((t *)k2); \
  47.         return (_t1==_t2)?0:((_t1<_t2)?-1:1); \
  48.     } 
  49.  
  50. #define REAL_COMPARE(t) \
  51.     inline long compare_##t(pKeyType k1, pKeyType k2) \
  52.     { \
  53.         t _t1 = *((t *)k1); \
  54.         t _t2 = *((t *)k2); \
  55.         return (_t1==_t2)?0:((_t1<_t2)?-1:1); \
  56.     }
  57.  
  58. ORD_COMPARE(short);
  59. ORD_COMPARE(ushort);
  60. ORD_COMPARE(long);
  61. ORD_COMPARE(ulong);
  62. ORD_COMPARE(dateType);
  63. ORD_COMPARE(char);
  64. ORD_COMPARE(uniqueType);
  65. REAL_COMPARE(float);
  66. REAL_COMPARE(double);
  67. REAL_COMPARE(moneyType);
  68. #endif
  69.