home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / CBTRIAL / SETUP / DATA.Z / STDGEN.H < prev    next >
C/C++ Source or Header  |  1997-02-14  |  4KB  |  110 lines

  1. #ifndef __RWSTDGENERIC_H__
  2. #define __RWSTDGENERIC_H__
  3. /* $Revision:   8.1  $ */
  4.  
  5. /***************************************************************************
  6.  *
  7.  * stdgen.h - Standardizes what various compilers see of the generic.h
  8.  *    facility
  9.  *
  10.  * $Id: stdgen.h,v 7.5 1995/08/14 22:30:13 smithey Exp $
  11.  *
  12.  ***************************************************************************
  13.  *
  14.  * (c) Copyright 1994, 1995 Rogue Wave Software, Inc.
  15.  * ALL RIGHTS RESERVED
  16.  *
  17.  * The software and information contained herein are proprietary to, and
  18.  * comprise valuable trade secrets of, Rogue Wave Software, Inc., which
  19.  * intends to preserve as trade secrets such software and information.
  20.  * This software is furnished pursuant to a written license agreement and
  21.  * may be used, copied, transmitted, and stored only in accordance with
  22.  * the terms of such license and with the inclusion of the above copyright
  23.  * notice.  This software and information or any other copies thereof may
  24.  * not be provided or otherwise made available to any other person.
  25.  *
  26.  * Notwithstanding any other lease or license that may pertain to, or
  27.  * accompany the delivery of, this computer software and information, the
  28.  * rights of the Government regarding its use, reproduction and disclosure
  29.  * are as set forth in Section 52.227-19 of the FARS Computer
  30.  * Software-Restricted Rights clause.
  31.  *
  32.  * Use, duplication, or disclosure by the Government is subject to
  33.  * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
  34.  * Technical Data and Computer Software clause at DFARS 252.227-7013.
  35.  * Contractor/Manufacturer is Rogue Wave Software, Inc.,
  36.  * P.O. Box 2328, Corvallis, Oregon 97339.
  37.  *
  38.  * This computer software and information is distributed with "restricted
  39.  * rights."  Use, duplication or disclosure is subject to restrictions as
  40.  * set forth in NASA FAR SUP 18-52.227-79 (April 1985) "Commercial
  41.  * Computer Software-Restricted Rights (April 1985)."  If the Clause at
  42.  * 18-52.227-74 "Rights in Data General" is specified in the contract,
  43.  * then the "Alternate III" clause applies.
  44.  *
  45.  **************************************************************************/
  46.  
  47. #if defined(__ZTC__) && !defined(THINK_CPLUS)
  48. #  include <generic.hpp>
  49. #else
  50. #  ifdef __GLOCK__
  51. #    include <generic.hxx>
  52. #  else
  53. #    if defined(_MSC_VER) || defined(__GNUC__)  /* Microsoft C/C++ or GNU? */
  54. #      define NO_NATIVE_GENERIC_H 1
  55. #    else
  56. #      include <generic.h>
  57. #    endif
  58. #  endif
  59. #endif
  60.  
  61.  
  62. #ifdef NO_NATIVE_GENERIC_H
  63.  
  64. /*
  65.  * If the compiler did not supply a generic.h, then we will have to
  66.  * do so:
  67.  *
  68.  * Here is the functionality we need:
  69.  *
  70.  *  MACROS:
  71.  **   name2(one,Two)  (we use the name2 macro directly)
  72.  *       result: oneTwo
  73.  **   declare(Class,type)
  74.  *       result: Classdeclare(type)
  75.  **   implement(Class,type)
  76.  *       result: Classimplement(type)
  77.  **   callerror(Class,type,intarg,charsplatarg)
  78.  *       result: (*errorhandler(Class,type))(intarg,charsplatarg)
  79.  **   set_handler(Class,type,handlerRetType)
  80.  *       result: set_typeClass_handler(handlerRetType)
  81.  *    errorhandler(Class,type)
  82.  *       result: typeClasshandler
  83.  *  Declarations and typedefs:
  84.  *    extern genericerror(int,char*)
  85.  *    typedef int(*GPT)(int,char)
  86.  */
  87.  
  88. extern rwexport genericerror(int,char*);
  89. typedef int (*GPT)(int,char*);
  90.  
  91. #define name2(a,b) _rwname2(a,b) /* to force the args to be evaluated here */
  92. #define _rwname2(a,b) a##b
  93. #define name3(a,b,c) _rwname3(a,b,c)
  94. #define _rwname3(a,b,c) a##b##c
  95. #define name4(a,b,c,d) _rwname4(a,b,c,d)
  96. #define _rwname4(a,b,c,d) a##b##c##d
  97.  
  98. #define declare(Class,type)     name2(Class,declare)(type)
  99. #define implement(Class,type)   name2(Class,implement)(type)
  100. #define callerror(Class,type,iarg,csarg) \
  101.                (*errorhandler(Class,type))(iarg,csarg)
  102. #define set_handler(Class,type,hrt) name4(set_,type,Class,_handler)(hrt)
  103. #define errorhandler(Class,type) name3(type,Class,handler)
  104.  
  105. #undef NO_NATIVE_GENERIC_H
  106.  
  107. #endif // NO_NATIVE_GENERIC_H
  108.  
  109. #endif // __RWSTDGENERIC_H__
  110.