summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/algobox
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-09-05 21:56:47 +0000
committerKarl Berry <karl@freefriends.org>2017-09-05 21:56:47 +0000
commita62f77790bf4d66905f22ad01203d3b08301f6e5 (patch)
tree553ed7ec1840ccfe6cab7e2425874def4ea43215 /Master/texmf-dist/source/latex/algobox
parent4bc5b2eef4dde44c1ae2a1f191b7bb5ddee7c121 (diff)
algobox (5sep17)
git-svn-id: svn://tug.org/texlive/trunk@45223 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/algobox')
-rw-r--r--Master/texmf-dist/source/latex/algobox/algobox.dtx142
-rw-r--r--Master/texmf-dist/source/latex/algobox/algobox.ins2
2 files changed, 97 insertions, 47 deletions
diff --git a/Master/texmf-dist/source/latex/algobox/algobox.dtx b/Master/texmf-dist/source/latex/algobox/algobox.dtx
index b20a17a29c9..2e26eb79f4d 100644
--- a/Master/texmf-dist/source/latex/algobox/algobox.dtx
+++ b/Master/texmf-dist/source/latex/algobox/algobox.dtx
@@ -1,7 +1,7 @@
% \iffalse meta-comment
% vim: tw=80
%
-%% File: algobox.dtx (C) Copyright 2016 RIVAUD Julien
+%% File: algobox.dtx (C) Copyright 2016-2017 RIVAUD Julien
%%
%% It may be distributed and/or modified under the conditions of the
%% General Public License (GPL), either version 3 of this
@@ -14,16 +14,16 @@
\RequirePackage{expl3}[2016/01/19]
\def\ExplFileName{algobox}
\def\ExplFileDescription{Typeset Algobox programs}
-\def\ExplFileDate{2017/09/03}
-\def\ExplFileVersion{1.1}
+\def\ExplFileDate{2017/09/04}
+\def\ExplFileVersion{1.2a}
%</driver|package>
%<*driver>
-\documentclass[full]{l3doc}
+\documentclass[full,a4paper]{l3doc}
\usepackage{fontspec}
\usepackage{algobox}
\usepackage{url}
\begin{document}
- \def\Algobox{\textsc{Algobox}}
+ \def\Algobox{\textsc{AlgoBox}}
\DocInput{\jobname.dtx}
\end{document}
%</driver>
@@ -232,14 +232,21 @@
\int_new:N \l_@@_level_int
+% \end{macrocode}
+% The colors are defined in "algohighlighter.cpp" in the \Algobox\ source,
+% except for the tree lines color. The names here are the same, with "algobox"
+% prepended.
+% \begin{macrocode}
+
\definecolor{algoboxarbre}{RGB}{146,146,146}
-\colorlet {algoboxcommentaire}{algoboxarbre!70!black}
-\definecolor{algoboxstructure}{RGB}{134,0,0}
-\definecolor{algoboxmotclef}{RGB}{25,3,180}
-\definecolor{algoboxsialors}{RGB}{147,0,128}
-\definecolor{algoboxpour}{RGB}{187,136,0}
-\definecolor{algoboxtantque}{RGB}{222,111,6}
-\definecolor{algoboxnormal}{RGB}{0,0,0}
+\definecolor{algoboxColorStandard}{HTML}{000000}
+\definecolor{algoboxColorComment}{HTML}{606060}
+\definecolor{algoboxColorBloc}{HTML}{800000}
+\definecolor{algoboxColorCommande}{HTML}{0000CC}
+\definecolor{algoboxColorSi}{HTML}{800080}
+\definecolor{algoboxColorTantQue}{HTML}{DD6F06}
+\definecolor{algoboxColorPour}{HTML}{BB8800}
+\definecolor{algoboxColorFonction}{HTML}{9A4D00}
\tikzset{
every~algobox/.style=,
@@ -253,31 +260,35 @@
algobox~indent/.style={xshift=2em},
algobox~normal/.style={
font=\sffamily,
- color=algoboxnormal,
+ color=algoboxColorStandard,
},
algobox~commentaire/.style={
algobox~normal/.try,
- color=algoboxcommentaire,
+ color=algoboxColorComment,
},
- algobox~motclef/.style={
+ algobox~commande/.style={
algobox~normal/.try,
- color=algoboxmotclef,
+ color=algoboxColorCommande,
},
algobox~structure/.style={
font=\sffamily\bfseries,
- color=algoboxstructure
+ color=algoboxColorBloc
},
algobox~sialors/.style={
algobox~structure/.try,
- color=algoboxsialors,
+ color=algoboxColorSi,
},
algobox~pour/.style={
algobox~structure/.try,
- color=algoboxpour,
+ color=algoboxColorPour,
},
algobox~tantque/.style={
algobox~structure/.try,
- color=algoboxtantque,
+ color=algoboxColorTantQue,
+ },
+ algobox~fonctions/.style={
+ algobox~structure/.try,
+ color=algoboxColorFonction,
},
}
@@ -404,38 +415,26 @@
% \subsection{Parsing/typesetting commands}
% \begin{macrocode}
-\NewDocumentCommand \@@_VARIABLES:w {} {
- \@@_indent:nn {structure} {VARIABLES}
-}
-
\NewDocumentCommand \@@_ESTDUTYPE:w { +u{\ESTDUTYPE} +u{\;} } {
\@@_block:nn {normal} {
\ignorespaces #1 \unskip\c_space_token\null
}
- \@@_node:nn {motclef}{EST_DU_TYPE}
+ \@@_node:nn {commande}{EST_DU_TYPE}
\@@_node:nn {normal}{\null\c_space_token#2}
}
-\NewDocumentCommand \@@_DEBUTALGORITHME:w {} {
- \int_compare:nNnT \l_@@_level_int = \c_one {
- % if there was a VARIABLES before
- \@@_unindent:
- }
- \@@_indent:nn {structure} {DEBUT_ALGORITHME}
-}
-
\NewDocumentCommand \@@_FINALGORITHME:w {} {
- \int_compare:nNnT \l_@@_level_int = \c_one {
+ \int_while_do:nNnn \l_@@_level_int > \c_zero {
\@@_unindent:
- \@@_block:nn {structure} {FIN_ALGORITHME}
}
+ \@@_block:nn {structure} {FIN_ALGORITHME}
}
\NewDocumentCommand \@@_PRENDLAVALEUR:w { u{\PRENDLAVALEUR} m } {
\@@_block:nn {normal} {
\ignorespaces#1\unskip\c_space_token\null
}
- \@@_node:nn {motclef}{PREND_LA_VALEUR}
+ \@@_node:nn {commande}{PREND_LA_VALEUR}
\@@_node:nn {normal}{\null\c_space_token#2}
}
@@ -490,6 +489,14 @@
\@@_unindent:
}
+\NewDocumentCommand \@@_FONCTION:w { +u{\;} } {
+ \int_while_do:nNnn \l_@@_level_int > \c_one {
+ \@@_unindent:
+ }
+ \@@_indent:nn {fonctions} {FONCTION}
+ \@@_node:nn {normal}{\null\c_space_token#1}
+}
+
\NewDocumentCommand \@@_LINE:w { s O{normal} m } {
\IfBooleanTF {#1} {
\@@_indent:nn {#2} {#3}
@@ -507,6 +514,51 @@
% \subsection{User commands and environment}
% \begin{macrocode}
+\cs_new_protected_nopar:Nn \@@_make_keyword:n {
+ \tl_set:Nn \l_tmpa_tl {#1}
+ \tl_replace_all:Nnn \l_tmpa_tl {_} {}
+ \cs_set:cpn {\l_tmpa_tl} {\@@_keyword:nw {#1}}
+}
+
+\NewDocumentCommand \@@_keyword:nw {m +u{\;}} {
+ \@@_block:nn {commande} {#1}
+ \@@_node:nn {normal}{\null\c_space_token#2}
+}
+
+\cs_new_protected_nopar:Nn \@@_make_structure:nn {
+ \tl_set:Nn \l_tmpa_tl {#2}
+ \tl_replace_all:Nnn \l_tmpa_tl {_} {}
+ \cs_set:cpn {\l_tmpa_tl} {\@@_topstructure:nn {#1}{#2}}
+}
+
+\cs_new_protected_nopar:Nn \@@_topstructure:nn {
+ \int_while_do:nNnn \l_@@_level_int > \c_zero {
+ \@@_unindent:
+ }
+ \@@_indent:nn {#1} {#2}
+}
+
+\cs_new_protected_nopar:Nn \@@_make_func_structure:nn {
+ \tl_set:Nn \l_tmpa_tl {#1}
+ \tl_replace_all:Nnn \l_tmpa_tl {_} {}
+ \cs_set:cpn {\l_tmpa_tl} {\@@_funcstructure:nn {#1}{#2}}
+}
+
+\cs_new_protected_nopar:Nn \@@_funcstructure:nn {
+ \int_while_do:nNnn \l_@@_level_int > \c_two {
+ \@@_unindent:
+ }
+ \bool_if:nTF {#2}{\@@_indent:nn}{\@@_block:nn} {fonctions} {#1}
+}
+
+\clist_const:Nn \c_@@_keywords_clist {
+ PAUSE, LIRE, AFFICHERCALCUL, AFFICHER,
+ TRACER_POINT, TRACER_POINT_Rouge, TRACER_POINT_Vert,
+ TRACER_POINT_Bleu, TRACER_POINT_Blanc,
+ TRACER_SEGMENT, TRACER_SEGMENT_Rouge, TRACER_SEGMENT_Vert,
+ TRACER_SEGMENT_Bleu, TRACER_SEGMENT_Blanc,
+ RENVOYER, APPELER_FONCTION
+}
\cs_new_protected_nopar:Nn \@@_begincode:n {
\int_zero:N \l_@@_level_int
@@ -517,26 +569,24 @@
\cs_set_eq:NN \; \prg_do_nothing:
\cs_set_eq:NN \LINE \@@_LINE:w
\cs_set_eq:NN \NODE \@@_NODE:w
- \cs_set_eq:NN \VARIABLES \@@_VARIABLES:w
- \cs_set_eq:NN \DEBUTALGORITHME \@@_DEBUTALGORITHME:w
\cs_set_eq:NN \FINALGORITHME \@@_FINALGORITHME:w
\cs_set_eq:NN \SI \@@_SI:w
\cs_set_eq:NN \POUR \@@_POUR:w
\cs_set_eq:NN \TANTQUE \@@_TANTQUE:w
- \cs_set:Npn \AFFICHER {\@@_keyword:nw {AFFICHER}}
- \cs_set:Npn \AFFICHERCALCUL {\@@_keyword:nw {AFFICHERCALCUL}}
- \cs_set:Npn \LIRE {\@@_keyword:nw {LIRE}}
- \cs_set:Npn \PAUSE {\@@_block:nn{motclef}{PAUSE}}
+ \cs_set_eq:NN \FONCTION \@@_FONCTION:w
\cs_set:Npn \//##1\; {\@@_block:nn{commentaire}{//##1}}
+ \clist_map_function:NN \c_@@_keywords_clist \@@_make_keyword:n
+ \@@_make_structure:nn {structure} {VARIABLES}
+ \@@_make_structure:nn {structure} {DEBUT_ALGORITHME}
+ \@@_make_structure:nn {fonctions} {FONCTIONS_UTILISEES}
+ \@@_make_func_structure:nn {VARIABLES_FONCTION} \c_true_bool
+ \@@_make_func_structure:nn {DEBUT_FONCTION} \c_false_bool
+ \@@_make_func_structure:nn {FIN_FONCTION} \c_false_bool
}
\cs_new_protected_nopar:Nn \@@_closecode: {
\end{tikzpicture}
}
-\NewDocumentCommand \@@_keyword:nw {m +u{\;}} {
- \@@_block:nn {motclef} {#1}
- \@@_node:nn {normal}{\null\c_space_token#2}
-}
\NewDocumentCommand \smalgobox { O{} m } {
diff --git a/Master/texmf-dist/source/latex/algobox/algobox.ins b/Master/texmf-dist/source/latex/algobox/algobox.ins
index 60f63628e77..5cd013ccbe8 100644
--- a/Master/texmf-dist/source/latex/algobox/algobox.ins
+++ b/Master/texmf-dist/source/latex/algobox/algobox.ins
@@ -1,6 +1,6 @@
\iffalse meta-comment
-File algobox.ins (C) Copyright 2016 RIVAUD Julien
+File algobox.ins (C) Copyright 2016-2017 RIVAUD Julien
It may be distributed and/or modified under the conditions of the
General Public License (GPL), either version 3 of this