-
-
Notifications
You must be signed in to change notification settings - Fork 142
/
Copy pathmemory2.sty
104 lines (100 loc) · 4.12 KB
/
memory2.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
%%
%% This is file `memory.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% memory.dtx (with options: `memory')
%%
%% This is a generated file.
%%
%% Copyright (C) 2013 by Song Zhiwei <[email protected]>
%%
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3c of this license
%% or (at your option) any later version. The latest version of this
%% license is in:
%%
%% http://www.latex-project.org/lppl.txt 32
%%
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2006/05/20 or later.
%%
\NeedsTeXFormat{LaTeX2e}[2003/12/01]
\ProvidesPackage{NOVAthesisFiles/memory2}
[2013/05/13 v1.2 containers for data of object and array in LaTeX]
% \RequirePackage{trimspaces}
\def\memoryemptybox{{%
\setlength{\fboxsep}{0pt}\LARGE\setbox0=\hbox{$\times$}%
\fbox{\rule{\wd0}{0pt}\rule{0pt}{\ht0}}%
}}
\def\memoryxbox{{\setlength{\fboxsep}{0pt}\LARGE\fbox{$\times$}}}
\def\datacrossiftrue#1(#2){%
\defifundef{\ifmemorycross}{\newif}%
\memorycrossfalse%
\@for\@memory@it:=#2\do{\ifdatadefined{#1}(#2){\memorycrosstrue}{}}%
\bgroup%
\ifmemorycross\memoryxbox\else\memoryemptybox\fi%
\egroup%
}
% \ifdatadefinedor{\match}{dataname}({val1},…){true}{false}
\def\ifdatadefinedor#1#2(#3){%
\@ifddor(#3,\@nil){#1}{#2}%
}
% \ifdatadefinedor({val1},…){\match}{dataname}{true}{false}
\def\@ifddor(#1,#2\@nil)#3#4#5#6{%
% \edef\@argone{#1}%
% \trim@spaces@in\@argone
% \edef\@argone{\zap@space#1 \@empty}
% \typeout{MEMORY ddor=#4(\@argone)(#2)}%
\ifdatadefined{#4}(\expanded{#1}){%
% \typeout{MEMORY >>> FOUND: #4(#1)}%
\edef#3{#1}#5%
}{\ifx\@nil#2\@nil\relax\expandafter#6\else\@ifddor(#2\@nil){#3}{#4}{#5}{#6}\fi}%
}
\def\ifdatadefined#1(#2)#3#4{%
\ifcsname @\expanded{#1}@\expanded{#2}@memory\endcsname#3\else#4\fi%
}
\def\ifdataequal#1(#2)#3#4#5{%
\ifdatadefined#1(#2){%
\edef\@data@tmp{\csname @\expanded{#1}@\expanded{#2}@memory\endcsname}%
\if\@data@tmp#3\relax#4\else#5\fi%
}{#5}%
}
\def\datadefault#1(#2){%
\ifdatadefined{#1}(#2){%
\csname the#1\endcsname(#2)%
}{%
\ifdatadefined{#1}(){\csname the#1\endcsname()}{}%
}%
}
\def\set@memory@i#1#2#3{\if#1*\expandafter\gdef\csname#2\endcsname{#3}%
\else\expandafter\def\csname#2\endcsname{#3}\fi}
\def\set@cond@memory@i#1#2?#3{\ifcsname#2\endcsname\else\set@memory@i{#1}{#2}{#3}\fi}
\def\set@memory#1#2={\@ifnextchar?{\set@cond@memory@i{#1}{#2}}{\set@memory@i{#1}{#2}}}
\def\eset@memory@i#1#2#3{\if#1*\expandafter\xdef\csname#2\endcsname{#3}%
\else\expandafter\protected@edef\csname#2\endcsname{#3}\fi}
\def\eset@cond@memory@i#1#2?#3{\ifcsname#2\endcsname\else\eset@memory@i{#1}{#2}{#3}\fi}
\def\eset@memory#1#2={\@ifnextchar?{\eset@cond@memory@i{#1}{#2}}{\eset@memory@i{#1}{#2}}}
\def\etest@memory#1#2:{\@ifnextchar={\eset@memory{#1}{#2}}
{\PackageError{memory}{Please use “=” or “:=”.}{}}}
\def\data@memory#1#2{\@ifnextchar={\set@memory{#1}{@#2@memory}}
{\@ifnextchar:{\etest@memory{#1}{@#2@memory}}
{\PackageError{memory}{Please use \string\the#2 macro instead of \string\#2.}{}}}}
\def\array@memory#1#2(#3){\data@memory{#1}{#2@#3}}
\def\newdata@memory#1#2{\@ifundefined{#2}
{\if#1*
\expandafter\gdef\csname#2\endcsname{\array@memory{#1}{#2}}
\expandafter\gdef\csname the#2\endcsname(##1){\csname @#2@\expanded{##1}@memory\endcsname}
\expandafter\gdef\csname THE#2\endcsname(##1){\MakeTextUppercase{\csname @#2@\expanded{##1}@memory\endcsname}}
\else
\expandafter\def\csname#2\endcsname{\array@memory{#1}{#2}}
\expandafter\def\csname the#2\endcsname(##1){\csname @#2@\expanded{##1}@memory\endcsname}
\expandafter\def\csname THE#2\endcsname(##1){\MakeTextUppercase{\csname @#2@\expanded{##1}@memory\endcsname}}
\fi}
{\PackageWarningNoLine{memory}{`#2' already defined.
Macro `newdata' ignored!}}}
\def\newdata{\@ifnextchar*{\newdata@memory}{\newdata@memory{}}}
\endinput
%%
%% End of file `memory.sty'.