%% %% This is file `l3keys.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% l3keys.dtx (with options: `package') %% %% 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: l3keys.dtx Copyright (C) 2006-2012 The 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 "l3kernel 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/svnroot/experimental/trunk/ %% %% 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 LaTeX3 Project. %% %% ----------------------------------------------------------------------- \RequirePackage{l3bootstrap} \GetIdInfo$Id: l3keys.dtx 4256 2012-11-02 08:47:41Z joseph $ {L3 Experimental key-value interfaces} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \__expl_package_check: \int_new:N \g__keyval_level_int \tl_new:N \l__keyval_key_tl \tl_new:N \l__keyval_value_tl \tl_new:N \l__keyval_sanitise_tl \tl_new:N \l__keyval_parse_tl \group_begin: \char_set_catcode_active:n { `\= } \char_set_catcode_active:n { `\, } \char_set_lccode:nn { `\8 } { `\= } \char_set_lccode:nn { `\9 } { `\, } \tl_to_lowercase:n { \group_end: \cs_new_protected:Npn \__keyval_parse:n #1 { \group_begin: \tl_clear:N \l__keyval_sanitise_tl \tl_set:Nn \l__keyval_sanitise_tl {#1} \tl_replace_all:Nnn \l__keyval_sanitise_tl { = } { 8 } \tl_replace_all:Nnn \l__keyval_sanitise_tl { , } { 9 } \tl_clear:N \l__keyval_parse_tl \exp_after:wN \__keyval_parse_elt:w \exp_after:wN \q_nil \l__keyval_sanitise_tl 9 \q_recursion_tail 9 \q_recursion_stop \exp_after:wN \group_end: \l__keyval_parse_tl } } \cs_new_protected:Npn \__keyval_parse_elt:w #1 , { \tl_if_blank:oTF { \use_none:n #1 } { \__keyval_parse_elt:w \q_nil } { \quark_if_recursion_tail_stop:o { \use_ii:nn #1 } \__keyval_split_key_value:w #1 = = \q_stop \__keyval_parse_elt:w \q_nil } } \cs_new_protected:Npn \__keyval_split_key_value:w #1 = #2 \q_stop { \__keyval_split_key:n {#1} \str_if_eq:nnTF {#2} { = } { \tl_put_right:Nx \l__keyval_parse_tl { \exp_not:c { __keyval_key_no_value_elt_ \int_use:N \g__keyval_level_int :n } { \exp_not:o \l__keyval_key_tl } } } { \__keyval_split_key_value:wTF #2 \q_no_value \q_stop { \__keyval_split_value:w \q_nil #2 } { \__msg_kernel_error:nn { kernel } { misplaced-equals-sign } } } } \cs_new:Npn \__keyval_split_key_value:wTF #1 = #2#3 \q_stop { \tl_if_head_eq_meaning:nNTF {#3} \q_no_value } \cs_new_protected:Npn \__keyval_split_key:n #1 { \str_if_eq_x:nnTF { \exp_not:N \q_nil } { \exp_not:o { \use_none:nnn #1 \q_nil \q_nil } } { \tl_set:Nx \l__keyval_key_tl { \exp_not:o { \use_ii:nnn #1 \q_nil } } } { \__keyval_split_key:w #1 \q_stop } } \cs_new_protected:Npn \__keyval_split_key:w \q_nil #1 \q_stop { \tl_set:Nx \l__keyval_key_tl { \tl_trim_spaces:n {#1} } } \cs_new_protected:Npn \__keyval_split_value:w #1 = = { \tl_put_right:Nx \l__keyval_parse_tl { \exp_not:c { __keyval_key_value_elt_ \int_use:N \g__keyval_level_int :nn } { \exp_not:o \l__keyval_key_tl } } \tl_set:Nx \l__keyval_value_tl { \exp_not:o { \use_none:nnn #1 \q_nil \q_nil } } \tl_if_empty:NTF \l__keyval_value_tl { \tl_put_right:Nn \l__keyval_parse_tl { { } } } { \quark_if_nil:NTF \l__keyval_value_tl { \tl_put_right:Nx \l__keyval_parse_tl { { \exp_not:o { \use_ii:nnn #1 \q_nil } } } } { \__keyval_split_value_aux:w #1 \q_stop } } } \cs_new_protected:Npn \__keyval_split_value_aux:w \q_nil #1 \q_stop { \tl_set:Nx \l__keyval_value_tl { \tl_trim_spaces:n {#1} } \tl_put_right:Nx \l__keyval_parse_tl { { \exp_not:o \l__keyval_value_tl } } } \cs_new_protected:Npn \keyval_parse:NNn #1#2#3 { \int_gincr:N \g__keyval_level_int \cs_gset_eq:cN { __keyval_key_no_value_elt_ \int_use:N \g__keyval_level_int :n } #1 \cs_gset_eq:cN { __keyval_key_value_elt_ \int_use:N \g__keyval_level_int :nn } #2 \__keyval_parse:n {#3} \int_gdecr:N \g__keyval_level_int } \__msg_kernel_new:nnnn { kernel } { misplaced-equals-sign } { Misplaced~equals~sign~in~key-value~input~\msg_line_number: } { LaTeX~is~attempting~to~parse~some~key-value~input~but~found~ two~equals~signs~not~separated~by~a~comma. } \tl_const:Nn \c__keys_code_root_tl { key~code~>~ } \tl_const:Nn \c__keys_vars_root_tl { key~var~>~ } \tl_const:Nn \c__keys_props_root_tl { key~prop~>~ } \tl_const:Nn \c__keys_value_forbidden_tl { forbidden } \tl_const:Nn \c__keys_value_required_tl { required } \int_new:N \l_keys_choice_int \tl_new:N \l_keys_choice_tl \tl_new:N \l_keys_key_tl \tl_new:N \l__keys_module_tl \bool_new:N \l__keys_no_value_bool \tl_new:N \l_keys_path_tl \tl_new:N \l__keys_property_tl \tl_new:N \l__keys_unknown_clist \tl_new:N \l_keys_value_tl \cs_new_protected:Npn \keys_define:nn { \__keys_define:onn \l__keys_module_tl } \cs_new_protected:Npn \__keys_define:nnn #1#2#3 { \tl_set:Nx \l__keys_module_tl { \tl_to_str:n {#2} } \keyval_parse:NNn \__keys_define_elt:n \__keys_define_elt:nn {#3} \tl_set:Nn \l__keys_module_tl {#1} } \cs_generate_variant:Nn \__keys_define:nnn { o } \cs_new_protected:Npn \__keys_define_elt:n #1 { \bool_set_true:N \l__keys_no_value_bool \__keys_define_elt_aux:nn {#1} { } } \cs_new_protected:Npn \__keys_define_elt:nn #1#2 { \bool_set_false:N \l__keys_no_value_bool \__keys_define_elt_aux:nn {#1} {#2} } \cs_new_protected:Npn \__keys_define_elt_aux:nn #1#2 { \__keys_property_find:n {#1} \cs_if_exist:cTF { \c__keys_props_root_tl \l__keys_property_tl } { \__keys_define_key:n {#2} } { \__msg_kernel_error:nnxx { kernel } { property-unknown } { \l__keys_property_tl } { \l_keys_path_tl } } } \cs_new_protected:Npn \__keys_property_find:n #1 { \tl_set:Nx \l_keys_path_tl { \l__keys_module_tl / } \tl_if_in:nnTF {#1} { . } { \__keys_property_find:w #1 \q_stop } { \__msg_kernel_error:nnx { kernel } { key-no-property } {#1} } } \cs_new_protected:Npn \__keys_property_find:w #1 . #2 \q_stop { \tl_set:Nx \l_keys_path_tl { \l_keys_path_tl \tl_to_str:n {#1} } \tl_if_in:nnTF {#2} { . } { \tl_set:Nx \l_keys_path_tl { \l_keys_path_tl . } \__keys_property_find:w #2 \q_stop } { \tl_set:Nn \l__keys_property_tl { . #2 } } } \cs_new_protected:Npn \__keys_define_key:n #1 { \bool_if:NTF \l__keys_no_value_bool { \exp_after:wN \__keys_define_key:w \l__keys_property_tl \q_stop { \use:c { \c__keys_props_root_tl \l__keys_property_tl } } { \__msg_kernel_error:nnxx { kernel } { property-requires-value } { \l__keys_property_tl } { \l_keys_path_tl } } } { \use:c { \c__keys_props_root_tl \l__keys_property_tl } {#1} } } \cs_new_protected:Npn \__keys_define_key:w #1 : #2 \q_stop { \tl_if_empty:nTF {#2} } \cs_new:Npn \__keys_bool_set:NN #1#2 { \bool_if_exist:NF #1 { \bool_new:N #1 } \__keys_choice_make: \__keys_cmd_set:nx { \l_keys_path_tl / true } { \exp_not:c { bool_ #2 set_true:N } \exp_not:N #1 } \__keys_cmd_set:nx { \l_keys_path_tl / false } { \exp_not:c { bool_ #2 set_false:N } \exp_not:N #1 } \__keys_cmd_set:nn { \l_keys_path_tl / unknown } { \__msg_kernel_error:nnx { kernel } { boolean-values-only } { \l_keys_key_tl } } \__keys_default_set:n { true } } \cs_new:Npn \__keys_bool_set_inverse:NN #1#2 { \bool_if_exist:NF #1 { \bool_new:N #1 } \__keys_choice_make: \__keys_cmd_set:nx { \l_keys_path_tl / true } { \exp_not:c { bool_ #2 set_false:N } \exp_not:N #1 } \__keys_cmd_set:nx { \l_keys_path_tl / false } { \exp_not:c { bool_ #2 set_true:N } \exp_not:N #1 } \__keys_cmd_set:nn { \l_keys_path_tl / unknown } { \__msg_kernel_error:nnx { kernel } { boolean-values-only } { \l_keys_key_tl } } \__keys_default_set:n { true } } \cs_new_protected_nopar:Npn \__keys_choice_make: { \__keys_cmd_set:nn { \l_keys_path_tl } { \__keys_choice_find:n {##1} } \__keys_cmd_set:nn { \l_keys_path_tl / unknown } { \__msg_kernel_error:nnxx { kernel } { key-choice-unknown } { \l_keys_path_tl } {##1} } } \cs_new_protected:Npn \__keys_choices_make:nn #1#2 { \__keys_choice_make: \int_zero:N \l_keys_choice_int \clist_map_inline:nn {#1} { \int_incr:N \l_keys_choice_int \__keys_cmd_set:nx { \l_keys_path_tl / ##1 } { \tl_set:Nn \exp_not:N \l_keys_choice_tl {##1} \int_set:Nn \exp_not:N \l_keys_choice_int { \int_use:N \l_keys_choice_int } \exp_not:n {#2} } } } \cs_new_protected:Npn \__keys_choices_generate:n #1 { \cs_if_exist:cTF { \c__keys_vars_root_tl \l_keys_path_tl .choice~code } { \__keys_choice_make: \int_zero:N \l_keys_choice_int \clist_map_function:nN {#1} \__keys_choices_generate_aux:n } { \__msg_kernel_error:nnx { kernel } { generate-choices-before-code } { \l_keys_path_tl } } } \cs_new_protected:Npn \__keys_choices_generate_aux:n #1 { \int_incr:N \l_keys_choice_int \__keys_cmd_set:nx { \l_keys_path_tl / #1 } { \tl_set:Nn \exp_not:N \l_keys_choice_tl {#1} \int_set:Nn \exp_not:N \l_keys_choice_int { \int_use:N \l_keys_choice_int } \exp_not:v { \c__keys_vars_root_tl \l_keys_path_tl .choice~code } } } \cs_new_protected:Npn \__keys_choice_code_store:n #1 { \cs_if_exist:cF { \c__keys_vars_root_tl \l_keys_path_tl .choice~code } { \tl_new:c { \c__keys_vars_root_tl \l_keys_path_tl .choice~code } } \tl_set:cn { \c__keys_vars_root_tl \l_keys_path_tl .choice~code } {#1} } \cs_generate_variant:Nn \__keys_choice_code_store:n { x } \cs_new_protected:Npn \__keys_cmd_set:nn #1#2 { \__keys_cmd_set:n {#1} \cs_set:cpn { \c__keys_code_root_tl #1 } ##1 {#2} } \cs_new_protected:Npn \__keys_cmd_set:nx #1#2 { \__keys_cmd_set:n {#1} \cs_set:cpx { \c__keys_code_root_tl #1 } ##1 {#2} } \cs_generate_variant:Nn \__keys_cmd_set:nn { Vo } \cs_new_protected:Npn \__keys_cmd_set:n #1 { \tl_clear_new:c { \c__keys_vars_root_tl #1 .default } \tl_set:cn { \c__keys_vars_root_tl #1 .default } { \q_no_value } \tl_clear_new:c { \c__keys_vars_root_tl #1 .req } } \cs_new_protected:Npn \__keys_default_set:n #1 { \tl_set:cn { \c__keys_vars_root_tl \l_keys_path_tl .default } {#1} } \cs_generate_variant:Nn \__keys_default_set:n { V } \cs_new_protected:Npn \__keys_initialise:n #1 { \use:x { \exp_after:wN \__keys_initialise:wn \l_keys_path_tl \q_stop {#1} } } \cs_generate_variant:Nn \__keys_initialise:n { V } \cs_new:Npn \__keys_initialise:wn #1 / #2 \q_stop #3 { \keys_set:nn {#1} { #2 = \exp_not:n { {#3} } } } \cs_new_protected:Npn \__keys_meta_make:n #1 { \__keys_cmd_set:Vo \l_keys_path_tl { \exp_after:wN \keys_set:nn \exp_after:wN { \l__keys_module_tl } {#1} } } \cs_new_protected:Npn \__keys_meta_make:x #1 { \__keys_cmd_set:nx { \l_keys_path_tl } { \exp_not:N \keys_set:nn { \l__keys_module_tl } {#1} } } \cs_new:Npn \__keys_multichoice_find:n #1 { \clist_map_function:nN {#1} \__keys_choice_find:n } \cs_new_protected_nopar:Npn \__keys_multichoice_make: { \__keys_cmd_set:nn { \l_keys_path_tl } { \__keys_multichoice_find:n {##1} } \__keys_cmd_set:nn { \l_keys_path_tl / unknown } { \__msg_kernel_error:nnxx { kernel } { key-choice-unknown } { \l_keys_path_tl } {##1} } } \cs_new_protected:Npn \__keys_multichoices_make:nn #1#2 { \__keys_multichoice_make: \int_zero:N \l_keys_choice_int \clist_map_inline:nn {#1} { \int_incr:N \l_keys_choice_int \__keys_cmd_set:nx { \l_keys_path_tl / ##1 } { \tl_set:Nn \exp_not:N \l_keys_choice_tl {##1} \int_set:Nn \exp_not:N \l_keys_choice_int { \int_use:N \l_keys_choice_int } \exp_not:n {#2} } } } \cs_new_protected:Npn \__keys_value_requirement:n #1 { \tl_set_eq:cc { \c__keys_vars_root_tl \l_keys_path_tl .req } { c__keys_value_ #1 _tl } } \cs_new_protected:Npn \__keys_variable_set:NnNN #1#2#3#4 { \use:c { #2_if_exist:NF } #1 { \use:c { #2 _new:N } #1 } \__keys_cmd_set:nx { \l_keys_path_tl } { \exp_not:c { #2 _ #3 set:N #4 } \exp_not:N #1 {##1} } } \cs_new_protected:Npn \__keys_variable_set:NnN #1#2#3 { \__keys_variable_set:NnNN #1 {#2} { } #3 } \cs_generate_variant:Nn \__keys_variable_set:NnNN { c } \cs_generate_variant:Nn \__keys_variable_set:NnN { c } \cs_new_protected:cpn { \c__keys_props_root_tl .bool_set:N } #1 { \__keys_bool_set:NN #1 { } } \cs_new_protected:cpn { \c__keys_props_root_tl .bool_gset:N } #1 { \__keys_bool_set:NN #1 g } \cs_new_protected:cpn { \c__keys_props_root_tl .bool_set_inverse:N } #1 { \__keys_bool_set_inverse:NN #1 { } } \cs_new_protected:cpn { \c__keys_props_root_tl .bool_gset_inverse:N } #1 { \__keys_bool_set_inverse:NN #1 g } \cs_new_protected_nopar:cpn { \c__keys_props_root_tl .choice: } { \__keys_choice_make: } \cs_new_protected:cpn { \c__keys_props_root_tl .choices:nn } #1 { \__keys_choices_make:nn #1 } \cs_new_protected:cpn { \c__keys_props_root_tl .code:n } #1 { \__keys_cmd_set:nn { \l_keys_path_tl } {#1} } \cs_new_protected:cpn { \c__keys_props_root_tl .code:x } #1 { \__keys_cmd_set:nx { \l_keys_path_tl } {#1} } \cs_new_protected:cpn { \c__keys_props_root_tl .choice_code:n } #1 { \__keys_choice_code_store:n {#1} } \cs_new_protected:cpn { \c__keys_props_root_tl .choice_code:x } #1 { \__keys_choice_code_store:x {#1} } \cs_new_protected:cpn { \c__keys_props_root_tl .clist_set:N } #1 { \__keys_variable_set:NnN #1 { clist } n } \cs_new_protected:cpn { \c__keys_props_root_tl .clist_set:c } #1 { \__keys_variable_set:cnN {#1} { clist } n } \cs_new_protected:cpn { \c__keys_props_root_tl .clist_gset:N } #1 { \__keys_variable_set:NnNN #1 { clist } g n } \cs_new_protected:cpn { \c__keys_props_root_tl .clist_gset:c } #1 { \__keys_variable_set:cnNN {#1} { clist } g n } \cs_new_protected:cpn { \c__keys_props_root_tl .default:n } #1 { \__keys_default_set:n {#1} } \cs_new_protected:cpn { \c__keys_props_root_tl .default:V } #1 { \__keys_default_set:V #1 } \cs_new_protected:cpn { \c__keys_props_root_tl .dim_set:N } #1 { \__keys_variable_set:NnN #1 { dim } n } \cs_new_protected:cpn { \c__keys_props_root_tl .dim_set:c } #1 { \__keys_variable_set:cnN {#1} { dim } n } \cs_new_protected:cpn { \c__keys_props_root_tl .dim_gset:N } #1 { \__keys_variable_set:NnNN #1 { dim } g n } \cs_new_protected:cpn { \c__keys_props_root_tl .dim_gset:c } #1 { \__keys_variable_set:cnNN {#1} { dim } g n } \cs_new_protected:cpn { \c__keys_props_root_tl .fp_set:N } #1 { \__keys_variable_set:NnN #1 { fp } n } \cs_new_protected:cpn { \c__keys_props_root_tl .fp_set:c } #1 { \__keys_variable_set:cnN {#1} { fp } n } \cs_new_protected:cpn { \c__keys_props_root_tl .fp_gset:N } #1 { \__keys_variable_set:NnNN #1 { fp } g n } \cs_new_protected:cpn { \c__keys_props_root_tl .fp_gset:c } #1 { \__keys_variable_set:cnNN {#1} { fp } g n } \cs_new_protected:cpn { \c__keys_props_root_tl .generate_choices:n } #1 { \__keys_choices_generate:n {#1} } \cs_new_protected:cpn { \c__keys_props_root_tl .initial:n } #1 { \__keys_initialise:n {#1} } \cs_new_protected:cpn { \c__keys_props_root_tl .initial:V } #1 { \__keys_initialise:V #1 } \cs_new_protected:cpn { \c__keys_props_root_tl .int_set:N } #1 { \__keys_variable_set:NnN #1 { int } n } \cs_new_protected:cpn { \c__keys_props_root_tl .int_set:c } #1 { \__keys_variable_set:cnN {#1} { int } n } \cs_new_protected:cpn { \c__keys_props_root_tl .int_gset:N } #1 { \__keys_variable_set:NnNN #1 { int } g n } \cs_new_protected:cpn { \c__keys_props_root_tl .int_gset:c } #1 { \__keys_variable_set:cnNN {#1} { int } g n } \cs_new_protected:cpn { \c__keys_props_root_tl .meta:n } #1 { \__keys_meta_make:n {#1} } \cs_new_protected:cpn { \c__keys_props_root_tl .meta:x } #1 { \__keys_meta_make:x {#1} } \cs_new_protected_nopar:cpn { \c__keys_props_root_tl .multichoice: } { \__keys_multichoice_make: } \cs_new_protected:cpn { \c__keys_props_root_tl .multichoices:nn } #1 { \__keys_multichoices_make:nn #1 } \cs_new_protected:cpn { \c__keys_props_root_tl .skip_set:N } #1 { \__keys_variable_set:NnN #1 { skip } n } \cs_new_protected:cpn { \c__keys_props_root_tl .skip_set:c } #1 { \__keys_variable_set:cnN {#1} { skip } n } \cs_new_protected:cpn { \c__keys_props_root_tl .skip_gset:N } #1 { \__keys_variable_set:NnNN #1 { skip } g n } \cs_new_protected:cpn { \c__keys_props_root_tl .skip_gset:c } #1 { \__keys_variable_set:cnNN {#1} { skip } g n } \cs_new_protected:cpn { \c__keys_props_root_tl .tl_set:N } #1 { \__keys_variable_set:NnN #1 { tl } n } \cs_new_protected:cpn { \c__keys_props_root_tl .tl_set:c } #1 { \__keys_variable_set:cnN {#1} { tl } n } \cs_new_protected:cpn { \c__keys_props_root_tl .tl_set_x:N } #1 { \__keys_variable_set:NnN #1 { tl } x } \cs_new_protected:cpn { \c__keys_props_root_tl .tl_set_x:c } #1 { \__keys_variable_set:cnN {#1} { tl } x } \cs_new_protected:cpn { \c__keys_props_root_tl .tl_gset:N } #1 { \__keys_variable_set:NnNN #1 { tl } g n } \cs_new_protected:cpn { \c__keys_props_root_tl .tl_gset:c } #1 { \__keys_variable_set:cnNN {#1} { tl } g n } \cs_new_protected:cpn { \c__keys_props_root_tl .tl_gset_x:N } #1 { \__keys_variable_set:NnNN #1 { tl } g x } \cs_new_protected:cpn { \c__keys_props_root_tl .tl_gset_x:c } #1 { \__keys_variable_set:cnNN {#1} { tl } g x } \cs_new_protected_nopar:cpn { \c__keys_props_root_tl .value_forbidden: } { \__keys_value_requirement:n { forbidden } } \cs_new_protected_nopar:cpn { \c__keys_props_root_tl .value_required: } { \__keys_value_requirement:n { required } } \cs_new_protected:Npn \keys_set:nn { \__keys_set:onn { \l__keys_module_tl } } \cs_new_protected:Npn \__keys_set:nnn #1#2#3 { \tl_set:Nx \l__keys_module_tl { \tl_to_str:n {#2} } \keyval_parse:NNn \__keys_set_elt:n \__keys_set_elt:nn {#3} \tl_set:Nn \l__keys_module_tl {#1} } \cs_generate_variant:Nn \keys_set:nn { nV , nv , no } \cs_generate_variant:Nn \__keys_set:nnn { o } \cs_new_protected:Npn \keys_set_known:nnN { \__keys_set_known:onnN { \l__keys_module_tl } } \cs_new_protected:Npn \__keys_set_known:nnnN #1#2#3#4 { \tl_set:Nx \l__keys_module_tl { \tl_to_str:n {#2} } \clist_clear:N \l__keys_unknown_clist \cs_set_eq:NN \__keys_execute_unknown: \__keys_execute_unknown_alt: \keyval_parse:NNn \__keys_set_elt:n \__keys_set_elt:nn {#3} \cs_set_eq:NN \__keys_execute_unknown: \__keys_execute_unknown_std: \tl_set:Nn \l__keys_module_tl {#1} \clist_set_eq:NN #4 \l__keys_unknown_clist } \cs_generate_variant:Nn \keys_set_known:nnN { nV , nv , no } \cs_generate_variant:Nn \__keys_set_known:nnnN { o } \cs_new_protected:Npn \__keys_set_elt:n #1 { \bool_set_true:N \l__keys_no_value_bool \__keys_set_elt_aux:nn {#1} { } } \cs_new_protected:Npn \__keys_set_elt:nn #1#2 { \bool_set_false:N \l__keys_no_value_bool \__keys_set_elt_aux:nn {#1} {#2} } \cs_new_protected:Npn \__keys_set_elt_aux:nn #1#2 { \tl_set:Nx \l_keys_key_tl { \tl_to_str:n {#1} } \tl_set:Nx \l_keys_path_tl { \l__keys_module_tl / \l_keys_key_tl } \__keys_value_or_default:n {#2} \bool_if:nTF { \__keys_if_value_p:n { required } && \l__keys_no_value_bool } { \__msg_kernel_error:nnx { kernel } { value-required } { \l_keys_path_tl } } { \bool_if:nTF { \__keys_if_value_p:n { forbidden } && ! \l__keys_no_value_bool } { \__msg_kernel_error:nnxx { kernel } { value-forbidden } { \l_keys_path_tl } { \l_keys_value_tl } } { \__keys_execute: } } } \cs_new_protected:Npn \__keys_value_or_default:n #1 { \tl_set:Nn \l_keys_value_tl {#1} \bool_if:NT \l__keys_no_value_bool { \quark_if_no_value:cF { \c__keys_vars_root_tl \l_keys_path_tl .default } { \cs_if_exist:cT { \c__keys_vars_root_tl \l_keys_path_tl .default } { \tl_set_eq:Nc \l_keys_value_tl { \c__keys_vars_root_tl \l_keys_path_tl .default } } } } } \prg_new_conditional:Npnn \__keys_if_value:n #1 { p } { \tl_if_eq:ccTF { c__keys_value_ #1 _tl } { \c__keys_vars_root_tl \l_keys_path_tl .req } { \prg_return_true: } { \prg_return_false: } } \cs_new_nopar:Npn \__keys_execute: { \__keys_execute:nn { \l_keys_path_tl } { \__keys_execute_unknown: } } \cs_new_nopar:Npn \__keys_execute_unknown: { \__keys_execute:nn { \l__keys_module_tl / unknown } { \__msg_kernel_error:nnxx { kernel } { key-unknown } { \l_keys_path_tl } { \l__keys_module_tl } } } \cs_new_eq:NN \__keys_execute_unknown_std: \__keys_execute_unknown: \cs_new_nopar:Npn \__keys_execute_unknown_alt: { \clist_put_right:Nx \l__keys_unknown_clist { \exp_not:o \l_keys_key_tl \bool_if:NF \l__keys_no_value_bool { = { \exp_not:o \l_keys_value_tl } } } } \cs_new:Npn \__keys_execute:nn #1#2 { \cs_if_exist:cTF { \c__keys_code_root_tl #1 } { \exp_args:Nc \exp_args:No { \c__keys_code_root_tl #1 } \l_keys_value_tl } {#2} } \cs_new:Npn \__keys_choice_find:n #1 { \__keys_execute:nn { \l_keys_path_tl / \tl_to_str:n {#1} } { \__keys_execute:nn { \l_keys_path_tl / unknown } { } } } \prg_new_conditional:Npnn \keys_if_exist:nn #1#2 { p , T , F , TF } { \cs_if_exist:cTF { \c__keys_code_root_tl #1 / #2 } { \prg_return_true: } { \prg_return_false: } } \prg_new_conditional:Npnn \keys_if_choice_exist:nnn #1#2#3 { p , T , F , TF } { \cs_if_exist:cTF { \c__keys_code_root_tl #1 / #2 / #3 } { \prg_return_true: } { \prg_return_false: } } \cs_new:Npn \keys_show:nn #1#2 { \cs_show:c { \c__keys_code_root_tl #1 / \tl_to_str:n {#2} } } \__msg_kernel_new:nnnn { kernel } { boolean-values-only } { Key~'#1'~accepts~boolean~values~only. } { The~key~'#1'~only~accepts~the~values~'true'~and~'false'. } \__msg_kernel_new:nnnn { kernel } { choice-unknown } { Choice~'#2'~unknown~for~key~'#1'. } { The~key~'#1'~takes~a~limited~number~of~values.\\ The~input~given,~'#2',~is~not~on~the~list~accepted. } \__msg_kernel_new:nnnn { kernel } { generate-choices-before-code } { No~code~available~to~generate~choices~for~key~'#1'. } { \c_msg_coding_error_text_tl Before~using~.generate_choices:n~the~code~should~be~defined~ with~'.choice_code:n'~or~'.choice_code:x'. } \__msg_kernel_new:nnnn { kernel } { key-no-property } { No~property~given~in~definition~of~key~'#1'. } { \c_msg_coding_error_text_tl Inside~\keys_define:nn each~key~name needs~a~property: \\ ~ ~ #1 . \\ LaTeX~did~not~find~a~'.'~to~indicate~the~start~of~a~property. } \__msg_kernel_new:nnnn { kernel } { key-unknown } { The~key~'#1'~is~unknown~and~is~being~ignored. } { The~module~'#2'~does~not~have~a~key~called~#1'.\\ Check~that~you~have~spelled~the~key~name~correctly. } \__msg_kernel_new:nnnn { kernel } { property-requires-value } { The~property~'#1'~requires~a~value. } { \c_msg_coding_error_text_tl LaTeX~was~asked~to~set~property~'#2'~for~key~'#1'.\\ No~value~was~given~for~the~property,~and~one~is~required. } \__msg_kernel_new:nnnn { kernel } { property-unknown } { The~key~property~'#1'~is~unknown. } { \c_msg_coding_error_text_tl LaTeX~has~been~asked~to~set~the~property~'#1'~for~key~'#2':~ this~property~is~not~defined. } \__msg_kernel_new:nnnn { kernel } { value-forbidden } { The~key~'#1'~does~not~taken~a~value. } { The~key~'#1'~should~be~given~without~a~value.\\ LaTeX~will~ignore~the~given~value~'#2'. } \__msg_kernel_new:nnnn { kernel } { value-required } { The~key~'#1'~requires~a~value. } { The~key~'#1'~must~have~a~value.\\ No~value~was~present:~the~key~will~be~ignored. } \cs_new_eq:NN \c_keys_code_root_tl \c__keys_code_root_tl %% %% %% End of file `l3keys.sty'.