%% %% This is file `pml3array.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% hobby.dtx (with options: `array') %% ---------------------------------------------------------------- %% hobby --- a TikZ/PGF library for drawing smooth(ish) curves using %% Hobby's algorithm (implemented in LaTeX3) %% E-mail: stacey@math.ntnu.no %% Released under the LaTeX Project Public License v1.3c or later %% See http://www.latex-project.org/lppl.txt %% ---------------------------------------------------------------- %% \RequirePackage{expl3} \ExplSyntaxOn \tl_new:N \l_array_tmp_tl \tl_new:N \l_array_show_tl \int_new:N \l_array_base_int \int_new:N \l_array_top_int \int_new:N \l_array_tmp_int \int_new:N \g_array_base_int \int_set:Nn \g_array_base_int {0} \cs_new:Npn \array_adjust_ends:Nn #1#2 { \prop_get:NnNTF #1 {base} \l_tmpa_tl { \int_compare:nNnTF {\l_tmpa_tl} > {#2} { \prop_put:Nnx #1 {base} {\int_eval:n {#2}} } {} } { \prop_put:Nnx #1 {base} {\int_eval:n {#2}} } \prop_get:NnNTF #1 {top} \l_tmpa_tl { \int_compare:nNnTF {\l_tmpa_tl} < {#2} { \prop_put:Nnx #1 {top} {\int_eval:n {#2}} } {} } { \prop_put:Nnx #1 {top} {\int_eval:n {#2}} } } \cs_new:Npn \array_gadjust_ends:Nn #1#2 { \prop_get:NnNTF #1 {base} \l_tmpa_tl { \int_compare:nNnTF {\l_tmpa_tl} > {#2} { \prop_gput:Nnx #1 {base} {\int_eval:n {#2}} } {} } { \prop_gput:Nnx #1 {base} {\int_eval:n {#2}} } \prop_get:NnNTF #1 {top} \l_tmpa_tl { \int_compare:nNnTF {\l_tmpa_tl} < {#2} { \prop_gput:Nnx #1 {top} {\int_eval:n {#2}} } {} } { \prop_gput:Nnx #1 {top} {\int_eval:n {#2}} } } \cs_new:Npn \array_put:Nnn #1#2#3 { \exp_args:NNx \prop_put:Nnn #1 {\int_eval:n {#2}} {#3} \array_adjust_ends:Nn #1{#2} } \cs_generate_variant:Nn \array_put:Nnn {Nnx} \cs_new:Npn \array_gput:Nnn #1#2#3 { \exp_args:NNx \prop_gput:Nnn #1 {\int_eval:n {#2}} {#3} \array_gadjust_ends:Nn #1{#2} } \cs_generate_variant:Nn \array_gput:Nnn {Nnx} \cs_new:Npn \array_get:NnN #1#2#3 { \exp_args:NNx \prop_get:NnN #1 {\int_eval:n {#2}} #3 } \cs_new:Npn \array_get:Nn #1#2 { \exp_args:NNf \prop_get:Nn #1 { \int_eval:n {#2} } } \cs_new:Npn \array_get:NnNTF #1#2#3#4#5 { \exp_args:NNx \prop_get:NnNTF #1 {\int_eval:n {#2}} #3 {#4}{#5} } \prg_new_conditional:Npnn \array_if_empty:N #1 { p, T, F, TF } { \if_meaning:w #1 \c_empty_prop \prg_return_true: \else: \prg_return_false: \fi: } \cs_new_eq:NN \array_new:N \prop_new:N \cs_new_eq:NN \array_clear:N \prop_clear:N \cs_new_eq:NN \array_gclear:N \prop_gclear:N \cs_new:Npn \array_map_function:NN #1#2 { \array_if_empty:NTF #1 {} { \prop_get:NnNTF #1 {base} \l_array_tmp_tl { \int_set:Nn \l_array_base_int {\l_array_tmp_tl} }{ \int_set:Nn \l_array_base_int {0} } \prop_get:NnNTF #1 {top} \l_array_tmp_tl { \int_set:Nn \l_array_top_int {\l_array_tmp_tl} }{ \int_set:Nn \l_array_top_int {0} } \int_step_inline:nnnn {\l_array_base_int} {1} {\l_array_top_int} { \array_get:NnN #1 {##1} \l_array_tmp_tl \exp_args:NnV #2 {##1} \l_array_tmp_tl } } {} } \cs_generate_variant:Nn \array_map_function:NN { Nc } \cs_generate_variant:Nn \array_map_function:NN { c , cc } \cs_new:Npn \array_reverse_map_function:NN #1#2 { \array_if_empty:NTF #1 {} { \prop_get:NnNTF #1 {base} \l_array_tmp_tl { \int_set:Nn \l_array_base_int {\l_array_tmp_tl} }{ \int_set:Nn \l_array_base_int {0} } \prop_get:NnNTF #1 {top} \l_array_tmp_tl { \int_set:Nn \l_array_top_int {\l_array_tmp_tl} }{ \int_set:Nn \l_array_top_int {0} } \int_step_inline:nnnn {\l_array_top_int} {-1} {\l_array_base_int} { \array_get:NnN #1 {##1} \l_array_tmp_tl \exp_args:Nno #2 {##1} \l_array_tmp_tl } } {} } \cs_generate_variant:Nn \array_reverse_map_function:NN { Nc } \cs_generate_variant:Nn \array_reverse_map_function:NN { c , cc } \cs_new_protected:Npn \array_map_inline:Nn #1#2 { \int_gincr:N \g__prg_map_int \cs_gset:cpn { array_map_inline_ \int_use:N \g__prg_map_int :nn } ##1##2 {#2} \exp_args:NNc \array_map_function:NN #1 { array_map_inline_ \int_use:N \g__prg_map_int :nn } \__prg_break_point:Nn \array_map_break: { \int_gdecr:N \g__prg_map_int } } \cs_generate_variant:Nn \array_map_inline:Nn { c } \cs_new_protected:Npn \array_reverse_map_inline:Nn #1#2 { \int_gincr:N \g__prg_map_int \cs_gset:cpn { array_map_inline_ \int_use:N \g__prg_map_int :nn } ##1##2 {#2} \exp_args:NNc \array_reverse_map_function:NN #1 { array_map_inline_ \int_use:N \g__prg_map_int :nn } \__prg_break_point:Nn \array_map_break: { \int_gdecr:N \g__prg_map_int } } \cs_generate_variant:Nn \array_reverse_map_inline:Nn { c } \cs_new_nopar:Npn \array_map_break: { \__prg_map_break:Nn \array_map_break: { } } \cs_new_nopar:Npn \array_map_break:n { \__prg_map_break:Nn \array_map_break: } \__msg_kernel_new:nnn { kernel } { show-array } { The~array~\token_to_str:N #1~ \array_if_empty:NTF #1 { is~empty } { contains~the~items~(without~outer~braces): } } \cs_new_protected:Npn \array_show:N #1 { \tl_clear:N \l_array_show_tl \array_map_function:NN #1 \array_show_aux:nn \__msg_show_variable:Nno #1 { array } { \l_array_show_tl } } \cs_generate_variant:Nn \__msg_show_variable:Nnn { Nno } \cs_new_protected:Npn \array_show_aux:nn #1#2 { \tl_if_eq:nnTF {#2} {\q_no_value} {} { \tl_put_right:No \l_array_show_tl {\__msg_show_item:nn {#1}{#2}} } } \cs_generate_variant:Nn \array_show:N { c } \cs_new_protected:Npn \array_push:Nn #1#2 { \prop_get:NnNTF #1 {top} \l_array_tmp_tl { \int_set:Nn \l_array_tmp_int {\l_array_tmp_tl} \int_incr:N \l_array_tmp_int \array_put:Nnn #1 {\l_array_tmp_int} {#2} } { \array_put:Nnn #1 {\g_array_base_int} {#2} } } \cs_generate_variant:Nn \array_push:Nn {Nx} \cs_new_protected:Npn \array_gpush:Nn #1#2 { \prop_get:NnNTF #1 {top} \l_array_tmp_tl { \int_set:Nn \l_array_tmp_int {\l_array_tmp_tl} \int_incr:N \l_array_tmp_int \array_gput:Nnn #1 {\l_array_tmp_int} {#2} } { \array_gput:Nnn #1 {\g_array_base_int} {#2} } } \cs_generate_variant:Nn \array_gpush:Nn {Nx} \cs_new_protected:Npn \array_unshift:Nn #1#2 { \prop_get:NnNTF #1 {base} \l_array_tmp_tl { \int_set:Nn \l_array_tmp_int {\l_array_tmp_tl} \int_decr:N \l_array_tmp_int \array_put:Nnn #1 {\l_array_tmp_int} {#2} } { \array_put:Nnn #1 {\g_array_base_int} {#2} } } \cs_generate_variant:Nn \array_unshift:Nn {Nx} \cs_new_protected:Npn \array_gunshift:Nn #1#2 { \prop_get:NnNTF #1 {base} \l_array_tmp_tl { \int_set:Nn \l_array_tmp_int {\l_array_tmp_tl} \int_decr:N \l_array_tmp_int \array_gput:Nnn #1 {\l_array_tmp_int} {#2} } { \array_gput:Nnn #1 {\g_array_base_int} {#2} } } \cs_generate_variant:Nn \array_gunshift:Nn {Nx} \cs_new_protected:Npn \array_pop:NN #1#2 { \prop_get:NnN #1 {top} \l_array_tmp_tl \array_get:NnN #1 {\l_array_tmp_tl} #2 \array_del:Nn #1 {\l_array_tmp_tl} } \cs_new_protected:Npn \array_gpop:NN #1#2 { \prop_get:NnN #1 {top} \l_array_tmp_tl \array_get:NnN #1 {\l_array_tmp_tl} #2 \array_gdel:Nn #1 {\l_array_tmp_tl} } \cs_new_protected:Npn \array_shift:NN #1#2 { \prop_get:NnN #1 {base} \l_array_tmp_tl \array_get:NnN #1 {\l_array_tmp_tl} #2 \array_del:Nn #1 {\l_array_tmp_tl} } \cs_new_protected:Npn \array_gshift:NN #1#2 { \prop_get:NnN #1 {base} \l_array_tmp_tl \array_get:NnN #1 {\l_array_tmp_tl} #2 \array_gdel:Nn #1 {\l_array_tmp_tl} } \cs_new_protected:Npn \array_top:NN #1#2 { \prop_get:NnN #1 {top} \l_array_tmp_tl \array_get:NnN #1 {\l_array_tmp_tl} #2 } \cs_new_protected:Npn \array_base:NN #1#2 { \prop_get:NnN #1 {base} \l_array_tmp_tl \array_get:NnN #1 {\l_array_tmp_tl} #2 } \cs_new:Npn \array_top:N #1 { \array_get:Nn #1 {\prop_get:Nn #1 {top}} } \cs_new:Npn \array_base:N #1 { \array_get:Nn #1 {\prop_get:Nn #1 {base}} } \cs_new_protected:Npn \array_del:Nn #1#2 { \exp_args:NNx \prop_pop:Nn #1 {\int_eval:n {#2}} \int_set:Nn \l_array_tmp_int {0} \array_map_inline:Nn #1 { \tl_if_eq:NNTF {##2} {\q_no_value} {} { \int_incr:N \l_array_tmp_int } } \int_compare:nNnTF {\l_array_tmp_int} = {0} { \prop_clear:N #1 } { \prop_get:NnN #1 {top} \l_array_tmp_tl \int_compare:nNnTF {#2} = {\l_array_tmp_tl} { \prop_get:NnN #1 {base} \l_array_tmp_tl \int_set:Nn \l_array_tmp_int {\l_array_tmp_tl} \array_map_inline:Nn #1 { \tl_if_eq:NNTF {##2} {\q_no_value} {} { \int_compare:nNnTF {\l_array_tmp_int} < {##1} { \int_set:Nn \l_array_tmp_int {##1} }{} } } \prop_put:Nnx #1 {top} {\int_use:N \l_array_tmp_int} }{} \prop_get:NnN #1 {base} \l_array_tmp_tl \int_compare:nNnTF {#2} = {\l_array_tmp_tl} { \prop_get:NnN #1 {top} \l_array_tmp_tl \int_set:Nn \l_array_tmp_int {\l_array_tmp_tl} \array_map_inline:Nn #1 { \tl_if_eq:NNTF {##2} {\q_no_value} {} { \int_compare:nNnTF {\l_array_tmp_int} > {##1} { \int_set:Nn \l_array_tmp_int {##1} }{} } } \prop_put:Nnx #1 {base} {\int_use:N \l_array_tmp_int} }{} } } \cs_new_protected:Npn \array_gdel:Nn #1#2 { \exp_args:NNx \prop_gpop:Nn #1 {\int_eval:n {#2}} \int_set:Nn \l_array_tmp_int {0} \array_map_inline:Nn #1 { \tl_if_eq:NNTF {##2} {\q_no_value} {} { \int_incr:N \l_array_tmp_int } } \int_compare:nNnTF {\l_array_tmp_int} = {0} { \prop_gclear:N #1 } { \prop_get:NnN #1 {top} \l_array_tmp_tl \int_compare:nNnTF {#2} = {\l_array_tmp_tl} { \prop_get:NnN #1 {base} \l_array_tmp_tl \int_set:Nn \l_array_tmp_int {\l_array_tmp_tl} \array_map_inline:Nn #1 { \tl_if_eq:NNTF {##2} {\q_no_value} {} { \int_compare:nNnTF {\l_array_tmp_int} < {##1} { \int_set:Nn \l_array_tmp_int {##1} }{} } } \prop_gput:Nnx #1 {top} {\int_use:N \l_array_tmp_int} }{} \prop_get:NnN #1 {base} \l_array_tmp_tl \int_compare:nNnTF {#2} = {\l_array_tmp_tl} { \prop_get:NnN #1 {top} \l_array_tmp_tl \int_set:Nn \l_array_tmp_int {\l_array_tmp_tl} \array_map_inline:Nn #1 { \tl_if_eq:NNTF {##2} {\q_no_value} {} { \int_compare:nNnTF {\l_array_tmp_int} > {##1} { \int_set:Nn \l_array_tmp_int {##1} }{} } } \prop_gput:Nnx #1 {base} {\int_use:N \l_array_tmp_int} }{} } } \cs_new_protected:Npn \array_length:N #1 { \int_eval:n {\prop_get:Nn #1 {top} - \prop_get:Nn #1 {base}} } \ExplSyntaxOff %% %% Copyright (C) 2012 by Andrew Stacey %% %% This file may be distributed and/or modified under the conditions %% of the LaTeX Project Public License, either version 1.3 of this %% license or (at your option) any later version. %% The latest version of this license is in: %% %% http://www.latex-project.org/lppl.txt %% %% and version 1.3 or later is part of all distributions of LaTeX %% version 2005/12/01 or later. %% %% This work is "maintained" (as per LPPL maintenance status) by %% Andrew Stacey. %% %% This work consists of the files hobby.dtx %% hobby_doc.tex %% and the derived files hobby.code.tex %% pgflibraryhobby.code.tex %% tikzlibraryhobby.code.tex %% hobby.ins %% hobby.pdf %% hobby_doc.pdf %% README.txt %% %% %% End of file `pml3array.sty'.