{
  Copyright 1998-2026 PasDoc developers.

  This file is part of "PasDoc".

  "PasDoc" is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  "PasDoc" is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with "PasDoc"; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

  ----------------------------------------------------------------------------
}

{ Delphi version detection.

  TODO: We'd like to remove this include file at some point and just use
  CompilerVersion, like "$if CompilerVersion >= 32", checks throughout
  the codebase.
  For this reason, don't bother extending this file for newer Delphi versions.
}

{$IFNDEF FPC} // not FPC => Delphi

  {$DEFINE VERSION_UNKNOWN}

  {$IFDEF VER80}
    {$UNDEF VERSION_UNKNOWN}
    {$DEFINE DELPHI_1}
    {$DEFINE DELPHI_1_UP}

    {$DEFINE COMPILER_1}
    {$DEFINE COMPILER_1_UP}
  {$ENDIF}

  {$IFDEF VER90}
    {$UNDEF VERSION_UNKNOWN}
    {$DEFINE DELPHI_2}
    {$DEFINE DELPHI_2_UP}
    {$DEFINE DELPHI_1_UP}

    {$DEFINE COMPILER_2}
    {$DEFINE COMPILER_2_UP}
    {$DEFINE COMPILER_1_UP}
  {$ENDIF}

  {$IFDEF VER100}
    {$UNDEF VERSION_UNKNOWN}
    {$DEFINE DELPHI_3}
    {$DEFINE DELPHI_3_UP}
    {$DEFINE DELPHI_2_UP}
    {$DEFINE DELPHI_1_UP}

    {$DEFINE COMPILER_3}
    {$DEFINE COMPILER_3_UP}
    {$DEFINE COMPILER_2_UP}
    {$DEFINE COMPILER_1_UP}
  {$ENDIF}

  {$IFDEF VER120}
    {$UNDEF VERSION_UNKNOWN}
    {$DEFINE DELPHI_4}
    {$DEFINE DELPHI_4_UP}
    {$DEFINE DELPHI_3_UP}
    {$DEFINE DELPHI_2_UP}
    {$DEFINE DELPHI_1_UP}

    {$DEFINE COMPILER_4}
    {$DEFINE COMPILER_4_UP}
    {$DEFINE COMPILER_3_UP}
    {$DEFINE COMPILER_2_UP}
    {$DEFINE COMPILER_1_UP}
  {$ENDIF}

  {$IFDEF VER130}
    {$UNDEF VERSION_UNKNOWN}
    {$DEFINE DELPHI_5}
    {$DEFINE DELPHI_5_UP}
    {$DEFINE DELPHI_4_UP}
    {$DEFINE DELPHI_3_UP}
    {$DEFINE DELPHI_2_UP}
    {$DEFINE DELPHI_1_UP}

    {$DEFINE COMPILER_5}
    {$DEFINE COMPILER_5_UP}
    {$DEFINE COMPILER_4_UP}
    {$DEFINE COMPILER_3_UP}
    {$DEFINE COMPILER_2_UP}
    {$DEFINE COMPILER_1_UP}
  {$ENDIF}

  {$IFDEF VER140}
    {$UNDEF VERSION_UNKNOWN}
    {$DEFINE DELPHI_6}
    {$DEFINE DELPHI_6_UP}
    {$DEFINE DELPHI_5_UP}
    {$DEFINE DELPHI_4_UP}
    {$DEFINE DELPHI_3_UP}
    {$DEFINE DELPHI_2_UP}
    {$DEFINE DELPHI_1_UP}

    {$DEFINE COMPILER_6}
    {$DEFINE COMPILER_6_UP}
    {$DEFINE COMPILER_5_UP}
    {$DEFINE COMPILER_4_UP}
    {$DEFINE COMPILER_3_UP}
    {$DEFINE COMPILER_2_UP}
    {$DEFINE COMPILER_1_UP}
  {$ENDIF}

  {$IFDEF VER150}
    {$UNDEF VERSION_UNKNOWN}
    {$DEFINE DELPHI_7}
    {$DEFINE DELPHI_7_UP}
    {$DEFINE DELPHI_6_UP}
    {$DEFINE DELPHI_5_UP}
    {$DEFINE DELPHI_4_UP}
    {$DEFINE DELPHI_3_UP}
    {$DEFINE DELPHI_2_UP}
    {$DEFINE DELPHI_1_UP}

    {$DEFINE COMPILER_7}
    {$DEFINE COMPILER_7_UP}
    {$DEFINE COMPILER_6_UP}
    {$DEFINE COMPILER_5_UP}
    {$DEFINE COMPILER_4_UP}
    {$DEFINE COMPILER_3_UP}
    {$DEFINE COMPILER_2_UP}
    {$DEFINE COMPILER_1_UP}
  {$ENDIF}

  // VER160 was Delphi 8 .NET only, unsupported.

  {$IFDEF VER170}
    {$UNDEF VERSION_UNKNOWN}
    {$DEFINE DELPHI_9}
    {$DEFINE DELPHI_9_UP}
    {$DEFINE DELPHI_7_UP}
    {$DEFINE DELPHI_6_UP}
    {$DEFINE DELPHI_5_UP}
    {$DEFINE DELPHI_4_UP}
    {$DEFINE DELPHI_3_UP}
    {$DEFINE DELPHI_2_UP}
    {$DEFINE DELPHI_1_UP}

    {$DEFINE COMPILER_9}
    {$DEFINE COMPILER_9_UP}
    {$DEFINE COMPILER_7_UP}
    {$DEFINE COMPILER_6_UP}
    {$DEFINE COMPILER_5_UP}
    {$DEFINE COMPILER_4_UP}
    {$DEFINE COMPILER_3_UP}
    {$DEFINE COMPILER_2_UP}
    {$DEFINE COMPILER_1_UP}
  {$ENDIF}

  {$IFDEF VER180} { Delphi 2006 and 2007 }
    {$UNDEF VERSION_UNKNOWN}
    {$IFDEF VER185} { Delphi 2007 }
      {$DEFINE DELPHI_11}
      {$DEFINE COMPILER_11}
      {$DEFINE DELPHI_11_UP}
      {$DEFINE COMPILER_11_UP}
    {$ELSE}
      {$DEFINE DELPHI_10}
      {$DEFINE COMPILER_10}
    {$ENDIF}

    {$DEFINE DELPHI_10_UP}
    {$DEFINE DELPHI_9_UP}
    {$DEFINE DELPHI_7_UP}
    {$DEFINE DELPHI_6_UP}
    {$DEFINE DELPHI_5_UP}
    {$DEFINE DELPHI_4_UP}
    {$DEFINE DELPHI_3_UP}
    {$DEFINE DELPHI_2_UP}
    {$DEFINE DELPHI_1_UP}

    {$DEFINE COMPILER_10_UP}
    {$DEFINE COMPILER_9_UP}
    {$DEFINE COMPILER_7_UP}
    {$DEFINE COMPILER_6_UP}
    {$DEFINE COMPILER_5_UP}
    {$DEFINE COMPILER_4_UP}
    {$DEFINE COMPILER_3_UP}
    {$DEFINE COMPILER_2_UP}
    {$DEFINE COMPILER_1_UP}
  {$ENDIF}

  // VER190 is Delphi 2007 for .NET, unsupported

  {$IFDEF VER200} { Delphi 2009 }
    {$UNDEF VERSION_UNKNOWN}
    {$DEFINE DELPHI_12}
    {$DEFINE DELPHI_12_UP}
    {$DEFINE DELPHI_11_UP}
    {$DEFINE DELPHI_10_UP}
    {$DEFINE DELPHI_9_UP}
    {$DEFINE DELPHI_7_UP}
    {$DEFINE DELPHI_6_UP}
    {$DEFINE DELPHI_5_UP}
    {$DEFINE DELPHI_4_UP}
    {$DEFINE DELPHI_3_UP}
    {$DEFINE DELPHI_2_UP}
    {$DEFINE DELPHI_1_UP}

    {$DEFINE COMPILER_12}
    {$DEFINE COMPILER_12_UP}
    {$DEFINE COMPILER_11_UP}
    {$DEFINE COMPILER_10_UP}
    {$DEFINE COMPILER_9_UP}
    {$DEFINE COMPILER_7_UP}
    {$DEFINE COMPILER_6_UP}
    {$DEFINE COMPILER_5_UP}
    {$DEFINE COMPILER_4_UP}
    {$DEFINE COMPILER_3_UP}
    {$DEFINE COMPILER_2_UP}
    {$DEFINE COMPILER_1_UP}
  {$ENDIF}

  // Number 13 was skipped.

  {$IFDEF VER210} { Delphi 2010 }
    {$UNDEF VERSION_UNKNOWN}
    {$DEFINE DELPHI_14}
    {$DEFINE DELPHI_14_UP}
    {$DEFINE DELPHI_12_UP}
    {$DEFINE DELPHI_11_UP}
    {$DEFINE DELPHI_10_UP}
    {$DEFINE DELPHI_9_UP}
    {$DEFINE DELPHI_7_UP}
    {$DEFINE DELPHI_6_UP}
    {$DEFINE DELPHI_5_UP}
    {$DEFINE DELPHI_4_UP}
    {$DEFINE DELPHI_3_UP}
    {$DEFINE DELPHI_2_UP}
    {$DEFINE DELPHI_1_UP}

    {$DEFINE COMPILER_14}
    {$DEFINE COMPILER_14_UP}
    {$DEFINE COMPILER_12_UP}
    {$DEFINE COMPILER_11_UP}
    {$DEFINE COMPILER_10_UP}
    {$DEFINE COMPILER_9_UP}
    {$DEFINE COMPILER_7_UP}
    {$DEFINE COMPILER_6_UP}
    {$DEFINE COMPILER_5_UP}
    {$DEFINE COMPILER_4_UP}
    {$DEFINE COMPILER_3_UP}
    {$DEFINE COMPILER_2_UP}
    {$DEFINE COMPILER_1_UP}
  {$ENDIF}

  {$IFDEF VER220} { Delphi XE }
    {$UNDEF VERSION_UNKNOWN}
    {$DEFINE DELPHI_15}
    {$DEFINE DELPHI_15_UP}
    {$DEFINE DELPHI_14_UP}
    {$DEFINE DELPHI_12_UP}
    {$DEFINE DELPHI_11_UP}
    {$DEFINE DELPHI_10_UP}
    {$DEFINE DELPHI_9_UP}
    {$DEFINE DELPHI_7_UP}
    {$DEFINE DELPHI_6_UP}
    {$DEFINE DELPHI_5_UP}
    {$DEFINE DELPHI_4_UP}
    {$DEFINE DELPHI_3_UP}
    {$DEFINE DELPHI_2_UP}
    {$DEFINE DELPHI_1_UP}

    {$DEFINE COMPILER_15}
    {$DEFINE COMPILER_15_UP}
    {$DEFINE COMPILER_14_UP}
    {$DEFINE COMPILER_12_UP}
    {$DEFINE COMPILER_11_UP}
    {$DEFINE COMPILER_10_UP}
    {$DEFINE COMPILER_9_UP}
    {$DEFINE COMPILER_7_UP}
    {$DEFINE COMPILER_6_UP}
    {$DEFINE COMPILER_5_UP}
    {$DEFINE COMPILER_4_UP}
    {$DEFINE COMPILER_3_UP}
    {$DEFINE COMPILER_2_UP}
    {$DEFINE COMPILER_1_UP}
  {$ENDIF}

  {$IFDEF VERSION_UNKNOWN}
    // Assume this pasdoc version builds with newer compilers as well.
    {$UNDEF VERSION_UNKNOWN}
    {$DEFINE DELPHI_15}
    {$DEFINE DELPHI_15_UP}
    {$DEFINE DELPHI_14_UP}
    {$DEFINE DELPHI_12_UP}
    {$DEFINE DELPHI_11_UP}
    {$DEFINE DELPHI_10_UP}
    {$DEFINE DELPHI_9_UP}
    {$DEFINE DELPHI_7_UP}
    {$DEFINE DELPHI_6_UP}
    {$DEFINE DELPHI_5_UP}
    {$DEFINE DELPHI_4_UP}
    {$DEFINE DELPHI_3_UP}
    {$DEFINE DELPHI_2_UP}
    {$DEFINE DELPHI_1_UP}

    {$DEFINE COMPILER_15}
    {$DEFINE COMPILER_15_UP}
    {$DEFINE COMPILER_14_UP}
    {$DEFINE COMPILER_12_UP}
    {$DEFINE COMPILER_11_UP}
    {$DEFINE COMPILER_10_UP}
    {$DEFINE COMPILER_9_UP}
    {$DEFINE COMPILER_7_UP}
    {$DEFINE COMPILER_6_UP}
    {$DEFINE COMPILER_5_UP}
    {$DEFINE COMPILER_4_UP}
    {$DEFINE COMPILER_3_UP}
    {$DEFINE COMPILER_2_UP}
    {$DEFINE COMPILER_1_UP}
  {$ENDIF}

{$ENDIF} // not FPC (so Delphi)

