home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 v2.4 Fix / W95-v2.4fix.iso / ACADWIN / ADS / CPP / GENERAL / CPPSTUFF.H < prev   
Encoding:
C/C++ Source or Header  |  1995-02-08  |  4.2 KB  |  121 lines

  1. /* 
  2.     CPPSTUFF.H -
  3.     
  4.     This file:
  5.  
  6.         Declares some basic ADS C++ macros, enums and 
  7.         function structures.
  8.  
  9.     (C) Copyright 1988-1994 by Autodesk, Inc.
  10.  
  11.     This program is copyrighted by Autodesk, Inc. and is  licensed
  12.     to you under the following conditions.  You may not distribute
  13.     or  publish the source code of this program in any form.   You
  14.     may  incorporate this code in object form in derivative  works
  15.     provided  such  derivative  works  are  (i.) are  designed and
  16.     intended  to  work  solely  with  Autodesk, Inc. products, and
  17.     (ii.)  contain  Autodesk's  copyright  notice  "(C)  Copyright
  18.     1988-1994 by Autodesk, Inc."
  19.  
  20.     AUTODESK  PROVIDES THIS PROGRAM "AS IS" AND WITH  ALL  FAULTS.
  21.     AUTODESK  SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF  MER-
  22.     CHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK,  INC.
  23.     DOES  NOT  WARRANT THAT THE OPERATION OF THE PROGRAM  WILL  BE
  24.     UNINTERRUPTED OR ERROR FREE.
  25.  
  26. */
  27. #ifndef CPPSTUFF_H
  28. #define CPPSTUFF_H
  29.  
  30. //-----------------------------------------------------------------------------
  31. #define     MAX_ADS_FUNC        20
  32. #define     ARRAY_SIZE(x)       sizeof(x)/sizeof(x[0])
  33.  
  34. //-----------------------------------------------------------------------------
  35. #define     BASIC_CPP_STUFF( class_x )                              \
  36.             class_x&    operator=( const class_x& );                \
  37.                         class_x(const class_x&);                    \
  38.             public:                                                 \
  39.             virtual void WhoAmI( char *buf )                        \
  40.             {                                                       \
  41.                 if ( buf )                                          \
  42.                     strcpy( buf, #class_x );                        \
  43.             }                                                       \
  44.             private:                                                \
  45.  
  46. //-----------------------------------------------------------------------------
  47. enum ADS_FUNC_TYPE
  48. {
  49.     ADS_INT_FUNC
  50.     , ADS_VOID_FUNC
  51.     , ADS_REAL_FUNC
  52.     , ADS_UNKNOWN_FUNC
  53. };
  54.  
  55. //-----------------------------------------------------------------------------
  56. enum ADS_APP_STATE
  57. {
  58.     APP_OK  = 1
  59.     , APP_DONE
  60. };
  61.  
  62. //-----------------------------------------------------------------------------
  63. extern "C"
  64. {
  65. typedef int         (*ADS_int_FUNC)(struct resbuf*);
  66. typedef void        (*ADS_void_FUNC)(struct resbuf*);
  67. typedef ads_real    (*ADS_real_FUNC)(struct resbuf*);
  68. }
  69.  
  70. //-----------------------------------------------------------------------------
  71. struct ADS_FUNC
  72. {
  73.     union _ADS_FUNC
  74.     {
  75.         ADS_int_FUNC        AdsIntFunc;
  76.         ADS_void_FUNC       AdsVoidFunc;
  77.         ADS_real_FUNC       AdsRealFunc;
  78.     }calling_fun;
  79.     ADS_FUNC( ADS_int_FUNC aintfun ){ calling_fun.AdsIntFunc = aintfun; }
  80.     ADS_FUNC( ADS_void_FUNC avoidfun ){ calling_fun.AdsVoidFunc = avoidfun; }
  81.     ADS_FUNC( ADS_real_FUNC arealfun ){ calling_fun.AdsRealFunc = arealfun; }
  82.     ADS_FUNC(){ calling_fun .AdsIntFunc = NULL; }
  83. };
  84.  
  85. //-----------------------------------------------------------------------------
  86. class   ADS_APP;
  87. extern  ADS_APP     *main_app;
  88.  
  89. //-----------------------------------------------------------------------------
  90. ADS_APP* GetAdsApp();
  91.  
  92. //-----------------------------------------------------------------------------
  93. struct  ADS_FUNC_INFO
  94. {
  95.     ADS_FUNC        extern_func;
  96.     ADS_FUNC_TYPE   func_type;
  97.     char            extern_name[256];
  98.     int             func_code;
  99.     char            message[256];
  100.                     ADS_FUNC_INFO(){}
  101.                     ADS_FUNC_INFO(ADS_FUNC _extern_func
  102.                             , ADS_FUNC_TYPE _ads_func_type
  103.                             , char *_extern_name
  104.                             , char *message = NULL);
  105. };
  106.  
  107. //-----------------------------------------------------------------------------
  108. #ifndef ASSERT
  109. inline void ASSERT ( int exp )
  110. {
  111.     if ( exp == 0 )
  112.     {
  113.         ::MessageBox( GetFocus(), "Assert  occuried! " , "INFO", MB_OK );
  114.         _asm int 3;
  115.     }
  116. //    assert ( exp );
  117. }
  118. #endif
  119.  
  120. #endif
  121.