%D \module
%D   [       file=trac-vsp,
%D        version=2024.10.24,
%D          title=\CONTEXT\ Tracing Macros,
%D       subtitle=Slits,
%D         author=Hans Hagen & Mikael Sundqvist,
%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.

% these will become runtime commands

\writestatus{loading}{ConTeXt Tracing Macros / Splitpoints}

\registerctxluafile{trac-vsp}{}

\unprotect

\permanent\tolerant\protected\gdef\startshowsplitpoints[#1]%
  {\begingroup
   \getdummyparameters[\c!option=,\c!list=,\c!offset=\zeropoint,#1]%
   \ctxlua{tracers.splitpoints.start {
        option = "\dummyparameter\c!option",
        list   = "\dummyparameter\c!list",
        offset = \number\dimexpr\dummyparameter\c!offset\relax
    }}%
   \endgroup
   \vsplitchecks\plusone}

\permanent\protected\gdef\stopshowsplitpoints
  {\relax % prevent lookahead
   \ctxlua{tracers.splitpoints.stop()}%
   \vsplitchecks\zerocount}

\permanent\tolerant\protected\gdef\showsplitpoints[#1]%
  {\begingroup
   \getdummyparameters[\c!option=,#1]%
   \switchtobodyfont[6pt]%
   \ctxlua{tracers.splitpoints.typesetresult("\dummyparameter\c!option")}%
   \endgroup}

\protect \endinput
