diff options
author | Karl Berry <karl@freefriends.org> | 2012-04-23 23:35:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-04-23 23:35:34 +0000 |
commit | 06f92e7988867477e0e8ba1b2dea3752d90f7fbe (patch) | |
tree | 6cc2f8ec5dbfc078c9c5f37bfb15814c704b1793 /Master/texmf-dist/tex/latex/l3kernel/l3msg.sty | |
parent | 84c410717bd484db4ccea240224d83fbb42b464a (diff) |
l3kernel 3570 (23apr12)
git-svn-id: svn://tug.org/texlive/trunk@26111 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/l3msg.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3msg.sty | 237 |
1 files changed, 144 insertions, 93 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty index af40a84ac92..2e5ae99d6a4 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3msg.dtx 3470 2012-02-26 19:10:24Z bruno $ +\GetIdInfo$Id: l3msg.dtx 3568 2012-04-23 13:23:58Z joseph $ {L3 Experimental messages} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -54,9 +54,14 @@ \tl_new:N \l_msg_internal_tl \tl_const:Nn \c_msg_text_prefix_tl { msg~text~>~ } \tl_const:Nn \c_msg_more_text_prefix_tl { msg~extra~text~>~ } +\prg_new_conditional:Npnn \msg_if_exist:nn #1#2 { p , T , F , TF } + { + \cs_if_exist:cTF { \c_msg_text_prefix_tl #1 / #2 } + { \prg_return_true: } { \prg_return_false: } + } \cs_new_protected:Npn \chk_if_free_msg:nn #1#2 { - \cs_if_free:cF { \c_msg_text_prefix_tl #1 / #2 } + \msg_if_exist:nnT {#1} {#2} { \msg_kernel_error:nnxx { msg } { message-already-defined } {#1} {#2} @@ -65,7 +70,7 @@ \tex_ifodd:D \l@expl@log@functions@bool \cs_gset_protected:Npn \chk_if_free_msg:nn #1#2 { - \cs_if_free:cF { \c_msg_text_prefix_tl #1 / #2 } + \msg_if_exist:nnT {#1} {#2} { \msg_kernel_error:nnxx { msg } { message-already-defined } {#1} {#2} @@ -133,65 +138,50 @@ \cs_new_nopar:Npn \msg_newline: { ^^J } \cs_new_nopar:Npn \msg_two_newlines: { ^^J ^^J } \cs_new_nopar:Npn \msg_line_number: { \int_use:N \tex_inputlineno:D } -\cs_set_nopar:Npn \msg_line_context: +\cs_gset_nopar:Npn \msg_line_context: { \c_msg_on_line_text_tl \c_space_tl \msg_line_number: } -\char_set_catcode_letter:N \. -\tl_new:N - \c_msg_hide_tl.......................................................... -\tl_const:Nn \c_msg_hide_tl - { \c_msg_hide_tl.......................................................... } -\char_set_catcode_other:N \. -\tl_new:N \l_msg_text_tl \cs_new_protected:Npn \msg_interrupt:xxx #1#2#3 { - \group_begin: - \tl_if_empty:nTF {#3} - { \msg_interrupt_no_details:xx {#1} {#2} } - { \msg_interrupt_details:xxx {#1} {#2} {#3} } - \msg_interrupt_aux: - \group_end: - } -\cs_new_protected:Npn \msg_interrupt_no_details:xx #1#2 - { - \iow_wrap:xnnnN - { \\ \c_msg_no_info_text_tl } - { |~ } { 2 } { } \msg_interrupt_more_text:n - \iow_wrap:xnnnN { #1 \\ \\ #2 \\ \\ \c_msg_continue_text_tl } - { ! ~ } { 2 } {} \msg_interrupt_text:n + \tl_if_empty:nTF {#3} + { + \msg_interrupt_wrap:xx { \\ \c_msg_no_info_text_tl } + {#1 \\\\ #2 \\\\ \c_msg_continue_text_tl } + } + { + \msg_interrupt_wrap:xx { \\ #3 } + {#1 \\\\ #2 \\\\ \c_msg_help_text_tl } + } } -\cs_new_protected:Npn \msg_interrupt_details:xxx #1#2#3 +\cs_new_protected:Npn \msg_interrupt_wrap:xx #1#2 { - \iow_wrap:xnnnN - { \\ #3 } - { |~ } { 2 } { } \msg_interrupt_more_text:n - \iow_wrap:xnnnN { #1 \\ \\ #2 \\ \\ \c_msg_help_text_tl } - { ! ~ } { 2 } { } \msg_interrupt_text:n + \iow_wrap:xnnnN {#1} { | ~ } { 2 } { } \msg_interrupt_more_text:n + \iow_wrap:xnnnN {#2} { ! ~ } { 2 } { } \msg_interrupt_text:n } -\cs_new_protected:Npn \msg_interrupt_text:n #1 - { \tl_set:Nn \l_msg_text_tl {#1} } \cs_new_protected:Npn \msg_interrupt_more_text:n #1 { - \protected@edef \l_msg_internal_tl - { - |''''''''''''''''''''''''''''''''''''''''''''''' - #1 - \msg_newline: - |............................................... - } - \tex_errhelp:D \exp_after:wN { \l_msg_internal_tl } + \exp_args:Nx \tex_errhelp:D + { + |''''''''''''''''''''''''''''''''''''''''''''''' + #1 \iow_newline: + |............................................... + } } -\group_begin: % { +\group_begin: + \char_set_lccode:nn {`\{} {`\ } \char_set_lccode:nn {`\}} {`\ } \char_set_lccode:nn {`\&} {`\!} \char_set_catcode_active:N \& + \char_set_catcode_letter:N \. + \tl_new:N + \c_msg_hide_tl............................................ \tl_to_lowercase:n { \group_end: - \cs_new_protected:Npn \msg_interrupt_aux: + \cs_new_protected:Npn \msg_interrupt_text:n #1 { \iow_term:x { @@ -200,9 +190,17 @@ \iow_newline: ! } - \tl_put_right:No \l_msg_text_tl { \c_msg_hide_tl } - \cs_set_protected_nopar:Npx & - { \tex_errmessage:D { \exp_not:o { \l_msg_text_tl } } } + \group_begin: + \cs_set_protected_nopar:Npn & + { + \tex_errmessage:D + { + #1 + \c_msg_hide_tl............................................ + } + } + \exp_after:wN + \group_end: & } } @@ -220,7 +218,7 @@ \iow_term:x \iow_term:x { ************************************************* } } -\int_set:Nn \tex_errorcontextlines:D { -1 } +\int_gset:Nn \tex_errorcontextlines:D { -1 } \cs_new:Npn \msg_fatal_text:n #1 { Fatal~#1~error } \cs_new:Npn \msg_critical_text:n #1 { Critical~#1~error } \cs_new:Npn \msg_error_text:n #1 { #1~error } @@ -228,8 +226,6 @@ \cs_new:Npn \msg_info_text:n #1 { #1~info } \cs_new:Npn \msg_see_documentation_text:n #1 { \\ \\ See~the~#1~documentation~for~further~information. } -\prop_new:N \l_msg_redirect_classes_prop -\prop_new:N \l_msg_redirect_names_prop \cs_new_protected:Npn \msg_class_set:nn #1#2 { \prop_clear_new:c { l_msg_redirect_ #1 _prop } @@ -321,73 +317,126 @@ { \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } } \msg_class_set:nn { none } { } -\seq_new:N \l_msg_redirect_classes_seq \tl_new:N \l_msg_class_tl \tl_new:N \l_msg_current_class_tl -\tl_new:N \l_msg_current_module_tl +\prop_new:N \l_msg_redirect_classes_prop +\prop_new:N \l_msg_redirect_names_prop +\prop_new:N \l_msg_redirect_prop +\bool_new:N \l_msg_use_direct_bool \cs_new_protected:Npn \msg_use:nnnnxxxx #1#2#3#4#5#6#7#8 { - \cs_set_protected_nopar:Npx \msg_use_code: - { - \seq_clear:N \exp_not:N \l_msg_redirect_classes_seq - \exp_not:n {#2} - } - \cs_set_protected:Npx \msg_use_loop:n ##1 + \msg_if_exist:nnTF {#3} {#4} { - \seq_if_in:NnTF \exp_not:n \l_msg_redirect_classes_seq {#1} - { \msg_kernel_error:nn { msg } { message-loop } {#1} } + \cs_if_exist:cTF { msg_ #1 :nnxxxx } { - \seq_put_right:Nn \exp_not:N \l_msg_redirect_classes_seq {#1} - \exp_not:N \cs_if_exist:cTF { msg_ ##1 :nnxxxx } + \tl_set:Nn \l_msg_current_class_tl {#1} + \cs_set_protected_nopar:Npx \msg_use_code: { \exp_not:n {#2} } + \cs_set_protected_nopar:Npn \msg_use_or_change_class: { - \exp_not:N \use:c { msg_ ##1 :nnxxxx } - \exp_not:n { {#3} {#4} {#5} {#6} {#7} {#8} } + \tl_if_eq:NNTF \l_msg_current_class_tl \l_msg_class_tl + { \msg_use_code: } + { + \use:c { msg_ \l_msg_class_tl :nnxxxx } + {#3} {#4} {#5} {#6} {#7} {#8} + } } + \bool_if:NTF \l_msg_use_direct_bool { - \msg_kernel_error:nnx { msg } { message-class-unknown } {##1} + \bool_set_false:N \l_msg_use_direct_bool + \msg_use_code: } + { \msg_use_aux_i:nn {#3} {#4} } } + { \msg_kernel_error:nnx { msg } { message-class-unknown } {#1} } } - \cs_if_exist:cTF { \c_msg_text_prefix_tl #3 / #4 } - { \msg_use_aux:nnn {#1} {#3} {#4} } { \msg_kernel_error:nnxx { msg } { message-unknown } {#3} {#4} } } -\cs_new_protected:Npn \msg_use_aux:nnn #1#2#3 +\cs_new_protected_nopar:Npn \msg_use_code: { } +\cs_new_protected_nopar:Npn \msg_use_or_change_class: { } +\cs_new_protected:Npn \msg_use_aux_i:nn #1#2 + { + \prop_get:NnNTF \l_msg_redirect_prop { #1 / #2 } \l_msg_class_tl + { + \bool_set_true:N \l_msg_use_direct_bool + \msg_use_or_change_class: + } + { \msg_use_aux_ii:nn {#1} {#2} } + } +\cs_new_protected:Npn \msg_use_aux_ii:nn #1#2 + { + \prop_get:coNTF { l_msg_redirect_ \l_msg_current_class_tl _ prop } + { \msg_use_aux_iii:w #1 / #2 / \q_stop } \l_msg_class_tl + { \msg_use_or_change_class: } + { + \prop_get:coNTF { l_msg_redirect_ \l_msg_current_class_tl _ prop } + { \msg_use_aux_iv:w #1 / #2 \q_stop } \l_msg_class_tl + { \msg_use_or_change_class: } + { \msg_use_aux_v: } + } + } +\cs_new:Npn \msg_use_aux_iii:w #1 / #2 / #3 \q_stop { #1 / #2 } +\cs_new:Npn \msg_use_aux_iv:w #1 / #2 \q_stop { #1 } +\cs_new_protected:Npn \msg_use_aux_v: { - \tl_set:Nn \l_msg_current_class_tl {#1} - \tl_set:Nn \l_msg_current_module_tl {#2} - \prop_if_in:NnTF \l_msg_redirect_names_prop { // #2 / #3 / } - { \msg_use_loop_check:nn { names } { // #2 / #3 / } } - { \msg_use_aux:nn {#1} {#2} } + \prop_get:cnNF { l_msg_redirect_ \l_msg_current_class_tl _ prop } + { * } \l_msg_class_tl + { \tl_set_eq:NN \l_msg_class_tl \l_msg_current_class_tl } + \msg_use_or_change_class: } -\cs_new_protected:Npn \msg_use_aux:nn #1#2 +\cs_new_protected:Npn \msg_redirect_class:nn #1#2 { - \prop_if_in:cnTF { l_msg_redirect_ #1 _prop } {#2} - { \msg_use_loop_check:nn {#1} {#2} } + \cs_if_exist:cTF { msg_ #1 :nnxxxx } { - \prop_if_in:cnTF { l_msg_redirect_ #1 _prop } { * } - { \msg_use_loop_check:nn {#1} { * } } - { \msg_use_code: } + \cs_if_exist:cTF { msg_ #2 :nnxxxx } + { + \tl_set:Nn \l_msg_current_class_tl {#1} + \msg_redirect_class_aux:nnn {#1} {#2} {#2} + } + { \msg_kernel_error:nnx { msg } { message-class-unknown } {#2} } } + { \msg_kernel_error:nnx { msg } { message-class-unknown } {#1} } } -\cs_new_protected:Npn \msg_use_loop_check:nn #1#2 +\cs_new_protected:Npn \msg_redirect_class_aux:nnn #1#2#3 { - \prop_get:cnN { l_msg_redirect_ #1 _prop } {#2} \l_msg_class_tl - \tl_if_eq:NNTF \l_msg_current_class_tl \l_msg_class_tl + \prop_get:cnNTF { l_msg_redirect_ #2 _prop } { * } \l_msg_class_tl { - { \msg_use_code: } - { \msg_use_loop:o \l_msg_class_tl } + \tl_if_eq:NNTF \l_msg_class_tl \l_msg_current_class_tl + { \msg_kernel_error:nnxx { msg } { message-loop } {#1} {#3} } + { \msg_redirect_class_aux:nVn {#1} \l_msg_class_tl {#3} } } + { \prop_put:cnn { l_msg_redirect_ #1 _prop } { * } {#3} } } -\cs_new_protected_nopar:Npn \msg_use_code: { } -\cs_new_protected:Npn \msg_use_loop:n #1 { } -\cs_generate_variant:Nn \msg_use_loop:n { o } -\cs_new_protected:Npn \msg_redirect_class:nn #1#2 - { \prop_put:cnn { l_msg_redirect_ #1 _prop } { * } {#2} } +\cs_generate_variant:Nn \msg_redirect_class_aux:nnn { nV } \cs_new_protected:Npn \msg_redirect_module:nnn #1#2#3 - { \prop_put:cnn { l_msg_redirect_ #2 _prop } {#1} {#3} } + { + \cs_if_exist:cTF { msg_ #2 :nnxxxx } + { + \cs_if_exist:cTF { msg_ #3 :nnxxxx } + { + \tl_set:Nn \l_msg_current_class_tl {#1} + \msg_redirect_module_aux:nnnn {#1} {#2} {#3} {#3} + } + { \msg_kernel_error:nnx { msg } { message-class-unknown } {#3} } + } + { \msg_kernel_error:nnx { msg } { message-class-unknown } {#2} } + } +\cs_new_protected:Npn \msg_redirect_module_aux:nnnn #1#2#3#4 + { + \prop_get:cnNTF { l_msg_redirect_ #3 _prop } {#1} \l_msg_class_tl + { + \tl_if_eq:NNTF \l_msg_class_tl \l_msg_current_class_tl + { \msg_kernel_error:nnxx { msg } { message-loop } {#2} {#4} } + { \msg_redirect_moduel_aux:nVn {#1} {#2} \l_msg_class_tl {#4} } + } + { \prop_put:cnn { l_msg_redirect_ #2 _prop } {#1} {#4} } + } +\cs_generate_variant:Nn \msg_redirect_module_aux:nnnn { nnV } \cs_new_protected:Npn \msg_redirect_name:nnn #1#2#3 - { \prop_put:Nnn \l_msg_redirect_names_prop { // #1 / #2 / } {#3} } + { + \cs_if_exist:cTF { msg_ #3 :nnxxxx } + { \prop_put:Nnn \l_msg_redirect_prop { #1 / #2 } {#3} } + { \msg_kernel_error:nnx { msg } { message-class-unknown } {#3} } + } \cs_new_protected:Npn \msg_kernel_new:nnnn #1#2 { \msg_new:nnnn { LaTeX } { #1 / #2 } } \cs_new_protected:Npn \msg_kernel_new:nnn #1#2 @@ -445,11 +494,11 @@ } \cs_new_protected:Npn \msg_kernel_error:nnxxx #1#2#3#4#5 {\msg_kernel_error:nnxxxx {#1} {#2} {#3} {#4} {#5} { } } -\cs_set_protected:Npn \msg_kernel_error:nnxx #1#2#3#4 +\cs_gset_protected:Npn \msg_kernel_error:nnxx #1#2#3#4 { \msg_kernel_error:nnxxxx {#1} {#2} {#3} {#4} { } { } } -\cs_set_protected:Npn \msg_kernel_error:nnx #1#2#3 +\cs_gset_protected:Npn \msg_kernel_error:nnx #1#2#3 { \msg_kernel_error:nnxxxx {#1} {#2} {#3} { } { } { } } -\cs_set_protected:Npn \msg_kernel_error:nn #1#2 +\cs_gset_protected:Npn \msg_kernel_error:nn #1#2 { \msg_kernel_error:nnxxxx {#1} {#2} { } { } { } { } } \prop_new:N \l_msg_redirect_kernel_warning_prop \cs_new_protected:Npn \msg_kernel_warning:nnxxxx #1#2#3#4#5#6 @@ -592,6 +641,8 @@ { Zero~step~size~for~stepwise~function~#1. } \msg_kernel_new:nnn { prg } { replicate-neg } { Negative~argument~for~\prg_replicate:nn. } +\msg_kernel_new:nnn { kernel } { unknown-comparison } + { Relation~symbol~'#1'~unknown:~use~=,~<,~>,~==,~!=,~<=,~>=. } \msg_kernel_new:nnn { seq } { show } { The~sequence~\token_to_str:N #1~ |