%D \module
%D   [       file=strc-flt,
%D        version=2008.10.20,
%D          title=\CONTEXT\ Structure Macros,
%D       subtitle=Initialization \& Helpers,
%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.

\writestatus{loading}{ConTeXt Structure Macros / Initialization & Helpers}

\registerctxluafile{strc-ini}{1.001}

\unprotect

% segments: 0:100 2:3 chapter:subsection 3 (=self+2)        (alternative: sectionset)

% section   : [sectionnumber(s)]
%             sectionseparatorset (default) sectionconversionset (default) sectionstopper ()  sectionset sectionsegments

% lists     : [sectionnumber(s)] [text] [prefix(es)[separator][pagenumber(s)]
%             sectionseparatorset (default) sectionconversionset (default) sectionstopper     sectionset sectionsegments
%             prefixseparatorset  (default) prefixconversionset  (default) prefixstopper  (.) prefixset  prefixsegments
%             pageseparatorset    (default) pageconversionset    (default) pagestopper    ()             pagesegments
%             prefix (no)

% counter   : [prefix(es)[separator]][number(s)]
%             prefixseparatorset  (default) prefixconversionset  (default) prefixstopper  (.) prefixset  prefixsegments
%             numberseparatorset  (default) numberconversionset  (default) numberstopper  ()             numbersegments
%             prefix (no)

% pagenumber: [prefix(es)[separator]][pagenumber(s)]
%             prefixseparatorset  (default) prefixconversionset  (default) prefixstopper  (.) prefixset  prefixsegments
%             pageseparatorset    (default) pageconversionset    (default) pagestopper    ()
%             prefix (no)

%               text  mark  reference  list
% section       P     P     P          P
% float         P.N         P.N        P.N
% itemize       P.N         P.N
% enumerate     P.N         P.N        P.N
% formula       P.N         P.N
% footnote      P.N         P.N        P.N
% number        P.N         P.N

% number prefix section page

% [text|marking|reference|list]:[number|prefix|pagenumber|pageprefix]:[separatorset|conversionset|conversion|stopper|set|segments|resetset|order]

% figure caption  : text:number:* text:prefix:* -> \setupcaption[figure][...]; stores defaults
% figure list     : list:number:* list:prefix:* list:pagenumber:* list:pageprefix:* -> \setuplist[figure][...]; takes stored defaults for number and pagenumber]
% figure reference: reference:number:* reference:prefix:* reference:pagenumber:* reference:pageprefix:* -> \setupreference[figure]]...]; takes stored defaults

% This module deals with structure: section headers, list and
% numbering and eventually cross referencing. These components are
% rather interwoven and therefore an inbetween layer is used.
% Eventually this will replace the corresponding code in core-sec,
% core-lst, core-num and core-ref.

% We collect operations that deal with things like formatting on each
% level of a number in sets. This is all handles at the \LUA\ end.
% References to such sets travel with the multipass information.

\unexpanded\def\defineresetset     {\dotripleempty\strc_sets_define_reset_set}
\unexpanded\def\defineseparatorset {\dotripleempty\strc_sets_define_separator_set}
\unexpanded\def\defineconversionset{\dotripleempty\strc_sets_define_conversion_set}
\unexpanded\def\defineprefixset    {\dotripleempty\strc_sets_define_prefix_set}

% Low level versions (no optional checking). The detokenize might go away.

\unexpanded\def\strc_sets_define_reset_set     [#name][#set][#default]{\clf_definestructureset{structure:resets}     {#name}{\detokenize{#set}}{\detokenize{#default}}true\relax}
\unexpanded\def\strc_sets_define_separator_set [#name][#set][#default]{\clf_definestructureset{structure:separators} {#name}{\detokenize{#set}}{\detokenize{#default}}false\relax}
\unexpanded\def\strc_sets_define_conversion_set[#name][#set][#default]{\clf_definestructureset{structure:conversions}{#name}{\detokenize{#set}}{\detokenize{#default}}false\relax}
\unexpanded\def\strc_sets_define_prefix_set    [#name][#set][#default]{\clf_definestructureset{structure:prefixes}   {#name}{\detokenize{#set}}{\detokenize{#default}}false\relax}

\let\definestructureresetset     \defineresetset
\let\definestructureseparatorset \defineseparatorset
\let\definestructureconversionset\defineconversionset
\let\definestructureprefixset    \defineprefixset

% \defineseparatorset [weird][!,?,*][:]                                  % tex content
% \defineconversionset[weird][numbers,characters,romannumerals][numbers] % symbolic names
% \defineresetset     [weird][0,0,1][0]                                  % numbers

\protect \endinput
