Debian Codegraph @

texmf-dist/tex/latex/spectralsequences/sseqmain.code.tex

raw
1 %%
2 %% Package: spectralsequences v1.3.3 2023-01-28
3 %% Author: Hood Chatham
4 %% Email: [email protected]
5 %% Date: 2023-01-28
6 %% License: Latex Project Public License
7 %%
8 %% File: sseqmain.code.tex
9 %%
10 %% Defines the main environments and commands
11 %%
12
13
14 %%%%%%%
15 %%%
16 %%% Environment definitions
17 %%%
18 %%%%%%%
19 \def\sseq@usesavedpaths{%
20 \sseq@savedpaths
21 \sseq@clearchangestyles
22 \sseq@tempsavedpaths
23 \gdef\sseq@tempsavedpaths{}%
24 }
25
26 \sseq@addtostorelist\sseq@savedbackgroundpaths{}
27 \sseq@addtostorelist\sseq@restorestyles{}
28
29 \def\sseq@page{\protect\sseq@thepage}
30
31
32 \def\sseqdata{\@ifnextchar[{\sseqdata@}{\sseqdata@[]}}%}
33
34 \def\sseqdata@[#1]{%
35 \edef\sseq@restorefont{\font@name}%
36 \selectfont\nullfont % Avoid space hazards!
37
38 \def\par{}%
39 %
40 \ifx\pgfpictureid\@undefined\else %Uh-oh, we're inside tikz.
41 \sseq@error@n{env-inside-tikz}{sseqdata}\@xp\sseq@breakdataenv
42 \fi
43 \ifsseq@inprogress % Uh-oh, we're already in a sseq environment.
44 \sseq@error@n{env-inside-sseq}{sseqdata}\@xp\sseq@breakdataenv
45 \fi
46 \sseq@inprogresstrue
47 \def\sseq@sseqsetdirectory{/sseqpages}
48 \sseq@keepchangestrue
49 \sseq@storelist@setdefaults
50 \let\sseq@xtickfn\@firstofone\let\sseq@ytickfn\@firstofone % These are default functions, which addtostorelist can't handle.
51 %
52 \ifx\sseq@xmin@default\sseq@infinity
53 \let\sseq@xminmax\sseq@xminmax@active
54 \fi
55 \ifx\sseq@ymin@default\sseq@infinity
56 \let\sseq@yminmax\sseq@yminmax@active
57 \fi
58 \ifsseq@mathnodes
59 \let\sseq@maybemathswitch=$\@gobble$
60 \fi
61 %
62 % copy commands into the user namespace.
63 \sseq@installmacros
64 \sseq@installmsghooks
65 \sseq@install@xparse@Uarggrabber
66 % The behavior of xmax and xmin is very particular, so it's best not to mess with them.
67 % In particular, they shouldn't be expanded until printing no matter what, but we don't want
68 % \pgfmathparse to barf on them. \pgfmathparse really doesn't like engine protected macros,
69 % so in no case should this be engine protected. (Wish we could test an argument for the presence
70 % of engine protected macros). If we try to do that, \sseq@ifpgfmathexpr will break in
71 % \sseq@tikzprimitives@coords@notaclass@handle@.
72 \def\xmin{\protect\sseq@xmin}\def\xmax{\protect\sseq@xmax}
73 \def\ymin{\protect\sseq@ymin}\def\ymax{\protect\sseq@ymax}
74 %
75 \sseq@modtikzcommands % Defer evaluation of tikz primitives
76 \sseq@patchfor % patch \foreach to work with deferred macros
77 \pgfkeys{/handlers/first char syntax/the character "/.initial=\sseq@handlequote} % install quotes parsing
78 %
79 %
80 \pgfqkeys{/sseqpages/global/name only}{#1}
81 \@ifundefined{sseq@thename}{\sseq@error{env-data-no-name}\sseq@breakdataenv}{}
82 \sseq@obj@ifundef{exists}{
83 \sseq@obj@gdef{exists}{}
84 \pgfqkeys{/sseqpages/global}{{\sseq@thename} options/.code={}}
85 }{
86 \ifsseq@updateexisting\else
87 \sseq@error@x{env-data-already-exist}{\sseq@thename}% this could be a warning
88 \fi
89 \sseq@restorestyles
90 \sseq@getcmds
91
92 }
93 \sseq@setsavedpaths{standard}
94 %
95 % the default option handler for /sseqpages/global adds to \sseq@currentoptionpath options
96 \let\sseq@currentoptionpath\sseq@thename
97 \pgfqkeys{/sseqpages/global}{#1}
98 \ifx\sseq@targetx\pgfutil@empty\else
99 \sseq@hasdegreetrue
100 \fi
101 \sseq@eval{
102 \global\let\@xp\@nx\csname pgfk@/sseqpages/global/{\sseq@currentoptionpath} options/.@cmd\endcsname
103 \@xp\@nx\csname pgfk@/sseqpages/global/{\sseq@currentoptionpath} options/.@cmd\endcsname
104 }
105 \sseq@savedpaths@xadd{\@nx\sseq@style@object{\sseq@stylelist}}
106 \sseq@savedpaths@add{\begingroup\sseq@startcontentmarker} % prevent some of the two-pass user macros horrors
107 \let\sseq@error@setup\sseq@error@setup@withinfo
108 }
109 \let\sseq@startcontentmarker\relax
110
111 % Just store all the settings
112 \def\endsseqdata{%
113 \let\sseq@error@setup\sseq@error@setup@noinfo
114 \sseq@checkend{sseqdata}%
115 \sseq@savedpaths@add{\endgroup} % prevent some of the two-pass user macros horrors
116 \xdef\sseq@restorestyles{\sseq@stylelist}%
117 \sseq@storecmds
118 \ignorespacesafterend
119 \sseq@breakpoint
120 }
121
122 \def\sseqpage{\@ifnextchar[{\sseqpage@}{\sseqpage@[]}} %]
123
124 \def\sseqpage@[#1]{%
125 \edef\sseq@restorefont{\font@name}%
126 \selectfont\nullfont % Avoid space hazards!
127 \def\par{}%
128 %
129 \ifx\pgfpictureid\@undefined\else %Uh-oh, we're inside tikz.
130 \sseq@error@n{env-inside-tikz}{sseqpage}\@xp\sseq@breakpageenv
131 \fi
132 \ifsseq@inprogress % Uh-oh, we're already in a sseq environment. This is not good.
133 \sseq@error@n{env-inside-sseq}{sseqpage}\@xp\sseq@breakpageenv
134 \fi
135 \sseq@inprogresstrue
136 \sseq@ispageenvtrue
137 \def\sseq@sseqsetdirectory{/sseqpages}
138 %
139 % \ifsseq@mathnodes
140 % \let\sseq@maybemathswitch=$\@gobble$
141 % \fi
142 %
143 % Copy commands into user namespace
144 \sseq@installmacros
145 \sseq@installmsghooks
146 \sseq@install@xparse@Uarggrabber
147 \def\xmin{\protect\sseq@xmin}\def\xmax{\protect\sseq@xmax}
148 \def\ymin{\protect\sseq@ymin}\def\ymax{\protect\sseq@ymax}
149 \sseq@modtikzcommands % Redefine tikz primitives to store themselves in the appropriate place
150 \sseq@patchfor % Change foreach to record it's variable values in the appropriate places
151 \pgfkeys{/handlers/first char syntax/the character "/.initial=\sseq@handlequote}% install quotes parsing
152 %
153 \gdef\sseq@pagecleanup{}% For undoing local option settings
154 %
155 \def\sseq@thepage{0}% page defaults to 0
156 \def\thepage{\sseq@printpageas}
157 \def\page{\sseq@printnum@inftytosymbol{\sseq@thepage}}
158 \sseq@thepagecount=\z@
159 \pgfqkeys{/sseqpages/global/name only}{#1}% Get the name
160 \sseq@tempiftrue
161 \ifsseq@hasname
162 \sseq@obj@ifundef{exists}{
163 \sseq@error@x{env-page-not-exist}{\sseq@thename} % This could be a warning
164 \sseq@obj@gdef{exists}{}
165 \let\sseq@currentoptionpath\sseq@thename
166 \pgfqkeys{/sseqpages/global}{{\sseq@thename} options/.code={}}
167 \sseq@keepchangestrue
168 \sseq@keepglobaloptionstrue
169 \sseq@setsavedpaths{standard}
170 }{
171 \sseq@restorestyles
172 \sseq@getcmds
173 \ifsseq@keepchanges
174 \sseq@setsavedpaths{standard}
175 \else
176 \sseq@setsavedpaths{temporary}
177 \fi
178 \sseq@tempiffalse
179 \def\sseq@currentoptionpath{this page}
180 \pgfqkeys{/sseqpages/global}{{this page} options/.code={},#1}
181 }
182 \else
183 \edef\sseq@thename{temp@sseq@number@\the\sseq@anonsseqcount}
184 \global\advance\sseq@anonsseqcount1
185 \sseq@setsavedpaths{temporary}
186 \fi
187 \ifsseq@tempif % Either the spectral sequence has no name, or it has a name but no such existed.
188 \sseq@storelist@setdefaults
189 \sseq@savedpaths@xadd{\sseq@stylelist}
190 \let\sseq@currentoptionpath\sseq@thename
191 \pgfqkeys{/sseqpages/global}{{\sseq@thename} options/.code={},{this page} options/.code={},#1}
192 \sseq@eval{
193 \global\let\@xp\@nx\csname pgfk@/sseqpages/global/{\sseq@currentoptionpath} options/.@cmd\endcsname
194 \@xp\@nx\csname pgfk@/sseqpages/global/{\sseq@currentoptionpath} options/.@cmd\endcsname
195 }
196 \fi
197 %
198 \ifsseq@specifiedxrange
199 \let\sseq@xminmax\@gobbletwo
200 \else
201 \let\sseq@xminmax\sseq@xminmax@active
202 \fi
203 \ifsseq@specifiedyrange
204 \let\sseq@yminmax\@gobbletwo
205 \else
206 \let\sseq@yminmax\sseq@yminmax@active
207 \fi
208 %
209 \sseq@savedpaths@xadd{\sseq@stylelist}
210 \sseq@savedpaths@add{\begingroup} % prevent some of the two-pass user macros horrors
211 \ifx\sseq@targetx\pgfutil@empty\else
212 \sseq@hasdegreetrue
213 \fi
214 \let\sseq@error@setup\sseq@error@setup@withinfo
215 }
216
217 % Here we do all of the work to actually print the page
218 \def\endsseqpage{
219 \let\sseq@error@setup\sseq@error@setup@noinfo
220 \sseq@checkend{sseqpage}
221 \sseq@savedpaths@add{\endgroup} % prevent some of the two-pass user macros horrors
222 %
223 \sseq@xscalecm=\sseq@xscale cm
224 \sseq@yscalecm=\sseq@yscale cm
225 %
226 % check that range is okay
227 %
228 \ifx\sseq@xmin\sseq@infinity\sseq@error{no-range}\def\sseq@xmin{0}\def\sseq@xmax{0}\@xp\sseq@break\fi % could be warning
229 \ifx\sseq@ymin\sseq@infinity\sseq@error{no-range}\def\sseq@ymin{0}\def\sseq@ymax{0}\@xp\sseq@break\fi
230 \let\xmin\sseq@xmin
231 \let\xmax\sseq@xmax
232 \let\ymin\sseq@ymin
233 \let\ymax\sseq@ymax
234 %
235 \ifnum\numexpr\sseq@xmax-\sseq@xmin\relax>\numexpr\maxdimen/\dimexpr1pt\relax-1\relax
236 \sseq@error@xx{range-super-overflow}{x}
237 {from \sseq@xmin\space to \sseq@xmax\space (xmax - xmin = \the\numexpr\sseq@xmax-\sseq@xmin)}
238 \@xp\sseq@break
239 \fi
240 \ifnum\numexpr\sseq@ymax-\sseq@ymin\relax>\numexpr\maxdimen/\dimexpr1pt\relax-1\relax
241 \sseq@error@xx{range-super-overflow}{y}
242 {from \sseq@ymin\space to \sseq@ymax\space (ymax - ymin = \the\numexpr\sseq@ymax-\sseq@ymin)}
243 \@xp\sseq@break
244 \fi
245 %
246 \sseq@setlayoutparameters
247 \ifsseq@rangecheck
248 % Calculate available space
249
250 % We might need to know the dimensions of the tick marks in order to calculate "margin" size.
251 \bgroup
252 \@xp\tikzset\@xp{\sseq@xtickstyle}
253 \pgfmathparse{height("\sseq@xmin") + depth("\sseq@xmin")}
254 \edef\sseq@xlabelheight{\pgfmathresult pt}
255 \sseq@smuggle@macro\sseq@xlabelheight
256 \egroup
257 \bgroup
258 \@xp\tikzset\@xp{\sseq@ytickstyle}
259 \pgfmathparse{max(width("\sseq@ymax"), width("\sseq@ymin"))}
260 \edef\sseq@maxylabelwidth{\pgfmathresult pt}
261 \sseq@smuggle@macro\sseq@maxylabelwidth
262 \egroup
263
264 % "totaldirmargin" isn't really quite margin: it's the distance between
265 % the bounding box (xmin, ymin) -- (xmax, ymax) and the bounding box of
266 % the resulting figure.
267 %
268 % By subtracting the "margin" distance from the page width / height, we
269 % get the amount of space available for the content.
270 \sseq@tempxdimen = \dimexpr \linewidth - \sseq@totalhorizontalmargin@yborder - 0.1pt
271 \sseq@tempydimen = \dimexpr \textheight - \sseq@totalverticalmargin@xborder - 0.1pt
272 %
273 \ifsseq@insidewaysenv
274 % Swap availability measurements
275 \sseq@tempdimen=\sseq@tempxdimen
276 \sseq@tempxdimen=\sseq@tempydimen
277 \sseq@tempydimen=\sseq@tempdimen
278 \fi
279 %
280 % \showthe\dimexpr\dimexpr \sseq@tempxdimen - \sseq@xscale cm * (\sseq@xmax-\sseq@xmin)\relax
281 % Compare space available to range * scale.
282 \ifdim \sseq@tempxdimen < \dimexpr \sseq@xscale cm * (\sseq@xmax-\sseq@xmin)\relax
283 % this will divide by zero if somehow we overflow the space on page
284 % while the range is 0. Hopefully no one will ever manage that.
285 \pgfmathparse{\sseq@tempxdimen/1cm/(\sseq@xmax-\sseq@xmin)} % max x range
286 \sseq@tempx = \numexpr \sseq@tempxdimen /\sseq@xscalecm \relax % max xscale
287 \sseq@error@xxxx{range-overflow}{x}
288 {from \sseq@xmin\space to \sseq@xmax\space (xmax - xmin = \the\numexpr\sseq@xmax-\sseq@xmin)}
289 {\the\sseq@tempx}% max x range
290 {\pgfmathresult}% max xscale
291 %\@xp\sseq@break
292 \fi
293 %
294 \relax % Not sure why we need this...
295 %
296 % \showthe\dimexpr\dimexpr \sseq@tempydimen - \sseq@yscale cm * (\sseq@ymax-\sseq@ymin)\relax
297 \ifdim \sseq@tempydimen < \dimexpr \sseq@yscale cm * (\sseq@ymax-\sseq@ymin)\relax
298 \sseq@tempy = \numexpr \sseq@tempydimen /\sseq@yscalecm \relax % max y range
299 \pgfmathparse{\sseq@tempydimen/1cm/(\sseq@ymax-\sseq@ymin)} % max yscale
300 \sseq@error@xxxx{range-overflow}{y}
301 {from \sseq@ymin\space to \sseq@ymax\space (ymax - ymin = \the\numexpr\sseq@ymax-\sseq@ymin)}
302 {\the\sseq@tempy}% max y range
303 {\pgfmathresult} % max yscale
304 %\@xp\sseq@break
305 \fi
306 \fi
307 %
308 % Really this could be anything between -\sseq@xmin and -\sseq@xmax and it wouldn't matter. We'll split the difference.
309 \sseq@xoffset=\numexpr\sseq@intdivceiling{\numexpr-\sseq@xmin-\sseq@xmax\relax}{\numexpr4*\sseq@xgridstep\relax}*(2*\sseq@xgridstep)\relax
310 \sseq@yoffset=\numexpr\sseq@intdivceiling{\numexpr-\sseq@ymin-\sseq@ymax\relax}{\numexpr4*\sseq@ygridstep\relax}*(2*\sseq@ygridstep)\relax
311 %
312 %
313 \def\sseq@temp{\sseq@novalue}
314 \ifx\sseq@printpageas\sseq@temp
315 \def\sseq@printpageas{Page $2$ (all differentials)}%
316 \fi
317 %
318 %
319 \tikzset{
320 z=0pt,
321 every path/.style={},
322 every node/.style={}
323 }
324 \let\errmessage\sseq@errmessage@std
325 \begin{tikzpicture}[/sseqpages/global/{default} options,\ifsseq@hasname/sseqpages/global/{\sseq@thename} options\fi,/sseqpages/global/{this page} options]%
326 \sseq@sseqstyle@globalpart
327 \sseq@globaldetonetransform
328 \sseq@globalscaletransform
329 %
330 \let\sseq@transform\sseq@error@illegaltransform % Disallow most coordinate transforms
331 \let\sseq@shifttransform\sseq@checkshifttransform % Allow shifts as long as they are by integers and have no units.
332 %
333 \sseq@setupclip
334 %
335 \sseq@patchtikzcoords
336 %
337 \pgfonlayer{background}%
338 % Axes labels only occur once per page, so the cost of typesetting them with tikz doesn't matter ... THANK GOD
339 \ifx\sseq@title\pgfutil@empty\else
340 \ifsseq@drawtitle
341 \sseq@eval{\@nx\node[
342 /sseqpages/global/every title,
343 above=\sseq@topclippadding+5pt
344 ] {\unexpanded\expandafter{\sseq@title}};
345 }
346 \fi
347 \fi
348 % Don't touch the shifts -- they are very persnickety.
349 \ifx\sseq@xaxislabel\pgfutil@empty\else\ifsseq@drawxaxislabel
350 \sseq@eval{\noexpand\node[
351 align=center,
352 /sseqpages/global/every x axis label,
353 below,
354 shift={\sseq@xlabelposition},
355 ] {\unexpanded\expandafter{\sseq@xaxislabel}};}
356 \fi\fi
357 \ifx\sseq@yaxislabel\pgfutil@empty\else\ifsseq@drawyaxislabel
358 \sseq@eval{\noexpand\node[
359 align=center,
360 /sseqpages/global/every y axis label,
361 above,
362 rotate=90,
363 shift={\sseq@ylabelposition},
364 ] {\unexpanded\expandafter{\sseq@yaxislabel}};}
365 \fi\fi
366 %
367 \sseq@grid
368 \sseq@handlexaxis % Draw the axis with pgf primitives. These are defined in sseqdrawing.code.tex
369 \sseq@handleyaxis
370 \endpgfonlayer
371 %
372 \ifsseq@mathnodes
373 \tikzset{execute at begin node=$,execute at end node=$}%
374 \fi
375 %
376 \begingroup
377 \sseq@savedbackgroundpaths
378 \endgroup
379 %
380 \sseq@useclip
381 %
382 \ifsseq@drawdifferentials\else
383 \let\sseq@differential@object\@gobble
384 \fi
385 \ifsseq@drawstructlines\else
386 \let\sseq@structline@object\@gobble
387 \fi
388 %
389 \sseq@usesavedpaths
390 %
391 \ifsseq@keepchanges
392 \xdef\sseq@restorestyles{\sseq@stylelist}
393 \fi
394 \end{tikzpicture}%
395 \ifsseq@keepchanges
396 \sseq@storecmds % store changes
397 \else
398 \sseq@pagecleanup % undo any changes specific to this page
399 \fi
400 \sseq@breakpoint
401 \ignorespacesafterend
402 }
403
404 % Shorthand for sseqpage with empty body
405 \def\printpage[#1]{%
406 \begin{sseqpage}[#1]%
407 \end{sseqpage}%
408 }
409
410
411 \def\SseqCopyPage#1#2#3{
412 \begingroup
413 \def#1{\begingroup}
414 \global\let\sseq@copymacro\empty
415 \def\sseq@thename{#2}
416 \global\let\sseq@savedpaths@save\sseq@savedpaths
417 \sseq@storelist@get\sseq@savedpaths
418 \def\sseq@thepage{#3}
419 \sseq@thepagecount=#3\relax
420 \def\sseq@beginscope@object{\sseq@g@addto@macro#1{\sseq@savedpaths@add{\sseq@beginscope@object}}}
421 \def\sseq@endscope@object{\sseq@g@addto@macro#1{\sseq@savedpaths@add{\sseq@endscope@object}}}
422 \def\sseq@scope@object##1{\sseq@g@addto@macro#1{\sseq@savedpaths@add{\sseq@scope@object{##1}}}}
423 \def\sseq@style@object##1{\sseq@g@addto@macro#1{\sseq@savedpaths@add{\sseq@style@object{##1}}}}
424 \let\sseq@class@drawnode\sseq@copypage@addclass
425 \let\sseq@differential@object\@gobble
426 \let\sseq@structline@draw\sseq@copypage@addstructline
427 \let\sseq@extension@draw\sseq@copypage@addextension
428 \let\sseq@tikzpath@object\@gobble
429 \let\sseq@pgfkeysdocommand\@gobbletwo
430 \sseq@savedpaths
431 \sseq@g@addto@macro#1{\endgroup}
432 \endgroup
433 \@xp\let\csname\sseq@macroname#1 copiedcode\endcsname\sseq@copymacro
434 \DeclareSseqGroup #1 {} { \csname\sseq@macroname#1 copiedcode\endcsname }
435 \let\sseq@savedpaths\sseq@savedpaths@save
436 }
437
438 \def\sseq@copypage@addclass#1{
439 \sseq@x@addto@macro\sseq@copymacro{\@nx\sseq@class@copy{\sseq@thename}{#1}}
440 }
441
442 \def\sseq@copypage@addstructline#1{
443 \sseq@x@addto@macro\sseq@copymacro{\@nx\sseq@structline@copy{\sseq@thename}{#1}}
444 }
445
446 \def\sseq@copypage@addextension#1{
447 \sseq@x@addto@macro\sseq@copymacro{\@nx\sseq@extension@copy{\sseq@thename}{#1}}
448 }
449
450
451 %%% Scope
452 \newcount\sseq@scope@savestackid
453 \def\sseq@scope@secondpasstoks{}
454 \def\sseq@scope{\@ifnextchar[{\sseq@scope@}{\sseq@scope@[]}}%]
455 \def\sseq@scope@[#1]{%
456 \sseq@scope@savedpaths@add{\sseq@beginscope@object}%
457 % This is a funky hack to fix a problem with shifts. On tmfass, if we don't handle shifts specially, we actually put so much stuff into
458 % this \sseq@scope@secondpasstoks macro that we exceed TeX's upper bound for the maximum total macro memory. Or something like that -- I don't understand the error,
459 % but it definitely only depends on how much stuff there is overall and on there being lots of scopes, not on any particular part of the diagram.
460 % Anyways, to avoid this excessive storage demand, we don't put the shifts into the scope toks and apply them tons of times, we just do them once.
461 \let\sseq@options@scopeshiftsecondpass\sseq@scope@savedpaths@add
462 \sseq@processoptions{scope}{#1}% outputs into \sseq@savedoptioncode
463 \edef\sseq@scope@secondpasstoks{\unexpanded\@xp{\sseq@scope@secondpasstoks}\unexpanded\@xp{\sseq@savedoptioncode}}
464 \sseq@eval{\@nx\sseq@scope@savedpaths@add{\@nx\sseq@scope@object{\sseq@scope@toks{\unexpanded\@xp{\sseq@scope@secondpasstoks}}}}}%
465 %\advance\sseq@scope@savestackid\@ne
466 %\sseq@savestack@name{scope@save\the\sseq@scope@savestackid}
467 }
468 \def\sseq@endscope{%
469 \sseq@scope@savedpaths@add{\sseq@endscope@object}
470 %\sseq@restorestack@name{scope@save\the\sseq@scope@savestackid
471 }
472
473
474
475
476
477
478
479 \protected\def\sseq@xcoord{}\protected\def\sseq@ycoord{}
480
481
482 %%% "Quick" commands for "compiled" code.
483 \def\sseq@qclass(#1,#2){
484 \sseq@obj@inccheckdef{partcoord.(#1,#2).numnodes}
485 \edef\tempn{\sseq@obj{partcoord.(#1,#2).numnodes}}
486 \edef\classname{class.(#1,#2,\tempn)}
487 \sseq@obj@xdef{\classname.n}{\tempn}
488 \sseq@obj@xdef{\classname.num}{0}
489 \sseq@obj@xdef{\classname[0].page}{\sseq@infinity}
490 \sseq@savedpaths@addclass{class.(#1,#2,\tempn)}
491 }
492 \def\sseq@qclassnamed(#1,#2)#3{
493 \sseq@qclass(#1,#2)
494 \def\sseq@class@name{#3}
495 \sseq@obj@xdef{\classname[0].name}{\sseq@class@name}
496 \sseq@obj@xdef{class.namedclass.\detokenize\@xp{\sseq@class@name}}{#1,#2,\tempn}
497 }
498
499 \def\sseq@qdnamed#1(#2)(#3){\sseq@eval{\@nx\sseq@qd#1(\sseq@obj{class.namedclass.\detokenize{#2}})(\sseq@obj{class.namedclass.\detokenize{#3}})}}
500 \def\sseq@qd#1(#2,#3,#4)(#5,#6,#7){
501 \bgroup
502 \def\sseq@dname{d.#1(#2,#3,#4)(#5,#6,#7)}
503 \def\source{(#2,#3,#4)}
504 \def\target{(#5,#6,#7)}
505 \sseq@obj@gdef{\[email protected]}{#1}
506 \sseq@obj@gdef{\[email protected]}{(#2,#3,#4)}
507 \sseq@obj@gdef{\[email protected]}{(#5,#6,#7)}
508 \sseq@d@setpageminrec{class.\source}{#1}{source}% automatically handles \sseq@cleanup@obj
509 \sseq@d@setpageminrec{class.\target}{#1}{target}
510 \sseq@savedpaths@adddifferential{\sseq@dname}
511 \egroup
512 }
513
514 \def\sseq@qstructlinenamed(#1)(#2){\sseq@eval{\@nx\sseq@qstructline(\sseq@obj{class.namedclass.\detokenize{#1}})(\sseq@obj{class.namedclass.\detokenize{#2}})}}
515 \def\sseq@qstructline(#1,#2,#3)(#4,#5,#6){
516 \def\source{(#1,#2,#3)}
517 \def\target{(#4,#5,#6)}
518 \sseq@obj@xdef{structline.\source\target.num}{0}
519 \def\sseq@pagemin{0}
520 \edef\sseq@structlinename{structline.\source\target[\sseq@obj{structline.\source\target.num}]}
521 \sseq@cleanup@obj{\[email protected]}
522 \sseq@obj@xdef{\[email protected]}{\sseq@infinity}
523 \sseq@obj@xdef{\[email protected]}{\sseq@pagemin}
524 \sseq@obj@xdef{\[email protected]}{\source}
525 \sseq@obj@xdef{\[email protected]}{\target}
526 \sseq@class@adddependence{class.\source}{\sseq@structlinename}% If the source or target is already dead, this will set structlinename.page
527 \sseq@class@adddependence{class.\target}{\sseq@structlinename}
528 \sseq@savedpaths@addstructline{structline.\source\target}
529 %\sseq@cleanup@obj{\[email protected]}
530 %\sseq@obj@xdef{\[email protected]}{\ifsseq@needstikz\@nx\sseq@needstikztrue\fi\unexpanded\@xp{\sseq@savedoptioncode}}
531 }
532
533
534
535 %%%%%
536 %%
537 %% The main commands
538 %%
539 %%%%%
540 %%% \class, \classoptions, \replaceclass
541 \sseq@DeclareDocumentCommand\class{or()}{%
542 \begingroup
543 \sseq@loadinputline
544 \IfNoValueT{#2}{\sseq@break}
545 \sseq@xsetthiscall{\string\class\IfNoValueF{#1}{[\unexpanded{#1}]}\unexpanded{(#2)}}%
546 \sseq@options@firstpassmode
547 \the\sseq@sseqstyle
548 \the\sseq@classstyle
549 \the\sseq@scope@toks
550 \sseq@options@normalmode
551 \IfNoValueF{#1}{%
552 \sseq@processoptions{class}{#1}% Outputs result into \sseq@savedoptioncode
553 }%
554 %
555 \@ifundefined{sseq@class@page}{}{\sseq@error@xxx{cmdoptions-only}{page} {\string\class}{\string\classoptions}}% could be warnings
556 \@ifundefined{sseq@gen} {}{\sseq@error@xxx{cmdoptions-only}{generation}{\string\class}{\string\classoptions}}
557 %
558 \sseq@cparsecoord{#2}{}%
559 \ifnum\csname sseq@\sseq@classpattern @maxclasses\endcsname<\nodenum\relax
560 \sseq@error@xxxx{classpattern-too-many-classes}{(\partialcoord)}{\nodenum}{\sseq@classpattern}{\@xp\the\csname sseq@\sseq@classpattern @maxclasses\endcsname}
561 \sseq@breakfi
562 \fi
563 %%%% No more breaks after this point
564
565 \sseq@processlabels % This sets up the label nodes, now that we know the position of the class (I think that's what we needed?)
566 \sseq@class@main % We segment off the main part of the class so that we can call it separately from the copy method
567 \sseq@breakpoint
568 \endgroup
569 }
570 %
571 \def\sseq@class@main{
572 \ifx\sseq@classinsert\empty
573 % by default, just insert to the right of previous classes
574 \edef\sseq@classinsert{\nodenum}
575 \else
576 \ifnum\sseq@classinsert<\z@
577 % negative 1 is where we would normally insert things
578 \edef\sseq@classinsert{\the\numexpr\nodenum+\sseq@classinsert+1}
579 \fi
580 \ifnum\sseq@classinsert<\@ne
581 \def\sseq@classinsert{1}
582 \fi
583 \ifnum\sseq@classinsert>\nodenum\relax
584 \edef\sseq@classinsert{\nodenum}
585 \fi
586 \ifnum\nodenum>\@ne
587 \@xp\sseq@class@adjustclasses\@xp{\partialcoord} % Adjust all of the indices of the classes to the right of the one we're inserting
588 \fi
589 \fi
590 %
591 %
592 \sseq@xminmax{\xcoord}{\ycoord}%
593 \sseq@yminmax{\xcoord}{\ycoord}%
594 \sseq@cleanup@obj{partcoord.(\partialcoord).numnodes}%
595 \sseq@obj@xdef{partcoord.(\partialcoord).numnodes}{\nodenum}%
596 \edef\classname{class.\coord[0]}%
597 \ifx\sseq@class@tag\pgfutil@empty\else
598 \sseq@obj@ifdef{partcoord.(\partialcoord).tag.\sseq@class@tagprefix\sseq@class@tag}{
599 \sseq@error@xx{class-tag-already-defined}{\sseq@class@tagprefix\sseq@class@tag}{(\partialcoord)}% could be warning
600 }{}
601 \sseq@cleanup@obj{class.\coord.tag}
602 \sseq@obj@xdef{class.\coord.tag}{\sseq@class@tagprefix\sseq@class@tag}
603 \sseq@cleanup@obj{partcoord.(\partialcoord).tag.\sseq@class@tagprefix\sseq@class@tag}
604 \sseq@obj@xdef{partcoord.(\partialcoord).tag.\sseq@class@tagprefix\sseq@class@tag}{\nodenum}%
605 \fi
606 \ifx\sseq@class@name\pgfutil@empty\else
607 \sseq@cleanup@obj{\classname.name}
608 \sseq@cleanup@obj{class.namedclass.\detokenize\@xp{\sseq@class@name}}
609 \sseq@obj@xdef{\classname.name}{\sseq@class@name}
610 \sseq@obj@xdef{class.namedclass.\detokenize\@xp{\sseq@class@name}}{\coordnopar}
611 \fi
612 \sseq@pushstack@\coord
613 %
614 %
615 \sseq@obj@gdef{class.\coord.num}{0}% For \replaceclass
616 \sseq@obj@xdef{\classname.page}{\sseq@infinity}%
617 \sseq@obj@xdef{class.\coord.n}{\sseq@classinsert}
618 \ifx\sseq@familylist\pgfutil@empty\else
619 \sseq@obj@xodef{\classname.familylist}{\sseq@familylist}
620 \fi
621 \ifx\sseq@savedoptioncode\pgfutil@empty\else
622 \sseq@obj@xodef{\classname.options}{\sseq@savedoptioncode}%
623 \fi
624 \ifx\sseq@classnodetext\pgfutil@empty\else
625 \sseq@obj@xodef{\classname.nodetext}{\sseq@classnodetext}
626 \fi
627 \ifx\sseq@classnodetextoptions\pgfutil@empty\else
628 \sseq@obj@xodef{\classname.nodetext.options}{\sseq@classnodetextoptions}
629 \fi
630 \ifx\sseq@classlabelnodes\pgfutil@empty\else
631 \sseq@obj@xodef{\classname.labelnodes}{\sseq@classlabelnodes}%
632 \fi
633 \ifcsname sseq@class@showname\endcsname
634 \sseq@obj@xodef{\classname.showname}{\sseq@class@showname}
635 \fi
636 \ifsseq@needstikz
637 \sseq@obj@xdef{\classname.needstikz}{\sseq@needstikztrue}%
638 \fi
639 \@ifundefined{sseq@tempoffset}{}{%
640 \@xp\tikz@scan@one@point\@xp\sseq@setoffset\sseq@tempoffset
641 }%
642 \ifx\sseq@tooltip\pgfutil@empty\else
643 \sseq@obj@protectedxdef{\classname.tooltip}{\sseq@tooltip}
644 \fi
645 %
646 \sseq@savedpaths@addclass{class.\coord}%
647 }
648 \def\sseq@setoffset#1{\sseq@obj@gdef{\classname.offset}{\pgftransformshift{#1}}}
649
650 \def\sseq@copy@nameprefix{}
651
652 \def\sseq@class@copy#1#2{
653 \begingroup
654 \let\sseq@thename@saved\sseq@thename
655 \def\sseq@thename{#1}
656 \sseq@lettoobj\sseq@familylist{#2.familylist}
657 \sseq@lettoobj\sseq@savedoptioncode{#2.options}
658 \sseq@lettoobj\sseq@classnodetext{#2.nodetext}
659 \sseq@lettoobj\sseq@classnodetextoptions{#2.nodetext.options}
660 \sseq@lettoobj\sseq@classlabelnodes{#2.labelnodes}
661 \sseq@obj@ifdef{#2.showname}{\sseq@lettoobj\sseq@class@showname{#2.showname}}{}
662 \sseq@lettoobj\sseq@class@name{#2.name}
663 \edef\sseq@class@name{\unexpanded\@xp{\sseq@copy@nameprefix}\unexpanded\@xp{\sseq@class@name}}
664 \sseq@obj{#2.needstikz}
665 \sseq@lettoobj\sseq@tooltip{#2.tooltip}
666 \sseq@class@getparts#2.
667 \sseq@quieterror{class-tag-already-defined}
668 \edef\sseq@class@tag{copiedfrom\sseq@thisposnum}
669 \let\sseq@thename\sseq@thename@saved
670 \sseq@eval{\@nx\sseq@cparsecoord{\the\sseq@tempx,\the\sseq@tempy}}
671 \let\sseq@pushstack@\@gobble
672 \sseq@class@main
673 \endgroup
674 }
675
676
677 % This is for use with "insert" key. Add one to offset index of each class later than the one currently being inserted
678 % Takes the partial coordinate "x,y" in #1, and the position that the new class is being inserted into in \sseq@classinsert.
679 \def\sseq@class@adjustclasses#1{
680 \sseq@tempcount=\z@
681 \sseq@tempcountb=\sseq@obj{partcoord.(#1).numnodes}
682 \loop
683 \advance\sseq@tempcount\@ne
684 \ifnum\sseq@obj{class.(#1,\the\sseq@tempcount).n}<\sseq@classinsert\relax\else
685 \sseq@cleanup@obj{class.(#1,\the\sseq@tempcount).n}
686 \sseq@eval{\@nx\sseq@obj@inc{class.(#1,\the\sseq@tempcount).n}} % unfortunately, \sseq@obj@inc uses \sseq@tempcount so we need this eval
687 \fi
688 \ifnum\sseq@tempcount<\sseq@tempcountb\repeat
689
690 }
691
692 \sseq@DeclareDocumentCommand\classoptions{od()}{%
693 \begingroup
694 \sseq@loadinputline
695 \sseq@xsetthiscall{\string\classoptions\IfNoValueF{#1}{[\unexpanded{#1}]}\unexpanded{(#2)}}%
696 \IfNoValueT{#1}{\sseq@error@x{cmdoptions-without-options}{\string\classoptions}\sseq@break}% could be warning
697 \sseq@options@firstpassmode
698 \the\sseq@sseqstyle
699 \the\sseq@classstyle
700 \the\sseq@scope@toks
701 \sseq@options@normalmode
702 \let\sseq@processlabels\sseq@processlabels@default % Don't double dip on labels from the scope or classstyle
703 \sseq@processoptions{class}{#1}% Outputs result into \sseq@savedoptioncode
704 %
705 \IfNoValueTF{#2}{
706 \def\sseq@coord{\lastclass0}
707 }{
708 \def\sseq@coord{#2}
709 }
710 \sseq@parsecoord\coord{\sseq@coord}{\string\classoptions}%
711 %
712 \sseq@processlabels
713 %
714 \let\partialcoord\coord@partial
715 \edef\sseq@classnum{\sseq@obj@ifdef{class.\coord.num}{\sseq@obj{class.\coord.num}}{0}}
716 \@ifundefined{sseq@class@page}{%
717 \@ifundefined{sseq@gen}{
718 \@ifundefined{sseq@thepage}{
719 \let\sseq@gen\sseq@classnum
720 }{
721 \sseq@obj@pagetogen{class.\coord}{\sseq@thepage} % stores in \sseq@gen
722 }
723 \let\sseq@genmax\sseq@gen
724 }{
725 \ifnum\sseq@gen<\z@
726 \edef\sseq@gen{\the\numexpr\sseq@classnum+\sseq@gen+1}
727 \fi
728 \@ifundefined{sseq@genmax}{\let\sseq@genmax\sseq@gen}{
729 \edef\sseq@genmax{\the\numexpr\sseq@classnum+\sseq@genmax+1}
730 }
731 }
732 }{
733 \@ifundefined{sseq@gen}{}{\sseq@error{classoptions-page-gen}}% This could be a warning
734 \sseq@class@getgen{\sseq@class@page}
735 \@ifundefined{sseq@class@pagemax}{
736 % If no max is present, apply options to all pages starting at specified minimum
737 \let\sseq@genmax\sseq@classnum%
738 \let\sseq@class@pagemax\sseq@infinity % ensure if "page" is defined, "pagemax" is defined too
739 }{
740 \let\sseq@genmin\sseq@gen
741 \sseq@class@getgen{\sseq@class@pagemax}
742 \let\sseq@genmax\sseq@gen
743 \let\sseq@gen\sseq@genmin
744 }
745 \edef\sseq@class@page{\the\numexpr\sseq@class@page-\@ne}
746 \edef\sseq@class@pagemax{\the\numexpr\sseq@class@pagemax+\@ne}
747 }
748 \ifnum\sseq@gen=\m@ne
749 \let\sseq@gen\sseq@classnum
750 \fi
751 \edef\classname{class.\coord[\sseq@gen]}
752 \ifsseq@keepchanges\else
753 \ifnum\sseq@thepagecount>\sseq@obj{\classname.page}\relax
754 \sseq@error@xxx{classoptions-already-dead}{\sseq@gen}{\coordname}{\sseq@obj{\classname.page}}
755 \sseq@breakfifi
756 \fi
757 \ifnum\sseq@gen>\z@
758 \ifnum\sseq@thepagecount>\sseq@obj{class.\coord[\the\numexpr\sseq@gen-\@ne].page}\relax\else
759 \sseq@error@xx{classoptions-not-yet-born}{\sseq@gen}{\coord}{\sseq@class@page}%
760 \sseq@breakfififi
761 \fi
762 \fi
763 \fi{}
764 \ifx\sseq@class@tag\pgfutil@empty\else
765 \sseq@obj@ifdef{partcoord.(\partialcoord).tag.\sseq@class@tagprefix\sseq@class@tag}{%
766 \sseq@error@nn{class-tag-already-defined}{\sseq@class@tagprefix\sseq@class@tag}{\sseq@partialcoord}% could be warning
767 }%
768 \sseq@cleanup@obj{class.\coord.tag}%
769 \sseq@obj@xdef{class.\coord.tag}{\sseq@class@tagprefix\sseq@class@tag}%
770 \sseq@cleanup@obj{partcoord.(\partialcoord).tag.\sseq@class@tagprefix\sseq@class@tag}%
771 \sseq@obj@xdef{partcoord.(\partialcoord).tag.\sseq@class@tagprefix\sseq@class@tag}{\sseq@index}%
772 \fi
773 \ifx\sseq@class@name\pgfutil@empty\else
774 \sseq@obj@ifdef{\classname.name}{
775 \sseq@error@nn{classoptions-class-already-named}{\coord}{\sseq@obj{\classname.name}}%could be warning
776 }{}
777 \sseq@cleanup@obj{\classname.name}
778 \sseq@cleanup@obj{class.namedclass.\detokenize\@xp{\sseq@class@name}}
779 \sseq@obj@xdef{\classname.name}{\sseq@class@name}
780 \sseq@obj@xdef{class.namedclass.\detokenize\@xp{\sseq@class@name}}{\coordnopar}
781 \fi
782 \sseq@tempcount=\sseq@gen\relax
783 \advance\sseq@tempcount\m@ne
784 \loop
785 \advance\sseq@tempcount\@ne
786 \edef\classname{class.\coord[\the\sseq@tempcount]}
787 \sseq@cleanup@obj{\classname.options}
788 \sseq@classoptions@setup@pagerange
789 \sseq@classoptions@obj@addto@withpagerange{\classname.options}{\sseq@savedoptioncode}
790 %
791 \ifx\sseq@classnodetext\pgfutil@empty\else
792 \sseq@cleanup@obj{\classname.nodetext}
793 \@ifundefined{sseq@class@page}{}{
794 \sseq@obj@xdef{\classname.nodetext}{
795 \@nx\ifnum\@nx\sseq@thepagecount<\the\numexpr\sseq@class@page+1\relax\relax
796 \unexpanded\@xptwo{\csname \sseq@obj@fullname{\classname.nodetext}\endcsname\fi}
797 }
798 }
799 \sseq@classoptions@obj@addto@withpagerange{\classname.nodetext}{\sseq@classnodetext}
800 \fi
801 \ifx\sseq@classnodetextoptions\pgfutil@empty\else
802 \sseq@cleanup@obj{\classname.nodetext.options}
803 \sseq@classoptions@obj@addto@withpagerange{\classname.nodetext.options}{\sseq@classnodetextoptions}
804 \fi
805 \ifx\sseq@classlabelnodes\pgfutil@empty\else
806 \sseq@cleanup@obj{\classname.labelnodes}
807 \sseq@classoptions@obj@addto@withpagerange{\classname.labelnodes}{\sseq@classlabelnodes}
808 \fi
809 \ifcsname sseq@class@showname\endcsname
810 \sseq@obj@xodef{\classname.showname}{\sseq@class@showname}
811 \fi
812 \ifx\sseq@familylist\pgfutil@empty\else
813 \sseq@cleanup@obj{\classname.familylist}
814 \sseq@classoptions@obj@addto@withpagerange{\classname.familylist}{\sseq@familylist}
815 \fi
816 \@ifundefined{sseq@tempoffset}{}{
817 \sseq@cleanup@obj{\classname.offset}
818 \@xp\tikz@scan@one@point\@xp\sseq@setoffset\sseq@tempoffset
819 }
820 \ifnum\sseq@tempcount<\sseq@genmax\repeat
821 \sseq@breakpoint
822 \endgroup
823 }
824 \def\sseq@classoptions@setup@pagerange{%
825 \@ifundefined{sseq@class@page}{
826 \def\sseq@classoptions@obj@addto@withpagerange@{\sseq@obj@gaddto{\sseq@tempobj}}
827 }{
828 \def\sseq@temp##1{##1}
829 \ifnum\sseq@tempcount=\sseq@gen\relax
830 \sseq@eval{\@nx\pretocmd\@nx\sseq@temp{\@nx\ifnum\sseq@thepagecount>\sseq@class@page\relax}{}{%
831 \@nx\sseq@error@x{this-shouldnt-happen}{file main, function \string\sseq@classoptions@setup@pagerange}
832 }}%
833 \apptocmd\sseq@temp{\fi}{}{\sseq@error@x{this-shouldnt-happen}{file main, function \string\sseq@classoptions@setup@pagerange}}
834 \fi
835 \ifnum\sseq@tempcount=\sseq@genmax\relax
836 \sseq@eval{\@nx\pretocmd\@nx\sseq@temp{\@nx\ifnum\sseq@thepagecount<\sseq@class@pagemax\relax}{}{\@nx\sseq@error@internal{}}}
837 \apptocmd\sseq@temp{\fi}{}{\sseq@error@internal{this-shouldnt-happen}{file main, function \string\sseq@classoptions@setup@pagerange}}
838 \fi
839 \@xp\def\@xp\sseq@temp\@xp##\@xp1\@xp{\@xp{\sseq@temp{##1}}}
840 \pretocmd\sseq@temp{\sseq@obj@gaddto{\sseq@tempobj}}{}{\sseq@error@internal{this-shouldnt-happen}{file main, function \string\sseq@classoptions@setup@pagerange}}
841 \let\sseq@classoptions@obj@addto@withpagerange@\sseq@temp
842 }
843 }
844 \def\sseq@classoptions@obj@addto@withpagerange#1#2{%
845 \def\sseq@tempobj{#1}%
846 \@xp\sseq@classoptions@obj@addto@withpagerange@\@xp{#2}%
847 }
848 \def\sseq@class@getgen#1{
849 \bgroup
850 \ifnum\sseq@classnum>\z@
851 \sseq@eval{\unexpanded{\sseq@obj@pagetogen{class.\coord}}{#1}} % stores in \sseq@gen
852 \else
853 \def\sseq@gen{0}
854 \fi
855 \sseq@smuggle@macro\sseq@gen
856 \egroup
857 }
858
859 \sseq@DeclareDocumentCommand\replaceclass{od()}{%
860 \begingroup
861 \sseq@loadinputline
862 \sseq@xsetthiscall{\string\replaceclass\IfNoValueF{#1}{[\unexpanded{#1}]}\unexpanded{(#2)}}
863 %
864 \IfNoValueTF{#2}{
865 \def\sseq@coord{\lastclass0}
866 }{
867 \def\sseq@coord{#2}
868 }
869 \sseq@parsecoord\coord{\sseq@coord}{coordinate passed to \string\replaceclass}%
870 \sseq@replaceclassmain{#1}
871 }
872
873 \sseq@DeclareDocumentCommand\replacesource{o}{
874 \begingroup
875 \sseq@loadinputline
876 \sseq@xsetthiscall{\string\replacesource\IfNoValueF{#1}{[\unexpanded{#1}]}}
877 \sseq@parsedcoord@restore{\coord}{lastsource}
878 \sseq@replaceclassmain{#1}
879 }
880
881 \sseq@DeclareDocumentCommand\replacetarget{o}{
882 \begingroup
883 \sseq@loadinputline
884 \sseq@xsetthiscall{\string\replacetarget\IfNoValueF{#1}{[\unexpanded{#1}]}}
885 \sseq@parsedcoord@restore{\coord}{lasttarget}
886 \sseq@replaceclassmain{#1}
887 }
888
889 \def\sseq@replaceclassmain#1{
890 \sseq@pushstack@\coord
891 \sseq@options@firstpassmode
892 \the\sseq@sseqstyle
893 \the\sseq@classstyle
894 \the\sseq@scope@toks
895 \sseq@options@normalmode
896 \IfNoValueF{#1}{%
897 \sseq@processoptions{class}{#1}% Outputs result into \sseq@savedoptioncode
898 }%
899 \sseq@processlabels
900 \sseq@obj@ifundef{class.\coord.num}{\sseq@error@x{replaceclass-no-class}{\coordname}\sseq@break}{}
901 \sseq@ifdead\coord{}{\sseq@error@x{replaceclass-not-dead-yet}{\coordname}\sseq@break}
902 \edef\oldclassname{class.\coord[\sseq@obj{class.\coord.num}]}
903 % \ifsseq@keepchanges\else
904 % \ifnum\the\numexpr\sseq@obj{\oldclassname.page}<\sseq@thepagecount\else
905 % \edef\sseq@temp{\sseq@obj{\oldclassname.page}}
906 % \sseq@error@xxx{replaceclass-no-effect-on-this-page}{\coord}{\sseq@temp}{\the\numexpr\sseq@temp+\@ne}% warning
907 % \sseq@breakfifi
908 % \fi
909 % \fi
910 %
911 \sseq@cleanup@obj{class.\coord.num}
912 \sseq@obj@inc{class.\coord.num}
913 \edef\classname{class.\coord[\sseq@obj{class.\coord.num}]}
914 %\show\classname
915 %
916 \let\partialcoord\coord@partial
917 \ifx\sseq@class@tag\pgfutil@empty\else
918 \sseq@obj@ifdef{partcoord.(\partialcoord).tag.\sseq@class@tagprefix\sseq@class@tag}{%
919 \sseq@error@nn{class-tag-already-defined}{\sseq@class@tagprefix\sseq@class@tag}{\sseq@partialcoord}% could be warning
920 }{}%
921 \sseq@cleanup@obj{partcoord.(\partialcoord).tag.\sseq@class@tagprefix\sseq@class@tag}%
922 \sseq@obj@xdef{partcoord.(\partialcoord).tag.\sseq@class@tagprefix\sseq@class@tag}{\nodenum}%
923 \fi
924 \ifx\sseq@class@name\pgfutil@empty
925 \sseq@obj@ifdef{\oldclassname.name}{
926 \sseq@lettoobj\sseq@class@name{\oldclassname.name}
927 \sseq@cleanup@obj{\classname.name}
928 \sseq@cleanup@obj{class.namedclass.\detokenize\@xp{\sseq@class@name}}
929 \sseq@obj@xdef{\classname.name}{\sseq@class@name}
930 \sseq@obj@xdef{class.namedclass.\detokenize\@xp{\sseq@class@name}}{\coordnopar}
931 }{}
932 \else
933 \sseq@cleanup@obj{\classname.name}
934 \sseq@cleanup@obj{class.namedclass.\detokenize\@xp{\sseq@class@name}}
935 \sseq@obj@xdef{\classname.name}{\sseq@class@name}
936 \sseq@obj@xdef{class.namedclass.\detokenize\@xp{\sseq@class@name}}{\coordnopar}
937 \fi
938 \let\partialcoord\coord@partial
939 \ifx\sseq@class@tag\pgfutil@empty\else
940 \sseq@obj@ifdef{partialcoord.(\partialcoord).tag.\sseq@class@tagprefix\sseq@class@tag}{%
941 \sseq@error@nn{class-tag-already-defined}{\sseq@class@tagprefix\sseq@class@tag}{\sseq@partialcoord}% could be warning
942 }{}%
943 \sseq@obj@xdef{partialcoord.(\partialcoord).tag.\sseq@class@tagprefix\sseq@class@tag}{\nodenum}%
944 \fi
945 %
946 \ifcsname sseq@class@showname\endcsname
947 \sseq@obj@xodef{\classname.showname}{\sseq@class@showname}
948 \fi
949 \sseq@obj@xodef{\classname.familylist}{\sseq@familylist}
950 \sseq@obj@xdef{\classname.page}{\sseq@infinity}
951 \sseq@obj@xodef{\classname.options}{\sseq@savedoptioncode}
952 \ifx\sseq@classnodetext\pgfutil@empty\else
953 \sseq@obj@xodef{\classname.nodetext}{\sseq@classnodetext}
954 \fi
955 \ifx\sseq@classnodetextoptions\pgfutil@empty\else
956 \sseq@obj@xodef{\classname.nodetext.options}{\sseq@classnodetextoptions}
957 \fi
958 \sseq@obj@xodef{\classname.labelnodes}{\sseq@classlabelnodes}
959 \ifcsname sseq@class@showname\endcsname
960 \sseq@obj@xodef{\classname.showname}{\sseq@class@showname}
961 \fi
962 \sseq@obj@gdef{\classname.dependencies}{}
963 \ifsseq@needstikz
964 \sseq@obj@xdef{\classname.needstikz}{\sseq@needstikztrue}
965 \fi
966 \@ifundefined{sseq@tempoffset}{}{\@xp\tikz@scan@one@point\@xp\sseq@setoffset\sseq@tempoffset}
967 %
968 \sseq@breakpoint
969 \endgroup
970 }
971
972 \sseq@DeclareDocumentCommand\replacestructlines{od()}{%
973 \begingroup
974 \sseq@loadinputline
975 \sseq@xsetthiscall{\string\replaceclass\IfNoValueF{#1}{[\unexpanded{#1}]}\unexpanded{(#2)}}
976 %
977 \IfNoValueTF{#2}{
978 \def\sseq@coord{\lastclass0}
979 }{
980 \def\sseq@coord{#2}
981 }
982 \sseq@parsecoord\coord{\sseq@coord}{coordinate passed to \string\replaceclass}%
983 %
984 % TODO: error handling here...
985 %
986 \edef\sseq@classnum{\sseq@obj{class.\coord.num}}%
987 \ifnum\sseq@classnum=0\relax
988 \sseq@error@x{replacestructlines-class-not-replaced}{\coordname}\sseq@breakfi
989 \fi
990 \edef\classname{class.\coord[\sseq@classnum]}%
991 %\show\classname
992 \edef\oldclassname{class.\coord[\the\numexpr\sseq@obj{class.\coord.num}-1]}%
993 \sseq@cleanup@obj{\classname.dependencies}%
994 \sseq@obj@gletobj{\classname.dependencies}{\oldclassname.dependencies}%
995 %\sseq@obj@show{\classname.dependencies}
996 \sseq@obj@map{\classname.dependencies}{
997 \sseq@cleanup@obj{##1.page}%
998 \sseq@obj@gletobj{##1.page}{##1.page.old}%
999 }
1000 \sseq@breakpoint
1001 \endgroup
1002 }
1003
1004 \def\sseq@class@draw@ifpage#1{
1005 \bgroup
1006 \sseq@obj@pagetogen{#1}{\sseq@thepage} % sets \sseq@gen
1007 \ifnum\sseq@gen>\m@ne % -1 means no class to print
1008 \ifnum\sseq@obj{#1[\sseq@gen].page}=\sseq@thepagecount
1009 \sseq@thispagetrue
1010 \fi
1011 \sseq@drawtrue
1012 \sseq@obj{#1[\sseq@gen].familylist}
1013 \ifsseq@draw
1014 \sseq@gsetthiscall{class #1}
1015 \sseq@class@drawnode{#1[\sseq@gen]}
1016 \fi
1017 \fi
1018 \egroup
1019 }
1020
1021 % #1 -- object
1022 % #2 -- page
1023 % If there is a class #1 drawn on page #2, set \sseq@gen to be the generation of that class, otherwise set \sseq@gen to be -1.
1024 \def\sseq@obj@pagetogen#1#2{
1025 \bgroup
1026 \def\sseq@gen{-1}
1027 \sseq@tempcount=\m@ne
1028 \sseq@tempcountb=\sseq@obj{#1.num}\relax
1029 \loop
1030 \advance\sseq@tempcount\@ne
1031 \ifnum\sseq@obj{#1[\the\sseq@tempcount].page}<#2\relax\else
1032 \edef\sseq@gen{\the\sseq@tempcount}
1033 \sseq@tempcount=\sseq@tempcountb\relax
1034 \fi
1035 \ifnum\sseq@tempcount<\sseq@tempcountb\repeat
1036 \sseq@smuggle@macro\sseq@gen
1037 \egroup
1038 }
1039 %%%
1040 %%% \kill, \d and \doptions
1041 %%%
1042
1043 % Because \kill doesn't take options, there's no need to use \sseq@DeclareDocumentCommand for the outer command.
1044 % Rather than use \sseq@DeclareDocumentCommand with no arguments, we just do the normal stuff that \sseq@DeclareDocumentCommand would do,
1045 % Then call \sseq@d@grabpage, the command that is responsible for handling the strange syntax of the page argument for \d.
1046 \protected\def\sseq@kill{%
1047 \begingroup
1048 \sseq@setinputline % These two lines normally would happen inside of \sseq@DeclareDocumentCommand.
1049 \sseq@loadinputline
1050 \sseq@d@grabpage\sseq@kill@
1051 }
1052
1053
1054 % Now we need to parse a potential coordinate.
1055 \sseq@DeclareDocumentCommandAs\sseq@kill@\kill {d()} {
1056 \sseq@xsetthiscall{\string\kill\unexpanded\@xp{\sseq@dpage}\IfNoValueF{#1}{(#1)}}%
1057 \sseq@parsecoord\coordinate{\IfNoValueTF{#1}{\lastclass}{#1}}{}%
1058 \sseq@parsedcoord@save{lastsource}{\coordinate}
1059 \sseq@parsedcoord@save{lasttarget}{\coordinate}
1060 \sseq@ifintexpr{\sseq@dpage}{%
1061 \sseq@tempcount=\numexpr\sseq@dpage\relax % this is a convenient way to get rid of spaces because #3 has to be a number
1062 }{%
1063 \sseq@error@x{d-invalid-page}{\unexpanded\@xp{\sseq@dpage}}\sseq@break%
1064 }%
1065 \sseq@eval{\@nx\sseq@d@setpageminrec{class.\coordinate}{\the\sseq@tempcount}{coordinate}}% automatically handles \sseq@cleanup@obj
1066 \sseq@breakpoint
1067 \endgroup
1068 }
1069
1070 % \sseq@d@grabpage is defined in sseqparsers.
1071 \sseq@DeclareDocumentCommand\d{o}{%
1072 \begingroup
1073 \sseq@loadinputline
1074 \def\sseq@dtype{d}
1075 \def\sseq@d@theoptions{#1}
1076 \sseq@d@grabpage\sseq@d@
1077 }
1078
1079 \sseq@DeclareDocumentCommand\doptions{o}{%
1080 \begingroup
1081 \sseq@loadinputline
1082 \def\sseq@dtype{doptions}
1083 \def\sseq@d@theoptions{#1}
1084 \sseq@d@grabpage\sseq@d@
1085 }
1086
1087 \def\sseq@d@{
1088 \ifsseq@tempif
1089 \csname sseq@\sseq@dtype @grabcoord\@xp\endcsname
1090 \else
1091 \sseq@eval{\@nx\sseq@d@main{\sseq@dtype}{\unexpanded\@xp{\sseq@d@theoptions}}{\sseq@dpage}{\sseq@NoValue}{\sseq@NoValue}}
1092 \sseq@breakpoint
1093 \endgroup
1094 \fi
1095 }
1096
1097 \sseq@DeclareDocumentCommandAs\sseq@d@grabcoord\d{d()d()}{
1098 \sseq@eval{\@nx\sseq@d@main{\sseq@dtype}{\unexpanded\@xp{\sseq@d@theoptions}}{\sseq@dpage}}{#1}{#2}
1099 \sseq@breakpoint
1100 \endgroup
1101 }
1102
1103 \sseq@DeclareDocumentCommandAs\sseq@doptions@grabcoord\doptions{d()d()}{
1104 \sseq@eval{\@nx\sseq@d@main{\sseq@dtype}{\unexpanded\@xp{\sseq@d@theoptions}}{\sseq@dpage}}{#1}{#2}
1105 \sseq@breakpoint
1106 \endgroup
1107 }
1108
1109
1110 \def\sseq@d@main#1#2#3#4#5{%
1111 \sseq@options@firstpassmode
1112 \def\sseq@edgetype{differential}%
1113 \the\sseq@sseqstyle
1114 \the\sseq@edgestyle
1115 \the\sseq@differentialstyle
1116 \the\sseq@scope@toks
1117 \sseq@options@normalmode
1118 \IfNoValueF{#2}{%
1119 \sseq@processoptions{differential}{#2}% Outputs result into \sseq@savedoptioncode
1120 }%
1121 \sseq@xsetthiscall{\@xp\string\csname#1\endcsname\IfNoValueF{#2}{\unexpanded{[#2]}}\unexpanded{#3}\IfNoValueF{#4}{\unexpanded{(#4)}}\IfNoValueF{#5}{\unexpanded{(#5)}}}%
1122 \sseq@ifintexpr{#3}{%
1123 \sseq@tempcount=\numexpr#3\relax % this is a convenient way to get rid of spaces because #3 has to be a number
1124 }{%
1125 \sseq@error@n{d-invalid-page}{#3}\sseq@break
1126 }%
1127 \sseq@eval{\@nx\sseq@dparsecoord{\the\sseq@tempcount}{\IfNoValueTF{#4}{\lastclass0}{\unexpanded{#4}}}{\unexpanded{#5}}}
1128 \sseq@eval{\unexpanded{\csname sseq@d@#1\endcsname{#2}}{\the\sseq@tempcount}}%
1129 \sseq@breakpoint
1130 }
1131
1132 % #1 -- options
1133 % #2 -- page
1134 % #3 -- source coordinate
1135 \def\sseq@d@d#1#2{%%
1136 \sseq@obj@ifdef{class.\source.hasextension}{
1137 \sseq@error@xxx{d-class-has-extension}{source}{\sourcename}{#2}
1138 \sseq@break
1139 }{}
1140 \sseq@obj@ifdef{class.\target.hasextension}{
1141 \sseq@error@xxx{d-class-has-extension}{target}{\targetname}{#2}
1142 \sseq@break
1143 }{}
1144 \sseq@d@setpageminrec{class.\source}{#2}{source}% automatically handles \sseq@cleanup@obj
1145 \sseq@d@setpageminrec{class.\target}{#2}{target}
1146 %%% This is the last point we might break, so now the differential is good.
1147 %%% Note that we can break inside \sseq@d@setpageclass inside \sseq@d@setpageminrec
1148 %
1149 \ifsseq@drawdifferential % TODO: probably should get rid of invisible now that we have \kill...
1150 \sseq@obj@xodef{d.#2\source\target.familylist}{\sseq@familylist}
1151 \sseq@obj@gdef{d.#2\source\target.page}{#2}
1152 \sseq@obj@xdef{d.#2\source\target.source}{\source}
1153 \sseq@obj@xdef{d.#2\source\target.target}{\target}
1154 \sseq@obj@xdef{d.#2\source\target.options}{\ifsseq@needstikz\@nx\sseq@needstikztrue\fi\unexpanded\@xp{\sseq@savedoptioncode}}
1155 %
1156 \sseq@savedpaths@adddifferential{d.#2\source\target}%
1157 \else
1158 \sseq@obj@gdef{d.#2\source\target.invisible}{}
1159 \fi
1160 }
1161 \def\sseq@d@doptions#1#2{%
1162 \sseq@obj@ifundef{d.#2\source\target.options}{\sseq@error@n{cmdoptions-feature-doesn't-exist}{differential}\sseq@break}{}%
1163 \sseq@obj@ifdef{d.#2\source\target.invisible}{\sseq@error{doptions-invisible}\sseq@break}
1164 \ifsseq@keepchanges\else
1165 \@ifundefined{sseq@thepage}{}{
1166 \ifnum#2=\sseq@thepagecount\else\ifnum\sseq@thepagecount=\z@\else
1167 \sseq@error@n{doptions-no-effect-on-this-page}{#2}\sseq@breakfififi
1168 \fi\fi
1169 }%
1170 \fi
1171 %
1172 \sseq@cleanup@obj{d.#2\source\target.familylist}
1173 \sseq@obj@xoaddto{d.#2\source\target.familylist}{\sseq@familylist}
1174 \sseq@cleanup@obj{d.#2\source\target.options}
1175 \sseq@obj@xaddto{d.#2\source\target.options}{\ifsseq@needstikz\@nx\sseq@needstikztrue\fi\unexpanded\@xp{\sseq@savedoptioncode}}
1176 }
1177
1178 % Some helper macros:
1179 % #1 -- class name for \sseq@obj
1180 % #2 -- page
1181 % #3 -- source or target for error handling purposes.
1182 \def\sseq@d@setpageminrec#1#2#3{% not really recursive.
1183 \sseq@cleanup@obj{#1[\sseq@obj{#1.num}].page}
1184 \sseq@cleanup@obj{#1[\sseq@obj{#1.num}].deathinfo}
1185 \sseq@cleanup@obj{#1[\sseq@obj{#1.num}].deathline}
1186 \sseq@d@setpageclass{#1}{#2}{#3}
1187 \sseq@obj@map{#1[\sseq@obj{#1.num}].dependencies}{
1188 %\def\temp{##1}\show\temp
1189 %\sseq@obj@show{#1[\sseq@obj{#1.num}].dependencies}
1190 \sseq@d@setpagemin{##1}{#2} % automatically handles cleanup
1191 }
1192 }
1193
1194 % #1 -- class name for \sseq@obj
1195 % #2 -- page
1196 % #3 -- source or target for error handling purposes.
1197 \def\sseq@d@setpageclass#1#2#3{
1198 \edef\sseq@classgenname{#1[\sseq@obj{#1.num}]}
1199 % If the class is dead, then it's only not an error if it died on the current page
1200 \ifnum\sseq@obj{\[email protected]}<\sseq@infinitycount
1201 % If the page it died on is greater than this one, hit-wrong-order error
1202 \ifnum\sseq@obj{\[email protected]}>#2\relax
1203 \let\sseq@deadclass@genname\sseq@classgenname
1204 \sseq@preparestacktrace
1205 \sseq@error@xxxx{d-hit-wrong-order}{#3}{\csname #3name\endcsname}{#2}{\the\sseq@temptoks}
1206 \sseq@breakfifi
1207 \fi
1208 % If the page it died on is less than this one, class-already-hit error
1209 \ifnum\sseq@obj{\[email protected]}<#2\relax
1210 \let\sseq@deadclass@genname\sseq@classgenname
1211 \sseq@preparestacktrace
1212 \sseq@error@xxxx{d-class-already-hit}{#3}{\csname #3name\endcsname}{#2}{\the\sseq@temptoks}
1213 \sseq@breakfifi
1214 \fi
1215 \fi
1216 % If the class has been replaced before, that's only okay if it was replaced on a previous page.
1217 \ifnum\sseq@obj{#1.num}>\z@
1218 \sseq@tempcount=\sseq@obj{#1.num}\relax
1219 \advance\sseq@tempcount\m@ne
1220 \ifnum\sseq@obj{#1[\the\sseq@tempcount].page}<#2\relax\else
1221 \ifnum#2=\sseq@obj{#1[\the\sseq@tempcount].page}
1222 \sseq@error@xxxx{d-hit-same-page-replaceclass}{#3}{\csname #3name\endcsname}{#2}{\sseq@obj{#1[\the\sseq@tempcount].deathinfo}}
1223 \sseq@breakfififi
1224 \else
1225 \edef\sseq@deadclass@genname{#1[\the\numexpr\sseq@obj{#1.num}-\@ne]}
1226 \sseq@preparestacktrace
1227 \sseq@error@xxxx{d-hit-wrong-order}{#3}{\csname #3name\endcsname}{#2}{\the\sseq@temptoks}
1228 \sseq@breakfififi
1229 \fi
1230 \fi
1231 \fi
1232 \sseq@obj@xdef{\[email protected]}{#2}
1233 \sseq@obj@xdef{\[email protected]}{#3 of differential \sseq@thiscall\ on page #2}
1234 \bgroup
1235 \def\foreach{\@nx\@nx\@nx\foreach}
1236 \protected\def\\{}
1237 \let\sseq@possibleperiod\empty
1238 \let\sseq@possibleperiodb\empty
1239 \sseq@obj@xdef{\[email protected]}{%
1240 on input line \sseq@inputline\sseq@error@inforeachloop
1241 }
1242 \sseq@obj@xdef{\[email protected]}{\sseq@inputline}
1243 \sseq@tempiffalse
1244 \edef\sseq@temp{\the\sseq@foreachcall}
1245 \ifx\sseq@temp\pgfutil@empty\else\sseq@tempiftrue\fi
1246 \ifx\sseq@restofstacktrace\pgfutil@empty\else\sseq@tempiftrue\fi
1247 \sseq@obj@xdef{\[email protected]}{%
1248 \ifsseq@tempif
1249 \unexpanded{\\\\}Stack trace for differential \@nx\unexpanded{\sseq@thiscall} that killed #3:\unexpanded{\\}%
1250 \ifx\sseq@temp\sseq@empty\else\unexpanded{\ \ \ }\@nx\sseq@stack@unexpanded{\unexpanded\@xp{\the\sseq@foreachcall}}\fi
1251 \unexpanded\@xp{\sseq@restofstacktrace}%
1252 \fi
1253 }
1254 \egroup
1255 }
1256
1257 \def\sseq@preparestacktrace{
1258 \def\foreach{\@nx\foreach}
1259 \edef\sseq@temp@i{\unexpanded\@xpthree{\sseq@obj{\sseq@[email protected]}}}
1260 \edef\sseq@temp@ii{\sseq@inputline}
1261 \ifx\sseq@temp@i\sseq@temp@ii
1262 \sseq@temptoks\@xpthree{\sseq@obj{\sseq@[email protected]} (in the same \foreach loop)}
1263 \else
1264 \protected\def\\{}
1265 \sseq@eval{\sseq@temptoks{\unexpanded\@xpthree{\sseq@obj{\sseq@[email protected]}}\space(\sseq@obj{\[email protected]})}}
1266 \sseq@e@addto@macro\sseq@errorinfo{\unexpanded\@xpthree{\sseq@obj{\sseq@[email protected]}}}
1267 \fi
1268 }
1269
1270 \def\sseq@d@setpagemin#1#2{
1271 \ifnum\sseq@obj{#1.page}>#2\relax
1272 \ifnum\sseq@obj{#1.pagemin}>#2\relax\else % prevent a d1 from getting rid of a structline that was supposed to start on page 5
1273 \sseq@cleanup@obj{#1.page}
1274 \sseq@cleanup@obj{#1.page.old}
1275 \sseq@obj@gletobj{#1.page.old}{#1.page}
1276 \sseq@obj@xdef{#1.page}{#2}
1277 \fi
1278 \fi
1279 }
1280 \def\sseq@differential@draw@ifpage#1{
1281 \sseq@drawtrue
1282 \sseq@obj{#1.familylist}
1283 \ifsseq@draw
1284 \ifnum\sseq@thepagecount=\z@
1285 \sseq@drawdifferential{#1}
1286 \else
1287 \ifnum\sseq@obj{#1.page}>\sseq@thepagemm\relax
1288 \ifnum\sseq@obj{#1.page}<\sseq@thepagemaxpp\relax
1289 \sseq@drawdifferential{#1}
1290 \fi
1291 \fi
1292 \fi
1293 \fi
1294 }
1295 \def\sseq@drawdifferential#1{
1296 \bgroup
1297 \sseq@eval{
1298 \@nx\sseq@drawedge\sseq@obj{#1.source}\sseq@obj{#1.target}{differential}{%
1299 \@nx\sseq@obj{#1.options}
1300 }
1301 }
1302 \egroup
1303 }
1304 %%%
1305 %%% \structline and \structlineoptions
1306 %%%
1307
1308 \sseq@DeclareDocumentCommand\structline{od()}{%
1309 \begingroup
1310 \sseq@loadinputline
1311 \IfNoValueTF{#2}{
1312 \sseq@structline@main{structline}{#1}{#2}{#2}
1313 }{
1314 \def\next{\sseq@structline@@{structline}{#1}{#2}}%
1315 \@xptwo\next\sseq@trimleadingspaces
1316 }
1317 }
1318 \sseq@DeclareDocumentCommand\structlineoptions{od()}{%
1319 \begingroup
1320 \sseq@loadinputline
1321 \IfNoValueTF{#2}{
1322 \sseq@structline@main{structlineoptions}{#1}{#2}{#2}
1323 }{
1324 \def\next{\sseq@structlineoptions@@{structlineoptions}{#1}{#2}}%
1325 \@xptwo\next\sseq@trimleadingspaces
1326 }
1327 }
1328
1329 \sseq@DeclareDocumentCommandAs\sseq@structline@@\structline{mmmd()}{%
1330 \sseq@structline@main{#1}{#2}{#3}{#4}
1331 }
1332
1333 \sseq@DeclareDocumentCommandAs\sseq@structlineoptions@@\structlineoptions{mmmd()}{%
1334 \sseq@structline@main{#1}{#2}{#3}{#4}
1335 }
1336
1337 \def\sseq@structline@main#1#2#3#4{
1338 \sseq@xsetthiscall{\string\structline\IfNoValueF{#2}{\unexpanded{[#2]}}\IfNoValueF{#3}{\unexpanded{(#3)}\IfNoValueF{#4}{\unexpanded{(#4)}}}}%
1339 \def\sseq@edgetype{structline}
1340 \sseq@options@firstpassmode
1341 \the\sseq@sseqstyle
1342 \the\sseq@edgestyle
1343 \the\sseq@structlinestyle
1344 \the\sseq@scope@toks
1345 \sseq@options@normalmode
1346 \IfNoValueF{#2}{%
1347 \sseq@processoptions{struct line}{#2}% Outputs result into \sseq@savedoptioncode
1348 }%
1349 \def\sourcename{#3}%
1350 \def\targetname{#4}%
1351 \IfNoValueTF{#3}{%
1352 \def\sourcename{\lastclass1}%
1353 \def\targetname{\lastclass}%
1354 }{%
1355 \IfNoValueT{#4}{%
1356 \def\targetname{\lastclass}%
1357 }%
1358 }%
1359 \sseq@parsecoord\source{\sourcename}{source of structure line}%
1360 \sseq@parsecoord\target{\targetname}{target of structure line}%
1361 % Sort \xsource and \xtarget. This is to ensure that if a person adds
1362 \ifnum\xsource>\xtarget\relax
1363 \sseq@parsedcoords@swap\source\target
1364 \else
1365 \ifnum\xsource=\xtarget\relax
1366 \ifnum\ysource>\ytarget\relax
1367 \sseq@parsedcoords@swap\source\target
1368 \else
1369 \ifnum\ysource=\ytarget\relax
1370 \ifnum\nsource>\ntarget\relax
1371 \sseq@parsedcoords@swap\source\target
1372 \else
1373 \ifnum\nsource=\ntarget\relax
1374 \sseq@error@n{edge-source-target-equal}{\structline}%
1375 \sseq@fbreak
1376 \fi
1377 \fi
1378 \fi
1379 \fi
1380 \fi
1381 \fi
1382 \relax % stop fbreak
1383 \@ifundefined{sseq@structline@page}{%this is repeated in circleclasses
1384 \def\sseq@pagemin{0}
1385 \ifnum\sseq@obj{class.\source.num}>\z@
1386 \edef\sseq@pagemin{\sseq@obj{class.\source[\the\numexpr\sseq@obj{class.\source.num}-1].page}}
1387 \fi
1388 \ifnum\sseq@obj{class.\target.num}>\z@
1389 \edef\sseq@test{\sseq@obj{class.\target[\the\numexpr\sseq@obj{class.\target.num}-1].page}}
1390 \ifnum\sseq@test>\sseq@pagemin\relax
1391 \let\sseq@pagemin\sseq@test
1392 \fi
1393 \fi
1394 }{\edef\sseq@pagemin{\the\numexpr\sseq@structline@page-\@ne}}
1395 \csname sseq@structline@#1\endcsname
1396 \sseq@breakpoint
1397 \endgroup
1398 }
1399 \def\sseq@structline@structline{
1400 \@ifundefined{sseq@structline@pagemax}{}{\ifnum\sseq@structline@pagemax=\sseq@infinity\else \sseq@error{structline-no-page-max}\fi}% could be warning
1401 \ifnum\sseq@pagemin<\sseq@obj{class.\source[\sseq@obj{class.\source.num}].page}\relax\else
1402 \sseq@error{structline-stillborn}
1403 \sseq@breakfi
1404 \fi
1405 \ifnum\sseq@pagemin<\sseq@obj{class.\target[\sseq@obj{class.\target.num}].page}\relax\else % If the \structline is dead before it is born, throw an error
1406 \sseq@error{structline-stillborn}
1407 \sseq@breakfi
1408 \fi
1409 \sseq@obj@ifdef{structline.\source\target.num}{%
1410 \ifnum\sseq@obj{structline.\source\target[\sseq@obj{structline.\source\target.num}].page}=\sseq@infinitycount
1411 \sseq@error@xx{structline-already-exists}{\sourcename}{\targetname}
1412 \sseq@breakfi
1413 \fi
1414 \sseq@cleanup@obj{structline.\source\target.num}
1415 \sseq@obj@inc{structline.\source\target.num}
1416 }{
1417 \sseq@cleanup@obj{structline.\source\target.num}
1418 \sseq@obj@gdef{structline.\source\target.num}{0}
1419 \sseq@savedpaths@addstructline{structline.\source\target}
1420 }
1421 \edef\sseq@structlinename{structline.\source\target[\sseq@obj{structline.\source\target.num}]}
1422 % The following cleanup call is needed to prevent a glitch where if a \structline is made inside of a temporary sseqpage environment, then later attempts
1423 % to put a structline throw a "structline already exists" error
1424 \sseq@cleanup@obj{\[email protected]}
1425 \sseq@obj@xdef{\[email protected]}{\sseq@infinity}
1426 \sseq@obj@xdef{\[email protected]}{\sseq@pagemin}
1427 \sseq@obj@xdef{\[email protected]}{\source}
1428 \sseq@obj@xdef{\[email protected]}{\target}
1429 \sseq@class@adddependence{class.\source}{\sseq@structlinename}% If the source or target is already dead, this will set structlinename.page
1430 \sseq@class@adddependence{class.\target}{\sseq@structlinename}
1431 \sseq@obj@xodef{\[email protected]}{\sseq@familylist}
1432 \sseq@cleanup@obj{\[email protected]}
1433 \sseq@obj@xdef{\[email protected]}{\ifsseq@needstikz\@nx\sseq@needstikztrue\fi\unexpanded\@xp{\sseq@savedoptioncode}}
1434 }
1435 \def\sseq@structline@structlineoptions{
1436 \sseq@obj@ifundef{structline.\source\target.num}{
1437 \sseq@error@n{cmdoptions-feature-doesn't-exist}{\structline}
1438 \sseq@break
1439 }{}
1440 \@ifundefined{sseq@structline@page}{
1441 \edef\sseq@gen{\sseq@obj{structline.\source\target.num}}
1442 \let\sseq@genmax\sseq@gen
1443 }{
1444 \sseq@structline@getgen{\sseq@structline@page}
1445 \@ifundefined{sseq@structline@pagemax}{%
1446 % If no max is present, apply options to all pages starting at specified minimum
1447 \edef\sseq@genmax{\sseq@obj{structline.\source\target.num}}%
1448 \let\sseq@structline@pagemax\sseq@infinity
1449 }{
1450 \let\sseq@genmin\sseq@gen
1451 \sseq@structline@getgen{\sseq@structline@pagemax}
1452 \let\sseq@genmax\sseq@gen
1453 \let\sseq@gen\sseq@genmin
1454 }
1455 \edef\sseq@structline@page{\the\numexpr\sseq@structline@page-1}
1456 \edef\sseq@structline@pagemax{\the\numexpr\sseq@structline@pagemax+1}
1457 }
1458 \sseq@tempcount=\sseq@gen\relax
1459 \advance\sseq@tempcount\m@ne
1460 \loop
1461 \advance\sseq@tempcount\@ne
1462 \edef\sseq@structlinename{structline.\source\target[\the\sseq@tempcount]}
1463 \sseq@cleanup@obj{\[email protected]}
1464 \sseq@cleanup@obj{\[email protected]}
1465 \ifsseq@needstikz
1466 \sseq@obj@gaddto{\[email protected]}{\sseq@needstikztrue}
1467 \fi
1468 \ifnum\sseq@tempcount=\sseq@gen\relax
1469 \@ifundefined{sseq@structline@page}{}{
1470 \edef\sseq@savedoptioncode{\@nx\ifnum\sseq@thepagecount>\sseq@structline@page\relax\unexpanded\@xp{\sseq@savedoptioncode}\@nx\fi}
1471 \edef\sseq@familylist{\@nx\ifnum\sseq@thepagecount>\sseq@structline@page\relax\unexpanded\@xp{\sseq@familylist}\@nx\fi}
1472 }
1473 \fi
1474 \ifnum\sseq@tempcount=\sseq@genmax\relax
1475 \@ifundefined{sseq@structline@pagemax}{}{
1476 \edef\sseq@savedoptioncode{\@nx\ifnum\sseq@thepagecount<\sseq@structline@pagemax\relax\unexpanded\@xp{\sseq@savedoptioncode}\@nx\fi}
1477 \edef\sseq@familylist{\@nx\ifnum\sseq@thepagecount<\sseq@structline@pagemax\relax\unexpanded\@xp{\sseq@familylist}\@nx\fi}
1478 }
1479 \fi
1480 \sseq@obj@xoaddto{\[email protected]}{\sseq@savedoptioncode}
1481 \sseq@obj@xoaddto{\[email protected]}{\sseq@familylist}
1482 \ifnum\sseq@tempcount<\sseq@genmax\repeat
1483 }
1484
1485 \def\sseq@structline@copy#1#2{
1486 \begingroup
1487 \sseq@structline@copy@decomposename#2
1488 \let\sseq@thename@saved\sseq@thename
1489 \def\sseq@pagemin{0}
1490 \sseq@parsecoord\source{\sourcename}{source of structure line}%
1491 \sseq@parsecoord\target{\targetname}{target of structure line}
1492 \def\sseq@thename{#1}
1493 \sseq@lettoobj\sseq@familylist{#2.familylist}
1494 \sseq@lettoobj\sseq@savedoptioncode{#2.options}
1495 \let\sseq@thename\sseq@thename@saved
1496 \sseq@structline@structline
1497 \endgroup
1498 }
1499
1500 \def\sseq@structline@copy@decomposename#1.(#2,#3,#4)(#5,#6,#7){
1501 \def\sourcename{#2,#3,copiedfrom#4}
1502 \def\targetname{#5,#6,copiedfrom#7}
1503 }
1504
1505 \def\sseq@structline@getgen#1{
1506 \bgroup
1507 \sseq@tempcount=\sseq@obj{structline.\source\target.num}\relax
1508 \ifnum\sseq@tempcount>\z@
1509 \ifnum#1<\z@\relax
1510 \@ifundefined{sseq@thepage}{
1511 \ifnum\sseq@obj{structline.\source\target[\the\sseq@tempcount].page}<\sseq@infinitycount
1512 \sseq@tempcount=\sseq@obj{structline.\source\target[\the\sseq@tempcount].page}\relax
1513 \else
1514 \advance\sseq@tempcount\m@ne
1515 \sseq@tempcount=\sseq@obj{structline.\source\target[\the\sseq@tempcount].page}\relax
1516 \advance\sseq@tempcount\@ne
1517 \fi
1518 }{
1519 \sseq@tempcount=\sseq@thepagecount
1520 }
1521 \advance\sseq@tempcount\@ne
1522 \advance\sseq@tempcount#1\relax
1523 \fi
1524 \sseq@eval{\unexpanded{\sseq@obj@pagetogen{structline.\source\target}}{\the\sseq@tempcount}} % stores in \sseq@gen
1525 \else
1526 \def\sseq@gen{0}
1527 \fi
1528 \sseq@smuggle@macro\sseq@gen
1529 \egroup
1530 }
1531 \def\sseq@class@adddependence#1#2{
1532 \edef\sseq@temp{\sseq@obj{#1.num}}
1533 \sseq@d@setpagemin{#2}{\sseq@obj{#1[\sseq@temp].page}}% automatically handles cleanup
1534 \sseq@cleanup@obj{#1[\sseq@temp].dependencies}
1535 \sseq@obj@xaddto{#1[\sseq@temp].dependencies}{\@nx\\{#2}}
1536 }
1537 \def\sseq@structline@draw@ifpage#1{
1538 \bgroup
1539 \ifnum\sseq@thepagecount=\z@
1540 \ifnum\sseq@obj{#1[0].pagemin}=\z@
1541 \sseq@drawtrue
1542 \sseq@obj{#1[0].familylist}
1543 \ifsseq@draw
1544 \sseq@structline@draw{#1[0]}
1545 \fi
1546 \fi
1547 \else
1548 \sseq@obj@pagetogen{#1}{\sseq@thepage} % sets \sseq@gen
1549 \ifnum\sseq@gen<\z@\else % negative sseq@gen means don't draw it
1550 \ifnum\sseq@obj{#1[\sseq@gen].page}=\sseq@thepagecount
1551 \sseq@thispagetrue
1552 \fi
1553 \ifnum\sseq@obj{#1[\sseq@gen].pagemin}<\sseq@thepagecount
1554 \sseq@drawtrue
1555 \sseq@obj{#1[\sseq@gen].familylist}
1556 \ifsseq@draw
1557 \sseq@structline@draw{#1[\sseq@gen]}
1558 \fi
1559 \fi
1560 \fi
1561 \fi
1562 \egroup
1563 }
1564 \def\sseq@structline@draw#1{\sseq@eval{\@nx\sseq@drawedge\sseq@obj{#1.source}\sseq@obj{#1.target}{structline}{\@nx\sseq@obj{#1.options}}}}
1565
1566
1567
1568 \sseq@DeclareDocumentCommand\extension{od()}{%
1569 \begingroup
1570 \sseq@loadinputline
1571 \IfNoValueTF{#2}{
1572 \sseq@extension@main{extension}{#1}{#2}{#2}
1573 }{
1574 \def\next{\sseq@extension@@{extension}{#1}{#2}}%
1575 \@xptwo\next\sseq@trimleadingspaces
1576 }
1577 }
1578 \sseq@DeclareDocumentCommand\extensionoptions{od()}{%
1579 \begingroup
1580 \sseq@loadinputline
1581 \IfNoValueTF{#2}{
1582 \sseq@structline@main{extensionoptions}{#1}{#2}{#2}
1583 }{
1584 \def\next{\sseq@extensionoptions@@{extensionoptions}{#1}{#2}}%
1585 \@xptwo\next\sseq@trimleadingspaces
1586 }
1587 }
1588
1589 \sseq@DeclareDocumentCommandAs\sseq@extension@@\extension{mmmd()}{%
1590 \sseq@extension@main{#1}{#2}{#3}{#4}
1591 }
1592
1593 \sseq@DeclareDocumentCommandAs\sseq@extensionoptions@@\extensionoptions{mmmd()}{%
1594 \sseq@extension@main{#1}{#2}{#3}{#4}
1595 }
1596
1597 \def\sseq@extension@main#1#2#3#4{
1598 \sseq@xsetthiscall{\string\extension\IfNoValueF{#2}{\unexpanded{[#2]}}\IfNoValueF{#3}{\unexpanded{(#3)}\IfNoValueF{#4}{\unexpanded{(#4)}}}}%
1599 \def\sseq@edgetype{extension}
1600 \sseq@options@firstpassmode
1601 \the\sseq@sseqstyle
1602 \the\sseq@edgestyle
1603 \the\sseq@structlinestyle
1604 \the\sseq@scope@toks
1605 \sseq@options@normalmode
1606 \IfNoValueF{#2}{%
1607 \sseq@processoptions{extension}{#2}% Outputs result into \sseq@savedoptioncode
1608 }%
1609 \def\sourcename{#3}%
1610 \def\targetname{#4}%
1611 \IfNoValueTF{#3}{%
1612 \def\sourcename{\lastclass1}%
1613 \def\targetname{\lastclass}%
1614 }{%
1615 \IfNoValueT{#4}{%
1616 \def\targetname{\lastclass}%
1617 }%
1618 }%
1619 \sseq@parsecoord\source{\sourcename}{source of extension}%
1620 \sseq@parsecoord\target{\targetname}{target of extension}%
1621 \ifnum\xsource>\xtarget\relax
1622 \sseq@parsedcoords@swap\source\target
1623 \else
1624 \ifnum\xsource=\xtarget\relax
1625 \ifnum\ysource>\ytarget\relax
1626 \sseq@parsedcoords@swap\source\target
1627 \else
1628 \ifnum\ysource=\ytarget\relax
1629 \ifnum\nsource>\ntarget\relax
1630 \sseq@parsedcoords@swap\source\target
1631 \else
1632 \ifnum\nsource=\ntarget\relax
1633 \sseq@error@n{edge-source-target-equal}{\extension}%
1634 \sseq@fbreak
1635 \fi
1636 \fi
1637 \fi
1638 \fi
1639 \fi
1640 \fi
1641 \relax % stop fbreak
1642 \csname sseq@extension@#1\endcsname
1643 \sseq@breakpoint
1644 \endgroup
1645 }
1646 \def\sseq@extension@extension{
1647 \ifnum\sseq@obj{class.\source[\sseq@obj{class.\source.num}].page}<\sseq@infinity\relax
1648 \sseq@error{extension-stillborn}
1649 \sseq@breakfi
1650 \fi
1651 \ifnum\sseq@obj{class.\target[\sseq@obj{class.\target.num}].page}<\sseq@infinity\relax
1652 \sseq@error{extension-stillborn}
1653 \sseq@breakfi
1654 \fi
1655 \edef\sseq@extensionname{extension.\source\target}
1656 \sseq@obj@ifdef{\[email protected]}{%
1657 \sseq@error@xx{extension-already-exists}{\sourcename}{\targetname}
1658 \sseq@breakfi
1659 }{
1660 \sseq@savedpaths@addextension{extension.\source\target}
1661 }
1662 \sseq@cleanup@obj{class.\source.hasextension}
1663 \sseq@obj@gdef{class.\source.hasextension}{}
1664 \sseq@cleanup@obj{class.\target.hasextension}
1665 \sseq@obj@gdef{class.\target.hasextension}{}
1666 \sseq@cleanup@obj{\[email protected]}
1667 \sseq@obj@xdef{\[email protected]}{\source}
1668 \sseq@obj@xdef{\[email protected]}{\target}
1669 \sseq@obj@xodef{\[email protected]}{\sseq@familylist}
1670 \sseq@cleanup@obj{\[email protected]}
1671 \sseq@obj@xdef{\[email protected]}{\ifsseq@needstikz\@nx\sseq@needstikztrue\fi\unexpanded\@xp{\sseq@savedoptioncode}}
1672 }
1673 \def\sseq@extension@extensionoptions{
1674 \edef\sseq@extensionname{extension.\source\target}
1675 \sseq@obj@ifundef{\[email protected]}{
1676 \sseq@error@n{cmdoptions-feature-doesn't-exist}{\extension}
1677 \sseq@break
1678 }{}
1679 \sseq@cleanup@obj{\[email protected]}
1680 \sseq@cleanup@obj{\[email protected]}
1681 \ifsseq@needstikz
1682 \sseq@obj@gaddto{\[email protected]}{\sseq@needstikztrue}
1683 \fi
1684 \sseq@obj@xoaddto{\[email protected]}{\sseq@savedoptioncode}
1685 \sseq@obj@xoaddto{\[email protected]}{\sseq@familylist}
1686 }
1687
1688 \def\sseq@extension@copy#1#2{
1689 \begingroup
1690 \sseq@structline@copy@decomposename#2
1691 \let\sseq@thename@saved\sseq@thename
1692 \def\sseq@pagemin{0}
1693 \sseq@parsecoord\source{\sourcename}{source of structure line}%
1694 \sseq@parsecoord\target{\targetname}{target of structure line}
1695 \def\sseq@thename{#1}
1696 \sseq@lettoobj\sseq@familylist{#2.familylist}
1697 \sseq@lettoobj\sseq@savedoptioncode{#2.options}
1698 \let\sseq@thename\sseq@thename@saved
1699 \sseq@extension@extension
1700 \endgroup
1701 }
1702
1703
1704 \def\sseq@extension@draw@ifpage#1{
1705 \bgroup
1706 \ifnum\sseq@thepage=\sseq@infinity\relax
1707 \sseq@extension@draw{#1}
1708 \fi
1709 \egroup
1710 }
1711 \def\sseq@extension@draw#1{\sseq@eval{\@nx\sseq@drawedge\sseq@obj{#1.source}\sseq@obj{#1.target}{extension}{\@nx\sseq@obj{#1.options}}}}
1712
1713 %% This is a dumb place to put this. It has to be after the differential commands are defined.
1714 \ifsseq@draftmode % Okay, have to dummy out all the main commands.
1715 % Only add tikz background paths to the savedpaths. We need to draw background paths because they might change the bounding box!
1716 \sseq@setsavedpaths@draftmode
1717 \let\sseq@handlequote\@gobble
1718 %
1719 % All we want to do here is record the range. Have to process options in order to figure out where it is.
1720 \sseq@DeclareDocumentCommand\class{or()}{%
1721 \begingroup
1722 \sseq@loadinputline
1723 \IfNoValueT{#2}{\sseq@break}%
1724 \sseq@xsetthiscall{\string\class\IfNoValueF{#1}{[\unexpanded{#1}]}\unexpanded{(#2)}}%
1725 \sseq@options@firstpassmode
1726 \the\sseq@sseqstyle
1727 \the\sseq@classstyle
1728 \sseq@options@normalmode
1729 \IfNoValueF{#1}{%
1730 \sseq@processoptions{class}{#1}% Outputs result into \sseq@savedoptioncode
1731 }%
1732 \sseq@cparsecoord{#2}{}%
1733 \sseq@xminmax{\xcoord}{\ycoord}%
1734 \sseq@yminmax{\xcoord}{\ycoord}%
1735 \sseq@pushstack@\coord % also need the class stack to calculate other \class commands.
1736 \sseq@cleanup@obj{partcoord.(\partialcoord).numnodes}%
1737 \ifnum\nodenum=\@ne
1738 \sseq@obj@gdef{partcoord.(\partialcoord).numnodes}{0}%
1739 \fi
1740 \sseq@obj@xdef{partcoord.(\partialcoord).numnodes}{\nodenum}%
1741 \edef\classname{class.\coord[0]}%
1742 \ifx\sseq@class@tag\pgfutil@empty\else
1743 \sseq@obj@ifdef{partcoord.(\partialcoord).tag.\sseq@class@tagprefix\sseq@class@tag}{%
1744 \sseq@error@xx{class-tag-already-defined}{\sseq@class@tagprefix\sseq@class@tag}{(\partialcoord)}% could be warning
1745 }{}%
1746 \sseq@cleanup@obj{partcoord.(\partialcoord).tag.\sseq@class@tagprefix\sseq@class@tag}%
1747 \sseq@obj@xdef{partcoord.(\partialcoord).tag.\sseq@class@tagprefix\sseq@class@tag}{\nodenum}%
1748 \fi
1749 \ifx\sseq@class@name\pgfutil@empty\else
1750 \sseq@cleanup@obj{\classname.name}
1751 \sseq@cleanup@obj{class.namedclass.\detokenize\@xp{\sseq@class@name}}
1752 \sseq@namehandler
1753 \sseq@obj@xdef{\classname.name}{\sseq@class@name}
1754 \sseq@obj@xdef{class.namedclass.\detokenize\@xp{\sseq@class@name}}{\coordnopar}
1755 \fi
1756 \sseq@breakpoint
1757 \endgroup
1758 }
1759
1760 % Now the rest of these can be no-ops
1761 \sseq@DeclareDocumentCommand\classoptions{od()}{}
1762 \sseq@DeclareDocumentCommand\replaceclass{od()}{}
1763 \sseq@DeclareDocumentCommand\replacesource{o}{}
1764 \sseq@DeclareDocumentCommand\replacetarget{o}{}
1765 \def\sseq@d@main#1#2#3#4#5{}
1766 \DeclareDocumentCommand \sseq@DrawIfValidDifferential@ { mmO{} } {
1767 \sseq@loadinputline
1768 \def\sseq@dtype{d}
1769 \def\sseq@trueclause{#1}
1770 \def\sseq@falseclause{#2}
1771 \sseq@d@grabpage\sseq@DrawIfValidDifferential@@
1772 }
1773 \DeclareDocumentCommand \sseq@DrawIfValidDifferential@@ { d() d() } {
1774 \csname sseq@DrawIfValidDifferential@@handle@truefalse%
1775 @@\sseq@trueclause\sseq@falseclause
1776 \endcsname
1777 }
1778 % Have to do something in case it branches. We somewhat arbitrarily always
1779 % pretend it branched yes.
1780 \def\sseq@DrawIfValidDifferential@@handle@truefalse@@{}
1781 \def\sseq@DrawIfValidDifferential@@handle@truefalse@@T{\@firstofone}
1782 \def\sseq@DrawIfValidDifferential@@handle@truefalse@@F{\@gobble}
1783 \def\sseq@DrawIfValidDifferential@@handle@truefalse@@TF{\@firstoftwo}
1784
1785 \sseq@DeclareDocumentCommand\structline{od()d()}{}
1786 \sseq@DeclareDocumentCommand\structlineoptions{od()d()}{}
1787 \sseq@DeclareDocumentCommand\circleclasses{or()r()}{}
1788 \sseq@DeclareDocumentCommand\gettag{mr()}{}
1789 \expandafter\endinput
1790 \fi
1791
1792
1793 \newcount\sseq@circleclassuid
1794 \sseq@DeclareDocumentCommand\circleclasses{or()r()}{
1795 \begingroup
1796 \sseq@loadinputline
1797 \def\sseq@keysfortikzprim{}
1798 \IfNoValueF{#1}{
1799 \sseq@processoptions{fit}{#1}
1800 }
1801 \sseq@parsecoord\coorda{#2}{first \@nx\circleclass class}
1802 \sseq@parsecoord\coordb{#3}{second \@nx\circleclass class}
1803 %
1804 %
1805 \ifsseq@keepchanges
1806 \@ifundefined{sseq@fit@page}{% also in structline@main. TODO: refactor these chunks together?
1807 \def\sseq@pagemin{0}
1808 \ifnum\sseq@obj{class.\coorda.num}>\z@
1809 \edef\sseq@pagemin{\sseq@obj{class.\coorda[\the\numexpr\sseq@obj{class.\coorda.num}-\@ne].page}}
1810 \fi
1811 \ifnum\sseq@obj{class.\coordb.num}>\z@
1812 \edef\sseq@test{\sseq@obj{class.\coordb[\the\numexpr\sseq@obj{class.\coordb.num}-\@ne].page}}
1813 \ifnum\sseq@test>\sseq@pagemin\relax
1814 \let\sseq@pagemin\sseq@test
1815 \fi
1816 \fi
1817 }{\edef\sseq@pagemin{\the\numexpr\sseq@fit@page-\@ne}}
1818 \@ifundefined{sseq@fit@pagemax}{\let\sseq@pagemax\sseq@infinity}{\let\sseq@pagemax\sseq@fit@pagemax}
1819 \else % Put it on the current page no matter what inside sseqpage
1820 \let\sseq@pagemax\sseq@infinity\def\sseq@pagemin{-1}
1821 \fi
1822 %
1823 %
1824 \global\advance\sseq@circleclassuid\@ne
1825 \edef\circleclassobjname{circleclass(\coordanopar)(\coordbnopar)\the\sseq@circleclassuid}
1826 %
1827 %
1828 \sseq@obj@xodef{\circleclassobjname.options}{\sseq@savedoptioncode}
1829 \sseq@obj@xodef{\circleclassobjname.familylist}{\sseq@familylist}
1830 \sseq@obj@xodef{\circleclassobjname.tikzprimoptions}{\sseq@keysfortikzprim}
1831 \sseq@obj@xdef{\circleclassobjname.fitnodes}{\@nx\tikz@lib@fit{(sseq{\coordanopar})(sseq{\coordbnopar})\sseq@fitalso}}
1832 %\edef\temp{\@nx\sseq@circleclass@draw{\coorda@internalname}{\coordb@internalname}{\unexpanded\@xp{\sseq@savedoptioncode}}}
1833 \sseq@savedpaths@xadd{\@nx\sseq@circleclass@object{\circleclassobjname}{\coordanopar}{\coordbnopar}}
1834 \sseq@obj@xdef{\circleclassobjname.page}{\sseq@pagemax}
1835 \sseq@obj@xdef{\circleclassobjname.pagemin}{\sseq@pagemin}
1836 \@ifundefined{sseq@fit@pagemax}{
1837 \ifsseq@keepchanges
1838 \sseq@class@adddependence{class.\coorda}{\circleclassobjname}% If the source or target is already dead, this will set structlinename.page
1839 \sseq@class@adddependence{class.\coordb}{\circleclassobjname}
1840 \fi
1841 }{}
1842 \sseq@breakpoint
1843 \endgroup
1844 }
1845
1846 \ifsseq@patchfit\else
1847 \sseq@DeclareDocumentCommand\circleclasses{or()r()}{%
1848 \sseq@warning{circleclasses-not-provided}
1849 }
1850 \fi
1851
1852 \def\sseq@circleclass@draw@ifpage#1#2#3{
1853 \sseq@drawtrue
1854 \sseq@obj{#1.familylist}
1855 \ifsseq@draw
1856 \ifnum\sseq@thepagecount<\numexpr\sseq@obj{#1.page}+\@ne
1857 \ifnum\sseq@obj{#1.page}=\sseq@thepagecount
1858 \sseq@thispagetrue
1859 \fi
1860 \ifnum\sseq@obj{#1.pagemin}<\sseq@thepagecount
1861 \sseq@circleclass@draw{#1}{#2}{#3}
1862 \fi
1863 \fi
1864 \fi
1865 }
1866
1867 %%
1868 %% Labels
1869 %%
1870 %% This code is called from the key value handler, but it has more to do with the code in this file so I am putting it here. Search in sseqkeys.code.tex for "Labels"
1871 %%
1872
1873 \def\sseq@processlabels@default{%
1874 \global\let\sseq@classnodetext\pgfutil@empty
1875 \global\let\sseq@classnodetextoptions\pgfutil@empty
1876 \global\let\sseq@classlabelnodes\pgfutil@empty
1877 }
1878 \let\sseq@processlabels\sseq@processlabels@default
1879
1880 \let\sseqlastlabel\empty
1881 % I can't remember why we need to defer this. If at some point I figure this out, I should explain why here and in the definition of \class...
1882 \def\sseq@handleclassquotes@inner#1#2{%
1883 \begingroup\pgfscope
1884 \def\sseq@classquotes@smugglehook{}
1885 \def\sseq@classquotes@smugglehook@inner{}
1886 \sseq@options@firstpassmode
1887 \sseq@thesseqstyle
1888 \sseq@thelabelstyle
1889 \sseq@theclasslabelstyle
1890 \the\sseq@scope@toks
1891 \sseq@options@normalmode
1892 \gdef\sseqlastlabel{#2}
1893 \sseq@processoptions{class/label}{#2}%
1894 \sseq@classlabel@handler{#1}% labeltextfn is a private handler for transformations, sseq@classlabel@handler is exposed via "class label handler"
1895 \ifsseq@classlabel
1896 \sseq@options@firstpassmode
1897 \the\sseq@outerclasslabelstyle
1898 \sseq@x@addto@macro\sseq@classlabelnodes{%
1899 \@nx\sseq@drawlabel{%
1900 \sseq@maybemathswitch\unexpanded\@xp{\result}\sseq@maybemathswitch}%
1901 {% This is set up to prevent a bug where \classoptions and class label style don't work correctly together
1902 \the\sseq@sseqstyle\@nx\the\sseq@sseqstyle@page
1903 \the\sseq@labelstyle\@nx\the\sseq@labelstyle@page
1904 \the\sseq@classlabelstyle\@nx\the\sseq@classlabelstyle@page
1905 \sseq@theouterclasslabelstyle
1906 \@nx\sseq@collections@labels@hook
1907 \@nx\sseq@collections@classlabels@hook
1908 \@nx\sseq@collections@outerclasslabels@hook
1909 \unexpanded\@xp{\sseq@savedoptioncode}%
1910 }%
1911 }%
1912 \else
1913 \let\sseq@classquotes@smugglehook\sseq@classquotes@smugglehook@inner
1914 \sseq@options@firstpassmode
1915 \the\sseq@innerclasslabelstyle
1916 \sseq@options@normalmode
1917 \sseq@protectedeval{\@nx\pgfqkeys{/sseqpages/class/label}{#2}}%
1918 \sseq@protected@xdef\sseq@classnodetext{\sseq@maybemathswitch\result\sseq@maybemathswitch}%
1919 \xdef\sseq@classnodetextoptions{%
1920 %\unexpanded{\def\pgfkeysdefaultpath{/sseqpages/class/node texts/}}%
1921 \sseq@thelabelstyle\sseq@theclasslabelstyle\sseq@theinnerclasslabelstyle
1922 \@nx\sseq@collections@labels@hook
1923 \@nx\sseq@collections@classlabels@hook
1924 \@nx\sseq@collections@innerclasslabels@hook
1925 \unexpanded\@xp{\sseq@savedoptioncode}%
1926 }%
1927 \fi
1928 \@xp\endpgfscope\@xp\endgroup
1929 \sseq@classquotes@smugglehook
1930 }
1931
1932 \def\sseq@handleedgequotes#1#2{% We use this via \let\tikz@quotes@as\sseq@handleedgequotes
1933 /utils/exec={% so it's called inside \pgfkeysalso{stuff}. Need to surround with /utils/exec={} to get out.
1934 \let\sseq@savedoptioncode@save\sseq@savedoptioncode
1935 \sseq@processoptions{label}{#2}
1936 \sseq@needstikztrue
1937 \let\sseq@temp\sseq@savedoptioncode
1938 \let\sseq@savedoptioncode\sseq@savedoptioncode@save
1939 \sseq@e@addto@options{
1940 \@nx\tikzset{
1941 every to/.append style={
1942 edge node={
1943 node [/sseqpages/label,
1944 /utils/exec={
1945 \let\@nx\sseq@tikz@transform@save\@nx\tikz@transform
1946 \let\@nx\tikz@transform\relax
1947 \@nx\sseq@thelabelstyle
1948 \@nx\sseq@collections@labels@hook
1949 \@nx\sseq@theedgelabelstyle
1950 \@nx\sseq@collections@edgelabels@hook
1951 \@xp\@nx\csname sseq@the\sseq@edgetype labelstyle\endcsname
1952 \@xp\@nx\csname sseq@collections@\sseq@edgetype labels@hook\endcsname
1953 \unexpanded\@xp{\sseq@temp}
1954 \ifsseq@rotatelabels\iftikz@fullytransformed\else\@nx\tikz@fullytransformedtrue\@nx\tikz@addtransform{\@nx\pgftransformresetnontranslations\@nx\sseq@globalrotatetransform}\fi\fi
1955 \unexpanded\@xp{\sseq@edgeoptionhook} % this is just to make description work
1956 \let\@nx\tikz@transform\@nx\sseq@tikz@transform@save
1957 }
1958 ]{\sseq@labeltextfn{#1}}
1959 }
1960 }
1961 }
1962 }
1963 }
1964 }
1965
1966