%D \module
%D   [       file=mult-sys,
%D        version=1996.06.01,
%D          title=\CONTEXT\ Multilingual Macros,
%D       subtitle=System,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D In boring module we define a lot of obscure but useful system constants.
%D By doing so we save lots of memory while at the same time we prevent
%D ourself making typing errors.

\writestatus{loading}{ConTeXt Multilingual Macros / System}

\unprotect

%D This file is mostly the same as the \MKII\ variant but we keep extending
%D \MKIV, so it was bout time to have a dedicated variant.
%D
%D The constants are grouped in such a way that there is a minimal change of
%D conflicts.
%D
%D \starttyping
%D \definesystemconstants {word}
%D \definemessageconstant {word}
%D \stoptyping
%D
%D This commands generate \type{\s!word} and \type{\m!word}.

\definesystemconstant {hans}
\definesystemconstant {taco}

%D First we define some system constants used for both the multi||lingual
%D interface and multi||linguag typesetting.

% definesystemconstant {slovene}
% definesystemconstant {cz}
% definesystemconstant {vn}

\definesystemconstant {afrikaans}      \definesystemconstant {af}
\definesystemconstant {ancientgreek}   \definesystemconstant {agr}
\definesystemconstant {ancientlatin}   \definesystemconstant {ala}
\definesystemconstant {arabic}         \definesystemconstant {ar}
\definesystemconstant {bokmal}         \definesystemconstant {nb}
\definesystemconstant {catalan}        \definesystemconstant {ca}
\definesystemconstant {chinese}        \definesystemconstant {cn}
\definesystemconstant {chinese}        \definesystemconstant {cn}
\definesystemconstant {croatian}       \definesystemconstant {hr}
\definesystemconstant {czech}          \definesystemconstant {cs}
\definesystemconstant {danish}         \definesystemconstant {da}
\definesystemconstant {dutch}          \definesystemconstant {nl}
\definesystemconstant {english}        \definesystemconstant {en}
\definesystemconstant {estonian}       \definesystemconstant {et}
\definesystemconstant {farsi}          \definesystemconstant {fa} % just persian
\definesystemconstant {finnish}        \definesystemconstant {fi}
\definesystemconstant {french}         \definesystemconstant {fr}
\definesystemconstant {gbenglish}      \definesystemconstant {gb}
\definesystemconstant {german}         \definesystemconstant {de}
\definesystemconstant {greek}          \definesystemconstant {gr}
\definesystemconstant {hebrew}         \definesystemconstant {he}
\definesystemconstant {hungarian}      \definesystemconstant {hu}
\definesystemconstant {italian}        \definesystemconstant {it}
\definesystemconstant {japanese}       \definesystemconstant {ja}
\definesystemconstant {korean}         \definesystemconstant {kr}
\definesystemconstant {latin}          \definesystemconstant {la}
\definesystemconstant {lithuanian}     \definesystemconstant {lt}
\definesystemconstant {malayalam}      \definesystemconstant {ml}
\definesystemconstant {norwegian}      \definesystemconstant {no}
\definesystemconstant {nynorsk}        \definesystemconstant {nn}
\definesystemconstant {persian}        \definesystemconstant {pe}
\definesystemconstant {polish}         \definesystemconstant {pl}
\definesystemconstant {portuguese}     \definesystemconstant {pt}
\definesystemconstant {romanian}       \definesystemconstant {ro}
\definesystemconstant {russian}        \definesystemconstant {ru}
\definesystemconstant {slovak}         \definesystemconstant {sk}
\definesystemconstant {slovenian}      \definesystemconstant {sl}
\definesystemconstant {spanish}        \definesystemconstant {es}
\definesystemconstant {swedish}        \definesystemconstant {sv}
\definesystemconstant {thai}           \definesystemconstant {th} % mojca mentioned it at BT2013 but we need more info
\definesystemconstant {turkish}        \definesystemconstant {tr}
\definesystemconstant {turkmen}        \definesystemconstant {tk}
\definesystemconstant {ukenglish}      \definesystemconstant {uk}
\definesystemconstant {ukrainian}      \definesystemconstant {ua}
\definesystemconstant {usenglish}      \definesystemconstant {us}
\definesystemconstant {vietnamese}     \definesystemconstant {vi}

%D For proper \UNICODE\ support we need a few font related constants.

\definesystemconstant {BoldItalic}
\definesystemconstant {BoldSlanted}
\definesystemconstant {Bold}
\definesystemconstant {Italic}
\definesystemconstant {Regular}
\definesystemconstant {Slanted}
\definesystemconstant {Unicode}

\definesystemconstant {Handwriting}
\definesystemconstant {Calligraphy}
\definesystemconstant {Casual}

\definesystemconstant {Regular}
\definesystemconstant {Support}
\definesystemconstant {Type}

\definesystemconstant {Math}     % not used
\definesystemconstant {MathBold} % not used

\definesystemconstant {MathRoman}
\definesystemconstant {MathRomanBold}

\definesystemconstant {Serif}
\definesystemconstant {SerifBold}
\definesystemconstant {SerifItalic}
\definesystemconstant {SerifBoldItalic}
\definesystemconstant {SerifSlanted}
\definesystemconstant {SerifBoldSlanted}
\definesystemconstant {SerifCaps}
%definesystemconstant {SerifCapsSlanted}

\definesystemconstant {Sans}
\definesystemconstant {SansBold}
\definesystemconstant {SansItalic}
\definesystemconstant {SansBoldItalic}
\definesystemconstant {SansSlanted}
\definesystemconstant {SansBoldSlanted}
\definesystemconstant {SansCaps}
%definesystemconstant {SansCapsSlanted}

\definesystemconstant {Mono}
\definesystemconstant {MonoBold}
\definesystemconstant {MonoItalic}
\definesystemconstant {MonoBoldItalic}
\definesystemconstant {MonoSlanted}
\definesystemconstant {MonoBoldSlanted}
\definesystemconstant {MonoCaps}
%definesystemconstant {MonoCapsSlanted}
%definesystemconstant {MonoVariable}

\definesystemconstant {DefaultFont}

\definesystemconstant {Simple}
\definesystemconstant {Normal}
\definesystemconstant {Caps}

\definesystemconstant {serif}
\definesystemconstant {sans}
\definesystemconstant {mono}
\definesystemconstant {math}
\definesystemconstant {nomath}
\definesystemconstant {handwriting}
\definesystemconstant {calligraphy}
\definesystemconstant {casual}
\definesystemconstant {fax}

\definesystemconstant {fallback}

%definesystemconstant {mnem} % kind of generic short tag

\definesystemconstant {otr}
\definesystemconstant {box}

\definesystemconstant {file}
\definesystemconstant {name}
\definesystemconstant {spec}

\definesystemconstant {both}

\definesystemconstant {internal}
\definesystemconstant {external}

\definesystemconstant {attribute}

\definesystemconstant {none}
\definesystemconstant {auto}
\definesystemconstant {default}
\definesystemconstant {smallcaps}

\definesystemconstant {regular}
\definesystemconstant {script}
\definesystemconstant {fraktur}
\definesystemconstant {blackboard}

\definesystemconstant {mi} % maybe some day a special default vector
\definesystemconstant {tf}
\definesystemconstant {sl}
\definesystemconstant {it}
\definesystemconstant {bf}
\definesystemconstant {bs}
\definesystemconstant {bi}

\definesystemconstant {rm}
\definesystemconstant {ss}
\definesystemconstant {tt}
\definesystemconstant {hw}
\definesystemconstant {cg}
\definesystemconstant {mm}

\definesystemconstant {x}
\definesystemconstant {xx}
\definesystemconstant {em}

\definesystemconstant {a}
\definesystemconstant {b}
\definesystemconstant {c}
\definesystemconstant {d}
\definesystemconstant {e}
\definesystemconstant {f}

\definesystemconstant {mr}
\definesystemconstant {mb}
\definesystemconstant {mrlr}
\definesystemconstant {mrrl}
\definesystemconstant {mblr}
\definesystemconstant {mbrl}

\definesystemconstant {tf}
\definesystemconstant {bf}
\definesystemconstant {bs}
\definesystemconstant {bi}
\definesystemconstant {sl}
\definesystemconstant {it}
\definesystemconstant {sc}

\definesystemconstant {small}
\definesystemconstant {big}

\definesystemconstant {first}
\definesystemconstant {second}
\definesystemconstant {third}

%D Next come some \CONTEXT\ constants, used in the definition of private commands:

\definesystemconstant {tex}
\definesystemconstant {xml}
\definesystemconstant {lua}

\definesystemconstant {action}
\definesystemconstant {ascii}
\definesystemconstant {chain}
\definesystemconstant {child}
\definesystemconstant {class}
\definesystemconstant {clone}
\definesystemconstant {compare}
\definesystemconstant {complex}
\definesystemconstant {counter}
\definesystemconstant {current}
\definesystemconstant {default}
\definesystemconstant {dodo}
\definesystemconstant {done}
\definesystemconstant {do}
\definesystemconstant {dummy}
\definesystemconstant {font}
\definesystemconstant {forget}
\definesystemconstant {global}
\definesystemconstant {handler}
\definesystemconstant {indeed}
\definesystemconstant {internal}
\definesystemconstant {link}
\definesystemconstant {local}
\definesystemconstant {multi}
\definesystemconstant {next}
\definesystemconstant {parent}
\definesystemconstant {pickup}
\definesystemconstant {plural}
\definesystemconstant {section}
\definesystemconstant {simple}
\definesystemconstant {single}
\definesystemconstant {singular}
\definesystemconstant {start}
\definesystemconstant {stop}
\definesystemconstant {unknown}

% translating setups is asking for a mess so we keep them as-is:

\definesystemconstant {setups}

\definesystemconstant {cite}
\definesystemconstant {nocite}
\definesystemconstant {list}
\definesystemconstant {register}
\definesystemconstant {author}
\definesystemconstant {numbering}

% \def\s!parent{->} % 1% faster / => does not work in assignments
% \def\s!child {<-} % 1% faster / <= does not work in assignments

\definesystemconstant {hasnumber}
\definesystemconstant {hastitle}
\definesystemconstant {hascaption}
\definesystemconstant {haslevel}
\definesystemconstant {hasparent}
\definesystemconstant {hassuffix}

\definesystemconstant {mkiv}
\definesystemconstant {mkii}

\definesystemconstant {normal}
\definesystemconstant {bold}
\definesystemconstant {italic}
\definesystemconstant {slanted}
\definesystemconstant {smallcaps}
\definesystemconstant {lcgreek}
\definesystemconstant {ucgreek}
\definesystemconstant {sygreek}
\definesystemconstant {italics}
\definesystemconstant {ligatures}
\definesystemconstant {collapsing}

\definesystemconstant {default}

\definesystemconstant {mode}
\definesystemconstant {setup}
\definesystemconstant {environment}
\definesystemconstant {document}

%definesystemconstant {fam}
\definesystemconstant {display}
\definesystemconstant {text}
\definesystemconstant {script}
\definesystemconstant {scriptscript}
\definesystemconstant {uncramped}
\definesystemconstant {cramped}

\definesystemconstant {hyphenmin}
\definesystemconstant {lefthyphenmin}
\definesystemconstant {righthyphenmin}
\definesystemconstant {lefthyphenchar}
\definesystemconstant {righthyphenchar}

\definesystemconstant {head}
\definesystemconstant {symbol}
\definesystemconstant {sub}
\definesystemconstant {margin}
\definesystemconstant {edge}

\definesystemconstant {double}
\definesystemconstant {decimal}
\definesystemconstant {binary}

%definesystemconstant {skewchar}
%definesystemconstant {hyphenchar}
\definesystemconstant {catcodes}
%definesystemconstant {encoding}
%definesystemconstant {entities}
%definesystemconstant {resource}
\definesystemconstant {mapping}
\definesystemconstant {language}
\definesystemconstant {patterns}
\definesystemconstant {rname}
\definesystemconstant {rscale}
%definesystemconstant {handling}
\definesystemconstant {features}
\definesystemconstant {direction}
\definesystemconstant {fallbacks}
\definesystemconstant {goodies}
\definesystemconstant {designsize}
%definesystemconstant {background}
%definesystemconstant {ucmap}
\definesystemconstant {level}
\definesystemconstant {integral}
\definesystemconstant {insert} % maybe insertclass
\definesystemconstant {marker}
\definesystemconstant {kernpairs}
\definesystemconstant {mixedcolumn}
\definesystemconstant {orientation}

\definesystemconstant {ampersand}

%definesystemconstant {property}
%definesystemconstant {overprint}
%definesystemconstant {layer}
\definesystemconstant {effect}                 % todo s
%definesystemconstant {negative}
%definesystemconstant {color}
%definesystemconstant {transparency}

\definesystemconstant {black}
\definesystemconstant {white}

\definesystemconstant {system} % not yet interfaces messages
\definesystemconstant {user}
\definesystemconstant {check}
\definesystemconstant {reset}
\definesystemconstant {set}
\definesystemconstant {empty}

\definesystemconstant {realpage}
\definesystemconstant {userpage}
\definesystemconstant {subpage}

\definesystemconstant {page}
\definesystemconstant {subpage}
\definesystemconstant {leftpage}
\definesystemconstant {rightpage}
\definesystemconstant {somewhere}

\definesystemconstant {userdata}
\definesystemconstant {command}
\definesystemconstant {simple}

\definesystemconstant {full}
\definesystemconstant {text}
\definesystemconstant {paragraph}
\definesystemconstant {margintext}
\definesystemconstant {line}

\definesystemconstant {number}
\definesystemconstant {symbol}
\definesystemconstant {format}
\definesystemconstant {data}
\definesystemconstant {float}
\definesystemconstant {extensions}
\definesystemconstant {initializations}

\definesystemconstant {rgb}
\definesystemconstant {cmyk}
\definesystemconstant {gray}
\definesystemconstant {spot}
\definesystemconstant {all}
\definesystemconstant {dtp}
\definesystemconstant {none}

\definesystemconstant {map}
\definesystemconstant {special}
\definesystemconstant {size}

\definesystemconstant {depth}
\definesystemconstant {height}
\definesystemconstant {noheight}
\definesystemconstant {nodepth}

\definesystemconstant {rel}
\definesystemconstant {ord}

%D Just to be complete we define the standard \TEX\ units.

\definesystemconstant {cm}
\definesystemconstant {em}
\definesystemconstant {ex}
\definesystemconstant {mm}
\definesystemconstant {pt}
\definesystemconstant {sp}
\definesystemconstant {bp}
\definesystemconstant {in}
\definesystemconstant {pc}
\definesystemconstant {dd}
\definesystemconstant {cc}
\definesystemconstant {nd}
\definesystemconstant {nc}

\definesystemconstant {traditional}
\definesystemconstant {left}
\definesystemconstant {middle}
\definesystemconstant {right}
\definesystemconstant {xoffset}
\definesystemconstant {yoffset}

\definesystemconstant {topfloat}
\definesystemconstant {bottomfloat}
\definesystemconstant {pagefloat}

%D As the name of their define command states, the next set of constants is used in
%D the message macro's.

\definemessageconstant {check}
\definemessageconstant {colors}
\definemessageconstant {columns}
\definemessageconstant {regimes}
\definemessageconstant {figures}
\definemessageconstant {fields}
\definemessageconstant {files}
\definemessageconstant {floatblocks}
\definemessageconstant {fonts}
\definemessageconstant {handlings}
\definemessageconstant {interactions}
\definemessageconstant {javascripts}
\definemessageconstant {layouts}
\definemessageconstant {languages}
\definemessageconstant {references}
\definemessageconstant {structures}
\definemessageconstant {symbols}
\definemessageconstant {system}
\definemessageconstant {lua}
\definemessageconstant {textblocks}
\definemessageconstant {verbatims}
\definemessageconstant {versions}
\definemessageconstant {metapost}
\definemessageconstant {chemicals}
\definemessageconstant {publications}
\definemessageconstant {backend}

%D When we use numbers and dimensions the same applies as with the keywords like
%D \type {width} and \type {plus} mentioned earlier.

\def\!!ten                   {10}
\def\!!twelve                {12}
\def\!!hundred              {100}
\def\!!thousand            {1000}
\def\!!tenthousand        {10000}
\def\!!maxcard            {65536}
\def\!!medcard            {32768}

\def\!!zeropoint            {0pt}
\def\!!onepoint             {1pt}
\def\!!twopoint             {2pt}
\def\!!threepoint           {3pt}
\def\!!fourpoint            {4pt}
\def\!!fivepoint            {5pt}
\def\!!sixpoint             {6pt}
\def\!!sevenpoint           {7pt}
\def\!!eightpoint           {8pt}
\def\!!ninepoint            {9pt}
\def\!!tenpoint            {10pt}
\def\!!elevenpoint         {11pt}
\def\!!twelvepoint         {12pt}
\def\!!fourteenpointfour {14.4pt}

\def\!!plustoken              {+}
\def\!!minustoken             {-}

\def\__unknown__    {\string\\//} % unlikely value

%D Variables are composed of a command specific tag and a user supplied variable
%D (system constant). The tag \type {du} for instance is available as \type {\??du}
%D and expands to \type {@@du} in composed variables.

\definesystemvariable {du}   % dummy, will stay

% bibl:

\definesystemvariable {pv}   % PublicationVariable
\definesystemvariable {pb}   % PuBlication

% needs checking (namespaces now)

\definesystemvariable {fw}   % simpleFonts by Wolfgang

% old pragma

\definesystemvariable {kt}   % KonTakten
\definesystemvariable {kw}   % KontaktWaarde
\definesystemvariable {st}   % STickers
\definesystemvariable {km}   % KenMerk

% mkii

\definesystemvariable {xf}   % XML File (xtag)
\definesystemvariable {xp}   % XML Processing (xtag, so still needed)
\definesystemvariable {fo}   % xml FO (xtag)
\definesystemvariable {fx}   % FoXet

% mkiv

%D Next we define some language independant one letter variables and keywords. We can
%D actually make these system variables.

\defineinterfaceconstant {x} {x}
\defineinterfaceconstant {y} {y}
\defineinterfaceconstant {w} {w}
\defineinterfaceconstant {h} {h}
\defineinterfaceconstant {s} {s}
\defineinterfaceconstant {t} {t}

\defineinterfaceconstant {a} {a} % can go
\defineinterfaceconstant {b} {b} % can go
\defineinterfaceconstant {c} {c} % can go
\defineinterfaceconstant {d} {d} % can go
\defineinterfaceconstant {e} {e} % can go
\defineinterfaceconstant {f} {f} % can go

\defineinterfaceconstant {s} {s}
\defineinterfaceconstant {r} {r}
\defineinterfaceconstant {g} {g}
\defineinterfaceconstant {b} {b}
\defineinterfaceconstant {c} {c}
\defineinterfaceconstant {m} {m}
\defineinterfaceconstant {y} {y}
\defineinterfaceconstant {k} {k}
\defineinterfaceconstant {a} {a} % alternative
\defineinterfaceconstant {t} {t} % transparency
\defineinterfaceconstant {p} {p} % percentage
\defineinterfaceconstant {h} {h}
\defineinterfaceconstant {s} {s}
\defineinterfaceconstant {v} {v}

\defineinterfaceconstant {rgb}  {rgb}
\defineinterfaceconstant {cmyk} {cmyk}
\defineinterfaceconstant {mp}   {mp}

\defineinterfacevariable {rgb}  {rgb}
\defineinterfacevariable {cmyk} {cmyk}
\defineinterfacevariable {mp}   {mp}

\defineinterfacevariable {s} {s}

\defineinterfacevariable {a} {a}
\defineinterfacevariable {b} {b}
\defineinterfacevariable {c} {c}
\defineinterfacevariable {d} {d}

%D For tagging:

\definesystemconstant {subtype}
\definesystemconstant {top}
\definesystemconstant {bottom}
\definesystemconstant {both}

%D Special purpose variables:

\def\v!oddeven#1{\ifodd#1\v!odd\else\v!even\fi}

%D The names of files and their extensions are fixed. \CONTEXT\ uses as less
%D files as possible. Utility files can be recognized by the first two
%D characters of the extension: \type {tu}.

%definefileconstant {utilityfilename}    {texutil}
%definefileconstant {blockextension}     {tub}
%definefileconstant {figureextension}    {tuf}
%definefileconstant {inputextension}     {tui}
%definefileconstant {outputextension}    {tuo} % tup for previous run
%definefileconstant {optionextension}    {top}
%definefileconstant {temporaryextension} {tmp}
%definefileconstant {patternsextension}  {pat}
%definefileconstant {hyphensextension}   {hyp}
%definefileconstant {fontmapextension}   {map}
\definefileconstant {bibextension}       {bbl}

%D These files are loaded at start||up. They may contain system specific setups (or
%D calls to other files), old macro's, to garantee compatibility and new macro's noy
%D yet present in the format.

\definefileconstant {sysfilename} {cont-sys.mkiv}
\definefileconstant {newfilename} {cont-new.mkiv}
\definefileconstant {locfilename} {cont-loc.mkiv}
\definefileconstant {expfilename} {cont-exp.mkiv}
\definefileconstant {fntfilename} {cont-fnt.mkiv} % not yet used
\definefileconstant {gdsfilename} {cont-fnt.lfg}  % not yet used

%D The setup files for the language, font, color and special subsystems have a common
%D prefix. This means that we have at most three characters for unique filenames.

\definefileconstant {colo_run} {colo-run}
\definefileconstant {font_run} {font-run}
\definefileconstant {page_run} {page-run}
\definefileconstant {symb_run} {symb-run}
\definefileconstant {publ_tra} {publ-tra}

%D For figure inclusion we need(ed):

%defineinterfaceconstant {tif}  {tif}
%defineinterfaceconstant {eps}  {eps}
%defineinterfaceconstant {mps}  {mps}
%defineinterfaceconstant {jpg}  {jpg}
%defineinterfaceconstant {pdf}  {pdf}
%defineinterfaceconstant {png}  {png}
%defineinterfaceconstant {avi}  {avi}
%defineinterfaceconstant {mov}  {mov}
%defineinterfaceconstant {svg}  {svg}
\defineinterfaceconstant {tex}  {tex} % Also gone?
%defineinterfaceconstant {tmp}  {tmp}
%defineinterfaceconstant {cld}  {cld}

%D A careful reader will have noticed that in the module \type {mult-ini} we defined
%D \type {\selectinterface}. We were not yet able to actually select an interface,
%D because we still had to define the constants and variables. Now we've done so,
%D selection is permitted.

\selectinterface

%D Ok, here are some more, because we've got ouselves some extensions to \CONTEXT.

\definemessageconstant {addresses}
\definemessageconstant {documents}

%D Nicer than being undefined:

\let\p_align     \empty
\let\p_aligntitle\empty
\let\p_continue  \empty
\let\p_footer    \empty
\let\p_label     \empty
\let\p_number    \empty
\let\p_page      \empty
\let\p_state     \empty
\let\p_strut     \empty
\let\p_text      \empty
\let\p_tolerance \empty

% more will follow

\protect \endinput
