Skip to content

Commit

Permalink
Some documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
PhelypeOleinik committed Aug 9, 2021
1 parent ccb81a6 commit 299bc13
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions base/ltcmd.dtx
Expand Up @@ -2226,10 +2226,9 @@
% we'll just print stuff to the terminal.
%
% \begin{macro}{\@@_show:N}
% This macro just branches to the proper copying command by using
% \cs{@@_cmd_type_cases:NnnnF}. The copying command takes the names
% of the commands to be copied to and from, and the actual commands
% as its four arguments.
% This macro just branches to the proper showing command by using
% \cs{@@_cmd_type_cases:NnnnF}. The showing command takes the command
% to be shown as argument.
% \begin{macrocode}
\cs_new_protected:Npn \@@_show:N #1
{
Expand All @@ -2246,7 +2245,21 @@
\int_set:Nn \tex_escapechar:D { \int_use:N \tex_escapechar:D }
}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{
% \@@_show_command:N,
% \@@_show_command:NnNNwN,
% \@@_show_expandable:N,
% \@@_show_expandable:NnNNNNnN,
% \@@_show_command_aux:nNNn,
% \@@_show_environment:N,
% }
% These commands just expand the command once to reveal its innards,
% then pass the type of command, the control sequence, the signature,
% and the code macro to \cs{@@_show_command_aux:nNNn}.
% \begin{macrocode}
\cs_new_protected:Npn \@@_show_command:N #1
{ \exp_after:wN \@@_show_command:NnNNwN #1 \q_@@ #1 }
\cs_new_protected:Npn \@@_show_command:NnNNwN #1 #2 #3 #4 #5 \q_@@ #6
Expand All @@ -2255,19 +2268,26 @@
{ \exp_after:wN \@@_show_expandable:NnNNNNnN #1 #1 }
\cs_new_protected:Npn \@@_show_expandable:NnNNNNnN #1 #2 #3 #4 #5 #6 #7 #8
{ \@@_show_command_aux:nNNn { expandable~document~command } #8 #5 {#2} }
% \end{macrocode}
%
% And now just pretty-print everything:
% \begin{macrocode}
\cs_new_protected:Npn \@@_show_command_aux:nNNn #1 #2 #3 #4
{
\iow_term:x { > ~ \token_to_str:N #2 = #1: }
\iow_term:x { > ~ signature = \tl_to_str:n {#4} . }
\iow_term:x
{
> ~ \token_to_str:N #2 = #1: \iow_newline:
> ~ signature = \tl_to_str:n {#4} . \iow_newline:
> ~ \token_to_str:N #3 ~ (
\int_eval:n
{ \exp_args:Nf \str_count:n { \cs_argument_spec:N #3 } / 2 } ~
parameters ) : \cs_replacement_spec:N #3
}
}
% \end{macrocode}
%
% But complain when used with an environment:
% \begin{macrocode}
\cs_new_protected:Npn \@@_show_environment:N #1
{ \msg_error:nn { cmd } { env-show } }
\msg_new:nnn { cmd } { env-show }
Expand Down

0 comments on commit 299bc13

Please sign in to comment.