% Copyright 2006 Konstantin Korikov <lostclus@ua.fm>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
% 
% This Current Maintainer of this work is Konstantin Korikov.
%
% This work consists of all files listed in manifest.txt.
%
m4_ESKDX_INIT
m4_FILE_INIT
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{eskdappsheet}[m4_dnl
m4_FILE_ID([[$Date:: 2010-01-14#$]]) Approving Sheet GOST 2.105]

\RequirePackage{eskdlang}
\RequirePackage{eskdtitle}

\newcount\ESKD@appsheet@doc@cnt
\ESKD@appsheet@doc@cnt = 0

m4_dnl добавляет документ в список документов,
m4_dnl на которые распространяется данный ЛУ
\newcommand{\ESKDapprovingDoc}[1]{%
  \advance \ESKD@appsheet@doc@cnt 1
  \@namedef{ESKD@appsheet@doc@\number\ESKD@appsheet@doc@cnt}{#1}}

m4_dnl слова "Лист утверждения"
\renewcommand{\ESKDtheTitleFieldV}{%
  \ESKDapprovingSheetName}

m4_dnl обозначение - ЛУ
\renewcommand{\ESKDtheTitleFieldVI}{%
  \MakeUppercase{\ESKDtheSignature}}

m4_dnl количество листов ЛУ
\renewcommand{\ESKDtheTitleFieldVII}{}

m4_dnl список документов, на которые распространяется данный ЛУ
\def\ESKDtheTitleFieldVIIIlb{}
\renewcommand{\ESKDtheTitleFieldVIIIlb}{%
  \ESKD@tmpcnta = 1
  \ESKD@tmpcntb = \ESKD@appsheet@doc@cnt
  \advance \ESKD@tmpcntb 1
  \loop
  \ifnum \ESKD@tmpcnta < \ESKD@tmpcntb
    \@nameuse{ESKD@appsheet@doc@\number\ESKD@tmpcnta}\par
    \advance \ESKD@tmpcnta 2
  \repeat}
\def\ESKDtheTitleFieldVIIIrb{}
\renewcommand{\ESKDtheTitleFieldVIIIrb}{%
  \ESKD@tmpcnta = 2
  \ESKD@tmpcntb = \ESKD@appsheet@doc@cnt
  \advance \ESKD@tmpcntb 1
  \loop
  \ifnum \ESKD@tmpcnta < \ESKD@tmpcntb
    \@nameuse{ESKD@appsheet@doc@\number\ESKD@tmpcnta}\par
    \advance \ESKD@tmpcnta 2
  \repeat}
\renewcommand{\ESKDtheTitleFieldVIII}{%
  \ESKD@title@split@field{\ESKDtheTitleFieldVIIIl}{\ESKDtheTitleFieldVIIIr}
  \par
  \ESKD@title@split@field{\ESKDtheTitleFieldVIIIlb}{\ESKDtheTitleFieldVIIIrb}}

m4_dnl графы 14 - 18 по ГОСТ 2.104
\renewcommand{\ESKDtheTitleFieldX}{}

\renewcommand{\ESKDtitleFontX}{\ESKDfontIII}

m4_dnl печатает лист утверждения
\newcommand{\ESKDmakeApprovingSheet}{\maketitle}

m4_dnl vim:ft=tex:sw=2:ai
