summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-03-29 22:00:00 +0200
committerHans Hagen <pragma@wxs.nl>2012-03-29 22:00:00 +0200
commit96230d16cbb4bc8a2c411de70c0d3cd9c6292492 (patch)
treef57449a0187c6f5696e3959614fd7611d717d6db
parenta3066c2438db5837bbd5ba418113b03b68db22f7 (diff)
downloadcontext-96230d16cbb4bc8a2c411de70c0d3cd9c6292492.tar.gz
beta 2012.03.29 22:00
-rw-r--r--tex/context/base/anch-snc.mkiv20
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4069 -> 4069 bytes
-rw-r--r--tex/context/base/context-version.pngbin104628 -> 105619 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/scrn-bar.mkvi6
-rw-r--r--tex/context/base/status-files.pdfbin24334 -> 24326 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin172429 -> 172420 bytes
-rw-r--r--tex/context/base/strc-def.mkiv2
-rw-r--r--tex/context/base/strc-doc.mkiv8
-rw-r--r--tex/context/base/strc-enu.mkvi9
-rw-r--r--tex/context/base/strc-flt.mkvi20
-rw-r--r--tex/context/base/strc-itm.mkvi34
-rw-r--r--tex/context/base/strc-lab.mkiv2
-rw-r--r--tex/context/base/strc-lnt.mkvi10
-rw-r--r--tex/context/base/strc-mat.mkiv18
-rw-r--r--tex/context/base/strc-not.mkvi8
-rw-r--r--tex/context/base/strc-num.lua97
-rw-r--r--tex/context/base/strc-num.mkiv364
-rw-r--r--tex/context/base/strc-pag.mkiv108
-rw-r--r--tex/context/base/strc-sec.mkiv16
-rw-r--r--tex/context/base/syst-aux.mkiv81
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
25 files changed, 391 insertions, 422 deletions
diff --git a/tex/context/base/anch-snc.mkiv b/tex/context/base/anch-snc.mkiv
index 5f2c17ac9..77ebc3e0e 100644
--- a/tex/context/base/anch-snc.mkiv
+++ b/tex/context/base/anch-snc.mkiv
@@ -24,17 +24,19 @@
\ifx\s!syncpos\undefined \def\s!syncpos{syncpos} \fi
\unexpanded\def\definesyncpositions[#1]%
- {\global\let\flushsyncpositions\doflushsyncpositions % only when used
- \global\let\flushsyncresets \doflushsyncresets
- \global\let\flushsyncpresets \doflushsyncpresets
- \setcounter{\s!num:\s!syncpos:#1}{0}%
- \doglobal\appendtoksonce\csname\s!reset :\s!syncpos:#1\endcsname\to\resetsyncpositions
+ {\ifcsname\s!num:\s!syncpos:#1\endcsname \else
+ \global\let\flushsyncpositions\doflushsyncpositions % only when used
+ \global\let\flushsyncresets \doflushsyncresets
+ \global\let\flushsyncpresets \doflushsyncpresets
+ \expandafter\newcount\csname\s!num:\s!syncpos:#1\endcsname
+ \doglobal\appendtoksonce\csname\s!reset :\s!syncpos:#1\endcsname\to\resetsyncpositions
\doglobal\appendtoksonce\csname\s!preset:\s!syncpos:#1\endcsname\to\presetsyncpositions
% to be tested:
% \doglobal\expandafter\appendtoksonce\csname\s!reset :\s!syncpos:#1\endcsname\to\resetsyncpositions
% \doglobal\expandafter\appendtoksonce\csname\s!preset:\s!syncpos:#1\endcsname\to\presetsyncpositions
- \setgvalue{\s!syncpos:#1}{sync_n[#1] := 0 ;}%
- \setgvalue{\s!set:\s!syncpos:#1}{\dosetsyncpositions{#1}}}
+ \setgvalue{\s!syncpos:#1}{sync_n[#1] := 0 ;}%
+ \setgvalue{\s!set:\s!syncpos:#1}{\dosetsyncpositions{#1}}%
+ \fi}
\def\syncposition
{\dodoubleempty\dosyncposition}
@@ -53,10 +55,10 @@
{\letgvalue{\s!reset:\s!syncpos:#1}\relax
\letgvalue{\s!preset:\s!syncpos:#1}\relax
\ifcsname\s!syncpos:#1\endcsname
- \pluscounter{\s!num:\s!syncpos:#1}%
+ \global\advance\csname\s!num:\s!syncpos:#1\endcsname\plusone
\setsyncpositions{#1}%
% option: geen w/h, alleen p 0 0 0 data
- \setpositionplus{\s!syncpos:#1:\countervalue{\s!num:\s!syncpos:#1}}{#2}\hbox{\strut}%
+ \setpositionplus{\s!syncpos:#1:\the\csname\s!num:\s!syncpos:#1\endcsname}{#2}\hbox{\strut}%
\else
\strut
\fi}
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 2fb697335..19e021c74 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.03.29 13:03}
+\newcontextversion{2012.03.29 22:00}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index e58e7f97e..11a45c874 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.03.29 13:03}
+\newcontextversion{2012.03.29 22:00}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 0144fcc3f..0666489e4 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index b63387590..f78eb0e7a 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index c2de7b2f2..e678549e4 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.03.29 13:03}
+\edef\contextversion{2012.03.29 22:00}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 5ec716827..660ef5826 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -23,7 +23,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.03.29 13:03}
+\edef\contextversion{2012.03.29 22:00}
%D For those who want to use this:
diff --git a/tex/context/base/scrn-bar.mkvi b/tex/context/base/scrn-bar.mkvi
index d2915eb1b..dabc8f77d 100644
--- a/tex/context/base/scrn-bar.mkvi
+++ b/tex/context/base/scrn-bar.mkvi
@@ -280,7 +280,7 @@
\unskip}
\def\scrn_bar_alternative_d
- {\ifnum\nofsubpages>\plusone \doif{\structurecounterparameter\s!subpage\c!state}\v!start{%
+ {\ifnum\nofsubpages>\plusone \doif{\counterparameter\s!subpage\c!state}\v!start{%
\d_scrn_bar_width \interactionbarparameter\c!width
\d_scrn_bar_distance\interactionbarparameter\c!distance
\d_scrn_bar_height \interactionbarparameter\c!height
@@ -290,7 +290,7 @@
}\fi}
\def\scrn_bar_alternative_e
- {\ifnum\nofsubpages>\plusone \doif{\structurecounterparameter\s!subpage\c!state}\v!start{%
+ {\ifnum\nofsubpages>\plusone \doif{\counterparameter\s!subpage\c!state}\v!start{%
\d_scrn_bar_width \interactionbarparameter\c!width
\d_scrn_bar_distance\interactionbarparameter\c!distance
\d_scrn_bar_height \interactionbarparameter\c!height
@@ -305,7 +305,7 @@
}\fi}
\def\scrn_bar_alternative_f
- {\ifnum\nofsubpages>\plusone \doif{\structurecounterparameter\s!subpage\c!state}\v!start{%
+ {\ifnum\nofsubpages>\plusone \doif{\counterparameter\s!subpage\c!state}\v!start{%
\d_scrn_bar_width \interactionbarparameter\c!width
\d_scrn_bar_distance\interactionbarparameter\c!distance
\d_scrn_bar_height \interactionbarparameter\c!height
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 1232d7905..95cb2a282 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 41bbb974d..bd58ddcad 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-def.mkiv b/tex/context/base/strc-def.mkiv
index c60ddfeb7..7917b7d83 100644
--- a/tex/context/base/strc-def.mkiv
+++ b/tex/context/base/strc-def.mkiv
@@ -252,7 +252,7 @@
% brrr
-% \definestructurecounter[\v!page][\c!start=1] % todo: setup
+% \definecounter[\v!page][\c!start=1] % todo: setup
% lists
diff --git a/tex/context/base/strc-doc.mkiv b/tex/context/base/strc-doc.mkiv
index 3811e2ab7..4e9dec32e 100644
--- a/tex/context/base/strc-doc.mkiv
+++ b/tex/context/base/strc-doc.mkiv
@@ -24,8 +24,6 @@
% that accepts multiple arguments. We might change this approach and
% remove this layer but it was needed for the transition.
-\def\currentstructurecounter{0}
-
\installcorenamespace{structure}
\installdirectcommandhandler \??structure {structure} % unchecked, so we need to initialize used parameters
@@ -202,9 +200,9 @@
\structureparameter\c!command
\endgroup}
-\let\currentstructurenumber \!!zerocount
-\let\currentstructurecounter \!!zerocount
-\let\previousstructurecounter\!!zerocount
+\let\currentstructurenumber \!!zerocount
+\let\currentsectioncountervalue \!!zerocount % redefined later
+\let\previoussectioncountervalue\!!zerocount % redefined later
% todo: a direct flusher (needed when hidden)
diff --git a/tex/context/base/strc-enu.mkvi b/tex/context/base/strc-enu.mkvi
index 2ef09517b..e3261fa35 100644
--- a/tex/context/base/strc-enu.mkvi
+++ b/tex/context/base/strc-enu.mkvi
@@ -170,7 +170,7 @@
\ifx\p_counter\empty %
\let\p_counter\currentenumeration
\fi
- \doifstructurecounterelse\p_counter\donothing{\strc_enumerations_define_counter\p_counter}%
+ \doifcounterelse\p_counter\donothing{\strc_enumerations_define_counter\p_counter}%
\letenumerationparameter\s!counter\p_counter
\strc_enumerations_setup_counter\currentenumeration
\to \everydefineenumeration
@@ -229,11 +229,11 @@
\the\everysetupenumerationcounter}
\def\strc_enumerations_define_counter#1% todo: fast inheritance (was mainparameter)
- {\definestructurecounter[#1]%
+ {\definecounter[#1]%
\strc_enumerations_setup_counter{#1}}
\appendtoks
- \dostructurecountersetup\v_strc_enumerations_counter_name\enumerationparameter
+ \strc_counter_setup_using_parameter\v_strc_enumerations_counter_name\enumerationparameter
\to \everysetupenumerationcounter
% \def\currentconstructionnumber {\enumerationparameter\s!counter}
@@ -382,7 +382,4 @@
\def\skipenumerationcoupling[#1]% e.g. for questions with no answer
{\ctxlua{structures.references.setnextorder("construction","#1")}}
- \unexpanded\def\structurecounterreference#1%
- {[enumref: #1]}
-
\protect \endinput
diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi
index 4e7efd755..4e3edcd02 100644
--- a/tex/context/base/strc-flt.mkvi
+++ b/tex/context/base/strc-flt.mkvi
@@ -131,13 +131,13 @@
%D Individial settings:
-\presetstructurecountersetup\setupcaption\sharedstructurecounterparameter
+\strc_counter_preset_using_parameter\setupcaption\sharedcounterparameter
\appendtoks
\let\currentfloat\currentfloatcaption
\ifx\currentfloat\empty \else
- \dostructurecountersetup\currentfloatcaption\floatcaptionparameter
- \docheckstructurecountersetup\currentfloatcaption
+ \strc_counter_setup_using_parameter\currentfloatcaption\floatcaptionparameter
+ \strc_counters_check_setup\currentfloatcaption
\fi
\to \everysetupfloatcaption
@@ -159,7 +159,7 @@
\def\dododefinefloat[#1][#2]%
{\definefloatcaption[#1]%
- \definestructurecounter[#1]%
+ \definecounter[#1]%
\definelist[#1]%
\presetlabeltext[#1=\Word{#1}~]%
\presetheadtext[#2=\Word{#2}]%
@@ -168,7 +168,7 @@
\def\redodefinefloat[#1][#2][#3]%
{\definefloatcaption[#1][#3]%
- \definestructurecounter[#1][#3]%
+ \definecounter[#1][#3]%
\definelist[#1][#3]%
\presetlabeltext[#1=\Word{#3}~]%
\presetheadtext[#2=\Word{#2}]%
@@ -727,7 +727,7 @@
\ifnofloatnumber \else \ifnofloatcaption \else
\strc_counters_increment{\strc_counters_the\currentfloat}%
\fi \fi
- \dostructurecountercomponent
+ \strc_counters_register_component
{float}%
\setupcurrentfloatcaption
\floatcaptionparameter
@@ -741,10 +741,10 @@
\s!hasnumber=\ifnofloatnumber \v!no\else\v!yes\fi,%
\s!hastitle=\ifemptyfloatcaption\v!no\else\v!yes\fi]%
[]%
- \globallet\previousfloatnumber \laststructurecounternumber
- \globallet\currentfloatnumber \laststructurecounternumber
- \globallet\currentfloatattribute \laststructurecounterattribute
- \globallet\currentfloatsynchronize\laststructurecountersynchronize
+ \globallet\previousfloatnumber \m_strc_counters_last_registered_index
+ \globallet\currentfloatnumber \m_strc_counters_last_registered_index
+ \globallet\currentfloatattribute \m_strc_counters_last_registered_attribute
+ \globallet\currentfloatsynchronize\m_strc_counters_last_registered_synchronize
\fi
%
\global\setfalse\usesamefloatnumber % one shot
diff --git a/tex/context/base/strc-itm.mkvi b/tex/context/base/strc-itm.mkvi
index 5f0cdf948..a33b9a965 100644
--- a/tex/context/base/strc-itm.mkvi
+++ b/tex/context/base/strc-itm.mkvi
@@ -235,7 +235,7 @@
\d_strc_itemgroups_max_width\ctxcommand{maxitemwidth("\currentitemgroup",\number\c_strc_itemgroups_n_of_lists)}\scaledpoint
\edef\currentnofitems{\the\c_strc_itemgroups_max_items}}
-% todo: \dodosetreference -> \dostructurecountercomponent (to be checked)
+% todo: \dodosetreference -> \strc_counters_register_component (to be checked)
\def\strc_itemgroups_insert_reference % we will make a decent number helper
{\iftrialtypesetting \else \ifx\currentitemreference \empty \else
@@ -256,27 +256,27 @@
section = structures.sections.currentid(),
},
prefixdata = structures.helpers.simplify {
- prefix = "\structurecounterparameter\v_strc_itemgroups_counter\c!prefix",
- separatorset = "\structurecounterparameter\v_strc_itemgroups_counter\c!prefixseparatorset",
- conversion = \!!bs\structurecounterparameter\v_strc_itemgroups_counter\c!prefixconversion\!!es,
- conversionset = "\structurecounterparameter\v_strc_itemgroups_counter\c!prefixconversionset",
- set = "\structurecounterparameter\v_strc_itemgroups_counter\c!prefixset",
- segments = "\structurecounterparameter\v_strc_itemgroups_counter\c!prefixsegments",
+ prefix = "\counterparameter\v_strc_itemgroups_counter\c!prefix",
+ separatorset = "\counterparameter\v_strc_itemgroups_counter\c!prefixseparatorset",
+ conversion = \!!bs\counterparameter\v_strc_itemgroups_counter\c!prefixconversion\!!es,
+ conversionset = "\counterparameter\v_strc_itemgroups_counter\c!prefixconversionset",
+ set = "\counterparameter\v_strc_itemgroups_counter\c!prefixset",
+ segments = "\counterparameter\v_strc_itemgroups_counter\c!prefixsegments",
% segments = "\askedprefixsegments",
- connector = \!!bs\structurecounterparameter\v_strc_itemgroups_counter\c!prefixconnector\!!es,
+ connector = \!!bs\counterparameter\v_strc_itemgroups_counter\c!prefixconnector\!!es,
},
numberdata = structures.helpers.simplify {
numbers = structures.counters.compact("\v_strc_itemgroups_counter",nil,true),
- separatorset = "\structurecounterparameter\v_strc_itemgroups_counter\c!numberseparatorset",
-% conversion = "\structurecounterparameter\v_strc_itemgroups_counter\c!numberconversion",
+ separatorset = "\counterparameter\v_strc_itemgroups_counter\c!numberseparatorset",
+% conversion = "\counterparameter\v_strc_itemgroups_counter\c!numberconversion",
% conversion = "\currentitemgroupconversionset",
-% conversionset = "\structurecounterparameter\v_strc_itemgroups_counter\c!numberconversionset",
+% conversionset = "\counterparameter\v_strc_itemgroups_counter\c!numberconversionset",
% todo: fixedconversion = "\currentitemgroupconversionset", % temp hack:
conversionset = "fixed::\currentitemgroupconversionset",
%
% for the moment no stopper, we need to make references configurable first
- % stopper = \!!bs\structurecounterparameter\v_strc_itemgroups_counter\c!numberstopper\!!es,
- segments = "\structurecounterparameter\v_strc_itemgroups_counter\c!numbersegments",
+ % stopper = \!!bs\counterparameter\v_strc_itemgroups_counter\c!numberstopper\!!es,
+ segments = "\counterparameter\v_strc_itemgroups_counter\c!numbersegments",
},
})
}%
@@ -309,7 +309,7 @@ conversionset = "fixed::\currentitemgroupconversionset",
\setuevalue{\e!stop \currentitemgroup}{\stopitemgroup}%
\setuevalue{\e!setup\currentitemgroup\e!endsetup}{\setupitemgroup[\currentitemgroup]}% obsolete
\let\currentparentitemgroup\currentitemgroup
- \definestructurecounter[\v_strc_itemgroups_counter]%
+ \definecounter[\v_strc_itemgroups_counter]%
% beware ... we cannot use _ as the conversion set is not expanded
% \defineconversionset[\v_strc_itemgroups_counter][\currentitemgroupconversionset][\currentitemgroupsymbol]%
\to \everydefineitemgroup
@@ -597,8 +597,8 @@ conversionset = "fixed::\currentitemgroupconversionset",
\def\strc_itemgroups_insert_item_counter_indeed
{\begingroup
- \setupstructurecounter
- [\v_strc_itemgroups_counter]
+ \strc_counters_setup
+ [\v_strc_itemgroups_counter]%
[%\c!prefix=\v!no,
\c!prefix=\itemgroupparameter\c!prefix,
\c!prefixstopper=\itemgroupparameter\c!prefixstopper,
@@ -619,7 +619,7 @@ conversionset = "fixed::\currentitemgroupconversionset",
%\normalexpanded{\defineconversionset[\v_strc_itemgroups_counter][\currentitemgroupconversionset][\currentitemgroupsymbol]}%
\normalexpanded{\strc_sets_define_conversion_set[\v_strc_itemgroups_counter][\currentitemgroupconversionset][\currentitemgroupsymbol]}%
%
- \convertedstructurecounter[\v_strc_itemgroups_counter]% [\number\currentitemlevel]%
+ \convertedcounter[\v_strc_itemgroups_counter]% [\number\currentitemlevel]%
\strc_itemgroups_insert_reference
\endgroup}
diff --git a/tex/context/base/strc-lab.mkiv b/tex/context/base/strc-lab.mkiv
index 447184fc0..483791462 100644
--- a/tex/context/base/strc-lab.mkiv
+++ b/tex/context/base/strc-lab.mkiv
@@ -74,7 +74,7 @@
{\dontleavehmode
\writestatus{!!!}{todo: reference of label}%
\dotextprefix{\descriptionparameter\c!text}%
- \convertedsubstructurecounter[\currentdescriptionnumber][\currentdescriptionlevel]}
+ \convertedsubcounter[\currentdescriptionnumber][\currentdescriptionlevel]}
\def\dodonextlabelnumber[#1]% todo: ref
{\strc_counters_increment_sub\currentdescriptionnumber\currentdescriptionlevel
diff --git a/tex/context/base/strc-lnt.mkvi b/tex/context/base/strc-lnt.mkvi
index 88d70264c..f07ce7839 100644
--- a/tex/context/base/strc-lnt.mkvi
+++ b/tex/context/base/strc-lnt.mkvi
@@ -52,9 +52,13 @@
{\begingroup
% we keep things local so we can use it as regular note too
\unexpanded\def\linenotelinenumber##1{\inlinerange[#2]}% ##1 == order
- \setupnotation[#1][\c!numbercommand=\linenotelinenumber]% todo: deep hook
- \setupnote[#1][\c!textcommand=\gobbleoneargument]% todo: deep hook
- \getvalue{\??linenote#1}{#3}%
+% \setupnotation[#1][\c!numbercommand=\linenotelinenumber]% todo: deep hook
+% \setupnote[#1][\c!textcommand=\gobbleoneargument]% todo: deep hook
+ \edef\currentnotation{#1}%
+ \let\currentnote\currentnotation
+ \letnotationparameter\c!numbercommand\linenotelinenumber% todo: deep hook
+ \letnoteparameter \c!textcommand \gobbleoneargument % todo: deep hook
+ \relax\getvalue{\??linenote#1}{#3}%
\endgroup}
\let\strc_linenotes_traced\gobbleoneargument
diff --git a/tex/context/base/strc-mat.mkiv b/tex/context/base/strc-mat.mkiv
index 276dd8d59..121808cd1 100644
--- a/tex/context/base/strc-mat.mkiv
+++ b/tex/context/base/strc-mat.mkiv
@@ -49,18 +49,18 @@
\setupsubformulas % subformulas could be last in chain
[\c!indentnext=\formulaparameter\c!indentnext]
-\definestructurecounter
+\definecounter
[\v!formula]
\defineconversionset
[\v!formula]
[numbers,characters]
-\presetstructurecountersetup\setupformulas\sharedstructurecounterparameter
+\strc_counter_preset_using_parameter\setupformulas\sharedcounterparameter
\appendtoks
- \dostructurecountersetup\v!formula\formulaparameter
- \docheckstructurecountersetup\v!formula % yes or no
+ \strc_counter_setup_using_parameter\v!formula\formulaparameter
+ \strc_counters_check_setup\v!formula % yes or no
\to \everysetupformula
\setupformulas
@@ -128,7 +128,7 @@
\def\storecurrentformulanumber#1#2#3#4#5% ref, todo:str, \sync % todo: title etc (like float)
{\settrue\handleformulanumber
- \dostructurecountercomponent
+ \strc_counters_register_component
{formula}%
\setupcurrentformula \formulaparameter \detokenizedformulaparameter
\relax \relax \relax
@@ -137,9 +137,9 @@
\c!reference=#1,\c!title=\namedformulaentry,\c!bookmark=]%
[#2]%
\glet\namedformulaentry\empty % \relax
- \globallet#3\laststructurecounternumber
- \globallet#4\laststructurecountersynchronize
- \globallet#5\laststructurecounterattribute}
+ \globallet#3\m_strc_counters_last_registered_index
+ \globallet#4\m_strc_counters_last_registered_synchronize
+ \globallet#5\m_strc_counters_last_registered_attribute}
% modes: 0=unset, 1=forced, 2=none, 3=reference
@@ -222,7 +222,7 @@
\def\doplacecurrentformulanumber
{\dohandlecurrentformulareferences
- \labeltexts\currentformula{\convertedstructurecounter[\v!formula][]}}
+ \labeltexts\currentformula{\convertedcounter[\v!formula][]}}
% \def\theboxdestinationattribute#1{\iflocation\ifx#1\relax\else\ifx#1\empty\else attr \destinationattribute#1\fi\fi\fi}
% \def\thedestinationattribute #1{\iflocation\ifx#1\relax\else\ifx#1\empty\else \attribute\destinationattribute#1\fi\fi\fi}
diff --git a/tex/context/base/strc-not.mkvi b/tex/context/base/strc-not.mkvi
index f1b502cb5..4c16afb91 100644
--- a/tex/context/base/strc-not.mkvi
+++ b/tex/context/base/strc-not.mkvi
@@ -179,10 +179,10 @@
\ifx\p_counter\empty %
\let\p_counter\currentnotation
\fi
-% \doifstructurecounterelse\p_counter\donothing{\strc_enumerations_define_counter\p_counter}%
+% \doifcounterelse\p_counter\donothing{\strc_enumerations_define_counter\p_counter}%
% \letnotationparameter\s!counter\p_counter
% \strc_enumerations_setup_counter\currentnotation
- \doifstructurecounterelse\p_counter\donothing{\strc_notes_define_counter\p_counter}%
+ \doifcounterelse\p_counter\donothing{\strc_notes_define_counter\p_counter}%
\letnotationparameter\s!counter\p_counter
\strc_notes_setup_counter\currentnotation
\to \everydefinenotation
@@ -392,11 +392,11 @@
\the\everysetupnotecounter}
\def\strc_notes_define_counter#1% todo: fast inheritance (was mainparameter
- {\definestructurecounter[#1]%
+ {\definecounter[#1]%
\strc_notes_setup_counter{#1}}
\appendtoks
- \dostructurecountersetup\v_strc_note_counter_name\notationparameter
+ \strc_counter_setup_using_parameter\v_strc_note_counter_name\notationparameter
\to \everysetupnotecounter
\appendtoks
diff --git a/tex/context/base/strc-num.lua b/tex/context/base/strc-num.lua
index 3b18ae1d5..b74864600 100644
--- a/tex/context/base/strc-num.lua
+++ b/tex/context/base/strc-num.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['strc-num'] = {
license = "see context related readme files"
}
--- this will be reimplemented
+-- this will be reimplemented and some more will move to the commands namespace
local format = string.format
local next, type = next, type
@@ -196,19 +196,6 @@ function counters.define(specification)
end
end
-function counters.show(name)
- local cd = counterdata[name]
- if cd then
- context("[%s:",name)
- local data = cd.data
- for i=1,#data do
- local d = data[i]
- context(" (%s: %s,%s,%s s:%s r:%s)",i,(d.start or 0),d.number or 0,d.last,d.step or 0,d.range or 0)
- end
- context("]")
- end
-end
-
function counters.raw(name)
return counterdata[name]
end
@@ -234,29 +221,29 @@ end
-- depends on when incremented, before or after (driven by d.offset)
function counters.previous(name,n)
- context(allocate(name,n).previous)
+ return allocate(name,n).previous
end
function counters.next(name,n)
- context(allocate(name,n).next)
+ return allocate(name,n).next
end
counters.prev = counters.previous
-function counters.current(name,n)
- context(allocate(name,n).number)
+function counters.currentvalue(name,n)
+ return allocate(name,n).number
end
function counters.first(name,n)
- context(allocate(name,n).first)
+ return allocate(name,n).first
end
function counters.last(name,n)
- context(allocate(name,n).last)
+ return allocate(name,n).last
end
function counters.subs(name,n)
- context(counterdata[name].data[n].subs or 0)
+ return counterdata[name].data[n].subs or 0
end
function counters.setvalue(name,tag,value)
@@ -356,8 +343,12 @@ function counters.restart(name,n,newstart)
newstart = tonumber(newstart)
if newstart then
local d = allocate(name,n)
+if d.start == newstart then
+ -- nothing, else we do it too often in a synchronize
+else
d.start = newstart
counters.reset(name,n)
+end
end
end
end
@@ -378,7 +369,7 @@ end
function counters.add(name,n,delta)
local cd = counterdata[name]
---~ table.print(cd,name)
+-- inspect(cd)
if cd and (cd.state == variables.start or cd.state == "") then
local data = cd.data
local d = allocate(name,n)
@@ -428,7 +419,7 @@ function counters.get(name,n,key)
end
function counters.value(name,n) -- what to do with own
- context(counters.get(name,n or 1,'number') or 0)
+ return counters.get(name,n or 1,'number') or 0
end
function counters.converted(name,spec) -- name can be number and reference to storage
@@ -485,29 +476,43 @@ end
-- interfacing
-commands.definestructurecounter = counters.define
-commands.setstructurecounter = counters.set
-commands.setownstructurecounter = counters.setown
-commands.resetstructurecounter = counters.reset
-commands.restartstructurecounter = counters.restart
-commands.savestructurecounter = counters.save
-commands.restorestructurecounter = counters.restore
-commands.addstructurecounter = counters.add
-commands.structurecountervalue = counters.value
-commands.laststructurecounter = counters.last
-commands.firststructurecounter = counters.first
-commands.nextstructurecounter = counters.next
-commands.prevstructurecounter = counters.prev
-commands.structurecountersubs = counters.subs
-commands.showstructurecounter = counters.show
-
-function commands.doifelsestructurecounter(name) commands.doifelse(counterdata[name]) end
-function commands.doifstructurecounter (name) commands.doif (counterdata[name]) end
-function commands.doifnotstructurecounter (name) commands.doifnot (counterdata[name]) end
-
-function commands.incrementedstructurecounter(...) context(counters.add(...)) end
-
-function commands.checkstructurecountersetup(name,level,start,state)
+commands.definecounter = counters.define
+commands.setcounter = counters.set
+commands.setowncounter = counters.setown
+commands.resetcounter = counters.reset
+commands.restartcounter = counters.restart
+commands.savecounter = counters.save
+commands.restorecounter = counters.restore
+commands.addcounter = counters.add
+
+commands.rawcountervalue = function(...) context(counters.raw (...)) end
+commands.countervalue = function(...) context(counters.value (...)) end
+commands.lastcountervalue = function(...) context(counters.last (...)) end
+commands.firstcountervalue = function(...) context(counters.first (...)) end
+commands.nextcountervalue = function(...) context(counters.next (...)) end
+commands.prevcountervalue = function(...) context(counters.previous(...)) end
+commands.subcountervalues = function(...) context(counters.subs (...)) end
+
+function commands.showcounter(name)
+ local cd = counterdata[name]
+ if cd then
+ context("[%s:",name)
+ local data = cd.data
+ for i=1,#data do
+ local d = data[i]
+ context(" (%s: %s,%s,%s s:%s r:%s)",i,(d.start or 0),d.number or 0,d.last,d.step or 0,d.range or 0)
+ end
+ context("]")
+ end
+end
+
+function commands.doifelsecounter(name) commands.doifelse(counterdata[name]) end
+function commands.doifcounter (name) commands.doif (counterdata[name]) end
+function commands.doifnotcounter (name) commands.doifnot (counterdata[name]) end
+
+function commands.incrementedcounter(...) context(counters.add(...)) end
+
+function commands.checkcountersetup(name,level,start,state)
counters.restart(name,1,start)
counters.setstate(name,state)
counters.setlevel(name,level)
diff --git a/tex/context/base/strc-num.mkiv b/tex/context/base/strc-num.mkiv
index 5de5a7565..34426d589 100644
--- a/tex/context/base/strc-num.mkiv
+++ b/tex/context/base/strc-num.mkiv
@@ -22,22 +22,19 @@
\installcorenamespace{counter}
-\unexpanded\def\setupstructurecountering{\dodoubleempty\getparameters[\??counter]}
+\unexpanded\def\setupstructurecounting{\dodoubleempty\getparameters[\??counter]}
-\setupstructurecountering
+\setupstructurecounting
[\c!way=\v!by\v!chapter,
% \c!blockway=,
% \c!prefixstarter=,
% \c!prefixstopper=,
\c!prefixconnector=.,
- \c!prefixsegments=\thenamedstructurecounterlevel\currentstructurecounter,
+ \c!prefixsegments=\autostructureprefixsegments\sharedcounterparameter,
\c!start=0,
\c!prefix=\v!yes,
\c!state=\v!start]
-\setupstructurecountering
- [\c!prefixsegments=\autostructureprefixsegments\sharedstructurecounterparameter]
-
\def\strc_counters_the#1% we need a nicer name
{\ifcsname\??counter#1\c!number\endcsname
\expandafter\strc_counters_the\csname\??counter#1\c!number\endcsname
@@ -48,7 +45,7 @@
\def\autostructureprefixsegments#1% todo: \c!prefixsegments=\v!auto
{2:\thenamedheadlevel{\ctxlua{structures.sections.way("#1\c!way")}}}
-\def\structurecounterparameter#1#2% this will become \named....
+\def\counterparameter#1#2% this will become \named....
{\csname
\ifcsname\??counter#1#2\endcsname
\??counter#1#2%
@@ -61,7 +58,7 @@
\fi\fi\fi
\endcsname}
-\def\sharedstructurecounterparameter#1%
+\def\sharedcounterparameter#1%
{\csname
\ifcsname\??counter#1\endcsname
\??counter#1%
@@ -70,53 +67,47 @@
\fi
\endcsname}
-\let\numberingparameter\sharedstructurecounterparameter
-
-% \def\structurecounterparameter #1#2{\csname\dostructurecounterparameter{\??counter#1}#2\endcsname}
-% \def\dostructurecounterparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\dostructurecounterparentparameter\csname#1\s!number\endcsname#2\fi}
-% \def\dostructurecounterparentparameter#1#2{\ifx#1\relax\s!empty\else\dostructurecounterparameter#1#2\fi}
-
-\unexpanded\def\definestructurecounter
- {\dodoubleempty\dodefinestructurecounter}
+\unexpanded\def\definecounter
+ {\dodoubleempty\strc_counters_define}
-\def\dodefinestructurecounter[#1][#2]%
+\def\strc_counters_define[#1][#2]%
{\doifassignmentelse{#2}
- {\dododefinestructurecounter[#1][#2]}
+ {\strc_counters_define_yes[#1][#2]}
{\doifelsenothing{#2}
- {\dododefinestructurecounter[#1][]}
- {\donodefinestructurecounter[#1][#2]}}}
+ {\strc_counters_define_yes[#1][]}
+ {\strc_counters_define_nop[#1][#2]}}}
-\def\dododefinestructurecounter[#1][#2]%
+\def\strc_counters_define_yes[#1][#2]%
{\getparameters[\??counter#1][\s!counter=,#2]% counter is for internal purposes
- \ctxcommand{definestructurecounter {
+ \ctxcommand{definecounter {
name = "#1",
- start = tonumber("\structurecounterparameter{#1}\c!start") or 0,
- counter = "\structurecounterparameter{#1}\s!counter",
- method = "\structurecounterparameter{#1}\c!method",
+ start = tonumber("\counterparameter{#1}\c!start") or 0,
+ counter = "\counterparameter{#1}\s!counter",
+ method = "\counterparameter{#1}\c!method",
}}%
- \docheckstructurecountersetup{#1}}
+ \strc_counters_check_setup{#1}}
-\def\donodefinestructurecounter[#1][#2]% inherit
+\def\strc_counters_define_nop[#1][#2]% inherit
{\getparameters[\??counter#1][\c!number=#2]%
- \docheckstructurecountersetup{#1}}
+ \strc_counters_check_setup{#1}}
-\unexpanded\def\setupstructurecounter
- {\dodoubleargument\dosetupstructurecounter}
+\unexpanded\def\setupcounter
+ {\dodoubleargument\strc_counters_setup}
-\def\dosetupstructurecounter[#1][#2]%
+\def\strc_counters_setup[#1][#2]%
{\getparameters[\??counter#1][\c!start=,#2]%
- \docheckstructurecountersetup{#1}}
+ \strc_counters_check_setup{#1}}
% % % %
-\def\structurecounterway#1% slow, we need to store it at the tex end
- {\ctxlua{structures.sections.way("\structurecounterparameter{#1}\c!way")}}
+\def\strc_counters_way#1% slow, we need to store it at the tex end
+ {\ctxlua{structures.sections.way("\counterparameter{#1}\c!way")}}
-% \def\thenamedstructurecounterlevel#1%
-% {\thenamedheadlevel{\structurecounterway{#1}}}
+% \def\thenamedcounterlevel#1%
+% {\thenamedheadlevel{\strc_counters_way{#1}}}
-\def\thenamedstructurecounterlevel#1%
- {\xthenamedheadlevel{\structurecounterway{#1}}}
+\def\thenamedcounterlevel#1%
+ {\xthenamedheadlevel{\strc_counters_way{#1}}}
\def\xthenamedheadlevel#1%
{\xsectionlevel{#1}{\sectionheadsection{\sectionheadcoupling{#1}}}}
@@ -132,7 +123,7 @@
\fi\fi
\endcsname}
-\def\docheckstructurecountersetup#1% does it have to happen here?
+\def\strc_counters_check_setup#1% does it have to happen here?
{% this can be done at the lua end / a bit messy here ... todo ...
\ifcsname\??counter#1\c!number\endcsname
\doifelsevalue {\??counter#1\c!number}{#1} {\letbeundefined{\??counter#1\c!number}}%
@@ -141,37 +132,30 @@
\ifcsname\??counter#1\c!number\endcsname
% it's a clone
\else
- \edef\currentstructurecounterlevel{\thenamedstructurecounterlevel{#1}}%
-% \ctxlua{% will be a command (depends on sections)
-% structures.counters.restart("#1",1,"\structurecounterparameter{#1}\c!start")
-% structures.counters.setstate("#1","\structurecounterparameter{#1}\c!state")
-% structures.counters.setlevel("#1",\currentstructurecounterlevel)
-% structures.sections.setchecker("#1",\currentstructurecounterlevel,structures.counters.reset)
-% }%
- \ctxcommand{checkstructurecountersetup("#1",\currentstructurecounterlevel,
- "\structurecounterparameter{#1}\c!start","\structurecounterparameter{#1}\c!state")}%
+ \edef\currentcounterlevel{\thenamedcounterlevel{#1}}%
+ \ctxcommand{checkcountersetup("#1",\currentcounterlevel,"\counterparameter{#1}\c!start","\counterparameter{#1}\c!state")}%
\fi}
-\unexpanded\def\doifstructurecounterelse#1{\ctxcommand{doifelsestructurecounter("\strc_counters_the{#1}")}}
-\unexpanded\def\doifstructurecounter #1{\ctxcommand{doifstructurecounter ("\strc_counters_the{#1}")}}
-\unexpanded\def\doifnotstructurecounter #1{\ctxcommand{doifnotstructurecounter ("\strc_counters_the{#1}")}}
+\unexpanded\def\doifcounterelse #1{\ctxcommand{doifelsecounter("\strc_counters_the{#1}")}}
+\unexpanded\def\doifcounter #1{\ctxcommand{doifcounter ("\strc_counters_the{#1}")}}
+\unexpanded\def\doifnotcounter #1{\ctxcommand{doifnotcounter ("\strc_counters_the{#1}")}}
-\unexpanded\def\setstructurecounter {\dotripleempty \strc_counters_set_interfaced}
-\unexpanded\def\setstructurecounterown {\dotripleempty \strc_counters_setown_interfaced}
-\unexpanded\def\restartstructurecounter {\dotripleempty \strc_counters_restart_interfaced}
-\unexpanded\def\resetstructurecounter {\dodoubleempty \strc_counters_reset_interfaced}
-\unexpanded\def\incrementstructurecounter{\dodoubleempty \strc_counters_increment_interfaced}
-\unexpanded\def\decrementstructurecounter{\dodoubleempty \strc_counters_decrement_interfaced}
+\unexpanded\def\setcounter {\dotripleempty \strc_counters_set_interfaced}
+\unexpanded\def\setcounterown {\dotripleempty \strc_counters_setown_interfaced}
+\unexpanded\def\restartcounter {\dotripleempty \strc_counters_restart_interfaced}
+\unexpanded\def\resetcounter {\dodoubleempty \strc_counters_reset_interfaced}
+\unexpanded\def\incrementcounter {\dodoubleempty \strc_counters_increment_interfaced}
+\unexpanded\def\decrementcounter {\dodoubleempty \strc_counters_decrement_interfaced}
-\unexpanded\def\rawstructurecounter {\dodoubleargument\strc_counters_raw_interfaced}
-\unexpanded\def\laststructurecounter {\dodoubleargument\strc_counters_last_interfaced}
-\unexpanded\def\firststructurecounter {\dodoubleargument\strc_counters_first_interfaced}
-\unexpanded\def\nextstructurecounter {\dodoubleargument\strc_counters_next_interfaced}
-\unexpanded\def\prevstructurecounter {\dodoubleargument\strc_counters_prev_interfaced}
-\unexpanded\def\structurecountersubs {\dodoubleargument\strc_counters_subs_interfaced}
+\unexpanded\def\rawcounter {\dodoubleargument\strc_counters_raw_interfaced}
+\unexpanded\def\lastcounter {\dodoubleargument\strc_counters_last_interfaced}
+\unexpanded\def\firstcounter {\dodoubleargument\strc_counters_first_interfaced}
+\unexpanded\def\nextcounter {\dodoubleargument\strc_counters_next_interfaced}
+\unexpanded\def\prevcounter {\dodoubleargument\strc_counters_prev_interfaced}
+\unexpanded\def\countersubs {\dodoubleargument\strc_counters_subs_interfaced}
-\unexpanded\def\savestructurecounter {\dodoubleempty\strc_counters_save_interfaced}
-\unexpanded\def\restorestructurecounter {\dodoubleempty\strc_counters_restore_interfaced}
+\unexpanded\def\savecounter {\dodoubleempty \strc_counters_save_interfaced}
+\unexpanded\def\restorecounter {\dodoubleempty \strc_counters_restore_interfaced}
\def\strc_counters_set_interfaced
{\ifthirdargument
@@ -340,61 +324,61 @@
\def\strc_counters_prev #1{\strc_counters_prev_sub {#1}\plusone}
\def\strc_counters_subs #1{\strc_counters_subs_sub {#1}\plusone}
-\unexpanded\def\strc_counters_set_sub #1#2#3{\ctxcommand{setstructurecounter ("\strc_counters_the{#1}",\number#2,\number#3)}}
-\unexpanded\def\strc_counters_setown_sub #1#2#3{\ctxcommand{setownstructurecounter ("\strc_counters_the{#1}",\number#2,"#3")}}
-\unexpanded\def\strc_counters_restart_sub #1#2#3{\ctxcommand{restartstructurecounter("\strc_counters_the{#1}",\number#2,\number#3)}}
-\unexpanded\def\strc_counters_reset_sub #1#2{\ctxcommand{resetstructurecounter ("\strc_counters_the{#1}",\number#2)}}
-\unexpanded\def\strc_counters_increment_sub #1#2{\ctxcommand{addstructurecounter ("\strc_counters_the{#1}",\number#2,1)}}
-\unexpanded\def\strc_counters_decrement_sub #1#2{\ctxcommand{addstructurecounter ("\strc_counters_the{#1}",\number#2,-1)}}
+\unexpanded\def\strc_counters_set_sub #1#2#3{\ctxcommand{setcounter ("\strc_counters_the{#1}",\number#2,\number#3)}}
+\unexpanded\def\strc_counters_setown_sub #1#2#3{\ctxcommand{setowncounter ("\strc_counters_the{#1}",\number#2,"#3")}}
+\unexpanded\def\strc_counters_restart_sub #1#2#3{\ctxcommand{restartcounter("\strc_counters_the{#1}",\number#2,\number#3)}}
+\unexpanded\def\strc_counters_reset_sub #1#2{\ctxcommand{resetcounter ("\strc_counters_the{#1}",\number#2)}}
+\unexpanded\def\strc_counters_increment_sub #1#2{\ctxcommand{addcounter ("\strc_counters_the{#1}",\number#2,1)}}
+\unexpanded\def\strc_counters_decrement_sub #1#2{\ctxcommand{addcounter ("\strc_counters_the{#1}",\number#2,-1)}}
- \def\strc_counters_raw_sub #1#2{\ctxcommand{structurecountervalue("\strc_counters_the{#1}",\number#2)}}
- \def\strc_counters_last_sub #1#2{\ctxcommand{laststructurecounter ("\strc_counters_the{#1}",\number#2)}}
- \def\strc_counters_first_sub #1#2{\ctxcommand{firststructurecounter("\strc_counters_the{#1}",\number#2)}}
- \def\strc_counters_next_sub #1#2{\ctxcommand{nextstructurecounter ("\strc_counters_the{#1}",\number#2)}}
- \def\strc_counters_prev_sub #1#2{\ctxcommand{prevstructurecounter ("\strc_counters_the{#1}",\number#2)}}
- \def\strc_counters_subs_sub #1#2{\ctxcommand{structurecounterssub ("\strc_counters_the{#1}",\number#2)}}
+ \def\strc_counters_raw_sub #1#2{\ctxcommand{countervalue ("\strc_counters_the{#1}",\number#2)}} % maybe raw
+ \def\strc_counters_last_sub #1#2{\ctxcommand{lastcountervalue ("\strc_counters_the{#1}",\number#2)}}
+ \def\strc_counters_first_sub #1#2{\ctxcommand{firstcountervalue ("\strc_counters_the{#1}",\number#2)}}
+ \def\strc_counters_next_sub #1#2{\ctxcommand{nextcountervalue ("\strc_counters_the{#1}",\number#2)}}
+ \def\strc_counters_prev_sub #1#2{\ctxcommand{previouscountervalue("\strc_counters_the{#1}",\number#2)}}
+ \def\strc_counters_subs_sub #1#2{\ctxcommand{subcountervalues ("\strc_counters_the{#1}",\number#2)}}
-\unexpanded\def\strc_counters_save #1{\ctxcommand{savestructurecounter ("\strc_counters_the{#1}")}}
-\unexpanded\def\strc_counters_restore #1{\ctxcommand{restorestructurecounter("\strc_counters_the{#1}")}}
+\unexpanded\def\strc_counters_save #1{\ctxcommand{savecounter ("\strc_counters_the{#1}")}}
+\unexpanded\def\strc_counters_restore #1{\ctxcommand{restorecounter("\strc_counters_the{#1}")}}
-\unexpanded\def\strc_counters_incremented #1{\ctxcommand{incrementedstructurecounter("\strc_counters_the{#1}",1, 1)}}
-\unexpanded\def\strc_counters_decremented #1{\ctxcommand{incrementedstructurecounter("\strc_counters_the{#1}",1,-1)}}
+\unexpanded\def\strc_counters_incremented #1{\ctxcommand{incrementedcounter("\strc_counters_the{#1}",1, 1)}}
+\unexpanded\def\strc_counters_decremented #1{\ctxcommand{incrementedcounter("\strc_counters_the{#1}",1,-1)}}
-\unexpanded\def\showstructurecounter [#1]{\ctxcommand{tracestructurecounter("\strc_counters_the{#1}")}}
+\unexpanded\def\showcounter [#1]{\ctxcommand{tracecounter("\strc_counters_the{#1}")}}
-\unexpanded\def\incrementedstructurecounter [#1]{\strc_counters_incremented{#1}} % expandable, no \dosingleargument
-\unexpanded\def\decrementedstructurecounter [#1]{\strc_counters_decremented{#1}} % expandable, no \dosingleargument
+\unexpanded\def\incrementedcounter [#1]{\strc_counters_incremented{#1}} % expandable, no \dosingleargument
+\unexpanded\def\decrementedcounter [#1]{\strc_counters_decremented{#1}} % expandable, no \dosingleargument
% public variants ... beware, for old cases, from now on the value variants are the
% ones that are expandable
-\def\rawstructurecountervalue [#1]{\strc_counters_raw_sub {#1}\plusone}
-\def\laststructurecountervalue [#1]{\strc_counters_last_sub {#1}\plusone}
-\def\firststructurecountervalue[#1]{\strc_counters_first_sub{#1}\plusone}
-\def\nextstructurecountervalue [#1]{\strc_counters_next_sub {#1}\plusone}
-\def\prevstructurecountervalue [#1]{\strc_counters_prev_sub {#1}\plusone}
+\def\rawcountervalue [#1]{\strc_counters_raw_sub {#1}\plusone}
+\def\lastcountervalue [#1]{\strc_counters_last_sub {#1}\plusone}
+\def\firstcountervalue[#1]{\strc_counters_first_sub{#1}\plusone}
+\def\nextcountervalue [#1]{\strc_counters_next_sub {#1}\plusone}
+\def\prevcountervalue [#1]{\strc_counters_prev_sub {#1}\plusone}
-\let\rawsubstructurecountervalue \strc_counters_raw_two
-\let\lastsubstructurecountervalue \strc_counters_last_two
-\let\firstsubstructurecountervalue\strc_counters_first_two
-\let\nextsubstructurecountervalue \strc_counters_next_two
-\let\prevsubstructurecountervalue \strc_counters_prev_two
+\let\rawsubcountervalue \strc_counters_raw_two
+\let\lastsubcountervalue \strc_counters_last_two
+\let\firstsubcountervalue\strc_counters_first_two
+\let\nextsubcountervalue \strc_counters_next_two
+\let\prevsubcountervalue \strc_counters_prev_two
% The bypage check needs a multipass reference and therefore we only check for it when we increment
% and know that some content will be placed. We could also check for spreads.
\unexpanded\def\strc_counters_increment_sub#1#2%
{% this will be combined into one lua call
- \edef\m_strc_counters_way{\structurecounterway{#1}}%
+ \edef\m_strc_counters_way{\strc_counters_way{#1}}%
\ifx\m_strc_counters_way\v!page
\checkpagechange{#1}%
\ifpagechanged
\strc_counters_reset{#1}%
\fi
\fi
- \ctxcommand{addstructurecounter("\strc_counters_the{#1}",\number#2,1)}}
+ \ctxcommand{addcounter("\strc_counters_the{#1}",\number#2,1)}}
-\unexpanded\def\convertedstructurecounter
+\unexpanded\def\convertedcounter
{\dodoubleempty\strc_counters_converted}
\def\strc_counters_converted[#1][#2]%
@@ -403,57 +387,57 @@
\ctxlua{structures.sections.prefixedconverted(
"\strc_counters_the{#1}",
{
- prefix = "\structurecounterparameter{#1}\c!prefix",
- separatorset = "\structurecounterparameter{#1}\c!prefixseparatorset",
- conversion = "\structurecounterparameter{#1}\c!prefixconversion",
- conversionset = "\structurecounterparameter{#1}\c!prefixconversionset",
- starter = \!!bs\structurecounterparameter{#1}\c!prefixstarter\!!es,
- stopper = \!!bs\structurecounterparameter{#1}\c!prefixstopper\!!es,
- set = "\structurecounterparameter{#1}\c!prefixset",
- segments = "\structurecounterparameter{#1}\c!prefixsegments",
- connector = \!!bs\structurecounterparameter{#1}\c!prefixconnector\!!es,
+ prefix = "\counterparameter{#1}\c!prefix",
+ separatorset = "\counterparameter{#1}\c!prefixseparatorset",
+ conversion = "\counterparameter{#1}\c!prefixconversion",
+ conversionset = "\counterparameter{#1}\c!prefixconversionset",
+ starter = \!!bs\counterparameter{#1}\c!prefixstarter\!!es,
+ stopper = \!!bs\counterparameter{#1}\c!prefixstopper\!!es,
+ set = "\counterparameter{#1}\c!prefixset",
+ segments = "\counterparameter{#1}\c!prefixsegments",
+ connector = \!!bs\counterparameter{#1}\c!prefixconnector\!!es,
},
{
- order = "\structurecounterparameter{#1}\c!numberorder",
- separatorset = "\structurecounterparameter{#1}\c!numberseparatorset",
- conversion = \!!bs\structurecounterparameter{#1}\c!numberconversion\!!es,
- conversionset = "\structurecounterparameter{#1}\c!numberconversionset",
- starter = \!!bs\structurecounterparameter{#1}\c!numberstarter\!!es,
- stopper = \!!bs\structurecounterparameter{#1}\c!numberstopper\!!es,
- segments = "\structurecounterparameter{#1}\c!numbersegments",
- type = "\structurecounterparameter{#1}\c!type",
- criterium = "\structurecounterparameter{#1}\c!criterium", % might change if we also want this with sectioning
+ order = "\counterparameter{#1}\c!numberorder",
+ separatorset = "\counterparameter{#1}\c!numberseparatorset",
+ conversion = \!!bs\counterparameter{#1}\c!numberconversion\!!es,
+ conversionset = "\counterparameter{#1}\c!numberconversionset",
+ starter = \!!bs\counterparameter{#1}\c!numberstarter\!!es,
+ stopper = \!!bs\counterparameter{#1}\c!numberstopper\!!es,
+ segments = "\counterparameter{#1}\c!numbersegments",
+ type = "\counterparameter{#1}\c!type",
+ criterium = "\counterparameter{#1}\c!criterium", % might change if we also want this with sectioning
}
)}%
\endgroup}
-\def\directconvertedstructurecounter#1#2% name, type
+\def\directconvertedcounter#1#2% name, type
{\ctxlua{structures.sections.prefixedconverted(
"\strc_counters_the{#1}",
{
- prefix = "\structurecounterparameter{#1}\c!prefix",
- separatorset = "\structurecounterparameter{#1}\c!prefixseparatorset",
- conversion = "\structurecounterparameter{#1}\c!prefixconversion",
- conversionset = "\structurecounterparameter{#1}\c!prefixconversionset",
- % starter = \!!bs\structurecounterparameter{#1}\c!prefixstarter\!!es,
- % stopper = \!!bs\structurecounterparameter{#1}\c!prefixstopper\!!es,
- set = "\structurecounterparameter{#1}\c!prefixset",
- segments = "\structurecounterparameter{#1}\c!prefixsegments",
- connector = \!!bs\structurecounterparameter{#1}\c!prefixconnector\!!es,
+ prefix = "\counterparameter{#1}\c!prefix",
+ separatorset = "\counterparameter{#1}\c!prefixseparatorset",
+ conversion = "\counterparameter{#1}\c!prefixconversion",
+ conversionset = "\counterparameter{#1}\c!prefixconversionset",
+ % starter = \!!bs\counterparameter{#1}\c!prefixstarter\!!es,
+ % stopper = \!!bs\counterparameter{#1}\c!prefixstopper\!!es,
+ set = "\counterparameter{#1}\c!prefixset",
+ segments = "\counterparameter{#1}\c!prefixsegments",
+ connector = \!!bs\counterparameter{#1}\c!prefixconnector\!!es,
},
{
- order = "\structurecounterparameter{#1}\c!numberorder",
- separatorset = "\structurecounterparameter{#1}\c!numberseparatorset",
- conversion = \!!bs\structurecounterparameter{#1}\c!numberconversion\!!es,
- conversionset = "\structurecounterparameter{#1}\c!numberconversionset",
- starter = \!!bs\structurecounterparameter{#1}\c!numberstarter\!!es,
- stopper = \!!bs\structurecounterparameter{#1}\c!numberstopper\!!es,
- segments = "\structurecounterparameter{#1}\c!numbersegments",
+ order = "\counterparameter{#1}\c!numberorder",
+ separatorset = "\counterparameter{#1}\c!numberseparatorset",
+ conversion = \!!bs\counterparameter{#1}\c!numberconversion\!!es,
+ conversionset = "\counterparameter{#1}\c!numberconversionset",
+ starter = \!!bs\counterparameter{#1}\c!numberstarter\!!es,
+ stopper = \!!bs\counterparameter{#1}\c!numberstopper\!!es,
+ segments = "\counterparameter{#1}\c!numbersegments",
type = "#2",
}
)}}
-\unexpanded\def\convertedsubstructurecounter
+\unexpanded\def\convertedsubcounter
{\dotripleempty\strc_counters_converted_sub}
\def\strc_counters_converted_sub[#1][#2][#3]% #2 can be n or n:m
@@ -463,74 +447,55 @@
\secondargumentfalse\strc_counters_converted[#1][]%
\fi}
-\let\getstructurecounter\convertedstructurecounter
-
-\unexpanded\def\doifdefinedstructurecounter#1%
+\unexpanded\def\doifdefinedcounter#1%
{\ifcsname\s!number#1\c!number\endcsname
\expandafter\firstofoneargument
\else
\expandafter\gobbleoneargument
\fi}
-\unexpanded\def\doifundefinedstructurecounter#1%
+\unexpanded\def\doifundefinedcounter#1%
{\ifcsname\s!number#1\c!number\endcsname
\expandafter\gobbleoneargument
\else
\expandafter\firstofoneargument
\fi}
-\unexpanded\def\doifdefinedstructurecounterelse#1%
+\unexpanded\def\doifdefinedcounterelse#1%
{\ifcsname\s!number#1\c!number\endcsname
\expandafter\firstoftwoarguments
\else
\expandafter\secondoftwoarguments
\fi}
-\ifx\checkstructurecounter\undefined \def\checkstructurecounter[#1]{} \fi
-
-\def\checkstructurecounter[#1]{}
-
%D What follows is a compatibility layer.
-\let \numberparameter \structurecounterparameter % {name}\c!key
+\let \numberparameter \counterparameter % {name}\c!key
-\let \definenumber \definestructurecounter % [name]
-\let \setupnumber \setupstructurecounter % [name][setups]
+\let \definenumber \definecounter % [name]
+\let \setupnumber \setupcounter % [name][setups]
-\let \setnumber \setstructurecounter % [name]{value}
-\let \resetnumber \resetstructurecounter % [name]
-\let \savenumber \savestructurecounter % [name]
-\let \restorenumber \restorestructurecounter % [name]
-\let \incrementnumber \incrementstructurecounter % [name]
-\let \decrementnumber \decrementstructurecounter % [name]
-\let \rawnumber \rawstructurecounter % [name]
-\let \getnumber \getstructurecounter % [name]
-\let \convertednumber \getstructurecounter % [name]
+\let \setnumber \setcounter % [name]{value}
+\let \resetnumber \resetcounter % [name]
+\let \savenumber \savecounter % [name]
+\let \restorenumber \restorecounter % [name]
+\let \incrementnumber \incrementcounter % [name]
+\let \decrementnumber \decrementcounter % [name]
+\let \rawnumber \rawcounter % [name]
+\let \getnumber \getcounter % [name]
+\let \convertednumber \getcounter % [name]
-\let \doifdefinednumber \doifstructurecounter % {number}{true}
-\let \doifundefinednumber \doifnotstructurecounter % {number}{true}
-\let \doifdefinednumberelse \doifstructurecounterelse % {number}{true}{false}
+\let \doifdefinednumber \doifdefinedcounter % {number}{true}
+\let \doifundefinednumber \doifnotdefinedcounter % {number}{true}
+\let \doifdefinednumberelse \doifdefinedcounterelse % {number}{true}{false}
-\let \setupnumbering \setupstructurecountering
-
-% \unexpanded\def\resetnumber {\dosingleargument\doresetnumber}
-% \def\doresetnumber [#1]{\processcommalistwithparameters[#1]\resetstructurecounter}
-
-% \def\accumulatednumber[#1]{}
-%
-% \unexpanded\def\setupnumbering
-% {\dodoubleempty\getparameters[\??nr]}
-%
-% \setupnumbering
-% [\c!way=\v!by\v!chapter,
-% \c!blockway=,
-% \c!state=\v!start]
+\let \setupnumbering \setupstructurecounting
%D Helpers:
% call:
%
-% \dostructurecountercomponent
+% \strc_counters_register_component
% \currentfloat
% \getfloatparameters \floatparameter \detokenizedfloatparameter
% \hascaption \hastitle \hasnumber
@@ -538,21 +503,22 @@
%
% sets:
%
-% \laststructurecounternumber
-% \laststructurecountersynchronize
+% \m_strc_counters_last_registered_index
+% \m_strc_counters_last_registered_attribute
+% \m_strc_counters_last_registered_synchronize
-\newconditional\hasstructurecountercaption
-\newconditional\hasstructurecountertitle
-\newconditional\hasstructurecounternumber
+\newconditional\hascountercaption
+\newconditional\hascountertitle
+\newconditional\hascounternumber
-\unexpanded\def\dostructurecountercomponent#1#2#3#4#5#6#7[#8][#9]% maybe also nolist
+\unexpanded\def\strc_counters_register_component#1#2#3#4#5#6#7[#8][#9]% maybe also nolist
{\begingroup
%
#2[\s!haslevel=1,#8]%
- \edef\hasstructurecounterlevel {#3\s!haslevel}%
- \edef\hasstructurecountercaption{#3\s!hascaption}%
- \edef\hasstructurecountertitle {#3\s!hastitle}%
- \edef\hasstructurecounternumber {#3\s!hasnumber}%
+ \edef\hascounterlevel {#3\s!haslevel}%
+ \edef\hascountercaption{#3\s!hascaption}%
+ \edef\hascountertitle {#3\s!hastitle}%
+ \edef\hascounternumber {#3\s!hasnumber}%
%
\edef\askedprefixsegments{#3\c!prefixsegments}%
\ifx\askedprefixsegments\v!auto
@@ -568,13 +534,7 @@
\let\currentcounter\currentname
\fi
%
-% \doif{#3\c!title}\v!none{\setfalse\hasstructurecountercaption\setfalse\hasstructurecounternumber}% will become obsolete
-% %
-% \ifx\hasstructurecounternumber\v!yes % here due to previous test but best in callers
-% \doincrementsubstructurecounter[\currentcounter][\hasstructurecounterlevel]%
-% \fi
- %
- \ifx\hasstructurecountercaption\v!yes
+ \ifx\hascountercaption\v!yes
\xdef\currentstructurecomponentname {#3\c!name}%
\xdef\currentstructurecomponentlevel {#3\c!level}%
\edef\currentstructurecomponentexpansion {#3\c!expansion}%
@@ -619,7 +579,7 @@
\fi
%
\setnextinternalreference
- \xdef\laststructurecounternumber{\ctxcommand{addtolist{
+ \xdef\m_strc_counters_last_registered_index{\ctxcommand{addtolist{
metadata = {
kind = "#1",
name = "\currentname",
@@ -653,7 +613,7 @@
list = \!!bs\detokenize\expandafter{\currentstructurecomponentlist}\!!es,
\fi
},
- \ifx\hasstructurecounternumber\v!yes
+ \ifx\hascounternumber\v!yes
prefixdata = {
prefix = "#3\c!prefix",
separatorset = "#3\c!prefixseparatorset",
@@ -677,21 +637,21 @@
userdata = \!!bs\detokenize{#9}\!!es % will be converted to table at the lua end
}
}}%
- \xdef\laststructurecounterattribute {\ctxlua {tex.write(structures.references.setinternalreference(nil,nil,\nextinternalreference))}}%
- \xdef\laststructurecountersynchronize{\ctxlatecommand{enhancelist(\laststructurecounternumber)}}%
+ \xdef\m_strc_counters_last_registered_attribute {\ctxlua {tex.write(structures.references.setinternalreference(nil,nil,\nextinternalreference))}}%
+ \xdef\m_strc_counters_last_registered_synchronize{\ctxlatecommand{enhancelist(\m_strc_counters_last_registered_index)}}%
\else
- \glet\laststructurecounternumber \relax
- \glet\laststructurecounterattribute \attributeunsetvalue
- \glet\laststructurecountersynchronize\relax
+ \glet\m_strc_counters_last_registered_index \relax
+ \glet\m_strc_counters_last_registered_attribute \attributeunsetvalue
+ \glet\m_strc_counters_last_registered_synchronize\relax
\fi
\endgroup}
-\let\laststructurecounternumber \relax
-\let\laststructurecounterattribute \relax
-\let\laststructurecountersynchronize\relax
+\let\m_strc_counters_last_registered_index \relax
+\let\m_strc_counters_last_registered_attribute \relax
+\let\m_strc_counters_last_registered_synchronize\relax
-\def\dostructurecountersetup#1#2% name \someparameter
- {\setupstructurecounter
+\def\strc_counter_setup_using_parameter#1#2% name \someparameter
+ {\setupcounter
[#1]
[ \c!start=#2\c!start,
\c!state=#2\c!state, % beware, "" == start
@@ -715,7 +675,7 @@
\c!numberstopper=#2\c!numberstopper,
\c!numbersegments=#2\c!numbersegments]}
-\def\presetstructurecountersetup#1#2% \setupcommand \someparameter
+\def\strc_counter_preset_using_parameter#1#2% \setupcommand \someparameter
{#1%
[\c!way =#2\c!way,
\c!prefix =#2\c!prefix,
diff --git a/tex/context/base/strc-pag.mkiv b/tex/context/base/strc-pag.mkiv
index d54c5744a..467ff3df4 100644
--- a/tex/context/base/strc-pag.mkiv
+++ b/tex/context/base/strc-pag.mkiv
@@ -71,9 +71,9 @@
% \stopbodymatter
% \stoptext
-\definestructurecounter[\s!realpage][\c!prefix=\v!no,\c!start=1,\c!prefixsegments=,\s!counter=realpageno,\c!method=\v!page]
-\definestructurecounter[\s!userpage][\c!prefix=\v!no,\c!start=1,\c!prefixsegments=,\s!counter=userpageno,\c!method=\v!page]
-\definestructurecounter[\s!subpage] [\c!prefix=\v!no,\c!start=1,\c!prefixsegments=,\s!counter=subpageno, \c!method=\v!page]
+\definecounter[\s!realpage][\c!prefix=\v!no,\c!start=1,\c!prefixsegments=,\s!counter=realpageno,\c!method=\v!page]
+\definecounter[\s!userpage][\c!prefix=\v!no,\c!start=1,\c!prefixsegments=,\s!counter=userpageno,\c!method=\v!page]
+\definecounter[\s!subpage] [\c!prefix=\v!no,\c!start=1,\c!prefixsegments=,\s!counter=subpageno, \c!method=\v!page]
\newtoks\everysetuprealpagenumber % todo: set state: none, start, stop, reset
\newtoks\everysetupuserpagenumber % todo: set state: none, start, stop, reset
@@ -83,11 +83,11 @@
\unexpanded\def\setupuserpagenumber{\dosingleargument\dosetupuserpagenumber}
\unexpanded\def\setupsubpagenumber {\dosingleargument\dosetupsubpagenumber}
-\def\dosavepagenumberstate#1{\edef\oldpagenumberstate{\structurecounterparameter#1\c!state}}
+\def\dosavepagenumberstate#1{\edef\oldpagenumberstate{\counterparameter#1\c!state}}
-\def\dosetuprealpagenumber[#1]{\dosavepagenumberstate\s!realpage\dosetupstructurecounter[\s!realpage][#1]\the\everysetuprealpagenumber}
-\def\dosetupuserpagenumber[#1]{\dosavepagenumberstate\s!userpage\dosetupstructurecounter[\s!userpage][#1]\the\everysetupuserpagenumber}
-\def\dosetupsubpagenumber [#1]{\dosavepagenumberstate\s!subpage \dosetupstructurecounter[\s!subpage ][#1]\the\everysetupsubpagenumber }
+\def\dosetuprealpagenumber[#1]{\dosavepagenumberstate\s!realpage\strc_counters_setup[\s!realpage][#1]\the\everysetuprealpagenumber}
+\def\dosetupuserpagenumber[#1]{\dosavepagenumberstate\s!userpage\strc_counters_setup[\s!userpage][#1]\the\everysetupuserpagenumber}
+\def\dosetupsubpagenumber [#1]{\dosavepagenumberstate\s!subpage \strc_counters_setup[\s!subpage ][#1]\the\everysetupsubpagenumber }
\def\resetrealpagenumber {} % not permitted
\def\resetuserpagenumber {\strc_counters_reset\s!userpage}
@@ -104,18 +104,18 @@
\def\savecurrentpagestate % \normalexpanded?
{\ctxlua{structures.pages.save({
- prefix = "\structurecounterparameter\s!userpage\c!prefix",
- separatorset = "\structurecounterparameter\s!userpage\c!prefixseparatorset",
- conversion = "\structurecounterparameter\s!userpage\c!prefixconversion",
- conversionset = "\structurecounterparameter\s!userpage\c!prefixconversionset",
- set = "\structurecounterparameter\s!userpage\c!prefixset",
- segments = "\structurecounterparameter\s!userpage\c!prefixsegments",
- connector = \!!bs\structurecounterparameter\s!userpage\c!prefixconnector\!!es,
+ prefix = "\counterparameter\s!userpage\c!prefix",
+ separatorset = "\counterparameter\s!userpage\c!prefixseparatorset",
+ conversion = "\counterparameter\s!userpage\c!prefixconversion",
+ conversionset = "\counterparameter\s!userpage\c!prefixconversionset",
+ set = "\counterparameter\s!userpage\c!prefixset",
+ segments = "\counterparameter\s!userpage\c!prefixsegments",
+ connector = \!!bs\counterparameter\s!userpage\c!prefixconnector\!!es,
},{
- conversion = "\structurecounterparameter\s!userpage\c!numberconversion",
- conversionset = "\structurecounterparameter\s!userpage\c!numberconversionset",
- starter = \!!bs\structurecounterparameter\s!userpage\c!numberstarter\!!es,
- stopper = \!!bs\structurecounterparameter\s!userpage\c!numberstopper\!!es,
+ conversion = "\counterparameter\s!userpage\c!numberconversion",
+ conversionset = "\counterparameter\s!userpage\c!numberconversionset",
+ starter = \!!bs\counterparameter\s!userpage\c!numberstarter\!!es,
+ stopper = \!!bs\counterparameter\s!userpage\c!numberstopper\!!es,
}
)}}
@@ -123,7 +123,7 @@
\savecurrentpagestate
\to \everyshipout
-\def\pushpagestate{\setxvalue{\??nm:\s!userpage:\c!state}{\structurecounterparameter\s!userpage\c!state}}
+\def\pushpagestate{\setxvalue{\??nm:\s!userpage:\c!state}{\counterparameter\s!userpage\c!state}}
\def\poppagestate {\normalexpanded{\noexpand\setuppagenumber[\c!state=\getvalue{\??nm:\s!userpage:\c!state}]}}
\setuppagenumber
@@ -139,21 +139,21 @@
% Counters
-\def\firstrealpagenumber{\convertedstructurecounter[\s!realpage][\c!type=\v!first]}
-\def\firstuserpagenumber{\convertedstructurecounter[\s!userpage][\c!type=\v!first]}
-\def\firstsubpagenumber {\convertedstructurecounter[\s!subpage ][\c!type=\v!first]}
+\def\firstrealpagenumber{\convertedcounter[\s!realpage][\c!type=\v!first]}
+\def\firstuserpagenumber{\convertedcounter[\s!userpage][\c!type=\v!first]}
+\def\firstsubpagenumber {\convertedcounter[\s!subpage ][\c!type=\v!first]}
-\def\lastrealpagenumber {\convertedstructurecounter[\s!realpage][\c!type=\v!last]}
-\def\lastuserpagenumber {\convertedstructurecounter[\s!userpage][\c!type=\v!last]}
-\def\lastsubpagenumber {\convertedstructurecounter[\s!subpage ][\c!type=\v!last]}
+\def\lastrealpagenumber {\convertedcounter[\s!realpage][\c!type=\v!last]}
+\def\lastuserpagenumber {\convertedcounter[\s!userpage][\c!type=\v!last]}
+\def\lastsubpagenumber {\convertedcounter[\s!subpage ][\c!type=\v!last]}
-\def\prevrealpagenumber {\convertedstructurecounter[\s!realpage][\c!type=\v!previous]}
-\def\prevuserpagenumber {\convertedstructurecounter[\s!userpage][\c!type=\v!previous]}
-\def\prevsubpagenumber {\convertedstructurecounter[\s!subpage ][\c!type=\v!previous]}
+\def\prevrealpagenumber {\convertedcounter[\s!realpage][\c!type=\v!previous]}
+\def\prevuserpagenumber {\convertedcounter[\s!userpage][\c!type=\v!previous]}
+\def\prevsubpagenumber {\convertedcounter[\s!subpage ][\c!type=\v!previous]}
-\def\nextrealpagenumber {\convertedstructurecounter[\s!realpage][\c!type=\v!next]}
-\def\nextuserpagenumber {\convertedstructurecounter[\s!userpage][\c!type=\v!next]}
-\def\nextsubpagenumber {\convertedstructurecounter[\s!subpage ][\c!type=\v!next]}
+\def\nextrealpagenumber {\convertedcounter[\s!realpage][\c!type=\v!next]}
+\def\nextuserpagenumber {\convertedcounter[\s!userpage][\c!type=\v!next]}
+\def\nextsubpagenumber {\convertedcounter[\s!subpage ][\c!type=\v!next]}
\def\firstrealpage{\strc_counters_first\s!realpage}
\def\firstuserpage{\strc_counters_first\s!userpage}
@@ -185,27 +185,27 @@
% Renderers:
\def\pagenumber {\strc_counters_raw\s!userpage}
-\def\prefixedpagenumber {\directconvertedstructurecounter\s!userpage\empty} % \userpagenumber
+\def\prefixedpagenumber {\directconvertedcounter\s!userpage\empty} % \userpagenumber
-\def\realpagenumber {\directconvertedstructurecounter\s!realpage\empty}
-\def\userpagenumber {\directconvertedstructurecounter\s!userpage\empty}
-\def\subpagenumber {\directconvertedstructurecounter\s!subpage \empty}
+\def\realpagenumber {\directconvertedcounter\s!realpage\empty}
+\def\userpagenumber {\directconvertedcounter\s!userpage\empty}
+\def\subpagenumber {\directconvertedcounter\s!subpage \empty}
-\def\firstrealpagenumber{\directconvertedstructurecounter\s!realpage\v!first}
-\def\firstuserpagenumber{\directconvertedstructurecounter\s!userpage\v!first}
-\def\firstsubpagenumber {\directconvertedstructurecounter\s!subpage \v!first}
+\def\firstrealpagenumber{\directconvertedcounter\s!realpage\v!first}
+\def\firstuserpagenumber{\directconvertedcounter\s!userpage\v!first}
+\def\firstsubpagenumber {\directconvertedcounter\s!subpage \v!first}
-\def\lastrealpagenumber {\directconvertedstructurecounter\s!realpage\v!last}
-\def\lastuserpagenumber {\directconvertedstructurecounter\s!userpage\v!last}
-\def\lastsubpagenumber {\directconvertedstructurecounter\s!subpage \v!last}
+\def\lastrealpagenumber {\directconvertedcounter\s!realpage\v!last}
+\def\lastuserpagenumber {\directconvertedcounter\s!userpage\v!last}
+\def\lastsubpagenumber {\directconvertedcounter\s!subpage \v!last}
-\def\prevrealpagenumber {\directconvertedstructurecounter\s!realpage\v!previous}
-\def\prevuserpagenumber {\directconvertedstructurecounter\s!userpage\v!previous}
-\def\prevsubpagenumber {\directconvertedstructurecounter\s!subpage \v!previous}
+\def\prevrealpagenumber {\directconvertedcounter\s!realpage\v!previous}
+\def\prevuserpagenumber {\directconvertedcounter\s!userpage\v!previous}
+\def\prevsubpagenumber {\directconvertedcounter\s!subpage \v!previous}
-\def\nextrealpagenumber {\directconvertedstructurecounter\s!realpage\v!next}
-\def\nextuserpagenumber {\directconvertedstructurecounter\s!userpage\v!next}
-\def\nextsubpagenumber {\directconvertedstructurecounter\s!subpage \v!next}
+\def\nextrealpagenumber {\directconvertedcounter\s!realpage\v!next}
+\def\nextuserpagenumber {\directconvertedcounter\s!userpage\v!next}
+\def\nextsubpagenumber {\directconvertedcounter\s!subpage \v!next}
\def\dodeincrementpageboundcounters % only at the end
{\strc_counters_decrement\s!realpage
@@ -257,8 +257,8 @@
\def\dosynchronizepagenumber{\global\let\@@pnstate\v!start}
-\def\decrementpagenumber{\csname\??pn-\structurecounterparameter\s!userpage\c!state\endcsname}
-\def\incrementpagenumber{\csname\??pn+\structurecounterparameter\s!userpage\c!state\endcsname}
+\def\decrementpagenumber{\csname\??pn-\counterparameter\s!userpage\c!state\endcsname}
+\def\incrementpagenumber{\csname\??pn+\counterparameter\s!userpage\c!state\endcsname}
\letvalue{\??pn-\v!start}\dodecrementpagenumber
\letvalue{\??pn-\v!none }\dodecrementpagenumber
@@ -362,7 +362,7 @@
\setnewconstant\overallpagenumberstate\plusone % general number: 0=invisible, 1=visible
\def\checkpagenumberstatechange#1#2%
- {\edef\newpagenumberstate{\structurecounterparameter#1\c!state}%
+ {\edef\newpagenumberstate{\counterparameter#1\c!state}%
\ifx\newpagenumberstate\oldpagenumberstate \else
\doifelse\newpagenumberstate\v!start
{#2\plustwo}%
@@ -413,17 +413,17 @@
% just for downward compatbility
\appendtoks
- \edef\askeduserpagenumber{\structurecounterparameter\s!userpage\c!number}%
+ \edef\askeduserpagenumber{\counterparameter\s!userpage\c!number}%
\ifx\askeduserpagenumber\empty \else
- \normalexpanded{\noexpand\setuppagenumber[\c!start=\structurecounterparameter\s!userpage\c!number,\c!number=]}%
+ \normalexpanded{\noexpand\setuppagenumber[\c!start=\counterparameter\s!userpage\c!number,\c!number=]}%
\userpageno\strc_counters_raw\s!userpage
\fi
\to \everysetupuserpagenumber % todo: set state: none, start, stop, reset
\appendtoks
- \edef\askedsubpagenumber{\structurecounterparameter\s!subpage\c!number}%
+ \edef\askedsubpagenumber{\counterparameter\s!subpage\c!number}%
\ifx\askedsubpagenumber\empty \else
- \normalexpanded{\noexpand\setupsubpagenumber[\c!start=\structurecounterparameter\s!subpage\c!number,\c!number=]}%
+ \normalexpanded{\noexpand\setupsubpagenumber[\c!start=\counterparameter\s!subpage\c!number,\c!number=]}%
\subpageno\strc_counters_raw\s!subpage\relax
\fi
\to \everysetupsubpagenumber % todo: set state: none, start, stop, reset
diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv
index 511a8bbd2..0294f4f88 100644
--- a/tex/context/base/strc-sec.mkiv
+++ b/tex/context/base/strc-sec.mkiv
@@ -504,7 +504,7 @@
%
% not here, after optional \page: \doregisterhead\currenthead{#2}{#3}%
%
-% \xdef\currentheadcounter{\currentstructurecounter}% lua call
+% \xdef\currentheadcounter{\currentsectioncountervalue}% lua call
%
% \currentstructuresynchronize % will move
%
@@ -691,20 +691,20 @@
\dodocheckheadlayout\v!text \c!text
\dodocheckheadlayout\v!footer\c!footer}}
-\def\currentstructurecounter {\ctxlua{structures.sections.depthnumber(\thenamedheadlevel\currenthead)}}
-\def\previousstructurecounter{\ctxlua{structures.sections.depthnumber(\thenamedheadlevel\currenthead-1)}}
+\def\currentsectioncountervalue {\ctxlua{structures.sections.depthnumber(\thenamedheadlevel\currenthead)}}
+\def\previoussectioncountervalue{\ctxlua{structures.sections.depthnumber(\thenamedheadlevel\currenthead-1)}}
\def\dohandleheadpagebreaknop
{\doifelse{\headparameter\c!continue}\v!yes
- {\ifnum\previousstructurecounter=\zerocount
+ {\ifnum\previoussectioncountervalue=\zerocount
\docheckheadlayout
- \else\ifnum\currentstructurecounter>\zerocount
+ \else\ifnum\currentsectioncountervalue>\zerocount
\docheckheadlayout
\fi\fi}%
{\docheckheadlayout}}
\def\dohandleheadpagebreakyes
- {%[[\currenthead @\thenamedheadlevel\currenthead/prev:\previousstructurecounter/curr:\currentstructurecounter]]
+ {%[[\currenthead @\thenamedheadlevel\currenthead/prev:\previoussectioncountervalue/curr:\currentsectioncountervalue]]
\ifconditional\ignorehandlepagebreak
\setfalse\ignorehandlepagebreak
\else
@@ -713,9 +713,9 @@
% \fi
% beware, these numbers are not yet know here
\doifelse{\headparameter\c!continue}\v!yes
- {\ifnum\previousstructurecounter=\zerocount
+ {\ifnum\previoussectioncountervalue=\zerocount
\docheckheadlayout
- \else\ifnum\currentstructurecounter>\zerocount
+ \else\ifnum\currentsectioncountervalue>\zerocount
\docheckheadlayout
\fi\fi}%
{\docheckheadlayout}%
diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv
index d607f0f20..0e43a6202 100644
--- a/tex/context/base/syst-aux.mkiv
+++ b/tex/context/base/syst-aux.mkiv
@@ -4637,45 +4637,48 @@
\let\dotoks\the
-%D \macros
-%D {makecounter,pluscounter,minuscounter,
-%D resetcounter,setcounter,countervalue}
-%D
-%D Declaring, setting and resetting \COUNTERS\ can be done
-%D with the next set of commands.
-%D
-%D \starttyping
-%D \makecounter {name}
-%D \pluscounter {name}
-%D \minuscounter {name}
-%D \resetcounter {name}
-%D \setcounter {name} {value}
-%D \countervalue {name}
-%D \stoptyping
-
-\def\makecounter#1%
- {\global\expandafter\let\csname#1\endcsname\zerocountervalue} % see earlier
-
-\def\countervalue#1%
- {\ifcsname#1\endcsname\csname#1\endcsname\fi}
-
-\def\pluscounter#1%
- {\expandafter\xdef\csname#1\endcsname{\the\numexpr\csname#1\endcsname+\plusone\relax}}
-
-\def\minuscounter#1%
- {\expandafter\xdef\csname#1\endcsname{\the\numexpr\csname#1\endcsname-\plusone\relax}}
-
-\def\resetcounter#1%
- {\global\expandafter\let\csname#1\endcsname\zerocountervalue}
-
-\def\setcounter#1#2%
- {\expandafter\xdef\csname#1\endcsname{\the\numexpr#2\relax}}
-
-\def\savecounter#1%
- {\expandafter\xdef\csname ! #1 !\endcsname{\the\numexpr\csname#1\endcsname\relax}}
-
-\def\restorecounter#1%
- {\expandafter\xdef\csname#1\endcsname{\the\numexpr\csname ! #1 !\endcsname\relax}}
+% The following code is obsolete (and names are reused for the more
+% advanced counter mechanism and those macros are not compatible!
+%
+% %D \macros
+% %D {makecounter,pluscounter,minuscounter,
+% %D resetcounter,setcounter,countervalue}
+% %D
+% %D Declaring, setting and resetting \COUNTERS\ can be done
+% %D with the next set of commands.
+% %D
+% %D \starttyping
+% %D \makecounter {name}
+% %D \pluscounter {name}
+% %D \minuscounter {name}
+% %D \resetcounter {name}
+% %D \setcounter {name} {value}
+% %D \countervalue {name}
+% %D \stoptyping
+%
+% \def\makecounter#1%
+% {\global\expandafter\let\csname#1\endcsname\zerocountervalue} % see earlier
+%
+% \def\countervalue#1%
+% {\ifcsname#1\endcsname\csname#1\endcsname\fi}
+%
+% \def\pluscounter#1%
+% {\expandafter\xdef\csname#1\endcsname{\the\numexpr\csname#1\endcsname+\plusone\relax}}
+%
+% \def\minuscounter#1%
+% {\expandafter\xdef\csname#1\endcsname{\the\numexpr\csname#1\endcsname-\plusone\relax}}
+%
+% \def\resetcounter#1%
+% {\global\expandafter\let\csname#1\endcsname\zerocountervalue}
+%
+% \def\setcounter#1#2%
+% {\expandafter\xdef\csname#1\endcsname{\the\numexpr#2\relax}}
+%
+% \def\savecounter#1%
+% {\expandafter\xdef\csname ! #1 !\endcsname{\the\numexpr\csname#1\endcsname\relax}}
+%
+% \def\restorecounter#1%
+% {\expandafter\xdef\csname#1\endcsname{\the\numexpr\csname ! #1 !\endcsname\relax}}
%D \macros
%D {beforesplitstring,aftersplitstring}
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 267c7547e..e9774e8f9 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 03/29/12 13:03:16
+-- merge date : 03/29/12 22:00:09
do -- begin closure to overcome local limits and interference