// Support sgImage unit
{$DEFINE SGVER_5_2_5}
// Support sgDrawingNavigator unit
{$DEFINE SGVER_6_0_0} // to comment this define for old versions CAD/DXF Import VCL

{$IFDEF SGVER_6_0_0}
  // Unsupport sgImage unit, Support only sgDrawingNavigator unit
  {$UNDEF SGVER_5_2_5}
{$ENDIF}

// support optimized code for some global functions
{$DEFINE SG_FAST_CODE}

{$A+}// Record field alignment =8
{$J+}// Assignable typed constants

// Borland Delphi 3.0
{$IFDEF VER100}
  {$DEFINE SGDEL_3}
{$ENDIF}
// Borland C++Builder 3.0
{$IFDEF VER110}
  {$DEFINE SGDEL_3}
{$ENDIF}
// Borland Delphi 4.0
{$IFDEF VER120}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
{$ENDIF}
// Borland C++Builder 4.0
{$IFDEF VER125}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
{$ENDIF}
// Borland Delphi 5.0 & C++Builder 5
{$IFDEF VER130}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
{$ENDIF}
// Borland Delphi 6.0 & C++Builder 6
{$IFDEF VER140}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$A8}
{$ENDIF}
// Borland Delphi 7.0
{$IFDEF VER150}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$A8}
{$ENDIF}
// Borland Delphi 8.0
{$IFDEF VER160}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$DEFINE SGDEL_8}
  {$A8}
{$ENDIF}
// Borland Delphi 2005
{$IFDEF VER170}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$DEFINE SGDEL_8}
  {$DEFINE SGDEL_2005}
  {$A8}
{$ENDIF}
// Borland Developer Studio 2006 (v10.0) VER180
{$IFDEF VER180}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$DEFINE SGDEL_8}
  {$DEFINE SGDEL_2005}
  {$DEFINE SGDEL_2006}
  {$A8}
{$ENDIF}
// CodeGear Delphi 2007 for Win32 (v11.0) VER180 and VER185
{$IFDEF SGDEL_2006}
  {$IFDEF VER185}
    {$DEFINE SGDEL_2007}
  {$ENDIF}
{$ENDIF}

// CodeGear Delphi 2009 and C++ Builder 2009 (v12.0) VER200
{$IFDEF VER200}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$DEFINE SGDEL_8}
  {$DEFINE SGDEL_2005}
  {$DEFINE SGDEL_2006}
  {$DEFINE SGDEL_2007}
  {$DEFINE SGDEL_2009}
  {$A8}
{$ENDIF}

// Embarcadero RAD 2010 (v14.0) VER210
{$IFDEF VER210}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$DEFINE SGDEL_8}
  {$DEFINE SGDEL_2005}
  {$DEFINE SGDEL_2006}
  {$DEFINE SGDEL_2007}
  {$DEFINE SGDEL_2009}
  {$DEFINE SGDEL_2010}
  {$A8}
{$ENDIF}

// Embarcadero RAD XE (v15.0) VER220
{$IFDEF VER220}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$DEFINE SGDEL_8}
  {$DEFINE SGDEL_2005}
  {$DEFINE SGDEL_2006}
  {$DEFINE SGDEL_2007}
  {$DEFINE SGDEL_2009}
  {$DEFINE SGDEL_2010}
  {$DEFINE SGDEL_XE}
  {$A8}
{$ENDIF}

// Embarcadero RAD XE 2 (v16.0) VER230
{$IFDEF VER230}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$DEFINE SGDEL_8}
  {$DEFINE SGDEL_2005}
  {$DEFINE SGDEL_2006}
  {$DEFINE SGDEL_2007}
  {$DEFINE SGDEL_2009}
  {$DEFINE SGDEL_2010}
  {$DEFINE SGDEL_XE}
  {$DEFINE SGDEL_XE2}
  {$IFDEF CPUX64}
    {$DEFINE SG_CPUX64}
  {$ELSE}
    {$DEFINE SG_CPUX32}
  {$ENDIF}
  {$A8}
  {.$UNDEF SG_FAST_CODE}
  {.$DEFINE SG_FUTURE_CONVERSION_XE2}
{$ENDIF}

// Embarcadero RAD XE 3 (v17.0) VER240
{$IFDEF VER240}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$DEFINE SGDEL_8}
  {$DEFINE SGDEL_2005}
  {$DEFINE SGDEL_2006}
  {$DEFINE SGDEL_2007}
  {$DEFINE SGDEL_2009}
  {$DEFINE SGDEL_2010}
  {$DEFINE SGDEL_XE}
  {$DEFINE SGDEL_XE2}
  {$DEFINE SGDEL_XE3}
  {$IFDEF CPUX64}
    {$DEFINE SG_CPUX64}
  {$ELSE}
    {$DEFINE SG_CPUX32}
  {$ENDIF}
  {$A8}
  {.$UNDEF SG_FAST_CODE}
  {.$DEFINE SG_FUTURE_CONVERSION_XE2}
{$ENDIF}

// Embarcadero RAD XE 4 (v18.0) VER250
{$IFDEF VER250}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$DEFINE SGDEL_8}
  {$DEFINE SGDEL_2005}
  {$DEFINE SGDEL_2006}
  {$DEFINE SGDEL_2007}
  {$DEFINE SGDEL_2009}
  {$DEFINE SGDEL_2010}
  {$DEFINE SGDEL_XE}
  {$DEFINE SGDEL_XE2}
  {$DEFINE SGDEL_XE3}
  {$DEFINE SGDEL_XE4}
  {$IFDEF CPUX64}
    {$DEFINE SG_CPUX64}
  {$ELSE}
    {$DEFINE SG_CPUX32}
  {$ENDIF}
  {$A8}
  {.$UNDEF SG_FAST_CODE}
  {.$DEFINE SG_FUTURE_CONVERSION_XE2}
{$ENDIF}

// Embarcadero RAD XE 5 (v19.0) VER260
{$IFDEF VER260}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$DEFINE SGDEL_8}
  {$DEFINE SGDEL_2005}
  {$DEFINE SGDEL_2006}
  {$DEFINE SGDEL_2007}
  {$DEFINE SGDEL_2009}
  {$DEFINE SGDEL_2010}
  {$DEFINE SGDEL_XE}
  {$DEFINE SGDEL_XE2}
  {$DEFINE SGDEL_XE3}
  {$DEFINE SGDEL_XE4}
  {$DEFINE SGDEL_XE5}
  {$IFDEF CPUX64}
    {$DEFINE SG_CPUX64}
  {$ELSE}
    {$DEFINE SG_CPUX32}
  {$ENDIF}
  {$A8}
  {.$UNDEF SG_FAST_CODE}
  {.$DEFINE SG_FUTURE_CONVERSION_XE2}
{$ENDIF}

// Embarcadero RAD XE 6 (v20.0) VER270
{$IFDEF VER270}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$DEFINE SGDEL_8}
  {$DEFINE SGDEL_2005}
  {$DEFINE SGDEL_2006}
  {$DEFINE SGDEL_2007}
  {$DEFINE SGDEL_2009}
  {$DEFINE SGDEL_2010}
  {$DEFINE SGDEL_XE}
  {$DEFINE SGDEL_XE2}
  {$DEFINE SGDEL_XE3}
  {$DEFINE SGDEL_XE4}
  {$DEFINE SGDEL_XE5}
  {$DEFINE SGDEL_XE6}
  {$IFDEF CPUX64}
    {$DEFINE SG_CPUX64}
  {$ELSE}
    {$DEFINE SG_CPUX32}
  {$ENDIF}
  {$A8}
  {.$UNDEF SG_FAST_CODE}
  {.$DEFINE SG_FUTURE_CONVERSION_XE2}
{$ENDIF}

// Embarcadero RAD XE 7 (v21.0) VER280
{$IFDEF VER280}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$DEFINE SGDEL_8}
  {$DEFINE SGDEL_2005}
  {$DEFINE SGDEL_2006}
  {$DEFINE SGDEL_2007}
  {$DEFINE SGDEL_2009}
  {$DEFINE SGDEL_2010}
  {$DEFINE SGDEL_XE}
  {$DEFINE SGDEL_XE2}
  {$DEFINE SGDEL_XE3}
  {$DEFINE SGDEL_XE4}
  {$DEFINE SGDEL_XE5}
  {$DEFINE SGDEL_XE6}
  {$DEFINE SGDEL_XE7}
  {$IFDEF CPUX64}
    {$DEFINE SG_CPUX64}
  {$ELSE}
    {$DEFINE SG_CPUX32}
  {$ENDIF}
  {$A8}
  {.$UNDEF SG_FAST_CODE}
  {.$DEFINE SG_FUTURE_CONVERSION_XE2}
{$ENDIF}

// Embarcadero RAD XE 8 (v22.0) VER290
{$IFDEF VER290}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$DEFINE SGDEL_8}
  {$DEFINE SGDEL_2005}
  {$DEFINE SGDEL_2006}
  {$DEFINE SGDEL_2007}
  {$DEFINE SGDEL_2009}
  {$DEFINE SGDEL_2010}
  {$DEFINE SGDEL_XE}
  {$DEFINE SGDEL_XE2}
  {$DEFINE SGDEL_XE3}
  {$DEFINE SGDEL_XE4}
  {$DEFINE SGDEL_XE5}
  {$DEFINE SGDEL_XE6}
  {$DEFINE SGDEL_XE7}
  {$DEFINE SGDEL_XE8}
  {$IFDEF CPUX64}
    {$DEFINE SG_CPUX64}
  {$ELSE}
    {$DEFINE SG_CPUX32}
  {$ENDIF}
  {$A8}
  {.$UNDEF SG_FAST_CODE}
  {.$DEFINE SG_FUTURE_CONVERSION_XE2}
{$ENDIF}

// Embarcadero RAD D10 (v23.0) VER300
{$IFDEF VER300}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$DEFINE SGDEL_8}
  {$DEFINE SGDEL_2005}
  {$DEFINE SGDEL_2006}
  {$DEFINE SGDEL_2007}
  {$DEFINE SGDEL_2009}
  {$DEFINE SGDEL_2010}
  {$DEFINE SGDEL_XE}
  {$DEFINE SGDEL_XE2}
  {$DEFINE SGDEL_XE3}
  {$DEFINE SGDEL_XE4}
  {$DEFINE SGDEL_XE5}
  {$DEFINE SGDEL_XE6}
  {$DEFINE SGDEL_XE7}
  {$DEFINE SGDEL_XE8}
  {$DEFINE SGDEL_D10}
  {$IFDEF CPUX64}
    {$DEFINE SG_CPUX64}
  {$ELSE}
    {$DEFINE SG_CPUX32}
  {$ENDIF}
  {$A8}
  {.$UNDEF SG_FAST_CODE}
  {.$DEFINE SG_FUTURE_CONVERSION_XE2}
{$ENDIF}

// Embarcadero RAD D10.1 (v24.0) VER310
{$IFDEF VER310}
  {$DEFINE SGDEL_3}
  {$DEFINE SGDEL_4}
  {$DEFINE SGDEL_5}
  {$DEFINE SGDEL_6}
  {$DEFINE SGDEL_7}
  {$DEFINE SGDEL_8}
  {$DEFINE SGDEL_2005}
  {$DEFINE SGDEL_2006}
  {$DEFINE SGDEL_2007}
  {$DEFINE SGDEL_2009}
  {$DEFINE SGDEL_2010}
  {$DEFINE SGDEL_XE}
  {$DEFINE SGDEL_XE2}
  {$DEFINE SGDEL_XE3}
  {$DEFINE SGDEL_XE4}
  {$DEFINE SGDEL_XE5}
  {$DEFINE SGDEL_XE6}
  {$DEFINE SGDEL_XE7}
  {$DEFINE SGDEL_XE8}
  {$DEFINE SGDEL_D10}
  {$DEFINE SGDEL_D10_1}
  {$IFDEF CPUX64}
    {$DEFINE SG_CPUX64}
  {$ELSE}
    {$DEFINE SG_CPUX32}
  {$ENDIF}
  {$A8}
  {.$UNDEF SG_FAST_CODE}
  {.$DEFINE SG_FUTURE_CONVERSION_XE2}
{$ENDIF}

{$DEFINE SG_BCB}
{$IFNDEF VER93}         // C++ Builder 1.0
  {$IFNDEF VER110}      // C++ Builder 3.0
    {$IFNDEF VER125}    // C++ Builder 4.0
      {$IFNDEF BCB}     // C++ Builder 5.0 or higher
        {$UNDEF SG_BCB}
      {$ENDIF}
    {$ENDIF}
  {$ENDIF}
{$ENDIF}

{$IFDEF SGDEL_4}
  {$IFNDEF SG_BCB}
    {$DEFINE SG_USEGDIPLUS}
  {$ELSE}
    {$IFDEF SGDEL_2007}
      {$DEFINE SG_USEGDIPLUS}
    {$ENDIF}
  {$ENDIF}
{$ENDIF}

{$IFDEF SGDEL_2006}
  {$DEFINE SG_INLINE}
{$ENDIF}

{$IFDEF SGDEL_2010}
  {$WEAKLINKRTTI ON}
  //{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
{$ENDIF}

{$IFDEF FPC}
{$IFDEF VER2}
 {$DEFINE SGDEL_3}
 {$DEFINE SGDEL_4}
 {$DEFINE SGDEL_5}
 {$DEFINE SGDEL_6}
 {$DEFINE SGDEL_7}
 {$IFDEF UNICODE}
  //
 {$ENDIF}
 {$DEFINE SGFPC}
 {$IFDEF CPUX64}
   {$DEFINE SG_CPUX64}
 {$ELSE}
   {$DEFINE SG_CPUX32}
 {$ENDIF}
 {$UNDEF SGFULLGDIPLUS}
 {$UNDEF SG_USEGDIPLUS}
 {$A8}
{$ENDIF}
{$ENDIF}

(*
// Previous version

{$IFNDEF VER80}// Delphi 1.0
 {$IFNDEF VER90}// Delphi 2.0
  {$IFNDEF VER93}// C++Builder 1.0
    // Delphi 3.0 or higher
    {$IFNDEF VER100}
      // C++Builder 3.0 or higher
      {$IFNDEF VER110}
        // Delphi 4.0 or higher
        {$IFNDEF VER120}
          // C++Builder 4.0 or higher
          {$IFNDEF VER125}
            // Delphi 5.0 or higher
              {$IFNDEF VER130}
                {$IFNDEF VER140}
                   {$DEFINE SGDEL_6} // Delphi 6.0 or higher
                   {$A8}
                {$ENDIF}
              {$ENDIF}
          {$ENDIF}
        {$ENDIF}
      {$ENDIF}
    {$ENDIF}
  {$ENDIF}
 {$ENDIF}
{$ENDIF}
*)
{$IFDEF SGDEL_6}
{$WARN SYMBOL_PLATFORM OFF}
{$ENDIF}

{$R-}//Range checking disenables

{$IFDEF SG_ABVIEWER}
  {$INCLUDE ABViewer.INC}
  {$INCLUDE SGCOMMON.INC}
{$ENDIF}

{$IFDEF SG_INVENTORY}
  {$INCLUDE Inventory.INC}
  {$INCLUDE SGCOMMON.INC}
{$ENDIF}

{$IFDEF SG_ABCAD}
  {$INCLUDE ABCAD.INC}
  {$INCLUDE SGCOMMON.INC}
{$ENDIF}

{$IFDEF SG_EVACUATION}
  {$INCLUDE Evacuation.INC}
  {$INCLUDE SGCOMMON.INC}
{$ENDIF}

{$IFDEF SG_CADVIEW_WLX}
  {$DEFINE SG_ACTIVE_X}
  {$INCLUDE SGCOMMON_DLL.INC}
{$ENDIF}

{$IFDEF SG_CADEDITORX}
  {$DEFINE SG_ACTIVE_X}
  {$INCLUDE SGCOMMON.INC}
  {$INCLUDE CADEDITORX.INC}
{$ENDIF}

{$IFDEF SG_CADVIEWX_LITE}
 {$DEFINE SG_ACTIVE_X}
  {$INCLUDE CADVIEWX_LITE.INC}
  {$INCLUDE SGCOMMON.INC}
  {$UNDEF SG_XML_INTERFACE}
{$ELSE}
{$IFDEF SGCADVIEWX}
 {$DEFINE SG_ACTIVE_X}
  {$INCLUDE CADVIEWX.INC}
  {$INCLUDE SGCOMMON.INC}
  {$UNDEF SG_NO3DMODELS}
{$ENDIF}
{$ENDIF}

{$IFDEF SG_ADITIONAL_GRAPHICS}
  {$DEFINE SG_USE_PNG}
{$ENDIF}

{$IFDEF SG_CADIMPORTER_DLL}
  {$INCLUDE CADIMPORTER.INC}
  {$INCLUDE SGCOMMON_DLL.INC}
{$ENDIF}

{$IFDEF SG_CADIMAGE_DLL}
  {$INCLUDE CADIMAGEDLL.INC}
  {$INCLUDE SGCOMMON_DLL.INC}
{$ENDIF}


{$IFDEF SG_KERNEL_TEST}
  {$DEFINE SG_BTI_TEST}
{$ENDIF}

{$IFDEF SG_SHAREWAREMANAGER}
  {$DEFINE SG_NO3DMODELS}
  {$DEFINE SG_WIDE_DB}
  {$DEFINE SG_NONEEDCONSTANTS}
  {$DEFINE SG_ABVIEWER}
  {$DEFINE SGMULLANG}
  {$DEFINE SGAPPPROTECT}
  {$IFDEF SG_DATABASE}
    {$UNDEF SG_SHAREIT}
    {$UNDEF SG_ADDRUSDOC}
    {$UNDEF SG_USE_ADO}
    {$DEFINE SG_USE_UNI}
  {$ELSE}
    {$DEFINE SG_SHAREIT}
    {$UNDEF SG_USE_UNI}
    {$DEFINE SG_USE_ADO}
  {$ENDIF}
{$ENDIF}

{$DEFINE SG_BREP_TOPOLOGY}

{$DEFINE SG_XREF_EXTENDED}

{$R-}
{$Q-}