| 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: sseqloadstore.code.tex |
| 9 |
%% |
| 10 |
%% Defines commands for maintaining separate namespaces between distinct spectral sequences and saving information. |
| 11 |
%% |
| 12 |
|
| 13 |
|
| 14 |
% These are attributes that come with a given spectral sequence (by name) |
| 15 |
% All of these values are loaded at the beginning of sseqpage (and of sseqdata if an existing sseq is being modified). |
| 16 |
% They are then stored together at the end of sseqdata (and of sseqpage if "keep changes" option is present). |
| 17 |
\def\sseq@storelist{} |
| 18 |
\def\sseq@storelist@setdefaults{} |
| 19 |
\def\sseq@addtostorelist#1#2{% |
| 20 |
\sseq@g@addto@macro\sseq@storelist{\\#1}% |
| 21 |
\sseq@x@addto@macro\sseq@storelist@setdefaults{\global\let\@nx#1\@xp\@nx\csname \sseq@macroname#1@default\endcsname}% |
| 22 |
\@xp\gdef\csname\sseq@macroname#1@default\endcsname{#2}% |
| 23 |
} |
| 24 |
% TODO: is this used? |
| 25 |
\def\sseq@addtostorelistlet#1#2{% |
| 26 |
\sseq@g@addto@macro\sseq@storelist{\\#1}% |
| 27 |
\sseq@x@addto@macro\sseq@storelist@setdefaults{\global\let\@nx#1\@xp\@nx\csname \sseq@macroname#1@default\endcsname}% |
| 28 |
\global\@xp\let\csname\sseq@macroname#1@default\endcsname#2% |
| 29 |
} |
| 30 |
|
| 31 |
\def\sseq@addiftostorelist#1{\sseq@addiftostorelistopt{#1}{false}} |
| 32 |
\def\sseq@addiftostorelist@truedefault#1{\sseq@addiftostorelistopt{#1}{true}} |
| 33 |
\def\sseq@addiftostorelistopt#1#2{% |
| 34 |
\@xp\newif\csname ifsseq@#1\endcsname |
| 35 |
\sseq@g@addto@macro\sseq@storelist{\sseq@storelistif{#1}}% |
| 36 |
\sseq@x@addto@macro\sseq@storelist@setdefaults{\@xp\@nx\csname sseq@#1@default\endcsname}% |
| 37 |
\@xp\xdef\csname sseq@#1@default\endcsname{\global\@xp\@nx\csname sseq@#1#2\endcsname}% |
| 38 |
} |
| 39 |
\def\sseq@addkeytostorelist#1#2{ |
| 40 |
\sseq@g@addto@macro\sseq@storelist{\sseq@storelistkey{#1}}% |
| 41 |
\sseq@x@addto@macro\sseq@storelist@setdefaults{ |
| 42 |
\global\let\@xp\@nx\csname pgfk@#1/.@cmd\endcsname\@xp\@nx\csname pgfk@#1/.@cmd@default\endcsname |
| 43 |
\global\let\@xp\@nx\csname pgfk@#1/.@body\endcsname\@xp\@nx\csname pgfk@#1/.@body@default\endcsname |
| 44 |
}% |
| 45 |
\pgfkeysdef{#1}{#2}% |
| 46 |
\global\@xp\let\csname pgfk@#1/.@cmd@default\@xp\endcsname\csname pgfk@#1/.@cmd\endcsname |
| 47 |
\global\@xp\let\csname pgfk@#1/.@body@default\@xp\endcsname\csname pgfk@#1/.@body\endcsname |
| 48 |
} |
| 49 |
|
| 50 |
% transfer data about the current spectral sequence between \<command> and \<command><sseqname> |
| 51 |
\def\sseq@storelist@store#1{\global\@xp\let\csname\sseq@macroname#1@@@\sseq@thename\endcsname#1} |
| 52 |
\def\sseq@storelist@get#1{\global\@xp\let\@xp#1\csname\sseq@macroname#1@@@\sseq@thename\endcsname} |
| 53 |
|
| 54 |
\def\sseq@storelistif@store#1{% |
| 55 |
\@xp\edef\csname sseq@storeif@#1\endcsname{\csname ifsseq@#1\endcsname \@xp\@nx\csname sseq@#1true\endcsname\else\@xp\@nx\csname sseq@#1false\endcsname\fi}% |
| 56 |
\@xp\sseq@storelist@store\csname sseq@storeif@#1\endcsname |
| 57 |
} |
| 58 |
\def\sseq@storelistif@get#1{ |
| 59 |
\@xp\sseq@storelist@get\csname sseq@storeif@#1\endcsname |
| 60 |
\csname sseq@storeif@#1\endcsname |
| 61 |
} |
| 62 |
|
| 63 |
\def\sseq@storelistkey@store#1{ |
| 64 |
\global\@xp\let\csname pgfk@#1/.@cmd@@@\sseq@thename\@xp\endcsname\csname pgfk@#1/.@cmd\endcsname |
| 65 |
\global\@xp\let\csname pgfk@#1/.@body@@@\sseq@thename\@xp\endcsname\csname pgfk@#1/.@body\endcsname |
| 66 |
} |
| 67 |
\def\sseq@storelistkey@get#1{ |
| 68 |
\global\@xp\let\csname pgfk@#1/.@cmd\@xp\endcsname\csname pgfk@#1/.@cmd@@@\sseq@thename\endcsname |
| 69 |
\global\@xp\let\csname pgfk@#1/.@body\@xp\endcsname\csname pgfk@#1/.@body@@@\sseq@thename\endcsname |
| 70 |
} |
| 71 |
|
| 72 |
\def\sseq@storecmds{\let\\\sseq@storelist@store\let\sseq@storelistif\sseq@storelistif@store\let\sseq@storelistkey\sseq@storelistkey@store\sseq@storelist} |
| 73 |
\def\sseq@getcmds{\let\\\sseq@storelist@get\let\sseq@storelistif\sseq@storelistif@get\let\sseq@storelistkey\sseq@storelistkey@get\sseq@storelist} |
| 74 |
|
| 75 |
%%%% New "poor man's OOP" Load/Store |
| 76 |
% Directly stores things into commands that are annotated with the name of the spectral sequence. |
| 77 |
% I use this primarily for commands that won't necessarily exist for every spectral sequence |
| 78 |
% for instance because it has the description of a particular class or differential as part of its name |
| 79 |
\def\sseq@obj@fullname#1{sseq.\sseq@thename.#1} |
| 80 |
\def\sseq@obj#1{\csname sseq.\sseq@thename.#1\endcsname} |
| 81 |
\def\sseq@obj@gdef#1{\@xptwo\gdef\sseq@obj{#1}} |
| 82 |
\def\sseq@obj@xdef#1{\@xptwo\xdef\sseq@obj{#1}} |
| 83 |
\def\sseq@obj@protectedxdef#1{\@xptwo\sseq@protected@xdef\sseq@obj{#1}} |
| 84 |
\def\sseq@obj@xodef#1{\@xp\gdef\csname \sseq@obj@fullname{#1}\@xp\endcsname\@xp} |
| 85 |
\def\sseq@obj@let#1{\@xptwo\let\sseq@obj{#1}} % This shouldn't be used anywhere because all object assignments should be global... |
| 86 |
\def\sseq@obj@glet#1{\global\@xptwo\let\sseq@obj{#1}} |
| 87 |
\def\sseq@obj@gletcsname#1#2{\global\@xp\let\csname\sseq@obj@fullname{#1}\@xp\endcsname\csname#2\endcsname} |
| 88 |
\def\sseq@obj@gletobj#1#2{\global\@xp\let\csname\sseq@obj@fullname{#1}\@xp\endcsname\csname\sseq@obj@fullname{#2}\endcsname} |
| 89 |
\def\sseq@obj@undef#1{\global\@xptwo\let\sseq@obj{#1}\relax} |
| 90 |
\def\sseq@obj@show#1{\@xptwo\show\sseq@obj{#1}} |
| 91 |
\def\sseq@obj@ifundef#1{\@ifundefined{\sseq@obj@fullname{#1}}} |
| 92 |
\def\sseq@obj@ifdef#1#2#3{\@ifundefined{\sseq@obj@fullname{#1}}{#3}{#2}} |
| 93 |
\def\sseq@obj@useifdef@else#1#2{\@ifundefined{\sseq@obj@fullname{#1}}{#2}{\sseq@obj{#1}}} |
| 94 |
\def\sseq@obj@inccheckdef#1{\sseq@obj@ifundef{#1}{\sseq@obj@gdef{#1}{1}}{\sseq@obj@inc{#1}}} |
| 95 |
\def\sseq@obj@inc#1{\sseq@obj@xdef{#1}{\the\numexpr\sseq@obj{#1}+1}} |
| 96 |
\def\sseq@obj@gaddto#1{\sseq@obj@ifundef{#1}{\sseq@obj@gdef{#1}}{\@xptwo\sseq@g@addto@macro\sseq@obj{#1}}} |
| 97 |
\def\sseq@obj@xaddto#1{\sseq@obj@ifundef{#1}{\sseq@obj@xdef{#1}}{\@xptwo\sseq@x@addto@macro\sseq@obj{#1}}} |
| 98 |
\def\sseq@obj@xoaddto#1{\sseq@obj@ifundef{#1}{\sseq@obj@xodef{#1}}{\@xp\sseq@g@addto@macro\csname \sseq@obj@fullname{#1}\@xp\endcsname\@xp}} |
| 99 |
\def\sseq@obj@map#1#2{\def\\##1{#2}\sseq@obj{#1}} |
| 100 |
|
| 101 |
\def\sseq@lettoobj#1#2{\sseq@obj@ifdef{#2}{\@xp\let\@xp#1\csname\sseq@obj@fullname{#2}\endcsname}{\let#1\empty}} |
| 102 |
|
| 103 |
|
| 104 |
\def\sseq@obj@ifchanged#1#2#3{\sseq@obj@ifundef{#1.changed}{#3}{#2}} |
| 105 |
\def\sseq@obj@changedtrue#1{\sseq@obj@gdef{#1.changed}{}} |
| 106 |
\def\sseq@obj@changedfalse#1{\sseq@obj@undef{#1.changed}} |
| 107 |
|
| 108 |
\def\sseq@cleanup@obj#1{ |
| 109 |
\ifsseq@keepchanges\else |
| 110 |
\sseq@obj@ifchanged{#1}{}{ |
| 111 |
\sseq@obj@changedtrue{#1} |
| 112 |
\sseq@x@addto@macro\sseq@pagecleanup{ |
| 113 |
\@xptwo\ifx\sseq@obj{#1}\relax |
| 114 |
\global\@nx\sseq@obj@let{#1}\relax |
| 115 |
\else |
| 116 |
\@nx\sseq@obj@gdef{#1}{\unexpanded\@xpthree{\sseq@obj{#1}}} |
| 117 |
\fi |
| 118 |
\@nx\sseq@obj@changedfalse{#1} |
| 119 |
} |
| 120 |
} |
| 121 |
\fi |
| 122 |
} |
| 123 |
|
| 124 |
|
| 125 |
%%%% Saved paths, temporary saved paths, background saved paths |
| 126 |
% \sseq@savedpaths@whatever is redefined to be \sseq@savedpaths@whatever@standard or \sseq@savedpaths@whatever@temporary depending on context |
| 127 |
% This simplifies the code a lot because I don't have to check again where I should put things. |
| 128 |
\sseq@addtostorelist\sseq@savedpaths{} |
| 129 |
\def\sseq@tempsavedpaths{} |
| 130 |
\def\sseq@savedpaths@addclass@standard#1{\sseq@x@addto@macro\sseq@savedpaths{\@nx\sseq@class@object{#1}}} |
| 131 |
\def\sseq@savedpaths@adddifferential@standard#1{\sseq@x@addto@macro\sseq@savedpaths{\@nx\sseq@differential@object{#1}}} |
| 132 |
\def\sseq@savedpaths@addextension@standard#1{\sseq@x@addto@macro\sseq@savedpaths{\@nx\sseq@extension@object{#1}}} |
| 133 |
\def\sseq@savedpaths@addstructline@standard#1{\sseq@x@addto@macro\sseq@savedpaths{\@nx\sseq@structline@object{#1}}} |
| 134 |
\def\sseq@savedpaths@xaddtikzpath@standard#1{\sseq@x@addto@macro\sseq@savedpaths{\@nx\sseq@tikzpath@object{#1}}} |
| 135 |
\def\sseq@savedpaths@add@standard{\sseq@g@addto@macro\sseq@savedpaths} |
| 136 |
\def\sseq@savedpaths@xadd@standard{\sseq@x@addto@macro\sseq@savedpaths} |
| 137 |
\def\sseq@savedpaths@show@standard{\show\sseq@savedpaths} |
| 138 |
\def\sseq@scope@savedpaths@add@standard#1{\sseq@savedpaths@add@standard{#1}\sseq@savedpaths@add@background{#1}} |
| 139 |
|
| 140 |
\def\sseq@savedpaths@addclass@temporary#1{\sseq@x@addto@macro\sseq@tempsavedpaths{\@nx\sseq@class@draw@ifpage{#1}}} |
| 141 |
\def\sseq@savedpaths@adddifferential@temporary#1{\sseq@x@addto@macro\sseq@tempsavedpaths{\@nx\sseq@differential@draw@ifpage{#1}}} |
| 142 |
\def\sseq@savedpaths@addextension@temporary#1{\sseq@x@addto@macro\sseq@tempsavedpaths{\@nx\sseq@extension@draw@ifpage{#1}}} |
| 143 |
\def\sseq@savedpaths@addstructline@temporary#1{\sseq@x@addto@macro\sseq@tempsavedpaths{\@nx\sseq@structline@draw@ifpage{#1}}} |
| 144 |
\def\sseq@savedpaths@xaddtikzpath@temporary#1{\sseq@x@addto@macro\sseq@tempsavedpaths{#1}} |
| 145 |
\def\sseq@savedpaths@add@temporary{\sseq@g@addto@macro\sseq@tempsavedpaths} |
| 146 |
\def\sseq@savedpaths@xadd@temporary{\sseq@x@addto@macro\sseq@tempsavedpaths} |
| 147 |
\def\sseq@savedpaths@show@temporary{\show\sseq@tempsavedpaths} |
| 148 |
\def\sseq@scope@savedpaths@add@temporary#1{\sseq@savedpaths@add@temporary{#1}\sseq@savedpaths@add@background{#1}} |
| 149 |
|
| 150 |
|
| 151 |
\def\sseq@savedpaths@addclass@background#1{\sseq@error@internal@n{illegal-add-background-mode}{\sseq@savedpaths@addclass}} |
| 152 |
\def\sseq@savedpaths@adddifferential@background#1{\sseq@error@internal@n{illegal-add-background-mode}{\sseq@savedpaths@adddifferential}} |
| 153 |
\def\sseq@savedpaths@addstructline@background#1{\sseq@error@internal@n{illegal-add-background-mode}{\sseq@savedpaths@addstructline}} |
| 154 |
\def\sseq@savedpaths@addextension@background#1{\sseq@error@internal@n{illegal-add-background-mode}{\sseq@savedpaths@addextension}} |
| 155 |
\def\sseq@savedpaths@xaddtikzpath@background#1{\sseq@x@addto@macro\sseq@savedbackgroundpaths{#1}} |
| 156 |
\def\sseq@savedpaths@add@background{\sseq@g@addto@macro\sseq@savedbackgroundpaths} |
| 157 |
\def\sseq@savedpaths@xadd@background{\sseq@x@addto@macro\sseq@savedbackgroundpaths} |
| 158 |
\def\sseq@savedpaths@show@background{\show\sseq@savedbackgroundpaths} |
| 159 |
|
| 160 |
\def\sseq@savedpaths@addclass@ignore#1{} |
| 161 |
\def\sseq@savedpaths@adddifferential@ignore#1{} |
| 162 |
\def\sseq@savedpaths@addstructline@ignore#1{} |
| 163 |
\def\sseq@savedpaths@addextension@ignore#1{} |
| 164 |
\def\sseq@savedpaths@xaddtikzpath@ignore#1{} |
| 165 |
\def\sseq@savedpaths@add@ignore#1{} |
| 166 |
\def\sseq@savedpaths@xadd@ignore#1{} |
| 167 |
\def\sseq@savedpaths@show@ignore#1{} |
| 168 |
\def\sseq@scope@savedpaths@add@ignore#1{} |
| 169 |
|
| 170 |
\def\sseq@setsavedpaths#1{% |
| 171 |
\@xp\let\@xp\sseq@savedpaths@addclass \csname sseq@savedpaths@addclass@#1\endcsname |
| 172 |
\@xp\let\@xp\sseq@savedpaths@adddifferential\csname sseq@savedpaths@adddifferential@#1\endcsname |
| 173 |
\@xp\let\@xp\sseq@savedpaths@addstructline \csname sseq@savedpaths@addstructline@#1\endcsname |
| 174 |
\@xp\let\@xp\sseq@savedpaths@addextension \csname sseq@savedpaths@addextension@#1\endcsname |
| 175 |
\@xp\let\@xp\sseq@savedpaths@xaddtikzpath \csname sseq@savedpaths@xaddtikzpath@#1\endcsname |
| 176 |
\@xp\let\@xp\sseq@savedpaths@add \csname sseq@savedpaths@add@#1\endcsname |
| 177 |
\@xp\let\@xp\sseq@savedpaths@xadd \csname sseq@savedpaths@xadd@#1\endcsname |
| 178 |
\pgfutil@ifundefined{sseq@scope@savedpaths@add@#1}{}{% |
| 179 |
\@xp\let\@xp\sseq@savedpaths@show \csname sseq@savedpaths@show@#1\endcsname |
| 180 |
\@xp\let\@xp\sseq@scope@savedpaths@add \csname sseq@scope@savedpaths@add@#1\endcsname |
| 181 |
}% |
| 182 |
} |
| 183 |
|
| 184 |
% We don't want to add anything to paths except for tikz paths in background mode |
| 185 |
% We need to draw those because they might affect the bounding box. |
| 186 |
\def\sseq@setsavedpaths@draftmode{ |
| 187 |
\sseq@setsavedpaths{ignore} % Don't add stuff to paths |
| 188 |
% Only add tikzpaths if in background mode (so ignore in standard or temporary) |
| 189 |
\let\sseq@savedpaths@xaddtikzpath@standard\@gobble |
| 190 |
\let\sseq@savedpaths@xaddtikzpath@temporary\@gobble |
| 191 |
% Only update mode for tikzpath |
| 192 |
\def\sseq@setsavedpaths##1{\@xp\let\@xp\sseq@savedpaths@xaddtikzpath \csname sseq@savedpaths@xaddtikzpath@##1\endcsname} |
| 193 |
} |
| 194 |
|