home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / h.z / GENERIC.H < prev    next >
C/C++ Source or Header  |  1996-07-24  |  1KB  |  40 lines

  1. //
  2. //  generic.h    Macros to support pseudo-templates
  3. //
  4. //  Copyright by WATCOM International Corp. 1988-1996.  All rights reserved.
  5. //
  6. #ifndef _GENERIC_H_INCLUDED
  7. #define _GENERIC_H_INCLUDED
  8.  
  9. #ifndef __cplusplus
  10. #error generic.h is for use with C++
  11. #endif
  12.  
  13. #define    name2(__n1,__n2)        __paste2(__n1,__n2)
  14. #define    __paste2(__p1,__p2)        __p1##__p2
  15. #define    name3(__n1,__n2,__n3)        __paste3(__n1,__n2,__n3)
  16. #define    __paste3(__p1,__p2,__p3)    __p1##__p2##__p3
  17. #define    name4(__n1,__n2,__n3,__n4)    __paste4(__n1,__n2,__n3,__n4)
  18. #define    __paste4(__p1,__p2,__p3,__p4)    __p1##__p2##__p3##__p4
  19.  
  20. #define    declare(__Cls,__Typ1) \
  21.     name2(__Cls,declare)(__Typ1)
  22. #define    implement(__Cls,__Typ1) \
  23.     name2(__Cls,implement)(__Typ1)
  24. #define    declare2(__Cls,__Typ1,__Typ2) \
  25.     name2(__Cls,declare)(__Typ1,__Typ2)
  26. #define    implement2(__Cls,__Typ1,__Typ2) \
  27.     name2(__Cls,implement)(__Typ1,__Typ2)
  28. #define callerror(__Cls,__Typ1,__Typ2,__Typ3) \
  29.     (*errorhandler(__Cls,__Typ1))(__Typ2,__Typ3)
  30. #define errorhandler(__Cls,__Typ1) \
  31.     name3(__Typ1,__Cls,handler)
  32. #define set_handler(__Cls,__Typ1,__Typ2) \
  33.     name4(set_,__Typ1,__Cls,_handler)(__Typ2)
  34.  
  35. // undocumented AT&T function (WATCOM stub returns first argument)
  36. extern int genericerror( int, char* );
  37. typedef int (*GPT)( int, char* );
  38.  
  39. #endif
  40.