%
% \section{Declaration of variables and functions}
%
%    \begin{macrocode}
%<*fontspec>
%    \end{macrocode}
%
% \paragraph{Booleans}
% \subparagraph{firsttime} As \cs{keys_set:nn} is run multiple times, some of its
% information storing only occurs once while we decide if the font family
% has been defined or not. When the later processing is occuring per-shape
% this no longer needs to happen; this is indicated by the `firsttime'
% conditional.
%    \begin{macrocode}
\bool_new:N \l_@@_firsttime_bool
%    \end{macrocode}
%    \begin{macrocode}
\bool_new:N \l_@@_nobf_bool
\bool_new:N \l_@@_noit_bool
\bool_new:N \l_@@_nosc_bool
%    \end{macrocode}
% These strange set functions are to simplify returning code from LuaTeX:
%    \begin{macrocode}
\bool_new:N \l_@@_check_bool
\cs_new:Npn \FontspecSetCheckBoolTrue  { \bool_set_true:N  \l_@@_check_bool }
\cs_new:Npn \FontspecSetCheckBoolFalse { \bool_set_false:N \l_@@_check_bool }
%    \end{macrocode}
%
%    \begin{macrocode}
\bool_new:N \l_@@_tfm_bool
\bool_new:N \l_@@_atsui_bool
\bool_new:N \l_@@_ot_bool
\bool_new:N \l_@@_mm_bool
\bool_new:N \l_@@_graphite_bool
%    \end{macrocode}
% For dealing with legacy maths:
%    \begin{macrocode}
\bool_new:N \g_@@_math_euler_bool
\bool_new:N \g_@@_math_lucida_bool
\bool_new:N \g_@@_pkg_euler_loaded_bool
%    \end{macrocode}
% For package options:
%    \begin{macrocode}
\bool_new:N \g_@@_cfg_bool
\bool_new:N \g_@@_math_bool
\bool_new:N \g_@@_euenc_bool
%    \end{macrocode}
%
%    \begin{macrocode}
\bool_new:N \l_@@_disable_defaults_bool
\bool_new:N \l_@@_alias_bool
\bool_new:N \l_@@_external_bool
\bool_new:N \l_@@_never_check_bool
\bool_new:N \l_@@_defining_encoding_bool
\bool_new:N \l_@@_script_exist_bool
\bool_new:N \g_@@_em_normalise_slant_bool
%    \end{macrocode}
%
% \paragraph{Counters}
%    \begin{macrocode}
\int_new:N \l_@@_script_int
\int_new:N \l_@@_language_int
\int_new:N \l_@@_strnum_int
\int_new:N \l_@@_tmp_int
\int_new:N \l_@@_em_int
\int_new:N \l_@@_emdef_int
\int_new:N \l_@@_strong_int
\int_new:N \l_@@_strongdef_int
%    \end{macrocode}
%
% \paragraph{Floating point}
%    \begin{macrocode}
\fp_new:N \l_@@_tmpa_fp
\fp_new:N \l_@@_tmpb_fp
%    \end{macrocode}
%
% \paragraph{Dimensions}
%    \begin{macrocode}
\dim_new:N \l_@@_tmpa_dim
\dim_new:N \l_@@_tmpb_dim
\dim_new:N \l_@@_tmpc_dim
\seq_new:N \g_@@_bf_series_seq
%    \end{macrocode}
%
% \paragraph{Comma lists}
%    \begin{macrocode}
\clist_new:N \g_@@_default_fontopts_clist
\clist_new:N \g_@@_all_keyval_modules_clist
\clist_set:Nn \l_@@_sizefeat_clist {Size={-}}
%    \end{macrocode}
%
% \paragraph{Property lists}
%    \begin{macrocode}
\prop_new:N \g_@@_fontopts_prop
\prop_new:N \l_@@_nfss_prop
\prop_new:N \l_@@_nfssfont_prop
\prop_new:N \g_@@_OT_features_prop
\prop_new:N \g_@@_all_opentype_feature_names_prop
\prop_new:N \g_@@_em_prop
%    \end{macrocode}
%
% \paragraph{Token lists}
%
%    \begin{macrocode}
\tl_new:N \g_@@_mathrm_tl
\tl_new:N \g_@@_bfmathrm_tl
\tl_new:N \g_@@_mathsf_tl
\tl_new:N \g_@@_mathtt_tl
%    \end{macrocode}
%
%    \begin{macrocode}
\tl_new:N \l_@@_family_label_tl
\tl_new:N \l_@@_fake_slant_tl
\tl_new:N \l_@@_fake_embolden_tl
%    \end{macrocode}
%
%    \begin{macrocode}
\tl_new:N \l_@@_fontname_up_tl
\tl_new:N \l_@@_fontname_bf_tl
\tl_new:N \l_@@_fontname_it_tl
\tl_new:N \l_@@_fontname_bfit_tl
\tl_new:N \l_@@_fontname_sl_tl
\tl_new:N \l_@@_fontname_bfsl_tl
\tl_new:N \l_@@_fontname_sc_tl
%    \end{macrocode}
%
%    \begin{macrocode}
\tl_new:N \l_@@_fontfeat_up_clist
\tl_new:N \l_@@_fontfeat_bf_clist
\tl_new:N \l_@@_fontfeat_it_clist
\tl_new:N \l_@@_fontfeat_bfit_clist
\tl_new:N \l_@@_fontfeat_sl_clist
\tl_new:N \l_@@_fontfeat_bfsl_clist
\tl_new:N \l_@@_fontfeat_sc_clist
%    \end{macrocode}
%
%    \begin{macrocode}
\tl_new:N \l_@@_script_name_tl
\tl_new:N \l_fontspec_script_tl
\tl_new:N \l_@@_lang_name_tl
\tl_new:N \l_fontspec_lang_tl
%    \end{macrocode}
%
%    \begin{macrocode}
\tl_new:N  \l_@@_mapping_tl
\tl_new:N  \g_@@_hexcol_tl
\tl_new:N  \g_@@_opacity_tl
\tl_set:Nn \g_@@_hexcol_tl {000000}
\tl_set:Nn \g_@@_opacity_tl {FF~}
\tl_set:Nn \g_@@_postadjust_tl { \l_@@_wordspace_adjust_tl \l_@@_punctspace_adjust_tl }
%    \end{macrocode}
%
%
%
% \subsection{Generic functions}
%
% \begin{macro}{\@@_keys_set_known:nnN}
%    \begin{macrocode}
\cs_new:Nn \@@_keys_set_known:nnN
  {
%<debug>  \typeout{:::: Keys~set:~{#1}~{#2} }
    \keys_set_known:nnN {#1} {#2} #3
%<debug>  \typeout{:::: Leftover:~{#3} }
  }
\cs_generate_variant:Nn \@@_keys_set_known:nnN {nx}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_head_ii:n}
% Expands to the first two \meta{items} of |#1|.
%    \begin{macrocode}
\cs_set:Npn \@@_head_ii:n #1 { \@@_head_ii:w #1 *** \q_stop}
\cs_set:Npn \@@_head_ii:w #1#2#3 \q_stop { #1#2 }
\cs_generate_variant:Nn \@@_head_ii:n {o}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_int_mult_truncate:Nn}
% Missing in expl3, IMO.
%    \begin{macrocode}
\cs_new:Nn \@@_int_mult_truncate:Nn
  {
    \int_set:Nn #1 { \__dim_eval:w #2 #1 \__dim_eval_end: }
  }
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{expl3 variants}
%
%    \begin{macrocode}
\cs_generate_variant:Nn \int_set:Nn {Nv}
\cs_generate_variant:Nn \keys_set:nn {nx}
\cs_generate_variant:Nn \keys_set_known:nnN {nx}
\cs_generate_variant:Nn \prop_put:Nnn {Nxx}
\cs_generate_variant:Nn \prop_put:Nnn {NxV}
\cs_generate_variant:Nn \prop_gput_if_new:Nnn  {NxV}
\cs_generate_variant:Nn \prop_gput:Nnn  {Nxn}
\cs_generate_variant:Nn \prop_get:NnNT  {NxN}
\cs_generate_variant:Nn \prop_get:NnNTF {NxN}
\cs_generate_variant:Nn \str_if_eq:nnTF {nv}
\cs_generate_variant:Nn \tl_if_empty:nTF {x}
\cs_generate_variant:Nn \tl_if_empty:nF {x}
\cs_generate_variant:Nn \tl_if_empty:nF {f}
\cs_generate_variant:Nn \tl_if_eq:nnT {ox}
\cs_generate_variant:Nn \tl_replace_all:Nnn {Nnx}
%    \end{macrocode}
%
%    \begin{macrocode}
%</fontspec>
%    \end{macrocode}

