% \iffalse meta-comment
% ======================================================================
% scrkernel-version.dtx
% Copyright (c) Markus Kohm, 2002-2022
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, version 1.3c of the license.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX 
% version 2005/12/01 or later and of this work.
%
% This work has the LPPL maintenance status "author-maintained".
%
% The Current Maintainer and author of this work is Markus Kohm.
%
% This work consists of all files listed in MANIFEST.md.
% ======================================================================
%%% From File: $Id: scrkernel-version.dtx 3962 2022-10-12 06:33:06Z kohm $
%
% ATTENTION: In this file parts of the code and documentation are before the
% driver. This must be, because this part of the code is needed by the driver
% in this file and most of the other KOMA-Script dtx-files.
%
% \fi^^A meta-comment
%
% \changes{v2.0e}{1994/07/07}{first release of \cls*{scrartcl},
%   \cls*{scrreprt}, and \cls*{scrbook}}
% \changes{v2.95}{2002/06/25}{first version of this file by splitting of
%   \file{scrclass.dtx}}
% \changes{v3.36}{2022/02/11}{switch over from \cls*{scrdoc} to
%   \cls*{koma-script-source-doc}}
% \changes{v3.36}{2022/02/11}{whole implementation documentation in English}
%
% \GetFileInfo{scrkernel-version.dtx}
% \title{The Version of the \href{https://komascript.de}{\KOMAScript} Kernel
%   and therefore the Classes and most of the Packages}
% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}}
% \date{Version \fileversion{} of \filedate}
% \maketitle
% \begin{abstract}
%   \filename{} is not only used for the code of all \KOMAScript{} classes and
%   most of the \KOMAScript{} packages. It is also used by most of the
%   installation drivers (\file{ins}-files) for the definition of
%   \KOMAScript{} version.
% \end{abstract}
% \tableofcontents
%
%
% \section{User Manual}
%
% You can find the user documentation of the commands implemented here in the
% \KOMAScript{} manual, either the German \file{scrguide} or the English
% \file{scrguien}.
%
% \MaybeStop{\PrintIndex}
%
% \section{Implementation of the \KOMAScript{} Kernel Version Information}
%
% \begin{command}{\KOMAScriptVersion}
% \changes{v2.95}{2002/06/25}{added}
% This is the \KOMAScript{} version the file is related to. It is also added
% to the classes and most of the packages by the installation drivers. This is
% done using \file{scrdocstrip.tex} and additionally loading this file.
% \begin{macro}{\@CheckKOMAScriptVersion}
% \changes{v2.95}{2002/06/25}{added}
% Depending on \cs{KOMAScriptVersion} already defined or not, the existing
% definition is compared with the version here or \cs{KOMAScriptVersion} is
% newly and globally defined. This has to work not only in class or package
% files, but also in document files. So \cs{makeatletter} inside a group is
% needed for the internal macros. Additionally a guard \texttt{ignorethis} is
% used, to avoid adding code, that is needed only for the installation driver,
% also to classes or packages.
%    \begin{macrocode}
\begingroup
  \catcode`\@11\relax
%<*ignorethis>
  \ifx\newcommand\undefined
    \gdef\@CheckKOMAScriptVersion#1{%
      \global\KOMAdefVariable{KOMAScriptVersion}{\space\space#1}%
      \expandafter\ifx\csname ifbeta\endcsname\relax
        \def\@defbeta##1 ##2 ##3KOMA-Script{%
          \def\@cmpstrA{##3}\def\@cmpstrB{BETA }%
          \ifx\@cmpstrA\@cmpstrB
            \expandafter\expandafter\expandafter\global
            \expandafter\expandafter\expandafter\let
            \expandafter\csname ifbeta\expandafter\endcsname
            \csname iftrue\endcsname
          \fi
        }\expandafter\@defbeta\KOMAvar@KOMAScriptVersion
      \fi
      \expandafter\ifx\csname ifbeta\endcsname\relax
        \def\@defbeta##1 ##2.##3.##4 KOMA-Script\@nil{%
          \def\@cmpstrA{##4}\def\@cmpstrB{}%
          \ifx\@cmpstrA\@cmpstrB\else
            \expandafter\expandafter\expandafter\global
            \expandafter\expandafter\expandafter\let
            \expandafter\csname ifbeta\expandafter\endcsname
            \csname iftrue\endcsname
          \fi
        }\expandafter\@defbeta\KOMAvar@KOMAScriptVersion. KOMA-Script\@nil
      \fi
      \expandafter\ifx\csname ifbeta\endcsname\relax
        \expandafter\expandafter\expandafter\global
        \expandafter\expandafter\expandafter\let
        \expandafter\csname ifbeta\expandafter\endcsname
        \csname iffalse\endcsname
      \fi
      \aftergroup\endinput
    }%
  \else
%</ignorethis>
  \ifx\KOMAScriptVersion\undefined
    \newcommand*{\@CheckKOMAScriptVersion}[1]{%
      \gdef\KOMAScriptVersion{#1}%
    }%
  \else
    \newcommand*{\@CheckKOMAScriptVersion}[1]{%
      \def\@tempa{#1}%
      \ifx\KOMAScriptVersion\@tempa\else
        \@latex@warning@no@line{%
          \noexpand\KOMAScriptVersion\space is 
          `\KOMAScriptVersion',\MessageBreak
          but `#1' was expected!\MessageBreak
          You should not use classes, packages or files
          from\MessageBreak
          different KOMA-Script versions%
        }%
      \fi
    }
%<*ignorethis>
  \fi
%</ignorethis>
  \fi
%    \end{macrocode}
% Note: Following line will be patched by \file{makebetaorrelase.sh} and
% therefore the syntax or general structure of the line must not be changed!
%    \begin{macrocode}
  \@CheckKOMAScriptVersion{2022/10/12 v3.38 KOMA-Script}%
\endgroup
%    \end{macrocode}
% \end{macro}
% \end{command}
%
% \iffalse
%<*dtx>
\ProvidesFile{scrkernel-version.dtx}[\KOMAScriptVersion (versions)]
\documentclass[USenglish]{koma-script-source-doc}
\usepackage{babel}
\begin{document}
  \DocInput{scrkernel-version.dtx}
\end{document}
%</dtx>
% \fi
%
% \subsection{Implementation of class and package names and file names}
%
% \begin{description}
% \item[ToDo] Maybe, this should be split in one file for each class. The file
%   extension code should be moved to \file{scrkernel-miscellaneous.dtx}.
% \end{description}
%
% \begin{macro}{\scr@pkgextension}
% \changes{v3.17}{2015/03/17}{added}
% \begin{macro}{\scr@clsextension}
% \changes{v3.17}{2015/03/17}{added}
% \changes{v3.18}{2015/06/17}{fixed}
% Last but not least same like \cs{@pkgextension} and \cs{@clsextension} but
% still valid after the preamble.
%    \begin{macrocode}
%<*class|package>
%<package>\providecommand*{\scr@pkgextension}{\@pkgextension}
%<class>\providecommand*{\scr@clsextension}{\@clsextension}
\AtBeginDocument{%
%<package>  \let\scr@pkgextension\@pkgextension
%<class>  \let\scr@clsextension\@clsextension
}
%</class|package>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{command}{\KOMAClassFileName}
% \changes{v3.17}{2014/03/12}{added}
% \begin{command}{\KOMAClassName}
% \changes{v2.95}{2004/11/04}{added}
% \begin{command}{\KOMALongClassFileName,\KOMALongClassName}
% \changes{v3.27}{2019/02/16}{added}
% \begin{command}{\ClassName}
% \changes{v2.95}{2004/11/04}{added}
% We define the name of each \KOMAScript{} class and the name of the
% \emph{class} of the class (usually name of the corresponding standard class)
% once. This allows to use code, that outputs the name of the class, for
% several classes without using always class specific code.
%    \begin{macrocode}
%<*class>
\newcommand*{\KOMAClassName}{%
%<article|(letter&long)>  scrartcl%
%<report>  scrreprt%
%<book>  scrbook%
%<letter&!long>  scrlttr2%
}
%<*!long>
\newcommand*{\KOMAClassFileName}{\KOMAClassName.\@clsextension}
\edef\KOMAClassFileName{\KOMAClassFileName}
%</!long>
\newcommand*{\ClassName}{%
%<article|(letter&long)>  article%
%<report>  report%
%<book>  book%
%<letter&!long>  letter%
}
%<*long>
\newcommand*{\KOMALongClassName}{}
%<!letter>\edef\KOMALongClassName{scr\ClassName}
%<letter>\def\KOMALongClassName{scrletter}
\newcommand*{\KOMALongClassFileName}{\KOMALongClassName.\@clsextension}
\edef\KOMALongClassFileName{\KOMALongClassFileName}
%</long>
%    \end{macrocode}
% \end{command}
% \end{command}
% \end{command}
% \end{command}
%    \begin{macrocode}
%<!long>\ProvidesClass{\KOMAClassName}[%
%<long>\ProvidesClass{\KOMALongClassName}[%
%!KOMAScriptVersion
  document class (\ClassName)%
]
%<*long>
\let\ClassName\relax
%<letter>\providecommand*{\@ptsize}{12}
\expandafter\let\expandafter\KOMAClassName\expandafter\relax
\expandafter\LoadClassWithOptions\expandafter{\KOMAClassName}
%<letter>\RequirePackage{scrletter}
%</long>
%</class>
%    \end{macrocode}
%
%    \begin{macrocode}
%<*package&letter>
\ProvidesPackage{scrletter}[%
%!KOMAScriptVersion
  letter package extending any KOMA-Script class%
]
%</package&letter>
%    \end{macrocode}
%
% \Finale
% \PrintChanges
%
\endinput
% Local Variables:
% mode: doctex
% ispell-local-dictionary: "en_US"
% eval: (flyspell-mode 1)
% TeX-master: t
% TeX-engine: luatex-dev
% eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx"))
% End:
