%%
%% This is file `bxjscompat.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bxjscls.dtx  (with options: `anc,compat')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from bxjscompat.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file bxjscls.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bxjscompat}
  [2022/04/10 v2.7a BXJS document classes]
\def\bxac@pkgname{bxjscompat}
\let\bxac@engine=n
\def\bxac@do#1#2{%
  \edef\bxac@tmpa{\string#1}%
  \edef\bxac@tmpb{\meaning#1}%
  \ifx\bxac@tmpa\bxac@tmpb #2\fi}
\bxac@do\XeTeXversion{\let\bxac@engine=x}
\bxac@do\luatexversion{\let\bxac@engine=l}
\ifx\jsAtEndOfClass\@undefined
  \let\bxac@delayed@if@bxjs\@firstofone
\else \let\bxac@delayed@if@bxjs\jsAtEndOfClass
\fi
\newif\ifbxac@in@old@behavior
\let\ImposeOldLuaTeXBehavior\relax
\let\RevokeOldLuaTeXBehavior\relax
\ifx x\bxac@engine
\ifx\XeTeXcharclass\@undefined\else
\bxac@delayed@if@bxjs{%
  \@ifpackageloaded{xeCJK}{}{%else
    \ifx\xe@alloc@intercharclass\@undefined\else
        \ifnum\xe@alloc@intercharclass=\z@
      \PackageInfo\bxac@pkgname
        {Setting up interchar class for CJK...\@gobble}%
      \InputIfFileExists{load-unicode-xetex-classes.tex}{%
        \xe@alloc@intercharclass=3
      }{%else
        \PackageWarning\bxac@pkgname
          {Cannot find file 'load-unicode-xetex-classes.tex'%
           \@gobble}%
      }%
    \fi\fi
    \ifnum\XeTeXcharclass"3041=\z@
      \PackageInfo\bxac@pkgname
        {Adjusting interchar class for CJK...\@gobble}%
      \@for\bxac@tmpb:={%
        3041,3043,3045,3047,3049,3063,3083,3085,3087,308E,%
        3095,3096,30A1,30A3,30A5,30A7,30A9,30C3,30E3,30E5,%
        30E7,30EE,30F5,30F6,30FC,31F0,31F1,31F2,31F3,31F4,%
        31F5,31F6,31F7,31F8,31F9,31FA,31FB,31FC,31FD,31FE,%
        31FF%
      }\do{\XeTeXcharclass"\bxac@tmpb=\@ne}%
    \fi
  }%
}
\fi
\chardef\bxac@tmpb=11
\def\bxac@do#1#2{%
  \@tempcnta=#1\relax
  \unless\ifnum\catcode\@tempcnta=\bxac@tmpb
    \chardef\bxac@tmpa=#2\relax
    \@whilenum{\@tempcnta<\bxac@tmpa}\do{%
      \catcode\@tempcnta\bxac@tmpb \advance\@tempcnta\@ne}%
  \fi}
\bxac@do{"4E00}{"9FCD}
\fi
\ifx l\bxac@engine
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname outputmode\endcsname\relax\else
\def\bxac@ob@list{%
  \do{\let}\pdfoutput{\outputmode}%
  \do{\let}\pdfpagewidth{\pagewidth}%
  \do{\let}\pdfpageheight{\pageheight}%
  \do{\protected\edef}\pdfhorigin{{\pdfvariable horigin}}%
  \do{\protected\edef}\pdfvorigin{{\pdfvariable vorigin}}}
\def\bxac@ob@do#1#2{\begingroup
  \expandafter\bxac@ob@do@a\csname bxac@\string#2\endcsname{#1}#2}
\def\bxac@ob@do@a#1#2#3#4{\endgroup
  \ifbxac@in@old@behavior \let#1#3\relax #2#3#4\relax
  \else \let#3#1\relax \let#1\@undefined
  \fi}
\protected\def\ImposeOldLuaTeXBehavior{%
  \unless\ifbxac@in@old@behavior
    \bxac@in@old@behaviortrue
    \let\do\bxac@ob@do \bxac@ob@list
  \fi}
\protected\def\RevokeOldLuaTeXBehavior{%
  \ifbxac@in@old@behavior
    \bxac@in@old@behaviorfalse
    \let\do\bxac@ob@do \bxac@ob@list
  \fi}
\fi
  \directlua{
    local function range(cs, ce, cc, ff)
      if ff or not tex.getcatcode(cs) == cc then
        local setcc = tex.setcatcode
        for c = cs, ce do setcc(c, cc) end
      end
    end
    range(0x3400, 0x4DB5, 11, false)
    \ifnum\luatexversion>64
    range(0x4DB5, 0x4DBF, 11, true)
    range(0x4E00, 0x9FCC, 11, false)
    range(0x9FCD, 0x9FFF, 11, true)
    range(0xAC00, 0xD7A3, 11, false)
    range(0x20000, 0x2A6D6, 11, false)
    range(0x2A6D7, 0x2A6FF, 11, true)
    range(0x2A700, 0x2B734, 11, false)
    range(0x2B735, 0x2B73F, 11, true)
    range(0x2B740, 0x2B81D, 11, false)
    range(0x2B81E, 0x2B81F, 11, true)
    range(0x2B820, 0x2CEA1, 11, false)
    range(0x2CEA2, 0x2FFFD, 11, true)
    \fi
  }
\fi
\endinput
%%
%% End of file `bxjscompat.sty'.
