diff options
author | Karl Berry <karl@freefriends.org> | 2009-06-09 23:31:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-06-09 23:31:15 +0000 |
commit | 215b9a864d5829070bdc66ba736986eb72e5143e (patch) | |
tree | fe0882c81fc4ec945cee4b512f72eaa21ea5f791 /Master/texmf-dist/source/latex/expl3/l3chk.dtx | |
parent | df90ec06321940c2f066b05e12f1b5ab099105da (diff) |
expl3 1407 (9jun09)
git-svn-id: svn://tug.org/texlive/trunk@13686 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/expl3/l3chk.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/expl3/l3chk.dtx | 173 |
1 files changed, 76 insertions, 97 deletions
diff --git a/Master/texmf-dist/source/latex/expl3/l3chk.dtx b/Master/texmf-dist/source/latex/expl3/l3chk.dtx index 281ba7bc1cc..ad016f91c91 100644 --- a/Master/texmf-dist/source/latex/expl3/l3chk.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3chk.dtx @@ -1,5 +1,5 @@ % \iffalse -%% File: l3chk.dtx Copyright (C) 1990-2006 LaTeX3 project +%% File: l3chk.dtx Copyright (C) 1990-2006,2009 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 @@ -17,7 +17,7 @@ %% %% The development version of the bundle can be found at %% -%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ +%% http://www.latex-project.org/svnroot/experimental/trunk/ %% %% for those people who are interested. %% @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3chk.dtx 621 2007-09-01 20:14:19Z morten $ +\GetIdInfo$Id: l3chk.dtx 1362 2009-05-28 20:19:21Z joseph $ {L3 Experimental check module} %\iffalse %<*driver> @@ -44,7 +44,7 @@ \ProvidesFile{\filename.\filenameext} [\filedate\space v\fileversion\space\filedescription] %\iffalse -\documentclass{l3doc} +\documentclass[full]{l3doc} \begin{document} \DocInput{\filename.\filenameext} \end{document} @@ -59,17 +59,27 @@ % \date{\filedate} % \maketitle % -% \section{The chk module} +% \begin{documentation} % % 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} +% \section{Tracing} +% +% \begin{function}{\tracingall | +% \absolutelytracingall | +% \donotcheck | +% \tracingoff | +% \traceon | +% \traceoff } +% Commands to control the level of verbosity in the tracing output. +% \end{function} +% +% \section{Functions} % % \begin{function}{% % \chk_var_or_const:N | -% \chk_var_or_const:c | % } % \begin{syntax} % "\chk_var_or_const:N" <cs> @@ -80,9 +90,7 @@ % % \begin{function}{% % \chk_local:N | -% \chk_local:c | % \chk_global:N | -% \chk_global:c | % } % \begin{syntax} % "\chk_local:N" <cs> @@ -108,40 +116,26 @@ % "\chk_local_or_pref_global:N" inside some function "\foo_bar:n" we can % implement a global version "\foo_gbar:n" by defining % \begin{quote} -% "\def_new:Npn \foo_gbar:n {\pref_global_chk: \foo_bar:n }" +% "\cs_new_nopar:Npn \foo_gbar:n {\pref_global_chk: \foo_bar:n }" % \end{quote} % provided that "\foo_bar:n" is built in a way that prefixing it with % "\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 | -% \chk_var_or_const_aux:w | -% } -% Helper functions that implement the checking. -% \end{function} +% \end{documentation} % -% \StopEventually{} +% \begin{implementation} % -% \subsection{The Implementation} +% \section{\pkg{l3chk} implementation} % % We start by ensuring that the required packages are loaded. % \begin{macrocode} -%<package>\ProvidesExplPackage -%<package> {\filename}{\filedate}{\fileversion}{\filedescription} -%<package>\RequirePackage{l3basics} -%<package>\RequirePackage{l3int,l3prg} +%<*package> +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} +\package_check_loaded_expl: +%</package> %<*initex|package> % \end{macrocode} % @@ -150,10 +144,10 @@ % too badly. All these functions are of type `{\tt e}' since they % issue error messages if certain conditions are violated. % -% \subsubsection{Checking variable assignments} +% \subsection{Checking variable assignments} % % \begin{macro}{\chk_local:N} -% \begin{macro}{\chk_local_aux:w} +% \begin{macro}[aux]{\chk_local_aux:w} % This function checks that its argument is a proper local % variable, i.e.\ its name starts with |\l| or |\L|. % It is not allowed that the name starts with |\g| or |\G|, @@ -166,18 +160,18 @@ % 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} +\cs_new_nopar:Npn \chk_local:N #1{ + \exp_after:wN \chk_local_aux:w \token_to_str:N#1\q_stop} -\def_new:Npn \chk_local_aux:w #1#2#3\q_stop{ +\cs_new_nopar:Npn \chk_local_aux:w #1#2#3\q_stop{ \if_num:w\tex_uccode:D`#2=`G\scan_stop: - \err_latex_bug:x{Local~mismatch:~local~function~called~with~ + \msg_kernel_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:x{Variable~mismatch:~function~not~called~with~ + \msg_kernel_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:} @@ -191,21 +185,21 @@ % \end{macro} % % \begin{macro}{\chk_global:N} -% \begin{macro}{\chk_global_aux:w} +% \begin{macro}[aux]{\chk_global_aux:w} % |\chk_global:N| is similar to |\chk_local:N| but looks only % for global variables. % \begin{macrocode} -\def_new:Npn \chk_global:N #1{\exp_after:NN - \chk_global_aux:w \token_to_string:N#1\q_stop} -\def_new:Npn \chk_global_aux:w #1#2#3\q_stop{ +\cs_new_nopar:Npn \chk_global:N #1{\exp_after:wN + \chk_global_aux:w \token_to_str:N#1\q_stop} +\cs_new_nopar:Npn \chk_global_aux:w #1#2#3\q_stop{ \if_num:w\tex_uccode:D`#2=`L\scan_stop: - \err_latex_bug:x{Global~mismatch:~global~function~called~with~ + \msg_kernel_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:x{Variable~mismatch:~function~not~called~with~ + \msg_kernel_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} @@ -218,7 +212,7 @@ % |\pref_global:D| without loosing the possibility to check for the % correct type of a variable, the following helper functions can be % used: |\chk_local_or_pref_global:N| \m{variable} is the variable -% check which is usually |\let:NN| to |\chk_local:N|, i.e.\ it will +% check which is usually |\cs_set_eq:NN| to |\chk_local:N|, i.e.\ it will % check for local variables. This behavior will be changed by % |\pref_global_chk:|. This function first changes % |\chk_local_or_pref_global:N| to check for global variables, then @@ -228,7 +222,7 @@ % inside some function |\foo_bar:n| we can implement a global % version |\foo_gbar:n| by defining % \begin{verbatim} -% \def_new:Npn \foo_gbar:n {\pref_global_chk: \foo_bar:n } +% \cs_new_nopar:Npn \foo_gbar:n {\pref_global_chk: \foo_bar:n } %\end{verbatim} % provided of course, that |\foo_bar:n| is defined in a way that a % |\pref_global:D| does work. Such a scheme has to be used @@ -237,25 +231,25 @@ % |\pref_global_chk:| into |\pref_global:D| and omit the % |\chk_local_or_pref_global:N| function in the body. % \begin{macrocode} -\def_new:Npn \pref_global_chk: { - \gdef:Npn \chk_local_or_pref_global:N ##1{ +\cs_new_nopar:Npn \pref_global_chk: { + \cs_gset_nopar:Npn \chk_local_or_pref_global:N ##1{ \chk_global:N ##1 - \glet:NN \chk_local_or_pref_global:N \chk_local:N} + \cs_gset_eq:NN \chk_local_or_pref_global:N \chk_local:N} \pref_global:D} -\let_new:NN \chk_local_or_pref_global:N \chk_local:N +\cs_new_eq:NN \chk_local_or_pref_global:N \chk_local:N % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\chk_var_or_const:N} -% \begin{macro}{\chk_var_or_const_aux:w} +% \begin{macro}[aux]{\chk_var_or_const_aux:w} % |\chk_var_or_const:N| is used in situations where we want to check % that we have a variable (or a constant) but do not care whether % or not it is global (for example, in allocation routines). % \begin{macrocode} -\def_new:Npn \chk_var_or_const:N #1{\exp_after:NN - \chk_var_or_const_aux:w \token_to_string:N#1\q_stop } -\def_new:Npn \chk_var_or_const_aux:w #1#2#3\q_stop { +\cs_new_nopar:Npn \chk_var_or_const:N #1{\exp_after:wN + \chk_var_or_const_aux:w \token_to_str:N#1\q_stop } +\cs_new_nopar:Npn \chk_var_or_const_aux:w #1#2#3\q_stop { \if_num:w\tex_uccode:D`#2=`L\scan_stop: \else: \if_num:w\tex_uccode:D`#2=`G\scan_stop: @@ -273,7 +267,7 @@ % could check this by testing that there is no |_|, but this is not % implemented so far. % \begin{macrocode} - \err_latex_bug:x{Variable~mismatch:~function~not~called~with~ + \msg_kernel_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:} @@ -282,7 +276,7 @@ % \end{macro} % % -% \subsubsection{Doing some tracing} +% \subsection{Doing some tracing} % % \begin{macro}{\tracingall} % \begin{macro}{\absolutelytracingall} @@ -292,20 +286,20 @@ % probably wrong. Therefore this definition of it turns the % functions of as far as possible. % \begin{macrocode} -\def_new:Npn\donotcheck{ - \let:NN \chk_global:N \use_none:n - \let:NN \chk_local:N \use_none:n - \let:NN \chk_local_or_pref_global:N \use_none:n - \let:NN \pref_global_chk: \pref_global:D - \let:NN \chk_new_cs:N \use_none:n - \let:NN \chk_exist_cs:N \use_none:n - \let:NN \chk_var_or_const:N \use_none:n - \let:NN \cs_record_name:N \use_none:n - \let:NN \cs_record_name:c \use_none:n - \let:NN \cs_record_meaning:N \use_none:n - \let:NN \register_record_name:N \use_none:n +\cs_new_nopar:Npn\donotcheck{ + \cs_set_eq:NN \chk_global:N \use_none:n + \cs_set_eq:NN \chk_local:N \use_none:n + \cs_set_eq:NN \chk_local_or_pref_global:N \use_none:n + \cs_set_eq:NN \pref_global_chk: \pref_global:D + \cs_set_eq:NN \chk_if_free_cs:N \use_none:n + \cs_set_eq:NN \chk_exist_cs:N \use_none:n + \cs_set_eq:NN \chk_var_or_const:N \use_none:n + \cs_set_eq:NN \cs_record_name:N \use_none:n + \cs_set_eq:NN \cs_record_name:c \use_none:n + \cs_set_eq:NN \cs_record_meaning:N \use_none:n + \cs_set_eq:NN \register_record_name:N \use_none:n } -\def_new:Npn\absolutelytracingall{ +\cs_new_nopar:Npn\absolutelytracingall{ % \end{macrocode} % \end{macro} % @@ -326,7 +320,7 @@ \tex_errorstopmode:D} % % Use LaTeX2e definition for now. -%\def_new:Npn\tracingall{ +%\cs_new_nopar:Npn\tracingall{ % \donotcheck % \absolutelytracingall %} @@ -337,7 +331,7 @@ % \begin{macro}{\tracingoff} % This macro turns off all tracing. % \begin{macrocode} -\def_new:Npn\tracingoff{ +\cs_new_nopar:Npn\tracingoff{ % \end{macrocode} % First we turn off |\g_trace_online_status| so that we get minimal % rubbish on the terminal. Of course, in the log file all @@ -358,28 +352,28 @@ % \end{macrocode} % \end{macro} % -% \subsubsection{Tracing modules} +% \subsection{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{ +\cs_new_nopar:Npn\traceon#1{ \clist_map_inline:nn {#1}{ - \cs_free:cF{g_trace_ ##1 _status} + \cs_if_free:cF{g_trace_ ##1 _status} {\int_gincr:c{g_trace_ ##1 _status}} } } -\def_new:Npn\traceoff#1{ +\cs_new_nopar:Npn\traceoff#1{ \clist_map_inline:nn {#1}{ - \cs_free:cF{g_trace_ ##1 _status} + \cs_if_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 +%<-trace>\cs_new_eq:NN\traceon\use_none:n +%<-trace>\cs_new_eq:NN\traceoff\use_none:n %</initex|package> % \end{macrocode} % \end{macro} @@ -393,22 +387,7 @@ %</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 +% \end{implementation} +% \PrintIndex % +% \endinput |