
{$R-}  // Turn off range checking.
{$A+}  // Need aligned record fields.
{$B-}  // Make sure there isn't complete boolean evaluation.
{$H+}  // Make sure huge strings are supported.

{------------------------------------------------------------------------------}
// Setup usage of default/alternate session behavior.
//
//  When controlling your own sessions manually, such as when doing an ISAPI
//  module, it is not necessary to maintain a default session. This is a
//  benefit because it avoids using a multi-threading resource when this
//  define is disabled. It is the same for the alternate session too.

// Make sure when building design-time packages the default session is on.

{$DEFINE ALLOW_DEFAULT_SESSION}
{ $ DEFINE ALLOW_ALT_SESSION}

{------------------------------------------------------------------------------}
// Setup defines according to compiler versions.
//
// Notes:
//
//   * Using an IBO_ prefix on the defines to avoid conflict with
//     non IBO packages.
//
//   * In an effort to minimise changes required to support new
//     compiler releases I use a reverse logic in assigning
//     some of the defines - that is, define all relevant values
//     and then undefine items not supported in specific versions.
//     - in support of this Delphi is the assumed compiler unless
//     overridden by specific C++Builder version. (Majority rule.)
//
//     IMPORTANT: If adding a new VCLxx_OR_GREATER define remember
//     to undefine the value in all the older versions!
//
//     Note: Actually this does not achieve much at the moment due
//     to a necessary hack in IBG_Custom.IMP.  Hopefully a means
//     will eventually be found to avoid that issue.
//     Use IBO_SUPPORTED_COMPILER if you need to test whether the
//     current compiler has been defined and tested to support IBObjects.

{$DEFINE IBO_40_OR_GREATER}    // Detection of move to IBO40

{$DEFINE IBO_VCL20_OR_GREATER}   // VCL v2.0 or greater (Delphi v2+)
{$DEFINE IBO_VCL30_OR_GREATER}   // VCL v3.0 or greater (Delphi v3+)
{$DEFINE IBO_VCL35_OR_GREATER}   // VCL v3.5 or greater (C++Builder v3+)
{$DEFINE IBO_VCL40_OR_GREATER}   // VCL v4.0 or greater (Delphi v4+ or C++B v4+)
{$DEFINE IBO_VCL50_OR_GREATER}   // VCL v5.0 or greater (Delphi v5+ or C++B v5+)
{$DEFINE IBO_VCL60_OR_GREATER}   // VCL v6.0 or greater (Delphi v6+ or C++B v6+)
{$DEFINE IBO_VCL70_OR_GREATER}   // VCL v7.0 or greater (Delphi v7+ or C++B v?+)
{$DEFINE IBO_VCL2005_OR_GREATER} // Delphi v2005 or greater
{$DEFINE IBO_VCL2006_OR_GREATER} // Delphi and C++ Builder v2006 or greater
{$DEFINE IBO_VCL2007_OR_GREATER} // Delphi and C++ Builder v2007 or greater

{------------------------------------------------------------------------------}

// Compiler specific defines, latest to oldest...

{$IFDEF VER185}                    // CodeGear For Delphi 2007
  {$IFDEF BCB}                     // C++ Builder
    {$DEFINE IBO_CPPB}
    {$DEFINE IBO_CPPB_2007}
  {$ELSE}                          // Delphi Win32
    {$DEFINE IBO_DELPHI}
    {$DEFINE IBO_DELPHI_2007}
  {$ENDIF}
  {$DEFINE IBO_VCL2007}
  {$DEFINE IBO_SUPPORTED_COMPILER}
{$ENDIF}

{$IFDEF VER180}                    // Borland Developer Studio v2006
  {$IFDEF BCB}                     // C++ Builder
    {$DEFINE IBO_CPPB}
    {$DEFINE IBO_CPPB_2006}
  {$ELSE}                          // Delphi Win32
    {$DEFINE IBO_DELPHI}
    {$DEFINE IBO_DELPHI_2006}
  {$ENDIF}
  {$DEFINE IBO_VCL2006}
  {$DEFINE IBO_SUPPORTED_COMPILER}

  {$UNDEF IBO_VCL2007_OR_GREATER}
{$ENDIF}

{$IFDEF VER170}                    // Delphi v2005
  {$IFDEF BCB}
    ERROR: BCB v2005 not supported
  {$ELSE}
    {$DEFINE IBO_DELPHI}
    {$DEFINE IBO_DELPHI_2005}
  {$ENDIF}
  {$DEFINE IBO_VCL2005}
  {$DEFINE IBO_SUPPORTED_COMPILER}

  {$UNDEF IBO_VCL2007_OR_GREATER}
  {$UNDEF IBO_VCL2006_OR_GREATER}
{$ENDIF}

{$IFDEF VER150}                    // Delphi v7
  {$IFDEF BCB}                     // C++ Builder
    ERROR: BCB v7 not supported
  {$ELSE}
    {$DEFINE IBO_DELPHI}
    {$DEFINE IBO_DELPHI_7}
  {$ENDIF}
  {$DEFINE IBO_VCL70}
  {$DEFINE IBO_SUPPORTED_COMPILER}

  {$UNDEF IBO_VCL2007_OR_GREATER}
  {$UNDEF IBO_VCL2006_OR_GREATER}
  {$UNDEF IBO_VCL2005_OR_GREATER}
{$ENDIF}

{$IFDEF VER140}
  {$IFDEF BCB}             // C++Builder v6
    {$DEFINE IBO_CPPB}
    {$DEFINE IBO_CPPB_6}
  {$ELSE}                  // Delphi 6
    {$DEFINE IBO_DELPHI}
    {$DEFINE IBO_DELPHI_6}
  {$ENDIF}
  {$DEFINE IBO_VCL60}
  {$DEFINE IBO_SUPPORTED_COMPILER}

  {$UNDEF IBO_VCL2007_OR_GREATER}
  {$UNDEF IBO_VCL2006_OR_GREATER}
  {$UNDEF IBO_VCL2005_OR_GREATER}
  {$UNDEF IBO_VCL70_OR_GREATER}
{$ENDIF}

{$IFDEF VER130}
  {$IFDEF BCB}             // C++Builder v5
    {$DEFINE IBO_CPPB}
    {$DEFINE IBO_CPPB_5}
  {$ELSE}                  // Delphi v5
    {$DEFINE IBO_DELPHI}
    {$DEFINE IBO_DELPHI_5}
  {$ENDIF}
  {$DEFINE IBO_VCL50}
  {$DEFINE IBO_SUPPORTED_COMPILER}

  {$UNDEF IBO_VCL2007_OR_GREATER}
  {$UNDEF IBO_VCL2006_OR_GREATER}
  {$UNDEF IBO_VCL2005_OR_GREATER}
  {$UNDEF IBO_VCL70_OR_GREATER}
  {$UNDEF IBO_VCL60_OR_GREATER}
{$ENDIF}

{$IFDEF VER125}    // C++Builder v4
  {$DEFINE IBO_CPPB}
  {$DEFINE IBO_CPPB_4}
  {$DEFINE IBO_VCL40} // same VCL version as Delphi 4
  {$DEFINE IBO_SUPPORTED_COMPILER}

  {$UNDEF IBO_VCL2007_OR_GREATER}
  {$UNDEF IBO_VCL2006_OR_GREATER}
  {$UNDEF IBO_VCL2005_OR_GREATER}
  {$UNDEF IBO_VCL70_OR_GREATER}
  {$UNDEF IBO_VCL60_OR_GREATER}
  {$UNDEF IBO_VCL50_OR_GREATER}
{$ENDIF}

{$IFDEF VER120}    // Delphi v4
  {$DEFINE IBO_DELPHI}
  {$DEFINE IBO_DELPHI_4}
  {$DEFINE IBO_VCL40}
  {$DEFINE IBO_SUPPORTED_COMPILER}

  {$UNDEF IBO_VCL2007_OR_GREATER}
  {$UNDEF IBO_VCL2006_OR_GREATER}
  {$UNDEF IBO_VCL2005_OR_GREATER}
  {$UNDEF IBO_VCL70_OR_GREATER}
  {$UNDEF IBO_VCL60_OR_GREATER}
  {$UNDEF IBO_VCL50_OR_GREATER}
{$ENDIF}

{$IFDEF VER110}    // C++Builder v3
  {$DEFINE IBO_CPPB}
  {$DEFINE IBO_CPPB_3}
  {$DEFINE IBO_VCL35}
  {$DEFINE IBO_SUPPORTED_COMPILER}

  {$UNDEF IBO_VCL2007_OR_GREATER}
  {$UNDEF IBO_VCL2006_OR_GREATER}
  {$UNDEF IBO_VCL2005_OR_GREATER}
  {$UNDEF IBO_VCL70_OR_GREATER}
  {$UNDEF IBO_VCL60_OR_GREATER}
  {$UNDEF IBO_VCL50_OR_GREATER}
  {$UNDEF IBO_VCL40_OR_GREATER}

  {$ObjExportAll On}
{$ENDIF}

{$IFDEF VER100}    // Delphi v3
  {$DEFINE IBO_DELPHI}
  {$DEFINE IBO_DELPHI_3}
  {$DEFINE IBO_VCL30}
  {$DEFINE IBO_SUPPORTED_COMPILER}

  {$UNDEF IBO_VCL2007_OR_GREATER}
  {$UNDEF IBO_VCL2006_OR_GREATER}
  {$UNDEF IBO_VCL2005_OR_GREATER}
  {$UNDEF IBO_VCL70_OR_GREATER}
  {$UNDEF IBO_VCL60_OR_GREATER}
  {$UNDEF IBO_VCL50_OR_GREATER}
  {$UNDEF IBO_VCL40_OR_GREATER}
  {$UNDEF IBO_VCL35_OR_GREATER}
{$ENDIF}

{$IFDEF VER90}     // Delphi v2
  {$DEFINE IBO_DELPHI}
  {$DEFINE IBO_DELPHI_2}
  {$DEFINE IBO_VCL20}
  {$DEFINE IBO_SUPPORTED_COMPILER}

  {$UNDEF IBO_VCL2007_OR_GREATER}
  {$UNDEF IBO_VCL2006_OR_GREATER}
  {$UNDEF IBO_VCL2005_OR_GREATER}
  {$UNDEF IBO_VCL70_OR_GREATER}
  {$UNDEF IBO_VCL60_OR_GREATER}
  {$UNDEF IBO_VCL50_OR_GREATER}
  {$UNDEF IBO_VCL40_OR_GREATER}
  {$UNDEF IBO_VCL35_OR_GREATER}
  {$UNDEF IBO_VCL30_OR_GREATER}
{$ENDIF}

{$IFDEF VER93}     // C++Builder v1.0
// Intentional compile time error
ERROR: C++Builder v1.0 not supported
{$ENDIF}

{$IFDEF VER80}     // Delphi v1.0 (Win16 version)
// Intentional compile time error
ERROR: Delphi v1.0 not supported
{$ENDIF}

{------------------------------------------------------------------------------}
// Derived defines based on compiler/VCL versions...

{$IFDEF IBO_VCL2006_OR_GREATER}
  {$DEFINE IBO_ASCOMP_SUPPORT}
{$ENDIF}

{$IFDEF IBO_DELPHI}
  {$DEFINE IBO_ASCOMP_SUPPORT}
{$ENDIF}

{$IFDEF IBO_VCL60_OR_GREATER}
  {$WARN UNIT_PLATFORM OFF}
{$ENDIF}

{$IFDEF IBO_VCL70_OR_GREATER}
  {$WARNINGS OFF}
{$ENDIF}