summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/memory/memory.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-05-13 23:46:45 +0000
committerKarl Berry <karl@freefriends.org>2013-05-13 23:46:45 +0000
commit37779918ae3fb37b74b1153c61c19b3e3c8aa501 (patch)
tree286a3e244e0e66624e31e66f752e6751ac7417a0 /Master/texmf-dist/source/latex/memory/memory.dtx
parent53fd1db4e92c7f40124c92de9c43b455aa7f29bb (diff)
memory (13may13)
git-svn-id: svn://tug.org/texlive/trunk@30452 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/memory/memory.dtx')
-rw-r--r--Master/texmf-dist/source/latex/memory/memory.dtx136
1 files changed, 136 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/memory/memory.dtx b/Master/texmf-dist/source/latex/memory/memory.dtx
new file mode 100644
index 00000000000..537757498bc
--- /dev/null
+++ b/Master/texmf-dist/source/latex/memory/memory.dtx
@@ -0,0 +1,136 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2013 by Song Zhiwei <songzw@gmail.com>
+% -----------------------------------------------------------
+%
+% 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
+%
+% and version 1.3c or later is part of all distributions of LaTeX
+% version 2006/05/20 or later.
+%
+% \fi
+%
+% \iffalse
+%
+%<*driver>
+\ProvidesFile{memory.dtx}
+%</driver>
+%<memory>\NeedsTeXFormat{LaTeX2e}[2003/12/01]
+%<memory>\ProvidesPackage{memory}
+%<*memory>
+ [2013/05/13 v1.2 containers for data of object and array in LaTeX]
+%</memory>
+%<*driver>
+\documentclass[a4paper]{ltxdoc}
+\usepackage{memory}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\OnlyDescription
+\begin{document}
+ \DocInput{memory.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{69}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+% \changes{v1.2}{2013/05/13}{Uses := to set the expanded value to a variable}
+% \changes{v1.1}{2013/05/11}{Reports warning when redeclaring a variable}
+% \changes{v1.0}{2013/05/10}{Initial version}
+%
+% \GetFileInfo{memory.dtx}
+%
+% \DoNotIndex{}
+%
+% \title{The \textsf{memory} package\thanks{This document
+% corresponds to \textsf{memory}~\fileversion, dated \filedate.}}
+% \author{Song Zhiwei\\\texttt{songzw@gmail.com}}
+%
+% \maketitle
+%
+% \section{Introduction}
+%
+% The package memory.sty provides an easy way to declare object or array
+% containers.
+% If you are considering to use an auxiliary file, you really need
+% this package rather than the heavy I/O manipulation.
+%
+% \section{Usage}
+% \newcommand\MyDescribeMacro[1]{\marginpar{\raggedleft\strut\MacroFont#1}}
+% \DescribeMacro{\newdata\marg{variable}}
+% \DescribeMacro{\newdata*\marg{variable}}
+% These macros declare data variables locally and globally, respectively.
+% The value for star version is also saved globally.
+% \begin{verbatim}\newdata{Person} % Note: no backslash for the variable declaration
+%\newdata*{Time}\end{verbatim}\newdata{Person} \newdata*{Time}
+% Uses = or := to set value. The := version sets the expanded value to variable.
+% \MyDescribeMacro{\textbackslash\meta{var}\oarg{p}=\marg{value}}%
+% \MyDescribeMacro{\textbackslash\meta{var}\oarg{p}:=\marg{value}}\\[0.5em]
+% -- Sets value as a single variable.
+% \begin{verbatim}\Person = {Song Zhiwei} % Note: add backslash for declared variable
+%\Time := \today\end{verbatim}
+% \Person = {Song Zhiwei} \Time := \today
+% -- Sets value as an array.
+% \begin{verbatim}\Person[1] = {28.3}\end{verbatim}\Person[1] = {28.3}
+% -- Sets value as a multiple dimensional array.
+% \begin{verbatim}\Time[2,5,\thesection] = {13 May 2013}\end{verbatim}
+% \Time[2,5,\thesection] = {13 May 2013}
+% -- Sets value as an object.
+% \begin{verbatim}\Person[description] = {A Chinese gentleman.}
+%\Person[hair] = {black}\end{verbatim}
+% \Person[description] = {A Chinese gentleman.}
+% \Person[hair] = {black}
+% -- Gets values.
+% \MyDescribeMacro{\textbackslash\meta{variable}\oarg{p}}
+% \begin{center}\newcommand\VRule{\rule[-0.2em]{0.4pt}{1.2em}}
+% \verb|\Person|\hfill\VRule\quad\makebox[12em][l]{\Person}\\
+% \verb|\Time|\hfill\VRule\quad\makebox[12em][l]{\Time}\\
+% \verb|\Person[1]|\hfill\VRule\quad\makebox[12em][l]{\Person[1]}\\
+% \verb|\Time[2,5,\thesection]|\hfill\VRule\quad\makebox[12em][l]{\Time[2,5,\thesection]}\\
+% \verb|\Person[description]|\hfill\VRule\quad\makebox[12em][l]{\Person[description]}\\
+% \verb|\Person[hair]|\hfill\VRule\quad\makebox[12em][l]{\Person[hair]}
+% \end{center}
+%
+% \StopEventually{}
+\def\set@memory#1#2=#3{\if#1*\expandafter\gdef\csname#2\endcsname{#3}%
+ \else\expandafter\def\csname#2\endcsname{#3}\fi}
+\def\eset@memory#1#2=#3{\if#1*\expandafter\xdef\csname#2\endcsname{#3}%
+ \else\expandafter\edef\csname#2\endcsname{#3}\fi}
+\def\etest@memory#1#2:{\@ifnextchar={\eset@memory{#1}{#2}}
+ {\csname #2\endcsname:}}
+\def\data@memory#1#2{\@ifnextchar={\set@memory{#1}{@#2@memory}}
+ {\@ifnextchar:{\etest@memory{#1}{@#2@memory}}
+ {\csname @#2@memory\endcsname}}}
+\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{\@ifnextchar[
+ {\array@memory{#1}{#2}}{\data@memory{#1}{#2}}}%
+ \else \expandafter\def\csname#2\endcsname{\@ifnextchar[
+ {\array@memory{#1}{#2}}{\data@memory{#1}{#2}}}\fi}
+ {\PackageWarningNoLine{memory}{`#2' already defined.
+ Macro `newdata' ignored!}}}
+\def\newdata{\@ifnextchar*{\newdata@memory}{\newdata@memory{}}}
+% \Finale
+\endinput