<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%
% ltj-base.sty
%

%! ă“ă‚ŚăŻĺ¤–ă‹ă‚‰čŞ­ăľă‚ŚăŞă„
%% Avoid multiple loading.
\csname luatexjabaseLoaded\endcsname
\edef\ltj@base@AtEnd{%
\endlinechar=\the\endlinechar
\relax}
\endlinechar=-1 %
\def\luatexjabaseLoaded{\endinput}

\ifltj@in@latex                 %&lt;*LaTeX&gt;
  \NeedsTeXFormat{LaTeX2e}
  \ProvidesPackage{ltj-base}[2021-03-16]
\fi                             %&lt;/LaTeX&gt;

%%------------------ Tiny helpers

%% Registers
%\newcount\ltj@tempcnta % defined at luatexja-core.sty
%\newcount\ltj@tempdima % defined at luatexja-core.sty
\newcount\ltj@tempcntb
\newcount\ltj@tempcntc
% \newskip\ltj@tempskipa unused
% \newtoks\ltj@temptoks unused

\countdef\ltj@@count@zero=0 %
\luatexattributedef\ltj@@attr@zero=0 %
\dimendef\ltj@@dimen@zero=0 %
\skipdef\ltj@@skip@zero=0 %

%% Quarks
%! ăźă&nbsp; expl3 ă® quark ă¨ăŻç•°ăŞă‚Šĺ±•é–‹ă•ă‚Śă‚‹ă¨ă‚¨ă©ăĽă«ăŞă‚‹.
%% \ltj@q@stop
\protected\def\ltj@q@stop{\ltj@q@stop@}
%% \ltj@q@nil
\protected\def\ltj@q@nil{\ltj@q@nil@}
%% \ltj@q@mark
\protected\def\ltj@q@mark{\ltj@q@mark@}

%! etoolbox ă® \csletcs.
%% \ltj@csletcs
\protected\def\ltj@csletcs#1#2{
  \expandafter\let\csname#1\expandafter\endcsname
  \csname#2\endcsname
}

%% \ltj@ifx{&lt;sutff&gt;}{&lt;yes&gt;}{&lt;no&gt;}
%! LaTeX ĺ˝˘ĺĽŹă® \ifx. ă“ă®ĺ˝˘ĺĽŹă®ĺ©ç‚ąăŻč‡Şĺ‹•çš„ă«ćťˇä»¶ăŤă‚ąăă‹ă‚‰ă®
%! č„±ĺ‡şăŚĺŹŻč˝ă§ă‚ă‚‹ă“ă¨.
% Does \ifx&lt;stuff&gt; test in LaTeX style.
\long\def\ltj@ifx#1{
  \ifx#1\expandafter\ltx@firstoftwo
  \else\expandafter\ltx@secondoftwo\fi
}

\protected\def\ltj@@q@empty{\ltj@@q@empty@}

%% \ltj@if@blank{&lt;stuff&gt;}{&lt;yes&gt;}{&lt;no&gt;}
%! &lt;stuff&gt; ăŚç©şăľăźăŻç©şç™˝ć–‡ĺ­—ă‹ă‚‰ăŞă‚‹ă‹.
% Checks if &lt;stuff&gt; is either empty or consisting only of spaces.
\def\ltj@if@blank#1{
  \ltj@@if@blankA#1\ltj@@q@empty\ltj@@q@empty
   \ltx@secondoftwo\ltx@firstoftwo\ltj@q@nil
}
\long\def\ltj@@if@blankA#1#2\ltj@@q@empty#3#4#5\ltj@q@nil{
  #4
}

%%------------------ LaTeX vs plain
\ifltj@in@latex            %&lt;*LaTeX&gt;

%% \ifltj@in@latex
%! LaTeX ă§ă‚ă‚‹ă‹.
%(Defined in luatexja-core.sty.)

%% \ifltj@in@plain
%! plain ă§ă‚ă‚‹ă‹.
\ltj@csletcs{ifltj@in@plain}{iffalse}

\else                           %&lt;*!LaTeX&gt;

%% \ifltj@in@plain
\ifnum\pdf@strcmp{\fmtname}{plain}=0 %
  \ltj@csletcs{ifltj@in@plain}{iftrue}
\else
  \ltj@csletcs{ifltj@in@plain}{iffalse}
\fi

\fi                             %&lt;/LaTeX&gt;
%%------------------ Value-token handling

%% helper stuffs

%% \ltj@gobble@num &lt;number&gt;
%! ć¬ˇă«ç¶šăŹć•´ć•°ă‚’(2 ĺ›žĺ±•é–‹ă§)čŞ­ăżćŤ¨ă¦ă‚‹. 
\def\ltj@gobble@num{
  \directlua{token.scan_int()}
}

%% \ltj@gobble@glue &lt;glue&gt;
%! ć¬ˇă«ç¶šăŹă‚°ă«ăĽĺ€¤ă‚’(2 ĺ›žĺ±•é–‹ă§)čŞ­ăżćŤ¨ă¦ă‚‹. 
\def\ltj@gobble@glue{
  \directlua{node.free(token.scan_glue())}
}

%% \ltj@gobble@dimen &lt;dimen&gt;
%! ć¬ˇă«ç¶šăŹĺŻ¸ćł•ĺ€¤ă‚’(2 ĺ›žĺ±•é–‹ă§)čŞ­ăżćŤ¨ă¦ă‚‹. 
\def\ltj@gobble@dimen{
  \directlua{token.scan_dimen()}
}

%% \ltj@grab@num &lt;number&gt;
%! ć¬ˇă«ç¶šăŹć•´ć•°ă‚’čŞ­ăżĺŹ–ăŁă¦, ăťă‚Śă¨ç­‰ă—ă„ć•´ć•°ă‚’čˇ¨ă™ăăĽă‚Żăłĺ—
%! (ĺż…ăšă—ă‚‚ć•´ć•°čˇ¨č¨ă¨ăŻé™ă‚‰ăŞă„)ă‚’ { } ă«ĺ…Ąă‚Śăźă‚‚ă®ă«(2 ĺ›žă§)
%! ĺ±•é–‹ă™ă‚‹.
%! ăźă&nbsp;ă—, ć•´ć•°ăŻä»Ąä¸‹ă®ĺ˝˘ĺĽŹă®ă„ăšă‚Śă‹ă§ăŞă‘ă‚Śă°ăŞă‚‰ăŞă„.
%! - ć•´ć•°čˇ¨č¨(10 é€˛, 8 é€˛, 16 é€˛, ć–‡ĺ­—)
%! - chardef ăăĽă‚Żăł
%! - ĺ†…é¨ć•´ć•°ă‘ă©ăˇă‚ż, countdef ăăĽă‚Żăł
%!   (command_name ăŚ "assign_int" ă§ă‚ă‚‹ăăĽă‚Żăł).
%! (ćł¨ć„Ź: ăľă&nbsp;ć–‡ĺ­—čˇ¨č¨(`A)ă«ĺŻľĺżśă—ă¦ă„ăľă›ă‚“.)
\def\ltj@grab@num{
  \directlua{tex.sprint(luatexbase.catcodetables['latex-package'], '{' .. token.scan_int() .. '}')}
}

%%------------------ Safe passing

% These macros convert a token sequence denoting a TeX value to its
% suitable notation in Lua, and when the argument is malformed then
% 'nil' is returned. They are all fully-expandable.
%! TeX ă®ĺ€¤ă‚’ Lua ä¸Šă®čˇ¨č¨ă«ĺ¤‰ćŹ›ă™ă‚‹. ä¸Ťć­Łĺ˝˘ĺĽŹă&nbsp;ă¨ nil ă«ă™ă‚‹.

\def\ltj@@safe@end{\noexpand\ltj@@safe@end}
  % behaves same as \relax but is distinct from it

%% \ltj@safe@invalid
% The value passed to lua instead of malformed value tokens.
\def\ltj@safe@invalid{(nil)}

%% \ltj@safe@num{&lt;number&gt;}
%! ć•´ć•°.
% For a number (integer).
\def\ltj@safe@num{
  \ltj@safe@num@or\ltj@safe@invalid
}
\def\ltj@safe@num@or#1#2{
  \expandafter\expandafter\expandafter\ltj@@safe@numA
   \ltj@gobble@num#2\ltj@@safe@end{#2}{#1}
}
\def\ltj@@safe@numA#1\ltj@@safe@end#2#3{
  \ltj@if@blank{#1}{
    (\number#2)
  }{
    #3
  }
}

%% \ltj@safe@dimen{&lt;dimen&gt;}
%! ĺŻ¸ćł•ĺ€¤.
% For a dimension. The result is a scaled-point value.
\def\ltj@safe@dimen{
  \ltj@safe@dimen@or\ltj@safe@invalid
}
\def\ltj@safe@dimen@or#1#2{
  \expandafter\expandafter\expandafter\ltj@@safe@dimenA
   \ltj@gobble@dimen#2\ltj@@safe@end{#2}{#1}
}
\def\ltj@@safe@dimenA#1\ltj@@safe@end#2#3{
  \ltj@if@blank{#1}{
    (\number\dimexpr#2\relax)
  }{
    #3
  }
}

%! ć•´ĺ˝˘ĺĽŹă®ć•´ć•° â†’ ć•°ĺ€¤ : \number#1
%! ĺ†…é¨ĺŻ¸ćł• â†’ ć•°ĺ€¤ : \number#1
%! ć•´ĺ˝˘ĺĽŹă®ĺŻ¸ćł• â†’ ć•°ĺ€¤ : \number\dimexpr#1\relax

%% \ltj@safe@str{&lt;text&gt;}
%! ć–‡ĺ­—ĺ—. (ăăĽă‚Żăłĺ—ă‚’éťžăăĽă‚ŻăłĺŚ–)
% Converts a token sequence to Lua string notation.
\def\ltj@safe@str#1{
  "\luatexluaescapestring{\detokenize{#1}}"
}

%%------------------ debug logging
\ifdefined\LuaTeXjaDebugEnabled

%% Load Lua module
\RequireLuaModule{luatexja.debug}

%% \ltj@debug{&lt;format&gt;}{&lt;arg&gt;,...}
\def\ltj@debug#1#2{
  \directlua{
    luatexja.base.debug(\ltj@safe@str{#1}
      \ltj@if@blank{#2}{}{, }
      #2)
  }
}

%% \ltj@package@debug{&lt;package&gt;}{&lt;format&gt;}{&lt;arg&gt;,...}
\def\ltj@package@debug#1#2#3{
  \directlua{
    luatexja.base.package_debug(\ltj@safe@str{#1},
      \ltj@safe@str{#2}
      \ltj@if@blank{#3}{}{, }
      #3)
  }
}

\else

\def\ltj@debug#1#2{}
\def\ltj@package@debug#1#2#3{}

\fi

%% \ltj@debug@logger\CS{&lt;package&gt;}
\def\ltj@debug@logger#1#2{
  \def#1{\ltj@package@debug{#2}}
}

%% \ltj@afterbox &lt;token&gt;&lt;box&gt;
%% -&gt; \setbox\ltj@afbox&lt;box&gt;&lt;token&gt;
%% idea from the atbegshi package
\newbox\ltj@afbox
\directlua{luatexja.afbox_number=\the\ltj@afbox}
\protected\def\ltj@afterbox#1{%
  \def\ltj@afbox@@arg{#1}\edef\ltj@afbox@@grouplevel{\number\currentgrouplevel}%
  \afterassignment\ltj@afbox@@\setbox\ltj@afbox}
\def\ltj@afbox@@{%
  \ifnum\ltj@afbox@@grouplevel&lt;\currentgrouplevel\expandafter\aftergroup\fi\ltj@afbox@@arg
}


%%------------------ all done
\ltj@base@AtEnd
\endinput
%% EOF
</pre></body></html>