// http://docwiki.embarcadero.com/RADStudio/Rio/en/Compiler_Versions

{$DEFINE DELPHI_XX}

{$IFDEF FPC}
  {$MODE DELPHI}
  {$UNDEF DELPHI_XX}
  // FPC is 100% compatible with D6
  {$DEFINE DELPHI6}
{$ENDIF}

// Delphi 1 
{$IFDEF VER80}
  {$DEFINE DELPHI1}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi 2 
{$IFDEF VER90}
  {$DEFINE DELPHI2}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi 3 
{$IFDEF VER100}
  {$DEFINE DELPHI3}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi 4 
{$IFDEF VER120}
  {$DEFINE DELPHI4}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi 5
{$IFDEF VER130}
  {$DEFINE DELPHI5}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi 6
{$IFDEF VER140}
  {$DEFINE DELPHI6}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi 7
{$IFDEF VER150}
  {$DEFINE DELPHI7}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi 8 for .Net 
{$IFDEF VER160}
  {$DEFINE DELPHI8}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi 2005 (Win32/.Net) 
{$IFDEF VER170}
  {$DEFINE DELPHI9}
  {$DEFINE DELPHI2005}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi 2007
// Delphi 2006 (Win32/.Net) 
{$IFDEF VER180}
  {$IFDEF VER185}
    {$DEFINE DELPHI11}
    {$DEFINE DELPHI2007}
  {$ELSE}
    {$DEFINE DELPHI10}
    {$DEFINE DELPHI2006}
  {$ENDIF}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi 2007 for .Net *
{$IFDEF VER190}
  {$DEFINE DELPHI11}
  {$DEFINE DELPHI2007}
  {$UNDEF DELPHI_XX}
{$ENDIF VER190}

// Delphi 2009
{$IFDEF VER200}
  {$DEFINE DELPHI12}
  {$DEFINE DELPHI2009}
  {$UNDEF DELPHI_XX}
{$ENDIF VER200}

// Delphi 2010
{$IFDEF VER210}
  {$DEFINE DELPHI14}
  {$DEFINE DELPHI2010}
  {$UNDEF DELPHI_XX}
{$ENDIF VER210}

// Delphi XE
{$IFDEF VER220}
  {$DEFINE DELPHI15}
  {$DEFINE DELPHI_XE}
  {$UNDEF DELPHI_XX}
{$ENDIF VER220}

// Delphi XE2 (Win32/Win64/OSX)
{$IFDEF VER230}
  {$DEFINE DELPHI16}
  {$DEFINE DELPHI_XE2}
  {$UNDEF DELPHI_XX}
{$ENDIF VER220}

// Delphi XE3 (Win32/Win64/OSX)
{$IFDEF VER240}
  {$DEFINE DELPHI17}
  {$DEFINE DELPHI_XE3}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi XE4 (Win32/Win64/OSX/iOS)
{$IFDEF VER250}
  {$DEFINE DELPHI18}
  {$DEFINE DELPHI_XE4}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi XE5 (Win32/Win64/OSX/iOS/Android)
{$IFDEF VER260}
  {$DEFINE DELPHI19}
  {$DEFINE DELPHI_XE5}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi XE6 (Win32/Win64/OSX/iOS/Android)
{$IFDEF VER270}
  {$DEFINE DELPHI20}
  {$DEFINE DELPHI_XE6}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi XE7 (Win32/Win64/OSX/iOS/Android)
{$IFDEF VER280}
  {$DEFINE DELPHI21}
  {$DEFINE DELPHI_XE7}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi XE8 (Win32/Win64/OSX/iOS32/iOS64/Android)
{$IFDEF VER290}
  {$DEFINE DELPHI22}
  {$DEFINE DELPHI_XE8}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi Seattle (Win32/Win64/OSX/iOS32/iOS64/Android)
{$IFDEF VER300}
  {$DEFINE DELPHI23}
  {$DEFINE DELPHI_XE10}
  {$DEFINE DELPHI_SEATTLE}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi Berlin (Win32/Win64/OSX/iOS32/iOS64/Android)
{$IFDEF VER310}
  {$DEFINE DELPHI24}
  {$DEFINE DELPHI_XE11}
  {$DEFINE DELPHI_BERLIN}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi Tokyo (Win32/Win64/OSX/iOS32/iOS64/Android/Linux64)
{$IFDEF VER320}
  {$DEFINE DELPHI25}
  {$DEFINE DELPHI_XE12}
  {$DEFINE DELPHI_TOKYO}
  {$UNDEF DELPHI_XX}
{$ENDIF}

// Delphi Rio (Win32/Win64/OSX/iOS32/iOS64/Android/Linux64)
{$IFDEF VER330}
  {$DEFINE DELPHI26}
  {$DEFINE DELPHI_XE13}
  {$DEFINE DELPHI_RIO}
  {$UNDEF DELPHI_XX}
{$ENDIF}

{$IFDEF DELPHI_XX}
  ERROR: Unknown compiler please update compiler.inc file
{$ENDIF}

{$IFDEF DELPHI26} {$DEFINE DELPHI26_UP} {$ENDIF}
{$IFDEF DELPHI25} {$DEFINE DELPHI25_UP} {$ENDIF}
{$IFDEF DELPHI24} {$DEFINE DELPHI24_UP} {$ENDIF}
{$IFDEF DELPHI23} {$DEFINE DELPHI23_UP} {$ENDIF}
{$IFDEF DELPHI22} {$DEFINE DELPHI22_UP} {$ENDIF}
{$IFDEF DELPHI21} {$DEFINE DELPHI21_UP} {$ENDIF}
{$IFDEF DELPHI20} {$DEFINE DELPHI20_UP} {$ENDIF}
{$IFDEF DELPHI19} {$DEFINE DELPHI19_UP} {$ENDIF}
{$IFDEF DELPHI18} {$DEFINE DELPHI18_UP} {$ENDIF}
{$IFDEF DELPHI17} {$DEFINE DELPHI17_UP} {$ENDIF}
{$IFDEF DELPHI16} {$DEFINE DELPHI16_UP} {$ENDIF}
{$IFDEF DELPHI15} {$DEFINE DELPHI15_UP} {$ENDIF}
{$IFDEF DELPHI14} {$DEFINE DELPHI14_UP} {$ENDIF}
{$IFDEF DELPHI12} {$DEFINE DELPHI12_UP} {$ENDIF}
{$IFDEF DELPHI11} {$DEFINE DELPHI11_UP} {$ENDIF}
{$IFDEF DELPHI10} {$DEFINE DELPHI10_UP} {$ENDIF}
{$IFDEF DELPHI9}  {$DEFINE DELPHI9_UP}  {$ENDIF}
{$IFDEF DELPHI8}  {$DEFINE DELPHI8_UP}  {$ENDIF}
{$IFDEF DELPHI7}  {$DEFINE DELPHI7_UP}  {$ENDIF}
{$IFDEF DELPHI6}  {$DEFINE DELPHI6_UP}  {$ENDIF}
{$IFDEF DELPHI5}  {$DEFINE DELPHI5_UP}  {$ENDIF}
{$IFDEF DELPHI4}  {$DEFINE DELPHI4_UP}  {$ENDIF}
{$IFDEF DELPHI3}  {$DEFINE DELPHI3_UP}  {$ENDIF}
{$IFDEF DELPHI2}  {$DEFINE DELPHI2_UP}  {$ENDIF}
{$IFDEF DELPHI1}  {$DEFINE DELPHI1_UP}  {$ENDIF}

{$IFDEF DELPHI26_UP} {$DEFINE DELPHI25_UP} {$ENDIF}
{$IFDEF DELPHI25_UP} {$DEFINE DELPHI24_UP} {$ENDIF}
{$IFDEF DELPHI24_UP} {$DEFINE DELPHI23_UP} {$ENDIF}
{$IFDEF DELPHI23_UP} {$DEFINE DELPHI22_UP} {$ENDIF}
{$IFDEF DELPHI22_UP} {$DEFINE DELPHI21_UP} {$ENDIF}
{$IFDEF DELPHI21_UP} {$DEFINE DELPHI20_UP} {$ENDIF}
{$IFDEF DELPHI20_UP} {$DEFINE DELPHI19_UP} {$ENDIF}
{$IFDEF DELPHI19_UP} {$DEFINE DELPHI18_UP} {$ENDIF}
{$IFDEF DELPHI18_UP} {$DEFINE DELPHI17_UP} {$ENDIF}
{$IFDEF DELPHI17_UP} {$DEFINE DELPHI16_UP} {$ENDIF}
{$IFDEF DELPHI16_UP} {$DEFINE DELPHI15_UP} {$ENDIF}
{$IFDEF DELPHI15_UP} {$DEFINE DELPHI14_UP} {$ENDIF}
{$IFDEF DELPHI14_UP} {$DEFINE DELPHI13_UP} {$ENDIF}
{$IFDEF DELPHI13_UP} {$DEFINE DELPHI12_UP} {$ENDIF}
{$IFDEF DELPHI12_UP} {$DEFINE DELPHI11_UP} {$ENDIF}
{$IFDEF DELPHI11_UP} {$DEFINE DELPHI10_UP} {$ENDIF}
{$IFDEF DELPHI10_UP} {$DEFINE DELPHI9_UP}  {$ENDIF}
{$IFDEF DELPHI9_UP}  {$DEFINE DELPHI8_UP}  {$ENDIF}
{$IFDEF DELPHI8_UP}  {$DEFINE DELPHI7_UP}  {$ENDIF}
{$IFDEF DELPHI7_UP}  {$DEFINE DELPHI6_UP}  {$ENDIF}
{$IFDEF DELPHI6_UP}  {$DEFINE DELPHI5_UP}  {$ENDIF}
{$IFDEF DELPHI5_UP}  {$DEFINE DELPHI4_UP}  {$ENDIF}
{$IFDEF DELPHI4_UP}  {$DEFINE DELPHI3_UP}  {$ENDIF}
{$IFDEF DELPHI3_UP}  {$DEFINE DELPHI2_UP}  {$ENDIF}
{$IFDEF DELPHI2_UP}  {$DEFINE DELPHI1_UP}  {$ENDIF}

{$IFDEF DELPHI26_UP} {$DEFINE DELPHI_XE13_UP} {$DEFINE DELPHI_RIO_UP} {$ENDIF}
{$IFDEF DELPHI25_UP} {$DEFINE DELPHI_XE12_UP} {$DEFINE DELPHI_TOKYO_UP} {$ENDIF}
{$IFDEF DELPHI24_UP} {$DEFINE DELPHI_XE11_UP} {$DEFINE DELPHI_BERLIN_UP} {$ENDIF}
{$IFDEF DELPHI23_UP} {$DEFINE DELPHI_XE10_UP} {$DEFINE DELPHI_SEATTLE_UP} {$ENDIF}
{$IFDEF DELPHI22_UP} {$DEFINE DELPHI_XE8_UP} {$ENDIF}
{$IFDEF DELPHI21_UP} {$DEFINE DELPHI_XE7_UP} {$ENDIF}
{$IFDEF DELPHI20_UP} {$DEFINE DELPHI_XE6_UP} {$ENDIF}
{$IFDEF DELPHI19_UP} {$DEFINE DELPHI_XE5_UP} {$ENDIF}
{$IFDEF DELPHI18_UP} {$DEFINE DELPHI_XE4_UP} {$ENDIF}
{$IFDEF DELPHI17_UP} {$DEFINE DELPHI_XE3_UP} {$ENDIF}
{$IFDEF DELPHI16_UP} {$DEFINE DELPHI_XE2_UP} {$ENDIF}
{$IFDEF DELPHI15_UP} {$DEFINE DELPHI_XE_UP}  {$ENDIF}
{$IFDEF DELPHI14_UP} {$DEFINE DELPHI2010_UP} {$ENDIF}
{$IFDEF DELPHI12_UP} {$DEFINE DELPHI2009_UP} {$ENDIF}
{$IFDEF DELPHI11_UP} {$DEFINE DELPHI2007_UP} {$ENDIF}
{$IFDEF DELPHI10_UP} {$DEFINE DELPHI2006_UP} {$ENDIF}
{$IFDEF DELPHI9_UP}  {$DEFINE DELPHI2005_UP} {$ENDIF}

{$IFDEF DELPHI2_UP}  {$DEFINE SUPPORTS_WIDECHAR}   {$ENDIF}
{$IFDEF DELPHI3_UP}  {$DEFINE SUPPORTS_WIDESTRING} {$ENDIF}
{$IFDEF DELPHI12_UP} {$DEFINE SUPPORTS_UNICODE}    {$ENDIF}

{$IFDEF FPC}
  {$DEFINE HAS_ENUM_ORDINALITY}
{$ENDIF}

{$IFDEF DELPHI7_UP}
  {$DEFINE HAS_ENUM_ORDINALITY}
  {$IFNDEF FPC}
    {$DEFINE HAS_ParentBackground}
  {$ENDIF}
{$ENDIF}

{$IFDEF DELPHI6_UP}
  {$DEFINE HAS_A4}
  {$DEFINE HAS_Z4}
  {$DEFINE HAS_PATH_DELIM}
  {$DEFINE HAS_PPANSICHAR}
  {$DEFINE HAS_UTF8_ENCODE_DECODE}
  {$DEFINE HAS_WS_EX_TRANSPARENT}
  {$DEFINE HAS_OnContextPopup}
  {$DEFINE HAS_THANDLE}
  {$DEFINE HAS_FILE_EXISTS}
  {$DEFINE HAS_DIRECTORY_EXISTS}
  {$DEFINE HAS_SYNCOBJS}
  {$DEFINE HAS_EXCEPTION_MASK}
{$ENDIF}

{$IFDEF MACOS}

{$ELSE}
  {$IFDEF UNIX}

  {$ELSE}
    {$IFNDEF MSWINDOWS}
      {$IFDEF WIN32}
        {$DEFINE MSWINDOWS}
      {$ENDIF}
    {$ENDIF}
  {$ENDIF}
{$ENDIF}

// now FPC not have CPUX64 and CPUX32, but have CPU64 and CPU32
{$IFDEF FPC}
  {$IFDEF CPU64}{$IFNDEF CPUX64}{$DEFINE CPUX64}{$ENDIF}{$ENDIF}
  {$IFDEF CPU32}{$IFNDEF CPUX32}{$DEFINE CPUX32}{$ENDIF}{$ENDIF}
{$ENDIF}

// old versions of delphi not have CPUX32
{$IFDEF WIN32}
  {$IFNDEF CPUX64}
    {$IFNDEF CPUX32}{$DEFINE CPUX32}{$ENDIF}
  {$ENDIF}
{$ENDIF}

{$IFDEF CPUX64}
  {$A8}
{$ELSE}
  {$IFDEF HAS_A4}
    {$A4}
  {$ELSE}
    {$A+}
  {$ENDIF}
{$ENDIF}

{$IFDEF HAS_Z4}{$Z4}{$ELSE}{$Z+}{$ENDIF}

