| 1 |
%% The LaTeX package genealogytree - version 2.4.0 (2026/05/06) |
| 2 |
%% gtrcore.parser.code.tex: Parser |
| 3 |
%% |
| 4 |
%% ------------------------------------------------------------------------------------------- |
| 5 |
%% Copyright (c) 2013-2026 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de> |
| 6 |
%% ------------------------------------------------------------------------------------------- |
| 7 |
%% |
| 8 |
%% This work may be distributed and/or modified under the |
| 9 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 10 |
%% of this license or (at your option) any later version. |
| 11 |
%% The latest version of this license is in |
| 12 |
%% http://www.latex-project.org/lppl.txt |
| 13 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 14 |
%% version 2005/12/01 or later. |
| 15 |
%% |
| 16 |
%% This work has the LPPL maintenance status `author-maintained'. |
| 17 |
%% |
| 18 |
%% This work consists of all files listed in README |
| 19 |
%% |
| 20 |
\gtr@set@library@version{2.4.0} |
| 21 |
|
| 22 |
%% (local) stack implementation |
| 23 |
\def\gtrnewstack#1{% |
| 24 |
\csedef{gtr@stack@#1@size}{0}% |
| 25 |
} |
| 26 |
|
| 27 |
\def\gtrstacksize#1{% |
| 28 |
\csname gtr@stack@#1@size\endcsname% |
| 29 |
} |
| 30 |
|
| 31 |
\def\gtrstackpush#1#2{% |
| 32 |
\count@\gtrstacksize{#1}% |
| 33 |
\advance\count@ 1\relax% |
| 34 |
\csedef{gtr@stack@#1@size}{\number\count@}% |
| 35 |
\csedef{gtr@stack@#1@\number\count@}{#2}% |
| 36 |
} |
| 37 |
|
| 38 |
\def\gtrstackpopto#1#2{% |
| 39 |
\count@\gtrstacksize{#1}% |
| 40 |
\edef#2{\csname gtr@stack@#1@\number\count@\endcsname}% |
| 41 |
\advance\count@ -1\relax% |
| 42 |
\csedef{gtr@stack@#1@size}{\number\count@}% |
| 43 |
} |
| 44 |
|
| 45 |
\def\gtrstackpop#1{% |
| 46 |
\count@\gtrstacksize{#1}% |
| 47 |
\csname gtr@stack@#1@\number\count@\endcsname% |
| 48 |
\advance\count@ -1\relax% |
| 49 |
\csedef{gtr@stack@#1@size}{\number\count@}% |
| 50 |
} |
| 51 |
|
| 52 |
\def\gtrstackpeekto#1#2{% |
| 53 |
\count@\gtrstacksize{#1}% |
| 54 |
\edef#2{\csname gtr@stack@#1@\number\count@\endcsname}% |
| 55 |
} |
| 56 |
|
| 57 |
\def\gtrstackpeek#1{% |
| 58 |
\count@\gtrstacksize{#1}% |
| 59 |
\csname gtr@stack@#1@\number\count@\endcsname% |
| 60 |
} |
| 61 |
|
| 62 |
\def\gtrmakestack#1{% |
| 63 |
\gtrnewstack{#1}% |
| 64 |
\csedef{gtr@stack@#1@size}{0}% |
| 65 |
\csdef{#1size}{\gtrstacksize{#1}}% |
| 66 |
\csdef{#1push}{\gtrstackpush{#1}}% |
| 67 |
\csdef{#1popto}{\gtrstackpopto{#1}}% |
| 68 |
\csdef{#1pop}{\gtrstackpop{#1}}% |
| 69 |
\csdef{#1peekto}{\gtrstackpeekto{#1}}% |
| 70 |
\csdef{#1peek}{\gtrstackpeek{#1}}% |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 75 |
%% Main Parser |
| 76 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 77 |
|
| 78 |
\newcount\gtr@c@level% |
| 79 |
\newcount\gtr@c@family% |
| 80 |
\newcount\gtr@c@pid% |
| 81 |
|
| 82 |
\gtrmakestack{gtr@famstack@}% |
| 83 |
\gtrmakestack{gtr@levelstack@}% |
| 84 |
|
| 85 |
\gtr@c@family\z@\relax |
| 86 |
\gtr@c@pid\z@\relax |
| 87 |
|
| 88 |
\newcommand{\gtr@parsegraph}[2][]{% |
| 89 |
\gtrset{#1,ignore family database}% |
| 90 |
\gtrkv@tikzset% |
| 91 |
\gtrkv@tcbset% |
| 92 |
% |
| 93 |
\let\gtr@timeflow=\gtrkv@timeflow% |
| 94 |
\letcs\gtr@init@leveldimens{gtr@init@timeflow@\gtr@timeflow}% |
| 95 |
\letcs\gtr@set@level@position{gtr@set@level@position@\gtr@timeflow}% |
| 96 |
\letcs\gtr@set@position@family{gtr@set@position@family@\gtr@timeflow}% |
| 97 |
% |
| 98 |
\edef\gtr@level@reference{0pt}% |
| 99 |
\gtr@proc@level@save@settings% |
| 100 |
\gtr@set@level{\gtrkv@proband@level}% |
| 101 |
\let\gtr@currentfamily=\@undefined% |
| 102 |
\numdef\gtr@num@fam@first{\gtr@c@family+1}% |
| 103 |
\numdef\gtr@num@per@first{\gtr@c@pid+1}% |
| 104 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@graph}#2x% |
| 105 |
\numdef\gtr@num@fam@last{\gtr@c@family}% |
| 106 |
\numdef\gtr@num@per@last{\gtr@c@pid}% |
| 107 |
\gtr@set@currentfamily{\gtr@num@fam@first}% |
| 108 |
\csdimdef{gtr@fam@\gtr@currentfamily @offset}{\gtrkv@tree@offset}% |
| 109 |
\gtr@positioning% |
| 110 |
} |
| 111 |
|
| 112 |
\def\gtr@parse@graphwithhandle#1{% |
| 113 |
\let\gtr@handle@continue=#1% |
| 114 |
\gtr@parse@graph% |
| 115 |
} |
| 116 |
|
| 117 |
\def\gtr@parse@graph{% |
| 118 |
\afterassignment\gtr@handle@graph\let\@gtr@token=% |
| 119 |
} |
| 120 |
|
| 121 |
\def\gtr@handle@graph{% |
| 122 |
\let\@next=\gtr@parse@error@token% |
| 123 |
\ifx\@gtr@token x% |
| 124 |
\let\@next=\gtr@parse@x% |
| 125 |
\else% |
| 126 |
\expandafter\ifx\space\@gtr@token% |
| 127 |
\let\@next\gtr@parse@graph% |
| 128 |
\else% |
| 129 |
\ifx\@gtr@token i% |
| 130 |
\let\@next\gtr@parse@i% |
| 131 |
\else% |
| 132 |
\ifx\@gtr@token\par% |
| 133 |
\let\@next\gtr@parse@graph% |
| 134 |
\else% |
| 135 |
\gtr@handle@continue% |
| 136 |
\fi% |
| 137 |
\fi% |
| 138 |
\fi% |
| 139 |
\fi% |
| 140 |
\@next% |
| 141 |
} |
| 142 |
|
| 143 |
\def\gtr@handle@continue@graph{% |
| 144 |
\ifx\@gtr@token p% |
| 145 |
\let\gtr@handle@continue\gtr@handle@continue@parent% |
| 146 |
\let\@next=\gtr@parse@graph@parent@% |
| 147 |
\else% |
| 148 |
\ifx\@gtr@token c% |
| 149 |
\let\gtr@handle@continue\gtr@handle@continue@child% |
| 150 |
\let\@next=\gtr@parse@graph@child@% |
| 151 |
\else% |
| 152 |
\ifx\@gtr@token s% |
| 153 |
\let\gtr@handle@continue\gtr@handle@continue@sandclock% |
| 154 |
\let\@next=\gtr@parse@graph@sandclock@% |
| 155 |
\fi% |
| 156 |
\fi% |
| 157 |
\fi% |
| 158 |
} |
| 159 |
|
| 160 |
|
| 161 |
\def\gtr@parse@graph@parent@ arent{\@ifnextchar[{\gtr@parent@@parent}{\gtr@parent@@parent[]}} |
| 162 |
|
| 163 |
\def\gtr@parse@graph@child@ hild{% |
| 164 |
\gtr@up@level% |
| 165 |
\dimdef\gtr@level@reference{\gtr@level@reference+\gtr@level@size+\gtr@level@distance}% |
| 166 |
\@ifnextchar[{\gtr@child@@child}{\gtr@child@@child[]}} |
| 167 |
|
| 168 |
\def\gtr@parse@graph@sandclock@ andclock{\@ifnextchar[{\gtr@sandclock@@}{\gtr@sandclock@@[]}} |
| 169 |
|
| 170 |
\def\gtr@parse@i n{% |
| 171 |
\@ifnextchar p{\gtr@parse@input@}{\gtr@parse@insert@}} |
| 172 |
|
| 173 |
\def\gtr@parse@input@ put#1{\expandafter\expandafter\expandafter \gtr@parse@graph \csname @@input\endcsname #1 } |
| 174 |
|
| 175 |
\def\gtr@parse@insert@ sert#1{\expandafter\expandafter\expandafter\gtr@parse@graph\csname#1\endcsname} |
| 176 |
|
| 177 |
\def\gtr@parse@x{} |
| 178 |
|
| 179 |
\def\gtr@parse@err{% |
| 180 |
\gtr@error{Parser error}{Some went wrong during parsing your genealogy tree data}% |
| 181 |
} |
| 182 |
|
| 183 |
\def\gtr@parse@error@token{% |
| 184 |
\gtr@error{Parser: unfeasible token}{You probably used some unfeasible token in your genealogy tree data. |
| 185 |
Press return to display this token.}% |
| 186 |
\show\@gtr@token |
| 187 |
} |
| 188 |
|
| 189 |
\long\def\gtr@parse@error#1{% |
| 190 |
\gtr@error{Parser: undefined #1}{Some went wrong during parsing your genealogy tree data}%% |
| 191 |
} |
| 192 |
|
| 193 |
|
| 194 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 195 |
%% Parent Parser |
| 196 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 197 |
|
| 198 |
\def\gtr@handle@continue@parent{% |
| 199 |
\ifx\@gtr@token g% |
| 200 |
\let\@next=\gtr@pparse@g% |
| 201 |
\else% |
| 202 |
\ifx\@gtr@token p% |
| 203 |
\let\@next=\gtr@pparse@p% |
| 204 |
\else |
| 205 |
\ifx\@gtr@token c% |
| 206 |
\let\@next=\gtr@pparse@c% |
| 207 |
\fi% |
| 208 |
\fi% |
| 209 |
\fi% |
| 210 |
} |
| 211 |
|
| 212 |
|
| 213 |
\def\gtr@pparse@c{\@ifnextchar[{\gtr@parent@@c}{\gtr@parent@@c[]}} |
| 214 |
\long\def\gtr@parent@@c[#1]#2{% |
| 215 |
\gtr@trav@@c[#1]{#2}% |
| 216 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@parent}% |
| 217 |
} |
| 218 |
\long\def\gtr@parent@@c@ignore[#1]#2{% |
| 219 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@parent}% |
| 220 |
} |
| 221 |
|
| 222 |
|
| 223 |
\def\gtr@pparse@p{% |
| 224 |
\@ifnextchar a{\gtr@pparse@parent@}{\gtr@pparse@p@}} |
| 225 |
\def\gtr@pparse@parent@ arent{\@ifnextchar[{\gtr@parent@@parent}{\gtr@parent@@parent[]}} |
| 226 |
\long\def\gtr@parent@@parent[#1]#2{% |
| 227 |
\gtr@trav@@parent[#1]{#2}% |
| 228 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@parent}% |
| 229 |
} |
| 230 |
\def\gtr@pparse@p@{\@ifnextchar[{\gtr@parent@@p}{\gtr@parent@@p[]}} |
| 231 |
|
| 232 |
|
| 233 |
\long\def\gtr@parent@@p@normal[#1]#2{% |
| 234 |
\gtr@trav@@p[#1]{#2}% |
| 235 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@parent}% |
| 236 |
} |
| 237 |
\long\def\gtr@parent@@p@malefemale[#1]#2{% |
| 238 |
\ifnum\gtr@c@level<\gtr@complementparents@levellimit\relax% |
| 239 |
\gtr@trav@@complementedparent{g[#1]{#2}p[c@mpl@m@nt@d,complemented]{male}p[c@mpl@m@nt@d,complemented]{female}}% |
| 240 |
\else% |
| 241 |
\gtr@trav@@p[#1]{#2}% |
| 242 |
\fi% |
| 243 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@parent}% |
| 244 |
} |
| 245 |
\long\def\gtr@parent@@p@femalemale[#1]#2{% |
| 246 |
\ifnum\gtr@c@level<\gtr@complementparents@levellimit\relax% |
| 247 |
\gtr@trav@@complementedparent{g[#1]{#2}p[c@mpl@m@nt@d,complemented]{female}p[c@mpl@m@nt@d,complemented]{male}}% |
| 248 |
\else% |
| 249 |
\gtr@trav@@p[#1]{#2}% |
| 250 |
\fi% |
| 251 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@parent}% |
| 252 |
} |
| 253 |
\long\def\gtr@parent@@p@unspecific[#1]#2{% |
| 254 |
\ifnum\gtr@c@level<\gtr@complementparents@levellimit\relax% |
| 255 |
\gtr@trav@@complementedparent{g[#1]{#2}p[c@mpl@m@nt@d,complemented]{}p[c@mpl@m@nt@d,complemented]{}}% |
| 256 |
\else% |
| 257 |
\gtr@trav@@p[#1]{#2}% |
| 258 |
\fi% |
| 259 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@parent}% |
| 260 |
} |
| 261 |
|
| 262 |
|
| 263 |
\def\gtr@pparse@g{\@ifnextchar[{\gtr@parent@@g}{\gtr@parent@@g[]}} |
| 264 |
\long\def\gtr@parent@@g[#1]#2{% |
| 265 |
\gtr@trav@@parent@g[#1]{#2}% |
| 266 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@parent}% |
| 267 |
} |
| 268 |
|
| 269 |
|
| 270 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 271 |
%% Child Parser |
| 272 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 273 |
|
| 274 |
\def\gtr@handle@continue@child{% |
| 275 |
\ifx\@gtr@token g% |
| 276 |
\let\@next=\gtr@cparse@g% |
| 277 |
\else% |
| 278 |
\ifx\@gtr@token p% |
| 279 |
\let\@next=\gtr@cparse@p% |
| 280 |
\else |
| 281 |
\ifx\@gtr@token c% |
| 282 |
\let\@next=\gtr@cparse@c% |
| 283 |
\else |
| 284 |
\ifx\@gtr@token u% |
| 285 |
\let\@next=\gtr@cparse@u% |
| 286 |
\fi |
| 287 |
\fi% |
| 288 |
\fi% |
| 289 |
\fi% |
| 290 |
} |
| 291 |
|
| 292 |
|
| 293 |
\def\gtr@cparse@p{\@ifnextchar[{\gtr@child@@p}{\gtr@child@@p[]}} |
| 294 |
\long\def\gtr@child@@p[#1]#2{% |
| 295 |
\gtr@trav@@p[#1]{#2}% |
| 296 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@child}% |
| 297 |
} |
| 298 |
|
| 299 |
\def\gtr@cparse@c{% |
| 300 |
\@ifnextchar h{\gtr@cparse@child@}{\gtr@cparse@c@}} |
| 301 |
\def\gtr@cparse@child@ hild{\@ifnextchar[{\gtr@child@@child}{\gtr@child@@child[]}} |
| 302 |
\long\def\gtr@child@@child[#1]#2{% |
| 303 |
\gtr@trav@@child[#1]{#2}% |
| 304 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@child}% |
| 305 |
} |
| 306 |
\def\gtr@cparse@c@{\@ifnextchar[{\gtr@child@@c}{\gtr@child@@c[]}} |
| 307 |
\long\def\gtr@child@@c[#1]#2{% |
| 308 |
\gtr@trav@@c[#1]{#2}% |
| 309 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@child}% |
| 310 |
} |
| 311 |
|
| 312 |
\def\gtr@cparse@u nion{\@ifnextchar[{\gtr@child@@union}{\gtr@child@@union[]}} |
| 313 |
\long\def\gtr@child@@union[#1]#2{% |
| 314 |
\gtr@trav@@union[#1]{#2}% |
| 315 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@child}% |
| 316 |
} |
| 317 |
|
| 318 |
\def\gtr@cparse@g{\@ifnextchar[{\gtr@child@@g}{\gtr@child@@g[]}} |
| 319 |
\long\def\gtr@child@@g[#1]#2{% |
| 320 |
\gtr@trav@@child@g[#1]{#2}% |
| 321 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@child}% |
| 322 |
} |
| 323 |
|
| 324 |
|
| 325 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 326 |
%% Union Parser |
| 327 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 328 |
|
| 329 |
\def\gtr@handle@continue@union{% |
| 330 |
\ifx\@gtr@token c% |
| 331 |
\let\@next=\gtr@uparse@c% |
| 332 |
\else% |
| 333 |
\ifx\@gtr@token p% |
| 334 |
\let\@next=\gtr@uparse@p% |
| 335 |
\fi% |
| 336 |
\fi% |
| 337 |
} |
| 338 |
|
| 339 |
\def\gtr@uparse@c{% |
| 340 |
\@ifnextchar h{\gtr@uparse@child@}{\gtr@uparse@c@}} |
| 341 |
\def\gtr@uparse@child@ hild{\@ifnextchar[{\gtr@union@@child}{\gtr@union@@child[]}} |
| 342 |
\long\def\gtr@union@@child[#1]#2{% |
| 343 |
\let\gtr@handle@continue\gtr@handle@continue@child% |
| 344 |
\gtr@trav@@child[#1]{#2}% |
| 345 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@union}% |
| 346 |
} |
| 347 |
\def\gtr@uparse@c@{\@ifnextchar[{\gtr@union@@c}{\gtr@union@@c[]}} |
| 348 |
\long\def\gtr@union@@c[#1]#2{% |
| 349 |
\gtr@trav@@c[#1]{#2}% |
| 350 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@union}% |
| 351 |
} |
| 352 |
|
| 353 |
\def\gtr@uparse@p{\@ifnextchar[{\gtr@union@@p}{\gtr@union@@p[]}} |
| 354 |
\long\def\gtr@union@@p[#1]#2{% |
| 355 |
\gtr@trav@@p[#1]{#2}% |
| 356 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@union}% |
| 357 |
} |
| 358 |
|
| 359 |
|
| 360 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 361 |
%% Sandclock Parser |
| 362 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 363 |
|
| 364 |
\def\gtr@handle@continue@sandclock{% |
| 365 |
\ifx\@gtr@token c% |
| 366 |
\let\@next=\gtr@sparse@c% |
| 367 |
\else% |
| 368 |
\ifx\@gtr@token p% |
| 369 |
\let\@next=\gtr@sparse@p% |
| 370 |
\fi% |
| 371 |
\fi% |
| 372 |
} |
| 373 |
|
| 374 |
|
| 375 |
\long\def\gtr@sandclock@@[#1]#2{% |
| 376 |
\gtr@trav@@sandclock[#1]{#2}% |
| 377 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@graph}% |
| 378 |
} |
| 379 |
|
| 380 |
\def\gtr@sparse@c{% |
| 381 |
\@ifnextchar h{\gtr@sparse@child@}{\gtr@sparse@c@}} |
| 382 |
\def\gtr@sparse@child@ hild{\@ifnextchar[{\gtr@sandclock@@child}{\gtr@sandclock@@child[]}} |
| 383 |
\long\def\gtr@sandclock@@child[#1]#2{% |
| 384 |
\gtr@trav@@child[#1]{#2}% |
| 385 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@sandclock}% |
| 386 |
} |
| 387 |
\def\gtr@sparse@c@{\@ifnextchar[{\gtr@sandclock@@c}{\gtr@sandclock@@c[]}} |
| 388 |
\long\def\gtr@sandclock@@c[#1]#2{% |
| 389 |
\gtr@trav@@c[#1]{#2}% |
| 390 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@sandclock}% |
| 391 |
} |
| 392 |
|
| 393 |
\def\gtr@sparse@p{% |
| 394 |
\@ifnextchar a{\gtr@sparse@parent@}{\gtr@sparse@p@}} |
| 395 |
\def\gtr@sparse@parent@ arent{\@ifnextchar[{\gtr@sandclock@@parent}{\gtr@sandclock@@parent[]}} |
| 396 |
\long\def\gtr@sandclock@@parent[#1]#2{% |
| 397 |
\gtr@trav@@parent[#1]{#2}% |
| 398 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@sandclock}% |
| 399 |
} |
| 400 |
\def\gtr@sparse@p@{\@ifnextchar[{\gtr@sandclock@@p}{\gtr@sandclock@@p[]}} |
| 401 |
\long\def\gtr@sandclock@@p[#1]#2{% |
| 402 |
\gtr@trav@@p[#1]{#2}% |
| 403 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@sandclock}% |
| 404 |
} |
| 405 |
|
| 406 |
|
| 407 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 408 |
%% Traversing |
| 409 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 410 |
|
| 411 |
\def\gtr@set@currentfamily#1{\edef\gtr@currentfamily{\number#1}} |
| 412 |
|
| 413 |
\def\gtr@next@family{% |
| 414 |
\let\gtr@lastfamily=\gtr@currentfamily% |
| 415 |
\ifdef{\gtr@currentfamily}{\gtr@famstack@push{\gtr@currentfamily}}{}% |
| 416 |
\advance\gtr@c@family 1\relax% |
| 417 |
\gtr@set@currentfamily{\gtr@c@family}% |
| 418 |
} |
| 419 |
|
| 420 |
\def\gtr@previous@family{% |
| 421 |
\let\gtr@lastfamily=\gtr@currentfamily% |
| 422 |
\ifnum\gtr@famstack@size>0\relax% |
| 423 |
\gtr@famstack@popto{\gtr@currentfamily}% |
| 424 |
\else% |
| 425 |
\let\gtr@currentfamily=\@undefined% |
| 426 |
\fi% |
| 427 |
} |
| 428 |
|
| 429 |
\def\gtr@set@currentperson#1{\edef\gtr@currentperson{\number#1}} |
| 430 |
|
| 431 |
\def\gtr@next@person{% |
| 432 |
\advance\gtr@c@pid 1\relax% |
| 433 |
\gtr@set@currentperson{\gtr@c@pid}% |
| 434 |
} |
| 435 |
|
| 436 |
\def\gtr@set@level#1{% |
| 437 |
\gtr@c@level#1\relax% |
| 438 |
\gtr@proc@level@opt% |
| 439 |
} |
| 440 |
|
| 441 |
\def\gtr@up@level{% |
| 442 |
\advance\gtr@c@level 1\relax% |
| 443 |
\gtr@proc@level@opt% |
| 444 |
} |
| 445 |
|
| 446 |
\def\gtr@up@level@push{% |
| 447 |
\gtr@levelstack@push{\gtr@level@reference}% |
| 448 |
\gtr@up@level% |
| 449 |
\dimdef\gtr@level@reference{\gtr@level@reference+\gtr@level@size+\gtr@level@distance}% |
| 450 |
} |
| 451 |
|
| 452 |
\def\gtr@up@level@pop{% |
| 453 |
\gtr@up@level% |
| 454 |
\gtr@levelstack@popto{\gtr@level@reference}% |
| 455 |
} |
| 456 |
|
| 457 |
\def\gtr@down@level{% |
| 458 |
\advance\gtr@c@level -1\relax% |
| 459 |
\gtr@proc@level@opt% |
| 460 |
} |
| 461 |
|
| 462 |
\def\gtr@down@level@push{% |
| 463 |
\gtr@levelstack@push{\gtr@level@reference}% |
| 464 |
\dimdef\gtr@level@reference{\gtr@level@reference-\gtr@level@size-\gtr@level@distance}% |
| 465 |
\gtr@down@level% |
| 466 |
} |
| 467 |
|
| 468 |
\def\gtr@down@level@pop{% |
| 469 |
\gtr@down@level% |
| 470 |
\gtr@levelstack@popto{\gtr@level@reference}% |
| 471 |
} |
| 472 |
|
| 473 |
\long\def\gtr@trav@@parent[#1]#2{% |
| 474 |
\gtr@up@level@push% |
| 475 |
\gtr@next@family% |
| 476 |
\gtr@proc@@parent@begin{#1}% |
| 477 |
\ifgtr@ignore% |
| 478 |
\advance\gtr@c@family -1\relax% |
| 479 |
\else% |
| 480 |
\gtr@parse@beginfamily@hook% |
| 481 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@parent}#2x% |
| 482 |
\gtr@parse@endfamily@hook% |
| 483 |
\gtr@parse@complementparents@hook% |
| 484 |
\gtr@proc@@parent@end% |
| 485 |
\fi% |
| 486 |
\gtr@previous@family% |
| 487 |
\gtr@down@level@pop% |
| 488 |
\gtr@parse@afterfamily@hook% |
| 489 |
} |
| 490 |
|
| 491 |
\long\def\gtr@trav@@complementedparent#1{% |
| 492 |
\gtr@up@level@push% |
| 493 |
\gtr@next@family% |
| 494 |
\gtr@proc@@parent@begin{family=complemented family}% |
| 495 |
\ifgtr@ignore% |
| 496 |
\advance\gtr@c@family -1\relax% |
| 497 |
\else% |
| 498 |
\gtr@parse@beginfamily@hook% |
| 499 |
\gtr@parse@graph #1x% |
| 500 |
\gtr@parse@endfamily@hook% |
| 501 |
\gtr@proc@@parent@end% |
| 502 |
\fi% |
| 503 |
\gtr@previous@family% |
| 504 |
\gtr@down@level@pop% |
| 505 |
\gtr@parse@afterfamily@hook% |
| 506 |
} |
| 507 |
|
| 508 |
\long\def\gtr@trav@@child[#1]#2{% |
| 509 |
\gtr@down@level@push% |
| 510 |
\gtr@next@family% |
| 511 |
\gtr@proc@@child@begin{#1}% |
| 512 |
\ifgtr@ignore% |
| 513 |
\advance\gtr@c@family -1\relax% |
| 514 |
\else% |
| 515 |
\gtr@parse@beginfamily@hook% |
| 516 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@child}#2x% |
| 517 |
\gtr@parse@endfamily@hook% |
| 518 |
\gtr@parse@childlesschild@hook% |
| 519 |
\gtr@proc@@child@end% |
| 520 |
\fi% |
| 521 |
\gtr@previous@family% |
| 522 |
\gtr@up@level@pop% |
| 523 |
\gtr@parse@afterfamily@hook% |
| 524 |
} |
| 525 |
|
| 526 |
\long\def\gtr@trav@@sandclock[#1]#2{% |
| 527 |
\gtr@up@level@push% |
| 528 |
\gtr@next@family% |
| 529 |
\gtr@proc@@sandclock@begin{#1}% |
| 530 |
\ifgtr@ignore% |
| 531 |
\advance\gtr@c@family -1\relax% |
| 532 |
\else% |
| 533 |
\gtr@parse@beginfamily@hook% |
| 534 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@sandclock}#2x% |
| 535 |
\gtr@parse@endfamily@hook% |
| 536 |
\gtr@proc@@sandclock@end% |
| 537 |
\fi% |
| 538 |
\gtr@previous@family% |
| 539 |
\gtr@down@level@pop% |
| 540 |
} |
| 541 |
|
| 542 |
\long\def\gtr@trav@@union[#1]#2{% |
| 543 |
\gtr@next@family% |
| 544 |
\gtr@proc@@union@begin{#1}% |
| 545 |
\ifgtr@ignore% |
| 546 |
\advance\gtr@c@family -1\relax% |
| 547 |
\else% |
| 548 |
\gtr@parse@beginfamily@hook% |
| 549 |
\gtr@parse@graphwithhandle{\gtr@handle@continue@union}#2x% |
| 550 |
\gtr@parse@endfamily@hook% |
| 551 |
\gtr@proc@@union@end% |
| 552 |
\fi% |
| 553 |
\gtr@previous@family% |
| 554 |
\gtr@parse@afterfamily@hook% |
| 555 |
} |
| 556 |
|
| 557 |
|
| 558 |
\long\def\gtr@trav@@add@node#1#2#3{% |
| 559 |
\gtr@proc@add@node{#1}{#2}% |
| 560 |
\ifgtr@ignore% |
| 561 |
\advance\gtr@c@pid -1\relax% |
| 562 |
\else% |
| 563 |
#3% |
| 564 |
\fi% |
| 565 |
} |
| 566 |
% \long\def\gtr@trav@@add@node@malefemale#1#2#3{% |
| 567 |
% \gdef\gtr@gtrav@mark{m}% |
| 568 |
% \gtr@proc@add@node{#1}{#2}% |
| 569 |
% \ifgtr@ignore% |
| 570 |
% \advance\gtr@c@pid -1\relax% |
| 571 |
% \else% |
| 572 |
% \csedef{gtr@per@\gtr@currentperson @mark}{\gtr@gtrav@mark}% |
| 573 |
% #3% |
| 574 |
% \fi% |
| 575 |
% } |
| 576 |
% \long\def\gtr@trav@@add@node@femalemale#1#2#3{% |
| 577 |
% \gdef\gtr@gtrav@mark{f}% |
| 578 |
% \gtr@proc@add@node{#1}{#2}% |
| 579 |
% \ifgtr@ignore% |
| 580 |
% \advance\gtr@c@pid -1\relax% |
| 581 |
% \else% |
| 582 |
% \csedef{gtr@per@\gtr@currentperson @mark}{\gtr@gtrav@mark}% |
| 583 |
% #3% |
| 584 |
% \fi% |
| 585 |
% } |
| 586 |
|
| 587 |
|
| 588 |
\long\def\gtr@trav@@parent@g[#1]#2{% |
| 589 |
\gtr@down@level@push% |
| 590 |
\gtr@next@person% |
| 591 |
\def\gtrnodetype{g}% |
| 592 |
\let\gtrifcnode\@secondoftwo% |
| 593 |
\let\gtrifpnode\@secondoftwo% |
| 594 |
\let\gtrifgnode\@firstoftwo% |
| 595 |
\ifcsdef{gtr@fam@\gtr@currentfamily @fam}{% |
| 596 |
\let\gtrifroot\@secondoftwo% |
| 597 |
\let\gtrifparent\@firstoftwo% |
| 598 |
\let\gtrifleaf\@secondoftwo% |
| 599 |
\let\gtrifleafchild\@secondoftwo% |
| 600 |
}{% |
| 601 |
\let\gtrifroot\@firstoftwo% |
| 602 |
\let\gtrifparent\@secondoftwo% |
| 603 |
\let\gtrifleaf\@firstoftwo% |
| 604 |
\let\gtrifleafchild\@firstoftwo% |
| 605 |
}% |
| 606 |
\let\gtrifchild\@firstoftwo% |
| 607 |
\let\gtrifleafparent\@secondoftwo% |
| 608 |
\gtr@trav@@add@node{#1}{#2}{\gtr@proc@@parent@g@content}% |
| 609 |
\gtr@up@level@pop% |
| 610 |
\gtr@parse@afternode@hook% |
| 611 |
} |
| 612 |
|
| 613 |
\long\def\gtr@trav@@child@g[#1]#2{% |
| 614 |
\gtr@next@person% |
| 615 |
\def\gtrnodetype{g}% |
| 616 |
\let\gtrifcnode\@secondoftwo% |
| 617 |
\let\gtrifpnode\@secondoftwo% |
| 618 |
\let\gtrifgnode\@firstoftwo% |
| 619 |
\ifcsdef{gtr@fam@\gtr@currentfamily @fam}{% |
| 620 |
\let\gtrifroot\@secondoftwo% |
| 621 |
\let\gtrifchild\@firstoftwo% |
| 622 |
\let\gtrifleaf\@secondoftwo% |
| 623 |
\let\gtrifleafparent\@secondoftwo% |
| 624 |
}{% |
| 625 |
\let\gtrifroot\@firstoftwo% |
| 626 |
\let\gtrifchild\@secondoftwo% |
| 627 |
\let\gtrifleaf\@firstoftwo% |
| 628 |
\let\gtrifleafparent\@firstoftwo% |
| 629 |
}% |
| 630 |
\let\gtrifparent\@firstoftwo% |
| 631 |
\let\gtrifleafchild\@secondoftwo% |
| 632 |
\gtr@trav@@add@node{#1}{#2}{\gtr@proc@@child@g@content}% |
| 633 |
\gtr@parse@afternode@hook% |
| 634 |
} |
| 635 |
|
| 636 |
\long\def\gtr@trav@@p[#1]#2{% |
| 637 |
\gtr@next@person% |
| 638 |
\def\gtrnodetype{p}% |
| 639 |
\let\gtrifcnode\@secondoftwo% |
| 640 |
\let\gtrifpnode\@firstoftwo% |
| 641 |
\let\gtrifgnode\@secondoftwo% |
| 642 |
\let\gtrifroot\@secondoftwo% |
| 643 |
\let\gtrifchild\@secondoftwo% |
| 644 |
\let\gtrifparent\@firstoftwo% |
| 645 |
\let\gtrifleaf\@firstoftwo% |
| 646 |
\let\gtrifleafchild\@secondoftwo% |
| 647 |
\let\gtrifleafparent\@firstoftwo% |
| 648 |
\gtr@trav@@add@node{#1}{#2}{\gtr@proc@@p@content}% |
| 649 |
\gtr@parse@afternode@hook% |
| 650 |
} |
| 651 |
|
| 652 |
\long\def\gtr@trav@@c[#1]#2{% |
| 653 |
\gtr@down@level@push% |
| 654 |
\gtr@next@person% |
| 655 |
\def\gtrnodetype{c}% |
| 656 |
\let\gtrifcnode\@firstoftwo% |
| 657 |
\let\gtrifpnode\@secondoftwo% |
| 658 |
\let\gtrifgnode\@secondoftwo% |
| 659 |
\let\gtrifroot\@secondoftwo% |
| 660 |
\let\gtrifchild\@firstoftwo% |
| 661 |
\let\gtrifparent\@secondoftwo% |
| 662 |
\let\gtrifleaf\@firstoftwo% |
| 663 |
\let\gtrifleafchild\@firstoftwo% |
| 664 |
\let\gtrifleafparent\@secondoftwo% |
| 665 |
\gtr@trav@@add@node{#1}{#2}{\gtr@proc@@c@content}% |
| 666 |
\gtr@up@level@pop% |
| 667 |
\gtr@parse@afternode@hook% |
| 668 |
} |
| 669 |
|
| 670 |
|
| 671 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 672 |
%% Hooks |
| 673 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 674 |
|
| 675 |
\def\gtr@parse@init@hook#1#2{% |
| 676 |
\ifcsvoid{#1@content}{% |
| 677 |
\csdef{#1}{% |
| 678 |
\letcs\gtr@currentid{#2}% |
| 679 |
\ifdefvoid{\gtr@currentid}{}{\csuse{#1@content}}% |
| 680 |
}% |
| 681 |
}{}% |
| 682 |
} |
| 683 |
|
| 684 |
\def\gtr@parse@appto@hook#1#2#3{% |
| 685 |
\begingroup\edef\x{\endgroup\noexpand\appto\expandonce{\csname #1@content\endcsname}{% |
| 686 |
\noexpand\ifdefstring{\noexpand\gtr@currentid}{\expandonce{#2}}{% |
| 687 |
\noexpand\gtr@parse@graph\expandonce{#3}x}{}% |
| 688 |
}}\x% |
| 689 |
} |
| 690 |
|
| 691 |
|
| 692 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 693 |
%% Parent Autofill |
| 694 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 695 |
|
| 696 |
% precondition: list with exact 2 parents |
| 697 |
\def\gtr@parse@toggle@parents{% |
| 698 |
\letcs\gtr@currentparentlist{gtr@fam@\gtr@currentfamily @par}% |
| 699 |
\def\dodo##1{% |
| 700 |
\def\gtr@tempB{##1}% |
| 701 |
}% |
| 702 |
\def\do##1{% |
| 703 |
\def\gtr@tempA{##1}% |
| 704 |
\let\do\dodo% |
| 705 |
}% |
| 706 |
\dolistloop{\gtr@currentparentlist}% |
| 707 |
\csundef{gtr@fam@\gtr@currentfamily @par}% |
| 708 |
\listcseadd{gtr@fam@\gtr@currentfamily @par}{\gtr@tempB}% |
| 709 |
\listcseadd{gtr@fam@\gtr@currentfamily @par}{\gtr@tempA}% |
| 710 |
\letcs\gtr@currentparentlist{gtr@fam@\gtr@currentfamily @par}% |
| 711 |
} |
| 712 |
|
| 713 |
\def\gtr@parse@complementparents@malefemale{% |
| 714 |
\ifnum\gtr@c@level>\gtr@complementparents@levellimit\relax% |
| 715 |
\else% |
| 716 |
\ifcsdef{gtr@fam@\gtr@currentfamily @par}% |
| 717 |
{% |
| 718 |
\def\dodo##1{% |
| 719 |
\let\gtr@parse@do@complementparents\@secondoftwo% |
| 720 |
}% |
| 721 |
\def\do##1{% |
| 722 |
\let\gtr@parse@do@complementparents\@firstoftwo% |
| 723 |
\letcs\gtr@temp{gtr@per@##1@flag@s}% |
| 724 |
\let\do\dodo% |
| 725 |
}% |
| 726 |
\dolistcsloop{gtr@fam@\gtr@currentfamily @par}% |
| 727 |
\gtr@parse@do@complementparents% |
| 728 |
{% |
| 729 |
\ifdefstring{\gtr@temp}{female}% |
| 730 |
{ |
| 731 |
\gtr@parse@graph p[c@mpl@m@nt@d,complemented]{male}x |
| 732 |
\gtr@parse@toggle@parents% |
| 733 |
}% |
| 734 |
{ |
| 735 |
\gtr@parse@graph p[c@mpl@m@nt@d,complemented]{female}x |
| 736 |
}% |
| 737 |
}{% |
| 738 |
\ifdefstring{\gtr@temp}{female}{\gtr@parse@toggle@parents}{}% |
| 739 |
}% |
| 740 |
}% |
| 741 |
{% |
| 742 |
\gtr@parse@graph p[c@mpl@m@nt@d,complemented]{male}p[c@mpl@m@nt@d,complemented]{female}x |
| 743 |
}% |
| 744 |
\fi% |
| 745 |
} |
| 746 |
|
| 747 |
\def\gtr@parse@complementparents@femalemale{% |
| 748 |
\ifnum\gtr@c@level>\gtr@complementparents@levellimit\relax% |
| 749 |
\else% |
| 750 |
\ifcsdef{gtr@fam@\gtr@currentfamily @par}% |
| 751 |
{% |
| 752 |
\def\dodo##1{% |
| 753 |
\let\gtr@parse@do@complementparents\@secondoftwo% |
| 754 |
}% |
| 755 |
\def\do##1{% |
| 756 |
\let\gtr@parse@do@complementparents\@firstoftwo% |
| 757 |
\letcs\gtr@temp{gtr@per@##1@flag@s}% |
| 758 |
\let\do\dodo% |
| 759 |
}% |
| 760 |
\dolistcsloop{gtr@fam@\gtr@currentfamily @par}% |
| 761 |
\gtr@parse@do@complementparents% |
| 762 |
{% |
| 763 |
\ifdefstring{\gtr@temp}{male}% |
| 764 |
{ |
| 765 |
\gtr@parse@graph p[c@mpl@m@nt@d,complemented]{female}x |
| 766 |
\gtr@parse@toggle@parents% |
| 767 |
}% |
| 768 |
{ |
| 769 |
\gtr@parse@graph p[c@mpl@m@nt@d,complemented]{male}x |
| 770 |
}% |
| 771 |
}{% |
| 772 |
\ifdefstring{\gtr@temp}{male}{\gtr@parse@toggle@parents}{}% |
| 773 |
}% |
| 774 |
}% |
| 775 |
{% |
| 776 |
\gtr@parse@graph p[c@mpl@m@nt@d,complemented]{female}p[c@mpl@m@nt@d,complemented]{male}x |
| 777 |
}% |
| 778 |
\fi% |
| 779 |
} |
| 780 |
|
| 781 |
\def\gtr@parse@complementparents@unspecific{% |
| 782 |
\ifnum\gtr@c@level>\gtr@complementparents@levellimit\relax% |
| 783 |
\else% |
| 784 |
\ifcsdef{gtr@fam@\gtr@currentfamily @par}% |
| 785 |
{% |
| 786 |
\def\dodo##1{% |
| 787 |
\let\gtr@parse@do@complementparents\@secondoftwo% |
| 788 |
}% |
| 789 |
\def\do##1{% |
| 790 |
\let\gtr@parse@do@complementparents\@firstoftwo% |
| 791 |
\let\do\dodo% |
| 792 |
}% |
| 793 |
\dolistcsloop{gtr@fam@\gtr@currentfamily @par}% |
| 794 |
\gtr@parse@do@complementparents% |
| 795 |
{% |
| 796 |
\gtr@parse@graph p[c@mpl@m@nt@d,complemented]{}x |
| 797 |
}{}% |
| 798 |
}% |
| 799 |
{% |
| 800 |
\gtr@parse@graph p[c@mpl@m@nt@d,complemented]{}p[c@mpl@m@nt@d,complemented]{}x |
| 801 |
}% |
| 802 |
\fi% |
| 803 |
} |
| 804 |
|
| 805 |
|
| 806 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 807 |
%% Information |
| 808 |
%%%%%%%%%%%%%%%%%%%%%%% |
| 809 |
|
| 810 |
\def\gtrnodenumber{\gtr@currentperson} |
| 811 |
\def\gtrnodefamily{\gtr@currentfamily} |
| 812 |
\def\gtrnodelevel{\number\gtr@c@level} |
| 813 |
|
| 814 |
\newrobustcmd\gtrifnodeid[2]{\ifdefvoid{\gtr@gkv@id}{#2}{#1}} |
| 815 |
\def\gtrnodeid{\gtrifnodeid{\expandafter\detokenize\expandafter{\gtr@gkv@id}}{???}} |