summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty')
-rw-r--r--Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty729
1 files changed, 352 insertions, 377 deletions
diff --git a/Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty b/Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty
index 661eb251946..4fd9e3137de 100644
--- a/Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty
+++ b/Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty
@@ -1,48 +1,32 @@
-% ____________________________________________________________________________
-% | |
-% | |
-% | spreadtab v0.4c |
-% | |
-% | 6 november 2014 |
-% | |
-% |___________________________________________________________________________|
+% Ce fichier contient le code de l'extension "spreadtab"
%
-% This is spreadtab.sty, the code of the spreadtab package.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+\def\STname {spreadtab} %
+\def\STver {0.4d} %
+% %
+\def\STdate {2018/01/01} %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% Copyright Christian Tellechea 2009-2014
-% email : unbonpetit@openmailbox.org
-%
-% The "spreadtab" package consists of the 6 following files:
-% spreadtab.sty (this file)
-% README
-% spreadtab_doc_fr.tex, spreadtab_doc_fr.pdf (manual in french)
-% spreadtab_doc_en.tex, spreadtab_doc_en.pdf (manual in english)
-%
-% -------------------------------------------------------------------
-% 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
-% 2005/12/01 or later.
-% -------------------------------------------------------------------
-% This work has the LPPL maintenance status `maintained'.
-%
-% The Current Maintainer of this work is Christian Tellechea
-% -------------------------------------------------------------------
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%% D\'efinitions pr\'ealables %%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand\ST@ver {0.4c}
-\newcommand\ST@date {2014/11/03}
-\newcommand\ST@fr@date {6 novembre 2014}
-\newcommand\ST@eng@date{6 november 2014}
-
-\ProvidesPackage{spreadtab}[\ST@date\space v\ST@ver\space Spreadsheet features for table environments]
+% --------------------------------------------------------------------
+% Author : Christian Tellechea
+% Status : Maintained
+% Email : unbonpetit@netc.fr
+% Package URL: https://www.ctan.org/pkg/spreadtab
+% Bug tracker: https://framagit.org/unbonpetit/spreadtab/issues
+% Repository : https://framagit.org/unbonpetit/spreadtab/tree/master
+% Copyright : Christian Tellechea 2009-2018
+% Licence : Released under the LaTeX Project Public License v1.3c
+% or later, see http://www.latex-project.org/lppl.txt
+% Files : 1) spreadtab.sty
+% 2) spreadtab-fr.tex
+% 3) spreadtab-fr.pdf
+% 4) spreadtab-en.tex
+% 5) spreadtab-en.pdf
+% 6) README
+% --------------------------------------------------------------------
+\ProvidesPackage{spreadtab}[\STdate\space v\STver\space Spreadsheet features for table environments (CT)]
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{fp}% pour les calculs scientifiques
\RequirePackage{xstring}[2013/07/29]% version n\'ecessaire
@@ -60,113 +44,106 @@
\AtBeginDocument{\@ifpackageloaded{colortbl}\ST@colortblloadedtrue\ST@colortblloadedfalse}
% D\'efinit le marqueur qui signale le commencement du champ num\'erique
-\newcommand*\STnumericfieldmarker{:=}
+\def\STnumericfieldmarker{:=}
% D\'efinit la macro qui va afficher les valeurs num\'eriques dans le tableau
-\newcommand\STprintnum[1]{#1}
+\def\STprintnum#1{#1}
% D\'efinit les caract\`eres entre lesquels doivent entre envelopp\'ees les r\'ef\'erences des cellules
% que l'on veut afficher dans les champs textuels
-\newcommand*\STsetdisplaymarks[2]{%
- \def\ST@startdisplay{#1}\def\ST@enddisplay{#2}%
-}
+\def\STsetdisplaymarks#1#2{\def\ST@startdisplay{#1}\def\ST@enddisplay{#2}}
\STsetdisplaymarks{<<}{>>}% d\'elimiteurs par d\'efaut
% d\'efinit le marqueur qui signale une cellule de texte
-\makeatother\newcommand*\STtextcell{@}\makeatletter
+\edef\STtextcell{\string @}
% Commande qui permet \'a l'utilisateur de d\'efinir le caract\`ere qui conserve une r\'ef\'erence lors de la copie d'une formule
-\AtBeginDocument{\newcommand*\STtransposecar{!}}
+\AtBeginDocument{\def\STtransposecar{!}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Messages d'erreur %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newif\ifST@message
-\def\ST@package@name{spreadtab}
-
-\newcommand*\STmessage[1]{% #1 = true ou false pour autoriser ou pas les messages
- \csname ST@message#1\endcsname
-}
+\def\STmessage#1{\csname ST@message#1\endcsname}
-\newcommand*\ST@emit@message[1]{\ifST@message\message{#1}\fi}
+\def\ST@emit@message#1{\ifST@message\message{#1}\fi}
-\newcommand*\ST@seedoc@i{Please, read the manual.}
+\def\ST@seedoc@i{Please, read the manual.}
-\newcommand*\ST@circular@reference{%
+\def\ST@circular@reference{%
\ST@coord@toref\ST@coord
\let\ST@deptree\@empty
\ST@show@dependance@tree
- \PackageError\ST@package@name{circular reference found in cell \ST@coord!^^J
- Here is its dependant cells: \ST@deptree}\ST@seedoc@i\stop
+ \PackageError\STname{circular reference found in cell \ST@coord!^^J
+ Here is its dependant cells: \ST@deptree}\ST@seedoc@i
}
-\newcommand*\ST@undefined@cell{%
+\def\ST@undefined@cell{%
\ST@coord@toref\ST@temp@callcell
\ST@coord@toref\ST@coord
- \PackageError\ST@package@name{Undefined reference!^^J
- Cell \ST@temp@callcell\space contains a reference to an undefined cell: \ST@coord}\ST@seedoc@i\stop
+ \PackageError\STname{Undefined reference!^^J
+ Cell \ST@temp@callcell\space contains a reference to an undefined cell: \ST@coord}\ST@seedoc@i
}
-\newcommand*\ST@zerocodecell@cell{%
+\def\ST@zerocodecell@cell{%
\ST@coord@toref\ST@temp@callcell
\ST@coord@toref\ST@coord
- \PackageError\ST@package@name{A reference to a non-numeric or empty cell is not allowed!^^J
- Cell \ST@temp@callcell\space contains a reference to an empty or text cell: \ST@coord}\ST@seedoc@i\stop
+ \PackageError\STname{A reference to a non-numeric or empty cell is not allowed!^^J
+ Cell \ST@temp@callcell\space contains a reference to an empty or text cell: \ST@coord}\ST@seedoc@i
}
-\newcommand*\ST@multicol@cell{%
+\def\ST@multicol@cell{%
\ST@coord@toref\ST@temp@callcell
\ST@coord@toref\ST@coord
- \PackageError\ST@package@name{Cell \ST@temp@callcell\space contains a reference to a merged \string\multicolumn\space cell: \ST@coord}\ST@seedoc@i
+ \PackageError\STname{Cell \ST@temp@callcell\space contains a reference to a merged
+ \string\multicolumn\space cell: \ST@coord}\ST@seedoc@i
}
-\newcommand*\ST@illegal@relativeref{%
+\def\ST@illegal@relativeref{%
\edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
\ST@coord@toref\ST@temp@callcell
- \PackageError\ST@package@name{Illegal relative reference found in cell \ST@temp@callcell!}\ST@seedoc@i\stop
+ \PackageError\STname{Illegal relative reference found in cell \ST@temp@callcell!}\ST@seedoc@i
}
-\newcommand*\ST@illegal@ref{%
- \PackageError\ST@package@name{Illegal reference in \string\STsavecell!}\ST@seedoc@i
-}
+\def\ST@illegal@ref{\PackageError\STname{Illegal reference in \string\STsavecell!}\ST@seedoc@i}
-\newcommand*\ST@unmatch@matrixdim{%
+\def\ST@unmatch@matrixdim{%
\edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
\ST@coord@toref\ST@temp@callcell
- \PackageError\ST@package@name{Somprod dimension of matrix do not match in cell \ST@temp@callcell!}\ST@seedoc@i
+ \PackageError\STname{Somprod dimension of matrix do not match in cell \ST@temp@callcell!}\ST@seedoc@i
}
-\newcommand*\ST@fact@outofrange{%
- \PackageError\ST@package@name{Argument of fact is not integer or is out of range!}\ST@seedoc@i
-}
+\def\ST@fact@outofrange{\PackageError\STname{Argument of fact is not integer or is out of range!}\ST@seedoc@i}
-\newcommand\ST@invalid@date{%
+\def\ST@invalid@date{%
\edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
\ST@coord@toref\ST@temp@callcell
- \PackageError\ST@package@name{Invalid date in cell \ST@temp@callcell.}\ST@seedoc@i
+ \PackageError\STname{Invalid date in cell \ST@temp@callcell.}\ST@seedoc@i
}
-\newcommand*\ST@invalid@range{%
+\def\ST@invalid@range{%
\edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
\ST@coord@toref\ST@temp@callcell
- \PackageError\ST@package@name{Invalid range in cell \ST@temp@callcell.}\ST@seedoc@i\stop
+ \PackageError\STname{Invalid range in cell \ST@temp@callcell.}\ST@seedoc@i
}
-\newcommand*\ST@invalidSTcopy{%
+\def\ST@invalidSTcopy{%
\edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
\ST@coord@toref\ST@temp@callcell
- \PackageError\ST@package@name{Numeric field marker found, \string\STcopy\space forbidden in cell \ST@temp@callcell.}\ST@seedoc@i\stop
+ \PackageError\STname{Numeric field marker found, \string\STcopy\space forbidden in cell \ST@temp@callcell.}\ST@seedoc@i
}
-\newcommand*\ST@unknown@tag{%
+\def\ST@unknown@tag{%
\edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
\ST@coord@toref\ST@temp@callcell
- \PackageError\ST@package@name{Undefined tag in cell \ST@temp@callcell.}\ST@seedoc@i
+ \PackageError\STname{Undefined tag in cell \ST@temp@callcell.}\ST@seedoc@i
}
+\def\ST@intarg@required{\PackageError\STname{Macro function randint require integer argument}\ST@seedoc@i}
+
% transforme la chaine de cellules "(1,3)(4,5)(3,2)(1,3)" rencontr\'e en r\'ef\'erence circulaire en "A3-D5-C2-A3"
-\newcommand*\ST@show@dependance@tree{%
+\def\ST@show@dependance@tree{%
\ST@between\ST@dependance@tree()\ST@currentref
\ST@right\ST@dependance@tree)\ST@dependance@tree
\ST@coord@toref\ST@currentref
@@ -178,92 +155,88 @@
}
% transforme la s\'equence de contr\^ole #1 qui contient par exemple «4,5» en «D5»
-\newcommand*\ST@coord@toref[1]{%
+\def\ST@coord@toref#1{%
\ST@split#1,\ST@temp@a#1%
\edef#1{\ifcase\ST@temp@a\or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M\or
N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z\fi#1}%
}
-\newcommand*\ST@illegal@copy{%
- \PackageError\ST@package@name{Illegal reference in copied formula!}\ST@seedoc@i
-}
+\def\ST@illegal@copy{\PackageError\STname{Illegal reference in copied formula!}\ST@seedoc@i}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%% Macros d'affectation et d'expansion %%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand*\ST@letname[1]{\expandafter\let\csname#1\endcsname}
+\def\ST@letname#1{\expandafter\let\csname#1\endcsname}
-\newcommand\ST@exp@two@args[3]{%
+\def\ST@exp@two@args#1#2#3{%
\def\ST@tmp@{#1}%
\ST@expadd@tomacro\ST@tmp@{\expandafter{#2}}%
\ST@expadd@tomacro\ST@tmp@{\expandafter{#3}}%
\ST@tmp@
}
-\newcommand\ST@add@tomacro[2]{\expandafter\def\expandafter#1\expandafter{#1#2}}
+\def\ST@add@tomacro#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}}
-\newcommand\ST@expadd@tomacro[2]{\expandafter\ST@add@tomacro\expandafter#1\expandafter{#2}}
+\def\ST@expadd@tomacro#1#2{\expandafter\ST@add@tomacro\expandafter#1\expandafter{#2}}
-\newcommand\ST@edefadd@tomacro[2]{%
- \edef#1{\unexpanded\expandafter{#1}#2}%
-}
+\def\ST@edefadd@tomacro#1#2{\edef#1{\unexpanded\expandafter{#1}#2}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%% Macros de manipulation de chaines %%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\def\ST@gobble@remain{%
+\def\ST@gobble@remain{% mange tous jusqu'à \ST@nil. Méthode LENTE privilégiée car il peut y avoir des ) de catcode 2 isolées
\afterassignment\ST@gobble@remain@i
\let\ST@toks=
}
+\def\ST@gobble@remain@i{\unless\ifx\ST@toks\ST@nil\expandafter\ST@gobble@remain\fi}
-\def\ST@gobble@remain@i{%
- \unless\ifx\ST@toks\ST@nil\expandafter\ST@gobble@remain\fi
-}
-
-\newcommand\ST@splitatfirstcar[3]{%
+\def\ST@splitatfirstcar#1#2#3{%
\def\ST@splitatfirstcar@i##1##2\@nil{\def#2{##1}\def#3{##2}}%
\expandafter\ST@splitatfirstcar@i#1\@nil
}
% dans la sc #1, remplace le . par le s\'eparateur d\'ecimal
-\newcommand\ST@substdecsep[1]{%
- \ST@Ifinstr#1.{\expandafter\ST@substdecsep@i\expandafter#1\expandafter{\ST@decsep}}\relax
+\def\ST@substdecsep#1{%
+ \ST@Ifinstr#1.
+ {\expandafter\ST@substdecsep@i\expandafter#1\expandafter{\ST@decsep}}
+ {}%
}
-\newcommand\ST@substdecsep@i[2]{%
+\def\ST@substdecsep@i#1#2{%
\def\ST@substdecsep@ii##1.##2\@nil{\def#1{##1#2##2}}%
\expandafter\ST@substdecsep@ii#1\@nil
}
% enl\`eve tous les espaces de la sc #1 et assigne le r\'esultat \'a #1
-\newcommand\ST@remove@first@spaces[1]{%
+\def\ST@remove@firST@spaces#1{%
\IfBeginWith#1\space
- {\StrGobbleLeft#11[#1]\ST@remove@first@spaces{#1}}%
+ {\StrGobbleLeft#11[#1]\ST@remove@firST@spaces{#1}}%
{}%
}
-\newcommand\ST@keep@firstcar[1]{% on ne garde dans la sc #1 que le 1er caract\`ere de la sc #1 ou on enl\`eve les accolades
- \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter#1\expandafter\expandafter\expandafter{\expandafter\@car#1\@nil}%
+\def\ST@keep@firstcar#1{% on ne garde dans la sc #1 que le 1er caract\`ere de la sc #1 ou on enl\`eve les accolades
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\expandafter#1\expandafter\expandafter\expandafter{\expandafter\@car#1\@nil}%
}
-\newcommand\ST@firstarg@after[3]{% assigne \'a la sc #3 l'argument qui suit #2 dans le d\'eveloppement de la sc #1
+\def\ST@firstarg@after#1#2#3{% assigne \'a la sc #3 l'argument qui suit #2 dans le d\'eveloppement de la sc #1
\def\ST@firstarg@after@i##1#2##2##3\@nil{\def#3{##2}}%
\expandafter\ST@firstarg@after@i#1\@nil
}
-\newcommand\ST@thirdarg@after[3]{% assigne \'a la sc #3 le 3\`e argument qui suit #2 dans le d\'eveloppement de la sc #1
+\def\ST@thirdarg@after#1#2#3{% assigne \'a la sc #3 le 3\`e argument qui suit #2 dans le d\'eveloppement de la sc #1
\def\ST@thirdarg@after@i##1#2##2##3##4##5\@nil{\def#3{##4}}%
\expandafter\ST@thirdarg@after@i#1\@nil
}
% est ce que la sc #1 contient la sc #2 ?
-\newcommand\ST@Ifinstr[2]{\ST@exp@two@args\ST@Ifinstr@i{#1}{#2}}
-\newcommand\ST@Ifinstr@i[2]{%
+\def\ST@Ifinstr#1#2{\ST@exp@two@args\ST@Ifinstr@i{#1}{#2}}
+\def\ST@Ifinstr@i#1#2{%
\def\ST@Ifinstr@ii##1#2##2\@nil{\ifx\@empty##2\@empty\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi}%
\ST@Ifinstr@ii#1\@@nil#2\@nil
}
% Est ce que la sc #1 commence par les caract\`eres #2 ?
-\newcommand\ST@Iffirstis[2]{%
+\def\ST@Iffirstis#1#2{%
\expandafter\ST@Ifinstr@i\expandafter{#1}{#2}%
{\def\ST@Iffirstis@i##1#2##2\@nil{%
\ifx\@empty##1\@empty\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
@@ -275,55 +248,57 @@
% Coupe la sc #1 au caract\`ere #2
% ce qui est avant est assign\'e \'a #3 et ce qui est apr\`es \'a #4
-\newcommand\ST@split[4]{%
+\def\ST@split#1#2#3#4{%
\def\ST@split@i##1#2##2\@nil{\def#3{##1}\def#4{##2}}%
\expandafter\ST@split@i#1\@nil
}
% Dans la sc #1, assigne ce qui est avant le d\'eveloppement de la sc #2 \'a la sc #3
-\newcommand\ST@left[3]{\ST@exp@two@args\ST@left@i{#1}{#2}#3}
-\newcommand\ST@left@i[3]{%
+\def\ST@left#1#2#3{\ST@exp@two@args\ST@left@i{#1}{#2}#3}
+\def\ST@left@i#1#2#3{%
\def\ST@left@ii##1#2##2\@nil{\def#3{##1}}%
\ST@left@ii#1\@nil
}
% Dans la sc #1, assigne ce qui est apr\`es le d\'eveloppement de la sc #2 \'a la sc #3
-\newcommand\ST@right[3]{\ST@exp@two@args\ST@right@i{#1}{#2}#3}
-\newcommand\ST@right@i[3]{%
+\def\ST@right#1#2#3{\ST@exp@two@args\ST@right@i{#1}{#2}#3}
+\def\ST@right@i#1#2#3{%
\def\ST@right@ii##1#2##2\@nil{\def#3{##2}}%
\ST@right@ii#1\@nil
}
% Dans la sc #1, assigne \'a la sc #4 ce qui est entre les caract\`eres #2 et #3
-\newcommand\ST@between[4]{%
+\def\ST@between#1#2#3#4{%
\def\ST@between@i##1#2##2#3##3\@nil{\def#4{##2}}%
\expandafter\ST@between@i#1\@nil
}
% Dans la sc #1, substitue la premi\`ere occurrence du pattern #2 par le pattern #3
-\newcommand\ST@subst@once[3]{%
- \def\ST@subst@once@i##1#2##2\@nil{\def#1{##1#3##2}}%
- \ST@Ifinstr#1{\@empty#2}{\expandafter\ST@subst@once@i#1\@nil}\relax
+\def\ST@subST@once#1#2#3{%
+ \def\ST@subST@once@i##1#2##2\@nil{\def#1{##1#3##2}}%
+ \ST@Ifinstr#1{\@empty#2}
+ {\expandafter\ST@subST@once@i#1\@nil}
+ {}%
}
% Dans la sc #1, substitue le pattern #2 par le pattern #3
-\newcommand\ST@subst[3]{%
- \def\ST@subst@i##1#2##2\@nnil{%
+\def\ST@subst#1#2#3{%
+ \def\ST@subST@i##1#2##2\@nnil{%
\ifx\@empty##2\@empty
\def#1{##1}\expandafter\remove@to@nnil
\else
- \expandafter\ST@subst@i
+ \expandafter\ST@subST@i
\fi
##1#3##2\@nnil
}%
- \expandafter\ST@subst@i#1#2\@nnil
+ \expandafter\ST@subST@i#1#2\@nnil
}
-\newcommand\ST@expsubst[3]{\ST@exp@two@args{\ST@subst#1}{#2}{#3}}
+\def\ST@expsubst#1#2#3{\ST@exp@two@args{\ST@subst#1}{#2}{#3}}
-\newcommand\ST@removespaces[1]{\ST@subst#1{ }{}}
+\def\ST@removespaces#1{\ST@subst#1{ }{}}
-\newcommand\ST@ifvalid@csname[1]{%
+\def\ST@ifvalid@csname#1{%
\ifcsname#1\endcsname
\expandafter\ifx\csname#1\endcsname\ST@undef@content
\expandafter\expandafter\expandafter\@secondoftwo
@@ -339,14 +314,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Lecture du tableau %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% lit le tableau : consid\`ere que \\ s\'epare les lignes
-\newcommand\ST@read@tab{%
+\def\ST@read@tab{%
\def\ST@total@colnumber{0}%
\ST@rowcount\z@
\ST@search@hline% on met de c\^ot\'e la (ou les) ligne sup\'erieure du tableau
\ST@read@tab@i
}
-\newcommand\ST@read@tab@i{%
+\def\ST@read@tab@i{%
\advance\ST@rowcount\@ne
\ST@Ifinstr\ST@tab{\ST@eol}% si contient \\, il reste encore des lignes
{\expandafter\ST@split\expandafter\ST@tab\expandafter{\ST@eol}\ST@current@row\ST@tab
@@ -354,11 +329,11 @@
\ST@Iffirstis\ST@tab[% on prend en compte l'\'eventuel argument optionnel de \\
{\ST@between\ST@tab[]\ST@temp@a% prend ce qui est entre crochet
\ST@Ifinstr\ST@temp@a,% si c'est une r\'ef\'erence (on teste juste la pr\'esence de la virgule, ça devrait suffire)
- \relax% on ne fait rien
+ {}% on ne fait rien
{\ST@split\ST@tab]\ST@temp@a\ST@tab% sinon, coupe au crocher fermant
\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname{\ST@temp@a]}}% ajoute l'argument optionnel \'a la fin de ligne
}%
- \relax
+ {}%
\ST@search@hline% on va purger les hlines et les mettre dans la fin de ligne
\ifx\ST@tab\@empty
\let\ST@next@readrows\relax
@@ -374,7 +349,7 @@
{\edef\ST@row@skiplist{(\number\ST@rowcount)\ST@row@skiplist}% on ajoute le num\'ero de ligne \'a masquer \'a la skiplist
\StrDel\ST@current@row{\@empty\SThiderow}[\ST@current@row]%
}%
- \relax
+ {}%
\ST@colcount\z@
\let\ST@multicol@number\@empty
\let\ST@nextcell\@empty
@@ -382,29 +357,31 @@
\ST@next@readrows
}
-\newcommand\ST@read@cells{% divise la ligne contenue dans \ST@current@row en cellules
+\def\ST@read@cells{% divise la ligne contenue dans \ST@current@row en cellules
\advance\ST@colcount\@ne
\ST@Ifinstr\ST@current@row&%
{\ST@split\ST@current@row&\ST@current@cell\ST@current@row
- \let\ST@next@readcells\ST@read@cells}%
+ \let\ST@next@readcells\ST@read@cells
+ }%
{\let\ST@current@cell\ST@current@row
\let\ST@next@readcells\relax
- \ifnum\ST@colcount>\ST@total@colnumber\edef\ST@total@colnumber{\number\ST@colcount}\fi}%
+ \ifnum\ST@colcount>\ST@total@colnumber\edef\ST@total@colnumber{\number\ST@colcount}\fi
+ }%
\ST@Ifinstr\ST@current@cell{\@empty\SThidecol}% on doit masquer cette colonnes ?
{\ST@Ifinstr\ST@col@skiplist{\expandafter(\number\ST@colcount)}% ça a d\'ej\'a \'et\'e demand\'e ?
- \relax% on fait rien
+ {}% on fait rien
{\edef\ST@col@skiplist{(\number\ST@colcount)\ST@col@skiplist}% sinon -> ajout \'a la skiplist
- \ifnum\ST@colcount>\ST@last@skipcol\edef\ST@last@skipcol{\number\ST@colcount}\fi
+ \ifnum\ST@colcount>\ST@laST@skipcol\edef\ST@laST@skipcol{\number\ST@colcount}\fi
}%
\StrDel\ST@current@cell{\@empty\SThidecol}[\ST@current@cell]%
}%
- \relax
+ {}%
\exploregroups
\ST@Ifinstr\ST@current@cell{\@empty\multicolumn}% tester la pr\'esence d'un \multicol
{\ST@firstarg@after\ST@current@cell\multicolumn\ST@multicol@number}%
{\let\ST@multicol@number\@empty}%
\IfSubStr\ST@current@cell\STnumericfieldmarker% il y a un marqueur de champ num\'erique ?
- {\IfSubStr\ST@current@cell{\@empty\STcopy}\ST@invalidSTcopy\relax% s'il y a un \STcopy, erreur (pas de champ num\'erique et de \STcopy dans une m\^eme cellule)
+ {\IfSubStr\ST@current@cell{\@empty\STcopy}\ST@invalidSTcopy{}% s'il y a un \STcopy, erreur (pas de champ num\'erique et de \STcopy dans une m\^eme cellule)
\StrBehind\ST@current@cell\STnumericfieldmarker[\ST@current@formula]%
\noexploregroups
\StrChar\ST@current@formula1[\ST@temp@a]% \ST@temp@a contient {<formule}
@@ -453,7 +430,7 @@
\fi
\else% ici, la cellule est compos\'ee d'une champ num\'erique sans marqueur
\@namedef{code@\number\ST@colcount @\number\ST@rowcount}{1}% toute la cellule est consid\'er\'ee comme champ num\'erique
- \ST@remove@first@spaces\ST@current@cell
+ \ST@remove@firST@spaces\ST@current@cell
\ST@Ifinstr\ST@current@cell{\@empty\STcopy}%
{\ST@findcopyargs\ST@current@cell\ST@copyrange\ST@copyformula% on chope les arguments de \STcopy
\ST@seekcopyoffset\ST@copyrange% cherche les d\'ecalages
@@ -490,15 +467,15 @@
% On va essayer de purger dans #1 toutes les \hline, \clines, \hhline etc, et ajouter tout ce beau monde
% et leur ev\'entuels arguments dans des sc sp\'eciales (par ex \endrow@3 pour la fin de la 3e ligne.)
-\newcommand\ST@search@hline{%
+\def\ST@search@hline{%
\ST@ifvalid@csname{endrow@\number\ST@rowcount}%
- \relax
+ {}
{\ST@letname{endrow@\number\ST@rowcount}\@empty}%
\ST@search@hline@i
}
-\newcommand\ST@search@hline@i{%
- \ST@remove@first@spaces\ST@tab% on enl\`eve les espaces au d\'ebut
+\def\ST@search@hline@i{%
+ \ST@remove@firST@spaces\ST@tab% on enl\`eve les espaces au d\'ebut
\StrChar\ST@tab1[\ST@temp@a]% \ST@temp@a est le 1er car
\let\ST@next\ST@search@hline@i
\IfStrEqCase\ST@temp@a{% on envisage tous les cas de trac\'e de ligne horizontale
@@ -508,30 +485,30 @@
{\@empty\noalign}{\StrSplit\ST@tab2\ST@temp@a\ST@tab\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a}%
{\@empty\toprule}{% les commandes de booktabs
\StrSplit\ST@tab1\ST@temp@a\ST@tab% chope le 1er lex\`eme : la commande \toprule
- \IfBeginWith\ST@tab[{\StrBefore\ST@tab][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind\ST@tab][\ST@tab]}\relax
+ \IfBeginWith\ST@tab[{\StrBefore\ST@tab][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind\ST@tab][\ST@tab]}{}%
\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a
}%
{\@empty\midrule}{%
\StrSplit\ST@tab1\ST@temp@a\ST@tab% chope le 1er lex\`eme : la commande \midrule
- \IfBeginWith\ST@tab[{\StrBefore\ST@tab][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind\ST@tab][\ST@tab]}\relax
+ \IfBeginWith\ST@tab[{\StrBefore\ST@tab][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind\ST@tab][\ST@tab]}{}%
\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a
}%
{\@empty\bottomrule}{%
\StrSplit\ST@tab1\ST@temp@a\ST@tab% chope le 1er lex\`eme : la commande \bottomrule
- \IfBeginWith\ST@tab[{\StrBefore\ST@tab][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind\ST@tab][\ST@tab]}\relax
+ \IfBeginWith\ST@tab[{\StrBefore\ST@tab][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind\ST@tab][\ST@tab]}{}%
\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a
}%
{\@empty\cmidrule}{%
\StrSplit\ST@tab1\ST@temp@a\ST@tab% chope le 1er lex\`eme : la commande \cmidrule
- \IfBeginWith\ST@tab[{\StrBefore\ST@tab][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind\ST@tab][\ST@tab]}\relax
- \IfBeginWith\ST@tab({\StrBefore\ST@tab)[\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b)}\StrBehind\ST@tab)[\ST@tab]}\relax
+ \IfBeginWith\ST@tab[{\StrBefore\ST@tab][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind\ST@tab][\ST@tab]}{}%
+ \IfBeginWith\ST@tab({\StrBefore\ST@tab)[\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b)}\StrBehind\ST@tab)[\ST@tab]}{}%
\StrSplit\ST@tab1\ST@temp@b\ST@tab% chope l'argument obligatoire : {a-b}
\ST@expadd@tomacro\ST@temp@a\ST@temp@b% l'ajoute \'a \ST@temp@b
\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a% et on ajoute le tout \'a endrow
}%
{\@empty\addlinespace}{%
\StrSplit\ST@tab1\ST@temp@a\ST@tab% chope le 1er lex\`eme : la commande \addlinespace
- \IfBeginWith\ST@tab[{\StrBefore\ST@tab][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind\ST@tab][\ST@tab]}\relax
+ \IfBeginWith\ST@tab[{\StrBefore\ST@tab][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind\ST@tab][\ST@tab]}{}%
\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a
}%
{\@empty\morecmidrules}{\StrGobbleLeft\ST@tab1[\ST@tab]\expandafter\ST@add@tomacro\csname endrow@\number\ST@rowcount\endcsname\morecmidrules}%
@@ -543,14 +520,14 @@
% Cette macro transpose toutes les r\'ef\'erences (absolues et relatives) de la sc #3.
% Le d\'ecalage est de #1 (nombre sign\'e) pour les colonnes et de #2 (nombre sign\'e) pour les lignes.
% La sc #4 recoit la formule transpos\'ee.
-\newcommand\ST@transposeformula[4]{%
+\def\ST@transposeformula#1#2#3#4{%
\def\ST@addcol{#1}\def\ST@addrow{#2}\let\ST@temp@formula#3%
\let\ST@transposed@formula\@empty
\ST@transposeformula@i
\let#4\ST@transposed@formula
}
-\newcommand\ST@transposeformula@i{%
+\def\ST@transposeformula@i{%
\unless\ifx\@empty\ST@temp@formula% tant que l'on n'a pas parcouru \ST@temp@formula
\ST@splitatfirstcar\ST@temp@formula\ST@firstcar\ST@temp@formula% prend le 1er car de \ST@temp@formula
\if\expandafter\noexpand\STtransposecar\expandafter\noexpand\ST@firstcar% si ce caract\`ere est un !
@@ -566,7 +543,7 @@
\else
\let\ST@addrow@\ST@addrow% sinon, on copie le vecteur
\fi
- \IfInteger\ST@temp@formula\relax\relax% on prend le nombre qui suit
+ \IfInteger\ST@temp@formula{}{}% on prend le nombre qui suit
\ifnum\integerpart>\z@% si ce nombre est plus grand que 0 -> r\'ef\'erence valide
\let\ST@temp@formula\@xs@afterinteger% on prend ce qui est apr\`es le nombre
\expandafter\lowercase\expandafter{\expandafter\def\expandafter\ST@firstcar\expandafter{\ST@firstcar}}% met en minuscules
@@ -617,7 +594,7 @@
% Cherche dans la sc #1 les 3 arguments qui se trouvent apr\`es \STcopy
% Affecte le 1er \'a #2, le 2\`e \'a #3 et le 3\`e \'a #4
-\newcommand\ST@findcopyargs[3]{%
+\def\ST@findcopyargs#1#2#3{%
\def\ST@argaftercopy##1\STcopy##2##3##4\@nil{%
\def#1{##1}\ST@expadd@tomacro#1{\STnumericfieldmarker##4}% dans #1,supprime \STcopy{<arg1>}{<arg2>} et le remplace par :=
\def#2{##2}\def#3{##3}%
@@ -668,21 +645,21 @@
% Regarde dans la liste de copie si la cellule de coodonn\'ees #1 #2 est dans une plage de copie
% si oui, affecte \'a #3 la formule transpos\'ee
% La liste de copy est parcourue de gauche \'a droite avec sortie d\`es qu'une plage qui convient est rencontr\'ee
-\newcommand\ST@lookincopylist[3]{%
+\def\ST@lookincopylist#1#2#3{%
\let\ST@alias@copylist\ST@copylist
\let\ST@returnedformula\@empty
\def\ST@copycol{#1}\def\ST@copyrow{#2}\let#3\@empty
- \ST@lookincopylist@i
+ \ST@lookincopyliST@i
\let#3\ST@returnedformula
}
-\newcommand\ST@lookincopylist@i{%
+\def\ST@lookincopyliST@i{%
\expandafter\ST@testfirstincopylist\ST@alias@copylist\@nil
\ifx\@empty\ST@alias@copylist
\let\ST@next\relax
\else
\ifx\@empty\ST@returnedformula
- \let\ST@next\ST@lookincopylist@i
+ \let\ST@next\ST@lookincopyliST@i
\else
\let\ST@next\relax
\fi
@@ -691,8 +668,7 @@
}
% Teste si un \'el\'ement de la copylist contient une plage qui inclus la cellule en cours.
-\def\ST@testfirstincopylist|#1|[#2,#3](#4,#5)#6\@nil%
-{%
+\def\ST@testfirstincopylist|#1|[#2,#3](#4,#5)#6\@nil{%
\def\ST@alias@copylist{#6}% on enl\`eve le premier \'el\'ement de la copylist
\ST@Ifin\ST@copycol\ST@copyrow[#2,#3](#4,#5)% si ça correspond
{\def\ST@returnedformula{#1}%
@@ -711,7 +687,7 @@
% S'il trouve > ou v sans nombre derri\`ere, le d\'ecalage correspondant est vide
% S'il ne trouve pas > ou v, le d\'ecalage correspond est \'egal \'a 0
% Assigne les d\'ecalages trouv\'es dans \ST@hoffest et \ST@voffest
-\newcommand\ST@seekcopyoffset[1]{%
+\def\ST@seekcopyoffset#1{%
\ST@Ifinstr#1>%
{\ST@findcopyoffest#1>\ST@hoffest}%
{\def\ST@hoffest{0}}%
@@ -721,54 +697,46 @@
}
% Cherche dans la sc #1 ce qui est entre #2 et ,
-\newcommand\ST@findcopyoffest[3]{%
- \def\ST@findcopyoffest@i##1#2##2,##3\@nil{\def#3{##2}}%
- \expandafter\ST@findcopyoffest@i#1,\@nil
+\def\ST@findcopyoffest#1#2#3{%
+ \def\ST@findcopyoffeST@i##1#2##2,##3\@nil{\def#3{##2}}%
+ \expandafter\ST@findcopyoffeST@i#1,\@nil
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%% Recherche d'une r\'ef\'erence %%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% teste si le token #1 est une lettre (majuscule ou minuscule)
-\newcommand\ST@ifcar@isletter[1]{%
- \ifcat\relax\noexpand#1
- \let\ST@next\@secondoftwo% faux si c'est une sc
- \else
- \ifnum`#1<\ifnum`#1<`a`A\else`a\fi
- \let\ST@next\@secondoftwo
- \else
- \ifnum`#1>\ifnum`#1<`a`Z\else`z\fi
- \let\ST@next\@secondoftwo
- \else
- \let\ST@next\@firstoftwo
- \fi
- \fi
- \fi
- \ST@next
+\def\ST@ifcar@isletter#1{%
+ \begingroup\escapechar`\\
+ \lowercase{\expandafter\ST@ifcar@isletter@i\detokenize{#1}}.\@nil
+}
+\def\ST@ifcar@isletter@i#1#2\@nil{%
+ \endgroup
+ \ifnum\numexpr(`#1-`a)*(`#1-`z)\relax>\z@\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi
}
% cherche une r\'ef\'erence du type lettre+nombre dans la sc #1
% si on trouve, renvoie les coordonn\'ees dans #2 sous la forme x@y
% si on ne trouve pas, #2 est vide.
-\newcommand\ST@findref@informula[2]{%
+\def\ST@findref@informula#1#2{%
\let\ST@temp@formula#1%
\ST@findref@informula@i
\let#2\ST@temp@formula
\unless\ifx\@empty\ST@ref@found
- \ST@Iffirstis\ST@after@ref@found|\relax{%
- \ST@exp@two@args{\ST@subst@once#1}\ST@ref@found{\ST@ref@found|}%
- }%
+ \ST@Iffirstis\ST@after@ref@found|
+ {}
+ {\ST@exp@two@args{\ST@subST@once#1}\ST@ref@found{\ST@ref@found|}}%
\fi
}
-\newcommand\ST@findref@informula@i{%
+\def\ST@findref@informula@i{%
\let\ST@next@search\ST@findref@informula@i
\ifx\@empty\ST@temp@formula
\let\ST@next@search\relax
\else
\StrSplit\ST@temp@formula1\ST@firstcar\ST@temp@formula% prend le 1er car de ce qui reste
\expandafter\ST@ifcar@isletter\expandafter{\ST@firstcar}% est-ce que le 1er car est une lettre ?
- {\IfInteger\ST@temp@formula\relax\relax% on prend le nombre qui suit
+ {\IfInteger\ST@temp@formula{}{}% on prend le nombre qui suit
\ifnum\integerpart>\z@% si ce nombre est plus grand que 0 -> r\'ef\'erence valide
\let\ST@after@ref@found\@xs@afterinteger
\edef\ST@ref@found{\ST@firstcar\number\integerpart}% est la r\'ef\'erence trouv\'ee
@@ -802,7 +770,7 @@
}
% cette commande teste si la sc #1 est syntaxiquement une r\'ef\'erence
-\newcommand\ST@ifref[1]{%
+\def\ST@ifref#1{%
\let\ST@temp@formula#1%
\let\ST@ref@found\@empty
\ST@findref@informula@i
@@ -822,28 +790,28 @@
%%%%%%%%%%%%%%%%% Le noyau : \'evaluation de toutes les cellules %%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Essaie de calculer la cellule (#1,#2)
-\def\ST@try@calc@cell(#1,#2)%
-{%
+\def\ST@try@calc@cell(#1,#2){%
\ST@ifvalid@csname{formula@#1@#2}% on v\'erifie que la formule existe
{\expandafter\ifx\csname formula@#1@#2\endcsname\@empty
\@namedef{code@#1@#2}{0}% si vide, code \'a 0
\else% et qu'elle est non vide
\def\ST@current@colnumber{#1}\def\ST@current@rownumber{#2}%
- \expandafter\ST@find@first@func\csname formula@#1@#2\endcsname% cherche une fonction dans la formule
+ \expandafter\ST@find@firST@func\csname formula@#1@#2\endcsname% cherche une fonction dans la formule
\ifx\@empty\ST@function@namefound% s'il n'y a pas de fonction
\expandafter\ST@findref@informula\csname formula@#1@#2\endcsname\ST@coord
\ifx\@empty\ST@coord% ni de r\'ef\'erence
\ST@calc@cell(#1,#2)% on va la calculer la cellule
\fi
\fi
- \fi}\relax
+ \fi
+ }
+ {}%
}
-\def\ST@calc@cell(#1,#2)%
-{% calcule la formule num\'erique de la cellule (#1,#2)
+\def\ST@calc@cell(#1,#2){% calcule la formule num\'erique de la cellule (#1,#2)
\unless\ifnum\csname code@#1@#2\endcsname<\@ne% si le code est >= 1
\expandafter\let\expandafter\ST@temp@a\csname formula@#1@#2\endcsname% \ST@temp@a est le contenu de la formule
- \ST@Iffirstis\ST@temp@a-{\expandafter\def\expandafter\ST@temp@a\expandafter{\expandafter0\ST@temp@a}}\relax
+ \ST@Iffirstis\ST@temp@a-{\expandafter\def\expandafter\ST@temp@a\expandafter{\expandafter0\ST@temp@a}}{}%
\FPeval\ST@temp@a\ST@temp@a% on calcule cette formule
\unless\ifx\ST@rounddigit\@empty\FPround\ST@temp@a\ST@temp@a\ST@rounddigit\fi% on arrondi s'il faut
\ifST@clipround% on arrondit en enlevant les 0 inutiles ?
@@ -859,18 +827,18 @@
}
% Calcule toutes les formules du tableau
-\newcommand\ST@eval@tab{%
+\def\ST@eval@tab{%
\ST@rowcount\@ne\ST@colcount\@ne
\ST@eval@tab@i
}
-\newcommand\ST@eval@tab@i{%
+\def\ST@eval@tab@i{%
\ifnum\ST@rowcount>\ST@total@rownumber
\let\ST@nextcell\relax
\else
\ST@ifvalid@csname{formula@\number\ST@colcount @\number\ST@rowcount}% si la formule existe
{\ST@eval@cell(\number\ST@colcount,\number\ST@rowcount)}% on la calcule
- \relax
+ {}%
\advance\ST@colcount\@ne
\let\ST@nextcell\ST@eval@tab@i
\ifnum\ST@colcount>\ST@total@colnumber
@@ -884,7 +852,7 @@
% la sc #1 est le nom d'une fonction.
% La macro renvoie dans la sc #2 : 1, 2 ou 2 selon que #1 est le nom d'une macro \'a argument num\'erique, \'a argument plage ou \'a argument texte.
% #2 est vaut 0 si #1 n'est pas le nom d'une fonction
-\newcommand\ST@determine@function@code[2]{%
+\def\ST@determine@function@code#1#2{%
\ST@Ifinstr{\ST@functions@with@num@arg,}{#1,}%
{\def#2{1}}%
{\ST@Ifinstr{\ST@functions@with@range@arg,}{#1,}%
@@ -897,9 +865,8 @@
}
% \'Evalue la cellule (#1#2) par ses coordonn\'ees num\'eriques (col,row)
-\def\ST@eval@cell(#1,#2)%
-{%
- \def\ST@dependance@tree{(#1,#2)}%
+\def\ST@eval@cell(#1,#2){%
+ \edef\ST@dependance@tree{(#1,#2)}% FIXME : mettre \edef
\let\ST@stackcall\@empty
\let\ST@function@namesaved\@empty
\ST@eval@cell@i(#1,#2)% on appelle la macro r\'ecursive
@@ -912,15 +879,14 @@
}
% Ceci est la macro principale : elle \'evalue la cellule (#1,#2)
-\def\ST@eval@cell@i(#1,#2)% #1 = no colonne #2 = no ligne
-{%
+\def\ST@eval@cell@i(#1,#2){% #1 = no colonne #2 = no ligne
\ifnum\csname code@#1@#2\endcsname=\@ne% on ne fait quelque chose que si le code est 1 : cellule non calcul\'ee
\def\ST@current@colnumber{#1}\def\ST@current@rownumber{#2}%
- \expandafter\ST@find@first@func\csname formula@#1@#2\endcsname% cherche une fonction dans la formule
+ \expandafter\ST@find@firST@func\csname formula@#1@#2\endcsname% cherche une fonction dans la formule
\ifx\@empty\ST@function@namefound% il n'y a pas de fonction
\IfSubStr[2]\ST@dependance@tree{(#1,#2)}%
{\edef\ST@coord{#1,#2}\ST@circular@reference}% message et on s'arr\^ete si r\'ef\'erence circulaire
- \relax
+ {}%
\expandafter\ST@findref@informula\csname formula@#1@#2\endcsname\ST@coord% y a t-il une r\'ef\'erence dans l'argument ?
\ifx\ST@coord\@empty% pas de r\'ef\'erence dans l'argument
\ifx\ST@function@namesaved\@empty% si aucune fonction n'a \'et\'e d\'ecel\'ee
@@ -954,7 +920,7 @@
% si la valeur distante est <0, on la met entre parenth\`eses
\ST@Iffirstis\ST@distant@formula-%
{\expandafter\def\expandafter\ST@distant@formula\expandafter{\expandafter(\ST@distant@formula)}}%
- \relax
+ {}%
% on remplace toutes les r\'ef\'erences par la valeur distante
\expandafter\ST@expsubst\csname formula@#1@#2\endcsname{\ST@ref@found|}\ST@distant@formula
\edef\ST@stackcall{(#1,#2)\ST@stackcall}% puis, on \'evalue \'a nouveau cette cellule
@@ -972,7 +938,7 @@
\let\ST@function@namesaved\ST@function@namefound
\ST@determine@function@code\ST@function@namefound\ST@codefunc% d\'etermine le code de la fonction
\ifcase\ST@codefunc\relax
- \PackageError\ST@package@name{This error should not occur! Please email the author. Thanks.}{}%
+ \PackageError\STname{This error should not occur! Please email the author. Thanks.}{}%
\or% le code vaut 1, c'est une fonction \'a argument num\'erique
\ST@findref@informula\ST@function@argfound\ST@temp@formula% y a t-il une r\'ef\'erence dans l'argument de la formule ?
\ifx\ST@temp@formula\@empty% pas de r\'ef\'erence dans l'argument de la fonction
@@ -980,10 +946,10 @@
\let\ST@tobereplaced\ST@function@namefound
\ST@expadd@tomacro\ST@tobereplaced{\expandafter(\ST@function@argfound)}% ce qui va \^etre replac\'e : fonction(argument)
\ST@Ifinstr{\ST@functions@no@calc@arg,}{\ST@function@namefound,}% doit-on calculer l'argument de cette fonction ?
- \relax
+ {}%
{\FPeval\ST@function@argfound\ST@function@argfound\FPclip\ST@function@argfound\ST@function@argfound}%
\csname ST@func@\ST@function@namefound\endcsname\ST@function@argfound\ST@result@func% puis on \'evalue la fonctionfound
- \ST@Iffirstis\ST@result@func-{\expandafter\def\expandafter\ST@result@func\expandafter{\expandafter(\ST@result@func)}}\relax
+ \ST@Iffirstis\ST@result@func-{\expandafter\def\expandafter\ST@result@func\expandafter{\expandafter(\ST@result@func)}}{}%
\ST@expsubst\ST@current@formula\ST@tobereplaced\ST@result@func% on replace dans l'alias
\ST@letname{formula@#1@#2}\ST@current@formula% on l'assigne dans la formule
\ifx\@empty\ST@current@formula% pour cause de macro fonction "tag" qui est seule et qui a disparue apr\`es substitution
@@ -996,7 +962,7 @@
\expandafter\let\expandafter\ST@current@formula\csname formula@\ST@temp@formula\endcsname% alias pour la formule distante
\ST@Iffirstis\ST@current@formula-%
{\expandafter\def\expandafter\ST@current@formula\expandafter{\expandafter(\ST@current@formula)}}%
- \relax
+ {}%
\let\ST@tobereplaced\ST@function@namefound
\ST@expadd@tomacro\ST@tobereplaced{\expandafter(\ST@function@argfound)}%
\let\ST@replaced\ST@tobereplaced
@@ -1013,7 +979,7 @@
\let\ST@tobereplaced\ST@function@namefound\ST@expadd@tomacro\ST@tobereplaced{\expandafter(\ST@function@argfound)}%
\csname ST@func@\ST@function@namefound\endcsname\ST@function@argfound\ST@result@func% puis on essaie d'\'evaluer la fonction
\unless\ifx\ST@result@func\@empty% si le calcul a abouti
- \ST@Iffirstis\ST@result@func-{\expandafter\def\expandafter\ST@result@func\expandafter{\expandafter(\ST@result@func)}}\relax
+ \ST@Iffirstis\ST@result@func-{\expandafter\def\expandafter\ST@result@func\expandafter{\expandafter(\ST@result@func)}}{}%
\expandafter\ST@expsubst\csname formula@#1@#2\endcsname\ST@tobereplaced\ST@result@func% on replace dans la formule
\edef\ST@stackcall{(#1,#2)\ST@stackcall}% puis, on \'evalue \'a nouveau cette cellule
\fi
@@ -1035,7 +1001,8 @@
\expandafter\let\expandafter\ST@current@formula\csname text@\ST@temp@formula\endcsname% alias pour la zone texte distante
\StrDel[1]\ST@current@formula\STnumericfieldmarker[\ST@current@formula]% on enl\`eve le := si besoin
\ST@Ifinstr\ST@current@formula{\@empty\multicolumn}% on ne prend que le texte s'il y a un \multicolumn qui traine
- {\ST@thirdarg@after\ST@current@formula\multicolumn\ST@current@formula}\relax
+ {\ST@thirdarg@after\ST@current@formula\multicolumn\ST@current@formula}
+ {}%
\let\ST@tobereplaced\ST@function@namefound
\ST@expadd@tomacro\ST@tobereplaced{\expandafter(\ST@function@argfound)}%
\ST@subst\ST@tobereplaced|{}%
@@ -1043,7 +1010,7 @@
\expandafter\ST@expsubst\csname formula@#1@#2\endcsname\ST@tobereplaced\ST@result@func
\edef\ST@stackcall{(#1,#2)\ST@stackcall}% puis, on \'evalue \'a nouveau cette cellule
\else
- \PackageError\ST@package@name{Macro function \ST@function@namefound\space requires a reference to a text cell!}\ST@seedoc@i
+ \PackageError\STname{Macro function \ST@function@namefound\space requires a reference to a text cell!}\ST@seedoc@i
\fi
\fi
\fi
@@ -1054,7 +1021,7 @@
% On regarde s'il y a des appels de calcul de cellules en attente
% Si oui, on enl\`eve le 1er appel de la pile lifo et on l'ex\'ecute
-\newcommand\ST@next@onstack{%
+\def\ST@next@onstack{%
\unless\ifx\ST@stackcall\@empty
\ST@split\ST@stackcall)\ST@temp@a\ST@stackcall
\ST@add@tomacro\ST@temp@a)%
@@ -1064,12 +1031,12 @@
\fi
}
-\newcommand\ST@sanitize@stack{% enl\`eve de \ST@stackcall toutes les occurrences de \ST@temp@a
+\def\ST@sanitize@stack{% enl\`eve de \ST@stackcall toutes les occurrences de \ST@temp@a
\ST@Ifinstr\ST@stackcall\ST@temp@a
{\expandafter\ST@subst\expandafter\ST@stackcall\expandafter{\ST@temp@a}{}%
\ST@sanitize@stack
}%
- \relax
+ {}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1077,37 +1044,37 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% liste des fonctions dont l'argument est num\'erique
-\newcommand\ST@functions@with@num@arg{%
+\def\ST@functions@with@num@arg{%
id,fact,ifeq,ifgt,iflt,numtofrshortdate,numtoengshortdate,numtofrlongdate,gcd,lcm,%
numtoenglongdate,numtofrmonth,numtoengmonth,numtofrday,numtoengday}
% liste des fonctions dont l'argument est une plage ou est vide
-\newcommand\ST@functions@with@range@arg{sum,rand,randint,sumprod}
+\def\ST@functions@with@range@arg{sum,rand,randint,sumprod}
% liste des fonctions dont l'argument est un texte
-\newcommand\ST@functions@with@text@arg{frshortdatetonum,engshortdatetonum,englongdatetonum,frlongdatetonum,scitodec,tag,row,col,cell}
+\def\ST@functions@with@text@arg{frshortdatetonum,engshortdatetonum,englongdatetonum,frlongdatetonum,scitodec,tag,row,col,cell,value}
% liste des fonctions dont l'argument ne doit pas \^etre calcul\'e
-\newcommand\ST@functions@no@calc@arg{ifeq,ifgt,iflt,gcd,lcm}
+\def\ST@functions@no@calc@arg{ifeq,ifgt,iflt,gcd,lcm,value}
% liste des fonctions dont l'argument est une variable -> il ne faut donc pas aller chercher des r\'ef\'erences dans l'argument
-\newcommand\ST@functions@with@assign@argument{tag,row,col,cell}
+\def\ST@functions@with@assign@argument{tag,row,col,cell,value}
% liste des fonctions dont le r\'esultat est un texte
-\newcommand\ST@functions@with@textresult{%
+\def\ST@functions@with@textresult{%
numtofrshortdate,numtoengshortdate,numtofrlongdate,numtoenglongdate,%
numtofrmonth,numtoengmonth,numtofrday,numtoengday}
% liste totale des fonctions
\edef\ST@functions@list{\ST@functions@with@range@arg,\ST@functions@with@num@arg,\ST@functions@with@text@arg}
-\newcommand\ST@for[2]{% \ST@for{#1}{code} -> ex\'ecute le code pour toutes les cellules des plages pass\'ees en argument #1
+\def\ST@for#1#2{% \ST@for{#1}{code} -> ex\'ecute le code pour toutes les cellules des plages pass\'ees en argument #1
\def\ST@forcode{#2}%
\expandafter\def\expandafter\ST@for@rangelist\expandafter{#1;}%
\ST@for@i
}
-\newcommand\ST@for@loopcode{% #2 est le code \'a ex\'ecuter dans la boucle for
+\def\ST@for@loopcode{% #2 est le code \'a ex\'ecuter dans la boucle for
\ST@forcode% on ex\'ecute le code
\let\ST@nextfor\ST@for@loopcode
\advance\ST@colcount@i\@ne
@@ -1122,17 +1089,17 @@
\ST@nextfor
}
-\newcommand\ST@for@i{%
+\def\ST@for@i{%
\ST@left\ST@for@rangelist;\ST@for@currentrange
\ST@left{\ST@for@currentrange:}{\@empty:}\ST@temp@a
- \ST@ifref\ST@temp@a\relax\ST@invalid@range
+ \ST@ifref\ST@temp@a{}\ST@invalid@range
\let\ST@for@col@start\ST@distant@colnumber
\let\ST@for@row@start\ST@distant@rownumber
\ST@colcount@i\ST@distant@colnumber
\ST@rowcount@i\ST@distant@rownumber
\ST@Ifinstr\ST@for@currentrange{\@empty:}%
{\ST@right\ST@for@currentrange{\@empty:}\ST@temp@a
- \ST@ifref\ST@temp@a\relax\ST@invalid@range
+ \ST@ifref\ST@temp@a{}\ST@invalid@range
\let\ST@for@col@end\ST@distant@colnumber
\let\ST@for@row@end\ST@distant@rownumber
\let\ST@nextfor\ST@for@loopcode
@@ -1153,19 +1120,19 @@
% Cette macro cherche dans la sc #1 la premi\`ere fonction qu'elle trouve ne contenant pas d'autre fonction dans son argument
% En sortie, \ST@function@namefound contient le nom de la fonction trouv\'ee et \ST@function@argfound son argument.
% Si aucune fonction mot-cl\'e n'est trouv\'e, ces 2 derni\`eres s\'equences de contr\^oles sont vides.
-\newcommand\ST@find@first@func[1]{%
+\def\ST@find@firST@func#1{%
\let\ST@function@namefound\@empty\let\ST@function@argfound\@empty
\let\ST@function@namefound@\@empty\let\ST@function@argfound@\@empty
\let\ST@tempfunc#1%
- \ST@find@first@func@i
+ \ST@find@firST@func@i
}
-\newcommand\ST@find@first@func@i{%
+\def\ST@find@firST@func@i{%
\edef\ST@tempfunctions@list{\ST@functions@list,}% r\'einitialise la liste
\let\ST@tempfunc@\ST@tempfunc% sauveagrde pour restauration ult\'erieure
\let\ST@function@namefound\@empty% initialise avant appel \'a la macro
\ST@Ifinstr\ST@tempfunc(% s'il y a une parenth\`ese
- {\ST@find@first@func@ii% cherche la 1ere fonction dans l'argument
+ {\ST@find@firST@func@ii% cherche la 1ere fonction dans l'argument
\ifx\ST@function@namefound\@empty% elle n'existe pas ?
\let\ST@function@namefound\ST@function@namefound@\let\ST@function@argfound\ST@function@argfound@% on restaure les valeurs pr\'ec\'edentes
\else% si il y a une fonction dans l'argument
@@ -1173,12 +1140,12 @@
\ST@seekfunc@arg\ST@tempfunc\ST@function@argfound% isole l'argument entre parenth\`eses
\let\ST@function@namefound@\ST@function@namefound\let\ST@function@argfound@\ST@function@argfound% met \'a jour les valeurs pr\'ec\'edentes
\let\ST@tempfunc\ST@function@argfound% recommence avec l'argument
- \expandafter\ST@find@first@func@i
+ \expandafter\ST@find@firST@func@i
\fi}%
{\let\ST@function@namefound\ST@function@namefound@\let\ST@function@argfound\ST@function@argfound@}%
}
-\newcommand\ST@find@first@func@ii{%
+\def\ST@find@firST@func@ii{%
\unless\ifx\ST@tempfunc\@empty% tant que le contenu n'est pas vide
\unless\ifx\ST@tempfunctions@list\@empty% et tant que tous les noms de fonctions n'ont pas \'et\'e explor\'es
\ST@split\ST@tempfunctions@list,\ST@current@funcname\ST@tempfunctions@list
@@ -1186,8 +1153,8 @@
{\let\ST@function@namefound\ST@current@funcname
\ST@left\ST@tempfunc{\ST@current@funcname(}\ST@tempfunc% on r\'eduit l'argument \'a ce qui est avant ce nom
}%
- \relax
- \expandafter\expandafter\expandafter\ST@find@first@func@ii
+ {}%
+ \expandafter\expandafter\expandafter\ST@find@firST@func@ii
\fi
\fi
}
@@ -1195,24 +1162,27 @@
% la sc #1 commence normalement (sinon, ça va gueuler) par une parenth\`ese
% La macro trouve l'argument se trouvant entre les parenth\`eses les plus ext\'erieures
% et l'assigne \'a la sc #2
-\newcommand\ST@seekfunc@arg[2]{%
+\def\ST@seekfunc@arg#1#2{%
\begingroup
\everyeof{\ST@nil}% met un \@nil \`a la fin du fichier virtuel
\endlinechar\m@ne
\catcode\z@12
\catcode`(=1 \catcode`)=2
\afterassignment\ST@gobble@remain
- \expandafter\def\expandafter\ST@temp@a\scantokens\expandafter{#1}%
+ \expandafter\def\expandafter\ST@temp@a\scantokens\expandafter{#1}% Attentionn !!! Il peut rester des ) non équilibrées
\catcode`(=12 \catcode`)=12
\def\ST@assign@result##1\ST@nil{\endgroup\def#2{##1}}%
\expandafter\ST@assign@result\scantokens\expandafter{\ST@temp@a}% on fait l'assignation
}
-\newcommand\ST@func@sum[2]{% #1 est la sc contenant la plage de valeurs, #2 est la sc recevant le r\'esultat
+\def\ST@func@sum#1#2{% #1 est la sc contenant la plage de valeurs, #2 est la sc recevant le r\'esultat
\def#2{0}% r\'esultat nul pour l'instant
\let\ST@temp@stack\@empty% pile d'appel temporaire vide aussi au d\'ebut
\ST@for{#1}% on parcourt la <plage de cellules>
- {\ifcase\csname code@\number\ST@colcount@i @\number\ST@rowcount@i\endcsname\relax% on ne prend en compte que les code 1 et 2
+ {\ifnum\numexpr10000*(\ST@colcount@i-\ST@current@colnumber)+\ST@rowcount@i-\ST@current@rownumber=\z@
+ \ST@invalid@range% si la cellule courante est dans la plage, erreur
+ \fi
+ \ifcase\csname code@\number\ST@colcount@i @\number\ST@rowcount@i\endcsname\relax% on ne prend en compte que les code 1 et 2
\or% code=1
\edef\ST@temp@stack{\ST@temp@stack(\number\ST@colcount@i,\number\ST@rowcount@i)}%
\or% code=2
@@ -1230,15 +1200,15 @@
\fi
}
-\newcommand\ST@func@sumprod[2]{% #1 est la sc contenant la plage de valeurs, #2 est la sc recevant le r\'esultat
+\def\ST@func@sumprod#1#2{% #1 est la sc contenant la plage de valeurs, #2 est la sc recevant le r\'esultat
\ST@left{#1;};\ST@firstmat
\ST@right#1;\ST@othermat
\ST@left\ST@firstmat{\@empty:}\ST@temp@a
- \ST@ifref\ST@temp@a\relax\ST@invalid@range
+ \ST@ifref\ST@temp@a{}\ST@invalid@range
\let\ST@mat@firstcol\ST@distant@colnumber
\let\ST@mat@firstrow\ST@distant@rownumber
\StrBehind\ST@firstmat{\@empty:}[\ST@temp@a]%
- \ST@ifref\ST@temp@a\relax\ST@invalid@range
+ \ST@ifref\ST@temp@a{}\ST@invalid@range
\edef\ST@matcol{\number\numexpr\ST@distant@colnumber-\ST@mat@firstcol}%
\edef\ST@matrow{\number\numexpr\ST@distant@rownumber-\ST@mat@firstrow}%
\ST@count\@ne
@@ -1247,13 +1217,13 @@
\ST@left{\ST@othermat;};\ST@currentmat
\ST@right{\ST@othermat;};\ST@othermat
\ST@left{\ST@currentmat:}{\@empty:}\ST@temp@a
- \ST@ifref\ST@temp@a\relax\ST@invalid@range
+ \ST@ifref\ST@temp@a{}\ST@invalid@range
\let\ST@currentmatcol\ST@distant@colnumber
\let\ST@currentmatrow\ST@distant@rownumber
\expandafter\edef\csname ST@vectorcol@\romannumeral\ST@count\endcsname{\number\numexpr\ST@distant@colnumber-\ST@mat@firstcol}%
\expandafter\edef\csname ST@vectorrow@\romannumeral\ST@count\endcsname{\number\numexpr\ST@distant@rownumber-\ST@mat@firstrow}%
\ST@right\ST@currentmat{\@empty:}\ST@temp@a
- \ST@ifref\ST@temp@a\relax\ST@invalid@range
+ \ST@ifref\ST@temp@a{}\ST@invalid@range
\edef\ST@currentmatcol{\number\numexpr\ST@distant@colnumber-\ST@currentmatcol}%
\edef\ST@currentmatrow{\number\numexpr\ST@distant@rownumber-\ST@currentmatrow}%
\unless\ifnum\ST@matcol=\ST@currentmatcol\ST@unmatch@matrixdim\fi% la dimension horizontale ne correspond pas
@@ -1299,10 +1269,10 @@
\fi
}
-\newcommand\ST@func@id[2]{\expandafter\def\expandafter#2\expandafter{#1}}
+\def\ST@func@id#1#2{\expandafter\def\expandafter#2\expandafter{#1}}
% Calcule la factorielle du nombre #1 et met le r\'esultat dans la sc #2
-\newcommand\ST@func@fact[2]{%
+\def\ST@func@fact#1#2{%
\FPifint{#1}%
\FPifgt{#1}{18}%
\ST@fact@outofrange
@@ -1321,7 +1291,7 @@
}
\newif\ifST@gcd
-\newcommand\ST@arithmetic[2]{% #1 est une liste de nombres s\'epar\'es par des virgules, #2 la sc qui reçoit leur pgcd ou ppcm selon \ifST@gcd
+\def\ST@arithmetic#1#2{% #1 est une liste de nombres s\'epar\'es par des virgules, #2 la sc qui reçoit leur pgcd ou ppcm selon \ifST@gcd
\ST@split{#1},#2\ST@argB
\ST@Ifinstr\ST@argB,{\ST@split\ST@argB,\ST@argB\ST@remain\let\ST@next\ST@arithmetic}{\let\ST@remain\@empty\let\ST@next\@gobbletwo}%
\let\ST@argA#2%
@@ -1342,45 +1312,45 @@
\expandafter\expandafter\expandafter\ST@next\expandafter\expandafter\expandafter{\expandafter#2\expandafter,\ST@remain}#2%
}
-\newcommand\ST@func@gcd[2]{% #1 est une liste de nombres s\'epar\'es par des virgules, #2 la sc qui reçoit leur pgcd
+\def\ST@func@gcd#1#2{% #1 est une liste de nombres s\'epar\'es par des virgules, #2 la sc qui reçoit leur pgcd
\ST@gcdtrue\ST@arithmetic{#1}#2%
}
-\newcommand\ST@func@lcm[2]{% #1 est une liste de nombres s\'epar\'es par des virgules, #2 la sc qui reçoit leur ppcm
+\def\ST@func@lcm#1#2{% #1 est une liste de nombres s\'epar\'es par des virgules, #2 la sc qui reçoit leur ppcm
\ST@gcdfalse\ST@arithmetic{#1}#2%
}
% d\'etermine la graine pour fp en fonction de la date et de l'heure
-\newcommand\ST@seed{\FPseed\number\time\number\day\number\month}
+\def\ST@seed{\FPseed\number\time\number\day\number\month}
% la fonction randint
-\newcommand\ST@func@randint[2]{% #1=sc contenant l'argument #2: sc recevant le r\'esultat
+\def\ST@func@randint#1#2{% #1=sc contenant l'argument #2: sc recevant le r\'esultat
\ST@Ifinstr#1,% s'il y a 2 nombres -> intervalle [nb1;nb2]
{\ST@split#1,\ST@limita\ST@limitb
- \FPifeq\ST@limita\ST@limitb\PackageError\ST@package@name{Macro function randint require two different numbers}\ST@seedoc@i\fi
+ \FPifeq\ST@limita\ST@limitb\PackageError\STname{Macro function randint require two different numbers}\ST@seedoc@i\fi
\FPifgt\ST@limita\ST@limitb
\let\ST@temp@a\ST@limitb\let\ST@limitb\ST@limita\let\ST@limita\ST@temp@a
\fi
- \FPifint\ST@limita\else\PackageError\ST@package@name{Macro function randint require integer argument}\ST@seedoc@i\fi
- \FPifint\ST@limitb\else\PackageError\ST@package@name{Macro function randint require integer argument}\ST@seedoc@i\fi
+ \FPifint\ST@limita\else\ST@intarg@required\fi
+ \FPifint\ST@limitb\else\ST@intarg@required\fi
\FPrandom#2%
\FPeval#2{trunc(trunc(#2*(\ST@limitb-\ST@limita+1),0)+\ST@limita,0)}%
}%
- {\FPifint#1\else\PackageError\ST@package@name{Macro function randint require integer argument}\ST@seedoc@i\fi
+ {\FPifint#1\else\ST@intarg@required\fi
\FPrandom#2% s'il n'y a qu'un nombre -> intervalle [0;nb2]
\FPeval#2{trunc(#2*(#1+1),0)}%
}%
}
-\newcommand\ST@func@rand[2]{% #1=sc contenant l'argument (ignor\'e) #2: sc recevant le r\'esultat
- \FPrandom#2%
-}
+\def\ST@func@rand#1#2{\FPrandom#2}% #1=sc contenant l'argument (ignor\'e) #2: sc recevant le r\'esultat
+
+\def\ST@genzeros#1{\if#1m0\expandafter\ST@genzeros\fi}
-\newcommand\ST@genzeros[1]{\if#1m0\expandafter\ST@genzeros\fi}
-\newcommand\ST@powerten[2]{% g\'en\`ere 10^abs(#1) dans la sc #2
+\def\ST@powerten#1#2{% g\'en\`ere 10^abs(#1) dans la sc #2
\edef#2{1\expandafter\ST@genzeros\romannumeral\number\ifnum#1<\z@-\fi#1000\relax}%
}
-\newcommand\ST@func@scitodec[2]{% #1=sc contenant l'argument #2: sc recevant le r\'esultat
+
+\def\ST@func@scitodec#1#2{% #1=sc contenant l'argument #2: sc recevant le r\'esultat
\expandafter\lowercase\expandafter{\expandafter\def\expandafter#1\expandafter{#1}}%
\ST@Ifinstr#1{ee}% on regarde s'il y a "ee"
{\ST@split#1{ee}\ST@mantissa\ST@exposant
@@ -1388,16 +1358,16 @@
\csname FP\ifnum\ST@exposant<\z@ div\else mul\fi\endcsname#2\ST@mantissa\ST@tenpow}%
{\IfDecimal#1%
{\let#2#1}%
- {\PackageError\ST@package@name{Illegal number in scitodec argument}\ST@seedoc@i}}%
+ {\PackageError\STname{Illegal number in scitodec argument}\ST@seedoc@i}}%
}
% les fonctions de test
-\def\ST@list@offour#1,#2,#3,#4\@nil{%
+\def\ST@liST@offour#1,#2,#3,#4\@nil{%
\def\ST@argA{#1}\def\ST@argB{#2}\def\ST@argC{#3}\def\ST@argD{#4}%
}
-\newcommand\ST@def@funcif[3]{%
- \expandafter\ST@list@offour#1\@nil
+\def\ST@def@funcif#1#2#3{%
+ \expandafter\ST@liST@offour#1\@nil
\FPeval\ST@argA\ST@argA\FPeval\ST@argB\ST@argB
\csname FPif#3\endcsname\ST@argA\ST@argB
\FPset#2\ST@argC
@@ -1406,12 +1376,12 @@
\fi
}
-\newcommand\ST@func@ifeq[2]{\ST@def@funcif#1#2{eq}}
-\newcommand\ST@func@ifgt[2]{\ST@def@funcif#1#2{gt}}
-\newcommand\ST@func@iflt[2]{\ST@def@funcif#1#2{lt}}
+\def\ST@func@ifeq#1#2{\ST@def@funcif#1#2{eq}}
+\def\ST@func@ifgt#1#2{\ST@def@funcif#1#2{gt}}
+\def\ST@func@iflt#1#2{\ST@def@funcif#1#2{lt}}
% Transforme une date en nombre
-\newcommand\ST@datetonum[4]{% #1=sc recevant le r\'esultat #2=jj #3=mm #4=aa
+\def\STdatetonum#1#2#3#4{% #1=sc recevant le r\'esultat #2=jj #3=mm #4=aa
\FPeval#1{#3+9-12*trunc((#3+9)/12,0)}%
\FPeval\ST@@@year{#4-trunc(#1/10,0)}%
\FPeval#1{365*\ST@@@year+trunc(\ST@@@year/4,0)-trunc(\ST@@@year/100,0)+trunc(\ST@@@year/400,0)+trunc((#1*306+5)/10,0)+#2-1}%
@@ -1419,7 +1389,7 @@
}
% Transforme un nombre en une date
-\newcommand\ST@numtodate[4]{% #1=nombre repr\'esentant la date #2=jour #3=mois #4=ann\'ee
+\def\ST@numtodate#1#2#3#4{% #1=nombre repr\'esentant la date #2=jour #3=mois #4=ann\'ee
\FPeval#4{trunc((10000*#1+14780)/3652425,0)}%
\FPeval#2{#1-(365*#4+trunc(#4/4,0)-trunc(#4/100,0)+trunc(#4/400,0))}%
\FPifneg#2%
@@ -1432,83 +1402,79 @@
\FPeval#3{#3+2-12*trunc((#3+2)/12,0)+1}\FPclip#3#3%
}
-\def\ST@parse@datefr#1/#2/#3\@nil{%
- \def\ST@@@day{#1}\def\ST@@@month{#2}\def\ST@@@year{#3}%
-}
+\def\ST@parse@datefr#1/#2/#3\@nil{\def\ST@@@day{#1}\def\ST@@@month{#2}\def\ST@@@year{#3}}
-\def\ST@parse@dateeng#1/#2/#3\@nil{%
- \def\ST@@@day{#3}\def\ST@@@month{#2}\def\ST@@@year{#1}%
-}
+\def\ST@parse@dateeng#1/#2/#3\@nil{\def\ST@@@day{#3}\def\ST@@@month{#2}\def\ST@@@year{#1}}
% transforme une date française courte du type jj/mm/aaaa en nombre
-\newcommand\ST@func@frshortdatetonum[2]{% #1=sc \'etant l'argument jj/mm/aaaa #2=sc recevant le r\'esultat
+\def\ST@func@frshortdatetonum#1#2{% #1=sc \'etant l'argument jj/mm/aaaa #2=sc recevant le r\'esultat
\expandafter\ST@parse@datefr#1\@nil
- \ST@datetonum#2\ST@@@day\ST@@@month\ST@@@year
+ \STdatetonum#2\ST@@@day\ST@@@month\ST@@@year
}
% Transforme un nombre en une date française de type jj/mm/aaaa
-\newcommand\ST@func@numtofrshortdate[2]{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
+\def\ST@func@numtofrshortdate#1#2{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
\ST@numtodate#1\ST@@@day\ST@@@month\ST@@@year
\edef#2{\ST@@@day/\ST@@@month/\ST@@@year}%
}
% Transforme un nombre en une date longue française du type «14 juillet 1789»
-\newcommand\ST@func@numtofrlongdate[2]{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
+\def\ST@func@numtofrlongdate#1#2{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
\ST@numtodate#1\ST@@@day\ST@@@month\ST@@@year
\edef#2{\ST@@@day\space\ifcase\ST@@@month\or janvier\or f\'evrier\or mars\or avril\or mai\or
juin\or juillet\or ao\^ut\or septembre\or octobre \or novembre\or d\'ecembre\fi\space\ST@@@year}%
}
% Extrait d'un nombre repr\'esentant une date le mois en toutes lettres en français
-\newcommand\ST@func@numtofrmonth[2]{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
+\def\ST@func@numtofrmonth#1#2{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
\ST@numtodate#1\ST@@@day\ST@@@month\ST@@@year
\edef#2{\ifcase\ST@@@month\or janvier\or f\'evrier\or mars\or avril\or mai\or
juin\or juillet\or ao\^ut\or septembre\or octobre \or novembre\or d\'ecembre\fi}%
}
% Extrait d'un nombre rep\'esentant une date le nom du jour en français
-\newcommand\ST@func@numtofrday[2]{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
+\def\ST@func@numtofrday#1#2{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
\FPeval\ST@@@day{#1-7*trunc(#1/7,0)}\FPclip\ST@@@day\ST@@@day
\edef#2{\ifcase\ST@@@day mercredi\or jeudi\or vendredi\or samedi\or dimanche\or lundi\or mardi\fi}
}
% transforme une date anglaise courte du type aaaa/mm/jj en nombre
-\newcommand\ST@func@engshortdatetonum[2]{% #1=sc \'etant l'argument aaaa/mm/jj #2=sc recevant le r\'esultat
+\def\ST@func@engshortdatetonum#1#2{% #1=sc \'etant l'argument aaaa/mm/jj #2=sc recevant le r\'esultat
\expandafter\ST@parse@dateeng#1\@nil
- \ST@datetonum#2\ST@@@day\ST@@@month\ST@@@year
+ \STdatetonum#2\ST@@@day\ST@@@month\ST@@@year
}
% Transforme un nombre en une date anglaise de type aaaa/mm/jj
-\newcommand\ST@func@numtoengshortdate[2]{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
+\def\ST@func@numtoengshortdate#1#2{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
\ST@numtodate#1\ST@@@day\ST@@@month\ST@@@year
\edef#2{\ST@@@year/\ST@@@month/\ST@@@day}
}
% Transforme un nombre en une date longue anglaise du type «July 14, 1789»
-\newcommand\ST@func@numtoenglongdate[2]{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
+\def\ST@func@numtoenglongdate#1#2{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
\ST@numtodate#1\ST@@@day\ST@@@month\ST@@@year
\edef#2{\ifcase\ST@@@month\or January\or February\or March\or April\or May\or
June\or July\or August\or September\or October\or November\or December\fi\space\ST@@@day,\space\ST@@@year}%
}
% Extrait d'un nombre repr\'esentant une date le mois en toutes lettres en anglais
-\newcommand\ST@func@numtoengmonth[2]{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
+\def\ST@func@numtoengmonth#1#2{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
\ST@numtodate#1\ST@@@day\ST@@@month\ST@@@year
\edef#2{\ifcase\ST@@@month\or January\or February\or March\or April\or May\or
June\or July\or August\or September\or October\or November\or December\fi}%
}
% Extrait d'un nombre rep\'esentant une date le nom du jour en anglais
-\newcommand\ST@func@numtoengday[2]{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
+\def\ST@func@numtoengday#1#2{% % #1=nombre repr\'esentant la date #2=sc recevant le r\'esultat
\FPeval\ST@@@day{#1-7*trunc(#1/7,0)}\FPclip\ST@@@day\ST@@@day
\edef#2{\ifcase\ST@@@day wednesday\or thursday\or friday\or saturday\or sunday\or monday\or tuesday\fi}
}
% Teste si la date contenue dans les 3 sc #1 (jour) #2(mois) #3(ann\'ee) est valide. Sinon, envoie un message d'erreur
-\newcommand\ST@test@date@validity[3]{%
- \IfInteger#1\relax\ST@invalid@date
- \IfInteger#2\relax\ST@invalid@date
- \IfInteger#3\relax\ST@invalid@date
+\def\ST@teST@date@validity#1#2#3{%
+ \IfInteger#1{}\ST@invalid@date
+ \IfInteger#2{}\ST@invalid@date
+ \IfInteger#3{}\ST@invalid@date
\ifnum#2<\@ne\ST@invalid@date\fi
\ifnum#2>12 \ST@invalid@date\fi
\ifnum#1<\@ne\ST@invalid@date\fi
@@ -1517,13 +1483,13 @@
}
% Transforme une date anglaise longue du type «July 14, 1789» en un nombre
-\newcommand\ST@func@englongdatetonum[2]{% #1=sc contenant la date longue #2=sc recevant le r\'esultat
+\def\ST@func@englongdatetonum#1#2{% #1=sc contenant la date longue #2=sc recevant le r\'esultat
\ST@analyse@text@engdate#1\ST@@@day\ST@@@month\ST@@@year
- \ST@datetonum#2\ST@@@day\ST@@@month\ST@@@year
+ \STdatetonum#2\ST@@@day\ST@@@month\ST@@@year
}
-\newcommand\ST@analyse@text@engdate[4]{% #1=texte repr\'esentant la date #2=jour #3=n° mois #4=ann\'ee
- \ST@remove@first@spaces#1%
+\def\ST@analyse@text@engdate#1#2#3#4{% #1=texte repr\'esentant la date #2=jour #3=n° mois #4=ann\'ee
+ \ST@remove@firST@spaces#1%
\def\ST@today{\today}%
\ifx#1\ST@today
\edef#2{\number\day}\edef#3{\number\month}\edef#4{\number\year}%
@@ -1547,28 +1513,28 @@
}[\def#3{-1}]%
\ST@right#1\space#2%
\ST@Ifinstr#2,{\ST@split#2,#2#4}{\ST@split#2{ }#2#4}%
- \IfInteger#2\relax{\edef#2{\number\integerpart}}%
+ \IfInteger#2{}{\edef#2{\number\integerpart}}%
\ST@removespaces#4%
- \ST@test@date@validity#2#3#4%
+ \ST@teST@date@validity#2#3#4%
\fi
}
% Transforme une date anglaise longue du type «14 juillet 1789» en un nombre
-\newcommand\ST@func@frlongdatetonum[2]{% #1=sc contenant la date longue #2=sc recevant le r\'esultat
+\def\ST@func@frlongdatetonum#1#2{% #1=sc contenant la date longue #2=sc recevant le r\'esultat
\ST@analyse@text@frdate#1\ST@@@day\ST@@@month\ST@@@year
- \ST@datetonum#2\ST@@@day\ST@@@month\ST@@@year
+ \STdatetonum#2\ST@@@day\ST@@@month\ST@@@year
}
\def\ST@utfencoding{utf8}
-\newcommand\ST@analyse@text@frdate[4]{% #1=texte repr\'esentant la date #2=jour #3=n° mois #4=ann\'ee
- \ST@remove@first@spaces#1%
+\def\ST@analyse@text@frdate#1#2#3#4{% #1=texte repr\'esentant la date #2=jour #3=n° mois #4=ann\'ee
+ \ST@remove@firST@spaces#1%
\def\ST@today{\today}%
\ifx#1\ST@today
\edef#2{\number\day}\edef#3{\number\month}\edef#4{\number\year}%
\else
\ST@split#1{ }#2#3%
- \IfInteger#2\relax{\edef#2{\number\integerpart}}%
+ \IfInteger#2{}{\edef#2{\number\integerpart}}%
\ST@split#3{ }#3#4%
\ST@removespaces#3%
\def\ST@e{^^e9}\def\ST@u{^^fb}% \'e et û en latin1
@@ -1583,15 +1549,16 @@
{avril}{\def#3{4}}{mai}{\def#3{5}}{juin}{\def#3{6}}%
{juillet}{\def#3{7}}{aout}{\def#3{8}}{septembre}{\def#3{9}}%
{octobre}{\def#3{10}}{novembre}{\def#3{11}}{decembre}{\def#3{12}}%
- }[\def#3{-1}]%
- \ST@test@date@validity#2#3#4%
+ }
+ [\def#3{-1}]%
+ \ST@teST@date@validity#2#3#4%
\fi
}
-\newcommand\ST@func@tag[2]{%
+\def\ST@func@tag#1#2{%
\let#2\@empty
\ifcsname ST@@\detokenize\expandafter{#1}\endcsname
- \PackageWarning\ST@package@name{The tag "\detokenize\expandafter{#1}" already exists, previous is lost.}%
+ \PackageWarning\STname{The tag "\detokenize\expandafter{#1}" already exists, previous is lost.}%
\fi
\expandafter\edef\csname ST@@\detokenize\expandafter{#1}\endcsname{\number\ST@colcount,\number\ST@rowcount}%
\ST@expadd@tomacro\ST@tag@list{%
@@ -1599,17 +1566,17 @@
\expandafter\ST@coord@toref\csname ST@@\detokenize\expandafter{#1}\endcsname
}
-\newcommand\ST@func@cell[2]{%
+\def\ST@func@cell#1#2{%
\unless\ifcsname ST@@\detokenize\expandafter{#1}\endcsname\ST@unknown@tag\fi
\edef#2{\csname ST@@\detokenize\expandafter{#1}\endcsname}%
}
-\newcommand\ST@func@row[2]{%
+\def\ST@func@row#1#2{%
\unless\ifcsname ST@@\detokenize\expandafter{#1}\endcsname\ST@unknown@tag\fi
\edef#2{\expandafter\expandafter\expandafter\@gobble\csname ST@@\detokenize\expandafter{#1}\endcsname}%
}
-\newcommand\ST@func@col[2]{%
+\def\ST@func@col#1#2{%
\unless\ifcsname ST@@\detokenize\expandafter{#1}\endcsname\ST@unknown@tag\fi
\edef#2{%
\number\numexpr
@@ -1617,7 +1584,15 @@
`\expandafter\expandafter\expandafter\@car\csname ST@@\detokenize\expandafter{#1}\endcsname\@nil-64}%
}
-% \newcommand\ST@func@timetosec[2]{%
+\def\ST@func@value#1#2{%
+ \ifcsname ST@celltag@\detokenize\expandafter{#1}\endcsname
+ \expandafter\let\expandafter#2\csname ST@celltag@\detokenize\expandafter{#1}\endcsname
+ \else
+ \PackageWarning\ST@package@name{The tag "\detokenize\expandafter{#1}" does not exists, have you defined it?}%
+ \def#2{0}% use 0 if tag undefined
+ \fi
+}
+% \def\ST@func@timetosec#1#2{%
% \ST@left{#1}:\ST@nb@hours
% \ST@right{#1}:\ST@nb@min
% \ST@Ifinstr\ST@nb@min:%
@@ -1629,7 +1604,7 @@
% \FPclip#2#2%
% }
%
-% \newcommand\ST@func@sectotime[2]{%
+% \def\ST@func@sectotime#1#2{%
% \FPeval\ST@nb@hours{trunc(#1/3600,0)}\FPclip\ST@nb@hours\ST@nb@hours
% \FPeval\ST@nb@min{trunc((#1-\ST@nb@hours*3600)/60,0)}\FPclip\ST@nb@min\ST@nb@min
% \FPeval\ST@nb@sec{#1-3600*\ST@nb@hours-60*\ST@nb@min}\FPclip\ST@nb@sec\ST@nb@sec
@@ -1642,19 +1617,19 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%% Construction du tableau \'a afficher %%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand\ST@search@lastshowcol{% cherche le num\'ero de la derni\`ere colonne non masqu\'ee
+\def\ST@search@lastshowcol{% cherche le num\'ero de la derni\`ere colonne non masqu\'ee
\ST@colcount\ST@total@colnumber% on commence par la fin
\ST@search@lastshowcol@i
}
-\newcommand\ST@search@lastshowcol@i{%
+\def\ST@search@lastshowcol@i{%
\ST@Ifinstr{\ST@col@skiplist}{\expandafter(\number\ST@colcount)}%
{\advance\ST@colcount\m@ne\ST@search@lastshowcol@i}%
{\edef\ST@lastshowcol{\number\ST@colcount}}%
}
% cherche "<<ref>>" dans la sc #1 et remplace toutes ces occurences par le champ num\'erique de "ref"
-\newcommand\ST@displaynumfields[1]{%
+\def\ST@displaynumfields#1{%
\StrBehind#1\ST@startdisplay[\ST@dipslaycell]%
\StrBefore\ST@dipslaycell\ST@enddisplay[\ST@dipslaycell]%
\let\ST@next\@gobble% \'a priori, on ne reboucle pas
@@ -1668,18 +1643,19 @@
\unless\ifx\ST@decsep\ST@decsepfp\ST@substdecsep\ST@dipslaycell\fi% subsitution du s\'eparateur d\'ecimal s'il y a lieu
\StrSubstitute#1\ST@next\ST@dipslaycell[#1]% on substitue <<ref>> par le champ num\'erique de la formule distante
\let\ST@next\ST@displaynumfields
- }\relax
+ }
+ {}%
\fi
\ST@next#1%
}
-\newcommand\ST@build@tab{%
+\def\ST@build@tab{%
\ST@rowcount\@ne\ST@colcount\@ne
\expandafter\ST@expadd@tomacro\expandafter\ST@tab\csname endrow@0\endcsname% la (ou les) \'eventuelle ligne sup\'erieure du tableau
\ST@build@tab@i
}
-\newcommand\ST@build@tab@i{% reconstitue le tableau \'a partir des valeurs calcul\'ees et des cellules
+\def\ST@build@tab@i{% reconstitue le tableau \'a partir des valeurs calcul\'ees et des cellules
\ifnum\ST@rowcount>\ST@total@rownumber
\let\ST@nextcell\relax
\else
@@ -1704,7 +1680,8 @@
\ST@displaynumfields\ST@temp@a% affiche les champs num\'eriques des cellules entre << et >>
\noexploregroups
\ST@expadd@tomacro\ST@tab\ST@temp@a% on ajoute la cellule au tableau
- }\relax
+ }
+ {}%
}%
\advance\ST@colcount\@ne% on passe \'a la colonne suivante !
\ST@ifvalid@csname{code@\number\ST@colcount @\number\ST@rowcount}% y a t-il encore un code d\'efini ensuite ?
@@ -1714,7 +1691,7 @@
\advance\ST@colcount\m@ne
\ST@ifvalid@csname{code@\number\ST@colcount @\number\ST@rowcount}% y a t-il un code d\'efini apr\`es le multicol ?
{\ST@add@tomacro\ST@tab&}% on ajoute la tabulation
- \relax
+ {}%
\else% pas de \multicolumn
\unless\ifST@hiddencol% si la cellule n'est pas masqu\'ee
\unless\ifnum\ST@colcount>\ST@lastshowcol% si ce n'est pas la derni\`ere cellule affich\'ee
@@ -1724,7 +1701,7 @@
\fi}%
{\ST@ifvalid@csname{endrow@\number\ST@rowcount}%
{\expandafter\ST@expadd@tomacro\expandafter\ST@tab\csname endrow@\number\ST@rowcount\endcsname}% ajoute la fin de la ligne
- \relax
+ {}%
\ST@colcount\@ne% on remet la colonne \'a 1
\advance\ST@rowcount\@ne% on passe \'a la ligne suivante
}%
@@ -1734,27 +1711,23 @@
}
% format des lettres et nombres repr\'esentant les coordonn\'ees (helvetica gras tr\`es petit)
-\newcommand\ST@debugformat@headers{%
- \usefont{T1}{phv}{b}{n}%
-}
+\def\ST@debugformat@headers{\usefont{T1}{phv}{b}{n}}
% format utilis\'e pour les cellules
-\newcommand\ST@debug@format@cells{%
- \usefont{T1}{lmtt}{m}{n}%
-}
+\def\ST@debug@format@cells{\usefont{T1}{lmtt}{m}{n}}
-\newcommand\ST@colorcell{%
- \ifST@colortblloaded\noexpand\cellcolor[gray]{.6}\fi
-}
+\def\ST@colorcell{\ifST@colortblloaded\noexpand\cellcolor[gray]{.6}\fi}
-\newcommand\STdebug[1]{%
+\def\STdebug#1{%
\ST@debugmodetrue% on se met en mode d\'ebogage
\begingroup
\def\ST@debuginfo{#1}%
\ifmmode\scriptscriptstyle\else\scriptsize\fi
\def\ST@temp@a{formula}% pour n'afficher les fins de ligne que dans ce cas
\IfStrEqCase\ST@debuginfo{%
- {formula}\relax{text}\relax{code}\relax
+ {formula}{}%
+ {text}{}%
+ {code}{}%
}[\ST@illegaldebugcommand]%
\ST@debug@format@cells
\tabcolsep0.3em
@@ -1776,14 +1749,14 @@
\ifx\ST@temp@a\ST@debuginfo
\ST@ifvalid@csname{endrow@\number\ST@rowcount}%
{\detokenize\expandafter\expandafter\expandafter{\csname endrow@0\endcsname}}%
- \relax
+ {}%
\fi}%
\noexpand\\\noexpand\cline{2-\number\numexpr\ST@lastshowcol+1}%
}%
\ST@debug@tab@i
}
-\newcommand\ST@debug@tab@i{% affiche le tableau de d\'ebobage
+\def\ST@debug@tab@i{% affiche le tableau de d\'ebobage
\ifnum\ST@rowcount>\ST@total@rownumber
\ST@edefadd@tomacro\ST@debugtab{\noexpand\cline{2-\number\numexpr\ST@lastshowcol+1}\noexpand\end{tabular}}%
\ST@debugtab% affichage du tableau de d\'ebogage
@@ -1807,7 +1780,7 @@
\ifx\ST@temp@a\ST@debuginfo
\ST@ifvalid@csname{endrow@\number\ST@rowcount}%
{\detokenize\expandafter\expandafter\expandafter{\csname endrow@\number\ST@rowcount\endcsname}}%
- \relax
+ {}%
\fi}%
\noexpand\\\noexpand\cline{2-\number\numexpr\ST@lastshowcol+1}}%
\ST@colcount\@ne% on remet la colonne \'a 1
@@ -1825,32 +1798,30 @@
% d\'efinit quelle sera le s\'equence de conytr\^ole qui finira les lignes
% dans les tableaux de spreadtab
-\newcommand*\STeol[1]{\def\ST@eol{#1}}
+\def\STeol#1{\def\ST@eol{#1}}
\STeol\\
% renvoie la valeur num\'erique de la cellule de tag #1
-\newcommand\STtag[1]{%
- \ifcsname ST@celltag@\detokenize\expandafter{#1}\endcsname\expandafter\@firstoftwo\else\expandafter\@scondoftwo\fi
+\def\STtag#1{%
+ \ifcsname ST@celltag@\detokenize\expandafter{#1}\endcsname\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
{\csname ST@celltag@\detokenize\expandafter{#1}\endcsname}
- {\PackageError\ST@package@name{Tag "#1" is unknown, have you defined it?}\ST@seedoc@i}%
-}
-
-\newcommand*\STmakegtag[1]{%
- \STmakegtag@i#1,\STmakegtag@i,%
+ {\PackageError\STname{Tag "#1" is unknown, have you defined it?}\ST@seedoc@i
+ }%
}
+\def\STmakegtag#1{\STmakegtag@i#1,\STmakegtag@i,}
\def\STmakegtag@i#1,{%
\ifx\STmakegtag@i#1%
\else
\def\ST@temp@a{#1}%
\ifx\@empty\ST@temp@a
- \PackageWarning\ST@package@name{An empty tag is ignored.}%
+ \PackageWarning\STname{An empty tag is ignored.}%
\else
\ifcsname ST@celltag@\detokenize\expandafter{#1}\endcsname
\global\expandafter\let\csname ST@celltag@\detokenize\expandafter{#1}\expandafter\endcsname
\csname ST@celltag@\detokenize\expandafter{#1}\endcsname
\else
- \PackageError\ST@package@name{Tag "#1" is unknown, have you defined it?}\ST@seedoc@i
+ \PackageError\STname{Tag "#1" is unknown, have you defined it?}\ST@seedoc@i
\fi
\fi
\expandafter\STmakegtag@i
@@ -1858,33 +1829,31 @@
}
% d\'efinit le s\'eparateur d\'ecimal
-\newcommand*\STsetdecimalsep[1]{\def\ST@decsep{#1}}
+\def\STsetdecimalsep#1{\def\ST@decsep{#1}}
\def\ST@decsepfp{.}% le s\'eparateur d\'ecimal donn\'e par fp
\STsetdecimalsep.% le point par d\'efaut
\STmessage{true}% affiche les messages par d\'efaut
\newif\ifST@clipround
-\newcommand*\STautoround{\@ifstar{\ST@cliproundfalse\ST@autoround}{\ST@cliproundtrue\ST@autoround}}
-\newcommand*\ST@autoround[1]{\def\ST@rounddigit{#1}}
+\def\STautoround{\@ifstar{\ST@cliproundfalse\ST@autoround}{\ST@cliproundtrue\ST@autoround}}
+\def\ST@autoround#1{\def\ST@rounddigit{#1}}
\STautoround{}% pas d'arrondi par d\'efaut
-\newcommand\STsavecell[2]{% met dans la sc #1 la valeur du champ num\'erique de la cellule sp\'ecifi\'ee par sa r\'ef\'erence ABSOLUE
+\def\STsavecell#1#2{% met dans la sc #1 la valeur du champ num\'erique de la cellule sp\'ecifi\'ee par sa r\'ef\'erence ABSOLUE
\def\ST@temp@ref{#2}%
- \ST@ifref\ST@temp@ref\relax\ST@illegal@ref
- \ST@Ifinstr\ST@temp@ref[\ST@illegal@ref\relax
+ \ST@ifref\ST@temp@ref{}\ST@illegal@ref
+ \ST@Ifinstr\ST@temp@ref[\ST@illegal@ref{}%
\expandafter\let\expandafter#1\csname formula@\ST@temp@formula\endcsname% le nombre est assign\'e \'a #1
\unless\ifx\ST@decsep\ST@decsepfp\ST@substdecsep#1\fi% et si le "." doit \^etre remplac\'e par "," on substitue
\global\let#1#1% on rend l'assignation globale
}
-\long\def\ST@get@body@env#1\end{%
- \expandafter\def\expandafter\ST@tab\expandafter{\ST@tab#1}\ST@find@end
-}
+\long\def\ST@get@body@env#1\end{\expandafter\def\expandafter\ST@tab\expandafter{\ST@tab#1}\ST@find@end}
-\newcommand\ST@find@end[1]{%
+\def\ST@find@end#1{%
\def\ST@temp@a{#1}%
- \ifx\ST@temp@a\ST@package@name
+ \ifx\ST@temp@a\STname
\expandafter\spreadtab@i
\else
\ST@add@tomacro\ST@tab{\end{#1}}%
@@ -1892,12 +1861,10 @@
\fi
}
-\long\def\ST@get@body@cs#1\endspreadtab{%
- \def\ST@tab{#1}\spreadtab@i
-}
+\long\def\ST@get@body@cs#1\endspreadtab{\def\ST@tab{#1}\spreadtab@i}
-\newcommand\spreadtab[2][]{%
- \ifx\ST@package@name\@currenvir% on vient d'un \begin{spreadtab} ?
+\newcommand*\spreadtab[2][]{%
+ \ifx\STname\@currenvir% on vient d'un \begin{spreadtab} ?
\endgroup
\let\ST@get@body\ST@get@body@env
\else
@@ -1915,15 +1882,15 @@
\let\ST@copylist\@empty
\let\ST@row@skiplist\@empty
\let\ST@col@skiplist\@empty
- \def\ST@last@skipcol{0}%
+ \def\ST@laST@skipcol{0}%
\edef\ST@previous@seed{\number\FPseed}% sauvegarde de la graine
\ST@seed% graine variable
- \ST@emit@message{New spreadtab: \string\begin\detokenize{#2}^^J* reading tab:}%
+ \ST@emit@message{^^JNew spreadtab: \string\begin\detokenize{#2}^^J* reading tab:}%
\let\ST@tab\@empty
\ST@get@body% met le code du tableau dans \ST@tab
}
-\newcommand\spreadtab@i{%
+\def\spreadtab@i{%
\let\ST@tag@list\@empty
\let\ST@ref@found\@empty
\ST@read@tab% analyse le tableau contenu dans \ST@tab
@@ -1938,7 +1905,8 @@
\def\STdisplaytab{%
\ST@debugmodefalse
\ST@emit@message{\space\space\space\space\space Debug mode: display final tab^^J}%
- \let\STdisplaytab\relax}%
+ \let\STdisplaytab\relax
+ }%
\ST@optcode% ex\'ecute l'argument optionnel en ne tenant compte que de \STdisplaytab s'il y figure
\unless\ifST@debugmode% si on doit afficher le tableau, on fait le boulot
\ST@emit@message{* computing formulas:^^J}%
@@ -1956,16 +1924,16 @@
\FPseed\ST@previous@seed% restauration de la graine
\let\ifFPmessages\ST@FPmessages
\restoreexpandmode\restoreexploremode
- \ST@catocde@saved
- \ST@tag@list
+ \ST@catocde@saved
+ \ST@tag@list
\ST@sanitize@cs
}
-\newcommand\ST@sanitize@cs{%
+\def\ST@sanitize@cs{%
\ST@letname{endrow@0}\ST@undef@content
\ST@sanitize@cs@i1}
-\newcommand\ST@sanitize@cs@i[1]{%
+\def\ST@sanitize@cs@i#1{%
\unless\ifnum#1>\ST@total@rownumber
\def\ST@temp@a{#1}%
\ST@letname{endrow@#1}\ST@undef@content
@@ -1974,7 +1942,7 @@
\fi
}
-\newcommand\ST@sanitize@cs@ii[1]{%
+\def\ST@sanitize@cs@ii#1{%
\unless\ifnum#1>\ST@total@colnumber
\ST@letname{formula@#1@\ST@temp@a}\ST@undef@content
\ST@letname{code@#1@\ST@temp@a}\ST@undef@content
@@ -1984,7 +1952,6 @@
}
\def\ST@undef@content{\ST@undef@content}
-
\endinput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -2143,5 +2110,13 @@ v0.4c 2014/11/06
\ST@analyse@text@engdate : si #1 commence par un espace parasite,
celui-ci est d\'esormais retir\'e.
2 Bug corrig\'e dans \ST@displaynumfields : les macros
- \ST@current@colnumber et \ST@current@rownumber sont définies avant
- d'appeler \ST@ifref \ No newline at end of file
+ \ST@current@colnumber et \ST@current@rownumber sont d\'efinies avant
+ d'appeler \ST@ifref
+-------------------------------------------------------------------------------
+v0.4d 2018/01/02
+ 1 Bug corrig\'e dans \ST@eval@cell : le \edef\ST@dependance@tree corrige
+ le \def !
+ 2 Ajout d'un message d'erreur si une la fonction sum a une plage qui
+ contient la cellule courante elle-m\^eme
+ 3 Nouvelle macro fonction "value"
+ 4 Nettoyage du code \ No newline at end of file