%!TeX TS-program = ConTeXt-MKII

\defineregister[Passage][Passages] 
\setupregister[Passage][n=1,% 
balance=yes,% 
pagestyle=\tfx\em,% 
textstyle=\tfx,% 
criterium=all,% 
interaction={pagenumber},% 
] 
\setupregister[Passage][indicator=no,distance=0.5em] 
% interface to register
\def\MyPassage#1#2#3{\locuskey{#3}\expandoneargafter\doMyPassage{\nextkey}{#1}{#2}{#3}}
\def\doMyPassage#1#2#3#4{\Passage[#2#3#1]{{#2}+{#3}+{#4}}}

%
% Def. of \locuskey#1
%	In: #1<-p1[.l2[--l3]] Out: key stored in \nextkey
% Utility: length of string of characters (see TeX Book, p. 219)
\newcount\keylength
\def\initkeylength#1{\global\keylength=0 \doLength#1\end}
\def\doLength#1{\ifx#1\end\let\next=\relax\else\global\advance\keylength by1\let\next=\doLength\fi\next}
% Create a letter-only key based on page.line(s).   Result stored in \nextkey.
\def\locuskey#1{\gdef\nextkey{}\doifinstringelse{.}{#1}
	{\doifinstringelse{-}{#1}{\startlocuskeypagelinerange#1\stoplocuskeypagelinerange}{\startlocuskeypageline#1\stoplocuskeypageline}}
	{\locuskeypage{#1}}}
\def\locuskeypage#1{\padkey{#1}\padkey{}\padkey{}}
\def\startlocuskeypageline#1.#2\stoplocuskeypageline{\padkey{#1}\padkey{#2}\padkey{}}
\def\startlocuskeypagelinerange#1.#2--#3\stoplocuskeypagelinerange{\padkey{#1}\padkey{#2}\padkey{#3}}
% pad page or line number with intial a's, fixed length 5 chars; convert digits to letters
\def\padkey#1{{\initkeylength{#1}\xdef\nextkey{\nextkey\ifcase\keylength aaaa\or aaa\or aa\or a\else\fi}\toletters{#1}}}
\def\toletters#1{\keylength=0 \dotoletters#1\end}
\def\dotoletters#1{\ifx#1\end\let\next=\relax\else\digittoletter#1\let\next=\dotoletters\fi \next}
\def\digittoletter#1{\xdef\nextkey{\nextkey\ifcase#1a\or b\or c\or d\or e\or f\or g\or h\or i\or j\else #1\fi}}

\starttext 

See \MyPassage{Simplicius}{\em In de caelo}{280}280.
See \MyPassage{Simplicius}{\em In de caelo}{483.15--19}483.15--19. 
See \MyPassage{Simplicius}{\em Work III}{280}280.
See \MyPassage{Plato}{\em Whatever}{77.13--24}77.13--24. 
See \MyPassage{Plato}{\em Whatever}{25.7}25.7. 
See \MyPassage{Plato}{\em Whatever}{25.37}25.37. 
See \MyPassage{Simplicius}{\em Work III}{483.1}483.1. 
See \MyPassage{Simplicius}{\em Work III}{483.15--19}483.15--19. 
\page 
See \MyPassage{Simplicius}{\em In de caelo}{477.3--4}477.3--4.
See \MyPassage{Simplicius}{\em Alter}{478.3}478.3.
See \MyPassage{Simplicius}{\em In de caelo}{278}278. 
See \MyPassage{Simplicius}{\em In de caelo}{377}377. 
See \MyPassage{Simplicius}{\em In de caelo}{277}277. 
See \MyPassage{Simplicius}{\em In de caelo}{8}8. 
See \MyPassage{Simplicius}{\em In de caelo}{77.3--4}77.3--4. 
See \MyPassage{Simplicius}{\em In de caelo}{377.43--44}377.43--44. 
See \MyPassage{Plato}{\em Whatever}{28}28. 
See \MyPassage{Plato}{\em Whatever}{77.3--4}77.3--4. 
See \MyPassage{Plato}{\em Whatever}{377.43--44}377.43--44. 
\page
See \MyPassage{Simplicius}{\em In de caelo}{377.43--44}377.43--44. 
See \MyPassage{Simplicius}{\em In de caelo}{376.7--14}376.7--14. 
See \MyPassage{Simplicius}{\em In de caelo}{376.73}376.73. 
See \MyPassage{Simplicius}{\em In de caelo}{377.43}377.43. 
See \MyPassage{Simplicius}{\em In de caelo}{478}478.
See \MyPassage{Plato}{\em Whatever}{25.117}25.117. 
\page 

\placeregister[Passage] 


\stoptext 

