\def\eltitle{}%
\def\extractch#1,#2 {\chkc{ho#1}\ifx\end#2\end\else\extractch#2 \fi}%
\def\stripdot#1.{#1}
\def\extractbk#1-#2#3#4+#5 {\chkbk{#1}\if#2h\if#3o\extractch#4, \fi\fi\ifx\end#5\end\else\extractbk#5 \fi}%
\def\parse#1.#2.#3.#4tex{\chkmth{#1}\extractbk#2+ \if\end#4\end\def\personal{#3}\else\edef\personal{\stripdot#4}\ifbbhv\def\soort{\expandafter\mksrme\stripdot#3 }\else\def\nivo{\expandafter\mksrme#3 }\fi\fi}%
\def\mkhnum#1#2#3 {\if#1h\if#2o\romannumeral #3%
    \else\errmessage{wrong argument to mkhnum}\fi\else
  \errmessage{wrong argument to mkhnum}\fi}%
\def\gethnum#1#2#3 {\if#1h\if#2o#3%
    \else\errmessage{wrong argument to gethnum}\fi\else
  \errmessage{wrong argument to gethnum}\fi}%
\def\mksrme#1 {\mksrm #1- }%
\def\mksrm#1#2 {%
  \if0#1\else
    \if1#1i\else
      \if2#1ii\else
        \if3#1iii\else
          \if4#1iv\else
            \if5#1v\else
              \if6#1vi\else #1\fi
            \fi
          \fi
        \fi
      \fi
    \fi
  \fi
  \ifx#2-\else\mksrm#2 \fi
}%
\def\stmth#1{\gdef\methode{method\mksrme #1 }}%
\def\callmth{\csname\methode\endcsname}%
\def\chkmth#1{\stmth{#1}%
  \if\callmth\relax
    \errmessage{Methode "#1" is onbekend}%
  \else
    \message{methode: "\callmth"}%
  \fi
}%
\newif\ifbbhvset
\newif\ifbbhv
\def\dmth#1#2{\stmth{#1}\expandafter\def\csname\methode\endcsname{#2}}%
\def\firstchr#1#2-{#1}
\def\stbk#1{\gdef\book{\methode book\mksrme#1 }%
  \def\complain{\errmessage{mix bovenbouw en onderbouwboeken niet toegestaan}}%
}%
\def\callbk{\csname\book\endcsname}%
\def\chkbk#1{\stbk{#1}%
  \ifbbhvset
    \ifbbhv
      \if1\firstchr#1-\complain\fi
      \if2\firstchr#1-\complain\fi
      \if3\firstchr#1-\complain\fi
      \if4\firstchr#1-\complain\fi
    \else
      \if h\firstchr#1-\complain\fi
      \if v\firstchr#1-\complain\fi
      \if a\firstchr#1-\complain\fi
      \if b\firstchr#1-\complain\fi
    \fi
  \else
    \bbhvsettrue
    \bbhvtrue
    \if1\firstchr#1-\bbhvfalse\fi
    \if2\firstchr#1-\bbhvfalse\fi
    \if3\firstchr#1-\bbhvfalse\fi
    \if4\firstchr#1-\bbhvfalse\fi
  \fi
  \edef\soort{\csname\book soort\endcsname}%
  \edef\nivo{\csname\book nivo\endcsname}%
  \if\callbk\relax
    \errmessage{Boek "#1" is onbekend in methode "\callmth"}%
  \else
    \message{boek: "\callbk", \ifbbhv bovenbouw HAVO/VWO\else bovenbouw VMBO of onderbouw\fi}%
  \fi
}%
\def\dbk#1#2#3#4{\stbk{#1}\expandafter\def\csname\book\endcsname{#2}%
  \expandafter\def\csname\book nivo\endcsname{#3}%
  \expandafter\def\csname\book soort\endcsname{\mksrme#4 }%
}%
\def\stc#1{\gdef\chpter{\book ho\mkhnum#1 }%
  \gdef\chpterno{\gethnum#1 }%
}%
\def\callc{\csname\chpter\endcsname}%
\def\chkc#1{\stc{#1}%
  \global\edef\eltitle{\eltitle H\chpterno\ ``\callc''\ }%
  \if\callc\relax
    \errmessage{Hoofdstuk "#1" is onbekend in boek "\callbk" in methode "\callmth"}%
  \else
    \message{hoofdstuk: "\callc"}%
  \fi
}%
\def\dc#1#2{\stc{#1}\expandafter\def\csname\chpter\endcsname{#2}}%
\def\versie{A}
\input gr03
\input gr07
\input gr08
\input gr11
\input gr12
\input gr15
\input gr19
%
% Parse jobname
\expandafter\parse\jobname.tex
