home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c221 / 6.ddi / MWHC.006 / 91 < prev    next >
Encoding:
Text File  |  1992-06-07  |  2.6 KB  |  94 lines

  1. #ifndef __RWGENERIC_H__
  2. #define __RWGENERIC_H__
  3. pragma push_align_members(64);
  4.  
  5. /*
  6.  * Standardizes what various compilers see of the generic.h facility
  7.  *
  8.  * $Header:   E:/vcs/rw/generic.h_v   1.0   11 Mar 1992 14:10:42   KEFFER  $
  9.  *
  10.  ****************************************************************************
  11.  *
  12.  * Rogue Wave Software, Inc.
  13.  * P.O. Box 2328
  14.  * Corvallis, OR 97339
  15.  *
  16.  * Copyright (C) 1992. This software is subject to copyright 
  17.  * protection under the laws of the United States and other countries.
  18.  *
  19.  ***************************************************************************
  20.  *
  21.  * $Log:   E:/vcs/rw/generic.h_v  $
  22.  * 
  23.  *    Rev 1.0   11 Mar 1992 14:10:42   KEFFER
  24.  * Initial revision.
  25.  */
  26. pragma push_align_members(64);
  27.  
  28. #include "rw/defs.h"
  29.  
  30. #ifdef __ZTC__
  31. #  include <generic.hpp>
  32. #else
  33. #  ifdef __GLOCK__
  34. #    include <generic.hxx>
  35. #  else
  36. #    ifdef _MSC_VER    /* Microsoft C/C++ ? */
  37. #      define NO_NATIVE_GENERIC_H 1
  38. #    else
  39. #      include <generic.h>
  40. #    endif
  41. #  endif
  42. #endif
  43.  
  44.  
  45. #ifdef NO_NATIVE_GENERIC_H
  46.  
  47. /*
  48.  * If the compiler did not supply a generic.h, then we will have to 
  49.  * do so:
  50.  *
  51.  * Here is the functionality we need:
  52.  *
  53.  *  MACROS:
  54.  **   name2(one,Two)  (we use the name2 macro directly)
  55.  *       result: oneTwo
  56.  **   declare(Class,type)
  57.  *       result: Classdeclare(type)
  58.  **   implement(Class,type)
  59.  *       result: Classimplement(type)
  60.  **   callerror(Class,type,intarg,charsplatarg)
  61.  *       result: (*errorhandler(Class,type))(intarg,charsplatarg)
  62.  **   set_handler(Class,type,handlerRetType)
  63.  *       result: set_typeClass_handler(handlerRetType)
  64.  *    errorhandler(Class,type)
  65.  *       result: typeClasshandler
  66.  *  Declarations and typedefs:
  67.  *    extern genericerror(int,char*)
  68.  *    typedef int(*GPT)(int,char)
  69.  */
  70.  
  71. extern genericerror(int,char*);
  72. typedef int (*GPT)(int,char*);
  73.  
  74. #define name2(a,b) _rwname2(a,b) /* to force the args to be evaluated here */
  75. #define _rwname2(a,b) a##b
  76. #define name3(a,b,c) _rwname3(a,b,c)
  77. #define _rwname3(a,b,c) a##b##c
  78. #define name4(a,b,c,d) _rwname4(a,b,c,d)
  79. #define _rwname4(a,b,c,d) a##b##c##d
  80.  
  81. #define declare(Class,type)     name2(Class,declare)(type)
  82. #define implement(Class,type)   name2(Class,implement)(type)
  83. #define callerror(Class,type,iarg,csarg) \
  84.            (*errorhandler(Class,type))(iarg,csarg)
  85. #define set_handler(Class,type,hrt) name4(set_,type,Class,_handler)(hrt)
  86. #define errorhandler(Class,type) name3(type,Class,handler)
  87.  
  88. #undef NO_NATIVE_GENERIC_H
  89.  
  90. #endif /* NO_NATIVE_GENERIC_H */
  91.  
  92. pragma pop_align_members();
  93. #endif    /* __RWGENERIC_H__ */
  94.