%%
%% This is file `interfaces-makecell.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% interfaces.dtx  (with options: `makecell')
%% 
%% This is a generated file.
%% 
%% interfaces : 2011/02/19 v3.1 - interfaces : interfaces with keys for other packages (FC)
%% 
%% 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
%% 
%% This work consists of the main source file interfaces.dtx
%% and the derived files
%%     interfaces.sty, interfaces.pdf, interfaces.ins,
%%     interfaces-base.sty,
%%     interfaces-LaTeX.sty,
%%     interfaces-tikz.sty,
%%     interfaces-titlesec.sty,
%%     interfaces-hyperref.sty,
%%     interfaces-bookmark.sty,
%%     interfaces-hypbmsec.sty,
%%     interfaces-fancyhdr.sty,
%%     interfaces-marks.sty,
%%     interfaces-tocloft.sty,
%%     interfaces-makecell.sty,
%%     interfaces-enumitem.sty,
%%     interfaces-truncate.sty,
%%     interfaces-appendix.sty,
%%     interfaces-embedfile.sty,
%%     interfaces-environ.sty,
%%     interfaces-umrand.sty,
%%     interfaces-scrlfile.sty,
%%     interfaces-pgfkeys.sty,
%%     interfaces-etoolbox.sty
%% 
%% interfaces: interfaces with keys for other packages (FC)
%% Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%% 
\ProvidesPackage{interfaces-makecell}
   [2011/02/19 v3.1 repeatcell to fill in tabulars (FC)]
\RequirePackage{interfaces-base}
\itf@Check@Package{makecell}
\edef\itf@AtEnd{\catcode126 \the\catcode126}% 126 = ~
\AtEndOfPackage{\itf@AtEnd}
\catcode126 \active % 126 = ~
\def\countvalues#1{\number\numexpr
   \expandafter\itf@countvalues\expandafter0#1,\countvalues\@nnil
}% \countvalues
\def\itf@countvalues#1#2,#3{%
   \ifx\countvalues#3%
      +#1\expandafter\remove@to@nnil
   \else
      +1\expandafter\itf@countvalues
   \fi1#3%
}% \itf@countvalues
\def\itf@getvalue #1{\romannumeral -`\q
   \expandafter\itf@getv@lue \expandafter0#1,\itf@getvalue}
\def\itf@getv@lue#1#2\itf@getvalue #3{\itf@getv@lu@{#1}{#3-1}#2\itf@getvalue\@nnil}
\def\itf@getv@lu@#1#2#3,#4{%
   \ifnum \numexpr#1=\numexpr#2\relax
       #3\expandafter\remove@to@nnil
   \else\ifx\itf@getvalue#4\@empty
         \expandafter\expandafter
         \expandafter\remove@to@nnil
   \else \expandafter\expandafter
         \expandafter\itf@getv@lu@
   \fi\fi{#1+1}{#2}#4%
}% \itf@getv@lu@
\newif\ifitf@celltranspose
\newrobustcmd*\repeatcell{\begingroup \iffalse{\fi \ifnum0=`}\fi \itf@repeatcell}
\newrobustcmd*\itf@repeatcell[3][]{%
   \ifblank{#1}% alignment option ?
      {\let\itf@makecell\@firstofone}
      {\def\itf@makecell##1{\noexpand\makecell[{#1}]{##1}}}%
   \countdef\itf@col=100% local
   \countdef\itf@row=101% local
   \countdef\itf@cnt=102% local
   \toksdef\itf@cell=1% local
   \itf@pgfkeys
   \pgfqkeys{/itf/makecell/repeatcell}{@reset={#2},#3}%
   \toks@{\ifnum0=`{}\fi \endgroup}% local
   \ifnum\itf@row>\z@ % number
      \edef\itf@rowloop{\noexpand\@whilenum\itf@row<\the\itf@row}%
      \def\itf@cell@init{\def\r{\row}\let\R\@empty}%
   \else % list
      \def\itf@rowloop{\@for\r:=\itf@rows}%
      \expandafter\def\expandafter\itf@cell@init\expandafter{%
         \expandafter\def\expandafter\R\expandafter{%
            \expandafter\itf@getvalue\expandafter{\expandafter\@empty\itf@rows}}}%
   \fi
   \ifnum\itf@col>\z@ % number
      \edef\itf@colloop{\noexpand\@whilenum\itf@col<\the\itf@col}%
      \expandafter\def\expandafter\itf@cell@init\expandafter{%
         \itf@cell@init\def\c{\column}\let\C\@empty}%
   \else % list
      \def\itf@colloop{\@for\c:=\itf@cols}%
      \expandafter\expandafter\expandafter\def
         \expandafter\expandafter\expandafter\itf@cell@init
            \expandafter\expandafter\expandafter{%
               \expandafter\itf@cell@init
               \expandafter\def\expandafter\C\expandafter{%
                     \expandafter\itf@getvalue\expandafter{\expandafter\@empty\itf@cols}}}%
   \fi
   \itf@cell@init % in case they are used in formulas
   \ifitf@celltranspose
      \itf@col\z@
      \itf@colloop\do{%
         \ifnum\itf@col>\z@
         \pgfkeysifdefined{/itf/makecell/repeatcell/cr/row\the\itf@col}%
            {\pgfkeysgetvalue{/itf/makecell/repeatcell/cr/row\the\itf@col}\itf@thecr}
            {\pgfkeysgetvalue{/itf/makecell/repeatcell/cr}\itf@thecr}%
         \toks@\expandafter{\the\expandafter\toks@ \itf@thecr}%
         \fi
         \advance\itf@col\@ne
         \itf@row\z@
         \itf@rowloop\do{%
            \advance\itf@row\@ne
            \ifnum\itf@row>\@ne
               \toks@\expandafter{\the\toks@&}%
            \fi
            \toks@\expandafter{\the\expandafter\toks@ \itf@cell@init}%
            \itf@cell@insert}% rows loop
      }% cols loop
   \else
   \itf@row\z@
   \itf@rowloop\do{%
      \ifnum\itf@row>\z@
         \pgfkeysifdefined{/itf/makecell/repeatcell/cr/row\the\itf@row}%
            {\pgfkeysgetvalue{/itf/makecell/repeatcell/cr/row\the\itf@row}\itf@thecr}
            {\pgfkeysgetvalue{/itf/makecell/repeatcell/cr}\itf@thecr}%
         \toks@\expandafter{\the\expandafter\toks@ \itf@thecr}%
      \fi
      \advance\itf@row\@ne
      \itf@col\z@
      \itf@colloop\do{%
         \advance\itf@col\@ne
         \ifnum\itf@col>\@ne
            \toks@\expandafter{\the\toks@&}%
         \fi
         \toks@\expandafter{\the\expandafter\toks@ \itf@cell@init}%
         \itf@cell@insert}% cols loop
      }% rows loop
   \fi
   \itf@message{Code introduced by repeatcell in the \@currenvir:^^J
                \the\toks@}% (to see the code...)
   \the\toks@ \ignorespaces
}% \itf@repeatcell
\let\itf@message \@gobble
\def\itf@cell@rowcolkey{%
   \removefromstart\pgfkeyscurrentname{row}%
   \ifin@\else
      \removefromstart\pgfkeyscurrentname{col}%
   \fi
   \ifin@
      \itf@number\itf@cnt\pgfkeyscurrentname\relax\@nnil
         {\pgfkeyslet\pgfkeyscurrentkey\pgfkeyscurrentvalue}
         \in@false
   \fi
   \ifin@\else
      \pgfkeysvalueof{/errors/unknown key/.@cmd}\pgfkeyscurrentkey
                                                \pgfkeyscurrentvalue
                                                \pgfeov
   \fi
}% \itf@cell@rowcolkey
\pgfqkeys{/itf/makecell/repeatcell}{%
   font/.store in=\itf@cellfont,%
   font/.unknown/.code=\itf@cell@rowcolkey,%
   text/.store in=\itf@celltext,%
      text/.default=\ifdefined\C\C\column\fi,%
   text/.unknown/.code=\itf@cell@rowcolkey,%
   cr/.initial=\\,%
      cr/.default=\crcr,cr/.blank=\\,%
      end/.alias=cr,%
   cr/.unknown/.code=\itf@cell@rowcolkey,%
   rows/.code=\itf@number\itf@row#1\relax\@nnil
                  {\ifnum\itf@row<\z@\itf@row\@ne\fi}
                  {\itf@row\z@
                  \def\itf@rows{#1}\itf@expandonceifcs\itf@rows},%
      rows/.default=1,rows/.blank=1,%
   @cols/.is private=interfaces-makecell,%
   column/.is private=interfaces-makecell,%
   row/.is private=interfaces-makecell,%
   transpose/.is if=itf@celltranspose,%
   .unknown/.code=%
      \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text \itf@cell@formulaerror{}\z@ \fi
      \ifx\pgfkeyscurrentvalue\@empty \itf@cell@formulaerror{}\@ne \fi
      \pgfkeysifdefined{\pgfkeyscurrentkey/@calc}%
            {\itf@cell@formulaerror{}\tw@}
            {\pgfkeyslet{\pgfkeyscurrentkey/@calc}\relax}%
      \itf@cell@getformula{#1}%
      \pgfkeysEaddvalue{/itf/makecell/repeatcell/@calc}{}
         {\the\toks@\expandafter\noexpand\csname\pgfkeyscurrentname\endcsname}%
      \expandafter\let\csname\pgfkeyscurrentname\endcsname\@undefined,%
   @reset/.code=% #1 are the columns
      \itf@celltransposefalse
      \let\itf@celltext\@empty
      \let\itf@cellfont\@empty
      \pgfkeyssetvalue{/itf/makecell/repeatcell/cr}{\\}%
      \itf@row\@ne
      \pgfkeyssetvalue{/itf/makecell/repeatcell/@calc}{%
         \itf@cell@numcalc\itf@col\column
         \itf@cell@numcalc\itf@row\row}%
      \itf@number\itf@col#1\relax\@nnil
         {\ifnum\itf@col<\z@\itf@col\@ne\fi}
         {\itf@col\z@
         \def\itf@cols{#1}\itf@expandonceifcs\itf@cols},%
}% keys for \repeatcell
\def\itf@cell@getformula#1{%
   \itf@cell@getf@rmula #1$$$\itf@cell@getformula$\relax\@nnil
   \expandafter\ifx\expandafter\toks@\the\toks@
      \itf@cell@formulaerror{#1}\thr@@
   \fi
}% \itf@cell@getformula
\def\itf@cell@getf@rmula #1$#2$#3$#4#5$#6{%
   \toks@{\toks@}%
   \ifx\itf@cell@getformula #4%
      \toks@{\itf@cell@numcalc{#1}}%
   \else\ifx $#4%
      \ifx\itf@cell@getformula #6%
         \ifdefined\pgfmathparse\else\itf@cell@formulaerror{#2}4\fi
         \toks@{\itf@cell@pgfcalc{#2}}%
      \else\ifx $#6%
         \ifdefined\FPeval\else\itf@cell@formulaerror{#3}5\fi
         \toks@{\itf@cell@FPcalc{#3}}%
      \fi\fi
   \fi\fi\remove@to@nnil
}% \itf@cell@getf@rmula
\def\itf@cell@formulaerror#1#2{%
   \def\itf@tp{#1}\@onelevel@sanitize\itf@tp
   \ifcase#2% 0
   \PackageError{interfaces-makecell}
      {Missing formula for key \pgfkeyscurrentname!}\@ehd
   \or %1
   \PackageError{interfaces-makecell}
      {Computed key \pgfkeyscurrentname\space wes left blank!}\@ehd
   \or %2
   \PackageError{interfaces-makecell}
      {Duplicate definition for computed key \pgfkeyscurrentname
      \MessageBreak\string\repeatcell\space will redefine the key}\@eha
   \or %3
   \PackageError{interfaces-makecell}
      {Incorrect formula in \string\repeatcell
      \MessageBreak Check: \itf@tp
      \MessageBreak Take care of commas and equal signs...}\@ehd
   \or %4
   \PackageError{interfaces-makecell}
      {Formula: \itf@tp
      \MessageBreak requires \string\pgfmathparse:\space\string\usetikz{pgfmath}}\@ehd
   \or %5
   \PackageError{interfaces-makecell}
      {Formula: \itf@tp
      \MessageBreak requires \string\FPeval:\space\string\usepackage{fp}}\@ehd
   \else
   \PackageError{interfaces-makecell}
      {Impossible value!}\@ehd
   \fi
}% \itf@cell@formulaerror
\protected\def\itf@cell@calc#1#2{%
   \edef#1{\def\noexpand#1{#2}}%
   \toks@\expandafter{\the\expandafter\toks@ #1}%
   #1%
}% \itf@cell@calc
\protected\def\itf@cell@numcalc#1#2{%
   \itf@cell@calc#2{\number\numexpr#1}%
}% \itf@cell@numcalc
\protected\def\itf@cell@pgfcalc#1#2{%
   \pgfmathparse{#1}%
   \itf@cell@calc#2\pgfmathresult
}% \itf@cell@pgfcalc
\protected\def\itf@cell@FPcalc#1#2{%
   \begingroup
   \hfuzz\maxdimen \vfuzz\hfuzz \hbadness\@M \vbadness\hbadness
   \everypar{}\tracinglostchars\z@
   \setbox\z@\vbox{%\FPeval introduces some weird code, hence the calculation in a \vbox
      \FPeval\FPresult{#1}%
   \expandafter}\expandafter\endgroup
   \expandafter\itf@cell@calc\expandafter#2\expandafter{\FPresult}%
}% \itf@cell@FPcalc
\def\itf@cell@getifdefined#1#2{%
   \pgfkeysifdefined{/itf/makecell/repeatcell/#1}
      {\pgfkeysgetvalue{/itf/makecell/repeatcell/#1}#2}
      {\let#2\@empty}%
}%
\def\itf@cell@insert{%
   \pgfkeysvalueof{/itf/makecell/repeatcell/@calc}%
   \ifx\R\@empty\else
      \toks@\expandafter{\the\expandafter\toks@
         \expandafter\def\expandafter\r\expandafter{\r}}%
   \fi
   \ifx\C\@empty\else
      \toks@\expandafter{\the\expandafter\toks@
         \expandafter\def\expandafter\c\expandafter{\c}}%
   \fi
   \itf@cell@getifdefined{font/row\the\itf@row}\itf@cellfontrow
   \itf@cell@getifdefined{font/col\the\itf@col}\itf@cellfontcol
   \itf@cell@getifdefined{text/row\the\itf@row}\itf@cellrow
   \itf@cell@getifdefined{text/col\the\itf@col}\itf@cellcol
   \toks@\expandafter{\the\expandafter\toks@ \itf@cellfont}%
   \ifx\itf@cellrow\@empty
      \ifx\itf@cellcol\@empty
         \itf@cell\expandafter\expandafter\expandafter{%
            \expandafter\itf@cellfontcol \itf@cellfontrow}%
         \let\itf@tp\itf@celltext
      \else
         \itf@cell\expandafter{\itf@cellfontcol}%
         \let\itf@tp\itf@cellcol
      \fi
   \else
      \ifx\itf@cellcol\@empty
         \itf@cell\expandafter{\itf@cellfontrow}%
         \let\itf@tp\itf@cellrow
      \else
         \itf@cell{}%
         \ifitf@celltranspose
         \edef\itf@tp{\noexpand\itf@diaghead(-2,1)%
            {\expandonce\itf@cellfontrow\expandonce\itf@cellrow}
            {\expandonce\itf@cellfontcol\expandonce\itf@cellcol}}%
         \else
         \edef\itf@tp{\noexpand\itf@diaghead(-2,1)%
            {\expandonce\itf@cellfontcol\expandonce\itf@cellcol}
            {\expandonce\itf@cellfontrow\expandonce\itf@cellrow}}%
         \fi
      \fi
   \fi
   \itf@cell\expandafter{\the\expandafter\itf@cell \itf@tp}%
   \edef\itf@tp{\itf@makecell{\the\itf@cell}}%
   \toks@\expandafter{\the\expandafter\toks@ \itf@tp}%
}% \itf@cell@insert
\def\itf@diaghead(#1)#2#3{%
   \begingroup
   \edef\itf@tp{\endgroup
   \noexpand\diaghead({#1}){\unexpanded{#2 #3}}%
                  {\unexpanded{#2}}
                  {\unexpanded{#3}}%
   }\itf@tp
}% \itf@diaghead
\AfterPackage*{colortbl}{%
\def\CT@cellc#1[#2]#3{%  #1 is either \@firstofone or \@gobble, [#2]#3 = color spec
   \xdef\CT@cell@color{\noexpand\CT@color#1{[{#2}]}{#3}%
   \global\let\noexpand\CT@cell@color\relax}%
}}
\endinput
%%
%% End of file `interfaces-makecell.sty'.
