%% %% This is file `l3num.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% l3num.dtx (with options: `package,trace') %% %% %% EXPERIMENTAL CODE %% %% Do not distribute this file without also distributing the %% source files specified above. %% %% Do not distribute a modified version of this file. %% %% %% File: l3num.dtx Copyright (C) 2005-2008 Frank Mittelbach, 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. %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} \GetIdInfo$Id: l3num.dtx 741 2008-08-01 13:37:16Z morten $ {L3 Experimental token numbers} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} \RequirePackage{l3expan}\par \let_new:NN \num_value:w \tex_number:D \let_new:NN \num_eval:w \etex_numexpr:D \let_new:NN \num_eval_end: \scan_stop: \let_new:NN \if_num:w \tex_ifnum:D \let_new:NN \if_num_odd:w \tex_ifodd:D \let_new:NN \if_case:w \tex_ifcase:D \let_new:NN \or: \tex_or:D \def:Npn \num_incr:N #1{\num_add:Nn#1 1} \def:Npn \num_decr:N #1{\num_add:Nn#1 \c_minus_one} \def:Npn \num_gincr:N #1{\num_gadd:Nn#1 1} \def:Npn \num_gdecr:N #1{\num_gadd:Nn#1 \c_minus_one} \def_new:Npn \num_incr:c {\exp_args:Nc \num_incr:N} \def_new:Npn \num_decr:c {\exp_args:Nc \num_decr:N} \def_new:Npn \num_gincr:c {\exp_args:Nc \num_gincr:N} \def_new:Npn \num_gdecr:c {\exp_args:Nc \num_gdecr:N} \def_new:Npn \num_zero:N #1 {\num_set:Nn #1 0} \def_new:Npn \num_gzero:N #1 {\num_gset:Nn #1 0} \def_new:Npn \num_zero:c {\exp_args:Nc \num_zero:N} \def_new:Npn \num_gzero:c {\exp_args:Nc \num_gzero:N} \def_new:Npn \num_new:N #1{\tlp_new:Nn #1{0}} \def_new:Npn \num_new:c {\exp_args:Nc \num_new:N} \def_new:Npn \num_eval:n #1{\num_eval:w #1\num_eval_end:} \def_new:Npn \num_set:Nn #1#2{ \tlp_set:No #1{ \tex_number:D \num_eval:n {#2} } } \def_new:Npn \num_gset:Nn {\pref_global:D \num_set:Nn} \def_new:Npn \num_set:cn {\exp_args:Nc \num_set:Nn } \def_new:Npn \num_gset:cn {\exp_args:Nc \num_gset:Nn } \let_new:NN \num_set_eq:NN \tlp_set_eq:NN \def_new:Npn \num_set_eq:cN {\exp_args:Nc \num_set_eq:NN} \def_new:Npn \num_set_eq:Nc {\exp_args:NNc \num_set_eq:NN} \def_new:Npn \num_set_eq:cc {\exp_args:Ncc \num_set_eq:NN} \let_new:NN \num_gset_eq:NN \tlp_gset_eq:NN \def_new:Npn \num_gset_eq:cN {\exp_args:Nc \num_gset_eq:NN} \def_new:Npn \num_gset_eq:Nc {\exp_args:NNc \num_gset_eq:NN} \def_new:Npn \num_gset_eq:cc {\exp_args:Ncc \num_gset_eq:NN} \def_new:Npn \num_add:Nn #1#2 {\num_set:Nn #1{#1+#2}} \def_new:Npn \num_add:cn {\exp_args:Nc\num_add:Nn} \def_new:Npn \num_gadd:Nn {\pref_global:D \num_add:Nn} \def_new:Npn \num_gadd:cn {\exp_args:Nc\num_gadd:Nn} \let_new:NN\num_use:N \use_arg_i:n \let_new:NN\num_use:c \cs_use:c \def_test_function_new:npn {num_compare:nNn}#1#2#3{ \if_num:w \num_eval:n {#1}#2\num_eval:n {#3} } \def_new:Npn \num_compare:cNcTF { \exp_args:NcNc\num_compare:nNnTF } \def_new:Npn \num_compare_p:nNn #1#2#3{ \if_num:w \num_eval:n {#1}#2\num_eval:n {#3} \c_true \else: \c_false \fi: } \def_new:Npn \num_abs:n#1{ \if_num:w \num_eval:n{#1}<\c_zero \exp_after:NN -\fi: #1 } \def_new:Npn \num_max_of:nn#1#2{\num_compare:nNnTF {#1}>{#2}{#1}{#2}} \def_new:Npn \num_min_of:nn#1#2{\num_compare:nNnTF {#1}<{#2}{#1}{#2}} \def_long_new:Npn \num_elt_count:n #1 { + 1 } \def_long_new:Npn \num_elt_count_prop:Nn #1#2 { + 1 } \num_new:N \l_tmpa_num \num_new:N \l_tmpb_num \num_new:N \l_tmpc_num \num_new:N \g_tmpa_num \num_new:N \g_tmpb_num \engine_if_aleph:TF { \let_new:NN \const_new_aux:Nw \tex_chardef:D \const_new_aux:Nw \c_max_register_num = 65535 \scan_stop: } { \let_new:NN \const_new_aux:Nw \tex_mathchardef:D \const_new_aux:Nw \c_max_register_num = 32767 \scan_stop: } \def_new:Npn \const_new:Nn #1#2 { \num_compare:nNnTF {#2} > \c_minus_one { \num_compare:nNnTF {#2} > \c_max_register_num {\int_new:N #1 \int_set:Nn #1{#2}} {\chk_new_cs:N #1 \const_new_aux:Nw #1 = #2 \scan_stop: } } {\int_new:N #1 \int_set:Nn #1{#2}} } %% \tex_countdef:D \c_minus_one = 10 \scan_stop: %% \c_minus_one = -1 \scan_stop: %% in l3basics %% \tex_chardef:D \c_sixteen = 16\scan_stop: %% in l3basics \const_new:Nn \c_zero {0} \const_new:Nn \c_one {1} \const_new:Nn \c_two {2} \const_new:Nn \c_three {3} \const_new:Nn \c_four {4} \const_new:Nn \c_six {6} \const_new:Nn \c_seven {7} \const_new:Nn \c_nine {9} \const_new:Nn \c_ten {10} \const_new:Nn \c_eleven {11} \const_new:Nn \c_thirty_two {32} \const_new:Nn \c_hundred_one {101} \const_new:Nn \c_twohundred_fifty_five {255} \const_new:Nn \c_twohundred_fifty_six {256} \const_new:Nn \c_thousand {1000} \const_new:Nn \c_ten_thousand {10000} \const_new:Nn \c_ten_thousand_one {10001} \const_new:Nn \c_ten_thousand_two {10002} \const_new:Nn \c_ten_thousand_three {10003} \const_new:Nn \c_ten_thousand_four {10004} \const_new:Nn \c_twenty_thousand {20000} %% %% %% End of file `l3num.sty'.