home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------------*/
- /* */
- /* DEFS.H */
- /* */
- /* Copyright (c) 1993 Borland International */
- /* All Rights Reserved */
- /* */
- /*------------------------------------------------------------------------*/
-
- #if !defined( __CLASSLIB_DEFS_H )
- #define __CLASSLIB_DEFS_H
-
- #if !defined( __CLASSLIB_RESOURCE_H )
- #include "classlib\resource.h"
- #endif // __CLASSLIB_RESOURCE_H
-
- /*------------------------------------------------------------------------*/
- /* */
- /* _RTTI provides a convenient macro for switching on the __rtti */
- /* keyword for finer grained control over generation of runtime type */
- /* information. */
- /* */
- /*------------------------------------------------------------------------*/
-
- #if defined(__BORLANDC__) && !defined(BI_NO_RTTI)
- #define _RTTI __rtti
- #else
- #define _RTTI
- #endif
-
- /*------------------------------------------------------------------------*/
- /* */
- /* These CAST macros encapsulate the new cast syntax in the ANSI/ISO */
- /* working paper. Note that TYPESAFE_DOWNCAST isn't as general as */
- /* dynamic_cast -- it only works on pointers. */
- /* */
- /* Usage: */
- /* */
- /* TYPESAFE_DOWNCAST(object,toClass) */
- /* Converts the pointer referred to by 'object' into a pointer to */
- /* an object of type 'toClass'. Note that the macro parameters to */
- /* TYPESAFE_DOWNCAST are in the opposite order from the rest of */
- /* the macros here. When using a compiler that supports new style */
- /* casts and runtime type information this is done with */
- /* dynamic_cast<> and will return 0 if the cast cannot be done. */
- /* When using a compiler that does not support new style casts and */
- /* runtime type information this is done with fake runtime type */
- /* information generated by the IMPLEMENT_CASTABLE macro. */
- /* */
- /* STATIC_CAST(targetType,object) */
- /* Converts the data object referred to by 'object' into the type */
- /* referred to by 'targetType'. When using a compiler that supports */
- /* new style casts, this is done with static_cast<> and will fail */
- /* if the cast cannot be done without runtime type information. */
- /* When using a compiler that does not support new style casts, this */
- /* is done with an old style dangerous cast. */
- /* */
- /* CONST_CAST(targetType,object) */
- /* Converts the data object referred to by 'object' into the type */
- /* referred to by 'targetType'. When using a compiler that supports */
- /* new style casts, this is done with const_cast<> and will fail */
- /* if the cast changes the type of the object in any way other than */
- /* adding or removing const and volatile qualifiers. */
- /* When using a compiler that does not support new style casts, this */
- /* is done with an old style dangerous cast. */
- /* */
- /* REINTERPRET_CAST(targetType,object) */
- /* Converts the data object referred to by 'object' into the type */
- /* referred to by 'targetType'. When using a compiler that supports */
- /* new style casts, this is done with reinterpret_cast<>. */
- /* When using a compiler that does not support new style casts, this */
- /* is done with an old style dangerous cast. */
- /* */
- /*------------------------------------------------------------------------*/
-
- #if defined( BI_NO_NEW_CASTS )
- # define TYPESAFE_DOWNCAST(object,toClass)\
- (object ?(toClass *)(object)->FindBase(#toClass) : 0)
- # define STATIC_CAST(targetType,object) \
- ((targetType)(object))
- # define CONST_CAST(targetType,object) \
- ((targetType)(object))
- # define REINTERPRET_CAST(targetType,object) \
- (*(targetType*)(void *)&(object))
- #else
- # define TYPESAFE_DOWNCAST(object,toClass)\
- dynamic_cast<toClass *>(object)
- # define STATIC_CAST(targetType,object) \
- static_cast<targetType>(object)
- # define CONST_CAST(targetType,object) \
- const_cast<targetType>(object)
- # define REINTERPRET_CAST(targetType,object) \
- reinterpret_cast<targetType>(object)
- #endif
-
- /*------------------------------------------------------------------------*/
- /* */
- /* Common definitions for pointer size and calling conventions. */
- /* */
- /* Calling conventions: */
- /* */
- /* _BIDSENTRY Specifies the calling convention used by BIDS. */
- /* */
- /* */
- /* Export (and size for DOS) information: */
- /* */
- /* _BIDSCLASS Exports class if building DLL version of library. */
- /* For DOS16 also provides size information. */
- /* */
- /* _BIDSDATA Exports data if building DLL version of library. */
- /* */
- /* _BIDSFUNC Exports function if building DLL version of library. */
- /* For DOS16 also provides size information */
- /* */
- /* _BIDSFAR Promotes data pointers to far in DLLs (DOS16 only). */
- /* */
- /* _BIDSFARDATA Forces data pointer to be far. */
- /* */
- /* _BIDSFARFUNC Forces function to be far. */
- /* */
- /* _BIDSFARCLASS Forces class to be far. */
- /* */
- /* _BIDSNEARDATA Forces data to be near. */
- /* */
- /* _BIDSNEARFUNC Forces function to be near. */
- /* */
- /* _BIDSNEARCLASS Forces class to be near. */
- /* */
- /*------------------------------------------------------------------------*/
-
- #if defined(__OS2__)
- # define _BIDSENTRY __stdcall
- #else
- # define _BIDSENTRY __cdecl
- #endif
-
- #if defined(__FLAT__)
- # define _BIDSFAR
- # define _BIDSFARDATA
- # define _BIDSFARFUNC
- # define _BIDSFARCLASS
- # define _BIDSNEARDATA
- # define _BIDSNEARFUNC
- # define _BIDSNEARCLASS
- # if defined(_BUILDBIDSDLL)
- # define _BIDSCLASS __export
- # define _BIDSDATA __export
- # define _BIDSFUNC __export
- # elif defined(_BIDSDLL) && !defined(__OS2__)
- # define _BIDSCLASS __import
- # define _BIDSDATA __import
- # define _BIDSFUNC __import
- # else
- # define _BIDSCLASS
- # define _BIDSDATA
- # define _BIDSFUNC
- # endif
- #else
- # if defined(__DLL__)
- # if defined(_BUILDBIDSDLL)
- # define _BIDSCLASS __export
- # elif defined(_BIDSDLL) || defined(_CLASSDLL)
- # define _BIDSCLASS __export
- # else
- # define _BIDSCLASS __far
- # endif
- # define _BIDSFAR __far
- # define _BIDSFARDATA __far
- # define _BIDSFARFUNC __far
- # define _BIDSFARCLASS __far
- # define _BIDSNEARDATA __near
- # define _BIDSNEARFUNC __near
- # define _BIDSNEARCLASS __near
- # elif defined(_BIDSDLL) || defined(_CLASSDLL)
- # define _BIDSCLASS __export
- # define _BIDSFAR __far
- # define _BIDSFARDATA __far
- # define _BIDSFARFUNC __far
- # define _BIDSFARCLASS __far
- # define _BIDSNEARDATA __near
- # define _BIDSNEARFUNC __near
- # define _BIDSNEARCLASS __near
- # else
- # if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
- # if defined(_BIDSFARVTABLE)
- # define _BIDSCLASS __huge
- # else
- # define _BIDSCLASS __near
- # endif
- # elif defined(__COMPACT__) || defined(__LARGE__)
- # if defined(_BIDSFARVTABLE)
- # define _BIDSCLASS __huge
- # else
- # define _BIDSCLASS __far
- # endif
- # else
- # define _BIDSCLASS __huge
- # endif
- # define _BIDSFAR
- # define _BIDSFARDATA __far
- # define _BIDSFARFUNC __far
- # define _BIDSFARCLASS __far
- # define _BIDSNEARDATA __near
- # define _BIDSNEARFUNC __near
- # define _BIDSNEARCLASS __near
- # endif
- # if defined(_BUILDBIDSDLL)
- # define _BIDSFUNC __export
- # else
- # if defined(_BIDSDLL) || defined(_CLASSDLL)
- # define _BIDSFUNC __far
- # else
- # define _BIDSFUNC
- # endif
- # endif
- # define _BIDSDATA
- #endif
-
- #endif // __CLASSLIB_DEFS_H
-
-