home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c021 / 7.img / INCLUDE.ZIP / GENERIC.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-04  |  1.4 KB  |  46 lines

  1. /* generic.h -- for faking generic class declarations
  2.  
  3.     Copyright (c) 1990 by Borland International    
  4.     All rights reserved
  5.  
  6.     When type templates are implemented in C++, this will probably go away.
  7. */
  8.  
  9. #ifndef __GENERIC_H
  10. #define __GENERIC_H
  11.  
  12. #if __STDC__
  13. #define _Cdecl
  14. #else
  15. #define _Cdecl    cdecl
  16. #endif
  17.  
  18. // token-pasting macros; ANSI requires an extra level of indirection
  19. #define _Paste2(z, y)        _Paste2_x(z, y)
  20. #define _Paste2_x(z, y)        z##y
  21. #define _Paste3(z, y, x)    _Paste3_x(z, y, x)
  22. #define _Paste3_x(z, y, x)    z##y##x
  23. #define _Paste4(z, y, x, w)    _Paste4_x(z, y, x, w)
  24. #define _Paste4_x(z, y, x, w)    z##y##x##w
  25.  
  26. // macros for declaring and implementing classes
  27. #define declare(z, y) _Paste2(z, declare)(y)
  28. #define implement(z, y) _Paste2(z, implement)(y)
  29. #define declare2(z, y, x) _Paste2(z, declare2)(y, x)
  30. #define implement2(z, y, x) _Paste2(z, implement2)(y, x)
  31.  
  32. // macros for declaring error-handling functions
  33. extern _Cdecl genericerror(int, char*);    // not implemented ***
  34. typedef int _Cdecl (*GPT)(int, char*);
  35. #define set_handler(gen, tp, z) _Paste4(set_, tp, gen, _handler)(z)
  36. #define errorhandler(gen, tp) _Paste3(tp, gen, handler)
  37. #define callerror(gen, tp, z, y) (*errorhandler(gen, tp))(z, y)
  38.  
  39. /*
  40.  * function genericerror is not documented in the AT&T release, and
  41.  * is not supplied.  If you can document any expected behavior, we
  42.  * will try to adjust our implementation accordingly.
  43.  */
  44.  
  45. #endif
  46.