summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/zhnumber
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-09-14 21:59:53 +0000
committerKarl Berry <karl@freefriends.org>2014-09-14 21:59:53 +0000
commit316a4982056f3d1332057d8b337e470357d69755 (patch)
treea0485a741ad02a6815d44e022fd875c201cd9a8d /Master/texmf-dist/tex/latex/zhnumber
parentcb121761c0eab3885766e8a10e3f6068d746d4a3 (diff)
zhnumber (14sep14)
git-svn-id: svn://tug.org/texlive/trunk@35169 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/zhnumber')
-rw-r--r--Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-big5.cfg5
-rw-r--r--Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-gbk.cfg5
-rw-r--r--Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-utf8.cfg5
-rw-r--r--Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty338
4 files changed, 165 insertions, 188 deletions
diff --git a/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-big5.cfg b/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-big5.cfg
index 623f99116fc..bd32e30c2af 100644
--- a/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-big5.cfg
+++ b/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-big5.cfg
@@ -19,11 +19,11 @@
%% This work has the LPPL maintenance status "maintained".
%% The Current Maintainer of this work is Qing Lee.
%%
-\GetIdInfo$Id: zhnumber.dtx 715 2014-09-09 14:11:20Z sobenlee $
+\GetIdInfo$Id: zhnumber.dtx 718 2014-09-13 09:13:29Z sobenlee $
{Chinese numerals with Big5 encoding}
\ProvidesExplFile
{\ExplFileName-big5.cfg}
- {\ExplFileDate}{2.0}{\ExplFileDescription}
+ {\ExplFileDate}{2.1}{\ExplFileDescription}
\zhnum_set_digits_map:nn { minus } { 璽 }
\zhnum_set_digits_map:nn { 0 } { 箂 }
\zhnum_set_digits_map:nn { null } { 〕 }
@@ -46,7 +46,6 @@
\zhnum_set_digits_map:nn { dot } { 翴 }
\zhnum_set_digits_map:nn { and } {  }
\zhnum_set_digits_map:nn { parts } { だぇ }
-\zhnum_set_digits_map:nn { s0 } { }
\zhnum_set_digits_map:nn { s1 } { 窾 }
\zhnum_set_digits_map:nn { s2 } { 货 }
\zhnum_set_digits_map:nn { s3 } {  }
diff --git a/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-gbk.cfg b/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-gbk.cfg
index ba98cc67668..ccba9ed19c0 100644
--- a/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-gbk.cfg
+++ b/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-gbk.cfg
@@ -19,11 +19,11 @@
%% This work has the LPPL maintenance status "maintained".
%% The Current Maintainer of this work is Qing Lee.
%%
-\GetIdInfo$Id: zhnumber.dtx 715 2014-09-09 14:11:20Z sobenlee $
+\GetIdInfo$Id: zhnumber.dtx 718 2014-09-13 09:13:29Z sobenlee $
{Chinese numerals with GBK encoding}
\ProvidesExplFile
{\ExplFileName-gbk.cfg}
- {\ExplFileDate}{2.0}{\ExplFileDescription}
+ {\ExplFileDate}{2.1}{\ExplFileDescription}
\zhnum_set_digits_map:nnn { minus } { simp } { 负 }
\zhnum_set_digits_map:nnn { minus } { trad } { 負 }
\zhnum_set_digits_map:nn { 0 } { 零 }
@@ -48,7 +48,6 @@
\zhnum_set_digits_map:nnn { dot } { trad } { 點 }
\zhnum_set_digits_map:nn { and } { 又 }
\zhnum_set_digits_map:nn { parts } { 分之 }
-\zhnum_set_digits_map:nn { s0 } { }
\zhnum_set_digits_map:nnn { s1 } { simp } { 万 }
\zhnum_set_digits_map:nnn { s1 } { trad } { 萬 }
\zhnum_set_digits_map:nnn { s2 } { simp } { 亿 }
diff --git a/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-utf8.cfg b/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-utf8.cfg
index 99291d70e57..9bdbebb6a2c 100644
--- a/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-utf8.cfg
+++ b/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-utf8.cfg
@@ -19,11 +19,11 @@
%% This work has the LPPL maintenance status "maintained".
%% The Current Maintainer of this work is Qing Lee.
%%
-\GetIdInfo$Id: zhnumber.dtx 715 2014-09-09 14:11:20Z sobenlee $
+\GetIdInfo$Id: zhnumber.dtx 718 2014-09-13 09:13:29Z sobenlee $
{Chinese numerals with UTF8 encoding}
\ProvidesExplFile
{\ExplFileName-utf8.cfg}
- {\ExplFileDate}{2.0}{\ExplFileDescription}
+ {\ExplFileDate}{2.1}{\ExplFileDescription}
\zhnum_set_digits_map:nnn { minus } { simp } { 璐 }
\zhnum_set_digits_map:nnn { minus } { trad } { 璨 }
\zhnum_set_digits_map:nn { 0 } { 闆 }
@@ -48,7 +48,6 @@
\zhnum_set_digits_map:nnn { dot } { trad } { 榛 }
\zhnum_set_digits_map:nn { and } { 鍙 }
\zhnum_set_digits_map:nn { parts } { 鍒嗕箣 }
-\zhnum_set_digits_map:nn { s0 } { }
\zhnum_set_digits_map:nnn { s1 } { simp } { 涓 }
\zhnum_set_digits_map:nnn { s1 } { trad } { 钀 }
\zhnum_set_digits_map:nnn { s2 } { simp } { 浜 }
diff --git a/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty b/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty
index 3ff77026369..6d81896fdb3 100644
--- a/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty
+++ b/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty
@@ -21,11 +21,11 @@
%%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
-\GetIdInfo$Id: zhnumber.dtx 715 2014-09-09 14:11:20Z sobenlee $
+\GetIdInfo$Id: zhnumber.dtx 718 2014-09-13 09:13:29Z sobenlee $
{Typesetting numbers with Chinese glyphs}
\ProvidesExplPackage
{\ExplFileName}
- {\ExplFileDate}{2.0}{\ExplFileDescription}
+ {\ExplFileDate}{2.1}{\ExplFileDescription}
\msg_new:nnn { zhnumber } { l3-too-old }
{
Support~package~'expl3'~too~old. \\\\
@@ -39,14 +39,15 @@
\DeclareExpandableDocumentCommand \zhnumber { +o +m }
{
\IfNoValueTF {#1}
- { \zhnum_number:n {#2} }
- { \zhnumberwithoptions {#1} {#2} }
+ { \zhnum_number:f }
+ { \zhnumberwithoptions {#1} }
+ {#2}
}
\NewDocumentCommand \zhnumberwithoptions { +m +m }
{
\group_begin:
\keys_set:nn { zhnum / options } {#1}
- \zhnum_number:n {#2}
+ \zhnum_number:f {#2}
\group_end:
}
\cs_new:Npn \zhnum_number:n #1
@@ -57,6 +58,7 @@
{ \__zhnum_integer_or_fraction:www #1 / \q_nil / \q_stop }
{ \zhnum_decimal:nn {#1} {#2} }
}
+\cs_generate_variant:Nn \zhnum_number:n { f }
\cs_new:Npn \__zhnum_integer_or_fraction:www #1 / #2 / #3 \q_stop
{
\quark_if_nil:nTF {#2}
@@ -67,58 +69,56 @@
{
\quark_if_nil:nTF {#3}
{
- \zhnum_blank_to_zero:f {#1}
+ \zhnum_blank_to_zero:n {#1}
\c__zhnum_parts_tl
- \zhnum_blank_to_zero:f {#2}
+ \zhnum_blank_to_zero:n {#2}
}
{
- \tl_if_blank:fF {#2}
+ \tl_if_blank:nF {#2}
{
\zhnum_number:n {#2}
\c__zhnum_and_tl
}
- \zhnum_blank_to_zero:f {#1}
+ \zhnum_blank_to_zero:n {#1}
\c__zhnum_parts_tl
- \zhnum_blank_to_zero:f {#3}
+ \zhnum_blank_to_zero:n {#3}
}
}
-\cs_generate_variant:Nn \tl_if_blank:nF { f }
\cs_new:Npn \zhnum_decimal:nn #1#2
{
- \zhnum_blank_to_zero:f {#1} \c__zhnum_dot_tl
- \tl_if_blank:fTF {#2}
+ \zhnum_blank_to_zero:n {#1} \c__zhnum_dot_tl
+ \tl_if_blank:nTF {#2}
{ \c__zhnum_zero_tl }
{ \zhnum_digits_zero:n {#2} }
}
-\cs_generate_variant:Nn \tl_if_blank:nTF { f }
\cs_new:Npn \zhnum_blank_to_zero:n #1
{
\tl_if_blank:nTF {#1}
{ \c__zhnum_zero_tl }
{ \zhnum_number:n {#1} }
}
-\cs_generate_variant:Nn \zhnum_blank_to_zero:n { f }
-\DeclareExpandableDocumentCommand \zhnum { o m }
+\DeclareExpandableDocumentCommand \zhnum { +o +m }
{
\IfNoValueTF {#1}
- { \zhnum_counter:n {#2} }
- { \zhnumwithoptions {#1} {#2} }
+ { \zhnum_counter:n }
+ { \zhnumwithoptions {#1} }
+ {#2}
}
-\NewDocumentCommand \zhnumwithoptions { m m }
+\NewDocumentCommand \zhnumwithoptions { +m +m }
{
\group_begin:
\keys_set:nn { zhnum / options } {#1}
\zhnum_counter:n {#2}
\group_end:
}
-\cs_new_nopar:Npn \zhnum_counter:n #1
- { \exp_args:Nc \zhnum_counter:Nn { c@#1 } {#1} }
-\cs_new:Npn \zhnum_counter:Nn #1#2
+\cs_new:Npn \zhnum_counter:n #1
{
- \token_if_int_register:NTF #1
- { \zhnum_int:n {#1} }
- { \__msg_expandable_error:n { `#2' is not a LaTeX counter. } }
+ \int_if_exist:cTF { c@#1 }
+ { \zhnum_int:c { c@#1 } }
+ { \__zhnum_counter_error:n {#1} }
}
+\cs_new:Npn \__zhnum_counter_error:n #1
+ { \__msg_expandable_error:n { `#1'~is~not~a~LaTeX~counter. } }
\cs_new:Npn \zhnum_int:n #1
{
\int_compare:nNnTF {#1} > \c_zero
@@ -132,6 +132,7 @@
{ \c__zhnum_zero_tl }
}
}
+\cs_generate_variant:Nn \zhnum_int:n { c }
\cs_new:Npn \zhnum_integer:n #1
{
\exp_after:wN \__zhnum_read_integer:www
@@ -193,82 +194,63 @@
\exp_after:wN \use_ii:nn
\fi:
}
-\cs_new_nopar:Npn \zhnum_parse_number:n #1
+\cs_new:Npn \zhnum_parse_number:n #1
{ \exp_args:Nf \zhnum_parse_number:nn { \tl_count:n {#1} } {#1} }
-\cs_new_nopar:Npn \zhnum_parse_number:nn #1#2
- { \exp_args:Nf \__zhnum_parse_number:nnn { \int_mod:nn {#1} \c_four } {#1} {#2} }
-\cs_new_nopar:Npn \__zhnum_parse_number:nnn #1#2#3
+\cs_new:Npn \zhnum_parse_number:nn #1
+ { \exp_args:Nf \__zhnum_parse_number:nnn { \int_mod:nn {#1} \c_four } {#1} }
+\cs_new:Npn \__zhnum_parse_number:nnn #1#2
{
\int_compare:nNnTF {#2} < \c_two
- { \zhnum_digit_map:n {#3} }
+ { \zhnum_digit_map:n }
{
- \zhnum_split_number:fNNfn { \zhnum_insert_zeros:n {#1} #3 }
- \c_true_bool \c_true_bool
- {
- \int_compare:nNnTF {#1} = \c_zero
- { \int_eval:n { (#2) / \c_four - \c_one } }
- { \int_div_truncate:nn {#2} \c_four }
- }
- { \c_zero }
+ \int_compare:nNnTF {#1} = \c_zero
+ { \zhnum_split_number:fn { \int_eval:n { #2 / \c_four - \c_one } } }
+ { \__zhnum_split_number_aux:nnn {#1} {#2} }
}
}
\cs_generate_variant:Nn \zhnum_parse_number:n { f }
-\cs_new_nopar:Npn \zhnum_insert_zeros:n #1
- {
- \if_case:w \etex_numexpr:D #1 - \c_one \scan_stop:
- \or: \exp_after:wN \use_none:n
- \or: \exp_after:wN \use_none:nn
- \else: \exp_after:wN \use_none:nnn
- \fi:
- 0 0 0
+\cs_new:Npn \__zhnum_split_number_aux:nnn #1#2
+ {
+ \exp_after:wN \__zhnum_split_number_aux:wwn
+ \tex_number:D \int_div_truncate:nn {#2} \c_four
+ \if_case:w #1 \exp_stop_f:
+ \or: \exp_after:wN \use:n
+ \or: \exp_after:wN \use_i_ii:nnn
+ \or: \exp_after:wN \use_i:nnn
+ \fi:
+ { \exp_stop_f: ; 0 } 0 0 ;
}
-\cs_new_nopar:Npn \zhnum_split_number:nNNnn #1#2#3#4#5
+\cs_new:Npn \__zhnum_split_number_aux:wwn #1 ; #2 ; #3
+ { \zhnum_split_number:nn {#1} { #2#3 } }
+\cs_new:Npn \zhnum_split_number:nn #1#2
{
- \__zhnum_split_number:fnNNnn { \zhnum_number_item:nn {#1} {#5} }
- {#1} #2#3 {#4} {#5}
+ \zhnum_split_number:NNnNNNNw \c_true_bool \c_true_bool {#1}
+ #2 \q_recursion_tail \q_nil \q_nil \q_nil \q_recursion_stop
}
-\cs_new_nopar:Npn \__zhnum_split_number:nnNNnn #1#2#3#4#5#6
+\cs_generate_variant:Nn \zhnum_split_number:nn { f }
+\cs_new:Npn \zhnum_split_number:NNnNNNNw #1#2#3#4#5#6#7#8 \q_recursion_stop
{
- \int_compare:nNnTF {#1} = \c_zero
- { \__zhnum_split_number_aux:NNfnnn \c_false_bool \c_true_bool }
+ \quark_if_recursion_tail_stop:N #4
+ \int_compare:nNnTF { #4#5#6#7 } = \c_zero
+ { \use_i:nn }
{
- \bool_if:NF #3 { \c__zhnum_zero_tl }
- \zhnum_process_number:NNn #3#4 {#1}
- \exp_args:Nf \zhnum_scale_map:n { \int_eval:n { #5 - #6 } }
- \int_compare:nNnTF { \int_mod:nn {#1} \c_ten } = \c_zero
- { \__zhnum_split_number_aux:NNfnnn \c_false_bool \c_true_bool }
- { \__zhnum_split_number_aux:NNfnnn \c_true_bool \c_false_bool }
+ \bool_if:NF #1 { \c__zhnum_zero_tl }
+ \zhnum_process_number:NNNNNN #4#5#6#7#1#2
+ \zhnum_scale_map:n {#3}
+ \int_compare:nNnTF {#7} = \c_zero
}
- { \int_eval:n { #6 + \c_one } } {#2} {#5} {#6}
- }
-\cs_new_nopar:Npn \__zhnum_split_number_aux:NNnnnn #1#2#3#4#5#6
- {
- \int_compare:nNnF {#5} = {#6}
- { \zhnum_split_number:nNNnn {#4} #1#2 {#5} {#3} }
+ { \zhnum_split_number:NNfNNNNw \c_false_bool \c_true_bool }
+ { \zhnum_split_number:NNfNNNNw \c_true_bool \c_false_bool }
+ { \int_eval:n { #3 - \c_one } } #8 \q_recursion_stop
}
-\cs_generate_variant:Nn \zhnum_split_number:nNNnn { fNNf }
-\cs_generate_variant:Nn \__zhnum_split_number:nnNNnn { f }
-\cs_generate_variant:Nn \__zhnum_split_number_aux:NNnnnn { NNf }
-\cs_new_nopar:Npn \zhnum_number_item:nn #1#2
- { \__zhnum_number_item:nNNNN {#2} #1 \q_recursion_stop }
-\cs_new_nopar:Npn \__zhnum_number_item:nNNNN #1#2#3#4#5
- {
- \int_compare:nNnTF {#1} = \c_zero
- { \__zhnum_recursion_stop:NNNNw #2#3#4#5 }
- { \__zhnum_number_item:fNNNN { \int_eval:n { #1 - \c_one } } }
- }
-\cs_generate_variant:Nn \__zhnum_number_item:nNNNN { f }
-\cs_new_nopar:Npn \__zhnum_recursion_stop:NNNNw #1#2#3#4#5 \q_recursion_stop
- { #1#2#3#4 }
-\cs_new_nopar:Npn \zhnum_process_number:NNn #1#2#3
- { \zhnum_process_number:NNNNNN #3#1#2 }
-\cs_new_nopar:Npn \zhnum_process_number:NNNNNN #1#2#3#4#5#6
+\cs_generate_variant:Nn \zhnum_split_number:NNnNNNNw { NNf }
+\cs_new:Npn \zhnum_process_number:NNNNNN #1#2#3#4#5#6
{
\int_compare:nNnTF {#1} = \c_zero
{ \bool_if:NF #6 { \c__zhnum_zero_tl } }
{ \zhnum_digit_map:n {#1} \c__zhnum_thousand_tl }
\int_compare:nNnTF {#2} = \c_zero
- { \int_compare:nNnT { #1 * (#3#4) } > \c_zero { \c__zhnum_zero_tl } }
+ { \int_compare:nNnF { #1 * (#3#4) } = \c_zero { \c__zhnum_zero_tl } }
{
\bool_if:nTF
{ \l__zhnum_ancient_bool && \int_compare_p:nNn {#2} = \c_two }
@@ -276,7 +258,7 @@
{ \zhnum_digit_map:n {#2} \c__zhnum_hundred_tl }
}
\int_compare:nNnTF {#3} = \c_zero
- { \int_compare:nNnT { #2 * #4 } > \c_zero { \c__zhnum_zero_tl } }
+ { \int_compare:nNnF { #2 * #4 } = \c_zero { \c__zhnum_zero_tl } }
{
\bool_if:nF
{
@@ -298,18 +280,14 @@
}
\int_compare:nNnF {#4} = \c_zero { \zhnum_digit_map:n {#4} }
}
-\DeclareExpandableDocumentCommand \zhdigits { s o m }
+\DeclareExpandableDocumentCommand \zhdigits { +s +o +m }
{
\IfNoValueTF {#2}
- { \zhnum_digits:Nn #1 {#3} }
- {
- \IfBooleanTF #1
- { \zhdigitswithoptions * }
- { \zhdigitswithoptions }
- {#2} {#3}
- }
+ { \zhnum_digits:Nn #1 }
+ { \zhdigitswithoptions {#1} {#2} }
+ {#3}
}
-\NewDocumentCommand \zhdigitswithoptions { s m m }
+\NewDocumentCommand \zhdigitswithoptions { +m +m +m }
{
\group_begin:
\keys_set:nn { zhnum / options } {#2}
@@ -369,17 +347,17 @@
_tl
\cs_end:
}
-\DeclareExpandableDocumentCommand \zhdate { s m }
+\DeclareExpandableDocumentCommand \zhdate { +s +m }
{
\__zhnum_date:www #2 \q_stop
- \IfBooleanT {#1}
- { \__zhnum_week_day:www #2 \q_stop }
+ \IfBooleanT #1
+ { \__zhnum_week_day:www #2 \q_stop }
}
-\cs_new_nopar:Npn \__zhnum_date:www #1/#2/#3 \q_stop
+\cs_new:Npn \__zhnum_date:www #1/#2/#3 \q_stop
{
\zhnum_check_time:Nn \zhnum_digits_null:n {#1} \c__zhnum_year_tl
- \zhnum_check_time:Nn \zhnum_integer:n {#2} \c__zhnum_month_tl
- \zhnum_check_time:Nn \zhnum_integer:n {#3} \c__zhnum_day_tl
+ \zhnum_check_time:Nn \zhnum_int:n {#2} \c__zhnum_month_tl
+ \zhnum_check_time:Nn \zhnum_int:n {#3} \c__zhnum_day_tl
}
\cs_new_nopar:Npn \zhtoday
{
@@ -387,13 +365,13 @@
\zhnum_check_time:Nn \zhnum_int:n \tex_month:D \c__zhnum_month_tl
\zhnum_check_time:Nn \zhnum_int:n \tex_day:D \c__zhnum_day_tl
}
-\cs_new_nopar:Npn \zhnum_check_time:Nn #1
- { \bool_if:NTF \l__zhnum_time_bool {#1} { \int_eval:n } }
-\cs_new_nopar:Npn \zhweekday #1
+\cs_new:Npn \zhnum_check_time:Nn #1
+ { \bool_if:NTF \l__zhnum_time_bool {#1} { \int_to_arabic:n } }
+\cs_new:Npn \zhweekday #1
{ \__zhnum_week_day:www #1 \q_stop }
-\cs_new_nopar:Npn \__zhnum_week_day:www #1/#2/#3 \q_stop
+\cs_new:Npn \__zhnum_week_day:www #1/#2/#3 \q_stop
{
- \if_case:w \etex_numexpr:D \zhnum_Zeller:nnn {#1} {#2} {#3} \scan_stop:
+ \if_case:w \zhnum_Zeller:nnn {#1} {#2} {#3} \exp_stop_f:
\c__zhnum_sat_tl
\or: \c__zhnum_sun_tl
\or: \c__zhnum_mon_tl
@@ -403,7 +381,7 @@
\or: \c__zhnum_fri_tl
\fi:
}
-\cs_new_nopar:Npn \zhnum_Zeller:nnn #1#2#3
+\cs_new:Npn \zhnum_Zeller:nnn #1#2#3
{
\int_compare:nNnTF
{ #1 \zhnum_two_digits:n {#2} \zhnum_two_digits:n {#3} } > { 1582 10 04 }
@@ -411,18 +389,18 @@
{ \__zhnum_Zeller_aux:Nnnn \zhnum_Zeller_Julian:nnn }
{#1} {#2} {#3}
}
-\cs_new_nopar:Npn \__zhnum_Zeller_aux:Nnnn #1#2#3#4
+\cs_new:Npn \__zhnum_Zeller_aux:Nnnn #1#2#3#4
{
\int_compare:nNnTF {#3} < \c_three
{ #1 { #2 - \c_one } { #3 + \c_twelve } {#4} }
{ #1 {#2} {#3} {#4} }
}
-\cs_new_nopar:Npn \zhnum_two_digits:n #1
+\cs_new:Npn \zhnum_two_digits:n #1
{
\int_compare:nNnT {#1} < \c_ten { 0 }
\int_eval:n {#1}
}
-\cs_new_nopar:Npn \zhnum_Zeller_Gregorian:nnn #1#2#3
+\cs_new:Npn \zhnum_Zeller_Gregorian:nnn #1#2#3
{
\int_mod:nn
{
@@ -435,7 +413,7 @@
}
{ \c_seven }
}
-\cs_new_nopar:Npn \zhnum_Zeller_Julian:nnn #1#2#3
+\cs_new:Npn \zhnum_Zeller_Julian:nnn #1#2#3
{
\int_mod:nn
{
@@ -447,17 +425,17 @@
}
{ \c_seven }
}
-\cs_new_nopar:Npn \zhtime #1
+\cs_new:Npn \zhtime #1
{ \__zhnum_time:ww #1 \q_stop }
\group_begin:
\char_set_lccode:nn { `\; } { `\: }
\tl_to_lowercase:n
{
\group_end:
- \cs_new_nopar:Npn \__zhnum_time:ww #1 ; #2 \q_stop
+ \cs_new:Npn \__zhnum_time:ww #1 ; #2 \q_stop
{
- \zhnum_check_time:Nn \zhnum_integer:n {#1} \c__zhnum_hour_tl
- \zhnum_check_time:Nn \zhnum_integer:n {#2} \c__zhnum_minute_tl
+ \zhnum_check_time:Nn \zhnum_int:n {#1} \c__zhnum_hour_tl
+ \zhnum_check_time:Nn \zhnum_int:n {#2} \c__zhnum_minute_tl
}
}
\cs_new_nopar:Npn \zhcurrtime
@@ -467,33 +445,36 @@
\zhnum_check_time:Nn \zhnum_int:n
{ \int_mod:nn \tex_time:D { 60 } } \c__zhnum_minute_tl
}
-\cs_new_nopar:Npn \zhnum_digit_map:n #1
+\cs_new:Npn \zhnum_digit_map:n #1
{ \use:c { c__zhnum_ #1 _tl } }
-\cs_new_nopar:Npn \zhnum_scale_map:n #1
+\cs_new:Npn \zhnum_scale_map:n #1
{
\cs_if_exist_use:cF { c__zhnum_s #1 _tl }
{ \zhnum_scale_map_hook:n {#1} }
}
-\cs_new_nopar:Npn \zhnum_scale_map_loop:n #1
- { \zhnum_scale_map:n { \int_mod:nn {#1} \g__zhnum_scale_int } }
-\int_new:N \g__zhnum_scale_int
-\int_set_eq:NN \g__zhnum_scale_int \c_eleven
+\cs_new:Npn \zhnum_scale_map_loop:n #1
+ { \zhnum_scale_map:n { \int_mod:nn {#1} \l__zhnum_scale_int } }
+\cs_generate_variant:Nn \zhnum_scale_map:n { f }
+\int_new:N \l__zhnum_scale_int
+\int_set_eq:NN \l__zhnum_scale_int \c_eleven
\cs_new_eq:NN \zhnum_scale_map_hook:n \zhnum_scale_map_loop:n
-\NewDocumentCommand \zhnumExtendScaleMap { > { \TrimSpaces } o m }
+\tl_const:cn { c__zhnum_s0_tl } { }
+\NewDocumentCommand \zhnumExtendScaleMap { > { \TrimSpaces } +o +m }
{
\int_zero:N \l_tmpa_int
- \clist_map_inline:nn {#2}
- {
- \int_incr:N \l_tmpa_int
- \tl_set:Nx \l_tmpa_tl
- { c__zhnum_s \int_eval:n { \l_tmpa_int + \c_eleven } _tl }
- \tl_if_exist:cF { \l_tmpa_tl }
- { \int_incr:N \g__zhnum_scale_int }
- \tl_set:cn { \l_tmpa_tl } {##1}
- }
+ \clist_map_function:nN {#2} \zhnum_set_scale:n
\IfNoValueF {#1}
{ \cs_set:Npn \zhnum_scale_map_hook:n ##1 {#1} }
}
+\cs_new_protected:Npn \zhnum_set_scale:n #1
+ {
+ \int_incr:N \l_tmpa_int
+ \tl_set:Nx \l_tmpa_tl
+ { c__zhnum_s \int_eval:n { \l_tmpa_int + \c_eleven } _tl }
+ \tl_if_exist:cF { \l_tmpa_tl }
+ { \int_incr:N \l__zhnum_scale_int }
+ \tl_set:cn { \l_tmpa_tl } {#1}
+ }
\group_begin:
\tl_set:Nn \l_tmpa_tl
@@ -543,16 +524,16 @@
\group_end:
\keys_define:nn { zhnum / options } { \exp_not:o \l_tmpa_tl }
}
-\cs_new_protected_nopar:Npn \zhnum_set_digits_map:nn #1#2
+\cs_new_protected:Npn \zhnum_set_digits_map:nn #1#2
{ \prop_put:Nnn \l__zhnum_cfg_map_prop {#1} {#2} }
-\cs_new_protected_nopar:Npn \zhnum_set_digits_map:nnn #1#2#3
+\cs_new_protected:Npn \zhnum_set_digits_map:nnn #1#2#3
{
\prop_put_if_new:Nnn \l__zhnum_cfg_map_prop {#1} {#3}
\prop_put:Nnn \l__zhnum_cfg_map_var_prop {#1_#2} {#3}
}
-\cs_new_protected_nopar:Npn \zhnum_set_financial_map:nn #1#2
+\cs_new_protected:Npn \zhnum_set_financial_map:nn #1#2
{ \prop_put:Nnn \l__zhnum_cfg_map_finan_prop {#1} {#2} }
-\cs_new_protected_nopar:Npn \zhnum_set_financial_map:nnn #1#2#3
+\cs_new_protected:Npn \zhnum_set_financial_map:nnn #1#2#3
{
\prop_put_if_new:Nnn \l__zhnum_cfg_map_finan_prop {#1} {#3}
\prop_put:Nnn \l__zhnum_cfg_map_var_prop { financial_#1_#2 } {#3}
@@ -563,40 +544,40 @@
\cs_new_protected_nopar:Npn \zhnum_parse_config:
{
\prop_map_function:NN \l__zhnum_cfg_map_prop \zhnum_check_simp:nn
- \bool_if:NF \l__zhnum_reset_bool
- { \prop_map_function:NN \l__zhnum_cfg_map_prop \zhnum_check_financial:nn }
\zhnum_set_zero:
\zhnum_set_week_day:
+ \bool_if:NF \l__zhnum_reset_bool
+ {
+ \zhnum_assgin_const:
+ \bool_set_true:N \l__zhnum_reset_bool
+ }
}
-\cs_new_protected_nopar:Npn \zhnum_check_simp:nn #1#2
+\cs_new_protected:Npn \zhnum_check_simp:nn #1#2
{
- \__zhnum_check_simp_aux:nn {#1} {#2}
+ \__zhnum_check_simp_aux:nn {#2} {#1}
\prop_get:NnNT \l__zhnum_cfg_map_finan_prop {#1} \l_tmpa_tl
- { \exp_args:Nno \__zhnum_check_simp_aux:nn { financial_ #1 } \l_tmpa_tl }
+ { \exp_args:No \__zhnum_check_simp_aux:nn { \l_tmpa_tl } { financial_ #1 } }
}
-\cs_new_protected_nopar:Npn \__zhnum_check_simp_aux:nn #1#2
+\cs_new_protected:Npn \__zhnum_check_simp_aux:nn #1#2
{
- \prop_get:NnNTF \l__zhnum_cfg_map_var_prop { #1 _trad } \l_tmpa_tl
+ \prop_get:NnNTF \l__zhnum_cfg_map_var_prop { #2 _trad } \l_tmpa_tl
{
- \prop_get:NnNTF \l__zhnum_cfg_map_var_prop { #1 _simp } \l_tmpb_tl
- {
- \tl_set:cx { l__zhnum_ #1 _tl }
- {
- \exp_not:n { \bool_if:NTF \l__zhnum_simp_bool }
- { \exp_not:o \l_tmpb_tl } { \exp_not:o \l_tmpa_tl }
- }
- }
+ \prop_get:NnNF \l__zhnum_cfg_map_var_prop { #2 _simp } \l_tmpb_tl
+ { \tl_set:Nn \l_tmpb_tl {#1} }
+ \tl_set:cx { l__zhnum_ #2 _tl }
{
- \tl_set:cx { l__zhnum_ #1 _tl }
- {
- \exp_not:n { \bool_if:NTF \l__zhnum_simp_bool }
- { \exp_not:n {#2} } { \exp_not:o \l_tmpa_tl }
- }
+ \exp_not:n { \bool_if:NTF \l__zhnum_simp_bool }
+ { \exp_not:o \l_tmpb_tl } { \exp_not:o \l_tmpa_tl }
}
}
- { \tl_set:cn { l__zhnum_ #1 _tl } {#2} }
+ { \tl_set:cn { l__zhnum_ #2 _tl } {#1} }
}
-\cs_new_protected_nopar:Npn \zhnum_check_financial:nn #1#2
+\cs_new_protected_nopar:Npn \zhnum_assgin_const:
+ {
+ \prop_map_function:NN \l__zhnum_cfg_map_prop \zhnum_check_financial:nn
+ \zhnum_set_alias:
+ }
+\cs_new_protected:Npn \zhnum_check_financial:nn #1#2
{
\prop_get:NnNTF \l__zhnum_cfg_map_finan_prop {#1} \l_tmpa_tl
{
@@ -616,7 +597,7 @@
{
\tl_set:cx { l__zhnum_0_tl }
{
- \exp_not:n { \bool_if:nTF \l__zhnum_null_bool }
+ \exp_not:n { \bool_if:NTF \l__zhnum_null_bool }
{ \exp_not:o \l__zhnum_null_tl } { \exp_not:v { l__zhnum_0_tl } }
}
}
@@ -636,28 +617,27 @@
{ \exp_not:N \c__zhnum_weekday_tl \exp_not:v { l__zhnum_6_tl } }
\tl_set:Nx \l__zhnum_sun_tl
{ \exp_not:N \c__zhnum_weekday_tl \exp_not:o \l__zhnum_day_tl }
- \bool_if:NF \l__zhnum_reset_bool
- {
- \clist_map_inline:nn { mon , tue , wed , thu , fri , sat , sun }
- {
- \zhnum_assgin_const_tl:cx
- { c__zhnum_ ##1 _tl } { \exp_not:c { l__zhnum_ ##1 _tl } }
- }
- \bool_set_true:N \l__zhnum_reset_bool
- }
}
+\clist_map_inline:nn { mon , tue , wed , thu , fri , sat , sun }
+ { \tl_const:cx { c__zhnum_ #1 _tl } { \exp_not:c { l__zhnum_ #1 _tl } } }
\cs_new_eq:NN \zhnum_assgin_const_tl:cx \tl_const:cx
\AtEndOfPackage
{ \cs_set_eq:NN \zhnum_assgin_const_tl:cx \tl_set:cx }
-\cs_new_protected_nopar:Npn \zhnum_set_alias:
- {
- \tl_const:Nx \c__zhnum_zero_tl { \exp_not:c { c__zhnum_ 0 _tl } }
- \tl_const:Nx \c__zhnum_ten_tl { \exp_not:c { c__zhnum_ 10 _tl } }
- \tl_const:Nx \c__zhnum_hundred_tl { \exp_not:c { c__zhnum_ 100 _tl } }
- \tl_const:Nx \c__zhnum_thousand_tl { \exp_not:c { c__zhnum_ 1000 _tl } }
+\cs_new_eq:NN \zhnum_set_alias:NN \cs_new_eq:NN
+\cs_new_protected_nopar:Npx \zhnum_set_alias:
+ {
+ \zhnum_set_alias:NN \exp_not:N \c__zhnum_zero_tl
+ \exp_not:c { c__zhnum_ 0 _tl }
+ \zhnum_set_alias:NN \exp_not:N \c__zhnum_ten_tl
+ \exp_not:c { c__zhnum_ 10 _tl }
+ \zhnum_set_alias:NN \exp_not:N \c__zhnum_hundred_tl
+ \exp_not:c { c__zhnum_ 100 _tl }
+ \zhnum_set_alias:NN \exp_not:N \c__zhnum_thousand_tl
+ \exp_not:c { c__zhnum_ 1000 _tl }
}
-\AtEndOfPackage { \zhnum_set_alias: }
-\cs_new_protected_nopar:Npn \zhnum_load_cfg:n #1
+\AtEndOfPackage
+ { \cs_set_eq:NN \zhnum_set_alias:NN \tl_set_eq:NN }
+\cs_new_protected:Npn \zhnum_load_cfg:n #1
{
\zhnum_set_cfg_name:Nn \l__zhnum_cfg_tl {#1}
\tl_if_eq:NNF \l__zhnum_cfg_tl \l__zhnum_last_cfg_tl
@@ -665,14 +645,14 @@
\zhnum_parse_config:
}
\cs_generate_variant:Nn \zhnum_load_cfg:n { o }
-\cs_new_protected_nopar:Npn \zhnum_update_cfg:n #1
+\cs_new_protected:Npn \zhnum_update_cfg:n #1
{
\prop_if_exist:cTF { g__zhnum_cfg_ \l__zhnum_cfg_tl _prop }
{ \tl_set_eq:NN \l__zhnum_last_cfg_tl \l__zhnum_cfg_tl }
{ \zhnum_input_cfg:n {#1} }
\__zhnum_update_cfg_prop:N \prop_set_eq:Nc
}
-\cs_new_protected_nopar:Npn \zhnum_input_cfg:n #1
+\cs_new_protected:Npn \zhnum_input_cfg:n #1
{
\file_if_exist_input:nTF { zhnumber - #1 .cfg }
{
@@ -688,7 +668,7 @@
\__zhnum_update_cfg_prop:N \__zhnum_prop_gset_eq:Nn
\group_end:
}
-\cs_new_protected_nopar:Npn \__zhnum_update_cfg_prop:N #1
+\cs_new_protected:Npn \__zhnum_update_cfg_prop:N #1
{
#1 \l__zhnum_cfg_map_prop { g__zhnum_cfg_ \l__zhnum_cfg_tl _prop }
#1 \l__zhnum_cfg_map_var_prop { g__zhnum_cfg_var_ \l__zhnum_cfg_tl _prop }
@@ -727,7 +707,7 @@
}
\if_predicate:w \zhnum_if_unicode_engine_p:
\cs_new_eq:NN \zhnum_set_catcode: \prg_do_nothing:
- \cs_new_protected_nopar:Npn \zhnum_set_cfg_name:Nn #1#2
+ \cs_new_protected:Npn \zhnum_set_cfg_name:Nn #1#2
{
\tl_set:Nx \l__zhnum_encoding_tl {#2}
\tl_set:Nx #1 { \tl_to_str:N \l__zhnum_encoding_tl }
@@ -754,7 +734,7 @@
}
\int_new:N \l__zhnum_byte_min_int
\int_new:N \l__zhnum_byte_max_int
- \cs_new_protected_nopar:Npn \zhnum_set_cfg_name:Nn #1#2
+ \cs_new_protected:Npn \zhnum_set_cfg_name:Nn #1#2
{
\tl_set:Nx \l__zhnum_encoding_tl {#2}
\tl_set:Nx #1
@@ -812,8 +792,8 @@
\tl_new:N \l__zhnum_encoding_tl
\msg_new:nnnn { zhnumber } { encoding-invalid }
{ The~encoding~`#1'~is~invalid. }
- { Available~encoding~are~`UTF8',~`GBK'~and~`Big5'. }
-\NewDocumentCommand \zhnumsetup { m }
+ { Available~encodings~are~`UTF8',~`GBK'~and~`Big5'. }
+\NewDocumentCommand \zhnumsetup { +m }
{
\keys_set:nn { zhnum / options } {#1}
\tex_ignorespaces:D