%% %% This is file `primargs.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% primargs.dtx (with options: `package') %% %% Communicate any suggestions for changing this package %% to Bruno Le Floch (blflatex@gmail.com). %% %% File: primargs.dtx Copyright (C) 2012 Bruno Le Floch %% %% 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 %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} \ProvidesExplPackage {primargs}{2012/07/10}{0.1}{Parsing~arguments~of~primitives} \RequirePackage{expl3} \cs_new_protected_nopar:Npn \g__primargs_code_tl { } \cs_new_protected_nopar:Npn \__primargs_no_afterassignment: { \tex_afterassignment:D \tex_relax:D } \cs_new_protected_nopar:Npn \__primargs_no_localdefs: { \__primargs_no_afterassignment: \int_compare:nNnF \tex_globaldefs:D > \c_zero { \tex_globaldefs:D = \c_zero } } \cs_new_protected_nopar:Npn \primargs_read_x_token:N { \group_begin: \__primargs_no_localdefs: \__primargs_read_x_token:N } \cs_new_protected_nopar:Npn \__primargs_read_x_token:N { \tex_afterassignment:D \__primargs_read_x_token_ii:N \tex_global:D \tex_futurelet:D \g_primargs_token } \cs_new_protected_nopar:Npn \__primargs_read_x_token_ii:N { \exp_after:wN \if_meaning:w \exp_not:N \g_primargs_token \g_primargs_token \group_end: \exp_after:wN \use_none:nnn \fi: \exp_after:wN \__primargs_read_x_token:N \exp_after:wN } \cs_new_protected_nopar:Npn \primargs_read_token:N { \group_begin: \__primargs_no_localdefs: \tex_afterassignment:D \group_end: \tex_global:D \tex_futurelet:D \g_primargs_token } \cs_new_protected:Npn \primargs_remove_token:N #1 { \group_begin: \__primargs_no_localdefs: \tex_aftergroup:D #1 \tex_afterassignment:D \group_end: \tex_global:D \tex_let:D \g_primargs_token = ~ } \cs_new_protected:Npn \primargs_remove_one_optional_space:N #1 { \group_begin: \__primargs_no_localdefs: \tex_aftergroup:D #1 \primargs_read_x_token:N \__primargs_remove_one_optional_space: } \exp_args:NNo \cs_new_protected_nopar:Npn \__primargs_remove_one_optional_space: { \use:n { \if_catcode:w } ~ \exp_not:N \g_primargs_token \exp_after:wN \primargs_remove_token:N \fi: \group_end: } \cs_new_protected:Npn \primargs_remove_optional_spaces:N #1 { \group_begin: \__primargs_no_localdefs: \tex_aftergroup:D #1 \__primargs_remove_optional_spaces: } \cs_new_protected_nopar:Npn \__primargs_remove_optional_spaces: { \primargs_read_x_token:N \__primargs_remove_optional_spaces_ii: } \exp_args:NNo \cs_new_protected_nopar:Npn \__primargs_remove_optional_spaces_ii: { \use:n { \if_catcode:w } ~ \exp_not:N \g_primargs_token \exp_after:wN \primargs_remove_token:N \exp_after:wN \__primargs_remove_optional_spaces: \else: \exp_after:wN \group_end: \fi: } \cs_new_protected:Npn \primargs_remove_equals:N #1 { \group_begin: \tex_aftergroup:D #1 \primargs_remove_optional_spaces:N \__primargs_remove_equals: } \cs_new_protected_nopar:Npn \__primargs_remove_equals: { \if_meaning:w = \g_primargs_token \exp_after:wN \__primargs_remove_equals_ii:NN \fi: \group_end: } \cs_new_protected:Npn \__primargs_remove_equals_ii:NN #1#2 { \tl_if_eq:nnTF { #2 } { = } { #1 } { #1 #2 } } \cs_new_protected:Npn \__primargs_get_rhs:NnN #1#2#3 { \group_begin: \__primargs_no_localdefs: \tex_aftergroup:D #3 \tl_gset:Nn \g__primargs_code_tl { \use:x { \exp_not:n { #1 = #2 \group_end: } { \tex_the:D #1 } } } \tex_afterassignment:D \g__primargs_code_tl #1 = } \cs_generate_variant:Nn \__primargs_get_rhs:NnN { No } \cs_new_protected_nopar:Npn \primargs_get_number:N { \__primargs_get_rhs:NoN \tex_deadcycles:D { \tex_the:D \tex_deadcycles:D } } \cs_new_protected_nopar:Npn \primargs_get_dimen:N { \__primargs_get_rhs:NoN \tex_hoffset:D { \tex_the:D \tex_hoffset:D } } \cs_new_protected_nopar:Npn \primargs_get_glue:N { \__primargs_get_rhs:NoN \tex_topskip:D { \tex_the:D \tex_topskip:D } } \cs_new_protected_nopar:Npn \primargs_get_mudimen:N { \msg_warning:nn { primargs } { get-mudimen } \primargs_get_muglue:N } \cs_new_protected_nopar:Npn \primargs_get_muglue:N { \__primargs_get_rhs:NoN \tex_thinmuskip:D { \tex_the:D \tex_thinmuskip:D } } \cs_new_protected_nopar:Npn \primargs_get_general_text:N { \__primargs_get_rhs:NoN \tex_errhelp:D { { } } } \tl_new:N \g__primargs_file_name_tl \cs_new_protected:Npn \primargs_get_file_name:N #1 { \group_begin: \__primargs_no_localdefs: \tex_aftergroup:D #1 \tl_gclear:N \g__primargs_file_name_tl \primargs_remove_optional_spaces:N \__primargs_get_file_name_test: } \cs_new_protected_nopar:Npn \__primargs_get_file_name_test: { \token_if_cs:NTF \g_primargs_token { \__primargs_get_file_name_end: } { \token_if_eq_charcode:NNTF \c_space_token \g_primargs_token { \primargs_remove_token:N \__primargs_get_file_name_end: } { \primargs_remove_token:N \__primargs_get_file_name_char: } } } \cs_new_protected_nopar:Npn \__primargs_get_file_name_end: { \exp_args:No \group_end: \g__primargs_file_name_tl } \cs_new_protected_nopar:Npn \__primargs_get_file_name_char: { \tl_gput_right:Nx \g__primargs_file_name_tl { \exp_after:wN \__primargs_get_file_name_char_ii:w \token_to_meaning:N \g_primargs_token \q_stop } \primargs_read_x_token:N \__primargs_get_file_name_test: } \cs_new:Npn \__primargs_get_file_name_char_ii:w #1 ~ #2 ~ #3 \q_stop { \__primargs_get_file_name_char_iii:w #3 ~ #3 ~ \q_stop } \cs_new:Npn \__primargs_get_file_name_char_iii:w #1 ~ #2 ~ #3 \q_stop {#2} %% %% %% End of file `primargs.sty'.