%%
%% This is file 'bxbase.sty'.
%%
%% Copyright (c) 2008-2023 Takayuki YATO (aka. "ZR")
%%   GitHub:   https://github.com/zr-tex8r
%%   Twitter:  @zr_tex8r
%%
%% This package is distributed under the MIT License.
%%

%% package declaration
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bxbase}[2023/02/23 v1.2a BX base library]

%--------------------------------------- main

%% load submodule
\providecommand*\bxRequireDefinition[1]{%
  \def\bxbz@ext{def}\@onefilewithoptions{#1}[][]\bxbz@ext}
\bxRequireDefinition{bxbase}

%% enable begin-document hooks
\bxBDHookBabel
\bxBDHookUnicode
\bxBDHookJisInput
\bxBDHookSafeCaret
\bxBDHookUcsFastErrors

%% error messages
\def\bxbz@pkgname{bxbase}
\def\bxbz@inf@aecsq#1{%
  \PackageInfo\bxbz@pkgname
   {Command \string#1 already exists}}

%--------------------------------------- extra

%%<*> \Ux / \UI / \AJ / \JI / \KI
% define commands unless their name is already used
\bxPreamble\def\bxbz@charcmd#1#2{%
  \ifundef#1{\def#1{#2}}{\bxbz@inf@aecsq#1}}
\bxbz@charcmd\Ux\bxUx
\bxbz@charcmd\UI\bxUI
\bxbz@charcmd\AJ\bxAJ
\bxbz@charcmd\JI\bxJI
\bxbz@charcmd\KI\bxKI

%--------------------------------------- all done
\endinput
%
% * bxbase provides:
%   - bx@Uxh@fb      (terminal)
%   - bxUx           (passed to bx@Ux)
%   - bxUI           (passed to bx@UI)
%   - bxUHex         (passed to bx@Uxh)
% * bxutf8 provides:
%   - conversion from UTF8 string to bxUHex
% * bxucs provides:
%   - bx@Ux@ucs      (fallback to bx@UI)
%   - bx@Uxh@ucs     (fallback to bx@UIh)
% * utf/otf provides:
%   - bx@UIh@p       (terminal)
%
% [default]
%   bx@Ux       bx@Uxh  
%     v           v     
%   bx@UI   >   bx@UIh  =  bx@UIh@fb or bx@UIh@p
%
% [with bxucs]
%   bx@Ux = bx@Ux@ucs   bx@Uxh = bx@Uxh@ucs
%             v                    v       
%           bx@UI     >          bx@UIh  =  bx@Uxh@fb or bx@UIh@p
%
%% EOF
