% Dit kost (te) veel hash-space vanwege de \getvalue.
%
% \def\gotosource#1%
%   {\global\setvalue{#1:\inputlinenumber}%
%      {\thisisinternal{#1:s:\inputlinenumber}%
%       \gotointernal{#1:t:\inputlinenumber}{\gotoresultsymbol}{}%
%       \gotoresultsymbol}%
%    \thisisinternal{#1:t:\inputlinenumber}%
%    \gotointernal{#1:s:\inputlinenumber}{\gotosourcesymbol}{}%
%    \gotosourcesymbol}
%
% \def\gotoresult#1%
%   {\getvalue{#1:\inputlinenumber}}

\unprotect

\def\inputlinenumber{\the\inputlineno}

\def\gotosource#1% kan beter met harde refs
  {\doifdefinedelse{lines:#1}
     {\edef\sourcelist{\getvalue{lines:#1}}}
     {\edef\sourcelist{}}%
   \doglobal\addtocommalist{\inputlinenumber}\sourcelist
   \global\setevalue{lines:#1}{\sourcelist}%
   \gotoconnection{#1}{t}{s}{\gotosourcesymbol}}

\def\gotoresult#1%
  {\ExpandFirstAfter\doifdefined{lines:#1}
     {\edef\sourcelist{\getvalue{lines:#1}}%
      \ExpandBothAfter\doifinsetelse{\inputlinenumber}{\sourcelist}
        {\gotoconnection{#1}{s}{t}{\gotoresultsymbol}}
        {}}}

\def\gotosourcesymbol%
  {\rightarrowfill}

\def\gotoresultsymbol%
  {\leftarrowfill}

\def\gotoconnection#1#2#3#4%
  {\hbox
     {\stelinteractiein[strut=nee]%
      \setbox0=\hbox
        {\omlijnd
           [hoogte=.7\korpsgrootte,
            strut=nee,
            achtergrond=kleur,
            achtergrondkleur=InteractieKleur,
            breedte=\linkerrandbreedte,
            kader=uit]
           {\vskip.2ex\showlocation{#4}}}%
      \expanded{\thisisinternal{#1:#2}{\inputlinenumber}}%
      \expanded{\gotointernal{#1:#3}{\inputlinenumber}{}{\copy0}}}}

\def\connecttosource%
  {\inlinkerrand{\geentest{\gotosource{\processedfile}}}}

\def\connecttoresult#1%
  {\inlinkerrand{\geentest{\gotoresult{#1}}}}

\def\processsources%
  {\def\docommando##1%
     {\bgroup
      \let\connecttosource=\relax
      \paragraaf{\Woord{##1}}
      \steltypenin[optie=kleur]
      \newcounter\inputlinenumber % here we overrule \the\inputlineno
      \EveryLine{\doglobal\increment\inputlinenumber\connecttoresult{##1}}%
      \typefile{##1}
      \egroup}%
   \processcommacommand
     [\processedfiles]
     \docommando}

\protect \endinput
