diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/expl3/l3chk.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/expl3/l3chk.dtx | 154 |
1 files changed, 106 insertions, 48 deletions
diff --git a/Master/texmf-dist/source/latex/expl3/l3chk.dtx b/Master/texmf-dist/source/latex/expl3/l3chk.dtx index 56b9cf5c34c..f492a516903 100644 --- a/Master/texmf-dist/source/latex/expl3/l3chk.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3chk.dtx @@ -1,16 +1,50 @@ % \iffalse -%% File: l3chk.dtx Copyright (C) 1990-1998 LaTeX3 project -% +%% File: l3chk.dtx Copyright (C) 1990-2006 LaTeX3 project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the ``expl3 bundle'' (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +%<package>\RequirePackage{l3names} %<*dtx> - \ProvidesFile{l3chk.dtx} +%\fi +\def\GetIdInfo$Id: #1.dtx #2 #3-#4-#5 #6 #7$#8{% + \def\fileversion{#2}% + \def\filedate{#3/#4/#5}% + \ProvidesFile{#1.dtx}[#3/#4/#5 v#2 #8]% +} +%\iffalse %</dtx> -%<package>\NeedsTeXFormat{LaTeX2e} -%<package>\ProvidesPackage{l3chk} -%<driver> \ProvidesFile{l3chk.drv} -% \fi -% \ProvidesFile{l3chk.dtx} - [1998/04/20 v1.0e L3 Experimental check module] -% +%\fi +\GetIdInfo$Id: l3chk.dtx 573 2006-08-21 20:59:37Z morten $ + {L3 Experimental check module} % \iffalse %<*driver> \documentclass{l3doc} @@ -21,7 +55,6 @@ %</driver> % \fi % -% \GetFileInfo{l3chk.dtx} % \title{The \textsf{l3chk} package\thanks{This file % has version number \fileversion, last % revised \filedate.}\\ @@ -35,11 +68,12 @@ % To ensure that functions and variables are properly used certain % checking functions are implemented that may or may not be compiled % into the final format. -% +% % \subsection{Functions} -% +% % \begin{function}{% % \chk_var_or_const:N | +% \chk_var_or_const:c | % } % \begin{syntax} % "\chk_var_or_const:N" <cs> @@ -47,10 +81,12 @@ % Checks that <cs> is a proper variable or constant which means that its % name starts out with "\L", "\l", "\G", "\g", "\R", "\C", "\c", or "\q". % \end{function} -% +% % \begin{function}{% % \chk_local:N | +% \chk_local:c | % \chk_global:N | +% \chk_global:c | % } % \begin{syntax} % "\chk_local:N" <cs> @@ -58,7 +94,7 @@ % Checks that <cs> is a proper local or global variable. This means that % its name starts out with "\L", "\l", or "\G", "\g" respectively. % \end{function} -% +% % \begin{function}{% % \chk_local_or_pref_global:N | % \pref_global_chk: | @@ -82,16 +118,16 @@ % "\pref_global:D" turns its operation into a global one. See % implementation for details. % \end{function} -% +% % \subsection{Constants} -% +% % \begin{variable}{\c_undefined} % This constant is always undefined and therefore can be used to check % for free function names. % \end{variable} -% +% % \subsection{Internal functions} -% +% % \begin{function}{% % \chk_global_aux:w | % \chk_local_aux:w | @@ -102,13 +138,13 @@ % % \StopEventually{} % -% \section{The code} +% \subsection{The Implementation} % % We start by ensuring that the required packages are loaded. % \begin{macrocode} %<package>\RequirePackage{l3basics} -%<package>\RequirePackage{l3int} -%<*package> +%<package>\RequirePackage{l3int,l3prg} +%<*initex|package> % \end{macrocode} % % The |\chk| module contains those functions that are used primarily @@ -116,33 +152,34 @@ % too badly. All these functions are of type `{\tt e}' since they % issue error messages if certain conditions are violated. % -% \subsection{Checking variable assignments} +% \subsubsection{Checking variable assignments} % % \begin{macro}{\chk_local:N} % \begin{macro}{\chk_local_aux:w} % This function checks that its argument is a proper local -% variable, i.e.\ its name starts with |\l| or |\L|. +% variable, i.e.\ its name starts with |\l| or |\L|. % It is not allowed that the name starts with |\g| or |\G|, % which means that we do not allow to update global -% variables locally. But see |\pref_global_chk:| below for +% variables locally. But see |\pref_global_chk:| below for % the encoding of functions that might accept global variables % in certain situations. Not checked is the case that the -% argument isn't a variable at all, i.e.\ it doesn't have +% argument isn't a variable at all, i.e.\ it doesn't have % a |_| as second letter. Maybe we should add this for safety % during the implementation since it will find certain errors % involving wrong expansion in earlier stage. % \begin{macrocode} -\def_new:Npn \chk_local:N #1{\exp_after:NN - \chk_local_aux:w \token_to_string:N#1\q_stop} +\def_new:Npn \chk_local:N #1{ + \exp_after:NN \chk_local_aux:w \token_to_string:N#1\q_stop} + \def_new:Npn \chk_local_aux:w #1#2#3\q_stop{ \if_num:w\tex_uccode:D`#2=`G\scan_stop: - \err_latex_bug:n{Local~mismatch:~local~function~called~with~ + \err_latex_bug:x{Local~mismatch:~local~function~called~with~ global~variable:^^J\text_put_four_sp: #1#2#3~ on~line~\tex_the:D\tex_inputlineno:D} \else: \if_num:w\tex_uccode:D`#2=`L\scan_stop: \else: - \err_latex_bug:n{Variable~mismatch:~function~not~called~with~ + \err_latex_bug:x{Variable~mismatch:~function~not~called~with~ proper~variable:^^J\text_put_four_sp: #1#2#3~ on~line~\tex_the:D\tex_inputlineno:D}\fi: \fi:} @@ -164,13 +201,13 @@ \chk_global_aux:w \token_to_string:N#1\q_stop} \def_new:Npn \chk_global_aux:w #1#2#3\q_stop{ \if_num:w\tex_uccode:D`#2=`L\scan_stop: - \err_latex_bug:n{Global~mismatch:~global~function~called~with~ + \err_latex_bug:x{Global~mismatch:~global~function~called~with~ local~variable:~#1#2#3~ on~line~\tex_the:D\tex_inputlineno:D} \else: \if_num:w\tex_uccode:D`#2=`G\scan_stop: \else: - \err_latex_bug:n{Variable~mismatch:~function~not~called~with~ + \err_latex_bug:x{Variable~mismatch:~function~not~called~with~ proper~variable:~#1#2#3~ on~line~\tex_the:D\tex_inputlineno:D}\fi:\fi:} % \end{macrocode} @@ -230,7 +267,7 @@ % \end{macrocode} % We also allow the beast to be a quark, i.e.\ to start with |\q|. % \begin{macrocode} - \if_char_code:w#2q\scan_stop: + \if_charcode:w#2q\scan_stop: \else: % \end{macrocode} % We might also want to allow that it is a user definable @@ -238,7 +275,7 @@ % could check this by testing that there is no |_|, but this is not % implemented so far. % \begin{macrocode} - \err_latex_bug:n{Variable~mismatch:~function~not~called~with~ + \err_latex_bug:x{Variable~mismatch:~function~not~called~with~ proper~variable:^^J\text_put_four_sp: #1#2#3~ on~line~\tex_the:D\tex_inputlineno:D}\fi:\fi:\fi: \fi:} @@ -247,7 +284,7 @@ % \end{macro} % % -% \subsection{Doing some tracing} +% \subsubsection{Doing some tracing} % % \begin{macro}{\tracingall} % \begin{macro}{\absolutelytracingall} @@ -288,7 +325,7 @@ \pref_global:D\g_trace_box_breadth_int\c_ten_thousand \pref_global:D\g_trace_box_depth_int\c_ten_thousand \pref_global:D\g_trace_online_status\c_one - \mode_errorstop:D} + \tex_errorstopmode:D} % % Use LaTeX2e definition for now. %\def_new:Npn\tracingall{ @@ -323,27 +360,29 @@ % \end{macrocode} % \end{macro} % -% \subsection{Tracing modules} +% \subsubsection{Tracing modules} % % \begin{macro}{\traceon} % \begin{macro}{\traceoff} % Turning the tracing of modules on or off. (primitive version). % \begin{macrocode} %<*trace> -\def_new:Npn\traceon#1{\for_clist:Nnn\l_tmpa_tlp{#1} - { - \cs_free:cF{g_trace_\l_tmpa_tlp _status} - {\int_gincr:c{g_trace_\l_tmpa_tlp _status}} - }} -\def_new:Npn\traceoff#1{\for_clist:Nnn\l_tmpa_tlp{#1} - { - \cs_free:cF{g_trace_\l_tmpa_tlp _status} - {\int_gdecr:c{g_trace_\l_tmpa_tlp _status}} - }} +\def_new:Npn\traceon#1{ + \clist_map_inline:nn {#1}{ + \cs_free:cF{g_trace_ ##1 _status} + {\int_gincr:c{g_trace_ ##1 _status}} + } +} +\def_new:Npn\traceoff#1{ + \clist_map_inline:nn {#1}{ + \cs_free:cF{g_trace_ ##1 _status} + {\int_gdecr:c{g_trace_ ##1 _status}} + } +} %</trace> %<-trace>\let_new:NN\traceon\use_none:n %<-trace>\let_new:NN\traceoff\use_none:n -%</package> +%</initex|package> % \end{macrocode} % \end{macro} % \end{macro} @@ -356,3 +395,22 @@ %</showmemory> % \end{macrocode} % +% \endinput +% +% $Log$ +% Revision 1.14 2006/03/20 18:26:34 braams +% Updated the copyright notice (2006) and demoted all implementation +% sections to subsections and so on to clean up the toc for source3.tex +% +% Revision 1.13 2005/12/27 09:58:01 morten +% Minor changes plus changed RCS information retrieval +% +% Revision 1.12 2005/04/12 12:07:53 morten +% Removed unnecessary functions +% +% Revision 1.11 2005/03/15 23:31:54 braams +% Some fiddling with docstrip guards for initex use +% +% Revision 1.10 2005/03/11 21:33:31 braams +% Fixed the use of RCS information +% |