From dc9526cb9ac65af66d74d5b44c78647df15e5b13 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 11 Dec 2009 01:03:36 +0000 Subject: tikz-timing 0.7 (9dec09) git-svn-id: svn://tug.org/texlive/trunk@16348 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/tikz-timing/README | 12 +- .../doc/latex/tikz-timing/tikz-timing.pdf | Bin 789735 -> 800447 bytes .../texmf-dist/source/latex/tikz-timing/Makefile | 87 +- .../source/latex/tikz-timing/tikz-timing.dtx | 6706 ++++++++++++++++---- .../source/latex/tikz-timing/tikz-timing.ins | 16 +- .../tex/latex/tikz-timing/tikz-timing-advnodes.sty | 617 ++ .../tex/latex/tikz-timing/tikz-timing-arrows.sty | 48 +- .../tex/latex/tikz-timing/tikz-timing-beamer.sty | 51 + .../latex/tikz-timing/tikz-timing-clockarrows.sty | 99 + .../latex/tikz-timing/tikz-timing-columntype.sty | 89 + .../tex/latex/tikz-timing/tikz-timing-counters.sty | 100 + .../tex/latex/tikz-timing/tikz-timing-either.sty | 799 ++- .../tex/latex/tikz-timing/tikz-timing-ifsym.sty | 89 + .../tex/latex/tikz-timing/tikz-timing-interval.sty | 111 + .../tex/latex/tikz-timing/tikz-timing-nicetabs.sty | 125 + .../tex/latex/tikz-timing/tikz-timing-overlays.sty | 79 +- .../tex/latex/tikz-timing/tikz-timing.sty | 2060 ++++-- 17 files changed, 9055 insertions(+), 2033 deletions(-) create mode 100644 Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-advnodes.sty create mode 100644 Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-beamer.sty create mode 100644 Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-clockarrows.sty create mode 100644 Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-columntype.sty create mode 100644 Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-counters.sty create mode 100644 Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-ifsym.sty create mode 100644 Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-interval.sty create mode 100644 Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-nicetabs.sty diff --git a/Master/texmf-dist/doc/latex/tikz-timing/README b/Master/texmf-dist/doc/latex/tikz-timing/README index 91ae56d861c..e021a5c9b57 100644 --- a/Master/texmf-dist/doc/latex/tikz-timing/README +++ b/Master/texmf-dist/doc/latex/tikz-timing/README @@ -1,16 +1,16 @@ -------------------------------------------------------------- tikz-timing - version 0.5, May 15th, 2009 -------------------------------------------------------------- -This package lets you typeset keywords of the version -control system Subversion inside your LaTeX files anywhere -you like. Unlike the very similar package 'svn' the usage of -multiple files for one LaTeX document is well supported. +This package provides macros and an environment to generate timing diagrams +(digital waveforms) without much effort. The TikZ (pgf) package is used to +produce the graphics. The diagrams may be inserted into text (paragraphs, +\hbox, etc.) and into tikzpictures. A tabular-like environment is provided to +produce larger timing diagrams. Copyright (C) 2009 Martin Scharrer E-mail: martin@scharrer-online.de -WWW: http://www.scharrer-online.de/latex/ +WWW: http://latex.scharrer-online.de/tikz-timing/ This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c diff --git a/Master/texmf-dist/doc/latex/tikz-timing/tikz-timing.pdf b/Master/texmf-dist/doc/latex/tikz-timing/tikz-timing.pdf index bee0d7f9e6c..6e1e5a31ffb 100644 Binary files a/Master/texmf-dist/doc/latex/tikz-timing/tikz-timing.pdf and b/Master/texmf-dist/doc/latex/tikz-timing/tikz-timing.pdf differ diff --git a/Master/texmf-dist/source/latex/tikz-timing/Makefile b/Master/texmf-dist/source/latex/tikz-timing/Makefile index b9a8a21a1fa..d83b96c88e9 100644 --- a/Master/texmf-dist/source/latex/tikz-timing/Makefile +++ b/Master/texmf-dist/source/latex/tikz-timing/Makefile @@ -1,20 +1,23 @@ -# $Id: Makefile 1156 2009-07-28 01:16:20Z martin $ +# $Id: Makefile 1537 2009-12-01 15:19:58Z martin $ PACKAGE=tikz-timing -PACKAGE_STY = ${PACKAGE}.sty +PACKAGE_STY = ${PACKAGE}.sty ${PACKAGE}-*.sty PACKAGE_DOC = ${PACKAGE}.pdf PACKAGE_SRC = ${PACKAGE}.dtx ${PACKAGE}.ins Makefile PACKFILES = ${PACKAGE_SRC} ${PACKAGE_DOC} README -TEXAUX = *.aux *.log *.glo *.ind *.idx *.out *.svn *.svx *.svt *.toc *.ilg *.gls *.hd *.exa *.exb *.fdb_latexmk +TEXAUX = *.aux *.log *.glo *.ind *.idx *.out *.svn *.svx *.svt *.toc *.ilg *.gls *.hd *.exa *.exb *.thm *.fdb_latexmk +TESTDIR = tests INSGENERATED = ${PACKAGE_STY} ZIPFILE = ${PACKAGE}-${ZIPVERSION}.zip -TDSZIPFILE = ${PACKAGE}.tds.zip +TDSZIPFILE = ${PACKAGE}-${ZIPVERSION}.tds.zip GENERATED = ${INSGENERATED} ${PACKAGE}.pdf ZIPS = zip tdszip LATEX_OPTIONS = -interaction=batchmode LATEX = pdflatex ${LATEX_OPTIONS} +SHELL=/bin/bash + TEXMFDIR = ${HOME}/texmf CP = cp -v @@ -22,17 +25,29 @@ MV = mv -v RMDIR = rm -rf MKDIR = mkdir -p -.PHONY: all doc package clean fullclean tds +.PHONY: all doc package clean fullclean tds reload all: package doc example new: fullclean all -doc: ${PACKAGE}.pdf +doc: ${PACKAGE}.pdf reload + +pdf: one_run reload + package: ${PACKAGE}.sty +reload: + -@pdfreload --file ${PACKAGE}.pdf 2>/dev/null || pdfopen --file ${PACKAGE}.pdf + example: +ctanify: ${PACKFILES} + ctanify $^ + +one_run: ${PACKAGE}.dtx + ${LATEX} $< + %.pdf: %.dtx ${LATEX} $*.dtx -makeindex -s gind.ist -o $*.ind $*.idx @@ -64,7 +79,7 @@ zip: @${MAKE} --no-print-directory ${ZIPFILE} ${PACKAGE}%.zip: ${PACKFILES} - grep -q '\* Checksum passed \*' ${PACKAGE}.log + @test -n "${IGNORE_CHECKSUM}" || grep -q '\* Checksum passed \*' ${PACKAGE}.log -pdfopt ${PACKAGE}.pdf opt_${PACKAGE}.pdf && mv opt_${PACKAGE}.pdf ${PACKAGE}.pdf ${RM} $@ zip $@ ${PACKFILES} @@ -74,7 +89,7 @@ ${PACKAGE}%.zip: ${PACKFILES} tds: .tds .tds: ${PACKAGE_STY} ${PACKAGE_DOC} ${PACKAGE_SRC} - @grep -q '\* Checksum passed \*' ${PACKAGE}.log + @test -n "${IGNORE_CHECKSUM}" || grep -q '\* Checksum passed \*' ${PACKAGE}.log ${RMDIR} tds ${MKDIR} tds/ ${MKDIR} tds/tex/ tds/tex/latex/ tds/tex/latex/${PACKAGE}/ @@ -87,6 +102,9 @@ tds: .tds tdszip: ${TDSZIPFILE} +tdszip: ZIPVERSION=$(shell grep "Package: ${PACKAGE} " ${PACKAGE}.log | \ + sed -e "s/.*Package: ${PACKAGE} ....\/..\/..\s\+\(v\S\+\).*/\1/") + ${TDSZIPFILE}: .tds ${RM} ${TDSZIPFILE} cd tds && zip -r ../${TDSZIPFILE} . @@ -94,7 +112,60 @@ ${TDSZIPFILE}: .tds install: .tds test -d "${TEXMFDIR}" && ${CP} -a tds/* "${TEXMFDIR}/" && texhash ${TEXMFDIR} +sinstall: + @touch ${PACKAGE}.pdf + ${MAKE} install + uninstall: test -d "${TEXMFDIR}" && ${RM} -rv "${TEXMFDIR}/tex/latex/${PACKAGE}" \ "${TEXMFDIR}/doc/latex/${PACKAGE}" "${TEXMFDIR}/source/latex/${PACKAGE}" && texhash ${TEXMFDIR} +test: test.pdf + +test.pdf: ${PACKAGE}.sty test.tex + pdflatex test + pdfcrop test.pdf + +CHARS=H L Z X M U D T C "" + +ACHARS='N(a)' [] ';' H L Z X M U U{A} D D{A} G T tt C cc E ee + +acompare: ${PACKAGE}.sty test2.tex + for a in ${ACHARS}; do \ + echo "$$a"; \ + pdflatex -jobname "test-$$a" "\\def\\a{$$a}\\input{test2}";\ + compare -density 500 "test-$$a.pdf[0]" "test-$$a.pdf[1]" "diff-$${a}_0x1.png"; \ + compare -density 500 "test-$$a.pdf[0]" "test-$$a.pdf[2]" "diff-$${a}_0x2.png"; \ + compare -density 500 "test-$$a.pdf[0]" "test-$$a.pdf[3]" "diff-$${a}_0x3.png"; \ + compare -density 500 "test-$$a.pdf[1]" "test-$$a.pdf[2]" "diff-$${a}_1x2.png"; \ + compare -density 500 "test-$$a.pdf[1]" "test-$$a.pdf[3]" "diff-$${a}_1x3.png"; \ + compare -density 500 "test-$$a.pdf[2]" "test-$$a.pdf[3]" "diff-$${a}_2x3.png"; \ + done + +icompare: ${PACKAGE}.sty test.tex + rm -f new-*.* old-*.* diff-*.* + for I in ${CHARS}; do \ + pdflatex -jobname "new-$$I" "\\def\\I{$$I}\\input{test}";\ + mv ${PACKAGE}.sty ${PACKAGE}.sty.save; \ + pdflatex -jobname "old-$$I" "\\def\\I{$$I}\\input{test}";\ + mv ${PACKAGE}.sty.save ${PACKAGE}.sty; \ + P=$$(( $$(pdfinfo new-$$I.pdf | grep ^Pages: | cut -d: -f2) - 1 )); \ + for N in $$(seq -w 0 $$P); do \ + compare -density 500 old-$$I.pdf[$$N] new-$$I.pdf[$$N] diff-$$I-$$N.png; \ + done; \ + done + +compare: ${PACKAGE}.sty test.tex + rm -f new*.* old*.* diff*.* + pdflatex test + pdfcrop test.pdf new.pdf + mv ${PACKAGE}.sty ${PACKAGE}.sty.save; + pdflatex test + pdfcrop test.pdf old.pdf + mv ${PACKAGE}.sty.save ${PACKAGE}.sty; + P=$$(( $$(pdfinfo new.pdf | grep ^Pages: | cut -d: -f2) - 1 )); \ + for N in $$(seq -w 0 $$P); do \ + echo -n "$$N: "; \ + compare -density 500 -metric MAE old.pdf[$$N] new.pdf[$$N] diff-$$N.png; \ + done + diff --git a/Master/texmf-dist/source/latex/tikz-timing/tikz-timing.dtx b/Master/texmf-dist/source/latex/tikz-timing/tikz-timing.dtx index e50557c636a..cb770a0b90b 100644 --- a/Master/texmf-dist/source/latex/tikz-timing/tikz-timing.dtx +++ b/Master/texmf-dist/source/latex/tikz-timing/tikz-timing.dtx @@ -20,7 +20,7 @@ % This work consists of the files tikz-timing.dtx, tikz-timing.ins % and the derived file tikz-timing.sty. % -% $Id: tikz-timing.dtx 1158 2009-07-28 09:14:00Z martin $ +% $Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $ % \fi % % \iffalse @@ -34,20 +34,39 @@ %\ProvidesPackageSVN[tikz-timing-arrows] %\ProvidesPackageSVN[tikz-timing-either] %\ProvidesPackageSVN[tikz-timing-overlays] +%\ProvidesPackageSVN[tikz-timing-clockarrows] +%\ProvidesPackageSVN[tikz-timing-columntype] +%\ProvidesPackageSVN[tikz-timing-nicetabs] +%\ProvidesPackageSVN[tikz-timing-counters] +%\ProvidesPackageSVN[tikz-timing-advnodes] +%\ProvidesPackageSVN[tikz-timing-interval] +%\ProvidesPackageSVN[tikz-timing-beamer] +%\ProvidesPackageSVN[tikz-timing-ifsym] %<*driver> \ProvidesFileSVN % - {$Id: tikz-timing.dtx 1158 2009-07-28 09:14:00Z martin $} - [v0.6a + {$Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $} + [v0.7 % Digital Timing Diagrams using TikZ] % Macros to produce examples for the tikz-timing package] % Documentation Macros for tikz-timing package] -% TikZ-Timing Library for timing arrows] -% TikZ-Timing Library for uncertain transitions] -% TikZ-Timing Library for timing overlays] +% TikZ-Timing Library for +% timing arrows] +% uncertain transitions] +% timing overlays] +% timing clock arrows] +% timing cell types] +% nice timing tables] +% counter values] +% advanced nodes] +% alternative Z transitions] +% beamer overlay support] +% ifsym compatible macros] %<*driver> DTX-File of 'tikz-timing' package.] % +%\GetFileInfoSVN*% +%\RequirePackage{tikz-timing}[\filedate]% %<*package|driver> \DefineFileInfoSVN[tikztiming] % @@ -58,24 +77,30 @@ %<*driver> \documentclass{ltxdoc} \usepackage{tikz-timing}[\tikztiming@date] -\usetikztiminglibrary{arrows,either,overlays} +\usetikztiminglibrary{arrows,either,overlays,clockarrows,columntype} +\usetikztiminglibrary{nicetabs,counters,advnodes,interval,ifsym} +\tikzset{timing/no nice tabs} +\tikzset{timing/interval/normal} +\usetikzlibrary{plotmarks} \makeatother -\usepackage[electronic]{ifsym} +%%%^^A\usepackage[electronic]{ifsym} \usepackage{calc} \usepackage{graphicx} -\usepackage{ifpdf} \usepackage{xcolor} \usepackage{tabularx} \usepackage{array} \usepackage{flafter,fnpos} \usepackage{booktabs} +\usepackage{supertabular} +%\usepackage{xtab} \usepackage{amsmath} +\usepackage{flafter} \usepackage{placeins} \makeFNbottom \makeFNbelow -\usepackage{microtype} +\usepackage{microtype}[2005/10/28] \DisableLigatures{encoding = T1, family = tt* }% - +\newsavebox{\mysb} \makeatletter % %<*ydoc> @@ -181,34 +206,11 @@ {\def\macrolink{\hyperlink{impl@#1.3}}}% \hypersetup{linkcolor=macrodesccolor}% \hspace*{\macrosep}% - \raisebox{\baselineskip}[\baselineskip]{\pdfbookmark[3]{\textbackslash #1}{desc@#1}}% - \macrolink{\macroformat{\textcolor{macrodesccolor}{\textbackslash #1}}}% - \noindent\mbox{}\macroargformat{#2}\nopagebreak - \macroline*[0.2\baselineskip]% - \endgroup - \nopagebreak - \ignorespaces -} - -\def\DescribeMacro{\@ifnextchar*{\DescribeMacroS}{\DescribeMacroN}} -\def\DescribeMacroN{% - \bigskip\pagebreak[3]\par\noindent\DescribeMacroS*% -} -\def\DescribeMacroS*#1#2{% - \begingroup - \g@namedef{href@desc@#1}{}% - \immediate\write\@mainaux{% - \noexpand\g@namedef{href@desc@#1}{}% - }% - \@ifundefined{href@impl@#1}% - {\let\macrolink\relax}% - {\def\macrolink{\hyperlink{impl@#1.3}}}% - \hypersetup{linkcolor=macrodesccolor}% - \hspace*{\macrosep}% - \raisebox{\baselineskip}[\baselineskip]{\pdfbookmark[3]{\textbackslash #1}{desc@#1}}% + \raisebox{\baselineskip}[\baselineskip]{\pdfbookmark[3]{\textbackslash + #1}{desc@#1}}% \macrolink{\macroformat{\textcolor{macrodesccolor}{\textbackslash #1}}}% \noindent\mbox{}\macroargformat{#2}\nopagebreak - \macroline*[0.2\baselineskip]% + \macroline*[0.15\baselineskip]% \endgroup \nopagebreak \ignorespaces @@ -229,7 +231,7 @@ {\def\macrolink{\hyperlink{impl@#1.3}}}% \hypersetup{linkcolor=macrodesccolor}% \hspace*{\macrosep}% - \raisebox{\baselineskip}[\baselineskip]{\pdfbookmark[3]{#1}{desc@#1}}% + %\raisebox{\baselineskip}[\baselineskip]{\pdfbookmark[3]{#1}{desc@#1}}% \css{begin}% \{\macrolink{\macroformat{\textcolor{macrodesccolor}{#1}}}\}% \noindent\mbox{}\macroargformat{#2}\\*\relax @@ -249,7 +251,8 @@ } \def\DescribeScriptS*#1#2{% \hspace*{\macrosep}% - \raisebox{\baselineskip}[\baselineskip]{\pdfbookmark[3]{Script #1}{script@#1}}% + %\raisebox{\baselineskip}[\baselineskip]{\pdfbookmark[3]{Script + %#1}{script@#1}}% \scriptformat{\textcolor{scriptcolor}{#1}}% \noindent\mbox{}\scriptargformat{\ {#2}}\macroline*[0.2\baselineskip]% \nopagebreak @@ -260,7 +263,8 @@ } \def\DescribeOptionS*#1{% \hspace*{\macrosep}% - \raisebox{\baselineskip}[\baselineskip]{\pdfbookmark[3]{Option #1}{option@#1}}% + %\raisebox{\baselineskip}[\baselineskip]{\pdfbookmark[3]{Option + %#1}{option@#1}}% \optionformat{\textcolor{optioncolor}{#1}}% \noindent\mbox{}\macroline*[0.2\baselineskip]% \nopagebreak @@ -288,10 +292,12 @@ {\let\macrolink\relax}% {\def\macrolink{\hyperlink{desc@#1.3}}}% \hspace*{\macrosep}% - \raisebox{\baselineskip}[\baselineskip]{\pdfbookmark[3]{\textbackslash #1}{impl@#1}}% + %\raisebox{\baselineskip}[\baselineskip]{\pdfbookmark[3]{\textbackslash + %#1}{impl@#1}}% \macrolink{\macroformat{% \textcolor{macroimplcolor}{\textbackslash #1}}}% \\*[\smallskipamount]% + \noindent \@ifnextchar\begin{\vspace*{-\baselineskip}}{\imacroarg}% } @@ -314,7 +320,7 @@ {\let\macrolink\relax}% {\def\macrolink{\hyperlink{desc@#1.3}}}% \hspace*{\macrosep}% - \raisebox{\baselineskip}[\baselineskip]{\pdfbookmark[3]{#1}{impl@#1}}% + %\raisebox{\baselineskip}[\baselineskip]{\pdfbookmark[3]{#1}{impl@#1}}% \macrolink{\macroformat{% \textcolor{macroimplcolor}{#1}}}% \\*[\smallskipamount]% @@ -333,10 +339,11 @@ } \newcommand*{\aftermacroargs}{% \@ifnextchar\begin - {\\*[-2ex]\ignorespaces}% - {\\*[\smallskipamount]\ignorespaces}% + {\\*[0ex]\noindent\ignorespaces}% + {\\*[\smallskipamount]\noindent\ignorespaces}% } \newcommand*{\imacroargX}[1]{% + \hspace*{-1em}\texttt{\#\thenmacroarg:} #1\relax \ifnum\c@macroargs>1 \newline \fi @@ -629,72 +636,42 @@ \makeatother \def\topfraction{0.91} -\def\bottomfraction{0.89} -\def\floatpagefraction{0.9} -\def\textfraction{0.09} +\def\bottomfraction{0.95} +\def\floatpagefraction{0.98} +\def\textfraction{0.05} +\setcounter{bottomnumber}{2} \makeatletter % The following code is only needed to produce package examples and therefor not % included in the style file but might be written to an additional file. -% \begin{macrocode} +% \iffalse % %<*examplecode> -\ifx\collect@body\@undefined - \IfFileExists{environ.sty} - {\RequirePackage{environ}} - {\RequirePackage{amsmath}} -\fi -% \end{macrocode} +% \fi % \begin{environment}{tikztimingexampletable} % \begin{macrocode} -\newenvironment{tikztimingexampletable}[1][]{% - \tikzpicture[timing/table,#1]% - \coordinate (last row) at (0,-1); - \coordinate (label pos) at (-1,0); - \collect@body\tikztimingexampletable@ -}{}% +\newenvironment{tikztimingexampletable}{% + \begingroup + \let\tikztimingtable@row\tikztimingexampletable@row + \tikzset{timing/nice tabs} + \tikztimingtable +}{% + \extracode + \tableheader{Characters}{Resulting Diagram}% + \tablerules +\endtikztimingtable +\endgroup +}% % \end{macrocode} % \end{environment} - -% \begin{macro}{\tikztimingexampletable@} -% \begin{macrocode} -\def\tikztimingexampletable@#1{% - \tikztimingexampletable@row#1\endtikztimingtable@ - \path (0,-1) +(-\tikztiming@coldist,0.5*\tikztiming@rowdist) node - [anchor=base east,timing/name] {Characters}; - \path (0,-1) +(0,0.5*\tikztiming@rowdist) node - [anchor=base west,timing/name] {Resulting Diagram}; - \draw [line width=\lightrulewidth] - (current bounding box.north west) +(-1,-2) -- - ($ (current bounding box.north east) +(+1,-2) $); - \draw [line width=\heavyrulewidth] - (current bounding box.north west) +(0,1) -- - ($ (current bounding box.north east) +(0,0) $); - \draw [line width=\heavyrulewidth] - (current bounding box.south west) +(0,-1) -- - ($ (current bounding box.south east) +(0,0) $); - \endtikzpicture -} -% \end{macrocode} -% \end{macro} - -% \begin{macro}{\tikztimingexampletable@row} +% +% \begin{macro}{\tikztimingexampletable@row}[1]{Row content} % \begin{macrocode} -\def\tikztimingexampletable@row#1\\{% +\long\def\tikztimingexampletable@row#1\\{% \def\tikztiming@text{#1}% \@onelevel@sanitize\tikztiming@text - \path (last row) +(0,-1*\tikztiming@rowdist) coordinate (last row); - \path (last row) +(-1*\tikztiming@coldist,0) node - [anchor=base east,timing/name] - {\ttfamily\tikztiming@text}; - \timing at (last row) {#1}; - \@ifnextchar\extracode - {\tikztimingextracode}% - {% - \@ifnextchar\endtikztimingtable@ - {\@gobble}{\tikztimingexampletable@row}% - }% + \tikztimingtable@row@@{\ttfamily\tikztiming@text}{#1}% } % \end{macrocode} % \end{macro} @@ -702,7 +679,7 @@ % \begin{macro}{\tikztimingfullexampletable} % \begin{macrocode} \def\tikztimingfullexampletable{ - \begin{tikzpicture}[x=1em,y=1em,font=\sffamily] + \begin{tikzpicture}[timing/picture,x=1em,y=1em,font=\sffamily] \tikzset{timing/d/background/.style={fill={gray!25},fill opacity=0.5}}% \let\chars\tikztiming@chars@default \node (charnode) at (0,0) {% @@ -748,17 +725,64 @@ % \end{macrocode} % \end{macro} % -% \begin{macrocode} +% \iffalse % %<*driver> -% \end{macrocode} -\makeatother +% \fi + +\makeatletter + +\def\MakeShortVerbQuote{% + \def\@shortvrbdef{\qverb}\@MakeShortVerb +} + +\let\verb@orig@egroup\verb@egroup %@ + +\def\qverb{% + \begingroup + \def\verb@egroup{\verb@orig@egroup'\endgroup}% + `\verb% +} +\MakeShortVerbQuote{\"} + + +\def\NewIn#1{ + \marginpar{\raisebox{.125ex}{\textcolor{black}{\emph{New in #1}}}}% +} + +\iffalse +\def\thesection{\texorpdfstring{\LARGE\texttiming[X]{D{\arabic{section}}.1X[black]}}{\arabic{section}}} +\def\thesubsection{\texorpdfstring{\Large\texttiming[X]{D{\arabic{section}}D{\arabic{subsection}}.1X[black]}}{\arabic{section}.\arabic{subsection}}} +\def\thesubsubsection{\texorpdfstring{\large\texttiming[X]{D{\arabic{section}}D{\arabic{subsection}}D{\arabic{subsubsection}}.1X[black]}} +{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}} + + %\def\timingsectionformat#1{% + % \sbox{\mysb}{\tikz \draw node [timing/d/text] {#1};}% + % \texttiming{ $ \wd\mysb / \tikztiming@xunit $ DD{#1} }% + %} + +\renewcommand\section{\@startsection {section}{1}{\z@}% + {-3.5ex \@plus -1ex \@minus -.2ex}% + {2.3ex \@plus.2ex}% + {\normalfont\Large\bfseries\sffamily}} + %[#1]{\texorpdfstring{\larger\timingsectionformat{#2}}{#2}}} +\renewcommand\subsection{\@startsection{subsection}{2}{\z@}% + {-3.25ex\@plus -1ex \@minus -.2ex}% + {1.5ex \@plus .2ex}% + {\normalfont\large\bfseries\sffamily}} +\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}% + {-3.25ex\@plus -1ex \@minus -.2ex}% + {1.5ex \@plus .2ex}% + {\normalfont\normalsize\bfseries\sffamily}} +\fi +\makeatother \EnableCrossrefs %\CodelineIndex \RecordChanges -%\OnlyDescription +\OnlyDescription \listfiles + \begin{document} \DocInput{tikz-timing.dtx} \PrintChanges @@ -767,7 +791,7 @@ % % \fi % -% \CheckSum{2221} +% \CheckSum{5223} % % \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 @@ -786,33 +810,6 @@ % Right brace \} Tilde \~} % % -% \changes{v0.3}{2009/04/24}{First released version} -% \changes{v0.4}{2009/04/28}{Added output routine which combines successive -% occurrences of the same character. This improves screen display quality and -% reduces rendering time and file size.} -% \changes{v0.4}{2009/04/28}{Removed own macros for lowercase characters. They -% are now handled by the uppercase macros which receive half of the width. -% Exceptions are possible like for the `m' character.} -% \changes{v0.4}{2009/04/29}{Added parser for rows in \env{tikztimingtable}. -% This makes the syntax much more stable. Also replaced row counter with TikZ -% coordinates which is more user-friendly.} -% \changes{v0.4}{2009/04/30}{User macros to draw grids and lines inside table.} -% \changes{v0.4}{2009/05/01}{In-line Nodes, \eg to mark positions inside the -% diagram.} -% \changes{v0.4}{2009/05/03}{Released as v0.4} -% \changes{v0.4a}{2009/05/05}{Added \cs{tablerules} macro. Changed default style -% of inline nodes to \texttt{coordinate}.} -% \changes{v0.5}{2009/05/15}{Added PGF shape for timing diagrams. Added -% meta-characters. Changed `M' character to use PGF decorations. Added special -% `B' character to reduce width of next character. Changed \cs{timing} syntax to -% include an `at' before the coordinate. Bug fix for use with the `calc' -% package.} -% \changes{v0.6}{2009/07/27}{Added ``forward'' modifier `\texttt{F}' as reverse -% version of the ``backward'' modifier `\texttt{B}'. Added support for -% lower-case modifiers ``\texttt{b}',`\texttt{f}' and \texttt{n}'. Added new -% optional characters `\texttt{A}'/`\texttt{W}' for arrows and '\texttt{E}' for -% uncertain low-to-high and high-to-low transitions.} -% \changes{v0.6a}{2009/07/28}{Added library for overlay modifier `\texttt{O}'.} % % \GetFileInfo{tikz-timing.dtx} % @@ -825,14 +822,13 @@ % \DoNotIndex{\ignorespaces,\lccode,\sffamily,\@gobble,\@ifundefined,\@for,\or} % \DoNotIndex{\@firstoftwo,\@ifnextchar,\@namedef,\@nameuse,\@secondoftwo} % \DoNotIndex{\@temptokena,\toks@,\BODY,\do,\g@addto@macro,\lowercase,\uppercase,\the} -% \DoNotIndex{\height,\width,\slope,\style,\draw,\path,\newdraw,\lastchar,\currentchar} +% \DoNotIndex{\height,\width,\slope,\style,\draw,\path,\newdraw,\newdrawns} % \DoNotIndex{\dslope,\zslope} % % \ifpdf % \hypersetup{% % pdfauthor = {Martin Scharrer }, -% pdftitle = {The svn-multi package, \fileversion\ from \filedate}, -% pdftitle = {The tikz-timing package}, +% pdftitle = {The tikz-timing package, \fileversion\ from \filedate}, % pdfsubject = {Documentation of LaTeX package tikz-timing which allows the % easy creation of timing diagrams inside tikz pictures or text.}, % pdfkeywords = {tikz-timing, timing diagram, LaTeX} @@ -842,14 +838,16 @@ % \null % \vspace*{-2em} % \begin{center} +% \sffamily % \tikzset{timing/z/.style={black}, % timing/intext/.style={timing,line width=0.1ex}} % {\LARGE\sffamily The \raisebox{-0.66ex}{\Huge\textsf % {\texttiming[z]{3d{\strut tikz}z5d{\strut timing}0.2z}}} package}\\[3ex] +% {\large Version \fileversion\ -- \filedate}\\[2ex] % {\large Martin Scharrer \\\normalsize % \url{martin@scharrer-online.de}\\[.8ex] -% \url{http://www.ctan.org/pkg/tikz-timing}\\[1.2ex]} -% {\large Version \fileversion\ -- \filedate}\\ +% WWW: \url{http://latex.scharrer-online.de/tikz-timing}\\[.5ex] +% CTAN: \url{http://www.ctan.org/pkg/tikz-timing}\\[1.2ex]} % \end{center} % \vspace{1.2em}% % @@ -858,25 +856,63 @@ % ^^A\textbf{Note to Advanced Users:} This is a new package which internal % ^^Amacros might still change. Please only rely on the user macros for now. % +% {\let\csd\texttt\tableofcontents} +% % \section{Introduction} % This package uses the \pkg[pgf]{tikz} package to produce timing diagrams % inside text or \envv{tikzpicture} environments. Also a tabular-like % environment is provided to produce a larger timing diagram with multiple % labeled signals and the possibility to add own drawing material. +% Additional optional functionality is provided by libraries. % % The signal levels of the timing diagram can be given by corresponding -% characters/letters like `|H|' for \emph{Logical High} or `|L|' for -% \emph{Logical Low}. So e.g.\ `|{HLZXD}|' gives `\texttiming{HLZXD}'. -% Lowercase characters only produce a signal with half the width while uppercase -% characters produce one with the ``full'' width, called the `\textsf{period -% width}' in this document and which is by default identical to there height, -% called `\textsf{signal height}', which defaults to 1.6ex (about the height of -% the uppercase `X' of the current font). -% Table~\ref{tab:chars} shows all by default defined logic characters and -% Table~\ref{tab:full} all possible transitions. -% Additional functionality is provided by the ``modifiers'' shown in -% Table~\ref{tab:modifiers}. -% +% characters/letters like "H" for \emph{Logical High} or "L" for +% \emph{Logical Low}. So e.g.\ "{HLZXD}" gives `\texttiming{HLZXD}'. +% In order to fit (in)to normal text the diagram size (\ie its height, width and line width) +% is defined relatively to the currently active font size. The diagram height is about the height of an +% uppercase `X' (+$2\times\frac12$ line width). This way the diagrams +% can also be scaled using font size commands like \cs{small}. +% (Example: {\sffamily +% \large X\texttiming{LH}X +% \normalsize X\texttiming{LH}X +% \small X\texttiming{LH}X +% \footnotesize X\texttiming{LH}X +% \scriptsize X\texttiming{LH}X +% \tiny X\texttiming{LH}X +% }) +% \makeatletter +% \def\iex#1{^^A +% \def\@tempa{#1}\@onelevel@sanitize\@tempa +% `\texttt{\@tempa}'~$\rightarrow$~`\texttiming{#1}'} +% \makeatother +% A single timing character produces a diagram with a width identical to its height +% (\iex{H}). Longer diagrams can be produces by either +% using the same character multiple times (\iex{HHH}) +% or writing the width as number in front of the character (\iex{3.2H}). +% For (partial) compatibility with similar packages lowercase characters only produce +% a signal with half the width (\iex{h}, \iex{3.2h}). +% +% Recurring character combinations can be repeated using character groups +% (\iex{3{hlz}}) or be defined as so called \emph{meta-characters} +% ({\tikztimingmetachar{Y}{hlz} "Y"="hlz", \iex{3Y}}), +% which are similar to a \TeX~macro. +% Since v0.7 meta-characters can also include macro arguments. +% +% Additional features are the inclusion of in-line TikZ styles (\iex{H ;[orange] L}), +% in-line nodes (\iex{2H N[rectangle](Name){Text} 2L}), automatic width calculations +% ("H $ 1+\mymacro-\slope $ L "~$\rightarrow$~`\texttiming{H2.5L}') +% and much more. +% +% \medskip +% \DeleteShortVerb{\|} +% \centerline{\texttiming[D]{ +% 2{12{[yscale=.9,shift={(0,.05)}]D{}} +% 13{[yscale=1.1,shift={(0,-.05)}]D{}};} +% $\dslope$ D{} +% }} +% \MakeShortVerb{\|} +% \medskip +% % \iffalse % The package is build to make it possible to define new characters from scratch % or as modified copy of other characters. However, no user macros nor @@ -884,33 +920,6 @@ % should look at the default definitions at the end of the source code. % \fi % -% \begin{table}[b!] -% \let\texttimingbefore\texttiminggrid -% \sffamily\centering -% \caption{Timing Characters}\label{tab:chars} -% \begin{tabular}{clccc} -% \toprule -% Character & Description & Full Width & Half Width & Transition \\ -% & & \small (Uppercase) & \small (Lowercase) & Example -% \\\midrule -% \texttt{H} & High & \texttiming{H} & \texttiming{h} & \texttiming[L]{H} \\ -% \texttt{L} & Low & \texttiming{L} & \texttiming{l} & \texttiming[H]{L} \\ -% \texttt{Z} & High Impedance & \texttiming{Z} & \texttiming{z} & \texttiming[L]{Z} \\ -% \texttt{X} & Undefined / Don't Care & \texttiming{X} & \texttiming{x} & \texttiming[L]{X} \\ -% \texttt{D} & Data / Double & \texttiming{D} & \texttiming{d} & \texttiming[L]{D{A}D} \\ -% \texttt{U} & Unknown Data & \texttiming{U} & \texttiming{u} & \texttiming[D]{U} \\ -% \texttt{T} & Toggle & \texttiming{L} or \texttiming{H} & \texttiming{l} or -% \texttiming{h} & \texttiming{TTTT} \\ -% \texttt{C} & Clock (no slope) & \texttiming{L} or \texttiming{H} & -% \texttiming{l} or \texttiming{h} & \texttiming{CCCC} \\ -% \texttt{M} & Metastable Condition & \texttiming{M} & \texttiming{m} & \texttiming[H]{Ml} \\ -% \midrule -% \texttt{G} & Glitch (zero width) & \texttiming{G} & \texttiming{g} & \texttiming{HGH} \\ -% \texttt{S} & Space (nothing) & \texttiming{S} & \texttiming{s} & \texttiming{HSL} \\ -% \bottomrule -% \end{tabular} -% \end{table} -% % \iffalse % \subsection{Similar Packages} % There a some packages which target the same application like the package @@ -919,7 +928,7 @@ % \begin{description} % \itempkg{ifsym} This package (using the |electronic| option) provides a % special font which contains graphical representation of the logical levels -% high and low at the corresponding letter `|H|' and `|L|'. The lower case +% high and low at the corresponding letter "H" and "L". The lower case % versions have only half the width of the uppercase ones. Also a transition % can be added using the `\verb+|+' character which will (sometimes) be added % automatically between |HL| and |LH|. @@ -937,7 +946,7 @@ % % \itempkgnoctan[(TikZ Example Page)]{timing}% % {http://www.texample.net/tikz/examples/timing-diagram/} This package is -% accidentally also called `|timing.sty|' and is not published on CTAN but on +% accidentally also called "timing.sty" and is not published on CTAN but on % the TikZ example website. It is a small package which is meant as an % example for the graphics package \texttt{tikz} which is used to draw the % diagram. The logical levels must be provided using macros like @@ -945,62 +954,223 @@ % \end{description} % \fi % +% \subsection{Changelog} +% \begingroup +% \renewcommand{\changes}[3]{\paragraph{#1 from #2}\begin{itemize}\item #3\end{itemize}} +% \newenvironment{Changes}[2]{\paragraph{#1 from #2}\begin{itemize}\let\change\item}{\end{itemize}} +% +% \changes{v0.3}{2009/04/24}{First released version} +% \changes{v0.4}{2009/05/03}{Added output routine which combines successive +% occurrences of the same character. This improves screen display quality and +% reduces rendering time and file size. +% \item Removed own macros for lowercase characters. They +% are now handled by the uppercase macros which receive half of the width. +% Exceptions are possible like for the `m' character. +% \item Added parser for rows in \env{tikztimingtable}. +% This makes the syntax much more stable. Also replaced row counter with TikZ +% coordinates which is more user-friendly. +% \item User macros to draw grids and lines inside table. +% \item In-line Nodes, \eg to mark positions inside the diagram.} +% \changes{v0.4a}{2009/05/05}{Added \cs{tablerules} macro. Changed default style +% of inline nodes to \texttt{coordinate}.} +% \changes{v0.5}{2009/05/15}{Added PGF shape for timing diagrams. Added +% meta-characters. Changed `M' character to use PGF decorations. Added special +% `B' character to reduce width of next character. Changed \cs{timing} syntax to +% include an `at' before the coordinate. Bug fix for use with the `calc' +% package.} +% \changes{v0.6}{2009/07/27}{Added ``forward'' modifier `\texttt{F}' as reverse +% version of the ``backward'' modifier `\texttt{B}'. +% \item Added support for +% lower-case modifiers ``\texttt{b}', `\texttt{f}' and \texttt{n}'. +% \item Added libaries for characters `\texttt{A}'/`\texttt{W}' for arrows and +% '\texttt{E}' for uncertain low-to-high and high-to-low transitions.} +% \changes{v0.6a}{2009/07/28}{Added library for overlay modifier `\texttt{O}'.} +% +% \begin{Changes}{v0.7}{2009/12/05} +% \change New libraries: +% \begin{description} +% \item[|clockarrows|] Library for clock arrows. +% \item[|columntype|] Library providing a timing column type for |tabular|. +% \item[|nicetabs|] Library to format \cs{tikztimingtable} like a |booktab| |tabular|. +% \item[|counters|] Library to defined counter characters which display an incrementing +% counter value every time there are used. +% \item[|advnodes|] Library for advanced nodes with multiple anchor points. +% \item[|ifsym|] Library providing the same timing symbols and characters as the |ifsym| package +% when loaded with the |electronic| option. +% \end{description} +% \change Additional experimental libraries: +% \begin{description} +% \item[|interval|] Library to change color of "ZL", "ZH" etc. transitions to +% indicate borders of an interval. +% \item[|beamer|] Library providing some marginal beamer overlay support. +% \end{description} +% \change "overlays" library: +% \begin{itemize} +% \item Overlays can now be cascaded, \ie an overlay can be inside another one. +% \item The second braces around the second part are now optional. +% \item Fixed issues with "T" and "C" characters inside overlays. +% \end{itemize} +% \change Meta-characters can now have arguments. +% \change Added more variety for in-line options: "[[ ]]", "[+ +]" and "[| |]". +% \change Handling of in-line options and nodes got modified. Options are now placed directly +% where placed and are valid until the next ";". Please note that |[/utils/exec={..}]| now +% needs to be written as \verb+[|/utils/exec={..}|]+. Otherwise it is re-executed every time +% the drawing path is renewed. +% \change Added star version of \cs{tablegrid}. +% \change Added background to "E" character ("either" library). +% \change Some fixes for placing of "D{}" texts. +% \change Fixed wrong slopes (\eg |lslope| instead of |zslope|) for some transitions. +% \change Major changes on internal character definition macros, parser and output routine. +% \change Fixed problems with expanding code content in user input. +% \change The \cs{texttiming} macro now uses a \cs{timing} macro internally. +% \change The \cs{timing} macro is now only defined inside |tikzpictures|. +% This includes |tikztimingtable|. +% \change Added TikZ style |timing/draw grid| for grids behind \cs{timing} macros. +% \change Replaced macros \cs{texttimingbefore}, \cs{texttimingafter} and \cs{texttiminggrid} with +% TikZ settings "timing/before text", "timing/after text" and "timing/draw grid". +% \change Added separators "timing/outer sep" around \cs{texttiming}. +% \change Graphical improvements for `double line' characters like "D", "U" and "E". +% The whole character including both edges is drawn in a single process. +% \change Character width can now be scaled using |wscale|. +% \change Character width can now be calculated by placing code inside "$ $". +% \change Fixed issue with \cs{horlines} macro. +% \change The \env{tikztimingtable} environment and associated macros got enhanced: +% \begin{itemize} +% \item The content is no longer read as macro argument and can now include paragraphs. +% \item Multiple |extracode| sections can be now included between rows, not only a single +% section at the very end. +% \item A \env{extracode} environment has been added. Both macro and environment have now +% an optional argument for TikZ settings. +% \item Added \cs{tableheader} macro to label both columns. The \cs{tablerules} macro got +% adjusted to detect the header line and draw also a middle line. +% \item Added \env{background} environment to draw things in the background. +% \item Fixed broken optional argument of \cs{tablegrid}. +% \item Added macro \cs{marknodes} and associated |debug/nodes| style to mark in-line nodes +% for debug purposes/orientation during the diagram creation. +% \end{itemize} +% \end{Changes} +% +% +% \endgroup +% +% \clearpage % \section{Usage} % +% \subsection{Timing Characters} +% As mentioned in the introduction section the logic levels are described by so called +% \emph{timing characters}. Actually all of them are letters, but the general term \emph{character} is used here. +% Table~\ref{tab:chars} shows all by default defined logic characters and +% Table~\ref{tab:full} all possible two-character transitions. +% Additional functionality is provided by the \emph{modifiers} shown in +% Table~\ref{tab:modifiers}. +% +% \begin{table} +% \tikzset{timing/draw grid} +% \sffamily\centering +% \caption{Timing Characters}\label{tab:chars} +% \begin{tabular}{clccc} +% \toprule +% Character & Description & Full Width & Half Width & Transition \\ +% & & \small (Uppercase) & \small (Lowercase) & Example +% \\\midrule +% \texttt{H} & High & \texttiming{H} & \texttiming{h} & \texttiming[L]{H} \\ +% \texttt{L} & Low & \texttiming{L} & \texttiming{l} & \texttiming[H]{L} \\ +% \texttt{Z} & High Impedance & \texttiming{Z} & \texttiming{z} & \texttiming[L]{Z} \\ +% \texttt{X} & Undefined / Don't Care & \texttiming{X} & \texttiming{x} & \texttiming[L]{X} \\ +% \texttt{D} & Data / Double & \texttiming{D} & \texttiming{d} & \texttiming[L]{D{A}D} \\ +% \texttt{U} & Unknown Data & \texttiming{U} & \texttiming{u} & \texttiming[D]{U} \\ +% \texttt{T} & Toggle & \texttiming{L} or \texttiming{H} & \texttiming{l} or +% \texttiming{h} & \texttiming{TTTT} \\ +% \texttt{C} & Clock (no slope) & \texttiming{L} or \texttiming{H} & +% \texttiming{l} or \texttiming{h} & \texttiming{CCCC} \\ +% \texttt{M} & Metastable Condition & \texttiming{M} & \texttiming{m} & \texttiming[H]{Ml} \\ +% \midrule +% \texttt{G} & Glitch (zero width) & \texttiming{G} & \texttiming{g} & \texttiming{HGH} \\ +% \texttt{S} & Space (nothing) & \texttiming{S} & \texttiming{s} & \texttiming{HSL} \\ +% \bottomrule +% \end{tabular} +% ^^A\par\bigskip +% ^^A\makebox[\textwidth][c]{\tikztimingfullexampletable} +% \end{table} +% +% \iftrue % \begin{table} -% \let\texttimingbefore\texttiminggrid -% \sffamily +% \tikzset{timing/draw grid} +% \sffamily\small % \caption{Overview over all transitions.}\label{tab:full} % \makebox[\textwidth][c]{\tikztimingfullexampletable} % \end{table} +% \fi % +% \DeleteShortVerb{\|} % \begin{table} -% \let\texttimingbefore\texttiminggrid +% \tikzset{timing/draw grid} % \let\normalfont\sffamily % \sffamily\centering % \caption{Modifiers for Timing Characters}\label{tab:modifiers} +% \makeatletter +% \def\Example#1{\def\@tempa{#1}\@onelevel@sanitize\@tempa +% \hbox{\emph{E.g.:} `\hbox{\texttt{\@tempa}}' $\to$ \texttiming{#1}}} % \makebox[\textwidth][c]{% -% \begin{tabularx}{1.25\textwidth}{>{\ttfamily}l>{\raggedright}X>{\ttfamily}ll} +% \begin{tabularx}{1.25\textwidth}{>{\ttfamily}l>{\raggedright\arraybackslash}X} % \toprule % \normalfont -% Modifier Syntax & Description & \normalfont Example & Example \\ -% & & \normalfont Usage & Result \\\midrule -% D\{\}D & Produces transition between two data values. & D\{\}D & -% \texttiming{D{}D} \\ -% D\{\meta{Text}\} & Adds text material into a data signal using a node. & -% D\{A\}D\{B\} & \texttiming{D{A}D{B}} \\ +% Modifier Syntax & Description \\ +% & \\\midrule +% D\{\}D & Produces transition between two data values. \Example{D{}D} \\ +% D\{\meta{Text}\} & Adds \meta{text} into a data signal using a node. +% \Example{D{A}D{B}} \\ % D\{[\meta{\scriptsize -% \raisebox{-1ex}{\shortstack{TikZ\\Settings}}}]\meta{Text}\} & Adds text -% material into a data signal using the given settings. & D\{[blue]A\} & -% \texttiming{D{[blue]A}} \\ +% \raisebox{-1ex}{\shortstack{TikZ\\Settings}}}]\meta{Text}\} & Adds \meta{text} +% using the given node \meta{settings}. \Example{D{[blue]A}} \\ % \meta{\small integer}\{\meta{\small characters}\} & Repeats the given -% characters \texttt{\meta{int}} times. & 5\{hl\} & \texttiming{5{hl}}\\ +% characters \texttt{\meta{int}} times. \Example{5{hl}}\\ % \meta{\small number}\meta{\small character} & Sets width of next signal to -% given number. Half of it if character is in lower case. & 2.6H5.2l & -% \texttiming{2.6H5.2l}\\ +% given number. Half of it if character is in lower case. +% \Example{2.6H5.2l}\\ % \meta{\small number}B & Su\underline{b}tracts the given number from the width -% of the next character. ``\textit{\texttt{B}ackwards}''& H .5B L & -% \texttiming{H.5BL}\\ +% of the next character. ``\textit{\texttt{B}ackwards}'' +% \Example{H.5BL}\\ % \meta{\small number}F & Adds the given number to the width of the next -% character. ``\textit{\texttt{F}orwards}''& H .5F L & \texttiming{H.5FL}\\ +% character. ``\textit{\texttt{F}orwards}'' \Example{H.5FL}\\ % N\oarg{\tiny Settings}\parg{\tiny Name}\marg{\tiny Content} & Adds node at -% current position. All three arguments are optional. & H N(a1) L & -% \texttiming{H N(a1) L}\\ +% current position. All three arguments are optional. \Example{H N(a1) L}\\ % \midrule -% {}[\meta{TikZ Settings}] & Executes given TikZ settings. & H[blue]LH & -% \texttiming{H[blue]LH} \\ +% {}[\meta{TikZ Settings}] & Executes given TikZ settings during the drawing +% process. This settings will be re-executed when the internal drawing path is renewed which +% can cause side-effects. \Example{H[blue]LH} \\ +% {}[|\meta{TikZ Settings}|] & Executes given TikZ settings during the drawing +% process like \texttt{[ ]} but does not re-executes them. +% {\Example{D{.} [|/utils/exec={\def\m{...}}|] D{.} D{.}}} \\ +% {}[!\meta{TikZ Settings}!] & Executes given TikZ settings during the +% \emph{parsing} process. Because this makes only sense for internal settings +% the default path is `\texttt{/tikz/timing}', not `\texttt{/tikz}' like in all +% other settings macros. \Example{H[!wscale=2.5!]LH} \\ +% {}[[\meta{TikZ Settings}]] & Executes given TikZ settings first during the +% parsing process and again during the drawing process. This is for settings +% which are needed for width calculations and again for the drawing code, \eg +% the slope values. \Example{H[[timing/slope=.5]]L $\slope$H} \\ % ; & Renews the internal drawing path which ends the scope of all options -% given by \texttt{[\,]}. & H;[blue]L;H & \texttiming{H;[blue]L;H} \\ +% given by \texttt{[\,]}. \Example{H;[blue]L;H} \\ % , & Same as `\texttt{;}', but timing specific options (atm.: slopes and line -% width) are restored for the new path. & \small H,[lw=1pt]L;H & -% \texttiming{H,[line width=1pt]L;H} \\ +% width) are restored for the new path. \Example{[line width=1pt]L,H;L} \\ % !\{\meta{code}\} & Places given code into the internal \envv{tikzpicture}. -%& \multicolumn{2}{l}{\small See Example~\ref{exa:adv} on -% page~\pageref{exa:adv}.} \\ +% See Example~\ref{exa:adv}. \\ +% @\{\meta{code}\} & Executes the given code immediately during the parsing +% process. This can be used to change parsing parameters. To execute code during +% the drawing process use \verb+[|/utils/exec=+\meta{code}\verb+|]+ instead. +% \Example{L @{\setwscale{2}} H} \\ +% \texttt{\$}\meta{math expression}\texttt{\$} & Takes a valid \texttt{pgfmath} +% expression (See \pkg{pgf} manual), evaluates it and places the result back in +% the input string so it can be used as width for the next character. The macros +% \cs{slope}=\cs{lslope}, \cs{dslope}, \cs{zslope} and \cs{wscale} can be used +% to access the corresponding values. \Example{D{} $ \dslope $ D{} D} \\ % \bottomrule % \end{tabularx}} % \end{table} +% \MakeShortVerb{\|} % +% \clearpage % \subsection{Macro for use in Text Mode} % \vspace{-\bigskipamount}% % \DescribeMacro{texttiming}{\oarg{initial~character/TikZ @@ -1036,24 +1206,34 @@ % \end{minipage} % \end{minipage} % -% \DescribeMacro{texttimingbefore}{\hspace{15.5em}(\emph{defaults to}: -% \meta{empty})} -% \DescribeMacro*{texttimingafter}{\hspace{16em}(\emph{defaults to}: -% \meta{empty})} +% \DescribeMacro{texttimingbefore}{\hspace{2em}\textbf{Deprecated!}\hspace{8em}(\emph{defaults +% to}: \meta{empty})} +% \DescribeMacro*{texttimingafter}{\hspace{2.5em}\textbf{Deprecated!}\hspace{8em}(\emph{defaults +% to}: \meta{empty})} % This two macros are executed before and after every timing diagram line % created by \cs{texttiming} macro inside the same \envv{tikzpicture} % environment and can be used to add drawing macros. The argument of the % \cs{texttiming} macro is already processed before any of these macros are % expanded, therefore this macros can access the width of the diagram. % -% Example: |\let\texttimingbefore\texttiminggrid| adds a grid into the +% These macros should not be used directly in newer code but instead the new +% TikZ styles "timing/before text" and "timing/after text". For backward +% compatibility these styles default to the two macros. +% +% (Deprecated) Example: |\let\texttimingbefore\texttiminggrid| adds a grid into the % background of the \cs{texttiming} diagram. A more \LaTeX-stylish way to do -% this is |\renewcommand*{\textttimingbefore}{\texttiminggrid}|. +% this is |\renewcommand*{\textttimingbefore}{\texttiminggrid}|. See below for an up-to-date way +% to achieve this. % -% \DescribeMacro{texttiminggrid}{} +% \DescribeMacro{texttiminggrid}{\hspace{2.5em}\textbf{Deprecated!}} % This macro should only be used inside \cs{texttimingbefore} or % \cs{texttimingafter} and draws a grid of the full size of the % \cs{texttiming} diagram. +% For newer code the TikZ styles "timing/draw grid" and "timing/no grid" +% should be used instead, \eg +% |\tikzset{timing/intext/.append style={timing/draw grid}}| or simply enable the grid globally +% for all in-text and other timing diagrams with |\tikzset{timing/draw grid}|. +% % % \newpage % \subsection{Macro for use inside TikZ-Pictures} @@ -1065,7 +1245,7 @@ % (\css{path}, \css{drawn}, \css{node}) it allows an optional argument with TikZ % settings and an optional TikZ-coordinate. However, a own argument parser, not % the one used by TikZ, is used to detect and read these optional arguments. -% Therefore the order of the arguments is mandatory and might not be reversed. +% Therefore the order of the arguments is mandatory and must not be reversed. % This small limitation might be overcome in future versions of this package. % % Please note that the optional initial character may be given \emph{inside} and @@ -1078,7 +1258,7 @@ % Example: |\tikz \timing [green] at (1,2) {[L]HLZDZLH};| gives `\tikz \timing % [green] at (1,2) {[L]HLZDZLH};'. % -% \subsubsection*{Timing Shape Anchors} +% \subsubsection{Timing Shape Anchors}\label{sec:timingshape} % Every timing diagram line produced by \cs{timing}, which includes the rows in % \env{tikztimingtable}, is also a PGF shape (node) with several anchors. These % are shown in Figure~\ref{fig:shape}. @@ -1123,7 +1303,167 @@ % signal.}\label{fig:shape} % \end{figure} % -% ^^A\newpage +% \iffalse +% \subsubsection{In-Line Nodes Shape Anchors} +% A default shape for In-Line Nodes/Coordinates ("N" character) is provided +% which is named `\texttt{tikztiming coordinate}'. Like the PGF standard shape +% `\texttt{coordinate}' this shape does not draw anything. However, it provides +% anchors for the logical high, low and middle ("mid") levels, as well as for +% the three slopes |lslope|, |dslope| and |zslope| (full and half values). This +% anchors can be used to access all possible connection points of default +% transitions as shown in Figure~\ref{fig:coordnodeanchors}. This is useful for +% drawing relationship arrows or similar graphics between signals. +% +% Because the node modifier can not look-ahead to the next character it does not +% know which transition will occur. Therefore all anchors are provided for all +% nodes. The user can/must select the suitable anchor(s) for every nodes. +% +% See Example~\ref{exa:inlinenodes} for an demonstration. +% +% \begin{figure} +% \tikzset{% +% timing/slope=.25, +% } +% \def\nx{4} +% \def\ny{-3} +% \begin{tikzpicture}[ +% timing/.append style={x=1cm,y=1cm}, +% timing/picture, +% timing/font=\sffamily\scriptsize, +% ultra thick, +% step=.5, +% help lines/.style={thin,gray,semitransparent} +% ] +% +% \draw [help lines,shift={(\nx,-1*\ny)}] (0,0) grid +(2,1); +% \timing at (\nx,-1*\ny) {S N(x)}; +% \draw [red] (x.low) circle(1pt); +% \draw [yellow] (x.mid) circle(1pt); +% \draw [green] (x.high) circle(1pt); +% \node [left] at (x.high) {(x.high)}; +% \node [left] at (x.mid) {(x.mid)}; +% \node [left] at (x.low) {(x.low)}; +% \node [below=3ex] at (x.low) {\meta{any} \texttt{N(x)} \meta{any}}; +% +% \draw [help lines,shift={(0,0)}] (0,0) grid +(2,1); +% \timing at (0,0) {H N(x) L}; +% \draw [blue] (x) circle(3pt); +% \draw [red] (x.low lslope) circle(1pt); +% \draw [yellow] (x.mid lslope/2) circle(1pt); +% \draw [green] (x.high) circle(1pt); +% \node [above] at (x) {(x)}; +% \node [right] at (x.high) {(x.high)}; +% \node [left] at (x.mid lslope/2) {(x.mid lslope/2)}; +% \node [left] at (x.low lslope) {(x.low lslope)}; +% \node [below=3ex] at (x.low) {\texttt{H N(x) L}}; +% +% \draw [help lines,shift={(\nx,0)}] (0,0) grid (2,1); +% \timing at (\nx,0) {H N(x) D}; +% \draw [blue] (x) circle(3pt); +% \draw [yellow] (x.mid dslope/2) circle(1pt); +% \draw [green] (x.high) circle(1pt); +% \draw [teal] (x.high dslope) circle(1pt); +% \draw [red] (x.low dslope) circle(1pt); +% \node [above left] at (x) {(x)~~~~}; +% \node [above] at (x.high) {(x.high)}; +% \node [left] at (x.mid dslope/2) {(x.mid zslope/2)}; +% \node [below right] at (x.high dslope) {(x.high dslope)}; +% \node [above right] at (x.low dslope) {(x.low dslope)}; +% \node [below=3ex] at (x.low) {\texttt{H N(x) D}}; +% +% \draw [help lines,shift={(2*\nx,0)}] (0,0) grid +(2,1); +% \timing at (2*\nx,0) {H N(x) Z}; +% \draw [blue] (x) circle(3pt); +% \draw [yellow] (x.mid zslope) circle(1pt); +% \draw [green] (x.high) circle(1pt); +% \node [above] at (x) {(x)}; +% \node [right] at (x.high) {(x.high)}; +% \node [left] at (x.mid zslope) {(x.mid zslope)}; +% \node [below=3ex] at (x.low) {\texttt{H N(x) Z}}; +% +% \draw [help lines,shift={(0,\ny)}] (0,0) grid +(2,1); +% \timing at (0,\ny) {L N(x) H}; +% \draw [blue] (x) circle(3pt); +% \draw [green] (x.high lslope) circle(1pt); +% \draw [yellow] (x.mid lslope/2) circle(1pt); +% \draw [red] (x.low) circle(1pt); +% \node [below] at (x) {(x)}; +% \node [left] at (x.high lslope) {(x.high lslope)}; +% \node [left] at (x.mid lslope/2) {(x.mid lslope/2)}; +% \node [right] at (x.low) {(x.low)}; +% \node [below=3ex] at (x.low) {\texttt{L N(x) H}}; +% +% \draw [help lines,shift={(\nx,\ny)}] (0,0) grid +(2,1); +% \timing at (\nx,\ny) {L N(x) D}; +% \draw [blue] (x) circle(3pt); +% \draw [yellow] (x.mid dslope/2) circle(1pt); +% \draw [red] (x.low) circle(1pt); +% \draw [orange] (x.low dslope) circle(1pt); +% \draw [green] (x.high dslope) circle(1pt); +% \node [left] at (x.mid dslope/2) {(x.mid dslope/2)}; +% \node [below left] at (x) {(x)~~~~}; +% \node [below] at (x.low) {(x.low)}; +% \node [above right] at (x.low dslope) {(x.low dslope)}; +% \node [above] at (x.high dslope) {(x.high dslope)}; +% \node [below=3ex] at (x.low) {\texttt{L N(x) D}}; +% +% \draw [help lines,shift={(2*\nx,\ny)}] (0,0) grid +(2,1); +% \timing at (2*\nx,\ny) {L N(x) Z}; +% \draw [blue] (x) circle(3pt); +% \draw [yellow] (x.mid zslope) circle(1pt); +% \draw [red] (x.low) circle(1pt); +% \node [below] at (x) {(x)}; +% \node [left] at (x.mid zslope) {(x.mid zslope)}; +% \node [right] at (x.low) {(x.low)}; +% \node [below=3ex] at (x.low) {\texttt{L N(x) Z}}; +% +% \draw [help lines,shift={(0,2*\ny)}] (0,0) grid +(2,1); +% \timing at (0,2*\ny) {D N(x) H}; +% \draw [blue] (x) circle(3pt); +% \draw [red] (x.low) circle(1pt); +% \draw [yellow] (x.mid dslope/2) circle(1pt); +% \draw [green] (x.high) circle(1pt); +% \draw [teal] (x.high dslope) circle(1pt); +% \node [below] at (x) {(x)}; +% \node [above left,inner xsep=0pt] at (x.high) {(x.high)}; +% \node [above] at (x.high dslope) {~~~~~~~~~(x.high dslope)}; +% \node [left] at (x.mid dslope/2) {(x.mid dslope/2)}; +% \node [right] at (x.low) {(x.low)}; +% \node [below=3ex] at (x.low) {\texttt{D N(x) H}}; +% +% \draw [help lines,shift={(\nx,2*\ny)}] (0,0) grid +(2,1); +% \timing at (\nx,2*\ny) {D N(x) L}; +% \draw [blue] (x) circle(3pt); +% \draw [yellow] (x.mid dslope/2) circle(1pt); +% \draw [red] (x.low) circle(1pt); +% \draw [green] (x.high) circle(1pt); +% \draw [orange] (x.low dslope) circle(1pt); +% \node [below left] at (x) {(x)~~~~}; +% \node [below] at (x.low) {(x.low)}; +% \node [left] at (x.mid dslope/2) {(x.mid dslope/2)}; +% \node [above right] at (x.low dslope) {(x.low dslope)}; +% \node [above] at (x.high) {(x.high)}; +% \node [below=3ex] at (x.low) {\texttt{D N(x) L}}; +% +% \draw [help lines,shift={(2*\nx,2*\ny)}] (0,0) grid +(2,1); +% \timing at (2*\nx,2*\ny) {D N(x) Z}; +% \draw [blue] (x) circle(3pt); +% \draw [yellow] (x.mid dslope/2) circle(1pt); +% \draw [red] (x.low) circle(1pt); +% \draw [green] (x.high) circle(1pt); +% \node [below] at (x) {(x)}; +% \node [left] at (x.mid dslope/2) {(x.mid dslope/2)}; +% \node [right] at (x.high) {(x.high)}; +% \node [right] at (x.low) {(x.low)}; +% \node [below=3ex] at (x.low) {\texttt{D N(x) Z}}; +% +% \end{tikzpicture} +% \caption{Anchors of In-Line Nodes. +% (\texttt{timing/slope=.25})}\label{fig:coordnodeanchors} +% \end{figure} +% \fi +% +% \clearpage % \subsection{Table for Timing Diagrams} % \DescribeEnv{tikztimingtable}{\oarg{TikZ settings for whole % table}\\\meta{Signal Name}\ \ \&\ \ \oarg{\small Init.~Char./TikZ Settings for @@ -1142,25 +1482,52 @@ % names, respectively. Additional \pkg{tikz} drawing code can be insert at the % end of the table using \cs{extracode}. % -% \DescribeMacro{extracode}{} -% This macro is only defined inside a \env{tikztimingtable} environment and can -% only be used after the last table line (\ie after a |\\|). If used all code -% between it and the |\end{tikztimingtable}| will be placed inside the same +% \DescribeMacro{extracode}{\oarg{TikZ Settings}} +% This macro is only defined inside a \env{tikztimingtable} environment. In earlier +% versions of this package it could only be used after the last table line (\ie after a |\\|). +% If used there all code between it and the |\end{tikztimingtable}| will be placed inside the same % \envv{tikzpicture}. This allows to add some drawing lines or a grid to the -% picture. It is also possible to draw something behind the timing diagram by -% using the PGF background layer: +% picture. The macro does \emph{not} start a TikZ |scope| or a \TeX\ group by itself. +% The optional \meta{settings} therefore affect all following code until the end of the picture. +% +% It is also possible to draw something behind the timing diagram by +% using using the \env{background} environment or the PGF background layer: % |\begin{pgfonlayer}{background}|\ldots|\end{pgfonlayer}|. % +% \DescribeMacro{endextracode}{} +% From\NewIn{v0.7} version 0.7 on it is possible to add further timing rows after an |extracode| section by using +% \cs{endextracode}. Everything after this macro is taken as part of a new row. It is allowed to use +% this macro direct before \cs{end}\env{tikztimingtable}. This makes it possible to use \cs{extracode} +% anywhere inside the table, including at the very start before any rows are processed. Early +% insertion of extra code is necessary for \eg limiting the bounding box or setting up a clipping path. +% +% \DescribeEnv{extracode}{\oarg{TikZ Settings}} +% Instead\NewIn{v0.7} of using \cs{extracode} \dots \cs{endextracode}, which is actual plain\TeX\ syntax, this +% \LaTeX\ style environment can be used. Like any environment it creates a \TeX\ group around its +% content, but no TikZ |scope| is created to allow drawing code (\eg clipping paths) to affect the +% rest of the table. The optional \meta{settings}, however, only affect the environment content. +% +% Please note that while \cs{endextracode} is optional if \cs{extracode} is used at the end of the table, +% a \cs{begin}\env{extracode} must always be closed by \cs{end}\env{extracode}. +% % \subsubsection{Macros for \cs{extracode} Section} % The following macros are only defined inside a \env{tikztimingtable} after the % macro \cs{extracode}. They are useful for drawing additional material. % +% \DescribeMacro{tablegrid}{\meta{*}\oarg{TikZ Settings}} +% After \css{extracode} this macro draws a grid in the background of the table. +% A separate grid is drawn for each row. The normal version draws all grids with +% the width of the widest row while the star version draws them with the width +% of the corresponding row. Because this macro draws material into the |background| +% layer it must not be placed inside a |pgfonlayer| environment itself. % -% \DescribeMacro{tablegrid}{\oarg{TikZ Settings}} -% \DescribeMacro*{fulltablegrid}{\oarg{TikZ Settings}} -% After \css{extracode} this macros draw a grid in the background of the table. -% The first one draws a separate grid for each row and the second one a big grid -% over all rows. +% \DescribeMacro{fulltablegrid}{\oarg{TikZ Settings}} +% After \css{extracode} this macro draws a big grid over all rows in the +% background of the table. +% +% \DescribeMacro{nrows}{} +% Returns the number of rows in the current table. Useful for use in +% \cs{horlines}. % % \DescribeMacro{rowdist}{} % \DescribeMacro*{coldist}{} @@ -1170,40 +1537,55 @@ % and \texttt{timing/coldist} settings which are explained in % Section~\ref{sec:styles}. % -% \DescribeMacro{nrows}{} -% Returns the number of rows in the current table. Useful for use in -% \cs{horlines}. -% % \DescribeMacro{twidth}{} % Returns the width (as multiple of the `period width') of the longest timing -% diagram line in the table.\\Example: If the longest line would be -% `|H 2.3L z|' than \cs{twidth} would be $1+2.3+0.5=3.8$. +% diagram line in the table. Example: If the longest line would be +% "H 2.3L z" than \cs{twidth} would be $1+2.3+0.5=3.8$. % % \DescribeMacro{horlines}{\oarg{TikZ Settings}\marg{list}} % Draws horizontal lines, optionally with the given \meta{Settings}, at the base % line of the rows given by \meta{list}. The PGF macro % \css{foreach}\footnote{See the \texttt{pgf} manual for more details.} is % internally used so the list can include not only row numbers as integer but -% also fractional numbers and the `|...|' operator to auto-increment the +% also fractional numbers and the "..." operator to auto-increment the % numbers. Please note that all numbers in the list are multiplied by % \cs{rowdist}. -% If the list is empty the default `|1,2,...,\nrows|' is used which draws lines +% If the list is empty the default "1,2,...,\nrows" is used which draws lines % for all rows. % % \DescribeMacro{vertlines}{\oarg{TikZ Settings}\marg{list}} % Like \cs{horlines} but draws vertical lines and the listed numbers a relative % to the basic width. -% If the list is empty the default `|0,1,...,\twidth|' is used which draws lines +% If the list is empty the default "0,1,...,\twidth" is used which draws lines % after every period width. % +% \DescribeMacro{tableheader}{\oarg{TikZ Settings}\marg{Description +% Title}\marg{Signal Title}} +% This macro adds a table head row on top of the table. The two mandatory +% arguments provide the header text for the description and signal columns. +% % \DescribeMacro{tablerules}{\oarg{TikZ Settings}} % This macro adds top and bottom rules to the table in the same (or at least % very similar) way as the \texttt{booktabs} package is doing it for normal % \texttt{tabular}s. The current bounding box is used to calculate the needed -% rule length, which makes this macro position dependent if further code is -% changing the bounding box. +% rule length, which makes this macro position dependent if further code +% changes the bounding box. If the \cs{tableheader} macro was used beforehand it +% also draws a thinner horizontal line (like \texttt{booktabs} \cs{midrule}) between the table head and body. +% +% \DescribeEnv{background}{\oarg{TikZ Settings}\\\meta{drawing commands}} +% This environment can be used to draw material on the |background| layer and is +% an abbreviation for:\\[\medskipamount] +% | \begin{pgfonlayer}{background}|\\ +% | \begin{scope}|\oarg{TikZ Settings}\\ +% | |\meta{drawing commands}\\ +% | \end{scope}|\\ +% | \end{pgfonlayer}| % % \subsubsection*{Positions \& Scalings inside the Table} +% \textbf{Note:} The anchors provided by the timing shape +% (Section~\ref{sec:timingshape}) should now be used to position additional +% graphics. +% % The first row starts at $y=0$ and the next rows are each % |-1*\rowdist| lower than the previous one. % ^^A The very last one can be accessed by the tikz coordinate `\texttt{(last @@ -1213,15 +1595,74 @@ % three rows goes from $y=+1$ (base line at 0 + 1 \textsf{signal height}) to % $y=-4$ (first row:~+0, second row:~-2, third row:~-4). This are relative to % the middle of the drawn lines, \ie the bounding box is -% $2\times\frac{\text{\textsf{line width}}}{2}=1\cdot $\textsf{line width} +% $2\times\frac{\text{\textsf{line width}}}{2}=1\times $\textsf{line width} % higher. % % The timing column starts at $x=0$ and goes into the positive range while % scaled using the period width. Example: |HHHh| has a width of 3.5. -% % The label column starts at $x=-$|\coldist| and the text is right align with % the right border at this position. % +% \clearpage +% \subsection{Macros for use inside the Character String} +% The modifiers "@" and `\texttt{\$}' allow the user to include macros. These +% macros are evaluated when the |tikz-timing| parser encounters them in the +% input character string, \ie before any diagram element is drawn or any single +% bracket "[ ]" options are processed. Therefore their values should be set +% either outside the |tikz-timing| diagram or with the "[! .. !]" or +% "[[ .. ]]" option blocks. +% +% The following macros are provided for the user. +% +% \DescribeMacro{tikztimingsetwscale}{\marg{math expression}} +% \DescribeMacro*{setwscale}{\marg{math expression}} +% This macro\NewIn{v0.7}, which can be called |\setwscale| for short inside modifier code, +% sets the |wscale| value. This value is used during the parsing process to +% scale the width of the characters, \eg |wscale=3.2| makes |1H| as long as +% |3.2H| normally would be. Slopes are not affected, but the `width' values of +% meta-characters are. It can also be set with the |timing/wscale| TikZ setting. +% The current value can be accessed using \cs{wscale}. +% +% \DescribeMacro{wscale}{} +% Returns the current width scaling "wscale" value. +% +% \begingroup +% \def\macroline*[#1]{\hspace{5em}} +% \DescribeMacro{xunit}{} +% \DescribeMacro*{yunit}{}\\ +% This dimension registers can be used to access the x- and y-unitlength of the timing diagram. +% Assignments to these registers do not change the scaling! +% +% \DescribeMacro{slope}{} +% \DescribeMacro*{lslope}{\hspace{.6em}\small(alias)}\\ +% Returns the current logic slope, \ie the slope between |L| and |H| +% levels. +% Set by the |timing/lslope| or indirectly by the |timing/slope| TikZ setting. +% See Table~\ref{tab:styles} for more information. +% \endgroup +% +% \DescribeMacro{zslope}{} +% Returns the current Z slope. Set by the |timing/zslope| or indirectly by the +% |timing/slope| TikZ setting. +% +% \DescribeMacro{dslope}{} +% Returns the current Z slope. Set by the |timing/dslope| or indirectly by the +% |timing/slope| TikZ setting. +% +% \subsubsection*{Examples:} +% Changing the slope and using its value to calculate the width of a +% character:\\ +% |\texttiming{ HLHLHL [[timing/slope=.5]] H $\slope$L }|\\ +% gives: +% {\texttiming{ HLHLHL [[timing/slope=.5]] H $\slope$L }} +% \\*[\smallskipamount] +% Changing the width scaling for a curtain group of characters:\\* +% |\texttiming|\ignorespaces +% |{ HL [!wscale=\wscale/3!] 3D{a} Z D Z [!wscale=3*\wscale!] HL }|\\* +% gives: +% {\texttiming{ HL [!wscale=\wscale/3!] 3D{a} Z D Z [!wscale=3*\wscale!] HL }} +% +% \clearpage % \subsection{Meta-Characters} % It is possible to define recurring groups of characters and modifiers as so % called meta-characters. These characters are than expanded to the group @@ -1234,40 +1675,77 @@ % suppresses its normal meaning. Using the meta-character in its own definition % group causes a infinite loop which will lead to an \TeX\ error. % -% \DescribeMacro{tikztimingmetachar}{\marg{Meta-Character}\marg{Character -% Group}} +% \DescribeMacro{tikztimingmetachar}{\marg{Meta-Character}\oarg{Number of +% arguments}\marg{Character Group}} % This macro defines the given \meta{meta-character} to be identical to the % given \meta{character group}. Alternatively this can also be done using the -% TikZ style `|timing/metachar=|\marg{Meta-Character}\marg{Character~Group}'. +% TikZ style `|timing/metachar=|\marg{Meta-Character}\oarg{Number of +% arguments}\marg{Character~Group}'. % % An empty group deletes the meta-character, which might be necessary in cases % when normal characters are temporary redefined as meta-characters. However, if % the group only contains spaces the meta-character is practically ignored. % +% \subsubsection*{Meta-Characters with Arguments} +% The\NewIn{v0.7} +% replacement text of meta-character can now include macro arguments. +% This allows the creation of more complex and flexible meta-characters. The +% optional argument \meta{Number of arguments} selects the number of macro +% arguments in the same way it does for \cs{newcommand}. However, the first +% argument |#1| is always set to the given `width' of the meta-character, \ie +% the number value preceding it. All further arguments are read as normal for +% macros from the text after the meta-character. It is recommended to enclose +% them in braces. +% +% The default behaviour of meta-character without arguments is, as mentioned +% above, to repeat the replacement group by the preceding number (`width'). This +% is now archived by defining them internally as `|#1|\marg{Character Group}', +% which creates a repetition group. Users which want to include an own argument +% but still want to repeat the group need to define a meta-character with at +% least two arguments and define it as "#1{ .. #2 .. }". If the repetition is +% not wanted the |#1| argument can be used as a real width for one or more group +% internal characters: "{Y}[1]{Z #1D Z}", so "4Y" will give "Z 4D Z" +% instead of "4{Z D Z}". +% +% Also the modifier "@" (see Table~\ref{tab:modifiers}) together with the +% \cs{setwscale} macro can be used to scale the whole group dependent on the +% first argument:\\ +% "{Y}[1]}{ @{\setwscale{#1*\wscale}} Z 2D Z @{\setwscale{\wscale/#1}} }", so +% "4Y" is equivalent to "4Z 8D 4Z". +% +% The new `\texttt{\$}' modifier can be used to calculate the width of the group +% characters: |{Y}[1]{$#1/3$D{A} $#1/3D${B} $#1/3$D{C}}|, so "4Y" results in +% "1.333D{A} 1.333D{B} 1.333D{C}". +% +% % \bigskip % \noindent -% \textit{Examples:}\\[\medskipamount] +% \textit{Examples:}\\*[\medskipamount] % |\tikztimingmetachar{Y}{2D 0.5U 2D{}} \texttiming{ZZ Y Z 3Y ZZ}|\\ -% gives:\\ +% gives: % {\tikztimingmetachar{Y}{2D 0.5U 2D{}} \texttiming{ZZ Y Z 3Y ZZ}} % \\[\bigskipamount] % |\tikztimingmetachar{Y}{2D{Text}} \tikztimingmetachar{y}{1D{\tiny Text}}| % |\texttiming{ZZ Y Z 3y ZZ}|\\ -% gives:\\ +% gives: % {\tikztimingmetachar{Y}{2D{Text}} \tikztimingmetachar{y}{1D{\tiny Text}} % \texttiming{ZZ Y Z 3y ZZ}} % \\[\bigskipamount] -% |\newcounter{mycount}|\\ -% |\tikztimingmetachar{Q}{2D{\stepcounter{mycount}\arabic{mycount}}}|\\ -% |\tikztimingmetachar{R}{[/utils/exec=\setcounter{mycount}{0}]}|\\ -% |\texttiming{ 5Q R 3Q R 10Q }|\\ -% gives:\\ +% \DeleteShortVerb{\|} +% \MakeShortVerb{\`} +% `\newcounter{mycount}`\\ +% `\tikztimingmetachar{Q}{2D{\stepcounter{mycount}\arabic{mycount}}}`\\ +% `\tikztimingmetachar{R}{[| /utils/exec=\setcounter{mycount}{0} |]}`\\ +% `\texttiming{ 5Q R 3Q R 10Q }`\\ +% gives: % {\newcounter{mycount}% % \tikztimingmetachar{Q}{2D{\stepcounter{mycount}\arabic{mycount}}}% -% \tikztimingmetachar{R}{[/utils/exec=\setcounter{mycount}{0}]}% +% \tikztimingmetachar{R}{[| /utils/exec=\setcounter{mycount}{0} |]}% % \texttiming{ 5Q R 3Q R 10Q }} +% \DeleteShortVerb{\`} +% \MakeShortVerb{\|} % \\[\bigskipamount] -% Redefining the glitch `|G|' character:\\ +% Redefining the glitch "G" character:\\ % |\tikztimingmetachar{G}{.1T.1T .2B} \tikztimingmetachar{g}{.1T.1T}|\\ % |\texttiming{ 10{H G L G} H } % With correction of width `.2B'|\\ % |\texttiming{ 10{H g L g} H } % Without correction|\\ @@ -1278,11 +1756,40 @@ % \texttiming{ 10{H G L G} H }\\ % \texttiming{ 10{H g L g} H }\\ % \texttiming{ 10{H L } H }} +% \\[\bigskipamount] +% |\tikztimingmetachar{J}[2]{ 1.8D{#2} .2D{} }|\\ +% |\texttiming{ D{} J{A} J{B} J{C} D }|\\ +% gives: +% {\tikztimingmetachar{J}[2]{ 1.8D{\strut #2} .2D{} }% +% \texttiming{ D{} J{A} J{B} J{C} D }} +% \\[\bigskipamount] +% |\tikztimingmetachar{Y}[3]{#1{ D{\strut #2} D{#3} }}|\\ +% |\texttiming{ Z 2Y{a}{b} Z 4Y{1}{2} Z}|\\ +% gives: +% {\tikztimingmetachar{Y}[3]{#1{ D{#2} D{#3} }}% +% \texttiming{ Z 2Y{a}{b} Z 4Y{1}{2} Z}} +% \\[\bigskipamount] +% |\tikztimingmetachar{Y}[3]{ .2D .2B #1d{\strut #2} .2D .2B #1d{\strut #3} }|\\ +% |\texttiming{ Z 2Y{a}{b} Z 4Y{1}{2} Z}|\\ +% gives: +% {\tikztimingmetachar{Y}[3]{ .2D .2B #1d{\strut #2} .2D .2B #1d{\strut #3} }% +% \texttiming{ Z 2Y{a}{b} Z 4Y{1}{2} Z}} +% \\[\bigskipamount] +% Mata-chars to set the width scaling. Because the scaling also affects the +% meta-char width (|#1|) argument a compensation is needed to achieve absolute +% values (|W|) instead of relative ones (|w|).\\ +% |\tikztimingmetachar{w}[1]{ [! wscale=#1 !] } % relative|\\ +% |\tikztimingmetachar{W}[1]{ [! wscale=#1/\wscale !] } % absolute|\\ +% |\texttiming{ HL .2w HLHLH 3w LH 1W LH }|\\ +% gives: +% {\tikztimingmetachar{w}[1]{ [! wscale=#1 !] }% +% \tikztimingmetachar{W}[1]{ [! wscale=#1/\wscale !] }\\ +% \texttiming{ HL .2w HLHLH 3w LH 1W LH }} % % \clearpage % \section{Styles}\label{sec:styles} % The generated logic signals are drawn using the style mechanism provided by -% \pkg{tikz}. This styles are defined and can be redefined using +% \pkg{tikz}, which itself uses |pgfkeys| for this purpose. This styles are defined and can be redefined using % \css{tikzset}|{|\meta{style name}|/.style=|\meta{value}|,}|. They can also be % used in all places where \meta{TikZ Settings} is mentioned. Please note that % path/draw specific settings might not survive the transition to characters @@ -1292,67 +1799,114 @@ % paths. % % The package follows the directory structures approach used by TikZ/PGF and -% places all styles and other settings under the ``subdirectory'' `|timing|' in +% places all styles and other settings under the ``subdirectory'' "timing" in % the main ``directory'' `tikz', which is the default when \css{tikzset} is % used.\\ % ^^AExample: The slope of the transitions can be changed using the key -% ^^A`|timing/slope|', which can also written in the absolute form -% ^^A`|/tikz/timing/slope|'. +% ^^A"timing/slope", which can also written in the absolute form +% ^^A"/tikz/timing/slope". % % ^^AThe Table~\ref{tab:styles} lists all styles defined by this package. -% {% -% \begin{table}[b] -% \centering -% \caption{TikZ Styles and Settings provided and used by this Package.} +% \begin{center}^^A{table}[b] +% \tablecaption{TikZ Styles and Settings provided and used by this Package.} % \label{tab:styles} % \def\en{\,\textsf{--}\,} -% \makebox[\textwidth][c]{^^A -% \begin{tabularx}{1.15\textwidth}{>{\ttfamily}l>{\raggedright\arraybackslash}X} +% \let\origtabular\tabular +% \let\endorigtabular\endtabular +% \def\tabular{\begingroup +% \setbox\mysb\hbox\bgroup +% \origtabular}% +% \def\endtabular{\endorigtabular\egroup\makebox[\textwidth][c]{\usebox\mysb} +% \endgroup}% +% \tablefirsthead{% % \toprule % \normalfont Style/Setting & Description \\ % \midrule +% }% +% \tablehead{% +% \multicolumn{2}{c}% +% {\raisebox{\belowcaptionskip}{\tablename\ \thetable{} -- +% continued from previous page}} \\ +% \toprule +% \normalfont Style/Setting & Description \\ +% \midrule +% }% +% \tabletail{% +% \bottomrule +% ^^A\multicolumn{2}{r}{Continued on next page}\\ +% } +% \tablelasttail{% +% \bottomrule +% } +% \begin{supertabular}{>{\ttfamily}l>{\raggedright\arraybackslash}p{.675\textwidth}} % timing & Base settings like signal height \& period width.\\ -% timing/intext & Used for \cs{texttiming}. Depends on |timing|.\\ +% timing/font & Sets the normal \texttt{font} key and sets +% \texttt{x}/\texttt{y} keys to 1.6ex.\\ +% timing/intext & Used for \cs{texttiming}. Depends on \texttt{timing}.\\ % timing/picture & Usable for own \texttt{tikzpictures} to set timing % settings.\\ -% timing/grid & Used for grids. Depends on |help lines| and |timing|. \\ -% timing/table & Used for \env{tikztimingtable}. Depends on |timing|.\\ -% timing/table/grid & Used for table grid. Depends on |timing/grid|.\\ +% timing/grid & Used for grids. Depends on \texttt{help lines} and \texttt{timing}. \\ +% timing/draw grid & Enables background grids for \cs{timing} macros. \\ +% timing/no grid & Disabled background grids for \cs{timing} macros. \\ +% timing/table & Used for \env{tikztimingtable}. Depends on \texttt{timing}.\\ +% timing/table/grid & Used for table grid. Depends on \texttt{timing/grid}.\\ % timing/table/lines & Used for \cs{horlines} and \cs{vertlines}. \\ -% timing/table/rules & Used for \cs{tablerules}. \\ -% timing/inline node & Used for nodes created by the |N| character. +% timing/table/rules & Used for \cs{tablerules} for top and bottom lines. +% \\ +% timing/table/midrules & Used for \cs{tablerules} between table head and +% body. \\ +% timing/table/header & Used for \cs{tableheader}. \\ +% timing/inline node & Used for nodes created by the \texttt{N} character. % Defaults to \texttt{coordinate}.\\ % \midrule +% timing/outer sep=\meta{dim} & Sets outer separation around \cs{texttiming} +% macros. \\ +% timing/outer xsep=\meta{dim} & See above. Only X-Coordinate. +% (Default:~0pt) \\ +% timing/outer ysep=\meta{dim} & See above. Only Y-Coordinate. +% (Default:~0pt) \\ +% \midrule % timing/\meta{lowercase char} & Style for character \meta{char}. Not used -% for `|H|' and `|L|'. \\ -% timing/\meta{lc char}/background & Background style for characters `|D|' -% and `|U|'. \\ +% for `\texttt{H}' and `\texttt{L}'. \\ +% timing/\meta{lc char}/background & Background style for characters `\texttt{D}' +% and `\texttt{U}'. \\ % timing/\meta{lc char}/text & Text style for character \meta{char}. Only -% defined for `|D|'. \\ +% defined for `\texttt{D}'. \\ % \midrule -% timing/initchar=\meta{char} & Sets initial character. Only valid as first +% timing/text format=\meta{macros} & Define macros which are placed before +% the text of `\texttt{D\{text\}}'. The text is enclosed in braces to allow +% the last macro to take it as an argument. A \cs{strut} is a good choice to +% ensure a common baseline.\\ +% timing/initchar=\meta{char} & Sets initial character. Only valid as first % optional argument in table rows or \cs{texttiming}.\\ -% timing/metachar=\meta{C}\meta{G} & Sets meta-character \meta{C} to -% character group \meta{G}.\\ +% timing/metachar=\marg{C}\oarg{\#arg}\marg{G} & Sets meta-character +% \meta{C} to character group \meta{G}.\\ % timing/slope=\meta{0.0\en1.0} & Sets slope for logic transitions. -% \newline This also sets |dslope=2*slope|, |zslope=slope/2|.\\ +% \newline This also sets \texttt{dslope=2*slope}, +% \texttt{zslope=slope/2}.\\ % timing/lslope=\meta{0.0\en1.0} & Sets slope for logic transitions only. % Default: 0.1\\ % timing/dslope=\meta{0.0\en1.0} & Sets slope for data transitions. % Default: 0.2\\ % timing/zslope=\meta{0.0\en1.0} & Sets slope for Z transitions. Default: % 0.05\\ +% \midrule % timing/rowdist=\meta{distance} & Sets (baseline) distance between rows in % a tikztimingtable. Default: 2 (=$2\times$signal height)\\ % timing/coldist=\meta{distance} & Sets distance between columns in a % tikztimingtable. Default: 1 (=$1\times$period width)\\ -% \bottomrule -% \end{tabularx} -% } +% \midrule +% timing/debug/nodes & Enables marking of named inline nodes. \\ +% timing/debug/node & Format style for inline node marker label, which itself is a TikZ node. \\ +% timing/debug/markcmd=\meta{code} & TikZ drawing code to draw marker (except label). The code can access the node name as \cs{N}. \\ +% timing/debug/scope & Format for scope of node markers. \\ +% timing/debug/level=\meta{integer} & Sets debug output level. This is only important for developers. \\ +% \end{supertabular} % ^^A\\[\smallskipamount] % ^^A\emph{Note:} As a convention all style names are completely in lowercase. -% \end{table}} +% \end{center}^^A{table} % +% \clearpage % \section{Libraries for Further Characters} % All default timing characters described in Table~\ref{tab:chars} are always % made available by this package. Further, less-common characters are provided @@ -1362,28 +1916,30 @@ % user-defined (meta-)characters. % The full syntax for the above macro is % \cs{usetikztiminglibrary}\oarg{options}\marg{library,\dots}\oarg{date}, like -% the one for \cs{usepackage}. However, no library provides any options so far. -% The date is used as a version number like for packages. +% the one for \cs{usepackage}. +% The date is used as a version number like for packages and is identical to the date +% of the |tikztiming| package. % % \subsection{Arrows} -% The library `|arrows|' enables two characters `|A|' and `|W|' which draw +% The library "arrows" enables two characters "A" and "W" which draw % vertical up and down \textit{A}rro\!\textit{W}s. Such arrows are used in % timing diagrams to mark special polarized events, like clock edges of another % signal. % % The width provided with these character is added as whitespace after the -% ``zero-width'' arrow: `|A2AA|' results in `\,\texttiming{A2AA}'. This space -% can be avoided by specifying the width to zero: `|0.A|'. Like the `|C|' and -% `|T|' characters the subsequent arrow characters are not combined into one. +% ``zero-width'' arrow: "A2AA" results in `\,\texttiming{A2AA}'. This space +% can be avoided by specifying the width to zero: "0A". Like the "C" and +% "T" characters the subsequent arrow characters are not combined into one. % % The arrow tips can be changed using the TikZ styles for this characters. See -% \ref{sec:styles} for more information. The `|A|' character should not be used -% together with any other characters except with `|S|' (space). +% section~\ref{sec:styles} for more information. The "A" character should not be used +% together with any other characters except with "S" (space). % % \begin{table}[H] % \centering % \caption{Examples for Arrow Characters.}\label{tab:arrows} % \begin{tikztimingexampletable} +% 0A \\ % AAA \\ % 3A \\ % 3{A} \\ @@ -1393,23 +1949,29 @@ % 3{AW} \\ % 3{aw} \\ % 2S 2A 3W A W \\ +% \extracode +% \tablegrid* % \end{tikztimingexampletable} % \end{table} % +% \clearpage % \subsection{Either High or Low} -% The library `|either|' is enabling the `|E|' character which stands for +% The library "either" enables the "E" character which stands for % `\textit{either high or low}'. This character is designed to be used with the -% `|H|' and `|L|' characters to display a uncertainty of a transition. +% "H" and "L" characters to display a uncertainty of a transition. % Sometimes a, e.g.\ low signal can go either to high or stay at low for a % certain time before it definitely goes to high. In this case both (or more) % possible transitions can be drawn using this character. -% Like the `|C|' and `|T|' characters subsequent `|E|' characters are not +% Like the "C" and "T" characters subsequent "E" characters are not % combined into one. % +% The drawing style can be changed using the |timing/e| and +% |timing/e/background| TikZ style. +% % \begin{table}[H] % \centering % \caption{Examples for the `\texttt{E}' Character.}\label{tab:either} -% \begin{tikztimingexampletable} +% \begin{tikztimingexampletable}[timing/e/background/.style={fill=black!20}] % L E H \\ % L D H \\ % H E L \\ @@ -1426,56 +1988,705 @@ % H E E H \\ % L E E L \\ % \end{tikztimingexampletable} +% \par\medskip +% \makebox[\textwidth][c]{% +% \begin{tabular}{lc} +% \toprule +% Settings (\texttt{timing/e/.cd}) & Resulting Diagram (\texttt{LL EE HH}) +% \\\midrule +% \texttt{.style=\{dotted,gray\}} & +% \texttiming[timing/e/.style={dotted,gray}]{LL EE HH} \\ +% \texttt{background/.style=\{fill=gray\}} & +% \texttiming[timing/e/background/.style={fill=gray}] +% {LL EE HH} \\ +% \bottomrule +% \end{tabular} +% }% % \end{table} % +% \clearpage % \subsection{Overlays} -% The library `|overlays|' is enabling the `|O|' character which allows the -% overlaying of two different groups of timing characters. This character awaits -% two groups enclosed by braces which are drawn in the given order. The position -% before the `|O|' character is saved and restored to draw the second group. -% The characters of the first group connect to the characters before the `|O|' -% modifier but then simply end. -% The characters following after the groups connect to the characters of the -% second group as normal. +% The library "overlays" enables the "O" character which allows the +% overlaying of timing characters, i.e.~different groups of timing characters +% are drawn on top of each other. This is not to be confused with `dynamic' overlay +% provided by the presentation class |beamer|. The |tikz-timing| library |beamer| provides +% some support for such overlays. +% +% The "O" character awaits a set of character +% enclosed by braces which are drawn as normal. The position before the "O" +% character is then restored and the following characters are drawn over them. +% Older versions of this character awaited a second set of characters in braces +% but this braces are now optional. The exact syntax is:\\[\smallskipamount] +% \hspace*{2em} \meta{chars before} |O|\marg{background chars} \marg{foreground +% chars} \meta{chars after}\\[\smallskipamount] +% or, without second set of braces, but equal:\\[\smallskipamount] +% \hspace*{2em} \meta{chars before} |O|\marg{background chars} \meta{foreground +% chars, \dots}\\[\smallskipamount] +% % It is the responsibility of the user to make sure that the lines drawn by the -% first group reconnect to the main lines or do something else useful. The -% modifier `|;|' can be used in the first group to restart the drawn line, e.g.\ -% to change to a different color. This is not done automatically to give the -% user the freedom if and where this should happen. It is recommended to start -% and end both groups with the same character to avoid ugly connection points. +% first set reconnect to the main lines or do something else useful. The +% modifier ";" can be used to restart the drawn line, e.g.\ to change to a +% different color. This is not done automatically to give the user the freedom +% if and where this should happen. It is recommended to start and end the set +% with characters identical with the main line to avoid ugly connection points. +% +% Please note that the width of the first argument is ignored and does not count to the +% total width of the diagram line. The characters following the overlay should therefore +% be as wide or wider as the one of the overlay, otherwise the bounding box and background grid +% will be incorrect. +% +% Overlays can be cascaded\NewIn{v0.7}, \ie an overlay can be included in the first argument +% of another overlay. % % \begin{table}[H] % \centering % \caption{Examples for the `\texttt{O}' Overlay Character.}\label{tab:overlays} -% \begin{tikztimingexampletable} +% \begin{tikztimingexampletable}[timing/draw grid] % LLL O{HH}{LL} HHH \\ % LLL O{HHH}{LL} HHH \\ -% LLL O{[gray]HHH}{LLH} HH \\ % LLL O{;[gray]HH.1H;}{LLH} HH \\ % LL O{L;[gray]HH.1H;}{LLLH} HH \\ -% HHH O{;[gray]HH.1L;}{LL} LLL \\ +% DD{} O{zd}{D}d 2D \\ +% ZZ O{Z D Z}{Z 1.1M .9Z} ZZ \\ +% ZZ O{d Z}O{DZ}{dD} ZZ \\ +% ZZ O{dDZ}O{DZ}{dZ} ZZ \\ +% ZZ 3D O{dDZ}{DZ} ZZ \\ +% ZZ 3D O{dDZ}O{DZ}{dZ} ZZ \\ +% ZZ 3D O{3D} DZZ \\ +% Z O{DD} ZDDD O{DDZZ} DZ 2S \\ +% Z O{6D Z}{Z 4D Z} Z \\ +% Z O{8D Z}O{Z 6D Z}{2Z 4D 2Z} Z \\ % \end{tikztimingexampletable} % \end{table} % -% % \clearpage -% \section{Examples} -% This section shows some examples by putting either the full source code or -% only the needed characters beside the graphical result. Please note that the -% displayed syntax is the one of \cs{timing} where the initial character is -% declared as optional argument (\oarg{char}) \emph{inside}/\emph{together} with -% the logic characters. The syntax of \cs{textttiming} is identical except the -% initial character is given as a normal optional argument before the characters -% argument. -% All examples except Example~\ref{exa:adv} are attached in compilable form -% to this PDF. -% ^^A\\[\smallskipamount] -% ^^A\emph{Example notation example:} `|[c]cccc|' means either -% ^^A|\timing{[c]cccc};| or |\texttiming[c]{cccc}|. -% +% \subsection{Clock Arrows} +% The library "clockarrows"\NewIn{v0.7} is changing the "C" clock character to contain +% arrows which mark the rising and/or falling clock edge. By default the rising +% edges are marked. To simplify the implementation only the transition from a +% "C" to another "C" character contains the arrows but not transitions from +% or to different characters, like "HCH" or "LCL". +% +% The arrows can be controlled using the TikZ styles shown in +% Table~\ref{tab:clockarrowstyles} below. This styles can also be used as +% library options. The key ``directory'' "timing/c" must be dropped for +% options, e.g.\\\hspace*{2em} +% \cs{usetikztiminglibrary}|[rising arrows]{clockarrows}|. -% \begin{exampletable} -% \centering +% \begin{table}[H] +% \centering +% \caption{TikZ Styles for Clock Arrows.} +% \label{tab:clockarrowstyles} +% \makebox[\textwidth][c]{% +% \begin{tabularx}{1\textwidth}{>{\ttfamily}l>{\raggedright\arraybackslash}X} +% \toprule +% \normalfont Style/Setting & Description \\ +% \midrule +% timing/c/rising arrows & Mark (only) rising edges with arrows.\\ +% timing/c/falling arrows & Mark (only) falling edges with arrows.\\ +% timing/c/dual arrows & Mark both rising and falling edges with arrows.\\ +% timing/c/no arrows & Do not mark any edges with arrows. (Default)\\ +% \midrule +% timing/c/arrow & Style for arrows. Can be modified to change arrow tip +% etc. (Default: \{\})\\ +% timing/c/arrow pos=\meta{0.\!-\!\!-1.} & Position of arrows, i.e.\ its +% tip, on the edge. May needs adjustment if different arrow tip shapes +% are selected. (Default: 0.95)\\ +% timing/c/arrow tip=\meta{name} & Tip shape of arrows. See the PGF manual +% for the list of arrow tips. (Default: `\texttt{to}')\\ +% \bottomrule +% \end{tabularx}} +% \end{table} +% +% \begin{table}[H] +% \caption{Examples for the Clock Arrows.}\label{tab:clockarrows} +% \tikzset{timing/c/dual arrows}% +% \centering +% \begin{tabular}{lc} +% \toprule +% Settings (\texttt{timing/c/.cd}) & Resulting Diagram (\texttt{10\{C\}}) +% \\\midrule +% \texttt{rising arrows} & \texttiming[timing/c/rising arrows]{10{C}} \\ +% \texttt{falling arrows}& \texttiming[timing/c/falling arrows]{10{C}} \\ +% \texttt{no arrows} & \texttiming[timing/c/no arrows]{10{C}}\\ +% \texttt{dual arrows} & \texttiming[timing/c/dual arrows]{10{C}}\\ +% \midrule +% \texttt{arrow pos=.5} & \texttiming[timing/c/arrow pos=.5]{10{C}}\\ +% \texttt{arrow tip=latex} & \texttiming[timing/c/arrow tip=latex]{10{C}}\\ +% \texttt{arrow tip=stealth}& \texttiming[timing/c/arrow tip=stealth]{10{C}}\\ +% \bottomrule +% \end{tabular} +% \end{table} +% +% \clearpage +% \subsection{Column Type} +% The library "columntype"\NewIn{v0.7} uses the \pkg{array} package to define a new +% |tabular| column type for timing characters. The tabular column can then hold +% timing characters like the \env{tikztimingtable}. An initial option block +% "[...]" is taken as initial character or diagram line wide settings. The +% main difference between these two table types is that \env{tikztimingtable} +% creates a big common |tikzpicture| with one coordinate system with potential +% extra drawing code and the column type creates single pictures for each +% diagram line without common coordinate system. +% +% By default the letter "T" and left alignment are used for the timing column +% type. The TikZ style |timing/columntype=|\marg{letter}\marg{alignment} can be +% used to select different column letters and alignments. The \meta{alignment} +% represents here the \emph{real} column letter like "l", "c" or "r". +% Additional column code can be added using the `|>|\marg{code}' and +% `|<|\marg{code}' argument of the \pkg{array} package. +% \iffalse +% \noindent\textbf{Examples:}\\ +% \hspace*{1em}|\tikzset{timing/columntype={T}{r}}| \hspace{2em} Change to right +% alignment.\\ +% \hspace*{1em}|\tikzset{timing/columntype={I}{>{code}c<{code}}| \hspace{2em} +% Defines letter "I" to create centered timing diagrams with some code before +% and after it. +% \fi +% +% More complex column types (\eg one holding |@{..}| or |!{..}| arguments, +% multiple columns, etc.) must be defined manually using \pkg{array}'s +% \cs{newcolumntype} macro. The default definition is equal +% to\\[\smallskipamount] +% \hspace*{2em}|\newcolumntype{T}{>{\celltiming}l<{\endcelltiming}}|. +% +% \smallskip +% The default "T" definition can be suppressed by using either the library +% option |notype| or a different |type| (equal to |timing/columntype|): +% \\[\smallskipamount] +% \hspace*{2em}|\usetikzlibrary[type={U}{l}]{columntype}|\\[\smallskipamount] +% +% \bigskip +% \begin{example} +% \centering +% \begin{examplecode} +% \begin{tabular}{lcT} +% \toprule +% Description & Num & \multicolumn{1}{l}{Signal} \\ +% \midrule +% Example & A & HLHZLHL \\ +% Example & B & [][green] HLHZLHL \\ +% Example & C & [green] HLHZLHL \\ +% \bottomrule +% \end{tabular} +% \end{examplecode} +% \caption{Example for use of Timing Column Type.}\label{exa:columntype} +% \end{example} +% +% \clearpage +% \subsection{Nice Timing Tables} +% The library "nicetabs"\NewIn{v0.7} uses the settings of the \pkg{array} and +% \pkg{booktabs} packages to improve the layout of \env{tikztimingtables}. The +% resulting table matches a \env{tabular}|{rT}| table which uses the above +% packages and the |columntype| library. The table macros \cs{tabcolsep}, +% \cs{arraystretch} and \cs{extrarowheight} are obeyed. +% +% The original table layout is designed to produce integer coordinates between +% the rows to simplify the drawing of extra drawings (see \cs{extracode}). The +% improved layout will cause non-integer coordinates, but in-line nodes and the +% \cs{rowdist} and \cs{coldist} macros can be used to draw extra material +% relatively to the rows. +% +% The TikZ styles "timing/nice tabs" (default) and "timing/no nice tabs" can +% be used to activate and deactivate the layout, \eg for each table. Both +% settings can be given as a library option, but without the "timing/" path. +% +% \bigskip +% \begin{table}[H] +% \caption{Timing tables using `nice' (left) and normal (right) Layout. For +% comparison a \texttt{\{tabular\}\{rT\}} table is placed in grey below the +% left table.}^^A +% \hbox{}\hfill +% \begin{tikzpicture} +% \node [gray] {\sffamily\ignorespaces +% \begin{tabular}{rT} +% \toprule +% Name & \multicolumn{1}{l}{Timing} \\ +% \midrule +% Example & HLHLLHHH \\ +% Example & HLHLLHHH \\ +% Example & HLHLLHHH \\ +% \bottomrule +% \end{tabular}^^A +% }; +% \node {\ignorespaces +% \begin{tikztimingtable}[timing/nice tabs] +% Example & HLHLLHHH \\ +% Example & HLHLLHHH \\ +% Example & HLHLLHHH \\ +% \extracode +% \tableheader{Name}{Timing} +% \tablerules +% \end{tikztimingtable}^^A +% }; +% \end{tikzpicture} +% \hfill +% \begin{tikztimingtable}[timing/no nice tabs] +% Example & HLHLLHHH \\ +% Example & HLHLLHHH \\ +% Example & HLHLLHHH \\ +% \extracode +% \tableheader{Name}{Timing} +% \tablerules +% \end{tikztimingtable} +% \hfill\hbox{}^^A +% \end{table} +% +% \clearpage +% \subsection{Counter Character} +% The library "counters"\NewIn{v0.7} allows the easy definition of meta-characters which +% implement up-counters. These characters show the counter value using the +% "D{}" character and increment it by one every time they are used. A second +% character can be defined to (re-)set the counter to a specific value. The +% counter values can be decimal (base-10, default), hexadecimal (base-16) or any +% other base from 2 till 36. By default the lower case version of the counter +% character is defined to produce the same output only with half the width. +% The style `\texttt{timing/counter/\meta{char}}' (initially empty) is used to +% format the graphic style of this counter.\\ +% +% Counter characters are defined using the TikZ key +% `\texttt{timing/counter/new=}\linebreak[3]\ignorespaces +% \texttt{\{char=\meta{char},\meta{settings}\}}' which can also be written as +% "timing/new counter". The \meta{settings} are TikZ keys themselves and are +% shown by Table~\ref{tab:countersettings}. One or more "new" keys (path +% "timing/counter" removed) can be given as library options. +% +% \begin{table} +% \caption{Settings for Counter Meta-Characters} +% \label{tab:countersettings} +% \begin{tabularx}{\textwidth}{>{\ttfamily}lX} +% \toprule +% \multicolumn{1}{l}{Key name} & Description \\ +% \midrule +% char=\meta{char} & Defines the given \meta{char} to be a counter +% meta-character. If it is a upper case character the lower case character +% will produce the same output but with the half width, as long this is not +% overwritten with the \texttt{half with char} key. \\ +% reset char=\meta{char} & Defines the given \meta{char} to (re-)set the +% counter value to the `width' of the character, \ie the number preceding it. +% The lower case version of \meta{char} is not defined.\\ +% base=\meta{Num 2-36} & Defines the numeric base of the counter. The default +% is 10.\\ +% half width char=\meta{char} & Defines the given \meta{char} to be the half +% width version of the counter value. By default this is the lower case +% version of the counter character given with \texttt{char}. An empty value +% for \meta{char} deactivates the definition of a half width character, which +% is the main application of this key.\\ +% \bottomrule +% \end{tabularx} +% \end{table} +% +% \subsubsection*{Example:} +% \noindent +% Counter character "Q" with base 16 (hexadecimal). "R" resets the +% counter:\\*\noindent +% |\tikzset{timing/new counter={char=Q,base=16,reset char=R}}|\\*\noindent +% The counter value should be in blue text typer font.\\*\noindent +% |\tikzset{timing/counter/Q/.style={font=\ttfamily,blue}}|\\*\noindent +% |\texttiming{ 3Q 3{Q} R 12{Q} 2R Q qq 0R 3{Q} }|\\*\noindent +% gives: {% +% \tikzset{timing/counter/new={char=Q,base=16,reset char=R}}% +% \tikzset{timing/counter/Q/.style={font=\ttfamily,blue}}% +% \texttiming{ 3Q 3{Q} R 12{Q} 2R Q qq 0R 3{Q} }% +% }% +% +% \clearpage +% \subsection{Advanced Nodes} +% The library "advnodes"\NewIn{v0.7} changes the in-line nodes, \ie the "N" character, to provide multiple +% transition dependent and independent node anchors shown in Table~\ref{tab:advanchor}. +% +% Most transitions provide the three logic level anchors "low", "mid" and "high" which lie +% on the drawn timing line. Transitions of `double line' characters like "D" can have +% two low and/or high level anchors which are called "low2" and "high2". +% +% To align marker lines over multiple rows inside a \env{tikztimingtable} a set of transition +% independent node anchors are provided: "LOW", "MID", "HIGH". This anchors lie all at the begin of the +% transition at the appropriate logic levels. +% With the normal coordinate-like in-line nodes the vertical node (center) position has to be taken into +% account, while this advanced anchors do this automatically. +% +% Often marker lines should start and end with a little vertical offset from the timing diagram to be more distinguishable. +% For this the two anchors "TOP" and "BOTTOM" exist. They lie above and below of "HIGH" and "LOW", respectively. +% The vertical distance can be set using `|timing/nodes/offset=|\meta{dim.~or number}'. +% +% \textbf{Please note} that the node \emph{center} of advanced nodes will be different for some transitions. +% The "center" anchor (used by default if no node anchor is provided) will be placed at the logical center of the +% transition, \ie mostly in the middle of it. In order not to break existing diagrams which use nodes as references +% to draw additional material an TikZ styles is provided to select between the old and new node centers. This styles +% can be used globally or locally as required. The two explicit anchors "new center" and "old center" are also +% provided. For existing documents with diagrams using normal nodes it is recommended +% to switch to simple nodes or to the old node centers globally or select such a style for each old diagram. +% +% The following TikZ settings can be used with the library. The node style settings affect all new nodes after them. +% The center settings affect all following \emph{references} (\eg "(NodeName)" or "(NodeName.center)") of advanced nodes. +% The settings can be used as library options with the "timing/nodes/" part removed. +% +% \vfill\noindent +% \begin{tabularx}{\textwidth}{lX} +% \toprule +% TikZ Setting & Description \\ +% \midrule +% |timing/nodes/advanced| & Selects advanced in-line nodes. (library default) \\ +% |timing/nodes/simple| & Selects simple coordinate-style in-line nodes. (package default) \\ +% \midrule +% |timing/nodes/new center| & Center of in-line nodes is in the new position. (default for |advanced|) \\ +% |timing/nodes/old center| & Center of in-line nodes is in the old position. (always on for |simple|) \\ +% \midrule +% |timing/nodes/offset| & Sets offset for |TOP| and |BOTTOM| anchors. +% Can be a dimension with unit or a factor to the current |y| unit. (default: 0.25) \\ +% \bottomrule +% \end{tabularx} +% +% \subsubsection*{Examples:} +% "\usetikztiminglibrary[simple]{advnodes}"\ \ loads the library with nodes default to the old "simple" style.\\\noindent +% "\usetikztiminglibrary[old center]{advnodes}"\ \ \ loads the library with advanced nodes with have the center at the same +% place as the normal simple nodes. This is a good ``compatibility mode'' for existing pre-v0.7 diagrams.\\\noindent +% "\begin{tikztimingtable}[timing/nodes/simple]"\ \ starts a timing table which uses simple nodes. \\\noindent +% "\begin{tikztimingtable}[timing/nodes/.cd,advanced,old center]"\\\noindent starts a timing table which uses advanced nodes with old node centers. +% +% +% \begin{table} +% \caption{Transition Dependent Anchor Points of Advanced Nodes}^^A +% \label{tab:advanchor}^^A +% \makeatletter +% \let\mid\relax +%^^A +% \tikzset{timing/draw grid}^^A +% \tikzset{timing/.cd, +% lslope=.5, +% dslope=.5, +% zslope=.5, +% }^^A +%^^A +% \tikzset{^^A +% marker/.style={opacity=.8,fill opacity=.8}, +% low/.style={marker,draw=red}, +% mid/.style={marker,draw=yellow}, +% high/.style={marker,draw=green}, +% low2/.style={marker,draw=red!50!black}, +% high2/.style={marker,draw=green!50!black}, +% LOW/.style={marker,CAPITAL,draw=red}, +% MID/.style={marker,CAPITAL,draw=yellow}, +% HIGH/.style={marker,CAPITAL,draw=green}, +% CAPITAL/.style={marker,mark=x,mark size=2\pgflinewidth}, +% origin/.style={marker,mark=x,draw=gray}, +% center/.style={marker,mark=+,draw=black}, +% old center/.style={marker,mark=+,mark size=2\pgflinewidth,draw=blue}, +% new center/.style={marker,mark size=\pgflinewidth,mark=*,fill=blue,draw=blue}, +% }^^A +%^^A +% \newcommand\namark[2][]{^^A +% \draw[mark=o,mark size=3\pgflinewidth,#1] plot coordinates {(#2)} +% }^^A +%^^A +% \def\NodeAnchors#1#2{^^A +% \Huge +% {\raisebox{-.5ex}{\scalebox{1}{^^A +% \begin{tikzpicture}[timing/picture,line width=.5\pgflinewidth] +% \let\pgf@sh@ma@A\@undefined +% \timing [name=T] at (0,0) {#1 N(A) #2}; +% \useasboundingbox (T.south west) rectangle (T.north east); +% ^^A +% \pgf@sh@ma@A +% \anchorpoints +% \foreach \a in {LOW,MID,HIGH,old center,new center} {^^A +% \namark[gray,\a]{A.\a};^^A +% }^^A +% \foreach \a in {low,mid,high,low2,high2} {^^A +% \@ifundefined{\a}{}^^A +% {\namark[semithick,\a]{A.\a};}^^A +% }^^A +% \namark[old center,blue]{A.old center};^^A +% \end{tikzpicture}^^A +% }}}^^A +% \Huge\strut +% }^^A +%^^A +% \def\bchars{,L,H,X,D,E}^^A +% \def\achars{,L,H,X,D,D{A},E,0LE,0HE}^^A +%^^A +% \def\DA{D{A}}^^A +% \def\tablecontent{^^A +% \begin{tabular}{lrrrrrrrrrrrrrrrrrr}^^A +% \toprule +% \tikzpicture +% \useasboundingbox (-1ex,-.5ex) rectangle (1ex,.5ex); +% \node {^^A +% \scalebox{0.4}^^A +% {\rotatebox{-45}{$\frac{\mbox{\rotatebox{45}{to}}}^^A +% {\mbox{\rotatebox{45}{from}}}$}}^^A +% };^^A +% \endtikzpicture +% } +%^^A +% \def\atc#1{^^A +% \begingroup +% \edef\@tempa{#1}^^A +% \expandafter\g@addto@macro\expandafter\tablecontent +% \expandafter{\@tempa}^^A +% \endgroup +% }^^A +%^^A +% \foreach \b in \bchars {^^A +% \atc{& \noexpand\multicolumn{1}{c}{\b}}^^A +% }^^A +%^^A +% \atc{\noexpand\\ \noexpand\midrule}^^A +%^^A +% \foreach \a in \achars {^^A +% \ifx\a\DA +% \atc{D\noexpand\{A\noexpand\}}^^A +% \else +% \atc{\a}^^A +% \fi +% \foreach \b in \bchars {^^A +% \atc{& \noexpand\NodeAnchors{\a}{\b}}^^A +% ^^A \hbox to 5em{\llap{\a\b:} \NodeAnchors{\a}{\b}}^^A +% }^^A +% \atc{\noexpand\\}^^A +% }^^A +%^^A +% \atc{^^A +% \noexpand\bottomrule +% \noexpand\end{tabular}^^A +% }^^A +%^^A +% \sffamily\centering +% \tablecontent +%^^A +% \def\legend#1#2{^^A +% \namark[#1]{[shift={(0,.125ex)}]#2}; \node [right] at (#2) {\normalsize #1\strut} +% }^^A +% \par +% \Huge +% \begin{tikzpicture}[timing/picture,line width=.5\pgflinewidth] +% \node [left] at (-1,0) {\large Legend:}; +% \legend{low}{0,0}; +% \legend{mid}{3,0}; +% \legend{high}{6,0}; +% \legend{low2}{0,-.8}; +% \legend{high2}{6,-.8}; +% \legend{LOW}{0,-1.6}; +% \legend{MID}{3,-1.6}; +% \legend{HIGH}{6,-1.6}; +% \legend{new center}{0,-2.4}; +% \legend{old center}{6,-2.4}; +% \end{tikzpicture}^^A +% \end{table} +% +% \clearpage +% \subsection{Compatibility Macros for \texttt{ifsym} package} +% The library "ifsym"\NewIn{v0.7} provides macros and timing styles to emulate the behaviour of the \pkg{ifsym} package +% when loaded with the |electronic| option. The \pkg{ifsym} package was an early inspiration to this package +% and this library allows the usage of |ifsym| style timing symbol macros and characters +% (`|\textifsym|\marg{characters}' which uses `|\texttiming[timing/ifsym]|\marg{characters}') +% which are described in Table~\ref{tab:ifsymmacros} and Table~\ref{tab:ifsym}, respectively. +% This is useful if old |ifsym| timing diagrams should be reused. The |tikz-timing| replacements are a very close match +% and do not need a special font to be installed. The graphic quality should be equal or better than the original. +% The intermixing of |ifsym| and |tikz-timing| style characters in a \cs{textifsym} macro +% (the one provided by this library, not the one from the \pkg{ifsym} package) is supported but it is not guaranteed to work +% 100\% properly. Please note that the "M" character is defined to use "X" in black. +% +% The library can be loaded with one of the options "provide" (default), "new", "renew" or "off", respectively. +% These select if the macros should be defined using \cs{providecommand}, \cs{newcommand}, \cs{renewcommand} +% or not at all. This can be useful if the \pkg{ifsym} package is loaded beforehand. +% +% \begin{table} +% \centering +% \caption[ifsym style Timing Symbol Macros]{\texttt{ifsym} style Timing Symbol Macros (from \pkg{ifsym} manual)} +% \label{tab:ifsymmacros} +% \begin{tabular}{lll} +% \toprule +% Macro & Symbol & Description (trivial) \\ +% \midrule +% \cs{RaisingEdge} & \RaisingEdge & Raising Edge \\ +% \cs{FallingEdge} & \FallingEdge & Falling Edge \\ +% \cs{ShortPulseHigh} & \ShortPulseHigh & Short Pulse High \\ +% \cs{ShortPulseLow} & \ShortPulseLow & Short Pulse Low \\ +% \cs{PulseHigh} & \PulseHigh & Normal Pulse High \\ +% \cs{PulseLow} & \PulseLow & Normal Pulse Low \\ +% \cs{LongPulseHigh} & \LongPulseHigh & Long Pulse High \\ +% \cs{LongPulseLow} & \LongPulseLow & Long Pulse Low \\ +% \bottomrule +% \end{tabular} +% \end{table} +% +% \begin{table} +% \centering +% \caption[ifsym style Timing Characters]{\texttt{ifsym} style Timing Characters (from \pkg{ifsym} manual)} +% \label{tab:ifsym} +% \begin{tabularx}{\textwidth}{llX} +% \toprule +% Character & Symbol & Description \\ +% \midrule +% |l, h| & \textifsym{l}, \textifsym{h} & Short low or high level signal. \\ +% |L, H| & \textifsym{L}, \textifsym{H} & Long low or high level signal. \\ +% \verb+|+ & \textifsym{|} & Transition/glitch between L/H or H/L levels. \\ +% |m, d| & \textifsym{m}, \textifsym{d} & Short middle or double level signal. \\ +% |M, D| & \textifsym{M}, \textifsym{D} & Long middle or double level signal. \\ +% |<, <<| & \textifsym{<}, \textifsym{<<}& Short or long slope between middle and double level. \\ +% |>, >>| & \textifsym{>}, \textifsym{>>}& Short or long slope between double and middle level. \\ +% \bottomrule +% \end{tabularx} +% \end{table} +% +% +% +% \clearpage +% \subsection{Intervals (experimental)} +% \textbf{This library is under development and might change in the future.} +% +% The library "interval"\NewIn{v0.7} allows the drawing of intervals using the "H", "L", "Z" and "X" logic levels. +% It provides modified definitions of X and Z transitions (e.g.~"LX", "XH") where the transition edges can +% be coloured either way to indicate interval borders. +% +% The interval borders can be set using the `|timing/interval=|\marg{settings}' TikZ style. The +% \meta{settings} are "lo" (left-open), "lc" (left-closed) and "ro" (right-open), "rc" (right-closed), which build the +% following combinations: "{lo,ro}", "{lc,ro}", "{lo,rc}" and "{lc,rc}". However, every of them can also be set on its own, +% e.g.\ "timing/interval={lc}" simply sets the interval to `left-closed' without changing the right border. +% +% The key "timing/interval/normal" (alternative: "timing/interval={normal}") sets the transitions back to their default. +% +% \par\medskip +% \noindent +% Examples: +% \begingroup +% \tikzset{timing/draw grid}\sffamily +% \newcommand*\ttt[2][]{\texttiming[timing/interval={#1}]{#2}} +% \newcommand*\extab[1]{% +% \begin{tabular}{rcc} +% & ro & rc \\ +% lo & \ttt[lo,ro]{#1} & \ttt[lo,rc]{#1} \\ +% lc & \ttt[lc,ro]{#1} & \ttt[lc,rc]{#1} \\ +% \end{tabular} +% } +% \extab{zlzlz} +% \endgroup +% \par\bigskip +% +% \noindent +% A meta-character can be defined for quick changes if necessary:\\[\smallskipamount] +% \begingroup +% |\tikztimingmetachar{Y}{[timing/interval={lo,ro}]}|\\ +% |\tikztimingmetachar{y}{[timing/interval/normal]}|\\ +% |\texttiming[timing/draw grid]{ LZH Y HZH y LZH Y LZL } |\\ +% |\texttiming[timing/draw grid]{ LXH Y HXH y LXH Y LXL } |\\ +% gives: +% \tikztimingmetachar{Y}{[timing/interval={lo,ro}]} +% \tikztimingmetachar{y}{[timing/interval/normal]} +% \texttiming[timing/draw grid]{ LZH Y HZH y LZH Y LZL } +% \texttiming[timing/draw grid]{ LXH Y HXH y LXH Y LXL } \\ +% \endgroup +% +% \par\bigskip +% \noindent +% A further alternative is to use a meta-character with an argument. +% Note that "#2" must be used, because "#1" holds the width, which is irrelevant here. +% This definition is also provided by the `|timing/interval/metachar|=\meta{Character}' key. +% \\[\smallskipamount] +% \begingroup +% |\tikztimingmetachar{I}[2]{[timing/interval={#2}]}|\\ +% or +% |\tikzset{timing/interval/metachar=I}|\\ +% |\texttiming[timing/draw grid]{ LZH I{lo,rc} HZH I{ro} LZH I{normal} LZL } |\\ +% gives: +% \tikztimingmetachar{I}[2]{[timing/interval={#2}]} +% \texttiming[timing/draw grid]{ LZH I{lo,rc} HZH I{ro} LZH I{normal} LZL }\\ +% \endgroup +% +% \clearpage +% \subsection{Beamer Overlay Support (experimental)} +% \textbf{This library is under development and might change in the future.} +% +% The library "beamer"\NewIn{v0.7} provides (at the moment) marginal support for overlays of the \pkg{beamer} class. +% It allows the usage of beamer \emph{overlay specifications} (|<|\meta{spec}|>|) inside the timing string. +% However, the current simple implementation might not work properly and cause strange results. +% The support is designed for use inside \env{tikztimingtable}. +% See the \pkg{beamer} manual for more informations about overlays specifications. +% +% \subsubsection*{Usage} +% Insert an overlay specification, e.g.~|<|\meta{number}|>|, inside the timing string. It will affect the +% rest of the timing characters of the current diagram line. +% Unfortunate due to the global nature of overlays it also affects the rest of the table. Therefore all +% diagram lines should end with a specification which turns overlays off, i.e. |<*>| or |<0->|. Otherwise +% strange results can occur (e.g.~wrong/missing background graphics). +% +% \subsubsection*{Example} +% | Timing Table Row & H L <2> Z L H <3> D{last} Z <*> \\ | +% +% \subsubsection*{Display Rows Stepwise} +% The rows of a \env{tikztimingtable} can be uncovered row-by-row using the way shown below. The signal names +% must be enclosed into a \cs{mbox} because \cs{uncover} needs to be inside horizontal mode. Instead +% of \cs{uncover} another beamer overlay command like \cs{only} or \cs{invisible} can be used. To highlight +% the signal name use \cs{alert}|<|\meta{\dots}|>|\marg{signal name} inside \cs{uncover}. +% At the moment there is no simple way to highlight the timing lines. +% +% \begin{lstlisting}[gobble=4] +% \begin{tikztimingtable} +% \mbox{\uncover<+->{Signal Name 1}} & <.-> HL <*> \\ +% \mbox{\uncover<+->{Signal Name 2}} & <.-> HL <*> \\ +% % ... +% \mbox{\uncover<+->{Signal Name n}} & <.-> HL <*> \\ +% \end{tikztimingtable} +% \end{lstlisting} +% +% \subsubsection*{Display Columns Stepwise} +% Different sections (`columns') of timing diagrams in a \env{tikztimingtable} can be uncovered stepwise using the way shown below. +% In this example the second section/column will be uncovered in the second slide. The first is always visible. Further sections/columns +% can be uncovered in further slides. +% +% Please note that the total width of the table is constant and e.g.~\cs{tablerules} will always cover the full width independent of overlays. +% +% \begin{lstlisting}[gobble=4] +% \begin{tikztimingtable} +% Signal Name 1 & 10D{Sec. 1} <2> 10D{Sec. 2} <*> \\ +% Signal Name 2 & 10D{Sec. 1} <2> 10D{Sec. 2} <*> \\ +% % ... +% Signal Name n & 10D{Sec. 1} <2> 10D{Sec. 2} <*> \\ +% \end{tikztimingtable} +% \end{lstlisting} +% +% \subsubsection*{Overlay Extra Code} +% The |beamer| overlay specifications can be used inside the \cs{extracode} section like in a normal \env{tikzpicture} environment. +% However, in both cases strange results will occur if the end of the environment is hidden by an overlay specification. Due to this +% reason it is recommended to only use overlay commands which affect only an argument, like \cs{only}|<|\meta{\dots}|>|\marg{code}, +% or to place a plain \cs{onlayer} before the end of the environment. +% +% \begin{lstlisting}[gobble=4] +% \begin{tikztimingtable} +% Signal Name 1 & 10D{Sec. 1} <2> 10D{Sec. 2} <*> \\ +% % ... +% \extracode +% % either +% \draw<2> (0,0) -- (2,0); +% \only<3> { ... } +% % or +% \onlayer<2> +% ... +% % and then at the very end: +% \onlayer % or \onlayer<*> +% \end{tikztimingtable} +% \end{lstlisting} +% +% \clearpage +% \section{Examples} +% This section shows some examples by putting either the full source code or +% only the needed characters beside the graphical result. Please note that the +% displayed syntax is the one of \cs{timing} where the initial character is +% declared as optional argument (\oarg{char}) \emph{inside}/\emph{together} with +% the logic characters. The syntax of \cs{textttiming} is identical except the +% initial character is given as a normal optional argument before the characters +% argument. +% All examples except Example~\ref{exa:adv} are attached in compilable form +% to this PDF. +% ^^A\\[\smallskipamount] +% ^^A\emph{Example notation example:} "[c]cccc" means either +% ^^A|\timing{[c]cccc};| or |\texttiming[c]{cccc}|. +% +% +% \DeleteShortVerb{\|} +% \begin{exampletable} +% \centering % \pgfmathsetbasenumberlength{2} % \newcounter{hexcount} % \addtocounter{hexcount}{+8}% @@ -1512,9 +2723,10 @@ % LLL 0.4U 0.6H HH \\ % [L][timing/slope=1.0] HL HL HL HL HL \\ % LLLLL !{-- +(.5,.5) -- ++(1,0)} HHHHHH \\ -% LLLLL [/utils/exec={\somemacro\code}] HHHHHH \\ +% LLLLL [| /utils/exec={\somemacro\code} |] HHHHHH \\ % LL [green] HH [brown] XX LL ZZ [orange] HH \\ % [][line width=1pt] HLXZDU [line width=0.1pt] HLXZDU \\ +% [][line width=1pt] HLXZDU ,[line width=0.1pt] HLXZDU \\ % [][line width=1pt] HLXZDU ;[line width=0.1pt] HLXZDU \\ % \end{tikztimingexampletable}% % } @@ -1523,6 +2735,7 @@ % \cs{texttiming} is used. % % \end{exampletable} +% \MakeShortVerb{\|} % % \begin{example} % \centering @@ -1574,19 +2787,19 @@ % \centering % \begin{examplecode} % \Huge -% \begin{tikzpicture}[timing,thick, -% timing/inline node/.style={coordinate, -% shift={(0.05,-.5)}}] +% \begin{tikzpicture}[timing/picture,thick] % \timing at (0,2) {hH N(A) LHLHL}; -% \timing at (0,0) {HLH N(B) LHLl}; +% \timing[timing/slope=.25] at (0,0) {HLL N(B) HHLl}; % \draw [orange,semithick] -% (A) ellipse (.2 and .6) +(0,-0.6) coordinate (Ax) -% (B) ellipse (.2 and .6) +(0,+0.6) coordinate (Bx); +% (A.mid) ellipse (.2 and .6) +% (B.mid) ellipse (.2 and .6); % \draw [orange,semithick,->] -% (Ax) parabola[bend pos=0.5] (Bx); +% ($ (A.mid) - (0,.6) $) +% parabola [bend pos=0.5] +% ($ (B.mid) + (0,.6) $); % \end{tikzpicture} % \end{examplecode} -% \caption{Using In-Line Nodes to draw Relationships.} +% \caption{Using In-Line Nodes to draw Relationships.}\label{exa:inlinenodes} % \end{example} % % \begin{example} @@ -1620,6 +2833,50 @@ % % \begin{example} % \centering +% \lstset{basicstyle=\footnotesize\ttfamily} +% \def\exampleextraheader{\noexpand\usetikztiminglibrary{advnodes}} +% \begin{examplecode} +% \def\degr#1{\makebox[2em][r]{#1}\ensuremath{{}^{\circ}}}% +% +% \begin{tikztimingtable}[% +% timing/dslope=0.1, timing/.style={x=2ex,y=2ex}, x=2ex, +% timing/rowdist=3ex, +% timing/name/.style={font=\sffamily\scriptsize}, +% timing/nodes/advanced, +% ] +% Clock \degr{90} & l 2{C} N(A1) 5{C} \\ +% Clock \degr{180}& C 2{C} N(A2) 4{C} c\\ +% Clock \degr{270}& h 3{C} N(A3) 4{C} \\ +% Clock \degr{0} & [C] 2{C} N(A0) 2{C} N(A4) 3{C}c ;[dotted] +% 2L; 2{C} N(A5) 3{C} \\ +% Start of T$_{\text{sw}}$ & 4S G N(start) \\ +% Input Pulse & 2.0L 2H 3.5L ;[dotted] 2L; 5L \\ +% Set 3 & 2.5L 2H 3.0L ;[dotted] 2L; 5L \\ +% Set 2 & 3.0L 2H 2.5L ;[dotted] 2L; 5L \\ +% Set 1 & 3.5L 2H 2.0L ;[dotted] 2L; 5L \\ +% Set 0 & 4.0L 2H 1.5L ;[dotted] 2L; 5L \\ +% Reset & 7.5L ;[dotted] 2L; 2L N(reset) 2H 1L \\ +% Final Pulse & 2.5L N(B1) e N(B2) e N(B3) e 3.5H; [dotted] +% 2H; 2H 3L \\ +% Counter & N(x) 2D{Full} N(B0) 2D{0} N(B4) 2D{1} 1.5D;[dotted] +% .25D{2} 1.75D{}; +% 2D{~D$_\text{M}$} N(B5) 2D{D$_\text{M}$+1} D N(y)\\ +% \extracode +% %\tablegrid +% \node[anchor=north] at ($ (x) ! .5 ! (y) - (0,.75) $) +% {\scriptsize D$_\text{M}$ = MSBs of Duty Cycle}; +% \begin{background}[timing/picture,line width=.06ex,color=black!60] +% \foreach \n in {0,...,5} +% \draw ([shift={(0,0.25)}]A\n.HIGH) +% -- ([shift={(0,-0.25)}]B\n.LOW); +% \end{background} +% \end{tikztimingtable}% +% \end{examplecode} +% \caption{Adjusting Diagram Parameters and using Advanced In-Line Nodes to draw Marker Lines.} +% \end{example} +% +% \begin{example} +% \centering % \lstset{basicstyle=\ttfamily\small} % \def\texta{}\def\textb{}^^A % \let\insertoriginalimageforcomparisionifpresent\relax @@ -1717,13 +2974,15 @@ % \url{http://en.wikipedia.org/wiki/File:SPI_timing_diagram.svg}}} % \end{example} % +% \clearpage % \StopEventually{} -% \FloatBarrier % \clearpage % \section{Implementation} % \subsection{Package Header} -% \begin{macrocode} +% \iffalse %<*package> +% \fi +% \begin{macrocode} \RequirePackage{tikz} \usetikzlibrary{calc} @@ -1734,92 +2993,156 @@ {\RequirePackage{environ}} {\RequirePackage{amsmath}} \fi - -\newcommand*\usetikztiminglibrary[2][]{% - \edef\tikztiming@library@options{#1}% - \@ifnextchar{[}%] - {\tikztiming@library{#2}}% - {\tikztiming@library{#2}[]}% -} -\def\tikztiming@library#1[#2]{% - \edef\tikztiming@library@date{#2}% - \tikztiming@library@#1,\relax -} - -\def\tikztiming@library@#1,{% - \IfFileExists{tikz-timing-#1.sty}% - {\RequirePackage[\tikztiming@library@options]{tikz-timing-#1}% - [\tikztiming@library@date]}% - {\PackageError{tikz-timing}% - {No tikz-timing library `#1' found!}% - {}{}{}{}% - }% - \@ifnextchar\relax{}{\tikztiming@library@}% -} - +% \end{macrocode} +% +% \subsection{General Definitions} +% +% \begin{macrocode} \def\tikztimingwidth{0.0} \newcount\tikztiming@numint \newcount\tikztiming@numfrac -\def\tikztiming@num{1.0}% +\def\tikztiming@wscale{1.0}% +\def\tikztimingsetwscale#1{% + \pgfmathparse{#1}% + \let\tikztiming@wscale\pgfmathresult +} +\def\tikztiming@num{0.0}% \let\tikztiming@back\empty \newlength\tikztiming@xunit \newlength\tikztiming@yunit +\setlength{\tikztiming@xunit}{1.6ex}% +\setlength{\tikztiming@yunit}{1.6ex}% + +\def\tikztiming@setnum#1{% + \pgfmathparse{#1}% + \global\let\tikztiming@num\pgfmathresult +} + +\newcount\tikztiming@debug + +\def\tikztiming@xsep{0pt} +\def\tikztiming@ysep{0pt} \newcounter{tikztiming@nrows}% \def\tikztiming@rowdist{2}% \def\tikztiming@coldist{1}% -\def\tikztiminglabel#1{#1}% -\def\tikztiming@prefix{tikztiming@trans@} +\def\tikztiming@prefix{tikztiming@trans@}% +\def\tikztiming@ttt#1#2#3{#1#2#3}% +\def\tikztiming@pfxtr{% + \tikztiming@prefix\expandafter\tikztiming@ttt +} + +\def\timingwidth{1}% +\def\timingheight{1}% % \end{macrocode} % \subsection{TikZ Style Settings} % \begin{macrocode} -\tikzset{timing/.style={% - x=1.6ex, y=1.6ex, +\tikzset{% + timing/.style={% line cap=round, line join=round, - /utils/exec={\setlength{\tikztiming@xunit}{1.6ex}\setlength{\tikztiming@yunit}{1.6ex}}, - }% + timing/adjust@xy + },% } \tikzset{% timing/.cd, + adjust@xy/.style={% + /utils/exec={% + \tikz@textfont + \setlength{\tikztiming@xunit}{1.6ex}% + \setlength{\tikztiming@yunit}{1.6ex}% + },% + /tikz/x=1.6ex, /tikz/y=1.6ex, + }, + font/.style={% + /tikz/font={#1}, + /tikz/timing/adjust@xy + },% initchar/.value required, - initchar/.code={\ifx\lastchar\empty\uppercase{\def\lastchar{#1}}\fi}, - metachar/.code 2 args={\tikztimingmetachar{#1}{#2}}, + initchar/.code={\uppercase{\gdef\tikztiming@lastchar{#1}}}, + metachar/.code={\tikztimingmetachar#1}, grid/.style={timing,help lines}, + @grid/.code={\texttiminggrid}, + draw grid/.style={% + timing/before text/.append style={timing/@grid},% + timing/before/.append style={timing/@grid}% + }, + no grid/.style={timing/@grid/.code={}}, + before/.code={}, + after/.code={}, + before text/.code={\texttimingbefore}, + after text/.code={\texttimingafter}, picture/.style={timing,line width=0.15ex}, intext/.style={timing,line width=0.15ex}, inline node/.style={shape=coordinate}, - table/.style={timing,line width=0.15ex,font=\sffamily}, + inline node/from char/.store in=\tikztiming@node@fromchar, + inline node/to char/.store in=\tikztiming@node@tochar, + table/.style={font=\sffamily,timing,line width=0.15ex}, + before table/.code={}, + after table/.code={}, coord/.style={coordinate}, - save/.style={coordinate,/utils/exec=\tikztiming@savesettings}, - restore/.style={/utils/exec=\tikztiming@restoresettings}, - name/.style={inner sep=0pt,outer sep=0pt}, + save/.style={coordinate}, + restore/.style={/utils/exec={\expandafter\tikzset\expandafter{\tikztiming@saved@options}}}, + option/.style={/utils/exec={\g@addto@macro\tikztiming@saved@options{#1,}},#1}, + nooptions/.style={/utils/exec={\gdef\tikztiming@saved@options{}}}, + name/.style={inner sep=0pt,outer sep=0pt,minimum size=0pt}, + text format/.store in=\tikztiming@textformat, + @/.style={}, + D/.style={timing/d}, + D/text/.style={timing/d/text}, + D/background/.style={timing/d/background}, + D@edge@/.style={timing/d@edge@}, + D@edge@/text/.style={timing/d@edge@/text}, + D@edge@/background/.style={timing/d@edge@/background}, + U/.style={timing/u}, + U/text/.style={timing/u/text}, + U/background/.style={timing/u/background}, + U@edge@/.style={timing/u@edge@}, + U@edge@/text/.style={timing/u@edge@/text}, + U@edge@/background/.style={timing/u@edge@/background}, + H/.style={timing/h}, + L/.style={timing/l}, + E/.style={timing/e}, + E/background/.style={timing/e/background}, + M/decoration/.style={timing/m/decoration}, + M/base/.style={timing/m/base}, + M/.style={timing/m}, + G/.style={timing/g}, + Z/.style={timing/z}, + T/.style={timing/t}, + C/.style={timing/c}, + X/.style={timing/x}, + d/.style={}, d/text/.style={timing,scale=0.6,font=\sffamily}, - d/background/.style={}, + d/background/.style={draw=none}, + d@edge@/.style={timing/d}, + d@edge@/text/.style={timing/d/text}, + d@edge@/background/.style={timing/d/background}, + u/.style={}, + u/background/.style={draw=none,fill=gray}, + u@edge@/.style={timing/u}, + u@edge@/text/.style={timing/u/text}, + u@edge@/background/.style={timing/u/background}, h/.style={}, l/.style={}, - d/.style={}, e/.style={}, - e/background/.style={}, - a/.style={->}, - w/.style={<-}, - m/.style={black!40!brown}, - m/decoration/.style={decorate,decoration={zigzag,segment - length=.25\tikztiming@xunit,amplitude=.225\tikztiming@yunit}}, - k/.style={black!40!blue,semitransparent}, - u/background/.style={fill=gray}, - u/.style={}, - o/background/.style={}, - o/.style={timing/d,line width=0.10ex,dotted}, - g/.style={}, + e/background/.style={draw=none}, + m/decoration/.style={decorate,% + decoration={zigzag,segment length=.25\tikztiming@xunit, + amplitude=.225\tikztiming@yunit}}, + m/base/.style={black!40!brown}, + m/.style={timing/m/base,timing/m/decoration}, + g/.style={decorate=false}, z/.style={blue}, t/.style={}, - c/.style={timing/slope=0.0}, + c/.style={timing/lslope=0.0}, x/.style={red}, table/grid/.style={timing/grid}, table/lines/.style={}, table/rules/.style={line width=0.08em,line cap=butt}, + table/midrules/.style={line width=0.05em,line cap=butt}, + table/header/.style={timing/name}, slope/.code={% \tikztimingsetslope{#1}% \tikztimingsetdslope{2*#1}% @@ -1828,14 +3151,31 @@ lslope/.code={\tikztimingsetslope{#1}}, dslope/.code={\tikztimingsetdslope{#1}}, zslope/.code={\tikztimingsetzslope{#1}}, + wscale/.code={\tikztimingsetwscale{#1}}, coldist/.store in=\tikztiming@coldist, rowdist/.store in=\tikztiming@rowdist, + outer xsep/.store in=\tikztiming@xsep, + outer ysep/.store in=\tikztiming@ysep, + outer sep/.style={/tikz/timing/outer xsep=#1,/tikz/timing/outer ysep=#1}, + % + debug/level/.code={\tikztiming@debug=#1\relax}, + debug/level/.value required, + debug/scope/.style={font=\sffamily\tiny,gray}, + debug/node/.style={above,inner sep=2pt}, + debug/nodes/.style={% + /tikz/timing/after table/.append code={\tikztiming@marknodes{\tikztiming@namednodes}}, + /tikz/timing/after text/.append code={\tikztiming@marknodes{\tikztiming@namednodes}} + }, + debug/markcmd/.store in={\tikztiming@markcmd}, +} +\tikzset{timing/inline node/.cd, + from char={}, to char={} } % \end{macrocode} % -% \subsection{Macros} +% \subsection{Text-Mode Macros} % \begin{macro}{\texttimingbefore} -% This macro is executed inside the tikzpicture environment of \cs{texttiming} +% This macro is executed inside the |tikzpicture| environment of \cs{texttiming} % before the timing diagram is drawn. % \begin{macrocode} \def\texttimingbefore{} @@ -1843,7 +3183,7 @@ % \end{macro} % % \begin{macro}{\texttimingafter} -% This macro is executed inside the tikzpicture environment of \cs{texttiming} +% This macro is executed inside the |tikzpicture| environment of \cs{texttiming} % after the timing diagram is drawn. % \begin{macrocode} \def\texttimingafter{} @@ -1861,34 +3201,25 @@ % \end{macrocode} % \end{macro} % +% \subsection{User Level Macros} +% % \begin{macro}{\texttiming}[2]{Optional initial character}{Timing characters} +% This macro now only parses it optional argument to check if it is a initial +% character or some style settings and then calls \cs{timing} appropriately. % \begin{macrocode} \DeclareRobustCommand*\texttiming[2][]{% \begingroup - \tikztiming@init + \let\tikztiming@lastchar\empty + \let\tikztiming@settings\empty + \tikzset{timing/before/.append style={timing/before text}}% + \tikzset{timing/after/.prefix style={timing/after text}}% \ifx\relax#1\relax\else \tikztiming@testoptarg#1\relax\relax% \fi - \def\@tempa{\begin{tikzpicture}[timing/intext,}%]}[ - \expandafter\@tempa\settings] - \@ifundefined{tikztiming@initcode@\lastchar}% - {}% - {\@nameuse{tikztiming@initcode@\lastchar}}% - \ifx\lastchar\empty\else - \@ifundefined{\tikztiming@prefix\lastchar @start}% - {\PackageWarning{tikz-timing}{Start value for timing character '\lastchar' - is not defined and will be ignored!}{}{}{}}% - {\tikztiming@nameaddtostr{\lastchar @start}{}}% - \fi - \tikztiming@#2\relax - %\message{^^J\meaning\tikztiming@str^^J}% - \path[use as bounding box] (0,0) rectangle - (\timingwidth*\tikztimingwidth,\timingheight);% - \texttimingbefore - \tikztiming@str;% - \node [shape=tikztiming@shape,anchor=origin,name=last texttiming] at (0,0) - {}; - \texttimingafter + \begin{tikzpicture}[timing/intext,baseline={(0,0)}] + \tikztiming@picinit + \def\@tempa{\expandafter\timing\expandafter[\tikztiming@settings] at (0,0)}% + \expandafter\@tempa\expandafter{\expandafter[\tikztiming@lastchar]#2};% \end{tikzpicture}% \endgroup } @@ -1899,282 +3230,467 @@ % \begin{macrocode} \def\tikztiming@testoptarg#1#2\relax{% \ifx\relax#2\relax - \uppercase{\def\lastchar{#1}}% + \uppercase{\def\tikztiming@lastchar{#1}}% \else - \def\settings{#1#2}% + \def\tikztiming@settings{#1#2}% \fi } % \end{macrocode} % \end{macro} % +% \begin{macro}{\tikztiming@picinit} +% For things which should only by initialised once per |tikzpicture|. +% \begin{macrocode} +\def\tikztiming@picinit{% + \global\let\tikztiming@namednodes\empty +} +\let\tikztiming@namednodes\empty +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\tikztiming@init} % \begin{macrocode} \def\tikztiming@init{% - \let\lastchar\empty% - \let\currentchar\empty - \let\settings\empty + \def\tikztiming@lastchar{@}% + \def\tikztiming@num{0}% + \let\tikztiming@currentchar\empty + \let\tikztiming@settings\empty + \let\tikztiming@fromchar\empty + \let\tikztiming@tochar\empty + \let\setwscale\tikztimingsetwscale + \def\wscale{\tikztiming@wscale}% + \let\xunit\tikztiming@xunit + \let\yunit\tikztiming@yunit + \def\slope{\timingslope}% + \def\lslope{\timingslope}% + \def\zslope{\timingzslope}% + \def\dslope{\timingdslope}% + \gdef\tikztiming@saved@settings{}% + \gdef\tikztiming@saved@options{}% + \gdef\tikztiming@oldnodecenter@{}% \def\tikztimingwidth{0.0}% \setcounter{tikztimingtrans}{-1}% \setcounter{tikztimingtranspos}{0}% - \def\tikztiming@str{\draw (0,0) coordinate (timing/start base) }% + \def\tikztiming@str{% + \useasboundingbox (0,0) rectangle (\tikztimingwidth,\timingheight); + \draw (0,0) + coordinate (timing@refa) + coordinate [shift={(0,\timingheight)}] (timing@refb) + coordinate [shift={(0,\timingheight/2)}] (timing@ref) + coordinate (timing/start) + coordinate (timing/start base) + }% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\timing} +% \begin{macro}{\tikz@timing} % \begin{macrocode} -\def\timing{% +\def\tikz@timing{% \@ifnextchar{[}% - {\timing@}% - {\timing@[]}% + {\tikz@timing@}% + {\tikz@timing@[]}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikz@installcommands} +% Add \cs{timing} to the TikZ internal |\tikz@installcommands| macro. +% The |\timing| macro will be installed at the begin of the |tikzpicture|. +% \begin{macrocode} +\g@addto@macro\tikz@installcommands{% + \let\tikz@origtiming=\timing% + \let\timing=\tikz@timing% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikz@uninstallcommands} +% Add \cs{timing} to the TikZ internal |\tikz@uninstallcommands| macro. +% The |\timing| macro will be uninstalled at the begin of nodes. +% \begin{macrocode} +\g@addto@macro\tikz@uninstallcommands{% + \let\timing=\tikz@origtiming% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\timing@}[1]{Optional TikZ Settings} +% \begin{macro}{\tikz@timing@}[1]{Optional TikZ Settings} % \begin{macrocode} -\def\timing@[#1]{% +\def\tikz@timing@[#1]{% \@ifnextchar{a}% - {\timing@at{#1}}% + {\tikz@timing@at{#1}}% {\PackageWarning{tikz-timing}{The \string\timing\space command awaits now an `at' before the coordinate, like the \string\node\space command is doing. Please update your source code to ensure compatibility with newer versions}{}{}{}% \@ifnextchar{+}% - {\timing@@{#1}}% + {\tikz@timing@@{#1}}% {\@ifnextchar(%) - {\timing@@{#1}}% - {\timing@@{#1}++(0,0)}% + {\tikz@timing@@{#1}}% + {\tikz@timing@@{#1}++(0,0)}% }% }% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\timing@at}[1]{Optional TikZ Settings} +% \begin{macro}{\tikz@timing@at}[1]{Optional TikZ Settings} % \begin{macrocode} -\def\timing@at#1at#2(#3){% - \timing@@@{#1}{#2(#3)}% +\def\tikz@timing@at#1at#2(#3){% + \tikz@timing@@@{#1}{#2(#3)}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\timing@@}[3]{Optional TikZ Settings}{Potential `+' or +% \begin{macro}{\tikz@timing@@}[3]{Optional TikZ Settings}{Potential `+' or % empty}{Coordinate} % \begin{macrocode} -\def\timing@@#1#2(#3){% - \timing@@@{#1}{#2(#3)}% +\def\tikz@timing@@#1#2(#3){% + \tikz@timing@@@{#1}{#2(#3)}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\timing@@@}[3]{Optional TikZ Settings}{Coordinate}{Timing +% \begin{macro}{\tikz@timing@@@}[3]{Optional TikZ Settings}{Coordinate}{Timing % Characters} % \begin{macrocode} -\def\timing@@@#1#2#3{% +\def\tikz@timing@@@#1#2#3{% \begingroup \tikztiming@init \let\tikz@alias=\pgfutil@empty% \begin{scope}[shift={#2},timing,#1]% \@ifnextchar{[}% - {\timing@@@init}% - {\timing@@@init[]}% + {\tikz@timing@@@init}% + {\tikz@timing@@@init[]}% #3\relax - %\message{^^J\meaning\tikztiming@str^^J}% + \ifnum\tikztiming@debug>1 + \message{^^J\meaning\tikztiming@str^^J}% + \ifnum\tikztiming@debug>2 + {% + \def\@protect##1{\def##1{\noexpand##1}}% + \@protect\useasboundingbox + \@protect\draw + \@protect\p + \@protect\n + \@protect\x + \@protect\y + \@protect\tikztiming@overlay@save + \edef\@tempa{\tikztiming@str}% + \message{^^J\meaning\@tempa^^J}% + }% + \fi + \fi + \tikzset{timing/before}% \tikztiming@str;% \node [shape=tikztiming@shape,anchor=origin,#1] at (0,0) {}; + \tikzset{timing/after}% \end{scope}% \endgroup - \timing@@@end + \tikz@timing@@@end } % \end{macrocode} % \end{macro} % -% \begin{macro}{\timing@@@end}[1]{Token behind \cs{timing} macro.} +% \begin{macro}{\tikz@timing@@@end} % \begin{macrocode} -\def\timing@@@end#1;{% - \ifx;#1;\else - \PackageError{tikz-package}{Can not parse timing path}{}{}{}% - \fi +\def\tikz@timing@@@end{% + \@ifnextchar{;}% + {\@gobble}% + {\PackageError{tikz-package}{Can not parse timing path}{}{}{}}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\timing@@@init}[1]{Initial character.} +% \begin{macro}{\tikz@timing@@@init}[1]{Initial character.} +% Opens a group which will end in \cs{tikztiming@parser@end}. % \begin{macrocode} -\def\timing@@@init[#1]{% +\def\tikz@timing@@@init[#1]{% + \begingroup \ifx\relax#1\relax\else - \uppercase{\def\lastchar{#1}}% + \uppercase{\def\tikztiming@lastchar{#1}}% \fi - \@ifundefined{tikztiming@initcode@\lastchar}% + \@ifundefined{tikztiming@initcode@\tikztiming@lastchar}% {}% - {\@nameuse{tikztiming@initcode@\lastchar}}% - \ifx\lastchar\empty\else - \@ifundefined{\tikztiming@prefix\lastchar @start}% - {\PackageWarning{tikz-timing}{Start value for timing character '\lastchar' - is not defined and will be ignored!}{}{}{}}% - {\tikztiming@nameaddtostr{\lastchar @start}{}}% + {\@nameuse{tikztiming@initcode@\tikztiming@lastchar}}% + \if @\tikztiming@lastchar\relax\else + \tikztiming@iftrans{@\tikztiming@lastchar}% + {\tikztiming@nameaddtostr{@}{\tikztiming@lastchar}{}}% + {\PackageWarning{tikz-timing}{Start value for timing character + '\tikztiming@lastchar' is not defined and will be ignored!}{}{}{}}% \fi - \tikztiming@ + \tikztiming@parser } % \end{macrocode} % \end{macro} % +% \subsection{Internal Macros} % % \begin{macro}{\tikztiming@trans@} -% The empty transition gets defined to avoid errors if it is used by the generic -% code, e.g. if a non-combinable character like `C' is the last one. -% \begin{macrocode} -\let\tikztiming@trans@\@gobble -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\tikztiming@aftercode@T} % \begin{macrocode} -\def\tikztiming@aftercode@T{% - \tikztiming@output@flush +\def\tikztiming@trans@#1#2#3#4{% + \csname\tikztiming@prefix #2#3#4\endcsname{#1}{#2}{#3}{#4}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@aftercode@t} +% \begin{macro}{\tikztiming@beforenextcode@D@edge@} % \begin{macrocode} -\def\tikztiming@aftercode@t{% - \tikztiming@aftercode@T +\def\tikztiming@beforenextcode@D@edge@{% + \if D\tikztiming@currentchar\else + \gdef\tikztiming@lastchar{D}% + \fi } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@aftercode@C} +% \begin{macro}{\tikztiming@beforenextcode@U@edge@} % \begin{macrocode} -\def\tikztiming@aftercode@C{% - %\tikztiming@output@flush +\def\tikztiming@beforenextcode@U@edge@{% + \if U\tikztiming@currentchar\else + \gdef\tikztiming@lastchar{U}% + \fi } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@aftercode@c} +% \begin{macro}{\tikztiming@initcode@} +% If empty init char was given, exchange it with "@". % \begin{macrocode} -\def\tikztiming@aftercode@c{% - \tikztiming@aftercode@C +\def\tikztiming@initcode@{% + \gdef\tikztiming@lastchar{@}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@aftercode@G} +% \begin{macro}{\tikztiming@initcode@D} % \begin{macrocode} -\def\tikztiming@aftercode@G{% - \let\lastchar\secondlastchar - \let\tikztimingwidth\lasttikztimingwidth +\def\tikztiming@initcode@D{% + \gdef\tikztiming@lastchar{D@edge@}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@aftercode@g} +% \begin{macro}{\tikztiming@initcode@U} % \begin{macrocode} -\def\tikztiming@aftercode@g{% - \let\lastchar\secondlastchar - \let\tikztimingwidth\lasttikztimingwidth +\def\tikztiming@initcode@U{% + \gdef\tikztiming@lastchar{U@edge@}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@aftercode@S} +% \begin{macro}{\tikztiming@parser} % \begin{macrocode} -\def\tikztiming@aftercode@S{% - \let\lastchar\secondlastchar +\def\tikztiming@parser{% + \@ifnextchar\relax + {\tikztiming@parser@end}% + {\tikztiming@testfornum}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@aftercode@s} +% \subsection{Add-to-Macro Macros} +% \begin{macro}{\tikztiming@eaddto}[2]{Macro name}{Tokens to add to macro} % \begin{macrocode} -\def\tikztiming@aftercode@s{% - \let\lastchar\secondlastchar +\def\tikztiming@eaddto#1#2{% + \begingroup + \tikztiming@internaldefs + \@temptokena\expandafter{#1}% + \xdef#1{% + \the\@temptokena + #2% + }% + \endgroup } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@beforenextcode@D@edge@} -% \begin{macrocode} -\def\tikztiming@beforenextcode@D@edge@{% - \if D\currentchar\else - \if d\currentchar\else - \def\lastchar{D}% - \fi - \fi -} -% \end{macrocode} -% \end{macro} % -% \begin{macro}{\tikztiming@beforecode@d@edge@} +% \begin{macro}{\tikztiming@eaddtostr} % \begin{macrocode} -\def\tikztiming@beforenextcode@d@edge@{% - \if D\currentchar\else - \if d\currentchar\else - \def\lastchar{D}% - \fi - \fi +\def\tikztiming@eaddtostr{% + \tikztiming@eaddto\tikztiming@str } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@initcode@D} +% \begin{macro}{\tikztiming@addtostr} % \begin{macrocode} -\def\tikztiming@initcode@D{% - \def\lastchar{D@edge@}% +\def\tikztiming@addtostr{% + \g@addto@macro\tikztiming@str } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@initcode@d} +% \begin{macro}{\tikztiming@makeglobal} % \begin{macrocode} -\def\tikztiming@initcode@d{% - \def\lastchar{d@edge@}% +\def\tikztiming@makeglobal#1{% + \global\let#1#1\relax\relax } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@} -% The |\@ifnextchar\bgroup| is a trick to remove following spaces which would -% break the number test. +% \begin{macro}{\tikztiming@iftrans}[1]{Characters} % \begin{macrocode} -\def\tikztiming@{% - \@ifnextchar\bgroup - {\tikztiming@testfornum}% - {\tikztiming@testfornum}% +\def\tikztiming@trans{}% +\def\tikztiming@iftrans#1{% + \tikztiming@iftrans@#1\empty\empty\empty\relax } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@eaddtostr}[1]{Tokens to add to string.} +% \begin{macro}{\tikztiming@iftrans}[4] +% {First character}{Second character} +% {Next character or empty}{Eats token till end marker} % \begin{macrocode} -\def\tikztiming@eaddtostr#1{% +\def\tikztiming@iftrans@#1#2#3#4\relax{% \begingroup - \tikztiming@internaldefs{}% - \@temptokena\expandafter{\tikztiming@str}% - \xdef\tikztiming@str{% - \the\@temptokena - #1% - }% - \endgroup -} -% \end{macrocode} -% \end{macro} + \xdef\tikztiming@trans{#1#2}% + \ifx\tikztiming@trans\empty + \gdef\tikztiming@trans{{@}{}{@}}% + \else + \global\let\tikztiming@trans\relax + % Use triple macros before double macros + \@ifundefined{tikztiming@triple@#2}% + {\@ifundefined{\tikztiming@prefix#1#2}% + {}% + {\xdef\tikztiming@trans{{#1}{#2}{}}}% + }% + {% + \@ifundefined{\tikztiming@prefix#1#2#3}% + {}% + {\xdef\tikztiming@trans{{#1}{#2}{#3}}}% + }% + % If both do not exist, search for aliases: + \ifx\tikztiming@trans\relax + \@ifundefined{tikztiming@alias@#1}% + {\edef\chara{#1}}% + {\edef\chara{#1,\csname tikztiming@alias@#1\endcsname}}% + \@ifundefined{tikztiming@alias@#2}% + {\edef\charb{#2}}% + {\edef\charb{#2,\csname tikztiming@alias@#2\endcsname}}% + \@ifundefined{tikztiming@triple@#2}% + {\def\charc{\empty}}% + {% + \@ifundefined{tikztiming@alias@#3}% + {\edef\charc{#3,}}% + {\edef\charc{#3,\csname tikztiming@alias@#3\endcsname,}}% + }% + \ifx\charb\empty + \def\charb{\empty}% + \fi + \let\tikztiming@next\relax + \foreach \b in \charb {% + \foreach \a in \chara {% + \foreach \c in \charc {% + %\message{ ^^J Testing: \a\b\c ^^J}% + \@ifundefined{\tikztiming@prefix\a\b\c}% + {}{% + \xdef\tikztiming@trans{{#1}{#2}{#3}}% + \expandafter\tikztimingcpy\expandafter + {\tikztiming@trans}{\a\b\c}% + \ifnum\tikztiming@debug>0 + \message{^^J DEBUG: '#1#2#3' = '\a\b\c' ^^J}% + \fi + \expandafter\tikztiming@makeglobal + \csname\tikztiming@pfxtr\tikztiming@trans\endcsname + \ifnum\tikztiming@debug>1 + \ifnum\tikztiming@debug>2 + \expandafter\show\csname\tikztiming@pfxtr\tikztiming@trans\endcsname + \else + \message{^^J\tikztiming@trans: + \expandafter\meaning\csname\tikztiming@pfxtr\tikztiming@trans\endcsname^^J}% + \message{^^J\a\b\c: + \expandafter\meaning\csname\tikztiming@prefix\a\b\c\endcsname^^J}% + \fi + \fi + \global\let\tikztiming@next\breakforeach + }% + \tikztiming@next + }% + \tikztiming@next + }% + \tikztiming@next + }% + \fi + \fi + \endgroup + \ifx\tikztiming@trans\relax + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi +} +% \end{macrocode} +% \end{macro} % -% \begin{macro}{\tikztiming@addtostr} +% \begin{macro}{\tikztiming@nameaddtostr} +% {First character}{Second character} +% {Optional next character} % \begin{macrocode} -\def\tikztiming@addtostr{% - \g@addto@macro\tikztiming@str +\def\tikztiming@nameaddtostr#1#2#3{% + \tikztiming@iftrans{{#1}{#2}{#3}}% + {% + \edef\@tempa{\noexpand\tikztiming@trans@{\tikztiming@num}\tikztiming@trans}% + \expandafter\g@addto@macro + \expandafter\tikztiming@str + \expandafter{\@tempa}% + }% + {\PackageWarning{tikz-timing}{No transitions '#1#2' (or '#1#2#3') defined!}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@output@addcode} +% Adds code to the output code buffer. The code will not be expanded, i.e.\ will +% be protected from the expansion when the buffer is flushed. +% \begin{macrocode} +\def\tikztiming@output@addcode#1{% + \g@addto@macro\tikztiming@output@bufcode{\unexpanded{ #1 }}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@output@eaddcode} +% Adds code to the output code buffer. The code will be expanded when the buffer +% is flushed. +% \begin{macrocode} +\def\tikztiming@output@eaddcode#1{% + \g@addto@macro\tikztiming@output@bufcode{ #1 }% } % \end{macrocode} % \end{macro} % +% \begin{macro}{\tikztiming@output@Eaddcode} +% Adds code to the output code buffer. The code will be expanded immediately and +% again when the buffer is flushed. +% \begin{macrocode} +\def\tikztiming@output@Eaddcode{% + \tikztiming@eaddto\tikztiming@output@bufcode% +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Output Routine} +% +% Init buffer macros: +% \begin{macrocode} +\def\tikztiming@output@bufchara{}% +\def\tikztiming@output@bufcharb{}% +\def\tikztiming@output@bufnum{0}% +\def\tikztiming@output@bufcode{}% +\def\tikztiming@output@nextchar{}% +% \end{macrocode} +% % \begin{macro}{\tikztiming@output}[2]{Character 1}{Character 2} % \begin{macrocode} \def\tikztiming@output#1#2{% + \edef\tikztiming@fromchar{#1}% + \edef\tikztiming@tochar{#2}% \ifx\relax#2\relax - \tikztiming@nameaddtostr{#1}% + %\tikztiming@output@codeflush + \tikztiming@nameaddtostr{}{#1}{}% \else \ifcase0% \ifx\tikztiming@output@bufchara\empty @@ -2185,85 +3701,95 @@ % not empty \edef\tikztiming@output@currentchar{#2}% \ifcase0% - \expandafter\ifx\csname tikztiming@nocombine@#2\endcsname\relax - \ifx\tikztiming@output@currentchar\tikztiming@output@bufcharb - 1% - \fi\fi + \ifx\tikztiming@output@bufcode\empty% Stop combining if code was inserted + \expandafter\ifx\csname tikztiming@nocombine@#2\endcsname\relax + \ifx\tikztiming@output@currentchar\tikztiming@output@bufcharb + 2% + \fi + \fi + \else + 1% + \fi \relax + \edef\tikztiming@output@nextchar{#2}% \tikztiming@output@flush - \edef\tikztiming@output@bufchara{#1}% - \edef\tikztiming@output@bufcharb{#2}% + \xdef\tikztiming@output@bufchara{#1}% + \xdef\tikztiming@output@bufcharb{#2}% + \or + \edef\tikztiming@output@nextchar{#2}% + \tikztiming@output@flush + \xdef\tikztiming@output@bufchara{#1}% + \xdef\tikztiming@output@bufcharb{#2}% \or \pgfmathparse{\tikztiming@output@bufnum + \tikztiming@num}% - \let\tikztiming@output@bufnum\pgfmathresult - \def\tikztiming@num{1.0}% + \global\let\tikztiming@output@bufnum\pgfmathresult \fi \else % empty - \edef\tikztiming@output@bufchara{#1}% - \edef\tikztiming@output@bufcharb{#2}% - \let\tikztiming@output@bufnum\tikztiming@num - \def\tikztiming@num{1.0}% + \tikztiming@output@codeflush + \xdef\tikztiming@output@bufchara{#1}% + \xdef\tikztiming@output@bufcharb{#2}% + \global\let\tikztiming@output@bufnum\tikztiming@num \fi \fi } % \end{macrocode} +% \end{macro} % -% Init buffer macros: +% \begin{macro}{\tikztiming@output@flush} % \begin{macrocode} -\def\tikztiming@output@bufchara{}% -\def\tikztiming@output@bufcharb{}% -\def\tikztiming@output@bufnum{0}% +\def\tikztiming@output@flush{% + \tikztiming@output@charflush + \tikztiming@output@codeflush +} % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@output@flush} +% \begin{macro}{\tikztiming@output@codeflush} % \begin{macrocode} -\def\tikztiming@output@flush{% +\def\tikztiming@output@codeflush{% + \tikztiming@eaddtostr{\tikztiming@output@bufcode}% + \global\let\tikztiming@output@bufcode\empty% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@output@charflush} +% A group is used to protect the current value of |num| which is the length of +% the new character after the flushed old character. This value will be assigned +% to the new buffer length |bufnum|. +% \begin{macrocode} +\def\tikztiming@output@charflush{% \begingroup \let\tikztiming@num\tikztiming@output@bufnum - \tikztiming@nameaddtostr{% - \tikztiming@output@bufchara - \tikztiming@output@bufcharb - }% + \tikztiming@nameaddtostr + {\tikztiming@output@bufchara}% + {\tikztiming@output@bufcharb}% + {\tikztiming@output@nextchar}% \endgroup% + \gdef\tikztiming@output@nextchar{}% \gdef\tikztiming@output@bufchara{}% \gdef\tikztiming@output@bufcharb{}% \global\let\tikztiming@output@bufnum\tikztiming@num - \gdef\tikztiming@num{1.0}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@nameaddtostr}[1]{Name of macro without prefix -% to add} -% \begin{macrocode} -\def\tikztiming@nameaddtostr#1{% - \begingroup - \edef\@tempa{\tikztiming@num}% - \expandafter\g@addto@macro - \expandafter\tikztiming@str - \expandafter{\csname\tikztiming@prefix#1\expandafter\endcsname - \expandafter{\@tempa} }% - \endgroup - \def\tikztiming@num{1.0}% -} -% \end{macrocode} -% \end{macro} % -% \begin{macro}{\tikztiming@nameedef}[3]{Optional character to indicate -% character case}{Macro name to be defined (without prefix)}{Content of macro} +% \subsection{Macros for Character Definitions} +% +% \begin{macro}{\tikztiming@nameedef}[4]{Macro name to be defined (without +% prefix)}{Content of macro} % Defines internal tikztiming macro with name |\|\meta{prefix}\meta{name (\#2)}. % The macro definition (\#3) is expanded while the internal drawing definitions % are active. % \begin{macrocode} -\newcommand\tikztiming@nameedef[3][A]{% - \def\@gtempa##1{#3}% - \expandafter\let\csname\tikztiming@prefix#2@general\endcsname\@gtempa +\newcommand\tikztiming@nameedef[4]{% + \def\@gtempa##1{#4}% \begingroup - \tikztiming@internaldefs{#1}% - \xdef\@gtempa##1{\@gtempa{\width}}% + \tikztiming@internaldefs + \xdef\@gtempa##1##2##3##4{\@gtempa{\width}}% \endgroup - \expandafter\let\csname\tikztiming@prefix#2\endcsname\@gtempa + \expandafter\let\csname\tikztiming@prefix#1#2#3\endcsname\@gtempa \let\@gtempa\empty } % \end{macrocode} @@ -2290,9 +3816,15 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@@end} +% +% \subsection{Parser} +% +% \begin{macro}{\tikztiming@parser@end} % \begin{macrocode} -\def\tikztiming@@end{% +\def\tikztiming@parser@end{% + \def\tikztiming@output@nextchar{@}% + \let\tikztiming@fromchar\tikztiming@tochar + \edef\tikztiming@tochar{@}% \tikztiming@output@flush \global\let\tikztimingwidth\tikztimingwidth \tikztiming@addtostr{ coordinate (timing/end) @@ -2300,47 +3832,34 @@ coordinate (timing/end base) at (\x2,\y1) coordinate (timing/end top) at (\x2,1+\y1) }% + \endgroup + \tikztiming@endhook% } +\let\tikztiming@endhook\relax % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@@}[1]{Next Character} +% \begin{macro}{\tikztiming@parser@}[1]{Next Character} % \begin{macrocode} -\def\tikztiming@@#1{% +\def\tikztiming@parser@#1{% \ifx\relax#1\empty - \expandafter\tikztiming@@end + \expandafter\tikztiming@parser@end \else - \let\lasttikztimingwidth\tikztimingwidth \tikztiming@iflower{#1}% - {\pgfmathparse{\tikztiming@num/2.0}\let\tikztiming@num\pgfmathresult}% + {\tikztiming@setnum{\tikztiming@num/2}}% {}% \ifx\tikztiming@back\empty\else - \pgfmathparse{\tikztiming@num-\tikztiming@back}% - \let\tikztiming@num\pgfmathresult - \let\tikztiming@back\empty + \tikztiming@setnum{\tikztiming@num - \tikztiming@back}% + \global\let\tikztiming@back\empty \fi \pgfmathparse{\tikztimingwidth + \tikztiming@num}% - \let\tikztimingwidth\pgfmathresult - \def\currentchar{#1}% - \uppercase{\def\currentcharuc{#1}}% - \@ifundefined{tikztiming@beforenextcode@\lastchar}% - {}% - {\@nameuse{tikztiming@beforenextcode@\lastchar}}% - \@ifundefined{tikztiming@beforecode@\currentchar}% - {}% - {\@nameuse{tikztiming@beforecode@\currentchar}}% - \@ifundefined{\tikztiming@prefix\lastchar\currentchar}% - {\@ifundefined{\tikztiming@prefix\lastchar\currentcharuc}% - {\PackageWarning{tikz-timing}{Timing transition '\lastchar\currentchar' - is not defined and will be ignored!}{}{}{}}% - {\tikztiming@output{\lastchar}{\currentcharuc}}% - }% - {\tikztiming@output{\lastchar}{\currentchar}}% - \let\secondlastchar\lastchar - \let\lastchar\currentcharuc - \@ifundefined{tikztiming@aftercode@\currentcharuc}% - {}% - {\@nameuse{tikztiming@aftercode@\currentcharuc}}% + \global\let\tikztimingwidth\pgfmathresult + \uppercase{\gdef\tikztiming@currentchar{#1}}% + \@nameuse{tikztiming@beforenextcode@\tikztiming@lastchar}% + \@nameuse{tikztiming@beforecode@\tikztiming@currentchar}% + \tikztiming@output{\tikztiming@lastchar}{\tikztiming@currentchar}% + \global\let\tikztiming@lastchar\tikztiming@currentchar + \@nameuse{tikztiming@aftercode@\tikztiming@currentchar}% \expandafter \tikztiming@testfortext \fi @@ -2353,55 +3872,89 @@ \def\tikztiming@testfortext{% \@ifnextchar\bgroup {\tikztiming@handletext}% - {\tikztiming@}% + {\tikztiming@parser}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\tikztiming@handletext}[1]{Text} -% \begin{macrocode} +% Looks ahead if the current character is the last one and sets the end-of-line +% marker if so. +% +% This seems outdated because |handletext@| does not flush the output any more. +% \begin{macrocode} \def\tikztiming@handletext#1{% + \@ifnextchar\relax + {\def\tikztiming@output@nextchar{@}\tikztiming@handletext@{#1}}% + {\def\tikztiming@output@nextchar{Z}\tikztiming@handletext@{#1}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@handletext@}[1]{Text} +% \begin{macrocode} +\def\tikztiming@handletext@#1{% \@ifnextchar{[}% - {\tikztiming@handletext@}% - {\tikztiming@handletext@[]}% - #1\relax + {\tikztiming@handletext@@}% + {\tikztiming@handletext@@[]}% + #1\tikztiming@endoftext } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@handletext@}[2]{Optional Settings}{Text} +% \begin{macro}{\tikztiming@handletext@@}[2]{Optional Settings}{Text} % \begin{macrocode} -\def\tikztiming@handletext@[#1]#2\relax{% - \begingroup +\def\tikztiming@handletext@@[#1]#2\tikztiming@endoftext{% + \@ifnextchar{\relax}% + {\def\tikztiming@output@nextchar{@}% + \tikztiming@handletext@@@{#1}{#2}}% + {\tikztiming@handletext@@@{#1}{#2}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@handletext@@@}[2]{Optional Settings} +% {Text} +% \begin{macrocode} +\def\tikztiming@handletext@@@#1#2{% \expandafter\lowercase\expandafter{% - \expandafter\def\expandafter\currentcharlc - \expandafter{\currentchar}% + \expandafter\def\expandafter\@tempa + \expandafter{\tikztiming@currentchar}% }% - \pgfkeysifdefined{/tikz/timing/\currentcharlc/text/.@cmd}% + \pgfkeysifdefined{/tikz/timing/\@tempa/text/.@cmd}% {% - \tikztiming@output@flush - \tikztiming@eaddtostr{% - node (timing@dend) at +(\dslope/2.0,\height/2.0) {} - node [%] - shift={($ (timing@dstart)!0.5!(timing@dend) $)},% - timing/\currentcharlc/text,% - }% - \endgroup - \tikztiming@addtostr{%[ - #1% - ] {#2}% - }% - \def\lastchar{D@edge@}% + \edef\@tempa{node [timing/\@tempa/text,}% + \expandafter\tikztiming@output@addcode\expandafter{% + \@tempa + #1] at ($ (timing@dstart) !.5! (timing@dend) $) + {\tikztiming@textformat{#2}} + }% + \ifcase0% + \if @\tikztiming@output@bufchara + 1% + \else + \ifx\tikztiming@output@bufchara\tikztiming@currentchar + 1% + \fi + \fi + \relax + \else + \fi + \xdef\tikztiming@output@bufcharb{\tikztiming@currentchar @edge@}% + \xdef\tikztiming@lastchar{\tikztiming@currentchar @edge@}% }{% \endgroup \PackageWarning{tikz-timing}{Ignoring text for character - '\currentchar'!}{}{}{}% + '\tikztiming@currentchar'!}{}{}{}% }% - \tikztiming@ + \tikztiming@parser } +\let\tikztiming@textformat\empty % \end{macrocode} % \end{macro} % +% \subsection{Definition of Modifiers} +% % \begin{macro}{\tikztiming@defcode}[1]{Code Character} % \begin{macrocode} \def\tikztiming@defcode#1{% @@ -2410,14 +3963,46 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\tikztiming@defcode{@}} +% Simply executes given code. The |\relax| is added to have some protection +% against user code manipulating the parser macro. The `@' character can be both +% a letter (in style files) and a character (in user documents), so it is +% defined twice. +% \begin{macrocode} +\tikztiming@defcode{@}#1{% + #1\relax + \tikztiming@parser +} +\begingroup + \expandafter\let\expandafter\temp + \csname tikztiming@code@\meaning @\endcsname + \makeatother + \expandafter\global\expandafter\let + \csname tikztiming@code@\meaning @\endcsname\temp +\endgroup +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@defcode{DOLLAR}} +% Takes the code between two dollar signs and parses it as math expression. The +% result is put back on the input stream. This allows the calculation of +% character width. +% \begin{macrocode} +\tikztiming@defcode$#1${% + \pgfmathparse{#1}% + \expandafter + \tikztiming@parser\pgfmathresult +} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\tikztiming@defcode{,}} % \begin{macrocode} \tikztiming@defcode{,}{% - \tikztiming@output@flush - \tikztiming@eaddtostr{% + \tikztiming@output@eaddcode{% \newdraw }% - \tikztiming@ + \tikztiming@parser } % \end{macrocode} % \end{macro} @@ -2425,11 +4010,11 @@ % \begin{macro}{\tikztiming@defcode{;}} % \begin{macrocode} \tikztiming@defcode{;}{% - \tikztiming@output@flush - \tikztiming@eaddtostr{% + \endgroup\begingroup + \tikztiming@output@eaddcode{% \newdrawns }% - \tikztiming@ + \tikztiming@parser } % \end{macrocode} % \end{macro} @@ -2454,180 +4039,243 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@addnode}[1]{Options} +% \begin{macro}{\tikztiming@defcode{B}} % \begin{macrocode} -\def\tikztiming@addnode@getoptions[#1]{% - \@ifnextchar(%) - {\tikztiming@addnode@getname{#1}}% - {\tikztiming@addnode@getname{#1}()}% +\tikztiming@defcode{B}{% + \pgfmathparse{\tikztiming@back+\tikztiming@num}% + \global\let\tikztiming@back\pgfmathresult + \tikztiming@parser } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@addnode@getname}[2]{Previous read options}{Node -% name} +% \begin{macro}{\tikztiming@defcode{b}} % \begin{macrocode} -\def\tikztiming@addnode@getname#1(#2){% - \@ifnextchar\bgroup - {\tikztiming@addnode@{#1}{#2}}% - {\tikztiming@addnode@{#1}{#2}{}}% +\tikztiming@defcode{b}{% + \pgfmathparse{\tikztiming@back+\tikztiming@num/2}% + \global\let\tikztiming@back\pgfmathresult + \tikztiming@parser } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@addnode@}[3]{Options}{Node name}{Node text} +% \begin{macro}{\tikztiming@defcode{F}} % \begin{macrocode} -\def\tikztiming@addnode@#1#2#3{% - \tikztiming@output@flush - \begingroup - \def\@tempa{#2}% - \ifx\@tempa\empty - \def\@tempa{ node [timing/inline node,#1] }% - \else - \def\@tempa{ node [timing/inline node,#1] (#2) }% - \fi - \expandafter\tikztiming@addtostr\expandafter{\@tempa {#3} }% - \endgroup - \tikztiming@ +\tikztiming@defcode{F}{% + \pgfmathparse{\tikztiming@back-\tikztiming@num}% + \global\let\tikztiming@back\pgfmathresult + \tikztiming@parser } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@testforcode} +% \begin{macro}{\tikztiming@defcode{f}} % \begin{macrocode} -\def\tikztiming@testforcode{% - \@ifnextchar{!}% - {\tikztiming@testforcode@}% - {\@ifundefined{tikztiming@code@\meaning\@let@token}% - {\tikztiming@@}% - {\csname tikztiming@code@\meaning\@let@token\expandafter - \endcsname\@gobble}% - }% +\tikztiming@defcode{f}{% + \pgfmathparse{\tikztiming@back-\tikztiming@num/2}% + \global\let\tikztiming@back\pgfmathresult + \tikztiming@parser } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@testforcode@}[1]{Character to gobble} +% +% \begin{macro}{\tikztiming@defcode []}[1]{Options} +% Single brackets are in-picture options. +% Brackets and a "!" sign "[! !]" are parser options. +% Double brackets are both. +% +% Brackets and `\verb+| |+' signs `\verb+[| |]+' are only-once in-picture options. % \begin{macrocode} -\def\tikztiming@testforcode@#1{% - \@ifnextchar\bgroup - {\tikztiming@handlecode}% - {% - \PackageWarning{tikz-timing}{Missing braces after '!' character. Ignoring - this character}{}{}{}% - \tikztiming@ +\tikztiming@defcode[{%}]{ + \@ifnextchar[%] + {\tikztiming@bothoption}% + {\@ifnextchar{!}% + {\tikztiming@parseroption}% + {\@ifnextchar{|}% + {\tikztiming@onceoption}% + {\tikztiming@addoption}% + }% }% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@defcode{B}} +% \begin{macro}{\tikztiming@parseroption}[1]{Options} +% Sets the given options immediately, so that they are in affect for the rest of +% the parser run. % \begin{macrocode} -\tikztiming@defcode{B}{% - \pgfmathparse{\tikztiming@back+\tikztiming@num}% - \let\tikztiming@back\pgfmathresult - \tikztiming@ +\def\tikztiming@parseroption!#1!]{% + \pgfqkeys{/tikz/timing}{#1}% + \tikztiming@parser } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@defcode{b}} +% \begin{macro}{\tikztiming@addoption}[1]{Options} +% Adds the options to the internal list of timing options. % \begin{macrocode} -\tikztiming@defcode{b}{% - \pgfmathparse{\tikztiming@back+\tikztiming@num/2}% - \let\tikztiming@back\pgfmathresult - \tikztiming@ +\def\tikztiming@addoption#1]{% + \tikztiming@output@addcode{ [timing/option={#1}] }% + \tikztiming@parser } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@defcode{F}} +% \begin{macro}{\tikztiming@bothoption}[1]{Options} +% Does executes and adds the options to the output code buffer. This is +% necessary for slopes if they are used in width calculations. % \begin{macrocode} -\tikztiming@defcode{F}{% - \pgfmathparse{\tikztiming@back-\tikztiming@num}% - \let\tikztiming@back\pgfmathresult - \tikztiming@ +\def\tikztiming@bothoption[#1]]{% + \tikzset{#1}%[ + \tikztiming@addoption{#1}]% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@defcode{f}} +% \begin{macro}{\tikztiming@onceoption}[1]{Options} +% Simply adds the options to the output code buffer. % \begin{macrocode} -\tikztiming@defcode{f}{% - \pgfmathparse{\tikztiming@back-\tikztiming@num/2}% - \let\tikztiming@back\pgfmathresult - \tikztiming@ +\def\tikztiming@onceoption|#1|]{% + \tikztiming@output@addcode{ [#1] }% + \tikztiming@parser } % \end{macrocode} % \end{macro} % +% +% \subsubsection{Add-Node Macros} +% +% \begin{macro}{\tikztiming@addnode}[1]{Options} % \begin{macrocode} -% -%<*lib-overlays> +\def\tikztiming@addnode@getoptions[#1]{% + \@ifnextchar(%) + {\tikztiming@addnode@getname{#1}}% + {\tikztiming@addnode@getname{#1}()}% +} % \end{macrocode} -% \begin{macro}{\tikztiming@defcode{O}} +% \end{macro} +% +% \begin{macro}{\tikztiming@addnode@getname}[2]{Previous read options}{Node name} % \begin{macrocode} -\tikztiming@defcode{O}{% - \@ifnextchar\relax - {\tikztiming@\relax}% - {\tikztiming@overlay}% +\def\tikztiming@addnode@getname#1(#2){% + \@ifnextchar\bgroup + {\tikztiming@addnode@{#1}{#2}}% + {\tikztiming@addnode@{#1}{#2}{}}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@overlays} +% \begin{macro}{\tikztiming@addnode@}[3]{Options}{Node name}{Node text} +% The |fromchar| and |tochar| macros are to be expanded in the output routine, +% not inside this macro. They do not hold the correct values yet. % \begin{macrocode} -\def\tikztiming@overlay#1#2{% - \ifx\relax#1\relax - \tikztiming@output@flush - \def\next{\tikztiming@\relax}% +\def\tikztiming@addnode@#1#2#3{% + \def\@tempa{#2}% + \ifx\@tempa\empty + \def\@tempa{ node [timing/inline node,% + timing/inline node/from char={\tikztiming@fromchar},% + timing/inline node/to char={\tikztiming@tochar},% + \unexpanded{#1}] }% + \def\@tempb{}% \else - \ifx\relax#2\relax - \def\next{\tikztiming@#1\relax}% - \else - \tikztiming@output@flush - \let\tikztiming@overlay@lastchar\lastchar - \tikztiming@addtostr{ node [timing/save] (timing@overlay@start) {} }% - \tikztiming@#1\relax - \tikztiming@output@flush - \let\lastchar\tikztiming@overlay@lastchar - \tikztiming@addtostr{ (timing@overlay@start) }% - \def\next{\tikztiming@#2}% - \fi + \def\@tempa{ node [timing/inline node,% + timing/inline node/from char={\tikztiming@fromchar},% + timing/inline node/to char={\tikztiming@tochar},% + \unexpanded{#1}] (\unexpanded{#2}) }% + \xdef\tikztiming@namednodes{\tikztiming@namednodes,#2}% \fi - \next + \expandafter\tikztiming@output@eaddcode\expandafter{\@tempa \unexpanded{{#3}}}% + \tikztiming@parser } % \end{macrocode} % \end{macro} % +% \begin{macro}{\tikztiming@marknodes}[1]{Comma-separated list of node names} % \begin{macrocode} -% -%<*package> +\newcommand*\tikztiming@marknodes[2][]{% + \scope[timing/debug/scope,#1] + \edef\@tempa{floor((\noexpand\y1-\tikztiming@xunit) / \tikztiming@rowdist\tikztiming@xunit) * \tikztiming@rowdist\tikztiming@xunit}% + \foreach \N in #2 {% + \ifx\N\empty\else + \tikztiming@markcmd + \path let \p1=(\N) in + node [timing/debug/node] at ($ (\x1,\noexpand\@tempa) + (0,1) $) {\N}; + \fi + }% + \endscope +} % \end{macrocode} +% \end{macro} % -% \begin{macro}{\tikztiming@handlecode}[1]{Code to add to string} +% \begin{macro}{\tikztiming@markcmd} % \begin{macrocode} -\def\tikztiming@handlecode#1{% - \tikztiming@output@flush - \tikztiming@addtostr{ #1 }% - \tikztiming@ +\def\tikztiming@markcmd{ \draw (\N) circle (1pt); }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@mark@nodes}[1]{Comma-separated list of node names} +% \begin{macrocode} +\newcommand*\tikztiming@mark@nodes[2][]{% + \begingroup + \def\@tempa{#2}% + \ifx\@tempa\empty \let\@tempa\tikztiming@namednodes \fi + \ifx\@tempa\space \let\@tempa\tikztiming@namednodes \fi + \def\@tempb{\tikztiming@marknodes[#1]}% + \expandafter\@tempb\expandafter{\expandafter{\@tempa}}% + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Test for Code (`!' modifier)} +% +% \begin{macro}{\tikztiming@testforcode} +% \begin{macrocode} +\def\tikztiming@testforcode{% + \@ifnextchar{!}% + {\tikztiming@testforcode@}% + {\@ifundefined{tikztiming@code@\meaning\@let@token}% + {\tikztiming@parser@}% + {\expandafter\afterassignment + \csname tikztiming@code@\meaning\@let@token\endcsname + \let\@let@token=% + }% + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@testforcode@}[1]{Character to gobble} +% \begin{macrocode} +\def\tikztiming@testforcode@#1{% + \@ifnextchar\bgroup + {\tikztiming@handlecode}% + {% + \PackageWarning{tikz-timing}{Missing braces after '!' character. Ignoring + this character}{}{}{}% + \tikztiming@parser + }% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@defcode []}[1]{Options to add to string} +% \begin{macro}{\tikztiming@handlecode}[1]{Code to add to string} % \begin{macrocode} -\tikztiming@defcode[#1]{% - \tikztiming@addtostr{ [#1] }% - \tikztiming@ +\def\tikztiming@handlecode#1{% + \tikztiming@output@addcode{ #1 }% + \tikztiming@parser } % \end{macrocode} % \end{macro} % - +% +% \subsection{Parser Macros: Numbers} +% % \begin{macro}{\tikztiming@testfornum} % \begin{macrocode} \def\tikztiming@testfornum{% + \global\let\tikztiming@num\tikztiming@wscale \let\tikztiming@numchars\empty \tikztiming@numfrac0\relax \afterassignment @@ -2664,8 +4312,13 @@ % \end{macro} % % \begin{macro}{\tikztiming@testfornum@} +% The \cs{@let@token} set in \cs{tikztiming@parser} is used to handle "0" +% which can not be detected using the \cs{tikztiming@numint} value. % \begin{macrocode} \def\tikztiming@testfornum@{% + \ifx0\@let@token + \let\tikztiming@next\tikztiming@testfornum@@ + \else \ifnum0<\tikztiming@numint \let\tikztiming@next\tikztiming@testfornum@@ \else @@ -2675,18 +4328,17 @@ {% \tikztiming@numint1\relax \tikztiming@numfrac0\relax - \def\tikztiming@num{1.0}% + \global\let\tikztiming@num\tikztiming@wscale \if@tikztiming@metachar {\def\@tempa{\expandafter\expandafter\expandafter - \tikztiming@testfornum@@@@ - \expandafter\expandafter\expandafter{% - \csname tikztiming@metachar@\meaning\@let@token\endcsname}}% - \expandafter\@tempa\@gobble + \tikztiming@parser + \csname tikztiming@metachar@\meaning\@let@token\endcsname{1}}% + \expandafter\@tempa\@gobble }% {\tikztiming@testforcode}% }% }% - \fi + \fi\fi \tikztiming@next } % \end{macrocode} @@ -2705,7 +4357,8 @@ % \begin{macro}{\tikztiming@testfornum@@@} % \begin{macrocode} \def\tikztiming@testfornum@@@{% - \xdef\tikztiming@num{\the\tikztiming@numint.\expandafter\@gobble\the\tikztiming@numfrac}% + \edef\tikztiming@num{\the\tikztiming@numint.\expandafter\@gobble\the\tikztiming@numfrac}% + \tikztiming@setnum{\tikztiming@wscale * \tikztiming@num}% \@ifnextchar\bgroup {% \expandafter\tikztiming@numfrac\expandafter0\expandafter @@ -2715,16 +4368,16 @@ \PackageWarning{tikz-timing}% {Can not repeat group by a non-integer factor!^^J% Rounding '\tikztiming@num' to '\pgfmathresult'.}{}{}{}% - \let\tikztiming@num\pgfmathresult + \global\let\tikztiming@num\pgfmathresult \fi \tikztiming@testfornum@@@@ }% {% \if@tikztiming@metachar {\def\@tempa{\expandafter\expandafter\expandafter - \tikztiming@testfornum@@@@ - \expandafter\expandafter\expandafter{% - \csname tikztiming@metachar@\meaning\@let@token\endcsname}}% + \tikztiming@parser + \csname tikztiming@metachar@\meaning\@let@token\expandafter\endcsname + \expandafter{\tikztiming@num}}% \expandafter\@tempa\@gobble }% {\tikztiming@testforcode}% @@ -2733,38 +4386,63 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztimig@metachar}[2]{Macro character}{Substituted -% Characters} +% \begin{macro}{\tikztiming@testfornum@@@@}[1]{Characters and other tokens to +% repeat} % \begin{macrocode} -\def\tikztimingmetachar#1#2{% - \ifx\relax#2\relax - \expandafter\let\csname tikztiming@metachar@\meaning#1\endcsname\@undefined - \else - \@namedef{tikztiming@metachar@\meaning#1}{#2}% - \fi +\def\tikztiming@testfornum@@@@#1{% + \begingroup + \@temptokena{#1}% + \tikztiming@numloop% + \endgroup + \tikztiming@numint1\relax + \tikztiming@numfrac0\relax + \expandafter\tikztiming@parser\tikztiming@numchars } % \end{macrocode} % \end{macro} % -% \begin{macro}{\if@tikztimig@metachar}[2]{True clause}{False clause} +% \subsection{Meta-Characters} +% +% \begin{macro}{\tikztimingmetachar}[1]{Meta-character} +% Checks if there is an optional argument and calls \cs{tikztiming@metachar} +% appropriately. % \begin{macrocode} -\def\if@tikztiming@metachar#1#2{% - \@ifundefined{tikztiming@metachar@\meaning\@let@token}{#2}{#1}% +\def\tikztimingmetachar#1{% + \@ifnextchar{[}%] + {\tikztiming@metachar{#1}}% + {\tikztiming@metachar{#1}[]}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiming@testfornum@@@@}[1]{Characters and other tokens to -% repeat} +% \begin{macro}{\tikztiming@metachar}[3]{Macro character}{Number of +% Arguments}{Substituted Characters} % \begin{macrocode} -\def\tikztiming@testfornum@@@@#1{% - \begingroup - \@temptokena{#1}% - \tikztiming@numloop% - \endgroup - \tikztiming@numint1\relax - \tikztiming@numfrac0\relax - \expandafter\tikztiming@\tikztiming@numchars +\def\tikztiming@metachar#1[#2]#3{% + \ifx\relax#3\relax + \expandafter\let\csname tikztiming@metachar@\meaning#1\endcsname\@undefined + \else + \@namedef{tikztiming@metachar@\meaning#1}{}% + \ifx\relax#2\relax + \expandafter\renewcommand\expandafter*% + \csname tikztiming@metachar@\meaning#1\expandafter + \endcsname\expandafter[1]{##1{#3}}% + \else + \expandafter\renewcommand\expandafter*% + \csname tikztiming@metachar@\meaning#1\expandafter + \endcsname\expandafter[#2]{#3}% + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\if@tikztiming@metachar}[2]{True clause}{False clause} +% Only works in an argument of |\@ifnextchar|. This macro sets the needed +% |\@let@token| macro. +% \begin{macrocode} +\def\if@tikztiming@metachar#1#2{% + \@ifundefined{tikztiming@metachar@\meaning\@let@token}{#2}{#1}% } % \end{macrocode} % \end{macro} @@ -2775,58 +4453,47 @@ \newcounter{tikztimingrows} % \end{macrocode} % -% \begin{macro}{\tikztiming@extracode} -% \begin{macrocode} -\def\tikztiming@extracode{\@gobble{EXTRACODE}}% -% \end{macrocode} -% \end{macro} - % \begin{environment}{tikztimingtable}[1]{Optional settings} % \begin{macrocode} +\def\abc{\tracingassigns=1} \newenvironment{tikztimingtable}[1][]{% \begingroup \setcounter{tikztiming@nrows}{0}% \def\tikztiming@maxwidth{0.0}% \let\extracode\tikztiming@extracode + \let\endextracode\tikztiming@endextracode \let\tablegrid\tikztiming@tablegrid \let\fulltablegrid\tikztiming@fulltablegrid \let\horlines\tikztiming@horlines \let\vertlines\tikztiming@vertlines - \let\tablerules\tikztiming@tablerules + \let\marknodes\tikztiming@mark@nodes + \def\background{\pgfonlayer{background}\scope}% + \def\endbackground{\endscope\endpgfonlayer}% + \def\tablerules{\tikztiming@tablerules}% + \def\tableheader{\tikztiming@tableheader}% \def\rowdist{\tikztiming@rowdist}% \def\coldist{\tikztiming@coldist}% \def\nrows{\the\c@tikztiming@nrows}% \def\twidth{\tikztiming@maxwidth}% \tikzpicture[timing/table,#1]% \coordinate (last row) at (0,\rowdist); - \coordinate (label pos) at (-1*\coldist,0); + \coordinate (label pos) at (-1*{(\coldist)},0); \coordinate (timing/table/top left) at (0,1); \coordinate (timing/table/bottom right) at (0,0); - \collect@body\tikztiming@table + \tikztiming@picinit + \tikzset{timing/before table}% + \tikztimingtable@checkrow }{% -} -% \end{macrocode} -% \end{environment} - -% \begin{macro}{\tikztiming@table}[1]{Table content} -% \begin{macrocode} -\def\tikztiming@table#1{% - \tikztimingtable@row#1\endtikztimingtable@ + \tikzset{timing/after table}% \endtikzpicture \endgroup } % \end{macrocode} -% \end{macro} - -% \begin{macro}{\endtikztimingtable@} -% \begin{macrocode} -\def\endtikztimingtable@{\@gobble{ENDTIKSTIMING}} -% \end{macrocode} -% \end{macro} - -% \begin{macro}{\tikztimingextracode}[2]{Token to gobble}{Extra drawing code} +% \end{environment} +% +% \begin{macro}{\tikztiming@extracode} % \begin{macrocode} -\long\def\tikztimingextracode#1#2\endtikztimingtable@{% +\def\tikztiming@extracode{% \path let \p1 = (timing/table/top left), \p2 = (timing/table/bottom right) @@ -2835,7 +4502,75 @@ coordinate (timing/table/top right) at (\x2,\y1) coordinate (timing/table/size) at (\x2-\x1,\y1-\y2) ; - #2% + \@ifnextchar[{\tikztiming@oset}{} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@endextracode} +% Checks if it is inside \cs{end} and calls \cs{tikztimingtable@checkrow} appropriately. +% \begin{macrocode} +\def\tikztiming@endextracode{% + \@ifnextchar\@checkend + {\aftergroup\expandafter\aftergroup\tikztimingtable@checkrow}% + {\tikztimingtable@checkrow}% +}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztimingtable@checkrow} +% Checks the next token to be either \cs{end}, \cs{extracode} or +% \cs{begin}. In the case of the latter \cs{tikztimingtable@chkbegec} +% is called to test if it is \cs{begin}|{extracode}|. +% \begin{macrocode} +\def\tikztimingtable@checkrow{% + \@ifnextchar\end + {}% + {\ifx\@let@token\extracode + \let\tikztiming@next\empty + \else + \ifx\@let@token\begin + \def\tikztiming@next{\tikztimingtable@chkbegec}% + \else + \def\tikztiming@next{\tikztimingtable@row}% + \fi + \fi + \tikztiming@next + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztimingtable@chkbegec} +% Checks if value of \cs{begin} is |{extracode}|. If so +% it is executed, otherwise it is taken as normal row and so +% \cs{tikztimingtable@row} is called. +% \begin{macrocode} +\def\tikztimingtable@chkbegec\begin#1{ + \begingroup + \def\@tempa{#1}% + \def\@tempb{extracode}% + \ifx\@tempa\@tempb + \endgroup + \def\tikztiming@next{\begin{extracode}}% + \else + \endgroup + \def\tikztiming@next{\tikztimingtable@row\begin{#1}}% + \fi + \tikztiming@next +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@oset} +% [1]{TikZ Settings} +% Handle optional TikZ settings. The \cs{tikz@options} must be used +% to ensure that the settings apply for the following graphic paths. +% \begin{macrocode} +\def\tikztiming@oset[#1]{% + \let\tikz@options\pgfutil@empty + \tikzset{#1}% + \tikz@options } % \end{macrocode} % \end{macro} @@ -2851,7 +4586,7 @@ % % \begin{macro}{\tikztimingtable@row}[1]{Row content} % \begin{macrocode} -\def\tikztimingtable@row#1\\{% +\long\def\tikztimingtable@row#1\\{% \tikztimingtable@row@#1&\tikztiming@emptycell&\\ } % \end{macrocode} @@ -2860,7 +4595,7 @@ % \begin{macro}{\tikztimingtable@row@}[3]{Cell 1}{Cell 2 or empty}{Potential % further cells} % \begin{macrocode} -\def\tikztimingtable@row@#1\\{% +\long\def\tikztimingtable@row@#1\\{% \ifx\\#3\\\else \begingroup \def\@tempa{\tikztiming@emptycell&}% @@ -2873,22 +4608,22 @@ \endgroup \fi \ifx\tikztiming@emptycell#2% - \def\next{\tikztimingtable@row@@{#1}{}}% + \def\tikztiming@next{\tikztimingtable@row@@{#1}{}}% \else - \def\next{\tikztimingtable@row@@{#1}{#2}}% + \def\tikztiming@next{\tikztimingtable@row@@{#1}{#2}}% \fi - \next + \tikztiming@next }% % \end{macrocode} % \end{macro} % % \begin{macro}{\tikztimingtable@row@@}[2]{Name/Label}{Timing characters} % \begin{macrocode} -\def\tikztimingtable@row@@#1#2{% +\long\def\tikztimingtable@row@@#1#2{% \addtocounter{tikztiming@nrows}{1}% - \path ($ (last row) + (0,-1*\rowdist) $) coordinate (last row); - \path ($ (last row) + (-1*\coldist,0) $) node [anchor=base east,timing/name] - {\tikztiminglabel{#1}}; + \coordinate (last row) at ($ (last row) - (0,\tikztiming@rowdist) $); + \node [anchor=base east,timing/name] (last row text) + at ($ (last row) - (\tikztiming@coldist,0) $) {\ignorespaces #1\unskip}; \@ifnextchar{[}% {\tikztiming@tabletiming}% {\tikztiming@tabletiming[]}% @@ -2898,15 +4633,7 @@ % \pgfmathparse{max(\tikztiming@maxwidth,\tikztimingwidth)}% \let\tikztiming@maxwidth\pgfmathresult - \@ifnextchar\extracode - {% - \let\extracode\relax - \tikztimingextracode - }% - {% - \@ifnextchar\endtikztimingtable@ - {\@gobble}{\tikztimingtable@row}% - }% + \tikztimingtable@checkrow } % \end{macrocode} % \end{macro} @@ -2914,14 +4641,17 @@ % \begin{macro}{\tikztiming@tabletiming} % \begin{macrocode} \def\tikztiming@tabletiming[#1]#2\relax{% - \let\lastchar\empty - \let\settings\empty + \let\tikztiming@lastchar\empty + \let\tikztiming@settings\empty \ifx\relax#1\relax\else \tikztiming@testoptarg#1\relax\relax \fi - \edef\@tempa{\noexpand\timing[name=row\the\c@tikztiming@nrows,\settings] + \ifx\tikztiming@lastchar\empty + \def\tikztiming@lastchar{@}% + \fi + \edef\@tempa{\noexpand\timing[name=row\the\c@tikztiming@nrows,\tikztiming@settings] at (last row)}% - \expandafter\@tempa\expandafter{\expandafter[\lastchar]#2}; + \expandafter\@tempa\expandafter{\expandafter[\tikztiming@lastchar]#2}; } % \end{macrocode} % \end{macro} @@ -2942,13 +4672,32 @@ % % \begin{macro}{\tikztiming@tablegrid}[1]{Optional settings} % \begin{macrocode} -\newcommand*\tikztiming@tablegrid[1][]{% +\def\tikztiming@tablegrid{% + \@ifnextchar{*}% + {\tikztiming@tablegrid@{row\row.high end}}% + {\tikztiming@tablegrid@{timing/table/top right}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@tablegrid@@}[2]{Optional settings}{End point} +% \begin{macrocode} +\def\tikztiming@tablegrid@#1{% + \@ifnextchar{[}%] + {\tikztiming@tablegrid@@{#1}}% + {\tikztiming@tablegrid@@{#1}[]}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@tablegrid@@}[2]{Optional settings}{End point} +% \begin{macrocode} +\def\tikztiming@tablegrid@@#1[#2]{% \begin{pgfonlayer}{background} - \scope[xstep={\timingwidth/2.},ystep={\timingheight/2.},timing/table/grid,#1] - \foreach \y in {1,...,\nrows} {% - \draw {[shift={($ (timing/table/bottom left) + (0,\y*\rowdist) - - (0,\rowdist) $)}] let \p1 = (timing/table/bottom right) in (0,0) grid - (\x1,1)}; + \scope[xstep={\timingwidth/2.},ystep={\timingheight/2.},timing/table/grid,#2] + \foreach \row in {1,...,\nrows} {% + \draw {[shift={(row\row.low start)}] + let \p1 = (#1) in (0,0) grid (\x1,1)}; }% \endscope \end{pgfonlayer} @@ -2956,18 +4705,50 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\tikztiming@tableheader}[3]{Optional Settings}{Text +% title}{Diagram title} +% \begin{macrocode} +\newcommand*\tikztiming@tableheader[3][]{% + \path [timing/table/header,#1] + (-1*{(\tikztiming@coldist)},1.5*{(\tikztiming@rowdist)}) node + [anchor=base east] {\ignorespaces #2\unskip\strut} + (0,1.5*{(\tikztiming@rowdist)}) node + [anchor=base west] {\ignorespaces #3\unskip\strut} + ; + \tikztiming@tableheadtrue +} +\newif\iftikztiming@tablehead +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\tikztiming@tablerules}[1]{Optional Settings} % \begin{macrocode} \newcommand*\tikztiming@tablerules[1][]{% - \draw [timing/table/rules,#1] let - \p1 = (current bounding box.north west), - \p2 = (current bounding box.south east), + \begin{scope}[#1] + \coordinate (NW) at (current bounding box.north west); + \coordinate (SE) at (current bounding box.south east); + % + \draw [timing/table/rules] + let + \p1 = (NW), + \p2 = (SE), \p3 = (last row) + in + ($ (\x1-\tabcolsep,\y3) - (0,.5*{(\rowdist)}) $) -- + ($ (\x2+\tabcolsep,\y3) - (0,.5*{(\rowdist)}) $) + \iftikztiming@tablehead + (\x1-\tabcolsep,2.5*{(\rowdist)}) -- (\x2+\tabcolsep,2.5*{(\rowdist)}) + \fi + ; + \draw + \iftikztiming@tablehead [timing/table/midrules] \else [timing/table/rules] \fi + let + \p1 = (NW), + \p2 = (SE) in (\x1-\tabcolsep,\rowdist) -- (\x2+\tabcolsep,\rowdist) - ($ (\x1-\tabcolsep,\y3) - (0,\rowdist-1) $) -- - ($ (\x2+\tabcolsep,\y3) - (0,\rowdist-1) $) ; + \end{scope} } % \end{macrocode} % \end{macro} @@ -2980,11 +4761,12 @@ \ifx\list\empty \def\list{1,2,...,\nrows}% \fi - \foreach \row in \list% + \foreach \row in \list {% \draw [timing/table/lines,#1] let \p1 = (timing/table/bottom right) in - (0,\rowdist-\row*\rowdist) -- +(\x1,0); + ($ (0,\rowdist) - (0,\row * {(\rowdist)}) $) -- +(\x1,0); + }% \endgroup } % \end{macrocode} @@ -3010,7 +4792,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Shape} +% \subsection{Shapes} % \begin{macrocode} \pgfdeclareshape{tikztiming@shape}{% \savedanchor\northeast{\pgfpointxy{.5*\tikztimingwidth}{.5}}% @@ -3064,6 +4846,22 @@ \pgfpointborderrectangle{\pgfpoint{\@tempdima}{\@tempdimb}}{\northeastborder}% }% } +% \end{macrocode} +% +% By default use the old node centers for backwards compatibility. +% \begin{macrocode} +\gdef\tikztiming@oldnodecenter@{}% +\tikzset{timing/old@node@center/.code={\xdef\tikztiming@oldnodecenter@{% + ++($ (0,0) - #1 $) + [timing/no@old@node@center]}}% +}% +\tikzset{timing/no@old@node@center/.code={\gdef\tikztiming@oldnodecenter@{}}}% + +\def\tikztiming@oldnodecenter#1{% + [timing/old@node@center={#1}] + ++#1 +} + % \end{macrocode} % % \subsection{Other Macros} @@ -3086,21 +4884,17 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\timingwidth} -% \begin{macro}{\timingheight} -% \begin{macrocode} -\def\timingwidth{1}% -\def\timingheight{1}% -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\tikztiming@internaldefs}[1]{Character} -% \begin{macrocode} -\def\tikztiming@internaldefs#1{% - \def\draw{\noexpand\draw}% - \def\path{\noexpand\path}% - \def\fill{\noexpand\fill}% +% \begin{macro}{\tikztiming@internaldefs}[3]{Character}{Character}{Character} +% \begin{macrocode} +\def\tikztiming@internaldefs{% + \let\draw\relax + \let\path\relax + \let\p\relax + \let\x\relax + \let\y\relax + \let\n\relax + \let\tikztiming@oldnodecenter\relax + \let\tikztiming@oldnodecenter@\relax \def\width{####1*\noexpand\timingwidth}% \def\fwidth{\noexpand\timingwidth}% \def\height{\noexpand\timingheight}% @@ -3108,10 +4902,9 @@ \def\zslope{\noexpand\timingzslope}% \def\dslope{\noexpand\timingdslope}% \def\gslope{0}% - \lowercase{% - \def\style{timing/#1}% - \def\bgstyle{timing/#1/background}% - }% + \def\style{timing/####3}% + \def\bgstyle{draw=none,timing/####3/background}% + \def\nstyle{timing/####4}% \def\newdraw{\tikztiming@newdraw}% \def\newdrawns{\tikztiming@newdraw@nosave}% \def\code##1{ [/utils/exec={\unexpanded{##1}}] }% @@ -3148,26 +4941,27 @@ } % \end{macrocode} % \end{macro} +% % \begin{macrocode} \tikztimingsetslope{0.10}% \tikztimingsetdslope{0.20}% \tikztimingsetzslope{0.05}% % \end{macrocode} % +% \subsection{Timing Character Definition Macros} +% % \begin{macro}{\tikztiminguse}[1]{Character(s)} % \begin{macrocode} -\def\tikztiminguse#1{% - \@ifundefined{\tikztiming@prefix#1@general}% - {\PackageWarning{Can not use transition macro for '#1'.}{}{}{}}% - {\@nameuse{\tikztiming@prefix#1@general}}% +\def\tikztiminguse#1#2{% + \@nameuse{\tikztiming@prefix#1}{#2}{##2}{##3}{##4}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztimingdef}[1]{One or two characters} +% \begin{macro}{\tikztimingdef}[1]{One till three characters} % \begin{macrocode} \def\tikztimingdef#1{% - \tikztimingdef@#1\relax% + \tikztimingdef@#1\empty\empty\relax } % \end{macrocode} % \end{macro} @@ -3175,46 +4969,51 @@ % \begin{macro}{\tikztimingdef@}[3]{First character}{Second character or % empty}{Definition code} % \begin{macrocode} -\def\tikztimingdef@#1#2\relax#3{% - \ifx\relax#2\relax - \tikztiming@nameedef[#1]{#1}{#3}% +\def\tikztimingdef@#1#2#3\relax#4{% + \ifx\empty#2\empty + \tikztiming@nameedef{}{#1}{}{#4}% \else - \tikztiming@nameedef[#2]{#1#2}{#3}% + \tikztiming@nameedef{#1}{#2}{#3}{#4}% \fi } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiminglet}[2]{Original characters}{New characters} +% \begin{macro}{\tikztimingcpy}[2]{New Character(s)}{Source Character(s)} % \begin{macrocode} -\def\tikztiminglet#1#2{% - \tikztiminglet@#1\relax#2\relax +\def\tikztimingcpy#1#2{% + \begingroup + \edef\tikztimingcpy@a{#1}% + \edef\tikztimingcpy@b{#2}% + \ifx\tikztimingcpy@a\tikztimingcpy@b + \endgroup + %\message{^^J Copy macro '#2' to '#1' skipped.^^J}% + \else + \endgroup + \@ifundefined{\tikztiming@pfxtr#2\empty\empty\empty}% + {\ifnum\tikztiming@debug>0\relax + \message{^^J Copy macro '#2' to '#1' failed.^^J}\fi}% + {\ifnum\tikztiming@debug>0\relax + \message{^^J Copy macro '#2' to '#1'.^^J}\fi + \expandafter\let + \csname\tikztiming@pfxtr#1\empty\empty\empty\expandafter\endcsname + \csname\tikztiming@pfxtr#2\empty\empty\empty\endcsname + }% + \fi } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiminglet@}[4]{First original character}{Second original -% character}{First new character}{Second new character} +% +% \begin{macro}{\tikztiminglet}[2]{Original characters}{New characters} % \begin{macrocode} -\def\tikztiminglet@#1#2\relax#3#4\relax{% - \tikztiming@namelet{#1#2}{#3#4}% - \tikztiming@namelet{#1#2@general}{#3#4@general}% - \tikztiming@iflower{#1}{}% - {\tikztiming@iflower{#2}% - {% - \lowercase{\tikztiminglet@{#1}{#2}\relax{#3}{#4}}\relax - }% - {% - \uppercase{\lowercase{% - \uppercase{\lowercase{\tikztiminglet@{#1}}{#2}}\relax{#3}}{#4}}\relax - \lowercase{\uppercase{% - \lowercase{\uppercase{\tikztiminglet@{#1}}{#2}}\relax{#3}}{#4}}\relax - }% - }% +\def\tikztiminglet#1#2{% + \tikztiming@namelet{#1}{#2}% } % \end{macrocode} % \end{macro} % +% % \begin{macro}{\tikztiming@chars}[1]{Comma to gobble} % Initial definition of character list. Will gobble the separation comma in % front of the first character which is added to the list. @@ -3239,7 +5038,6 @@ % \end{macrocode} % \end{macro} % -% % \begin{macro}{\tikztiming@addchar}[1]{Character} % \begin{macrocode} \def\tikztiming@addchar#1{% @@ -3261,173 +5059,163 @@ % \end{macro} % % \begin{macrocode} -\expandafter\def\csname\tikztiming@prefix @start\endcsname#1{}% +\@namedef{\tikztiming@prefix @@}#1#2#3#4{ coordinate (timing/start)}% % \end{macrocode} % % \begin{macro}{\tikztimingchar@}[3]{Character}{Start position}{Character % drawing code} % \begin{macrocode} \def\tikztimingchar@#1#2#3{% - \tikztiming@nameedef[#1]{#1@start}{#2 coordinate (timing/start) }% - \tikztiming@nameedef[#1]{#1}{#2 coordinate (timing/start) #3}% - \tikztimingdef{#1#1}{#3}% + \tikztiming@nameedef{@}{#1}{}{#2 coordinate (timing/start) #3}% + \tikztimingdef{{#1}{#1}}{#3}% } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztimingalias}[2]{Original character}{New character} +% \begin{macro}{\tikztimingecopy}[2]{New character}{Original character} % \begin{macrocode} -\def\tikztimingalias#1#2{% - \uppercase{\tikztimingalias@{#1}{#2}}% +\def\tikztimingecopy#1#2{% + \@namedef{tikztiming@alias@#1}{#2}% + \tikztiming@addchar{#1}% + \expandafter\let + \csname tikztiming@triple@#1\expandafter\endcsname + \csname tikztiming@triple@#2\endcsname + \expandafter\let + \csname tikztiming@nocombine@#1\expandafter\endcsname + \csname tikztiming@nocombine@#2\endcsname } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztimingalias@}[2]{New character}{Original character} +% \subsection{NewDraw Macros} +% +% \begin{macro}{\tikztiming@newdraw} % \begin{macrocode} -\def\tikztimingalias@#1#2{% - \tikztiming@namelet{#1}{#2}% - \tikztiming@namelet{#1@start}{#2@start}% - \lowercase{% - \tikztiming@namelet{#1}{#2}% - \tikztiming@namelet{#1@start}{#2@start}% - }% - \tikztiminglet{#1#1}{#2#2}% - \@for\@tempa:=\tikztiming@chars\do{% - \expandafter\tikztiminglet@@ - \expandafter{\@tempa}{#1}{#2}% - }% +\def\tikztiming@newdraw{% + node [timing/save] (timing@save) {};% + \draw [timing/restore] (timing@save) ++(0,0) } % \end{macrocode} % \end{macro} -% -% \begin{macro}{\tikztimingecopy}[2]{New character}{Original character} + +% \begin{macro}{\tikztiming@newdraw@nosave} % \begin{macrocode} -\def\tikztimingecopy#1#2{% - \uppercase{\tikztimingecopy@{#1}{#2}}% +\def\tikztiming@newdraw@nosave{% + node [timing/coord] (timing@save) {};% + \draw [timing/nooptions] (timing@save) ++(0,0) } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztimingecopy@}[2]{New character}{Original character} +% \begin{macro}{\tikztiming@baseline} % \begin{macrocode} -\def\tikztimingecopy@#1#2{% - \tikztimingchar{#1}{}{}% - \tikztimingdef{#1}{\tikztiminguse{#2}{##1}}% - \tikztiming@nameedef[#1]{#1@start}{\tikztiminguse{#2@start}{##1}}% - \lowercase{% - \@ifundefined{\tikztiming@prefix#2}{}{% - \tikztimingdef{#1}{\tikztiminguse{#2}{##1}}% - \tikztiming@nameedef[#1]{#1@start}{\tikztiminguse{#2@start}{##1}}% - }% - }% - \tikztimingdef{#1#1}{\tikztiminguse{#2#2}{##1}}% - \@for\@tempa:=\tikztiming@chars\do{% - \expandafter\tikztimingdef@@ - \expandafter{\@tempa}{#1}{#2}% -% \end{macrocode} -% Handle lowercase macros: -% \begin{macrocode} - \expandafter\lowercase\expandafter{\expandafter\def\expandafter\@tempb - \expandafter{\@tempa}}% - \@ifundefined{\tikztiming@prefix#2\@tempb}{}{% - \expandafter\tikztimingdef@@ - \expandafter{\@tempb}{#1}{#2}% - }% - }% +\def\tikztiming@baseline{% + node [timing/save] (timing@save) {};% + \draw [timing/restore] let \p1 = (timing@save) in (\x1,0) ++(0,0) } % \end{macrocode} % \end{macro} % -% \begin{macro}{\tikztiminglet@@}[3]{Character from list}{New -% character}{Original character} +% \subsection{Definition of Timing Characters} +% +% Pre-define list of timing characters to have it in a sorted fashion. % \begin{macrocode} -\def\tikztiminglet@@#1#2#3{% - \tikztiminglet@@@#1#2#3% - % Should stay, cause no harm: - \lowercase{\tikztiminglet@@@#1}#2#3% - \lowercase{\tikztiminglet@@@#1#2#3}% - \lowercase{\uppercase{\tikztiminglet@@@#1}#2#3}% -} +\def\tikztiming@chars{H,L,Z,X,M,D,U,T,C}% % \end{macrocode} -% \end{macro} % -% \begin{macro}{\tikztiminglet@@@}[3]{Character from list}{New -% character}{Original character} +% \subsubsection{Character `S'} +% This character is now implemented as modifier to avoid hassle with triple +% character transitions. % \begin{macrocode} -\def\tikztiminglet@@@#1#2#3{% - \tikztiminglet{#1#2}{#1#3}% - \tikztiminglet{#2#1}{#3#1}% +\tikztiming@defcode{S}{% + \pgfmathparse{\tikztimingwidth + \tikztiming@num}% + \global\let\tikztimingwidth\pgfmathresult + \tikztiming@output@Eaddcode{% + coordinate (timing@ref) at ($ (timing@ref) + (\tikztiming@num,0) $) + coordinate (timing@refa) at ($ (timing@refa) + (\tikztiming@num,0) $) + coordinate (timing@refb) at ($ (timing@refb) + (\tikztiming@num,0) $) + ++(\tikztiming@num,0) + }% + \tikztiming@parser } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\tikztimingdef@@}[3]{Character from list}{New -% character}{Original character} -% \begin{macrocode} -\def\tikztimingdef@@#1#2#3{% - \tikztimingdef{#1#2}{\tikztiminguse{#1#3}{##1}}% - \tikztimingdef{#2#1}{\tikztiminguse{#3#1}{##1}}% +\tikztiming@defcode{s}{% + \pgfmathparse{\tikztimingwidth + \tikztiming@num/2}% + \global\let\tikztimingwidth\pgfmathresult + \tikztiming@output@Eaddcode{% + coordinate (timing@ref) at ($ (timing@ref) + (\tikztiming@num/2,0) $) + coordinate (timing@refa) at ($ (timing@refa) + (\tikztiming@num/2,0) $) + coordinate (timing@refb) at ($ (timing@refb) + (\tikztiming@num/2,0) $) + ++(\tikztiming@num/2,0) + }% + \tikztiming@parser } % \end{macrocode} -% \end{macro} % -% \begin{macro}{\tikztiming@savesettings} +% \subsubsection{Character `G'} % \begin{macrocode} -\def\tikztiming@savesettings{% - \xdef\tikztiming@saved@settings{% - {\tikztiming@slope}% - {\tikztiming@dslope}% - {\tikztiming@zslope}% - {\the\pgflinewidth}% +\tikztiming@defcode{G}{% + \tikztiming@output@addcode{% + \tikztiming@glitch }% + \tikztiming@parser } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\tikztiming@restoresettings} -% \begin{macrocode} -\def\tikztiming@restoresettings{% - \expandafter\tikztiming@restoresettings@ - \tikztiming@saved@settings\relax + +\tikztiming@defcode{g}{% + \tikztiming@output@addcode{% + \tikztiming@glitch + }% + \tikztiming@parser +} + +\def\tikztiming@glitch{% + {[timing/g] let \p1 = +(0,0) in (\x1,0) -- (\x1,\timingheight) + coordinate (timing@dstart) at (\x1,\timingheight/2) (\x1,\y1) + }% } % \end{macrocode} -% \end{macro} % -% \begin{macro}{\tikztiming@restoresettings@}[4]{Slope}{D-Slope}{Z-Slope}{Line -% width} +% \subsubsection{Character `H'} % \begin{macrocode} -\def\tikztiming@restoresettings@#1#2#3#4\relax{% - \tikztimingsetslope{#1}% - \tikztimingsetdslope{#2}% - \tikztimingsetzslope{#3}% - \pgfsetlinewidth{#4}% +\tikztimingchar{H}{++(0,\height)}{-- ++(#1,0)} + +\tikztimingdef{HH}{ + -- ++(#1,0) +} + +\tikztimingdef{LH}{ + -- +(\slope, \height) + -- ++(#1, \height) +} + +\tikztimingdef{ZH}{ + \newdraw + -- ++(\zslope,+\height/2.) + -- ++($ (#1,0) - (\zslope,0) $) +} + +\tikztimingdef{DH}{ + \tikztiming@oldnodecenter@% + \newdraw [\style] + -- +(\dslope/2.,\height/2.) + -- ($ (timing@ref) + (#1,\height/2) $) } + % \end{macrocode} -% \end{macro} % -% \begin{macro}{\tikztiming@newdraw} +% \subsubsection{Character `L'} % \begin{macrocode} -\def\tikztiming@newdraw{% - node [timing/save] (timing@save) {};% - \draw [timing/restore] (timing@save) ++(0,0) +\tikztimingdef{DL}{ + \tikztiming@oldnodecenter@ + \newdraw [\style] + -- +(\dslope/2.,-\height/2.) + -- ($ (timing@ref) + (#1,-\height/2) $) } -% \end{macrocode} -% \end{macro} -% \begin{macro}{\tikztiming@newdraw} -% \begin{macrocode} -\def\tikztiming@newdraw@nosave{% - node [timing/coord] (timing@save) {};% - \draw (timing@save) ++(0,0) -} % \end{macrocode} -% \end{macro} - -% \subsection{Definition of Timing Characters} +% +% \subsubsection{Character `'} % \begin{macrocode} -\tikztimingchar{H}{++(0,\height)}{-- ++(#1,0)} \tikztimingchar{L}{++(0,0)}{-- ++(#1,0)} @@ -3436,31 +5224,7 @@ -- ++(#1,0) } -\tikztimingchar{X}{}{}% -\tikztimingchar{D}{}{}% -\tikztimingchar{U}{}{}% -%\tikztimingchar{O}{}{}% -\tikztimingchar{M}{}{}% - -\tikztimingchar{G}{++(0,0)}{-- ++(\gslope,\height) -- ++(\gslope,-\height)} -\tikztimingchar{S}{++(0,0)}{++(#1,0)} - -\tikztimingdef{DD}{ - node [timing/save] (timing@save) {}; \path [\bgstyle] (timing@save) ++(0,0) - +(0.5*\dslope,0.5*\height) -- +(\dslope,0) - -- +(#1,0) - -- +($ (#1,0) + 0.5*(\dslope,\height) $) - -- +(#1,\height) - -- +(\dslope,\height) -- cycle; - \draw [timing/restore,\style] (timing@save) ++(0,0) - node [timing/save] (timing@dstart) at +(\dslope/2.,\height/2.) {} - -- +(\dslope,+\height) -- +(#1,+\height) ++(0,+\height) - -- +(\dslope,-\height) -- ++(#1,-\height) -} -\tikztiming@namelet{D@edge@D}{DD} -\tikztiming@namelet{D@edge@D@general}{DD@general} - -\tikztimingchar{D}{++(0,0)}{ +\tikztimingchar{D}{++(0,\height/2.)}{ node [timing/save] (timing@save) {}; \path [\bgstyle] (timing@save) ++(0,0) -- +(#1,0) -- +($ (#1,0) + 0.5*(\dslope,\height) $) @@ -3473,21 +5237,10 @@ -- ++(#1,0) ++(0,-\height) } -\tikztimingdef{DD}{ - node [timing/save] (timing@save) {}; \path [\bgstyle] (timing@save) ++(0,0) - -- +(#1,0) - -- +($ (#1,0) + 0.5*(\dslope,\height) $) - -- +(#1,\height) - -- +(0,\height) - -- cycle; - \newdraw [\style] - -- +(#1,0) ++(0,+\height) - -- ++(#1,0) ++(0,-\height) -} - -\tikztiming@namelet{D@edge@@start}{D@start} -\tikztiming@namelet{d@edge@@start}{d@start} - +\def\tikztiming@triple@D{}% +\def\tikztiming@triple@D@edge@{}% +\def\tikztiming@nocombine@D@edge@{}% +\def\tikztiming@alias@D@edge@{D}% % \end{macrocode} % % \begin{macro}{\tikztiming@trans@D@fill}[2]{Original width}{Width to subtract} @@ -3507,147 +5260,488 @@ % \end{macro} % % \begin{macrocode} -\tikztimingdef{HH}{-- ++(#1,0)} -\tikztimingdef{LL}{-- ++(#1,0)} -\tikztimingdef{HL}{-- ++(\slope,-\height) \tikztiminguse{HH}{#1-\slope}} -\tikztimingdef{LH}{-- ++(\slope, \height) \tikztiminguse{LL}{#1-\slope}} +\tikztimingdef{LL}{ + -- ++(#1,0) +} -\tikztimingdef{HG}{-- ++(\gslope,-\height) -- ++(\gslope,+\height)} -\tikztimingdef{LG}{-- ++(\gslope,+\height) -- ++(\gslope,-\height)} -\tikztimingdef{ZG}{ - -- ++(\gslope,-\height/2.0) - -- ++(\gslope,+\height) - -- ++(\gslope,-\height/2.0) +\tikztimingdef{HL}{ + -- ++(\slope,-\height) + \tikztiminguse{HH}{#1-\slope} } -\tikztiminglet{DG}{LG} -\tikztiminglet{HS}{S} -\tikztiminglet{LS}{S} -\tikztiminglet{ZS}{S} -\tikztiminglet{DS}{S} -\tikztiminglet{TS}{S} \tikztimingdef{LZ}{ \newdraw [\style] - -- ++(\zslope,+\height/2.) -- ++($ (#1,0) - (\zslope,0) $) + -- ++(\zslope,+\height/2.) + -- ++($ (#1,0) - (\zslope,0) $) } \tikztimingdef{HZ}{% \newdraw [\style] - -- ++(\zslope,-\height/2.) -- ++($ (#1,0) - (\zslope,0) $) -} -\tikztimingdef{ZH}{ - \newdraw - -- ++(\zslope,+\height/2.) -- ++($ (#1,0) - (\zslope,0) $) + -- ++(\zslope,-\height/2.) + -- ++($ (#1,0) - (\zslope,0) $) } \tikztimingdef{ZL}{% \newdraw - -- ++(\zslope,-\height/2.) -- ++($ (#1,0) - (\zslope,0) $) + -- ++(\zslope,-\height/2.) + -- ++($ (#1,0) - (\zslope,0) $) } \tikztimingdef{DZ}{ - -- ++( \dslope/2.,+\height/2.) - ++(-\dslope/2.,+\height/2.) - -- ++( \dslope/2.,-\height/2.) + \tikztiming@oldnodecenter@ \newdraw [\style] - -- ++($ (#1,0) - (\dslope/2.,0) $) + -- ($ (timing@ref) + (#1,0) $) } -\tikztimingdef{ZD}{ - \tikztiming@trans@D@fill{#1}{0}% - -- ++(\dslope/2.,\height/2.) -- ++($ (#1,0) - (\dslope/2.,0) $) - ++($ -1*(#1,0) + (0,-\height/2.) $) - -- ++(\dslope/2.,-\height/2.) -- ++($ (#1,0) - (\dslope/2.,0) $) +\def\tikztiming@chard#1{% + \newdraw [\style,preaction={\bgstyle}] + coordinate (timing@dstart) + -- +(\dslope/2,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(\dslope/2,-\height/2) + -- +(0,-\height) + -- ($ (timing@dstart) + (\dslope/2,-\height/2) $) + -- (timing@dstart) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + ++(\dslope/2,0) + coordinate (timing@dend) + \tikztiming@oldnodecenter{% + (-\dslope/2,-\height/2) + }% + \newdraw } -\tikztimingdef{LD}{ - -- ++(0.5*\dslope,0.5*\height) - \tikztiming@trans@D@fill{#1}{0.5*\dslope}% - -- ++(0.5*\dslope,0.5*\height) - -- ++($ (#1,0) - (\dslope,0) $) - ++($ -1*(#1,0) + (0,-\height) $) ++(\dslope/2.,+\height/2.) - -- ++(\dslope/2.,-\height/2.) -- ++($ (#1,0) - (\dslope,0) $) +\def\tikztiming@chard@#1{% + \newdraw [\bgstyle] + -- +(\dslope/2,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(0,-\height)% + -- ($ (timing@save) + (\dslope/2,-\height/2) $) + -- (timing@save) + \newdraw [\style] + coordinate (timing@dstart) + -- +(\dslope/2,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + +(0,-\height)% + -- ($ (timing@save) + (\dslope/2,-\height/2) $) + -- (timing@save) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + coordinate [shift={(\dslope/2,0)}] (timing@dend) + \tikztiming@oldnodecenter{% + (0,-\height/2) + }% + \newdraw } -\tikztimingdef{DL}{ - -- ++( \dslope/2.,+\height/2.) - ++(-\dslope/2.,+\height/2.) - -- ++(\dslope/2.,-\height/2.) +\def\tikztiming@@chard#1{% + ++(0,\height/2) + \newdraw [\bgstyle] + -- +(0,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(\dslope/2,-\height/2) + -- +(0,-\height) + -- ($ (timing@save) + (0,-\height/2) $) + -- (timing@save) \newdraw [\style] - -- ++(\dslope/2.,-\height/2.) - -- ++($ (#1,0) - (\dslope,0) $) + +(0,0) + coordinate (timing/start) + +(-\dslope/2,0) + coordinate (timing@dstart) + +(0,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(\dslope/2,-\height/2) + -- +(0,-\height) + -- ($ (timing@save) + (0,-\height/2) $) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + ++(\dslope/2,0) + coordinate (timing@dend) + \tikztiming@oldnodecenter{% + (-\dslope/2,-\height/2) + }% + \newdraw } -\tikztimingdef{HD}{ - -- ++(0.5*\dslope,-0.5*\height) - \tikztiming@trans@D@fill{#1}{0.5*\dslope}% - -- ++(0.5*\dslope,-0.5*\height) - -- ++($ (#1,0) - (\dslope,0) $) - ++($ -1*(#1,0) + (0,+\height) $) ++(\dslope/2.,-\height/2.) - -- ++(\dslope/2.,+\height/2.) -- ++($ (#1,0) - (\dslope,0) $) - ++(0,-\height) +\def\tikztiming@@chard@#1{% + ++(0,\height/2) + \newdraw [\bgstyle] + -- +(0,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(0,-\height) + -- ($ (timing@save) + (0,-\height/2) $) + -- (timing@save) + \newdraw [\style] + +(0,0) + coordinate (timing/start) + coordinate (timing@ref) + coordinate [shift={(-\dslope/2,0)}] (timing@dstart) + +(0,\height/2) + -- +(#1,\height/2) + +(#1,-\height/2) + -- ($ (timing@save) + (0,-\height/2) $) + ++(#1,\height/2) + coordinate (timing@ref) + coordinate [shift={(\dslope/2,0)}] (timing@dend) + \tikztiming@oldnodecenter{% + (0,-\height/2) + }% + \newdraw } -\tikztimingdef{DH}{ - ++(0,+\height) - -- ++(+\dslope/2.,-\height/2.) - ++(-\dslope/2.,-\height/2.) - -- ++(\dslope/2.,+\height/2.) +\def\tikztiming@dchardu#1{% + \tikztiming@oldnodecenter@ + \newdraw [\bgstyle] + -- +(0,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(\dslope/2,-\height/2) + -- +(0,-\height) + -- ($ (timing@save) + (0,-\height/2) $) + -- (timing@save) + \newdraw [\style] + +(0,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(\dslope/2,-\height/2) + -- +(0,-\height) + -- ($ (timing@save) + (0,-\height/2) $) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + ++(\dslope/2,0) + coordinate (timing@dend) + \tikztiming@oldnodecenter{% + (-\dslope/2,-\height/2) + }% + \newdraw +} + +\def\tikztiming@uchardd#1{% + \tikztiming@oldnodecenter@ + \newdraw [\bgstyle] + -- +(\dslope/2,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(0,-\height) + -- ($ (timing@save) + (\dslope/2,-\height/2) $) + -- (timing@save) \newdraw [\style] - -- ++(\dslope/2.,+\height/2.) - -- ++($ (#1,0) - (\dslope,0) $) + coordinate (timing@dstart) + -- +(\dslope/2,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + +(0,-\height) + -- ($ (timing@save) + (\dslope/2,-\height/2) $) + -- (timing@save) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + coordinate [shift={(\dslope/2,0)}](timing@dend) + \tikztiming@oldnodecenter{% + ($ (0,0) - (0,\height/2) $) + }% + \newdraw } +\tikztimingdef{DD}{% + \tikztiming@dchardu{#1}% +} -\tikztimingalias{M}{Z} -\tikztimingchar{M}{++(0,\height/2.)}{ - \newdraw [\style/decoration,\style] - -- ++(#1,0) +\tikztimingdef{UU}{% + \tikztiming@dchardu{#1}% +} + +\def\tikztiming@dchard@#1{% + \tikztiming@oldnodecenter@ + \newdraw [\bgstyle] + -- +(0,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(0,-\height) + -- ($ (timing@save) + (0,-\height/2) $) + -- (timing@save) + \newdraw [\style] + +(0,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + +(0,-\height) + -- ($ (timing@save) + (0,-\height/2) $) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + coordinate [shift={(\dslope/2,0)}] (timing@dend) + \tikztiming@oldnodecenter{% + (0,-\height/2) + }% + \newdraw +} + +\tikztimingdef{DD@}{ + \tikztiming@dchard@{#1}% +} + +\tikztimingcpy{DDD}{DD@} +\tikztimingcpy{UUU}{DDD} + +\tikztimingdef{{D@edge@}{D@edge@}}{% + \tikztiming@oldnodecenter@ + \tikztiming@chard{#1}% +}% + +\tikztimingdef{@{D@edge@}}{% + \tikztiming@@chard@{#1}% +}% + +\tikztimingdef{@{D@edge@}@}{% + \tikztiming@@chard@{#1}% +}% + +\tikztimingdef{@{D@edge@}D}{% + \tikztiming@@chard{#1}% +} + +\tikztimingdef{D{D@edge@}}{% + \tikztiming@dchardu{#1}% +} + +\tikztimingdef{U{U@edge@}}{% + \tikztiming@dchardu{#1}% +} + +\tikztimingdef{U{D@edge@}}{% + \tikztiming@oldnodecenter@ + \tikztiming@chard{#1}% +} + +\tikztimingdef{U{D@edge@}@}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard@{#1}% +} + +\tikztimingdef{D{U@edge@}}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard{#1}% +} + +\tikztimingdef{D{U@edge@}@}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard@{#1}% +} + +\tikztimingdef{D{D@edge@}@}{% + \tikztiming@dchard@{#1}% +}% + +\tikztimingdef{U{U@edge@}@}{% + \tikztiming@dchard@{#1}% +}% + +\tikztimingdef{{D@edge@}{D@edge@}@}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard@{#1}% +}% + +\tikztimingdef{@{D@edge@}}{% + \tikztiming@@chard{#1}% +}% + +\tikztimingdef{{D@edge@}D}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard{#1}% +}% + +\tikztimingdef{{D@edge@}D@}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard@{#1}% +}% + +\tikztimingdef{ZDZ}{ + coordinate (timing@ref) + \tikztiming@chard{#1} +} +\tikztimingcpy{ZDX}{ZDZ} +\tikztimingcpy{XDX}{ZDZ} +\tikztimingcpy{XDZ}{ZDZ} + +\tikztimingdef{ZDD}{ + coordinate (timing@ref) + \tikztiming@chard@{#1} +} + +\tikztimingdef{ZDU}{ + coordinate (timing@ref) + \tikztiming@chard{#1} +} + +\tikztimingcpy{ZUD}{ZDU} +\tikztimingcpy{ZUU}{ZDD} + +\tikztimingdef{ZD}{ + coordinate (timing@ref) + \tikztiming@chard{#1} +} + +\tikztimingdef{@DD}{% + \tikztiming@@chard@{#1}% +} + +\tikztimingdef{ZD@}{% + coordinate (timing@ref) + \tikztiming@chard@{#1}% +} + +\tikztimingdef{HD@}{% + coordinate [shift={(0,-\height/2)}] (timing@ref) + -- ++(\dslope/2, -\height/2) + \tikztiming@chard@{#1}% +} + +\tikztimingdef{TD@}{% + coordinate [shift={(0,-\height/2 * \value{tikztimingtrans})}] (timing@ref) + -- ++(\dslope/2, -\height/2 * \value{tikztimingtrans}) + \tikztiming@chard@{#1}% +} + +\tikztimingdef{TD}{% + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + coordinate [shift={(0,\height/2 * \value{tikztimingtrans})}] (timing@ref) + -- ++(\dslope/2, \height/2 * \value{tikztimingtrans}) + \tikztiming@chard{#1}% +} + +\tikztimingdef{TDD}{% + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + coordinate [shift={(0,\height/2 * \value{tikztimingtrans})}] (timing@ref) + -- ++(\dslope/2, \height/2 * \value{tikztimingtrans}) + \tikztiming@chard@{#1}% +} + +\tikztimingdef{TUD}{% + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + coordinate [shift={(0,\height/2 * \value{tikztimingtrans})}] (timing@ref) + -- ++(\dslope/2, \height/2 * \value{tikztimingtrans}) + \tikztiming@chard{#1}% +} + +\tikztimingcpy{TDU}{TUD} +\tikztimingcpy{TUU}{TDD} + +\tikztimingdef{LD@}{% + coordinate [shift={(0,\height/2)}] (timing@ref) + -- ++(\dslope/2, \height/2) + \tikztiming@chard@{#1}% +} + +\tikztimingdef{@D}{% + \tikztiming@@chard@{#1}% } -\tikztimingdef{MG}{ - \newdraw [timing/m] - -- ++(\gslope,-\height/2.0) - -- ++(\gslope,+\height) - -- ++(\gslope,-\height/2.0) + +\tikztimingdef{@D@}{% + \tikztiming@@chard@{#1}% +} + +\tikztimingcpy{H{D@edge@}@}{HD@} +\tikztimingcpy{L{D@edge@}@}{LD@} +\tikztimingcpy{Z{D@edge@}@}{ZD@} +\tikztimingcpy{T{D@edge@}@}{TD@} + +\tikztimingdef{@DZ}{% + \tikztiming@@chard{#1}% +} +\tikztimingdef{@DH}{% + \tikztiming@@chard{#1}% +} +\tikztimingdef{@DL}{% + \tikztiming@@chard{#1}% +} +\tikztimingdef{@DT}{% + \tikztiming@@chard{#1}% +} + +\tikztimingdef{LD}{ + coordinate [shift={(0,\height/2)}] (timing@ref) + -- ++(\dslope/2, \height/2) + \tikztiming@chard{#1}% +} + +\tikztimingdef{LDD}{ + coordinate [shift={(0,\height/2)}] (timing@ref) + -- ++(\dslope/2, \height/2) + \tikztiming@chard@{#1} +} + +\tikztimingdef{LDU}{ + coordinate [shift={(0,\height/2)}] (timing@ref) + -- ++(\dslope/2, \height/2) + \tikztiming@chard{#1} +} + +\tikztimingcpy{LUD}{LDU} +\tikztimingcpy{LUU}{LDD} + +\tikztimingdef{HD}{ + coordinate [shift={(0,-\height/2)}] (timing@ref) + -- ++(\dslope/2, -\height/2) + \tikztiming@chard{#1} +} + +\tikztimingdef{HDD}{ + coordinate [shift={(0,-\height/2)}] (timing@ref) + -- ++(\dslope/2, -\height/2) + \tikztiming@chard@{#1} } -\tikztimingdef{MZ}{ +\tikztimingdef{HDU}{ + coordinate [shift={(0,-\height/2)}] (timing@ref) + -- ++(\dslope/2, -\height/2) + \tikztiming@chard{#1} +} +\tikztimingcpy{HUD}{HDU} +\tikztimingcpy{HUU}{HDD} + +% \end{macrocode} +% +% \subsubsection{Character `M'} +% \begin{macrocode} +\tikztimingecopy{M}{Z} +\tikztimingchar{M}{++(0,\height/2.)}{ \newdraw [\style] - \tikztiminguse{ZZ}{#1} + -- ++(#1,0) + \newdraw [\style/base] } \tikztimingdef{ZM}{ \newdraw [\style] - \tikztiminguse{MM}{#1} + -- ++(#1,0) + \newdraw [\style/base] } \tikztimingdef{LM}{ - \newdraw [\style] + \newdraw [\style/base] -- ++($ (1/8,0) + (0,\height/2) $) - \newdraw [\style/decoration,\style] + \newdraw [\style] -- ++($ (-1/8,0) + (#1,0) $) + \newdraw [\style/base] } \tikztimingdef{HM}{ - \newdraw [\style] + \newdraw [\style/base] -- ++($ (1/8,0) + (0,-1*\height/2) $) - \newdraw [\style/decoration,\style] + \newdraw [\style] -- ++($ (-1/8,0) + (#1,0) $) + \newdraw [\style/base] } \tikztimingdef{DM}{ - -- +($ (1/8,0) + (0,\height*.50) $) - +(0,\height) - -- ++($ (1/8,0) + (0,\height*.50) $) - \newdraw [\style/decoration,\style] - -- ++($ (-1/8,0) + (#1,0) $) + \tikztiming@oldnodecenter@% + \newdraw [\style] + -- ($ (timing@ref) + (#1,0) $) + \newdraw [\style/base] } +% \end{macrocode} +% +% \subsubsection{Character `T'} +% \begin{macrocode} \newcounter{tikztimingtrans} \newcounter{tikztimingtranspos} \tikztimingchar{T}{++(0,0)}{ -- ++(#1,0) } +\def\tikztiming@nocombine@T{}% \tikztimingdef{HT}{% {[\style] @@ -3678,76 +5772,203 @@ \tikztimingdef{TZ}{% \newdraw [\style] \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} - -- ++(\slope,\value{tikztimingtrans}*\height/2.) - -- ++($ (#1,0) - (\slope,0) $) -} - -\tikztimingdef{TG}{% - -- +(\gslope,-1*\value{tikztimingtrans}*\height) - -- +(\gslope,0) + -- ++(\zslope,\value{tikztimingtrans}*\height/2.) + -- ++($ (#1,0) - (\zslope,0) $) } \tikztimingdef{ZT}{% - \newdraw - {[\style] + \newdraw {[\style] \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} - -- ++(\slope,\value{tikztimingtrans}*\height/2.) - -- ++($ (#1,0) - (\slope,0) $) + -- ++(\zslope,\value{tikztimingtrans}*\height/2.) + -- ++($ (#1,0) - (\zslope,0) $) } } \tikztimingdef{TT}{% {[\style] \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} - -- ++(\slope,\value{tikztimingtrans}*\height) -- ++($ (#1,0) - (\slope,0) $) + -- ++(\slope,\value{tikztimingtrans}*\height) + -- ++($ (#1,0) - (\slope,0) $) } } -\tikztimingdef{TD}{ - \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} - \code{\setcounter{tikztimingtranspos}{\value{tikztimingtrans}}% - \addtocounter{tikztimingtranspos}{-1}} - -- ++(0.5*\dslope,+0.5*\value{tikztimingtrans} * \height) - \tikztiming@trans@D@fill{#1}{0.5*\dslope}% - -- ++(0.5*\dslope,+0.5*\value{tikztimingtrans} * \height) - -- ++($ (#1,0) - (\dslope,0) $) - ++($ -1*(#1,\value{tikztimingtrans}*\height) $) - ++(\dslope/2.,+1*\value{tikztimingtrans}*\height/2.) - -- ++(\dslope/2.,-1*\value{tikztimingtrans}*\height/2.) - -- ++($ (#1,0) - (\dslope,0) $) - ++(0,\value{tikztimingtranspos}*\height/2.) -} - \tikztimingdef{DT}{ \code{\setcounter{tikztimingtrans}{-1}} - \tikztiminguse{DL}{#1}% -} - -\tikztimingdef{MT}{% - \newdraw - {[\style] - -- ++(\slope,\value{tikztimingtrans}*\height/2.) -- ++($ (#1,0) - (\slope,0) $) + \tikztiming@oldnodecenter@% + \newdraw {[\style] + -- +(\dslope/2.,-\height/2) + -- ($ (timing@ref) + (#1,-\height/2) $) } } \tikztimingdef{TM}{% - \newdraw [\style] + \newdraw [\style/base] \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} -- ++($ (1/8,0) + (0,\value{tikztimingtrans}*\height/2) $) - \newdraw [\style/decoration,\style] + \newdraw [\style] -- ++($ (-1/8,0) + (#1,0) $) + \newdraw [\style/base] +} +% \end{macrocode} +% +% \subsubsection{Character `C'} +% \begin{macrocode} +\tikztimingecopy{C}{T} +% \end{macrocode} +% +% \subsubsection{Character `U'} +% \begin{macrocode} +\tikztimingecopy{U}{D} + +\def\tikztiming@triple@U@edge@{}% +\def\tikztiming@nocombine@U@edge@{}% +\def\tikztiming@alias@U@edge@{D@edge@}% + +\tikztimingcpy{UU@}{DD@}% + +\tikztimingdef{UDU}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard{#1}% } +\tikztimingcpy{DUD}{UDU}% -\let\tikztiming@chars@default\tikztiming@chars +\tikztimingdef{UDD}{% + \tikztiming@uchardd{#1}% +} + +\tikztimingcpy{{D@edge@}DD}{UDD} +\tikztimingcpy{{U@edge@}UU}{{D@edge@}DD} + +\tikztimingdef{H{D@edge@}}{ + coordinate [shift={(0,-\height/2)}] (timing@ref) + -- ++(\dslope/2, -\height/2) + \tikztiming@chard{#1}% +} + +\tikztimingdef{L{D@edge@}}{ + coordinate [shift={(0,\height/2)}] (timing@ref) + -- ++(\dslope/2, \height/2) + \tikztiming@chard{#1}% +} + +\tikztimingdef{Z{D@edge@}}{ + coordinate (timing@ref) + \tikztiming@chard{#1}% +} + +\tikztimingdef{T{D@edge@}}{ + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + coordinate [shift={(0,\height/2 * \value{tikztimingtrans})}] (timing@ref) + -- ++(\dslope/2, \height/2 * \value{tikztimingtrans}) + \tikztiming@chard{#1}% +} + +\tikztimingdef{{D@edge@}DU}{ + \tikztiming@oldnodecenter@ + \tikztiming@chard{#1} +} +\tikztimingcpy{{U@edge@}UD}{{D@edge@}DU} + +\tikztimingdef{DDU}{% + \tikztiming@dchardu{#1} +} + +\tikztimingcpy{DUU}{UDD}% +\tikztimingcpy{UUD}{DDU}% + +\tikztimingdef{@UU}{% + \tikztiming@@chard@{#1}% +} + +\tikztimingdef{@UD}{% + \tikztiming@@chard{#1}% +} + +\tikztimingdef{@DU}{% + \tikztiming@@chard{#1}% +} + +\tikztimingdef{UD}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard{#1}% +} + +\tikztimingdef{DU}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard{#1}% +} + +\tikztimingdef{UD@}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard@{#1}% +} + +\tikztimingdef{DU@}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard@{#1}% +} % \end{macrocode} +% +% \subsubsection{Character `X'} % \begin{macrocode} -% -%<*lib-either> +\tikztimingecopy{X}{Z} +% \end{macrocode} +% +% Save current list of characters as list of default characters. +% \begin{macrocode} +\let\tikztiming@chars@default\tikztiming@chars +% \end{macrocode} +% +% \clearpage +% \subsection{Libraries} +% +% \begin{macrocode} +\newcommand*\usetikztiminglibrary[2][]{% + \edef\tikztiming@library@options{#1}% + \@ifnextchar{[}%] + {\tikztiming@library{#2}}% + {\tikztiming@library{#2}[]}% +} +\def\tikztiming@library#1[#2]{% + \edef\tikztiming@library@date{#2}% + \tikztiming@library@#1,\relax +} % \end{macrocode} +% Load the library as package. The \LaTeX\ core macro \cs{zap@space} is patched +% to a no-op to keep spaces in the option text. Otherwise the option keys may +% not contain spaces. % \begin{macrocode} +\def\tikztiming@zap@space#1 \@empty{#1} -\tikztimingecopy{E}{D} +\def\tikztiming@library@#1,{% + \IfFileExists{tikz-timing-#1.sty}% + { \let\tikztiming@orig@zap@space\zap@space + \let\zap@space\tikztiming@zap@space + \RequirePackage + [\tikztiming@library@options]% + {tikz-timing-#1}% + [\tikztiming@library@date]% + \let\zap@space\tikztiming@orig@zap@space + }% + {\PackageError{tikz-timing}% + {No tikz-timing library `#1' found!}% + {}{}{}{}% + }% + \@ifnextchar\relax{}{\tikztiming@library@}% +} +% \end{macrocode} +% +% \iffalse +% +% \fi +% \subsubsection{Either High or Low} +% Provides character `E'. +% +% \iffalse +%<*lib-either> +% \fi +% \begin{macrocode} \tikztimingchar{E}{ ++(0,0) \code{\setcounter{tikztimingtranspos}{0}}% @@ -3756,140 +5977,2101 @@ \code{\setcounter{tikztimingtranspos}{0}}% \code{\setcounter{tikztimingtrans}{1}}% \tikztiminguse{D}{#1}% + \newdraw } -\tikztimingdef{LE}{% - -- ++(#1,0)% - \code{\setcounter{tikztimingtranspos}{0}}% - \code{\setcounter{tikztimingtrans}{1}}% - ++($ -1*(#1,0) $)% +\def\tikztiming@triple@E{}% + +\tikztimingdef{LE@}{% + \newdraw [\bgstyle] + -- ++(\slope,\height)% + -- ++($ (#1,0) - (\slope,0) $)% + -- ++(0,-\height)% + -- ++($ -1*(#1,0) $)% + \newdraw [\style] -- ++(\slope,\height)% -- ++($ (#1,0) - (\slope,0) $)% - ++(0,-\height)% + ++($ -1*(#1,\height) $)% + -- ++($ 1*(#1,0) $)% + ++(0,.5\height)% + \newdraw + \code{\setcounter{tikztimingtranspos}{0}}% + \code{\setcounter{tikztimingtrans}{1}}% }% -\tikztimingdef{HE}{% - -- ++(#1,0)% - \code{\setcounter{tikztimingtranspos}{1}}% - \code{\setcounter{tikztimingtrans}{-1}}% - ++($ -1*(#1,0) $)% + +\tikztimingdef{HE@}{% + \newdraw [\bgstyle] -- ++(\slope,-\height)% -- ++($ (#1,0) - (\slope,0) $)% -}% -\tikztimingdef{EE}{% - ++(0, \height * \value{tikztimingtranspos})% - ++(#1,0)% + -- ++(0,\height)% -- ++($ -1*(#1,0) $)% - -- ++(\slope, \height * \value{tikztimingtrans})% - -- ++(-\slope,0)% - -- ++(#1,0)% - ++(0, -\height + \height * \value{tikztimingtranspos})% -}% -\tikztimingdef{EH}{% - ++(0,+\height)% - -- ++(\slope,0)% - ++(-\slope,-\height)% - -- ++(\slope/2.,+\height/2.)% - \newdraw [\style]% - -- ++(\slope/2.,+\height/2.)% + \newdraw [\style] + -- ++(\slope,-\height)% -- ++($ (#1,0) - (\slope,0) $)% + ++($ -1*(#1,-\height) $)% + -- ++($ 1*(#1,0) $)% + ++(0,-.5\height)% + \newdraw + \code{\setcounter{tikztimingtranspos}{1}}% + \code{\setcounter{tikztimingtrans}{-1}}% }% -\tikztimingdef{EL}{% - -- ++(\slope,0)% - ++(-\slope,\height)% - -- ++(\slope/2.,-\height/2.)% - \newdraw [\style]% - -- ++(\slope/2.,-\height/2.)% + +\tikztimingdef{TE@}{% + \newdraw [\bgstyle] + -- ++(\slope,-\height * \value{tikztimingtrans})% -- ++($ (#1,0) - (\slope,0) $)% + -- ++(0,\height * \value{tikztimingtrans})% + -- ++($ -1*(#1,0) $)% + \newdraw [\style] + -- ++(\slope,-\height * \value{tikztimingtrans})% + -- ++($ (#1,0) - (\slope,0) $)% + ++($ -1*(#1,-\height * \value{tikztimingtrans}) $)% + -- ++($ 1*(#1,0) $)% + ++(0,-1*\value{tikztimingtrans}*.5*\height)% + \newdraw +}% + +\tikztimingdef{LEL}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\slope,\height)% + -- +(#1,\height)% + -- +($ (#1,0) + (\slope,0) $)% + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\slope,-\height/2)% + \newdraw }% -\tikztimingdef{ZE}{% + +\tikztimingdef{LEH}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\slope,\height)% + -- +($ (#1,\height) + (\slope,0) $)% + -- +(#1,0)% + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\slope,\height/2)% + \newdraw +}% + +\tikztimingdef{HEH}{% + \newdraw [\style,preaction={\bgstyle}] + -- +($ (#1,0) + (\slope,0) $)% + -- +(#1,-\height)% + -- +(\slope,-\height) + -- +(0,0) + ++(#1,-\height/2) coordinate (timing@ref) + ++(\slope,\height/2)% + \newdraw +}% + +\tikztimingdef{HEL}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(#1,0) + -- +($ (#1,-\height) + (\slope,0) $)% + -- +(\slope,-\height) + -- +(0,0) + ++(#1,-\height/2) coordinate (timing@ref) + ++(\slope,-\height/2)% + \newdraw +}% + +\tikztimingdef{HET}{ + \newdraw [\style,preaction={\bgstyle}] + -- +(#1,0) + {[\nstyle] + -- +($ (#1,-\height) + (\slope,0) $)% + } + -- +(\slope,-\height) + -- +(0,0) + {[\nstyle] + ++(#1,-\height/2) coordinate (timing@ref) + ++(\slope,-\height/2)% + } + \newdraw + \code{\setcounter{tikztimingtrans}{-1}}% +} + +\tikztimingdef{LET}{ + \newdraw [\style,preaction={\bgstyle}] + -- +(\slope,\height)% + {[\nstyle] + -- +($ (#1,\height) + (\slope,0) $)% + } + -- +(#1,0)% + -- +(0,0) + {[\nstyle] + ++(#1,\height/2)% + coordinate (timing@ref) + ++(\slope,\height/2)% + } + \newdraw + \code{\setcounter{tikztimingtrans}{1}}% +} + +\tikztimingdef{HEE}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(#1,0) coordinate (timing@refb) + coordinate [shift={(0,-\height/2)}] (timing@ref) + -- +($ (#1,-\height) + (\slope,0) $) coordinate (timing@refa) + -- +(\slope,-\height) + -- +(0,0) + coordinate [shift={(#1,-\height/2)}] (timing@ref) + ++($ (#1,-\height) + (\slope,0) $)% \code{\setcounter{tikztimingtranspos}{1}}% \code{\setcounter{tikztimingtrans}{-1}}% - \tikztiminguse{ZD}{#1}% + \newdraw +}% + +\tikztimingdef{LEE}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(#1,0) coordinate (timing@refa) + coordinate [shift={(0,\height/2)}] (timing@ref) + -- +($ (#1,\height) + (\slope,0) $) coordinate (timing@refb) + -- +(\slope,\height) + -- +(0,0) + ++(#1,0) coordinate [shift={(0,\height/2)}] (timing@ref) + \code{\setcounter{tikztimingtranspos}{0}}% + \code{\setcounter{tikztimingtrans}{1}}% + \newdraw +}% + +\tikztimingdef{TEE}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\slope, -\height * \value{tikztimingtrans})% + -- +($ (#1,0) + (\slope, -\height * \value{tikztimingtrans}) $) + -- +(#1,0) + -- +(0,0)% + \code{\setcounter{tikztimingtranspos}{\value{tikztimingtrans}}% + \addtocounter{tikztimingtranspos}{+1}} + +($ (#1,0) + (\slope/2 + \slope/2 * \value{tikztimingtrans}, -\height/2 * \value{tikztimingtranspos}) $) + coordinate (timing@refa) + +($ (#1,0) + (\slope/2 - \slope/2 * \value{tikztimingtrans}, \height - \height/2 * \value{tikztimingtranspos}) $) + coordinate (timing@refb) + ++(#1,0) + coordinate [shift={(0,-\height/2 * \value{tikztimingtrans})}] (timing@ref) + ++( + .5 * \slope + .5 * \value{tikztimingtrans} * \slope, + -.5 * \height - .5 * \value{tikztimingtrans} * \height + ) + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + \newdraw +}% + + +\tikztimingdef{TEH}{% + \newdraw [\style,preaction={\bgstyle}] + -- ++(\slope,-\height * \value{tikztimingtrans}) + -- ++($ (#1,0) - (\slope/2 + \slope/2 * \value{tikztimingtrans},0) $) + -- ++(\slope * \value{tikztimingtrans}, + \height * \value{tikztimingtrans}) + -- ++($ -1*(#1,0) - (\slope/2 + \slope/2 * \value{tikztimingtrans},0) $) + ++($ (#1,-\height/2 * \value{tikztimingtrans}) $) coordinate (timing@ref) + ++(\slope,\height/2) + \newdraw +} + +\tikztimingdef{TEL}{% + \newdraw [\style,preaction={\bgstyle}] + -- ++(\slope,-\height * \value{tikztimingtrans}) + -- ++($ (#1,0) - (\slope/2 - \slope/2 * \value{tikztimingtrans},0) $) + -- ++(-\slope * \value{tikztimingtrans}, + \height * \value{tikztimingtrans}) + -- ++($ -1*(#1,0) - (\slope/2 + -\slope/2 * \value{tikztimingtrans},0) $) + ++($ (#1,-\height/2 * \value{tikztimingtrans}) $) coordinate (timing@ref) + ++(\slope,-\height/2) + \newdraw +} + +\tikztimingdef{TEZ}{% + \newdraw [\style,preaction={\bgstyle}] + -- ++(\slope,-\height * \value{tikztimingtrans}) + -- ++($ (#1,0) - (\slope,0) $) + -- ++(\zslope, + \height/2 * \value{tikztimingtrans}) + -- ++(-\zslope, + \height/2 * \value{tikztimingtrans}) + -- ++($ -1*(#1,0) $) + ++($ (#1,0) + (0,-\height/2 * \value{tikztimingtrans}) $) + coordinate (timing@ref) + ++(\zslope,0) + \newdraw +} + +\tikztimingdef{TED}{% + \newdraw [\style,preaction={\bgstyle}] + -- ++(\slope,-\height * \value{tikztimingtrans}) + -- ++($ (#1,0) - (\slope,0) $) + -- ++(\dslope/2, + \height/2 * \value{tikztimingtrans}) + -- ++(-\dslope/2, + \height/2 * \value{tikztimingtrans}) + -- ++($ -1*(#1,0) $) + ++($ (#1,0) + (0,-\height/2 * \value{tikztimingtrans}) $) + coordinate (timing@ref) + ++(\dslope/2,0) + \newdraw +} + +\tikztimingdef{TET}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\slope, -\height * \value{tikztimingtrans})% + {[\nstyle] + -- +($ (#1,0) + (\slope, -\height * \value{tikztimingtrans}) $)% + } + -- +(#1,0)% + -- +(0,0)% + {[\nstyle] + ++($ (#1,0) + (0, -\height/2 * \value{tikztimingtrans}) $)% + coordinate (timing@ref) + ++(\slope, -\height/2 * \value{tikztimingtrans})% + } + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + \newdraw +}% + +\tikztimingdef{EEZ}{% + \newdraw [\style,preaction={\bgstyle}] + -- (timing@refb) + -- ($ (timing@ref) + (#1,+\height/2) $) + -- ($ (timing@ref) + (#1,0) + (\zslope,0) $) + -- ($ (timing@ref) + (#1,-\height/2) $) + -- (timing@refa) + ($ (timing@ref) + (#1,0) + (\zslope,0) $) + coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $) + \newdraw +}% + +\tikztimingdef{EED}{% + \newdraw [\style,preaction={\bgstyle}] + -- (timing@refb) + -- ($ (timing@ref) + (#1,+\height/2) $) + -- ($ (timing@ref) + (#1,0) + (\dslope/2,0) $) + -- ($ (timing@ref) + (#1,-\height/2) $) + -- (timing@refa) + ($ (timing@ref) + (#1,0) + (\dslope/2,0) $) + coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $) + \newdraw +}% + + +\tikztimingdef{HEZ}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(#1,0) + -- +($ (#1,-\height/2) + (\zslope,0) $)% + -- +(#1,-\height) + -- +(\slope,-\height) + -- +(0,0) + ++(#1,-\height/2) coordinate (timing@ref) + ++(\zslope,0)% + \newdraw +}% + + +\tikztimingdef{LEZ}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\slope,\height) + -- +(#1,\height) + -- +($ (#1,\height/2) + (\zslope,0) $)% + -- +(#1,0) + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\zslope,0)% + \newdraw +}% + + +\tikztimingdef{LED}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\slope,\height) + -- +(#1,\height) + -- +($ (#1,\height/2) + (\dslope/2,0) $)% + -- +(#1,0) + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\dslope/2,0)% + \newdraw +}% + +\tikztimingdef{HED}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(#1,0) + -- +($ (#1,-\height/2) + (\dslope/2,0) $)% + -- +(#1,-\height) + -- +(\slope,-\height) + -- +(0,0) + ++(#1,-\height/2) coordinate (timing@ref) + ++(\dslope/2,0)% + \newdraw +}% + + +\tikztimingdef{EZ}{% + \newdraw [\style] + -- ($ (timing@ref) + (#1,0) $)% +} + +\tikztimingdef{EM}{% + \newdraw [\style] + -- ($ (timing@ref) + (#1,0) $)% + \newdraw [\style/base] +} + +\tikztimingdef{EL}{% + -- ($ (timing@ref) + (#1,-\height/2) $)% +}% +\tikztimingdef{EH}{% + -- ($ (timing@ref) + (#1,+\height/2) $)% +}% + +\tikztimingdef{ED@}{% + \tikztiming@chard@{#1}% +} +\tikztimingcpy{E{D@edge@}@}{ED@} + +\tikztimingdef{ED}{% + \tikztiming@chard{#1}% +} +\tikztimingcpy{E{D@edge@}}{ED} +\tikztimingdef{EDD}{% + \tikztiming@chard@{#1}% +} +\tikztimingdef{EUU}{% + \tikztiming@chard@{#1}% +} +\tikztimingdef{EDU}{% + \tikztiming@chard{#1}% +} +\tikztimingdef{EUD}{% + \tikztiming@chard{#1}% +} + + +\tikztimingdef{DE@}{% + \tikztiming@oldnodecenter@% + \newdraw [\bgstyle] + -- +(\dslope/2,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $)% + -- ($ (timing@ref) + (#1,-\height/2) $)% + -- ($ (timing@save) + (\dslope/2,-\height/2) $) + -- (timing@save) + \newdraw [\style] + -- +(\dslope/2,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $)% + ($ (timing@ref) + (#1,-\height/2) $)% + -- ($ (timing@save) + (\dslope/2,-\height/2) $) + -- (timing@save) + ($ (timing@ref) + (#1,0) $)% + coordinate (timing@ref) +} + +\tikztimingdef{EEE}{% + \newdraw [\style,preaction={\bgstyle}] + -- (timing@refb) + -- ($ (timing@refb) + (#1,0) $) + -- ($ (timing@refa) + (#1,0) $) + -- (timing@refa) + ++(#1,0) coordinate (timing@refa) + coordinate (timing@refb) at ($ (timing@refb) + (#1,0) $) + coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $) + \newdraw +}% + +\tikztimingdef{EET}{% + \newdraw [\style,preaction={\bgstyle}] + -- (timing@refb) + {[\nstyle] + -- ($ (timing@ref) + (#1,+\height/2) + (\slope/2 + \slope/2 * \value{tikztimingtrans},0) $) + -- ($ (timing@ref) + (#1,-\height/2) + (\slope/2 - \slope/2 * \value{tikztimingtrans},0) $) + } + -- (timing@refa) + {[\nstyle] + ($ (timing@ref) + (#1,\height/2 * \value{tikztimingtrans}) + (\slope,0) $) + } + coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $) + \newdraw +}% + +\tikztimingdef{EEL}{% + \newdraw [\style,preaction={\bgstyle}] + -- (timing@refb) + -- ($ (timing@ref) + (#1,+\height/2) $) + -- ($ (timing@ref) + (#1,-\height/2) + (\slope,0) $) + -- (timing@refa) + ($ (timing@ref) + (#1,-\height/2) + (\slope,0) $) + coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $) + \newdraw +}% + +\tikztimingdef{EEH}{% + \newdraw [\style,preaction={\bgstyle}] + -- (timing@refb) + -- ($ (timing@ref) + (#1,+\height/2) + (\slope,0) $) + -- ($ (timing@ref) + (#1,-\height/2) $) + -- (timing@refa) + ($ (timing@ref) + (#1,+\height/2) + (\slope,0) $) + coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $) + \newdraw +}% + + +\tikztimingdef{EE@}{% + \newdraw [\bgstyle] + let \p0 = (timing@ref), \p1 = (timing@refa), \p2 = (timing@refb) in + -- (\p2) + -- ($ (\x0,\y2) + (#1,0) $) + -- +(0,\y1-\y2) + -- (\p1) + \newdraw [\style] + let \p0 = (timing@ref), \p1 = (timing@refa), \p2 = (timing@refb) in + -- (\p2) + -- ($ (\x0,\y2) + (#1,0) $) + +(0,\y1-\y2) + -- (\p1) + ($ (timing@ref) + (#1,0) $) coordinate (timing@ref) + \newdraw +}% + +\tikztimingdef{ZE@}{ + \newdraw [\bgstyle] + -- +(\zslope,\height/2) + -- +(#1,\height/2)% + -- +(#1,-\height/2)% + -- +(\zslope,-\height/2) + -- +(0,0) + \newdraw [\style] + -- +(\zslope,\height/2) + -- +(#1,\height/2)% + +(#1,-\height/2)% + -- +(\zslope,-\height/2) + -- +(0,0) + ++(#1,0) coordinate (timing@ref) +} + +\tikztimingdef{ZEH}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\zslope, \height/2) + -- +($ (#1,0) + (\slope, \height/2) $) + -- +(#1,-\height/2) + -- +(\zslope, -\height/2) + -- +(0,0) + ++(#1,0) coordinate (timing@ref) + ++(\slope, \height/2) + \newdraw +} + +\tikztimingdef{ZEL}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\zslope, \height/2) + -- +(#1,\height/2) + -- +($ (#1,0) + (\slope, -\height/2) $) + -- +(\zslope, -\height/2) + -- +(0,0) + ++(#1,0) coordinate (timing@ref) + ++(\slope, -\height/2) + \newdraw +} + +\tikztimingdef{ZET}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\zslope, \height/2) + {[\nstyle] + -- +($ (#1, \height/2) + (\slope/2 - \slope/2 * \value{tikztimingtrans}, 0) $) + -- +($ (#1,-\height/2) + (\slope/2 + \slope/2 * \value{tikztimingtrans}, 0) $) + } + -- +(\zslope, -\height/2) + -- +(0,0) + {[\nstyle] + ++(#1,0) coordinate (timing@ref) + ++(\slope,-\height/2 * \value{tikztimingtrans}) + } + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + \newdraw +} + +\tikztimingdef{DET}{% + \tikztiming@oldnodecenter@% + \newdraw [\style,preaction={\bgstyle}] + -- +(\dslope/2, \height/2) + {[\nstyle] + -- ($ (timing@ref) + (#1, \height/2) + (\slope/2 - \slope/2 * \value{tikztimingtrans}, 0) $) + -- ($ (timing@ref) + (#1,-\height/2) + (\slope/2 + \slope/2 * \value{tikztimingtrans}, 0) $) + } + -- ($ (timing@save) + (\dslope/2, -\height/2) $) + -- (timing@save) + {[\nstyle] + ($ (timing@ref) + (#1,0) $) coordinate (timing@ref) + ++(\slope,-\height/2 * \value{tikztimingtrans}) + } + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + \newdraw +} + +\tikztimingdef{ZEZ}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\zslope, \height/2) + -- +(#1,\height/2) + -- +($ (#1,0) + (\zslope, 0) $) + -- +(#1,-\height/2) + -- +(\zslope, -\height/2) + -- +(0,0) + ++(#1,0) coordinate (timing@ref) + ++(\zslope, 0) + \newdraw +} + +\tikztimingdef{ZEE}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\zslope, \height/2) + -- +($ (#1,0) + (\slope, \height/2) $) coordinate (timing@refb) + -- +(#1,-\height/2) coordinate (timing@refa) + -- +(\zslope, -\height/2) + -- +(0,0) + +(#1,0) coordinate (timing@ref) + ++(#1,-\height/2) + \code{\setcounter{tikztimingtranspos}{0}}% + \code{\setcounter{tikztimingtrans}{1}}% +} + +\tikztimingdef{DEE}{% + \tikztiming@oldnodecenter@ + \newdraw [\style,preaction={\bgstyle}] + -- +(\dslope/2, \height/2) + -- ($ (timing@ref) + (#1,0) + (\slope, \height/2) $) coordinate (timing@refb) + -- ($ (timing@ref) + (#1,-\height/2) $) coordinate (timing@refa) + -- ($ (timing@save) + (\dslope/2, -\height/2) $) + -- (timing@save) + coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $) + (timing@refa) + \code{\setcounter{tikztimingtranspos}{0}}% + \code{\setcounter{tikztimingtrans}{1}}% +} + + +\tikztimingdef{DED}{% + \tikztiming@oldnodecenter@% + \newdraw [\style,preaction={\bgstyle}] + -- +(\dslope/2, \height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- ($ (timing@ref) + (#1,0) + (\dslope/2,0) $) + -- ($ (timing@ref) + (#1,-\height/2) $) + -- ($ (timing@save) + (\dslope/2, -\height/2) $) + -- (timing@save) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + ++(\dslope/2,0) + \newdraw +} + +\tikztimingdef{ZED}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\zslope, \height/2) + -- +(#1,\height/2) + -- +($ (#1,0) + (\dslope/2, 0) $) + -- +(#1,-\height/2) + -- +(\zslope, -\height/2) + -- +(0,0) + ++(#1,0) coordinate (timing@ref) + ++(\dslope/2, 0) + \newdraw +} + +\tikztimingdef{DEZ}{% + \tikztiming@oldnodecenter@ + \newdraw [\style,preaction={\bgstyle}] + -- +(\dslope/2, \height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- ($ (timing@ref) + (#1,0) + (\zslope, 0) $) + -- ($ (timing@ref) + (#1,-\height/2) $) + -- ($ (timing@save) + (\dslope/2, -\height/2) $) + -- (timing@save) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + ++(\zslope, 0) + \newdraw +} + + +\tikztimingdef{DEH}{% + \tikztiming@oldnodecenter@% + \newdraw [\style,preaction={\bgstyle}] + -- +(\dslope/2, \height/2) + -- ($ (timing@ref) + (#1,0) + (\slope, \height/2) $) + -- ($ (timing@ref) + (#1,-\height/2) $) + -- ($ (timing@save) + (\dslope/2, -\height/2) $) + -- (timing@save) + ($ (timing@ref) + (#1,0) $) coordinate (timing@ref) + ++(\slope, \height/2) + \newdraw +} + +\tikztimingdef{DEL}{% + \tikztiming@oldnodecenter@% + \newdraw [\style,preaction={\bgstyle}] + -- +(\dslope/2, \height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- ($ (timing@ref) + (#1,0) + (\slope, -\height/2) $) + -- ($ (timing@save) + (\dslope/2, -\height/2) $) + -- (timing@save) + ($ (timing@ref) + (#1,0) $) coordinate (timing@ref) + ++(\slope, -\height/2) + \newdraw +} + + +\tikztimingdef{@E}{% + \code{\setcounter{tikztimingtranspos}{0}}% + \code{\setcounter{tikztimingtrans}{1}}% + \tikztiminguse{@D}{#1} +} + +\tikztimingdef{@DE}{% + \tikztiming@@chard{#1}% +} +\tikztimingdef{DDE}{ + \tikztiming@@chard{#1}% +} + +\tikztimingdef{@EH}{% + coordinate [shift={(0,\height/2)}] (timing/start) + \newdraw [\bgstyle] + -- +(0,\height) + -- +($ (#1,\height) + (\slope,0) $) + -- +(#1,0) + -- +(0,0) + \newdraw [\style] + +(0,\height) + -- +($ (#1,\height) + (\slope,0) $) + -- +(#1,0) + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\slope,\height/2) + \newdraw +} + +\tikztimingdef{@ET}{% + coordinate [shift={(0,\height/2)}] (timing/start) + \newdraw [\bgstyle] + -- +(0,\height) + {[\nstyle] + -- ($ (timing@ref) + (#1,\height/2) + (\slope,0) $) + } + -- ($ (timing@ref) + (#1,-\height/2) $) + -- (timing@save) + \newdraw [\style] + +(0,\height) + {[\nstyle] + -- ($ (timing@ref) + (#1,\height/2) + (\slope,0) $) + } + -- ($ (timing@ref) + (#1,-\height/2) $) + -- (timing@save) + {[\nstyle] + ($ (timing@ref) + (#1,0) $) coordinate (timing@ref) + ++(\slope,\height/2) + } + \newdraw + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} +} + +\tikztimingdef{ET}{% + {[\style] + -- ($ (timing@ref) + (#1,\height/2 * \value{tikztimingtrans}) $) + } +} + +\tikztimingdef{@EL}{% + coordinate [shift={(0,\height/2)}] (timing/start) + \newdraw [\bgstyle] + -- +(0,\height) + -- +(#1,\height) + -- +($ (#1,0) + (\slope,0) $) + -- +(0,0) + \newdraw [\style] + +(0,\height) + -- +(#1,\height) + -- +($ (#1,0) + (\slope,0) $) + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\slope,-\height/2) + \newdraw +} + +\tikztimingdef{@ED}{% + coordinate [shift={(0,\height/2)}] (timing/start) + \newdraw [\bgstyle] + -- +(0,\height) + -- +(#1,\height) + -- +($ (#1,\height/2) + (\dslope/2,0) $) + -- +(#1,0) + -- +(0,0) + \newdraw [\style] + +(0,\height) + -- +(#1,\height) + -- +($ (#1,\height/2) + (\dslope/2,0) $) + -- +(#1,0) + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\dslope/2,0) +} + +\tikztimingdef{@EZ}{% + coordinate [shift={(0,\height/2)}] (timing/start) + \newdraw [\bgstyle] + -- +(0,\height) + -- +(#1,\height) + -- +($ (#1,\height/2) + (\zslope,0) $) + -- +(#1,0) + -- +(0,0) + \newdraw [\style] + +(0,\height) + -- +(#1,\height) + -- +($ (#1,\height/2) + (\zslope,0) $) + -- +(#1,0) + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\zslope,0) +} + + +\tikztimingdef{@EE}{% + coordinate [shift={(0,\height/2)}] (timing/start) + \newdraw [\bgstyle] + -- +(0,\height) + -- +($ (#1,\height) + (\slope,0) $) + -- +(#1,0) + -- +(0,0) + \newdraw [\style] + +(0,\height) + -- +($ (#1,\height) + (\slope,0) $) coordinate (timing@refb) + -- +(#1,0) coordinate (timing@refa) + -- +(0,0) + ++(#1,0) coordinate [shift={(0,\height/2)}] (timing@ref) + \code{\setcounter{tikztimingtranspos}{0}}% + \code{\setcounter{tikztimingtrans}{1}}% +} + +\def\tikztiming@nocombine@E{}%% +% \end{macrocode} +% +% \iffalse +% +% \fi +% +% \subsubsection{Clock Arrows} +% +% \iffalse +%<*lib-clockarrows> +% \fi +% \begin{macrocode} +\tikztiming@iftrans{CC}% + {\let\tikztiming@trans@C@normal@C\tikztiming@trans@CC}% + {\PackageError{\@currname}{No 'CC' transition defined by the main tikz-timing + package.}{}{}}% + +\tikztimingdef{CC}{% + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + [timing/c/save] + \newdraw + [\style,timing/c/restore,>=\noexpand\tikztiming@c@arrow@tip,timing/c/arrow@style] + -- ++(\slope*\noexpand\tikztiming@c@arrow@pos,\value{tikztimingtrans}*\height*\noexpand\tikztiming@c@arrow@pos) + ; \draw [timing/restore,timing/c/restore] (timing@save) ++(0,0) [\style] + -- ++(\slope,\value{tikztimingtrans}*\height) + -- ++($ (#1,0) - (\slope,0) $) +} +\let\tikztiming@trans@C@arrow@C\tikztiming@trans@CC + +\tikzset{timing/c/.cd, + rising arrows/.code={% + \def\tikztiming@trans@CC{\tikztiming@trans@C@arrow@C}% + \def\tikztiming@clockarrow@style{\ifnum1=\c@tikztimingtrans\tikzset{->,timing/c/arrow}\fi}% + },% + falling arrows/.code={% + \def\tikztiming@trans@CC{\tikztiming@trans@C@arrow@C}% + \def\tikztiming@clockarrow@style{\ifnum-1=\c@tikztimingtrans\tikzset{->,timing/c/arrow}\fi}% + },% + dual arrows/.code={% + \def\tikztiming@trans@CC{\tikztiming@trans@C@arrow@C}% + \def\tikztiming@clockarrow@style{\tikzset{->,timing/c/arrow}}% + },% + no arrows/.code={% + \def\tikztiming@trans@CC{\tikztiming@trans@C@normal@C}% + \def\tikztiming@clockarrow@style{}% + },% + arrow@style/.code={\tikztiming@clockarrow@style},% + arrow/.style={},% + arrow pos/.store in=\tikztiming@c@arrow@pos, + arrow tip/.store in=\tikztiming@c@arrow@tip, + save/.code={% + \global\let\tikztiming@clockarrow@savedstyle\tikztiming@clockarrow@style + \global\let\tikztiming@trans@saved@CC\tikztiming@trans@CC + \global\let\tikztiming@c@arrow@savedpos\tikztiming@c@arrow@pos + \global\let\tikztiming@c@arrow@savedtip\tikztiming@c@arrow@tip + }, + restore/.code={% + \let\tikztiming@clockarrow@style\tikztiming@clockarrow@savedstyle + \let\tikztiming@trans@CC\tikztiming@trans@saved@CC + \let\tikztiming@c@arrow@pos\tikztiming@c@arrow@savedpos + \let\tikztiming@c@arrow@tip\tikztiming@c@arrow@savedtip + }, +} +\tikzset{timing/c/.cd, + no arrows, + arrow pos=0.95, + arrow tip=to, +} + +% \end{macrocode} +% Use the \pkg{pgfopts} to handle the package options. +% \begin{macrocode} +\RequirePackage{pgfopts} +\ProcessPgfOptions{/tikz/timing/c} +% \end{macrocode} +% \iffalse +% +% \fi +% +% \subsubsection{Arrows} +% +% \iffalse +%<*lib-arrows> +% \fi +% \begin{macrocode} +\tikzset{timing/.cd, + A/.style={timing/a}, + W/.style={timing/w}, + a/.style={->}, + w/.style={<-}, +} + +\tikztimingchar{A}{++(0,0)}{% + \newdraw [\style] -- ++(0,\height) + \newdraw ++(#1,-\height) +} +\def\tikztiming@nocombine@A{}% + +\tikztimingecopy{W}{A} +% \end{macrocode} +% +% \iffalse +% +% \fi +% +% \subsubsection{Overlays} +% +% \iffalse +%<*lib-overlays> +% \fi +% \begin{macro}{\tikztiming@defcode{O}} +% The last character before the "O" is saved and restored. Also the drawing +% state is saved and restored by the \cs{tikztiming@overlay@begin} and +% \cs{tikztiming@overlay@end} macros. The parser end macro +% \cs{tikztiming@parser@end} which is triggered at the end of the overlay string +% is redefined to avoid problems. The double \TeX\ group is necessary because +% the overlay string can close and reopen the inner \TeX\ +% group. +% \begin{macrocode} +\tikztiming@defcode{O}#1{% + \ifx\relax#1\empty + \def\tikztiming@next{\tikztiming@parser#1}% + \else + \let\tikztiming@overlay@lastchar\tikztiming@lastchar + \let\tikztiming@overlay@width\tikztimingwidth + \tikztiming@output@addcode{\tikztiming@overlay@begin}% + \begingroup + \def\tikztiming@parser@end{% + \def\tikztiming@output@nextchar{@}% + \tikztiming@output@flush + } + \begingroup + \tikztiming@parser #1\relax + \endgroup + \endgroup + \tikztiming@output@addcode{\tikztiming@overlay@end}% + \global\let\tikztiming@lastchar\tikztiming@overlay@lastchar + \global\let\tikztimingwidth\tikztiming@overlay@width + \def\tikztiming@next{\expandafter\tikztiming@parser\@firstofone}% + \fi + \tikztiming@next +} +% \end{macrocode} +% \end{macro} +% +% Set the later expanded macros to some sane initial value. +% \begin{macrocode} +\let\tikztiming@overlay@save\empty +\let\pgf@sh@nt@tikztiming@overlay@node\empty +% \end{macrocode} +% +% \begin{macro}{\tikztiming@overlay@begin} +% The drawing transition state (for "T", etc.) is saved and restored. +% In order to be able to include an "O" inside the argument of another one the +% overlay save node coordinates (\cs{pfg@sh@nt@tikztiming@overlay@node}) is also +% saved and restored. The \cs{tikztiming@overlay@save} macro also includes an +% self-assignment to its old version, which implements a stack. The macros must +% be global because the overlay string can reopen a new TikZ path. +% \begin{macrocode} +\def\tikztiming@overlay@begin{ + [/utils/exec={% + \xdef\tikztiming@overlay@save{% + \noexpand\global\noexpand\c@tikztimingtrans\the\c@tikztimingtrans\relax% + \noexpand\global\noexpand\c@tikztimingtranspos\the\c@tikztimingtranspos\relax% + \noexpand\gdef\noexpand\pgf@sh@nt@tikztiming@overlay@node + {\csname pgf@sh@nt@tikztiming@overlay@node\endcsname}% + \noexpand\gdef\noexpand\pgf@sh@nt@timing@refa + {\csname pgf@sh@nt@timing@refa\endcsname}% + \noexpand\gdef\noexpand\pgf@sh@nt@timing@refb + {\csname pgf@sh@nt@timing@refb\endcsname}% + \noexpand\gdef\noexpand\pgf@sh@nt@timing@ref + {\csname pgf@sh@nt@timing@ref\endcsname}% + \noexpand\gdef\noexpand\tikztiming@overlay@save{% + \expandafter\unexpanded\expandafter{\tikztiming@overlay@save}% + }% + }% + }]% + node [timing/save] (tikztiming@overlay@node) {} + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@overlay@end} +% Start new drawing path, restore position and saved drawing state. +% \begin{macrocode} +\def\tikztiming@overlay@end{% + \tikztiming@newdraw (tikztiming@overlay@node) + [/utils/exec={\tikztiming@overlay@save}] +}% +% \end{macrocode} +% \end{macro} +% +% +% \iffalse +% +%<*lib-columntype> +% \fi +% \subsubsection{Column Type} +% The \pkg{array} package is needed to define the column type. +% \begin{macrocode} +\RequirePackage{array} + +\tikzset{timing/columntype/.code 2 args = + \newcolumntype{#1}{>{\celltiming}#2<{\endcelltiming}}% +}% +% \end{macrocode} +% +% The options |type| (calls |timing/columntype|) and |notype| are defined. +% \begin{macrocode} +\RequirePackage{pgfopts} +\tikzset{timing/columntype/.cd, + type/.style 2 args={/tikz/timing/columntype={#1}{#2}},% + notype/.code={}, + notype/.value forbidden={}, +} + +\ProcessPgfOptions{/tikz/timing/columntype} +% \end{macrocode} +% Use default settings if no options where given. This works because all options +% so far will change the default type. +% \begin{macrocode} +\expandafter\ifx\csname opt@\@currname.\@currext\endcsname\empty + \tikzset{timing/columntype={T}{l}}% +\fi +% \end{macrocode} +% +% \begin{macro}{\celltiming}[1]{Some ignored tokens} +% The macro first reads everything to the |\ignorespaces| placed by the +% |tabular|. After placing the tokens except |\ignorespaces| back a +% |tikzpicture| is started. The \cs{tikztiming@endhook} is defined to call +% \cs{end@celltiming}. +% After the usual init process the input is tested for an optional argument and +% \cs{tikztiming@celltiming} is called accordantly. +% \begin{macrocode} +\def\celltiming#1\ignorespaces{% + #1% + \begin{tikzpicture}[timing/picture,baseline={(0,0)}] + \def\tikztiming@endhook{\end@celltiming} + \tikztiming@init + \let\tikztiming@settings\empty + \@ifnextchar{[}% + {\tikztiming@celltiming}% + {\tikztiming@celltiming[]}% +} +\let\endcelltiming\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@celltiming}[1]{Optional Initial Character or +% Settings} +% First the optional argument is tested to see if it is a single initial +% character or some settings. The \cs{tikztiming@testoptarg} macro sets the +% \cs{lastchar} and \cs{settings} macros to the appropriate values. +% +% If the \cs{lastchar} is empty it is set to the normal start value. +% +% Then a \pkg{pgf} scope with the potential user settings is started. The macros +% |\unskip| and |\\| which are used internally by the |tabular| environment are +% |\let| to |\relax| to work as end marker for the \cs{tikztiming@parser}. This +% will not influence the table because they will revert to their original +% definition at the end of the |tikzpicture| environment. +% +% Finally the \cs{tikztiming@parser} is called. +% \begin{macrocode} +\def\tikztiming@celltiming[#1]{% + \ifx\relax#1\relax\else + \tikztiming@testoptarg#1\relax\relax + \fi + \ifx\tikztiming@lastchar\empty + \def\tikztiming@lastchar{@}% + \fi + \expandafter\scope\expandafter[\tikztiming@settings]% + \begingroup + \let\unskip\relax + \let\\\relax + \tikztiming@parser +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\end@celltiming} +% This macro is called from the \cs{tikztiming@endhook} which is located in +% \cs{tikztiming@parser@end} when the end marker (|\relax| or alias) is +% encountered. It executes the accumulated \cs{tikztiming@str} and places the +% timing shape. Finally the |scope| and |tikzpicture| is closed. +% \begin{macrocode} +\def\end@celltiming{% + \tikzset{timing/before}% + \tikztiming@str; + \expandafter\node + \expandafter[\tikztiming@settings,shape=tikztiming@shape,anchor=origin] at (0,0) {}; + \tikzset{timing/after}% + \endscope + \end{tikzpicture}% +} +% \end{macrocode} +% \end{macro} +% +% \iffalse +% +%<*lib-nicetabs> +% \fi +% \subsubsection{Nice Timing Tables} +% +% The dimensions of the following packages are used. +% \begin{macrocode} +\RequirePackage{array} +\RequirePackage{booktabs} +% \end{macrocode} + +% +% \begin{macro}{\tikztiming@nicetabs@tableheader}[3]{Optional Settings}{Text +% title}{Diagram title} +% \begin{macrocode} +\newcommand*\tikztiming@nicetabs@tableheader[3][]{% + \path [timing/table/midrules] [/utils/exec=\xdef\@gtempa{\the\pgflinewidth}]; + \path [timing/table/header,#1] + let \p1 = (0,\belowrulesep + \aboverulesep + \@gtempa + \arraystretch * + {(\ht\strutbox + \extrarowheight)} + \arraystretch\dp\strutbox) in + node [anchor=base west] (tikztiming@header) at (0,\y1) {\ignorespaces + #3\unskip\strut} + node [anchor=base east] at (-1*{(\tikztiming@coldist)},\y1) {\ignorespaces + #2\unskip\strut} + ; + \tikztiming@tableheadtrue +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@nicetabs@tablerules}[1]{Optional Settings} +% \begin{macrocode} +\newcommand*\tikztiming@nicetabs@tablerules[1][]{% + \begin{scope}[#1] + \coordinate (NW) at (current bounding box.north west); + \coordinate (SE) at (current bounding box.south east); + % + \draw [timing/table/rules] + let + \p1 = (NW), + \p2 = (SE), + \p3 = (last row text.base), + \p4 = ($ (0,\y3) - (0,\arraystretch\dp\strutbox + \aboverulesep + + .5\pgflinewidth) $) + in + (\x1-\tabcolsep,\y4) -- (\x2+\tabcolsep,\y4) + \iftikztiming@tablehead + let + \p5 = (tikztiming@header.base), + \p6 = ($ (0,\y5) + (0,\arraystretch * {(\ht\strutbox + \extrarowheight + )} + \belowrulesep + .5\pgflinewidth) $) + in + (\x1-\tabcolsep,\y6) -- (\x2+\tabcolsep,\y6) + \fi + ; + \draw + \iftikztiming@tablehead [timing/table/midrules] \else [timing/table/rules] \fi + let + \p1 = (NW), + \p2 = (SE), + \p3 = (0, \arraystretch * {( \ht\strutbox + \extrarowheight )} + + \belowrulesep + .5\pgflinewidth) + in + (\x1-\tabcolsep, \y3) + -- + (\x2+\tabcolsep, \y3) + ; + \end{scope} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\let\tikztiming@normal@tableheader\tikztiming@tableheader +\let\tikztiming@normal@tablerules\tikztiming@tablerules +\let\tikztiming@normal@coldist\tikztiming@coldist +\let\tikztiming@normal@rowdist\tikztiming@rowdist + +\tikzset{% + timing/no nice tabs/.code={% + \let\tikztiming@coldist\tikztiming@normal@coldist + \let\tikztiming@rowdist\tikztiming@normal@rowdist + \let\tikztiming@tableheader\tikztiming@normal@tableheader + \let\tikztiming@tablerules\tikztiming@normal@tablerules + }, + timing/nice tabs/.code={% + \ifx\tikztiming@tableheader\tikztiming@nicetabs@tableheader\else + \let\tikztiming@normal@coldist\tikztiming@coldist + \let\tikztiming@normal@rowdist\tikztiming@rowdist + \fi + \def\tikztiming@rowdist{% + \arraystretch * {(\ht\strutbox+\extrarowheight)}% + +\arraystretch\dp\strutbox + }% + \def\tikztiming@coldist{2\tabcolsep}% + \let\tikztiming@tableheader\tikztiming@nicetabs@tableheader + \let\tikztiming@tablerules\tikztiming@nicetabs@tablerules + }, + timing/nicetabs/no nice tabs/.style={/tikz/timing/no nice tabs}, + timing/nicetabs/off/.style={/tikz/timing/no nice tabs}, + timing/nicetabs/nice tabs/.style={/tikz/timing/nice tabs}, + timing/nicetabs/on/.style={/tikz/timing/nice tabs}, +} +% +\tikzset{timing/nice tabs}% +% \end{macrocode} +% +% Use the \pkg{pgfopts} to handle the package options. +% \begin{macrocode} +\RequirePackage{pgfopts} +\ProcessPgfOptions{/tikz/timing/nicetabs} +% \end{macrocode} +% \iffalse +% +%<*lib-counters> +% \fi +% +% \subsubsection{Counters} +% +% \begin{macrocode} +\tikzset{% + timing/new counter/.style={timing/counter/new={#1}}, + timing/counter/.cd, + new/.code={\tikztiming@counter@new{#1}}, + new/.value required, + opt/.cd, + char/.estore in=\tikztiming@counter@char, + reset char/.estore in=\tikztiming@counter@resetchar, + base/.estore in=\tikztiming@counter@base, + half width char/.estore in=\tikztiming@counter@hwchar, + char/.value required, + reset char/.value required, + base/.value required, + half width char/.value required, +} +% \end{macrocode} +% +% \begin{macro}{\tikztiming@counter@new}[1]{Styles} +% \begin{macrocode} +\def\tikztiming@counter@new#1{% + \let\tikztiming@counter@char\empty + \let\tikztiming@counter@resetchar\empty + \def\tikztiming@counter@base{10}% + \let\tikztiming@counter@hwchar\relax + \pgfqkeys{/tikz/timing/counter/opt}{#1}% + \ifx\tikztiming@counter@char\empty + \PackageError{tikz-timing-counters}{Counter character must be given using + the 'char' key!}% + \else + \edef\@tempa{% + \noexpand\tikztiming@counter@new@{\tikztiming@counter@char}{\tikztiming@counter@base}% + {\tikztiming@counter@hwchar}{\tikztiming@counter@resetchar}% + }% + \expandafter\@tempa + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@counter@new@}[4]{Character}{Base}{Half Width +% Character}{Reset Character} +% \begin{macrocode} +\def\tikztiming@counter@new@#1#2#3#4{% + \newcounter{tikztiming@counter@#1}% + \tikzset{timing/counter/#1/.append style={}}% + \tikztimingmetachar{#1}[1]{##1D{[timing/counter/#1]\tikztiming@counter@vs{#1}{#2}}}% + \ifx\tikztiming@counter@hwchar\empty\else + \ifx\tikztiming@counter@hwchar\relax + \tikztiming@iflower{#1}{}% + {\lowercase{\tikztimingmetachar{#1}}[1]% + {##1d{[timing/counter/#1]\tikztiming@counter@vs{#1}{#2}}}}% + \else + \tikztimingmetachar{#3}[1]{##1d{[timing/counter/#1]\tikztiming@counter@vs{#1}{#2}}}% + \fi + \fi + \ifx\tikztiming@counter@resetchar\empty\else + \tikztimingmetachar{#4}[1]{[|/utils/exec=\tikztiming@counter@reset{#1}{##1}|]}% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@counter@reset}[2]{Character to Reset}{Reset value} +% The counter is set first using pgf to round the value correctly and then again +% with \cs{setcounter} to make it global. +% \begin{macrocode} +\def\tikztiming@counter@reset#1#2{% + \pgfmathsetcounter{tikztiming@counter@#1}{round((#2)/\tikztiming@wscale)}% + \setcounter{tikztiming@counter@#1}{\value{tikztiming@counter@#1}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@counter@vs}[2]{Character}{Base} +% \begin{macrocode} +\def\tikztiming@counter@vs#1#2{% + \pgfmathdectoBase\pgfmathresult{\value{tikztiming@counter@#1}}{#2}% + \pgfmathresult + \stepcounter{tikztiming@counter@#1}% +} +% \end{macrocode} +% \end{macro} +% +% Use the \pkg{pgfopts} to handle the package options. +% \begin{macrocode} +\RequirePackage{pgfopts} +\ProcessPgfOptions{/tikz/timing/counter} +% \end{macrocode} +% \iffalse +% +%<*lib-advnodes> +% \fi +% \begin{macrocode} + +\let\tikztiming@orig@oldnodecenter\tikztiming@oldnodecenter + +\tikzset{timing/nodes/.cd, + simple/.code={% + \let\tikztiming@oldnodecenter\tikztiming@orig@oldnodecenter + \tikzset{% + timing/inline node/.style={shape=coordinate}, + }% + }, + advanced/.code={% + \let\tikztiming@oldnodecenter\@gobble + \tikzset{% + timing/inline node/.style={shape=tikztiming coordinate}, + timing/nodes/new center, + }% + }, + old center/.code={% + \let\tikztiming@nodecenteranchor\tikztiming@old@nodecenteranchor + },% + new center/.code={% + \let\tikztiming@nodecenteranchor\empty + },% +} +\tikzset{timing/nodes/.cd,advanced,new center} + +\def\anchoralias#1#2{% + \expandafter\def + \csname pgf@anchor@\shape@name @#1\expandafter\endcsname + \expandafter{\csname pgf@anchor@\shape@name @#2\endcsname}% +} + +\def\tikztiming@anchorpoint#1#2#3{% + \pgf@xa=#2\relax + \pgf@ya=#3\relax + \expandafter\edef\csname#1\endcsname{% + \pgf@x=\the\pgf@xa\relax + \pgf@y=\the\pgf@ya\relax + }% + \expandafter\addtosavedmacro\csname#1\endcsname } -\tikztimingdef{XE}{% - \code{\setcounter{tikztimingtranspos}{1}}% - \code{\setcounter{tikztimingtrans}{-1}}% - \tikztiminguse{XD}{#1}% +% \end{macrocode} +% +% \begin{macro}{\tikztiming@tryanchor@}[2]{From}{To} +% \begin{macrocode} +\def\tikztiming@tryanchor#1#2{% + \let\tikztiming@next\relax + \ifnum\tikztiming@debug>2 + \message{^^J Try Anchor: '#1' '#2' ^^J }% + \def\tikztiming@next{\message{^^J TERM ^^J}}% + \fi + \ifx\relax#1\empty\else + \ifx\relax#2\empty\else + \def\tikztiming@next{% + \@ifundefined{tikztiming@anchors@#1@#2}% + {% + \edef\@tempa{% + {\csname tikztiming@alias@#1\endcsname}% + {\csname tikztiming@alias@#2\endcsname}% + }% + \expandafter\tikztiming@tryanchor@\@tempa{#1}{#2}% + }% + {\let\tikztiming@tryanchor\@gobbletwo + \ifnum\tikztiming@debug>2 + \message{^^J Anchor: '#1' '#2' ^^J }% + \fi + \@nameuse{tikztiming@anchors@#1@#2}% + }% + }% + \fi\fi + \tikztiming@next } -\tikztimingdef{ME}{% - \code{\setcounter{tikztimingtranspos}{1}}% - \code{\setcounter{tikztimingtrans}{-1}}% - \tikztiminguse{MD}{#1}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tikztiming@tryanchor@}[4]{Alias From}{Alias To}{From}{To} +% \begin{macrocode} +\def\tikztiming@tryanchor@#1#2#3#4{% + \tikztiming@tryanchor{#3}{#2}% + \tikztiming@tryanchor{#1}{#4}% + \tikztiming@tryanchor{#1}{#2}% + \let\tikztiming@tryanchor@\@gobblefour + \tikztiming@tryanchor{#3}{}% + \tikztiming@tryanchor{}{#4}% } -\def\tikztiming@nocombine@E{}%% -\def\tikztiming@nocombine@e{}%% % \end{macrocode} +% \end{macro} +% % \begin{macrocode} -% -%<*package> +\pgfdeclareshape{tikztiming coordinate}{% + \savedmacro\anchorpoints{% + \let\anchorpoint\tikztiming@anchorpoint + \let\slope\@tempdima + \let\dslope\@tempdimb + \let\zslope\@tempdimc + \let\height\pgf@yb + \let\fromchar\tikztiming@node@fromchar + \let\tochar\tikztiming@node@tochar + % + \ifnum\tikztiming@debug>2 + \message{^^J Node: \fromchar \tochar ^^J}% + \fi + % + \edef\@tempa{{timing/\tochar}}% + \expandafter\lowercase\expandafter + {\expandafter\tikzset\@tempa}% + \pgfpointxy{\timingslope}{0}% + \slope=\pgf@x\relax + \pgfpointxy{\timingdslope}{0}% + \dslope=\pgf@x\relax + \pgfpointxy{\timingzslope}{0}% + \zslope=\pgf@x\relax + \pgfpointxy{0}{\timingheight}% + \height=\pgf@y\relax + \edef\anchorpoints{% + \noexpand\pgf@yb=\the\height\relax + \let\noexpand\height\noexpand\pgf@yb + }% + % + \tikztiming@tryanchor{\fromchar}{\tochar}% + } + \savedanchor\lowpoint{% + \pgfpointanchor{timing/start base}{center}% + \pgf@x=0pt + }% + \anchor{origin}{% + \pgfpointorigin + \anchorpoints + \@nameuse{originoffset} + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + }% + \anchor{old center}{% + \pgfpointorigin + \tikztiming@old@nodecenteranchor + }% + \anchor{new center}{\pgfpointorigin}% + \anchor{center}{% + \pgfpointorigin + \tikztiming@nodecenteranchor + }% + \anchor{MID}{\tikztiming@useanchor{HIGH}\advance\pgf@y by -.5\height\relax }% + \anchor{LOW}{\tikztiming@useanchor{HIGH}\advance\pgf@y by -\height\relax }% + \anchor{HIGH}{\tikztiming@useanchor{HIGH}}% + \anchor{TOP}{% + \tikztiming@nodes@getoffset + \tikztiming@useanchor{HIGH} + \advance\pgf@y by \pgf@ya\relax + }% + \anchor{BOTTOM}{% + \tikztiming@nodes@getoffset + \tikztiming@useanchor{HIGH} + \advance\pgf@y by -\pgf@ya\relax + \advance\pgf@y by -\height\relax + }% + \anchor{mid}{\tikztiming@useanchor{mid}}% + \anchor{low}{\tikztiming@useanchor{low}}% + \anchor{high}{\tikztiming@useanchor{high}}% + \anchor{low2}{\tikztiming@useanchor{low2}}% + \anchor{high2}{\tikztiming@useanchor{high2}}% + % + \anchorborder{\pgfpointorigin}% + % + \nodeparts{}% no text +} + +\def\tikztiming@nodes@getoffset{% + \begingroup + \pgfpointxy{0}{1}% + \pgfmathsetresultunitscale{\pgf@y}% + \pgfpoint{0}{\tikztiming@nodes@offset}% + \global\pgf@ya=\pgf@y + \endgroup +} + +\tikzset{% + timing/nodes/.cd, + offset/.store in=\tikztiming@nodes@offset, + offset=0.25, +} + +\def\tikztiming@nodecenteranchor{} + +\def\tikztiming@old@nodecenteranchor{% + \anchorpoints + \@ifundefined{oldcenter}% + {\@nameuse{originoffset}% + \pgf@x=-\pgf@x\relax + \pgf@y=-\pgf@y\relax + }% + {\@nameuse{oldcenter}}% +} + +\def\tikztiming@useanchor#1{% + \anchorpoints + \@ifundefined{#1}% + {\PackageError{tikz-timing}% + {No such anchor '#1' defined for this transition!}% + \pgfpointorigin + }% + {\@nameuse{#1}}% +} + +\tikzset{% + every tikztiming coordinate node/.style={anchor=origin}, +} % \end{macrocode} % \begin{macrocode} +\def\tikztiming@anchors#1#2{% + \@namedef{tikztiming@anchors@#1@#2}% +} +\def\tikztiming@anchorslet#1#2#3#4{% + \expandafter\let + \csname tikztiming@anchors@#1@#2\expandafter\endcsname + \csname tikztiming@anchors@#3@#4\endcsname +} -\tikztimingecopy{C}{T} -\def\tikztiming@nocombine@T{}% -\def\tikztiming@nocombine@C{}% -\def\tikztiming@nocombine@t{}% -\def\tikztiming@nocombine@c{}% -\def\tikztiming@nocombine@M{}% -\def\tikztiming@nocombine@m{}% -\def\tikztiming@nocombine@W{}% -\def\tikztiming@nocombine@w{}% +\tikztiming@anchors{@}{D}{% + \anchorpoint{originoffset}{0pt}{.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{0pt}{.5\height}% + \anchorpoint{low}{0pt}{-.5\height}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} -\tikztimingecopy{U}{D} -\tikztimingdef{UD}{\tikztiminguse{D@edge@D}{#1}} -\tikztimingdef{DU}{\tikztiminguse{D@edge@D}{#1}} +\tikztiming@anchors{@}{H}{% + \anchorpoint{originoffset}{0pt}{\height}% + \anchorpoint{high}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{0pt}% +} -%\tikztimingecopy{O}{D} -\tikztimingecopy{X}{Z} +\tikztiming@anchors{@}{L}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{\height}% +} + +\tikztiming@anchors{@}{T}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{\height}% +} + +\tikztiming@anchors{@}{Z}{% + \anchorpoint{originoffset}{0pt}{.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\tikztiming@anchors{D}{D}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{.5\height}% + \anchorpoint{high}{0pt}{.5\height}% + \anchorpoint{low}{0pt}{-.5\height}% +} + +\tikztiming@anchors{L}{H}{% + \anchorpoint{originoffset}{.5\slope}{.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{.5\slope}{.5\height}% + \anchorpoint{low}{-.5\slope}{-.5\height}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% +} + +\tikztiming@anchors{E}{H}{% + \anchorpoint{originoffset}{-.5\slope}{-.5\height}% + \anchorpoint{oldcenter}{-.5\slope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{.5\slope}{.5\height}% + \anchorpoint{low}{-.5\slope}{-.5\height}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% +} + +\tikztiming@anchors{T}{T}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% + \ifnum 1=\c@tikztimingtrans + \anchorpoint{originoffset}{.5\slope}{-.5\height}% + \anchorpoint{high}{-.5\slope}{.5\height}% + \anchorpoint{low}{.5\slope}{-.5\height}% + \else + \anchorpoint{originoffset}{.5\slope}{.5\height}% + \anchorpoint{high}{.5\slope}{.5\height}% + \anchorpoint{low}{-.5\slope}{-.5\height}% + \fi +} +\tikztiming@anchorslet{T}{E}{T}{T}% + +\tikztiming@anchors{T}{@}{% + \ifnum 1=\c@tikztimingtrans + \anchorpoint{high}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{0pt}% + \else + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{\height}% + \fi +} + +\tikztiming@anchors{H}{H}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{high}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{0pt}% +} + +\tikztiming@anchors{L}{L}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{\height}% +} + +\tikztiming@anchors{Z}{Z}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\tikztiming@anchors{E}{E}{% + \anchorpoint{mid}{0pt}{0pt}% + \ifnum 1=\c@tikztimingtrans + \anchorpoint{originoffset}{.5\slope}{.5\height}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% + \anchorpoint{high}{.5\slope}{.5\height}% + \anchorpoint{low}{-.5\slope}{-.5\height}% + \else + \anchorpoint{originoffset}{-.5\slope}{.5\height}% + \anchorpoint{oldcenter}{-.5\slope}{-.5\height}% + \anchorpoint{HIGH}{.5\slope}{.5\height}% + \anchorpoint{high}{-.5\slope}{.5\height}% + \anchorpoint{low}{.5\slope}{-.5\height}% + \fi +} + +\tikztiming@anchors{H}{L}{% + \anchorpoint{originoffset}{.5\slope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{-.5\slope}{.5\height}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% + \anchorpoint{low}{.5\slope}{-.5\height}% +} +\tikztiming@anchorslet{H}{E}{H}{L}% + +\tikztiming@anchors{E}{L}{% + \anchorpoint{originoffset}{-.5\slope}{.5\height}% + \anchorpoint{oldcenter}{-.5\slope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{-.5\slope}{.5\height}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% + \anchorpoint{low}{.5\slope}{-.5\height}% +} + +\tikztiming@anchors{E}{T}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% + \ifnum 1=\c@tikztimingtrans + \anchorpoint{originoffset}{-.5\slope}{-.5\height}% + \anchorpoint{oldcenter}{-.5\slope}{-.5\height}% + \anchorpoint{high}{.5\slope}{.5\height}% + \anchorpoint{low}{-.5\slope}{-.5\height}% + \else + \anchorpoint{originoffset}{-.5\slope}{.5\height}% + \anchorpoint{oldcenter}{-.5\slope}{-.5\height}% + \anchorpoint{high}{-.5\slope}{.5\height}% + \anchorpoint{low}{.5\slope}{-.5\height}% + \fi +} + +\tikztiming@anchors{E}{Z}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{oldcenter}{-\zslope}{-.5\height}% + \anchorpoint{HIGH}{-\zslope}{.5\height}% + \anchorpoint{high}{-\zslope}{.5\height}% + \anchorpoint{low}{-\zslope}{-.5\height}% +} + +\tikztiming@anchors{Z}{D}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{.5\height}% + \anchorpoint{high}{.5\dslope}{.5\height}% + \anchorpoint{low}{.5\dslope}{-.5\height}% +} + +\tikztiming@anchors{D}{Z}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{oldcenter}{-.5\dslope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\dslope}{.5\height}% + \anchorpoint{high}{-.5\dslope}{.5\height}% + \anchorpoint{low}{-.5\dslope}{-.5\height}% +} + +\tikztiming@anchors{D}{H}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{oldcenter}{-.5\dslope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\dslope}{.5\height}% + \anchorpoint{high}{-.5\dslope}{.5\height}% + \anchorpoint{high2}{.5\dslope}{.5\height}% + \anchorpoint{low}{-.5\dslope}{-.5\height}% +} + +\tikztiming@anchors{D}{L}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{oldcenter}{-.5\dslope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\dslope}{.5\height}% + \anchorpoint{high}{-.5\dslope}{.5\height}% + \anchorpoint{low2}{-.5\dslope}{-.5\height}% + \anchorpoint{low}{.5\dslope}{-.5\height}% +} +\tikztiming@anchorslet{D}{T}{D}{L}% + +\tikztiming@anchors{D@edge@}{D}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{oldcenter}{-.5\dslope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\dslope}{.5\height}% + \anchorpoint{high}{-.5\dslope}{.5\height}% + \anchorpoint{high2}{.5\dslope}{.5\height}% + \anchorpoint{low}{-.5\dslope}{-.5\height}% + \anchorpoint{low2}{.5\dslope}{-.5\height}% +} +\tikztiming@anchorslet{D}{U}{D@edge@}{D} +\tikztiming@anchorslet{U}{D}{D@edge@}{D} +\tikztiming@anchorslet{D}{D@edge@}{D@edge@}{D} +\tikztiming@anchorslet{D@edge@}{D@edge@}{D@edge@}{D} +\tikztiming@anchorslet{D}{E}{D@edge@}{D} +\tikztiming@anchorslet{E}{D}{D@edge@}{D} + +\tikztiming@anchorslet{L}{E}{L}{H}% +\tikztiming@anchorslet{L}{T}{L}{H}% +\tikztiming@anchorslet{H}{T}{H}{L}% +\tikztiming@anchorslet{T}{H}{H}{L}% + +\tikztiming@anchors{D}{D}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{oldcenter}{0pt}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{0pt}{.5\height}% + \anchorpoint{low}{0pt}{-.5\height}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} +\tikztiming@anchorslet{D}{@}{D}{D} +\tikztiming@anchorslet{E}{@}{D}{D} +\tikztiming@anchorslet{U}{U}{D}{D} + +\tikztiming@anchorslet{@}{E}{@}{D} + +\tikztiming@anchors{L}{D}{% + \anchorpoint{originoffset}{.5\dslope}{.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{.5\dslope}{.5\height}% + \anchorpoint{low}{-.5\dslope}{-.5\height}% + \anchorpoint{low2}{.5\dslope}{-.5\height}% + \anchorpoint{HIGH}{-.5\dslope}{.5\height}% +} + +\tikztiming@anchors{T}{D}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\dslope}{.5\height}% + \ifnum 1=\c@tikztimingtrans + \anchorpoint{originoffset}{.5\dslope}{-.5\height}% + \anchorpoint{high}{-.5\dslope}{.5\height}% + \anchorpoint{high2}{.5\dslope}{.5\height}% + \anchorpoint{low}{.5\dslope}{-.5\height}% + \else + \anchorpoint{originoffset}{.5\dslope}{.5\height}% + \anchorpoint{high}{.5\dslope}{.5\height}% + \anchorpoint{low}{-.5\dslope}{-.5\height}% + \anchorpoint{low2}{.5\dslope}{-.5\height}% + \fi +} + +\tikztiming@anchors{H}{D}{% + \anchorpoint{originoffset}{.5\dslope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\dslope}{.5\height}% + \anchorpoint{high}{-.5\dslope}{.5\height}% + \anchorpoint{high2}{.5\dslope}{.5\height}% + \anchorpoint{low}{.5\dslope}{-.5\height}% +} + +\tikztiming@anchors{Z}{E}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{\zslope}{.5\height}% + \anchorpoint{low}{\zslope}{-.5\height}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\tikztiming@anchors{Z}{H}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{\zslope}{.5\height}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\tikztiming@anchors{Z}{T}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{.5\height}% + \ifnum1=\c@tikztimingtrans\relax + \anchorpoint{low}{\zslope}{-.5\height}% + \else + \anchorpoint{high}{\zslope}{.5\height}% + \fi +} + +\tikztiming@anchors{T}{H}{% + \ifnum1=\c@tikztimingtrans\relax + \anchorpoint{high}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{0pt}% + \else + \anchorpoint{originoffset}{.5\slope}{.5\height}% + \anchorpoint{low}{-.5\slope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{.5\slope}{.5\height}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% + \fi +} + +\tikztiming@anchors{T}{L}{% + \ifnum1=\c@tikztimingtrans\relax + \anchorpoint{originoffset}{.5\slope}{-.5\height}% + \anchorpoint{low}{.5\slope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{-.5\slope}{.5\height}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% + \else + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{\height}% + \fi +} + +\tikztiming@anchors{T}{Z}{% + \ifnum1=\c@tikztimingtrans\relax + \anchorpoint{high}{0pt}{0pt}% + \anchorpoint{mid}{\zslope}{-.5\height}% + \anchorpoint{HIGH}{0pt}{0pt}% + \else + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{mid}{\zslope}{.5\height}% + \anchorpoint{HIGH}{0pt}{\height}% + \fi +} + +\tikztiming@anchors{Z}{L}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{low}{\zslope}{-.5\height}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\tikztiming@anchors{H}{Z}{% + \anchorpoint{high}{0pt}{0pt}% + \anchorpoint{mid}{\zslope}{-.5\height}% + \anchorpoint{HIGH}{0pt}{0pt}% +} + +\tikztiming@anchors{L}{Z}{% + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{mid}{\zslope}{.5\height}% + \anchorpoint{HIGH}{0pt}{\height}% +} + +\tikztiming@anchors{Z}{Z}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\tikztiming@anchors{H}{@}{% + \anchorpoint{high}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{0pt}% +} + +\tikztiming@anchors{L}{@}{% + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{\height}% +} + +\tikztiming@anchors{Z}{@}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\tikztiming@anchors{}{@}{% + \anchorpoint{originoffset}{0pt}{.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{0pt}{.5\height}% + \anchorpoint{low}{0pt}{-.5\height}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} % \end{macrocode} +% +% Use the \pkg{pgfopts} to handle the package options. % \begin{macrocode} -% -%<*lib-arrows> +\RequirePackage{pgfopts} +\ProcessPgfOptions{/tikz/timing/node} % \end{macrocode} +% \iffalse +% +%<*lib-interval> +% \fi % \begin{macrocode} -\tikztimingchar{A}{++(0,0)}{% - \newdraw [\style] -- ++(0,\height) - \newdraw ++(#1,-\height) + +\let\tikztiming@linterval\relax +\let\tikztiming@rinterval\relax + +\tikztimingdef{LZ}{ + \tikztiming@linterval + {\newdraw [\style]} + {-- ++(\zslope,+\height/2.)} + -- ++($ (#1,0) - (\zslope,0) $) } -\def\tikztiming@nocombine@A{}% -\def\tikztiming@nocombine@a{}% -\tikztiminglet{AS}{SS} -\tikztiminglet{AH}{H} -\tikztiminglet{AZ}{Z} -\tikztimingdef{ZA}{ - ++(0,-0.5*\height) - \tikztiminguse{A}{#1} -} -\tikztimingdef{HA}{ - ++(0,-\height) - \tikztiminguse{A}{#1} -} -\tikztiminglet{XA}{ZA} -\tikztiminglet{MA}{ZA} -\tikztiminglet{AX}{AZ} -\tikztiminglet{AM}{AZ} -\tikztiminglet{LA}{A} -\tikztiminglet{AL}{LL} -\tikztiminglet{AD}{DD} -\tikztiminglet{AE}{LE} -\tikztiminglet{AU}{UU} -\tikztiminglet{SA}{A} -\tikztiminglet{AG}{G} -\tikztiminglet{AT}{LT} -\tikztiminglet{AC}{LC} -\tikztiminglet{DA}{A} -\tikztiminglet{UA}{A} -\tikztiminglet{TA}{A} -\tikztiminglet{CA}{A} -\tikztiminglet{EA}{A} -\tikztimingecopy{W}{A} +\tikztimingdef{HZ}{% + \tikztiming@linterval + {\newdraw [\style]} + {-- ++(\zslope,-\height/2.)} + -- ++($ (#1,0) - (\zslope,0) $) +} + +\tikztimingdef{TZ}{% + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + \tikztiming@linterval + {\newdraw [\style]} + {-- ++(\zslope,\value{tikztimingtrans}*\height/2.)} + -- ++($ (#1,0) - (\zslope,0) $) +} + +\tikztimingdef{ZL}{% + \tikztiming@rinterval + {\newdraw} + {-- ++(\zslope,-\height/2.)} + -- ++($ (#1,0) - (\zslope,0) $) +} + +\tikztimingdef{ZH}{% + \tikztiming@rinterval + {\newdraw} + {-- ++(\zslope,\height/2.)} + -- ++($ (#1,0) - (\zslope,0) $) +} + +\tikztimingdef{ZT}{% + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + \tikztiming@rinterval + {\newdraw [\style]} + {-- ++(\zslope,\value{tikztimingtrans}*\height/2.)} + -- ++($ (#1,0) - (\zslope,0) $) +} + +\def\tikztiming@onetwo#1#2{#1#2} +\def\tikztiming@twoone#1#2{#2#1} + +\let\tikztiming@linterval\tikztiming@onetwo +\let\tikztiming@rinterval\tikztiming@onetwo + +\tikzset{timing/interval/.code={\pgfqkeys{/tikz/timing/interval}{#1}}} +\tikzset{timing/interval/.cd, + lo/.style={/tikz/timing/interval/left open}, + lc/.style={/tikz/timing/interval/left close}, + ro/.style={/tikz/timing/interval/right open}, + rc/.style={/tikz/timing/interval/right close}, + left close/.code={\let\tikztiming@linterval\tikztiming@onetwo}, + left open/.code={\let\tikztiming@linterval\tikztiming@twoone}, + right open/.code={\let\tikztiming@rinterval\tikztiming@onetwo}, + right close/.code={\let\tikztiming@rinterval\tikztiming@twoone}, +} +\tikzset{ + timing/interval/normal/.style={/tikz/timing/interval/left close,/tikz/timing/interval/right open}, + timing/interval/verilog/.style={/tikz/timing/interval/normal}, + timing/interval/metachar/.style={/tikz/timing/metachar={#1}[2]{[timing/interval={##2}]}}, +} + +% \end{macrocode} +% \iffalse +% +% \fi +% +% \subsection{Beamer Overlay Support} +% Experimental library for marginal beamer overlay support. It will change in future versions. Use at own risk! +% +% \iffalse +%<*lib-beamer> +% \fi +% \begin{macrocode} + +\PackageWarning{\@currname}{This library is experimental and will change in future versions!}{}{} + +\tikztiming@defcode<#1>{ + \tikztiming@output@addcode{ + node [timing/save] (timing@save) {};% + \onslide<#1> + \draw [timing/restore] (timing@save) ++(0,0) + } + \tikztiming@parser +} +% \end{macrocode} +% \iffalse +% +% \fi +% +% \section{Compatibility with \protect\pkg{ifsym} Macros} +% +% \iffalse +%<*lib-ifsym> +% \fi +% +% Set up styles to match behaviour of \pkg{ifsym}. Slope and size is is adjusted. +% The macros only have 60\% of the height. +% \begin{macrocode} +\tikzset{% + timing/ifsym/macro/.style={/tikz/timing/ifsym,/utils/exec={\pgfmathparse{.6*\f@size}\let\ysize\pgfmathresult},/tikz/y=\ysize}, + timing/ifsym/.style={% + /tikz,timing/slope=0,x=\f@size,y=\f@size,line width=0.1ex, % \end{macrocode} +% Define "|" to create a glitch. While it can be ignored in "H|L" or "L|H" it can +% also be used like "L|L" and "H|H". % \begin{macrocode} -% -%<*package> + timing/metachar={|}{G}, +% \end{macrocode} +% The "X" is used for "M" and is set to black. +% \begin{macrocode} + timing/x/.style={}, +% \end{macrocode} +% Define "M"/"m" to be equal to "X"/"x": +% \begin{macrocode} + timing/metachar={M}[1]{#1X}, + timing/metachar={m}[1]{#1x}, +% \end{macrocode} +% +% Code changes: +% \begin{macrocode} + /utils/exec={% +% \end{macrocode} +% +% The |setdslope| macro is redefined to allow value higher than 1. +% \begin{macrocode} +\def\tikztimingsetdslope##1{% + \pgfmathparse{max(0.0,##1)}% + \let\tikztiming@dslope\pgfmathresult + \edef\timingdslope{\tikztiming@dslope*\noexpand\timingwidth}% +} +% \end{macrocode} +% +% The "<" and ">" characters are defined as code characters. They +% check if there appear twice which doubles their width. +% A macro is used to remove the second appearance from the input. +% \begin{macrocode} +\tikztiming@defcode{<}{% + \@ifnextchar{<}% + {\tikztiming@ifsym@longslope{X}{D}}% + {\tikztiming@parser [timing/dslope=1] 0Xd;}% +}% +\tikztiming@defcode{>}{% + \@ifnextchar{>}% + {\tikztiming@ifsym@longslope{D}{X}}% + {\tikztiming@parser [timing/dslope=1] 0Dx;}% +}% +\def\tikztiming@ifsym@longslope##1##2##3{ + \tikztiming@parser [timing/dslope=2.] 0##1 ##2;% +}% +% \end{macrocode} +% \begin{macrocode} + }}, +} +% \end{macrocode} +% +% Define library options. +% \begin{macrocode} +\tikzset{% + timing/ifsym/.cd, + provide/.code={\let\tikztiming@ifsym@def\providecommand}, + renew/.code={\let\tikztiming@ifsym@def\renewcommand}, + new/.code={\let\tikztiming@ifsym@def\newcommand}, + off/.code={\let\tikztiming@ifsym@def\@gobbletwo}, +} % \end{macrocode} % +% Execute library options. +% \begin{macrocode} +\tikzset{timing/ifsym/provide}% +\RequirePackage{pgfopts} +\ProcessPgfOptions{/tikz/timing/ifsym} +% \end{macrocode} +% +% Provide all timing symbol macros from |[electronic]{ifsym}|: +% \begin{macrocode} +\tikztiming@ifsym@def{\RaisingEdge}{\hbox{\texttiming[timing/ifsym/macro]{.4L .4H}}} +\tikztiming@ifsym@def{\FallingEdge}{\hbox{\texttiming[timing/ifsym/macro]{.4H .4L}}} +\tikztiming@ifsym@def{\ShortPulseHigh}{\hbox{\texttiming[timing/ifsym/macro]{.4L .2H .4L}}} +\tikztiming@ifsym@def{\ShortPulseLow}{\hbox{\texttiming[timing/ifsym/macro]{.4H .2L .4H}}} +\tikztiming@ifsym@def{\PulseHigh}{\hbox{\texttiming[timing/ifsym/macro]{.4L .6H .4L}}} +\tikztiming@ifsym@def{\PulseLow}{\hbox{\texttiming[timing/ifsym/macro]{.4H .6L .4H}}} +\tikztiming@ifsym@def{\LongPulseHigh}{\hbox{\texttiming[timing/ifsym/macro]{.4L H .4L}}} +\tikztiming@ifsym@def{\LongPulseLow}{\hbox{\texttiming[timing/ifsym/macro]{.4H L .4H}}} +% \end{macrocode} +% +% Provide \cs{textifsym} macro: +% \begin{macro}{\textifsym} +% \begin{macrocode} +\tikztiming@ifsym@def{\textifsym}{\texttiming[timing/ifsym]} +% \end{macrocode} +% \end{macro} +% +% Clean-up: +% \begin{macrocode} +\let\tikztiming@ifsym@def\@undefined +% \end{macrocode} +% \iffalse +% +% \fi +% % \Finale \endinput -% diff --git a/Master/texmf-dist/source/latex/tikz-timing/tikz-timing.ins b/Master/texmf-dist/source/latex/tikz-timing/tikz-timing.ins index 384455cac41..197cbf569ee 100644 --- a/Master/texmf-dist/source/latex/tikz-timing/tikz-timing.ins +++ b/Master/texmf-dist/source/latex/tikz-timing/tikz-timing.ins @@ -1,4 +1,4 @@ -% $Id: tikz-timing.ins 1156 2009-07-28 01:16:20Z martin $ +% $Id: tikz-timing.ins 1567 2009-12-08 01:19:15Z martin $ \input docstrip.tex \preamble @@ -26,9 +26,17 @@ and the derived file tikz-timing.sty. \generate{% \file{tikz-timing.sty}{\from{tikz-timing.dtx}{package}}% - \file{tikz-timing-arrows.sty}{\from{tikz-timing.dtx}{lib-arrows}}% - \file{tikz-timing-either.sty}{\from{tikz-timing.dtx}{lib-either}}% - \file{tikz-timing-overlays.sty}{\from{tikz-timing.dtx}{lib-overlays}}% + \file{tikz-timing-arrows.sty}{\from{tikz-timing.dtx}{lib,lib-arrows}}% + \file{tikz-timing-either.sty}{\from{tikz-timing.dtx}{lib,lib-either}}% + \file{tikz-timing-overlays.sty}{\from{tikz-timing.dtx}{lib,lib-overlays}}% + \file{tikz-timing-clockarrows.sty}{\from{tikz-timing.dtx}{lib,lib-clockarrows}}% + \file{tikz-timing-columntype.sty}{\from{tikz-timing.dtx}{lib,lib-columntype}}% + \file{tikz-timing-nicetabs.sty}{\from{tikz-timing.dtx}{lib,lib-nicetabs}}% + \file{tikz-timing-counters.sty}{\from{tikz-timing.dtx}{lib,lib-counters}}% + \file{tikz-timing-advnodes.sty}{\from{tikz-timing.dtx}{lib,lib-advnodes}}% + \file{tikz-timing-interval.sty}{\from{tikz-timing.dtx}{lib,lib-interval}}% + \file{tikz-timing-beamer.sty}{\from{tikz-timing.dtx}{lib,lib-beamer}}% + \file{tikz-timing-ifsym.sty}{\from{tikz-timing.dtx}{lib,lib-ifsym}}% % \file{tikz-timing-examplecode.sty}{\from{tikz-timing.dtx}{examplecode}}% % \file{ydoc.sty}{\from{tikz-timing.dtx}{ydoc}}% } diff --git a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-advnodes.sty b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-advnodes.sty new file mode 100644 index 00000000000..74c6481058c --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-advnodes.sty @@ -0,0 +1,617 @@ +%% +%% This is file `tikz-timing-advnodes.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% tikz-timing.dtx (with options: `lib,lib-advnodes') +%% +%% Copyright (C) 2009 by Martin Scharrer +%% +%% This work 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 2008/05/04 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files tikz-timing.dtx, tikz-timing.ins +%% and the derived file tikz-timing.sty. +%% +\RequirePackage{svn-prov}[2009/05/03] +\ProvidesPackageSVN[tikz-timing-advnodes] + {$Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $} + [v0.7 + TikZ-Timing Library for + advanced nodes] +\GetFileInfoSVN*% +\RequirePackage{tikz-timing}[\filedate]% +\DefineFileInfoSVN + + +\let\tikztiming@orig@oldnodecenter\tikztiming@oldnodecenter + +\tikzset{timing/nodes/.cd, + simple/.code={% + \let\tikztiming@oldnodecenter\tikztiming@orig@oldnodecenter + \tikzset{% + timing/inline node/.style={shape=coordinate}, + }% + }, + advanced/.code={% + \let\tikztiming@oldnodecenter\@gobble + \tikzset{% + timing/inline node/.style={shape=tikztiming coordinate}, + timing/nodes/new center, + }% + }, + old center/.code={% + \let\tikztiming@nodecenteranchor\tikztiming@old@nodecenteranchor + },% + new center/.code={% + \let\tikztiming@nodecenteranchor\empty + },% +} +\tikzset{timing/nodes/.cd,advanced,new center} + +\def\anchoralias#1#2{% + \expandafter\def + \csname pgf@anchor@\shape@name @#1\expandafter\endcsname + \expandafter{\csname pgf@anchor@\shape@name @#2\endcsname}% +} + +\def\tikztiming@anchorpoint#1#2#3{% + \pgf@xa=#2\relax + \pgf@ya=#3\relax + \expandafter\edef\csname#1\endcsname{% + \pgf@x=\the\pgf@xa\relax + \pgf@y=\the\pgf@ya\relax + }% + \expandafter\addtosavedmacro\csname#1\endcsname +} +\def\tikztiming@tryanchor#1#2{% + \let\tikztiming@next\relax + \ifnum\tikztiming@debug>2 + \message{^^J Try Anchor: '#1' '#2' ^^J }% + \def\tikztiming@next{\message{^^J TERM ^^J}}% + \fi + \ifx\relax#1\empty\else + \ifx\relax#2\empty\else + \def\tikztiming@next{% + \@ifundefined{tikztiming@anchors@#1@#2}% + {% + \edef\@tempa{% + {\csname tikztiming@alias@#1\endcsname}% + {\csname tikztiming@alias@#2\endcsname}% + }% + \expandafter\tikztiming@tryanchor@\@tempa{#1}{#2}% + }% + {\let\tikztiming@tryanchor\@gobbletwo + \ifnum\tikztiming@debug>2 + \message{^^J Anchor: '#1' '#2' ^^J }% + \fi + \@nameuse{tikztiming@anchors@#1@#2}% + }% + }% + \fi\fi + \tikztiming@next +} +\def\tikztiming@tryanchor@#1#2#3#4{% + \tikztiming@tryanchor{#3}{#2}% + \tikztiming@tryanchor{#1}{#4}% + \tikztiming@tryanchor{#1}{#2}% + \let\tikztiming@tryanchor@\@gobblefour + \tikztiming@tryanchor{#3}{}% + \tikztiming@tryanchor{}{#4}% +} +\pgfdeclareshape{tikztiming coordinate}{% + \savedmacro\anchorpoints{% + \let\anchorpoint\tikztiming@anchorpoint + \let\slope\@tempdima + \let\dslope\@tempdimb + \let\zslope\@tempdimc + \let\height\pgf@yb + \let\fromchar\tikztiming@node@fromchar + \let\tochar\tikztiming@node@tochar + % + \ifnum\tikztiming@debug>2 + \message{^^J Node: \fromchar \tochar ^^J}% + \fi + % + \edef\@tempa{{timing/\tochar}}% + \expandafter\lowercase\expandafter + {\expandafter\tikzset\@tempa}% + \pgfpointxy{\timingslope}{0}% + \slope=\pgf@x\relax + \pgfpointxy{\timingdslope}{0}% + \dslope=\pgf@x\relax + \pgfpointxy{\timingzslope}{0}% + \zslope=\pgf@x\relax + \pgfpointxy{0}{\timingheight}% + \height=\pgf@y\relax + \edef\anchorpoints{% + \noexpand\pgf@yb=\the\height\relax + \let\noexpand\height\noexpand\pgf@yb + }% + % + \tikztiming@tryanchor{\fromchar}{\tochar}% + } + \savedanchor\lowpoint{% + \pgfpointanchor{timing/start base}{center}% + \pgf@x=0pt + }% + \anchor{origin}{% + \pgfpointorigin + \anchorpoints + \@nameuse{originoffset} + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + }% + \anchor{old center}{% + \pgfpointorigin + \tikztiming@old@nodecenteranchor + }% + \anchor{new center}{\pgfpointorigin}% + \anchor{center}{% + \pgfpointorigin + \tikztiming@nodecenteranchor + }% + \anchor{MID}{\tikztiming@useanchor{HIGH}\advance\pgf@y by -.5\height\relax }% + \anchor{LOW}{\tikztiming@useanchor{HIGH}\advance\pgf@y by -\height\relax }% + \anchor{HIGH}{\tikztiming@useanchor{HIGH}}% + \anchor{TOP}{% + \tikztiming@nodes@getoffset + \tikztiming@useanchor{HIGH} + \advance\pgf@y by \pgf@ya\relax + }% + \anchor{BOTTOM}{% + \tikztiming@nodes@getoffset + \tikztiming@useanchor{HIGH} + \advance\pgf@y by -\pgf@ya\relax + \advance\pgf@y by -\height\relax + }% + \anchor{mid}{\tikztiming@useanchor{mid}}% + \anchor{low}{\tikztiming@useanchor{low}}% + \anchor{high}{\tikztiming@useanchor{high}}% + \anchor{low2}{\tikztiming@useanchor{low2}}% + \anchor{high2}{\tikztiming@useanchor{high2}}% + % + \anchorborder{\pgfpointorigin}% + % + \nodeparts{}% no text +} + +\def\tikztiming@nodes@getoffset{% + \begingroup + \pgfpointxy{0}{1}% + \pgfmathsetresultunitscale{\pgf@y}% + \pgfpoint{0}{\tikztiming@nodes@offset}% + \global\pgf@ya=\pgf@y + \endgroup +} + +\tikzset{% + timing/nodes/.cd, + offset/.store in=\tikztiming@nodes@offset, + offset=0.25, +} + +\def\tikztiming@nodecenteranchor{} + +\def\tikztiming@old@nodecenteranchor{% + \anchorpoints + \@ifundefined{oldcenter}% + {\@nameuse{originoffset}% + \pgf@x=-\pgf@x\relax + \pgf@y=-\pgf@y\relax + }% + {\@nameuse{oldcenter}}% +} + +\def\tikztiming@useanchor#1{% + \anchorpoints + \@ifundefined{#1}% + {\PackageError{tikz-timing}% + {No such anchor '#1' defined for this transition!}% + \pgfpointorigin + }% + {\@nameuse{#1}}% +} + +\tikzset{% + every tikztiming coordinate node/.style={anchor=origin}, +} +\def\tikztiming@anchors#1#2{% + \@namedef{tikztiming@anchors@#1@#2}% +} +\def\tikztiming@anchorslet#1#2#3#4{% + \expandafter\let + \csname tikztiming@anchors@#1@#2\expandafter\endcsname + \csname tikztiming@anchors@#3@#4\endcsname +} + +\tikztiming@anchors{@}{D}{% + \anchorpoint{originoffset}{0pt}{.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{0pt}{.5\height}% + \anchorpoint{low}{0pt}{-.5\height}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\tikztiming@anchors{@}{H}{% + \anchorpoint{originoffset}{0pt}{\height}% + \anchorpoint{high}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{0pt}% +} + +\tikztiming@anchors{@}{L}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{\height}% +} + +\tikztiming@anchors{@}{T}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{\height}% +} + +\tikztiming@anchors{@}{Z}{% + \anchorpoint{originoffset}{0pt}{.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\tikztiming@anchors{D}{D}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{.5\height}% + \anchorpoint{high}{0pt}{.5\height}% + \anchorpoint{low}{0pt}{-.5\height}% +} + +\tikztiming@anchors{L}{H}{% + \anchorpoint{originoffset}{.5\slope}{.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{.5\slope}{.5\height}% + \anchorpoint{low}{-.5\slope}{-.5\height}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% +} + +\tikztiming@anchors{E}{H}{% + \anchorpoint{originoffset}{-.5\slope}{-.5\height}% + \anchorpoint{oldcenter}{-.5\slope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{.5\slope}{.5\height}% + \anchorpoint{low}{-.5\slope}{-.5\height}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% +} + +\tikztiming@anchors{T}{T}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% + \ifnum 1=\c@tikztimingtrans + \anchorpoint{originoffset}{.5\slope}{-.5\height}% + \anchorpoint{high}{-.5\slope}{.5\height}% + \anchorpoint{low}{.5\slope}{-.5\height}% + \else + \anchorpoint{originoffset}{.5\slope}{.5\height}% + \anchorpoint{high}{.5\slope}{.5\height}% + \anchorpoint{low}{-.5\slope}{-.5\height}% + \fi +} +\tikztiming@anchorslet{T}{E}{T}{T}% + +\tikztiming@anchors{T}{@}{% + \ifnum 1=\c@tikztimingtrans + \anchorpoint{high}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{0pt}% + \else + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{\height}% + \fi +} + +\tikztiming@anchors{H}{H}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{high}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{0pt}% +} + +\tikztiming@anchors{L}{L}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{\height}% +} + +\tikztiming@anchors{Z}{Z}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\tikztiming@anchors{E}{E}{% + \anchorpoint{mid}{0pt}{0pt}% + \ifnum 1=\c@tikztimingtrans + \anchorpoint{originoffset}{.5\slope}{.5\height}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% + \anchorpoint{high}{.5\slope}{.5\height}% + \anchorpoint{low}{-.5\slope}{-.5\height}% + \else + \anchorpoint{originoffset}{-.5\slope}{.5\height}% + \anchorpoint{oldcenter}{-.5\slope}{-.5\height}% + \anchorpoint{HIGH}{.5\slope}{.5\height}% + \anchorpoint{high}{-.5\slope}{.5\height}% + \anchorpoint{low}{.5\slope}{-.5\height}% + \fi +} + +\tikztiming@anchors{H}{L}{% + \anchorpoint{originoffset}{.5\slope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{-.5\slope}{.5\height}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% + \anchorpoint{low}{.5\slope}{-.5\height}% +} +\tikztiming@anchorslet{H}{E}{H}{L}% + +\tikztiming@anchors{E}{L}{% + \anchorpoint{originoffset}{-.5\slope}{.5\height}% + \anchorpoint{oldcenter}{-.5\slope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{-.5\slope}{.5\height}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% + \anchorpoint{low}{.5\slope}{-.5\height}% +} + +\tikztiming@anchors{E}{T}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% + \ifnum 1=\c@tikztimingtrans + \anchorpoint{originoffset}{-.5\slope}{-.5\height}% + \anchorpoint{oldcenter}{-.5\slope}{-.5\height}% + \anchorpoint{high}{.5\slope}{.5\height}% + \anchorpoint{low}{-.5\slope}{-.5\height}% + \else + \anchorpoint{originoffset}{-.5\slope}{.5\height}% + \anchorpoint{oldcenter}{-.5\slope}{-.5\height}% + \anchorpoint{high}{-.5\slope}{.5\height}% + \anchorpoint{low}{.5\slope}{-.5\height}% + \fi +} + +\tikztiming@anchors{E}{Z}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{oldcenter}{-\zslope}{-.5\height}% + \anchorpoint{HIGH}{-\zslope}{.5\height}% + \anchorpoint{high}{-\zslope}{.5\height}% + \anchorpoint{low}{-\zslope}{-.5\height}% +} + +\tikztiming@anchors{Z}{D}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{.5\height}% + \anchorpoint{high}{.5\dslope}{.5\height}% + \anchorpoint{low}{.5\dslope}{-.5\height}% +} + +\tikztiming@anchors{D}{Z}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{oldcenter}{-.5\dslope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\dslope}{.5\height}% + \anchorpoint{high}{-.5\dslope}{.5\height}% + \anchorpoint{low}{-.5\dslope}{-.5\height}% +} + +\tikztiming@anchors{D}{H}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{oldcenter}{-.5\dslope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\dslope}{.5\height}% + \anchorpoint{high}{-.5\dslope}{.5\height}% + \anchorpoint{high2}{.5\dslope}{.5\height}% + \anchorpoint{low}{-.5\dslope}{-.5\height}% +} + +\tikztiming@anchors{D}{L}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{oldcenter}{-.5\dslope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\dslope}{.5\height}% + \anchorpoint{high}{-.5\dslope}{.5\height}% + \anchorpoint{low2}{-.5\dslope}{-.5\height}% + \anchorpoint{low}{.5\dslope}{-.5\height}% +} +\tikztiming@anchorslet{D}{T}{D}{L}% + +\tikztiming@anchors{D@edge@}{D}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{oldcenter}{-.5\dslope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\dslope}{.5\height}% + \anchorpoint{high}{-.5\dslope}{.5\height}% + \anchorpoint{high2}{.5\dslope}{.5\height}% + \anchorpoint{low}{-.5\dslope}{-.5\height}% + \anchorpoint{low2}{.5\dslope}{-.5\height}% +} +\tikztiming@anchorslet{D}{U}{D@edge@}{D} +\tikztiming@anchorslet{U}{D}{D@edge@}{D} +\tikztiming@anchorslet{D}{D@edge@}{D@edge@}{D} +\tikztiming@anchorslet{D@edge@}{D@edge@}{D@edge@}{D} +\tikztiming@anchorslet{D}{E}{D@edge@}{D} +\tikztiming@anchorslet{E}{D}{D@edge@}{D} + +\tikztiming@anchorslet{L}{E}{L}{H}% +\tikztiming@anchorslet{L}{T}{L}{H}% +\tikztiming@anchorslet{H}{T}{H}{L}% +\tikztiming@anchorslet{T}{H}{H}{L}% + +\tikztiming@anchors{D}{D}{% + \anchorpoint{originoffset}{0pt}{0pt}% + \anchorpoint{oldcenter}{0pt}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{0pt}{.5\height}% + \anchorpoint{low}{0pt}{-.5\height}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} +\tikztiming@anchorslet{D}{@}{D}{D} +\tikztiming@anchorslet{E}{@}{D}{D} +\tikztiming@anchorslet{U}{U}{D}{D} + +\tikztiming@anchorslet{@}{E}{@}{D} + +\tikztiming@anchors{L}{D}{% + \anchorpoint{originoffset}{.5\dslope}{.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{.5\dslope}{.5\height}% + \anchorpoint{low}{-.5\dslope}{-.5\height}% + \anchorpoint{low2}{.5\dslope}{-.5\height}% + \anchorpoint{HIGH}{-.5\dslope}{.5\height}% +} + +\tikztiming@anchors{T}{D}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\dslope}{.5\height}% + \ifnum 1=\c@tikztimingtrans + \anchorpoint{originoffset}{.5\dslope}{-.5\height}% + \anchorpoint{high}{-.5\dslope}{.5\height}% + \anchorpoint{high2}{.5\dslope}{.5\height}% + \anchorpoint{low}{.5\dslope}{-.5\height}% + \else + \anchorpoint{originoffset}{.5\dslope}{.5\height}% + \anchorpoint{high}{.5\dslope}{.5\height}% + \anchorpoint{low}{-.5\dslope}{-.5\height}% + \anchorpoint{low2}{.5\dslope}{-.5\height}% + \fi +} + +\tikztiming@anchors{H}{D}{% + \anchorpoint{originoffset}{.5\dslope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{-.5\dslope}{.5\height}% + \anchorpoint{high}{-.5\dslope}{.5\height}% + \anchorpoint{high2}{.5\dslope}{.5\height}% + \anchorpoint{low}{.5\dslope}{-.5\height}% +} + +\tikztiming@anchors{Z}{E}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{\zslope}{.5\height}% + \anchorpoint{low}{\zslope}{-.5\height}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\tikztiming@anchors{Z}{H}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{\zslope}{.5\height}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\tikztiming@anchors{Z}{T}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{.5\height}% + \ifnum1=\c@tikztimingtrans\relax + \anchorpoint{low}{\zslope}{-.5\height}% + \else + \anchorpoint{high}{\zslope}{.5\height}% + \fi +} + +\tikztiming@anchors{T}{H}{% + \ifnum1=\c@tikztimingtrans\relax + \anchorpoint{high}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{0pt}% + \else + \anchorpoint{originoffset}{.5\slope}{.5\height}% + \anchorpoint{low}{-.5\slope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{.5\slope}{.5\height}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% + \fi +} + +\tikztiming@anchors{T}{L}{% + \ifnum1=\c@tikztimingtrans\relax + \anchorpoint{originoffset}{.5\slope}{-.5\height}% + \anchorpoint{low}{.5\slope}{-.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{-.5\slope}{.5\height}% + \anchorpoint{HIGH}{-.5\slope}{.5\height}% + \else + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{\height}% + \fi +} + +\tikztiming@anchors{T}{Z}{% + \ifnum1=\c@tikztimingtrans\relax + \anchorpoint{high}{0pt}{0pt}% + \anchorpoint{mid}{\zslope}{-.5\height}% + \anchorpoint{HIGH}{0pt}{0pt}% + \else + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{mid}{\zslope}{.5\height}% + \anchorpoint{HIGH}{0pt}{\height}% + \fi +} + +\tikztiming@anchors{Z}{L}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{low}{\zslope}{-.5\height}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\tikztiming@anchors{H}{Z}{% + \anchorpoint{high}{0pt}{0pt}% + \anchorpoint{mid}{\zslope}{-.5\height}% + \anchorpoint{HIGH}{0pt}{0pt}% +} + +\tikztiming@anchors{L}{Z}{% + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{mid}{\zslope}{.5\height}% + \anchorpoint{HIGH}{0pt}{\height}% +} + +\tikztiming@anchors{Z}{Z}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\tikztiming@anchors{H}{@}{% + \anchorpoint{high}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{0pt}% +} + +\tikztiming@anchors{L}{@}{% + \anchorpoint{low}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{\height}% +} + +\tikztiming@anchors{Z}{@}{% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\tikztiming@anchors{}{@}{% + \anchorpoint{originoffset}{0pt}{.5\height}% + \anchorpoint{mid}{0pt}{0pt}% + \anchorpoint{high}{0pt}{.5\height}% + \anchorpoint{low}{0pt}{-.5\height}% + \anchorpoint{HIGH}{0pt}{.5\height}% +} + +\RequirePackage{pgfopts} +\ProcessPgfOptions{/tikz/timing/node} +\endinput +%% +%% End of file `tikz-timing-advnodes.sty'. diff --git a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-arrows.sty b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-arrows.sty index e5d3d734539..1e62192a316 100644 --- a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-arrows.sty +++ b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-arrows.sty @@ -4,7 +4,7 @@ %% %% The original source files were: %% -%% tikz-timing.dtx (with options: `lib-arrows') +%% tikz-timing.dtx (with options: `lib,lib-arrows') %% %% Copyright (C) 2009 by Martin Scharrer %% @@ -27,46 +27,26 @@ %% \RequirePackage{svn-prov}[2009/05/03] \ProvidesPackageSVN[tikz-timing-arrows] - {$Id: tikz-timing.dtx 1158 2009-07-28 09:14:00Z martin $} - [v0.6a - TikZ-Timing Library for timing arrows] + {$Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $} + [v0.7 + TikZ-Timing Library for + timing arrows] +\GetFileInfoSVN*% +\RequirePackage{tikz-timing}[\filedate]% \DefineFileInfoSVN +\tikzset{timing/.cd, + A/.style={timing/a}, + W/.style={timing/w}, + a/.style={->}, + w/.style={<-}, +} + \tikztimingchar{A}{++(0,0)}{% \newdraw [\style] -- ++(0,\height) \newdraw ++(#1,-\height) } \def\tikztiming@nocombine@A{}% -\def\tikztiming@nocombine@a{}% -\tikztiminglet{AS}{SS} -\tikztiminglet{AH}{H} -\tikztiminglet{AZ}{Z} -\tikztimingdef{ZA}{ - ++(0,-0.5*\height) - \tikztiminguse{A}{#1} -} -\tikztimingdef{HA}{ - ++(0,-\height) - \tikztiminguse{A}{#1} -} -\tikztiminglet{XA}{ZA} -\tikztiminglet{MA}{ZA} -\tikztiminglet{AX}{AZ} -\tikztiminglet{AM}{AZ} -\tikztiminglet{LA}{A} -\tikztiminglet{AL}{LL} -\tikztiminglet{AD}{DD} -\tikztiminglet{AE}{LE} -\tikztiminglet{AU}{UU} -\tikztiminglet{SA}{A} -\tikztiminglet{AG}{G} -\tikztiminglet{AT}{LT} -\tikztiminglet{AC}{LC} -\tikztiminglet{DA}{A} -\tikztiminglet{UA}{A} -\tikztiminglet{TA}{A} -\tikztiminglet{CA}{A} -\tikztiminglet{EA}{A} \tikztimingecopy{W}{A} \endinput diff --git a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-beamer.sty b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-beamer.sty new file mode 100644 index 00000000000..8d170c0ac75 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-beamer.sty @@ -0,0 +1,51 @@ +%% +%% This is file `tikz-timing-beamer.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% tikz-timing.dtx (with options: `lib,lib-beamer') +%% +%% Copyright (C) 2009 by Martin Scharrer +%% +%% This work 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 2008/05/04 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files tikz-timing.dtx, tikz-timing.ins +%% and the derived file tikz-timing.sty. +%% +\RequirePackage{svn-prov}[2009/05/03] +\ProvidesPackageSVN[tikz-timing-beamer] + {$Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $} + [v0.7 + TikZ-Timing Library for + beamer overlay support] +\GetFileInfoSVN*% +\RequirePackage{tikz-timing}[\filedate]% +\DefineFileInfoSVN + + +\PackageWarning{\@currname}{This library is experimental and will change in future versions!}{}{} + +\tikztiming@defcode<#1>{ + \tikztiming@output@addcode{ + node [timing/save] (timing@save) {};% + \onslide<#1> + \draw [timing/restore] (timing@save) ++(0,0) + } + \tikztiming@parser +} +\endinput +%% +%% End of file `tikz-timing-beamer.sty'. diff --git a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-clockarrows.sty b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-clockarrows.sty new file mode 100644 index 00000000000..3882174695d --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-clockarrows.sty @@ -0,0 +1,99 @@ +%% +%% This is file `tikz-timing-clockarrows.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% tikz-timing.dtx (with options: `lib,lib-clockarrows') +%% +%% Copyright (C) 2009 by Martin Scharrer +%% +%% This work 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 2008/05/04 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files tikz-timing.dtx, tikz-timing.ins +%% and the derived file tikz-timing.sty. +%% +\RequirePackage{svn-prov}[2009/05/03] +\ProvidesPackageSVN[tikz-timing-clockarrows] + {$Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $} + [v0.7 + TikZ-Timing Library for + timing clock arrows] +\GetFileInfoSVN*% +\RequirePackage{tikz-timing}[\filedate]% +\DefineFileInfoSVN + +\tikztiming@iftrans{CC}% + {\let\tikztiming@trans@C@normal@C\tikztiming@trans@CC}% + {\PackageError{\@currname}{No 'CC' transition defined by the main tikz-timing + package.}{}{}}% + +\tikztimingdef{CC}{% + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + [timing/c/save] + \newdraw + [\style,timing/c/restore,>=\noexpand\tikztiming@c@arrow@tip,timing/c/arrow@style] + -- ++(\slope*\noexpand\tikztiming@c@arrow@pos,\value{tikztimingtrans}*\height*\noexpand\tikztiming@c@arrow@pos) + ; \draw [timing/restore,timing/c/restore] (timing@save) ++(0,0) [\style] + -- ++(\slope,\value{tikztimingtrans}*\height) + -- ++($ (#1,0) - (\slope,0) $) +} +\let\tikztiming@trans@C@arrow@C\tikztiming@trans@CC + +\tikzset{timing/c/.cd, + rising arrows/.code={% + \def\tikztiming@trans@CC{\tikztiming@trans@C@arrow@C}% + \def\tikztiming@clockarrow@style{\ifnum1=\c@tikztimingtrans\tikzset{->,timing/c/arrow}\fi}% + },% + falling arrows/.code={% + \def\tikztiming@trans@CC{\tikztiming@trans@C@arrow@C}% + \def\tikztiming@clockarrow@style{\ifnum-1=\c@tikztimingtrans\tikzset{->,timing/c/arrow}\fi}% + },% + dual arrows/.code={% + \def\tikztiming@trans@CC{\tikztiming@trans@C@arrow@C}% + \def\tikztiming@clockarrow@style{\tikzset{->,timing/c/arrow}}% + },% + no arrows/.code={% + \def\tikztiming@trans@CC{\tikztiming@trans@C@normal@C}% + \def\tikztiming@clockarrow@style{}% + },% + arrow@style/.code={\tikztiming@clockarrow@style},% + arrow/.style={},% + arrow pos/.store in=\tikztiming@c@arrow@pos, + arrow tip/.store in=\tikztiming@c@arrow@tip, + save/.code={% + \global\let\tikztiming@clockarrow@savedstyle\tikztiming@clockarrow@style + \global\let\tikztiming@trans@saved@CC\tikztiming@trans@CC + \global\let\tikztiming@c@arrow@savedpos\tikztiming@c@arrow@pos + \global\let\tikztiming@c@arrow@savedtip\tikztiming@c@arrow@tip + }, + restore/.code={% + \let\tikztiming@clockarrow@style\tikztiming@clockarrow@savedstyle + \let\tikztiming@trans@CC\tikztiming@trans@saved@CC + \let\tikztiming@c@arrow@pos\tikztiming@c@arrow@savedpos + \let\tikztiming@c@arrow@tip\tikztiming@c@arrow@savedtip + }, +} +\tikzset{timing/c/.cd, + no arrows, + arrow pos=0.95, + arrow tip=to, +} + +\RequirePackage{pgfopts} +\ProcessPgfOptions{/tikz/timing/c} +\endinput +%% +%% End of file `tikz-timing-clockarrows.sty'. diff --git a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-columntype.sty b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-columntype.sty new file mode 100644 index 00000000000..8d6545e3827 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-columntype.sty @@ -0,0 +1,89 @@ +%% +%% This is file `tikz-timing-columntype.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% tikz-timing.dtx (with options: `lib,lib-columntype') +%% +%% Copyright (C) 2009 by Martin Scharrer +%% +%% This work 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 2008/05/04 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files tikz-timing.dtx, tikz-timing.ins +%% and the derived file tikz-timing.sty. +%% +\RequirePackage{svn-prov}[2009/05/03] +\ProvidesPackageSVN[tikz-timing-columntype] + {$Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $} + [v0.7 + TikZ-Timing Library for + timing cell types] +\GetFileInfoSVN*% +\RequirePackage{tikz-timing}[\filedate]% +\DefineFileInfoSVN + +\RequirePackage{array} + +\tikzset{timing/columntype/.code 2 args = + \newcolumntype{#1}{>{\celltiming}#2<{\endcelltiming}}% +}% +\RequirePackage{pgfopts} +\tikzset{timing/columntype/.cd, + type/.style 2 args={/tikz/timing/columntype={#1}{#2}},% + notype/.code={}, + notype/.value forbidden={}, +} + +\ProcessPgfOptions{/tikz/timing/columntype} +\expandafter\ifx\csname opt@\@currname.\@currext\endcsname\empty + \tikzset{timing/columntype={T}{l}}% +\fi +\def\celltiming#1\ignorespaces{% + #1% + \begin{tikzpicture}[timing/picture,baseline={(0,0)}] + \def\tikztiming@endhook{\end@celltiming} + \tikztiming@init + \let\tikztiming@settings\empty + \@ifnextchar{[}% + {\tikztiming@celltiming}% + {\tikztiming@celltiming[]}% +} +\let\endcelltiming\relax +\def\tikztiming@celltiming[#1]{% + \ifx\relax#1\relax\else + \tikztiming@testoptarg#1\relax\relax + \fi + \ifx\tikztiming@lastchar\empty + \def\tikztiming@lastchar{@}% + \fi + \expandafter\scope\expandafter[\tikztiming@settings]% + \begingroup + \let\unskip\relax + \let\\\relax + \tikztiming@parser +} +\def\end@celltiming{% + \tikzset{timing/before}% + \tikztiming@str; + \expandafter\node + \expandafter[\tikztiming@settings,shape=tikztiming@shape,anchor=origin] at (0,0) {}; + \tikzset{timing/after}% + \endscope + \end{tikzpicture}% +} +\endinput +%% +%% End of file `tikz-timing-columntype.sty'. diff --git a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-counters.sty b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-counters.sty new file mode 100644 index 00000000000..e81d3412b68 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-counters.sty @@ -0,0 +1,100 @@ +%% +%% This is file `tikz-timing-counters.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% tikz-timing.dtx (with options: `lib,lib-counters') +%% +%% Copyright (C) 2009 by Martin Scharrer +%% +%% This work 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 2008/05/04 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files tikz-timing.dtx, tikz-timing.ins +%% and the derived file tikz-timing.sty. +%% +\RequirePackage{svn-prov}[2009/05/03] +\ProvidesPackageSVN[tikz-timing-counters] + {$Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $} + [v0.7 + TikZ-Timing Library for + counter values] +\GetFileInfoSVN*% +\RequirePackage{tikz-timing}[\filedate]% +\DefineFileInfoSVN + +\tikzset{% + timing/new counter/.style={timing/counter/new={#1}}, + timing/counter/.cd, + new/.code={\tikztiming@counter@new{#1}}, + new/.value required, + opt/.cd, + char/.estore in=\tikztiming@counter@char, + reset char/.estore in=\tikztiming@counter@resetchar, + base/.estore in=\tikztiming@counter@base, + half width char/.estore in=\tikztiming@counter@hwchar, + char/.value required, + reset char/.value required, + base/.value required, + half width char/.value required, +} +\def\tikztiming@counter@new#1{% + \let\tikztiming@counter@char\empty + \let\tikztiming@counter@resetchar\empty + \def\tikztiming@counter@base{10}% + \let\tikztiming@counter@hwchar\relax + \pgfqkeys{/tikz/timing/counter/opt}{#1}% + \ifx\tikztiming@counter@char\empty + \PackageError{tikz-timing-counters}{Counter character must be given using + the 'char' key!}% + \else + \edef\@tempa{% + \noexpand\tikztiming@counter@new@{\tikztiming@counter@char}{\tikztiming@counter@base}% + {\tikztiming@counter@hwchar}{\tikztiming@counter@resetchar}% + }% + \expandafter\@tempa + \fi +} +\def\tikztiming@counter@new@#1#2#3#4{% + \newcounter{tikztiming@counter@#1}% + \tikzset{timing/counter/#1/.append style={}}% + \tikztimingmetachar{#1}[1]{##1D{[timing/counter/#1]\tikztiming@counter@vs{#1}{#2}}}% + \ifx\tikztiming@counter@hwchar\empty\else + \ifx\tikztiming@counter@hwchar\relax + \tikztiming@iflower{#1}{}% + {\lowercase{\tikztimingmetachar{#1}}[1]% + {##1d{[timing/counter/#1]\tikztiming@counter@vs{#1}{#2}}}}% + \else + \tikztimingmetachar{#3}[1]{##1d{[timing/counter/#1]\tikztiming@counter@vs{#1}{#2}}}% + \fi + \fi + \ifx\tikztiming@counter@resetchar\empty\else + \tikztimingmetachar{#4}[1]{[|/utils/exec=\tikztiming@counter@reset{#1}{##1}|]}% + \fi +} +\def\tikztiming@counter@reset#1#2{% + \pgfmathsetcounter{tikztiming@counter@#1}{round((#2)/\tikztiming@wscale)}% + \setcounter{tikztiming@counter@#1}{\value{tikztiming@counter@#1}}% +} +\def\tikztiming@counter@vs#1#2{% + \pgfmathdectoBase\pgfmathresult{\value{tikztiming@counter@#1}}{#2}% + \pgfmathresult + \stepcounter{tikztiming@counter@#1}% +} +\RequirePackage{pgfopts} +\ProcessPgfOptions{/tikz/timing/counter} +\endinput +%% +%% End of file `tikz-timing-counters.sty'. diff --git a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-either.sty b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-either.sty index 11d3f6c8ede..7a1f73e1249 100644 --- a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-either.sty +++ b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-either.sty @@ -4,7 +4,7 @@ %% %% The original source files were: %% -%% tikz-timing.dtx (with options: `lib-either') +%% tikz-timing.dtx (with options: `lib,lib-either') %% %% Copyright (C) 2009 by Martin Scharrer %% @@ -27,13 +27,14 @@ %% \RequirePackage{svn-prov}[2009/05/03] \ProvidesPackageSVN[tikz-timing-either] - {$Id: tikz-timing.dtx 1158 2009-07-28 09:14:00Z martin $} - [v0.6a - TikZ-Timing Library for uncertain transitions] + {$Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $} + [v0.7 + TikZ-Timing Library for + uncertain transitions] +\GetFileInfoSVN*% +\RequirePackage{tikz-timing}[\filedate]% \DefineFileInfoSVN - -\tikztimingecopy{E}{D} \tikztimingchar{E}{ ++(0,0) \code{\setcounter{tikztimingtranspos}{0}}% @@ -42,67 +43,767 @@ \code{\setcounter{tikztimingtranspos}{0}}% \code{\setcounter{tikztimingtrans}{1}}% \tikztiminguse{D}{#1}% + \newdraw } -\tikztimingdef{LE}{% - -- ++(#1,0)% - \code{\setcounter{tikztimingtranspos}{0}}% - \code{\setcounter{tikztimingtrans}{1}}% - ++($ -1*(#1,0) $)% +\def\tikztiming@triple@E{}% + +\tikztimingdef{LE@}{% + \newdraw [\bgstyle] + -- ++(\slope,\height)% + -- ++($ (#1,0) - (\slope,0) $)% + -- ++(0,-\height)% + -- ++($ -1*(#1,0) $)% + \newdraw [\style] -- ++(\slope,\height)% -- ++($ (#1,0) - (\slope,0) $)% - ++(0,-\height)% + ++($ -1*(#1,\height) $)% + -- ++($ 1*(#1,0) $)% + ++(0,.5\height)% + \newdraw + \code{\setcounter{tikztimingtranspos}{0}}% + \code{\setcounter{tikztimingtrans}{1}}% }% -\tikztimingdef{HE}{% - -- ++(#1,0)% - \code{\setcounter{tikztimingtranspos}{1}}% - \code{\setcounter{tikztimingtrans}{-1}}% - ++($ -1*(#1,0) $)% + +\tikztimingdef{HE@}{% + \newdraw [\bgstyle] -- ++(\slope,-\height)% -- ++($ (#1,0) - (\slope,0) $)% -}% -\tikztimingdef{EE}{% - ++(0, \height * \value{tikztimingtranspos})% - ++(#1,0)% + -- ++(0,\height)% -- ++($ -1*(#1,0) $)% - -- ++(\slope, \height * \value{tikztimingtrans})% - -- ++(-\slope,0)% - -- ++(#1,0)% - ++(0, -\height + \height * \value{tikztimingtranspos})% -}% -\tikztimingdef{EH}{% - ++(0,+\height)% - -- ++(\slope,0)% - ++(-\slope,-\height)% - -- ++(\slope/2.,+\height/2.)% - \newdraw [\style]% - -- ++(\slope/2.,+\height/2.)% + \newdraw [\style] + -- ++(\slope,-\height)% -- ++($ (#1,0) - (\slope,0) $)% + ++($ -1*(#1,-\height) $)% + -- ++($ 1*(#1,0) $)% + ++(0,-.5\height)% + \newdraw + \code{\setcounter{tikztimingtranspos}{1}}% + \code{\setcounter{tikztimingtrans}{-1}}% }% -\tikztimingdef{EL}{% - -- ++(\slope,0)% - ++(-\slope,\height)% - -- ++(\slope/2.,-\height/2.)% - \newdraw [\style]% - -- ++(\slope/2.,-\height/2.)% + +\tikztimingdef{TE@}{% + \newdraw [\bgstyle] + -- ++(\slope,-\height * \value{tikztimingtrans})% + -- ++($ (#1,0) - (\slope,0) $)% + -- ++(0,\height * \value{tikztimingtrans})% + -- ++($ -1*(#1,0) $)% + \newdraw [\style] + -- ++(\slope,-\height * \value{tikztimingtrans})% -- ++($ (#1,0) - (\slope,0) $)% + ++($ -1*(#1,-\height * \value{tikztimingtrans}) $)% + -- ++($ 1*(#1,0) $)% + ++(0,-1*\value{tikztimingtrans}*.5*\height)% + \newdraw }% -\tikztimingdef{ZE}{% - \code{\setcounter{tikztimingtranspos}{1}}% + +\tikztimingdef{LEL}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\slope,\height)% + -- +(#1,\height)% + -- +($ (#1,0) + (\slope,0) $)% + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\slope,-\height/2)% + \newdraw +}% + +\tikztimingdef{LEH}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\slope,\height)% + -- +($ (#1,\height) + (\slope,0) $)% + -- +(#1,0)% + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\slope,\height/2)% + \newdraw +}% + +\tikztimingdef{HEH}{% + \newdraw [\style,preaction={\bgstyle}] + -- +($ (#1,0) + (\slope,0) $)% + -- +(#1,-\height)% + -- +(\slope,-\height) + -- +(0,0) + ++(#1,-\height/2) coordinate (timing@ref) + ++(\slope,\height/2)% + \newdraw +}% + +\tikztimingdef{HEL}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(#1,0) + -- +($ (#1,-\height) + (\slope,0) $)% + -- +(\slope,-\height) + -- +(0,0) + ++(#1,-\height/2) coordinate (timing@ref) + ++(\slope,-\height/2)% + \newdraw +}% + +\tikztimingdef{HET}{ + \newdraw [\style,preaction={\bgstyle}] + -- +(#1,0) + {[\nstyle] + -- +($ (#1,-\height) + (\slope,0) $)% + } + -- +(\slope,-\height) + -- +(0,0) + {[\nstyle] + ++(#1,-\height/2) coordinate (timing@ref) + ++(\slope,-\height/2)% + } + \newdraw \code{\setcounter{tikztimingtrans}{-1}}% - \tikztiminguse{ZD}{#1}% } -\tikztimingdef{XE}{% - \code{\setcounter{tikztimingtranspos}{1}}% - \code{\setcounter{tikztimingtrans}{-1}}% - \tikztiminguse{XD}{#1}% + +\tikztimingdef{LET}{ + \newdraw [\style,preaction={\bgstyle}] + -- +(\slope,\height)% + {[\nstyle] + -- +($ (#1,\height) + (\slope,0) $)% + } + -- +(#1,0)% + -- +(0,0) + {[\nstyle] + ++(#1,\height/2)% + coordinate (timing@ref) + ++(\slope,\height/2)% + } + \newdraw + \code{\setcounter{tikztimingtrans}{1}}% } -\tikztimingdef{ME}{% + +\tikztimingdef{HEE}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(#1,0) coordinate (timing@refb) + coordinate [shift={(0,-\height/2)}] (timing@ref) + -- +($ (#1,-\height) + (\slope,0) $) coordinate (timing@refa) + -- +(\slope,-\height) + -- +(0,0) + coordinate [shift={(#1,-\height/2)}] (timing@ref) + ++($ (#1,-\height) + (\slope,0) $)% \code{\setcounter{tikztimingtranspos}{1}}% \code{\setcounter{tikztimingtrans}{-1}}% - \tikztiminguse{MD}{#1}% + \newdraw +}% + +\tikztimingdef{LEE}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(#1,0) coordinate (timing@refa) + coordinate [shift={(0,\height/2)}] (timing@ref) + -- +($ (#1,\height) + (\slope,0) $) coordinate (timing@refb) + -- +(\slope,\height) + -- +(0,0) + ++(#1,0) coordinate [shift={(0,\height/2)}] (timing@ref) + \code{\setcounter{tikztimingtranspos}{0}}% + \code{\setcounter{tikztimingtrans}{1}}% + \newdraw +}% + +\tikztimingdef{TEE}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\slope, -\height * \value{tikztimingtrans})% + -- +($ (#1,0) + (\slope, -\height * \value{tikztimingtrans}) $) + -- +(#1,0) + -- +(0,0)% + \code{\setcounter{tikztimingtranspos}{\value{tikztimingtrans}}% + \addtocounter{tikztimingtranspos}{+1}} + +($ (#1,0) + (\slope/2 + \slope/2 * \value{tikztimingtrans}, -\height/2 * \value{tikztimingtranspos}) $) + coordinate (timing@refa) + +($ (#1,0) + (\slope/2 - \slope/2 * \value{tikztimingtrans}, \height - \height/2 * \value{tikztimingtranspos}) $) + coordinate (timing@refb) + ++(#1,0) + coordinate [shift={(0,-\height/2 * \value{tikztimingtrans})}] (timing@ref) + ++( + .5 * \slope + .5 * \value{tikztimingtrans} * \slope, + -.5 * \height - .5 * \value{tikztimingtrans} * \height + ) + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + \newdraw +}% + +\tikztimingdef{TEH}{% + \newdraw [\style,preaction={\bgstyle}] + -- ++(\slope,-\height * \value{tikztimingtrans}) + -- ++($ (#1,0) - (\slope/2 + \slope/2 * \value{tikztimingtrans},0) $) + -- ++(\slope * \value{tikztimingtrans}, + \height * \value{tikztimingtrans}) + -- ++($ -1*(#1,0) - (\slope/2 + \slope/2 * \value{tikztimingtrans},0) $) + ++($ (#1,-\height/2 * \value{tikztimingtrans}) $) coordinate (timing@ref) + ++(\slope,\height/2) + \newdraw +} + +\tikztimingdef{TEL}{% + \newdraw [\style,preaction={\bgstyle}] + -- ++(\slope,-\height * \value{tikztimingtrans}) + -- ++($ (#1,0) - (\slope/2 - \slope/2 * \value{tikztimingtrans},0) $) + -- ++(-\slope * \value{tikztimingtrans}, + \height * \value{tikztimingtrans}) + -- ++($ -1*(#1,0) - (\slope/2 + -\slope/2 * \value{tikztimingtrans},0) $) + ++($ (#1,-\height/2 * \value{tikztimingtrans}) $) coordinate (timing@ref) + ++(\slope,-\height/2) + \newdraw +} + +\tikztimingdef{TEZ}{% + \newdraw [\style,preaction={\bgstyle}] + -- ++(\slope,-\height * \value{tikztimingtrans}) + -- ++($ (#1,0) - (\slope,0) $) + -- ++(\zslope, + \height/2 * \value{tikztimingtrans}) + -- ++(-\zslope, + \height/2 * \value{tikztimingtrans}) + -- ++($ -1*(#1,0) $) + ++($ (#1,0) + (0,-\height/2 * \value{tikztimingtrans}) $) + coordinate (timing@ref) + ++(\zslope,0) + \newdraw +} + +\tikztimingdef{TED}{% + \newdraw [\style,preaction={\bgstyle}] + -- ++(\slope,-\height * \value{tikztimingtrans}) + -- ++($ (#1,0) - (\slope,0) $) + -- ++(\dslope/2, + \height/2 * \value{tikztimingtrans}) + -- ++(-\dslope/2, + \height/2 * \value{tikztimingtrans}) + -- ++($ -1*(#1,0) $) + ++($ (#1,0) + (0,-\height/2 * \value{tikztimingtrans}) $) + coordinate (timing@ref) + ++(\dslope/2,0) + \newdraw +} + +\tikztimingdef{TET}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\slope, -\height * \value{tikztimingtrans})% + {[\nstyle] + -- +($ (#1,0) + (\slope, -\height * \value{tikztimingtrans}) $)% + } + -- +(#1,0)% + -- +(0,0)% + {[\nstyle] + ++($ (#1,0) + (0, -\height/2 * \value{tikztimingtrans}) $)% + coordinate (timing@ref) + ++(\slope, -\height/2 * \value{tikztimingtrans})% + } + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + \newdraw +}% + +\tikztimingdef{EEZ}{% + \newdraw [\style,preaction={\bgstyle}] + -- (timing@refb) + -- ($ (timing@ref) + (#1,+\height/2) $) + -- ($ (timing@ref) + (#1,0) + (\zslope,0) $) + -- ($ (timing@ref) + (#1,-\height/2) $) + -- (timing@refa) + ($ (timing@ref) + (#1,0) + (\zslope,0) $) + coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $) + \newdraw +}% + +\tikztimingdef{EED}{% + \newdraw [\style,preaction={\bgstyle}] + -- (timing@refb) + -- ($ (timing@ref) + (#1,+\height/2) $) + -- ($ (timing@ref) + (#1,0) + (\dslope/2,0) $) + -- ($ (timing@ref) + (#1,-\height/2) $) + -- (timing@refa) + ($ (timing@ref) + (#1,0) + (\dslope/2,0) $) + coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $) + \newdraw +}% + +\tikztimingdef{HEZ}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(#1,0) + -- +($ (#1,-\height/2) + (\zslope,0) $)% + -- +(#1,-\height) + -- +(\slope,-\height) + -- +(0,0) + ++(#1,-\height/2) coordinate (timing@ref) + ++(\zslope,0)% + \newdraw +}% + +\tikztimingdef{LEZ}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\slope,\height) + -- +(#1,\height) + -- +($ (#1,\height/2) + (\zslope,0) $)% + -- +(#1,0) + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\zslope,0)% + \newdraw +}% + +\tikztimingdef{LED}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\slope,\height) + -- +(#1,\height) + -- +($ (#1,\height/2) + (\dslope/2,0) $)% + -- +(#1,0) + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\dslope/2,0)% + \newdraw +}% + +\tikztimingdef{HED}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(#1,0) + -- +($ (#1,-\height/2) + (\dslope/2,0) $)% + -- +(#1,-\height) + -- +(\slope,-\height) + -- +(0,0) + ++(#1,-\height/2) coordinate (timing@ref) + ++(\dslope/2,0)% + \newdraw +}% + +\tikztimingdef{EZ}{% + \newdraw [\style] + -- ($ (timing@ref) + (#1,0) $)% +} + +\tikztimingdef{EM}{% + \newdraw [\style] + -- ($ (timing@ref) + (#1,0) $)% + \newdraw [\style/base] +} + +\tikztimingdef{EL}{% + -- ($ (timing@ref) + (#1,-\height/2) $)% +}% +\tikztimingdef{EH}{% + -- ($ (timing@ref) + (#1,+\height/2) $)% +}% + +\tikztimingdef{ED@}{% + \tikztiming@chard@{#1}% +} +\tikztimingcpy{E{D@edge@}@}{ED@} + +\tikztimingdef{ED}{% + \tikztiming@chard{#1}% +} +\tikztimingcpy{E{D@edge@}}{ED} +\tikztimingdef{EDD}{% + \tikztiming@chard@{#1}% +} +\tikztimingdef{EUU}{% + \tikztiming@chard@{#1}% +} +\tikztimingdef{EDU}{% + \tikztiming@chard{#1}% +} +\tikztimingdef{EUD}{% + \tikztiming@chard{#1}% +} + +\tikztimingdef{DE@}{% + \tikztiming@oldnodecenter@% + \newdraw [\bgstyle] + -- +(\dslope/2,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $)% + -- ($ (timing@ref) + (#1,-\height/2) $)% + -- ($ (timing@save) + (\dslope/2,-\height/2) $) + -- (timing@save) + \newdraw [\style] + -- +(\dslope/2,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $)% + ($ (timing@ref) + (#1,-\height/2) $)% + -- ($ (timing@save) + (\dslope/2,-\height/2) $) + -- (timing@save) + ($ (timing@ref) + (#1,0) $)% + coordinate (timing@ref) +} + +\tikztimingdef{EEE}{% + \newdraw [\style,preaction={\bgstyle}] + -- (timing@refb) + -- ($ (timing@refb) + (#1,0) $) + -- ($ (timing@refa) + (#1,0) $) + -- (timing@refa) + ++(#1,0) coordinate (timing@refa) + coordinate (timing@refb) at ($ (timing@refb) + (#1,0) $) + coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $) + \newdraw +}% + +\tikztimingdef{EET}{% + \newdraw [\style,preaction={\bgstyle}] + -- (timing@refb) + {[\nstyle] + -- ($ (timing@ref) + (#1,+\height/2) + (\slope/2 + \slope/2 * \value{tikztimingtrans},0) $) + -- ($ (timing@ref) + (#1,-\height/2) + (\slope/2 - \slope/2 * \value{tikztimingtrans},0) $) + } + -- (timing@refa) + {[\nstyle] + ($ (timing@ref) + (#1,\height/2 * \value{tikztimingtrans}) + (\slope,0) $) + } + coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $) + \newdraw +}% + +\tikztimingdef{EEL}{% + \newdraw [\style,preaction={\bgstyle}] + -- (timing@refb) + -- ($ (timing@ref) + (#1,+\height/2) $) + -- ($ (timing@ref) + (#1,-\height/2) + (\slope,0) $) + -- (timing@refa) + ($ (timing@ref) + (#1,-\height/2) + (\slope,0) $) + coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $) + \newdraw +}% + +\tikztimingdef{EEH}{% + \newdraw [\style,preaction={\bgstyle}] + -- (timing@refb) + -- ($ (timing@ref) + (#1,+\height/2) + (\slope,0) $) + -- ($ (timing@ref) + (#1,-\height/2) $) + -- (timing@refa) + ($ (timing@ref) + (#1,+\height/2) + (\slope,0) $) + coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $) + \newdraw +}% + +\tikztimingdef{EE@}{% + \newdraw [\bgstyle] + let \p0 = (timing@ref), \p1 = (timing@refa), \p2 = (timing@refb) in + -- (\p2) + -- ($ (\x0,\y2) + (#1,0) $) + -- +(0,\y1-\y2) + -- (\p1) + \newdraw [\style] + let \p0 = (timing@ref), \p1 = (timing@refa), \p2 = (timing@refb) in + -- (\p2) + -- ($ (\x0,\y2) + (#1,0) $) + +(0,\y1-\y2) + -- (\p1) + ($ (timing@ref) + (#1,0) $) coordinate (timing@ref) + \newdraw +}% + +\tikztimingdef{ZE@}{ + \newdraw [\bgstyle] + -- +(\zslope,\height/2) + -- +(#1,\height/2)% + -- +(#1,-\height/2)% + -- +(\zslope,-\height/2) + -- +(0,0) + \newdraw [\style] + -- +(\zslope,\height/2) + -- +(#1,\height/2)% + +(#1,-\height/2)% + -- +(\zslope,-\height/2) + -- +(0,0) + ++(#1,0) coordinate (timing@ref) +} + +\tikztimingdef{ZEH}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\zslope, \height/2) + -- +($ (#1,0) + (\slope, \height/2) $) + -- +(#1,-\height/2) + -- +(\zslope, -\height/2) + -- +(0,0) + ++(#1,0) coordinate (timing@ref) + ++(\slope, \height/2) + \newdraw +} + +\tikztimingdef{ZEL}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\zslope, \height/2) + -- +(#1,\height/2) + -- +($ (#1,0) + (\slope, -\height/2) $) + -- +(\zslope, -\height/2) + -- +(0,0) + ++(#1,0) coordinate (timing@ref) + ++(\slope, -\height/2) + \newdraw +} + +\tikztimingdef{ZET}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\zslope, \height/2) + {[\nstyle] + -- +($ (#1, \height/2) + (\slope/2 - \slope/2 * \value{tikztimingtrans}, 0) $) + -- +($ (#1,-\height/2) + (\slope/2 + \slope/2 * \value{tikztimingtrans}, 0) $) + } + -- +(\zslope, -\height/2) + -- +(0,0) + {[\nstyle] + ++(#1,0) coordinate (timing@ref) + ++(\slope,-\height/2 * \value{tikztimingtrans}) + } + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + \newdraw +} + +\tikztimingdef{DET}{% + \tikztiming@oldnodecenter@% + \newdraw [\style,preaction={\bgstyle}] + -- +(\dslope/2, \height/2) + {[\nstyle] + -- ($ (timing@ref) + (#1, \height/2) + (\slope/2 - \slope/2 * \value{tikztimingtrans}, 0) $) + -- ($ (timing@ref) + (#1,-\height/2) + (\slope/2 + \slope/2 * \value{tikztimingtrans}, 0) $) + } + -- ($ (timing@save) + (\dslope/2, -\height/2) $) + -- (timing@save) + {[\nstyle] + ($ (timing@ref) + (#1,0) $) coordinate (timing@ref) + ++(\slope,-\height/2 * \value{tikztimingtrans}) + } + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + \newdraw +} + +\tikztimingdef{ZEZ}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\zslope, \height/2) + -- +(#1,\height/2) + -- +($ (#1,0) + (\zslope, 0) $) + -- +(#1,-\height/2) + -- +(\zslope, -\height/2) + -- +(0,0) + ++(#1,0) coordinate (timing@ref) + ++(\zslope, 0) + \newdraw +} + +\tikztimingdef{ZEE}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\zslope, \height/2) + -- +($ (#1,0) + (\slope, \height/2) $) coordinate (timing@refb) + -- +(#1,-\height/2) coordinate (timing@refa) + -- +(\zslope, -\height/2) + -- +(0,0) + +(#1,0) coordinate (timing@ref) + ++(#1,-\height/2) + \code{\setcounter{tikztimingtranspos}{0}}% + \code{\setcounter{tikztimingtrans}{1}}% +} + +\tikztimingdef{DEE}{% + \tikztiming@oldnodecenter@ + \newdraw [\style,preaction={\bgstyle}] + -- +(\dslope/2, \height/2) + -- ($ (timing@ref) + (#1,0) + (\slope, \height/2) $) coordinate (timing@refb) + -- ($ (timing@ref) + (#1,-\height/2) $) coordinate (timing@refa) + -- ($ (timing@save) + (\dslope/2, -\height/2) $) + -- (timing@save) + coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $) + (timing@refa) + \code{\setcounter{tikztimingtranspos}{0}}% + \code{\setcounter{tikztimingtrans}{1}}% +} + +\tikztimingdef{DED}{% + \tikztiming@oldnodecenter@% + \newdraw [\style,preaction={\bgstyle}] + -- +(\dslope/2, \height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- ($ (timing@ref) + (#1,0) + (\dslope/2,0) $) + -- ($ (timing@ref) + (#1,-\height/2) $) + -- ($ (timing@save) + (\dslope/2, -\height/2) $) + -- (timing@save) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + ++(\dslope/2,0) + \newdraw +} + +\tikztimingdef{ZED}{% + \newdraw [\style,preaction={\bgstyle}] + -- +(\zslope, \height/2) + -- +(#1,\height/2) + -- +($ (#1,0) + (\dslope/2, 0) $) + -- +(#1,-\height/2) + -- +(\zslope, -\height/2) + -- +(0,0) + ++(#1,0) coordinate (timing@ref) + ++(\dslope/2, 0) + \newdraw +} + +\tikztimingdef{DEZ}{% + \tikztiming@oldnodecenter@ + \newdraw [\style,preaction={\bgstyle}] + -- +(\dslope/2, \height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- ($ (timing@ref) + (#1,0) + (\zslope, 0) $) + -- ($ (timing@ref) + (#1,-\height/2) $) + -- ($ (timing@save) + (\dslope/2, -\height/2) $) + -- (timing@save) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + ++(\zslope, 0) + \newdraw +} + +\tikztimingdef{DEH}{% + \tikztiming@oldnodecenter@% + \newdraw [\style,preaction={\bgstyle}] + -- +(\dslope/2, \height/2) + -- ($ (timing@ref) + (#1,0) + (\slope, \height/2) $) + -- ($ (timing@ref) + (#1,-\height/2) $) + -- ($ (timing@save) + (\dslope/2, -\height/2) $) + -- (timing@save) + ($ (timing@ref) + (#1,0) $) coordinate (timing@ref) + ++(\slope, \height/2) + \newdraw +} + +\tikztimingdef{DEL}{% + \tikztiming@oldnodecenter@% + \newdraw [\style,preaction={\bgstyle}] + -- +(\dslope/2, \height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- ($ (timing@ref) + (#1,0) + (\slope, -\height/2) $) + -- ($ (timing@save) + (\dslope/2, -\height/2) $) + -- (timing@save) + ($ (timing@ref) + (#1,0) $) coordinate (timing@ref) + ++(\slope, -\height/2) + \newdraw +} + +\tikztimingdef{@E}{% + \code{\setcounter{tikztimingtranspos}{0}}% + \code{\setcounter{tikztimingtrans}{1}}% + \tikztiminguse{@D}{#1} +} + +\tikztimingdef{@DE}{% + \tikztiming@@chard{#1}% } +\tikztimingdef{DDE}{ + \tikztiming@@chard{#1}% +} + +\tikztimingdef{@EH}{% + coordinate [shift={(0,\height/2)}] (timing/start) + \newdraw [\bgstyle] + -- +(0,\height) + -- +($ (#1,\height) + (\slope,0) $) + -- +(#1,0) + -- +(0,0) + \newdraw [\style] + +(0,\height) + -- +($ (#1,\height) + (\slope,0) $) + -- +(#1,0) + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\slope,\height/2) + \newdraw +} + +\tikztimingdef{@ET}{% + coordinate [shift={(0,\height/2)}] (timing/start) + \newdraw [\bgstyle] + -- +(0,\height) + {[\nstyle] + -- ($ (timing@ref) + (#1,\height/2) + (\slope,0) $) + } + -- ($ (timing@ref) + (#1,-\height/2) $) + -- (timing@save) + \newdraw [\style] + +(0,\height) + {[\nstyle] + -- ($ (timing@ref) + (#1,\height/2) + (\slope,0) $) + } + -- ($ (timing@ref) + (#1,-\height/2) $) + -- (timing@save) + {[\nstyle] + ($ (timing@ref) + (#1,0) $) coordinate (timing@ref) + ++(\slope,\height/2) + } + \newdraw + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} +} + +\tikztimingdef{ET}{% + {[\style] + -- ($ (timing@ref) + (#1,\height/2 * \value{tikztimingtrans}) $) + } +} + +\tikztimingdef{@EL}{% + coordinate [shift={(0,\height/2)}] (timing/start) + \newdraw [\bgstyle] + -- +(0,\height) + -- +(#1,\height) + -- +($ (#1,0) + (\slope,0) $) + -- +(0,0) + \newdraw [\style] + +(0,\height) + -- +(#1,\height) + -- +($ (#1,0) + (\slope,0) $) + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\slope,-\height/2) + \newdraw +} + +\tikztimingdef{@ED}{% + coordinate [shift={(0,\height/2)}] (timing/start) + \newdraw [\bgstyle] + -- +(0,\height) + -- +(#1,\height) + -- +($ (#1,\height/2) + (\dslope/2,0) $) + -- +(#1,0) + -- +(0,0) + \newdraw [\style] + +(0,\height) + -- +(#1,\height) + -- +($ (#1,\height/2) + (\dslope/2,0) $) + -- +(#1,0) + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\dslope/2,0) +} + +\tikztimingdef{@EZ}{% + coordinate [shift={(0,\height/2)}] (timing/start) + \newdraw [\bgstyle] + -- +(0,\height) + -- +(#1,\height) + -- +($ (#1,\height/2) + (\zslope,0) $) + -- +(#1,0) + -- +(0,0) + \newdraw [\style] + +(0,\height) + -- +(#1,\height) + -- +($ (#1,\height/2) + (\zslope,0) $) + -- +(#1,0) + -- +(0,0) + ++(#1,\height/2) coordinate (timing@ref) + ++(\zslope,0) +} + +\tikztimingdef{@EE}{% + coordinate [shift={(0,\height/2)}] (timing/start) + \newdraw [\bgstyle] + -- +(0,\height) + -- +($ (#1,\height) + (\slope,0) $) + -- +(#1,0) + -- +(0,0) + \newdraw [\style] + +(0,\height) + -- +($ (#1,\height) + (\slope,0) $) coordinate (timing@refb) + -- +(#1,0) coordinate (timing@refa) + -- +(0,0) + ++(#1,0) coordinate [shift={(0,\height/2)}] (timing@ref) + \code{\setcounter{tikztimingtranspos}{0}}% + \code{\setcounter{tikztimingtrans}{1}}% +} + \def\tikztiming@nocombine@E{}%% -\def\tikztiming@nocombine@e{}%% \endinput %% %% End of file `tikz-timing-either.sty'. diff --git a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-ifsym.sty b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-ifsym.sty new file mode 100644 index 00000000000..86a8548dbac --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-ifsym.sty @@ -0,0 +1,89 @@ +%% +%% This is file `tikz-timing-ifsym.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% tikz-timing.dtx (with options: `lib,lib-ifsym') +%% +%% Copyright (C) 2009 by Martin Scharrer +%% +%% This work 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 2008/05/04 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files tikz-timing.dtx, tikz-timing.ins +%% and the derived file tikz-timing.sty. +%% +\RequirePackage{svn-prov}[2009/05/03] +\ProvidesPackageSVN[tikz-timing-ifsym] + {$Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $} + [v0.7 + TikZ-Timing Library for + ifsym compatible macros] +\GetFileInfoSVN*% +\RequirePackage{tikz-timing}[\filedate]% +\DefineFileInfoSVN + +\tikzset{% + timing/ifsym/macro/.style={/tikz/timing/ifsym,/utils/exec={\pgfmathparse{.6*\f@size}\let\ysize\pgfmathresult},/tikz/y=\ysize}, + timing/ifsym/.style={% + /tikz,timing/slope=0,x=\f@size,y=\f@size,line width=0.1ex, + timing/metachar={|}{G}, + timing/x/.style={}, + timing/metachar={M}[1]{#1X}, + timing/metachar={m}[1]{#1x}, + /utils/exec={% +\def\tikztimingsetdslope##1{% + \pgfmathparse{max(0.0,##1)}% + \let\tikztiming@dslope\pgfmathresult + \edef\timingdslope{\tikztiming@dslope*\noexpand\timingwidth}% +} +\tikztiming@defcode{<}{% + \@ifnextchar{<}% + {\tikztiming@ifsym@longslope{X}{D}}% + {\tikztiming@parser [timing/dslope=1] 0Xd;}% +}% +\tikztiming@defcode{>}{% + \@ifnextchar{>}% + {\tikztiming@ifsym@longslope{D}{X}}% + {\tikztiming@parser [timing/dslope=1] 0Dx;}% +}% +\def\tikztiming@ifsym@longslope##1##2##3{ + \tikztiming@parser [timing/dslope=2.] 0##1 ##2;% +}% + }}, +} +\tikzset{% + timing/ifsym/.cd, + provide/.code={\let\tikztiming@ifsym@def\providecommand}, + renew/.code={\let\tikztiming@ifsym@def\renewcommand}, + new/.code={\let\tikztiming@ifsym@def\newcommand}, + off/.code={\let\tikztiming@ifsym@def\@gobbletwo}, +} +\tikzset{timing/ifsym/provide}% +\RequirePackage{pgfopts} +\ProcessPgfOptions{/tikz/timing/ifsym} +\tikztiming@ifsym@def{\RaisingEdge}{\hbox{\texttiming[timing/ifsym/macro]{.4L .4H}}} +\tikztiming@ifsym@def{\FallingEdge}{\hbox{\texttiming[timing/ifsym/macro]{.4H .4L}}} +\tikztiming@ifsym@def{\ShortPulseHigh}{\hbox{\texttiming[timing/ifsym/macro]{.4L .2H .4L}}} +\tikztiming@ifsym@def{\ShortPulseLow}{\hbox{\texttiming[timing/ifsym/macro]{.4H .2L .4H}}} +\tikztiming@ifsym@def{\PulseHigh}{\hbox{\texttiming[timing/ifsym/macro]{.4L .6H .4L}}} +\tikztiming@ifsym@def{\PulseLow}{\hbox{\texttiming[timing/ifsym/macro]{.4H .6L .4H}}} +\tikztiming@ifsym@def{\LongPulseHigh}{\hbox{\texttiming[timing/ifsym/macro]{.4L H .4L}}} +\tikztiming@ifsym@def{\LongPulseLow}{\hbox{\texttiming[timing/ifsym/macro]{.4H L .4H}}} +\tikztiming@ifsym@def{\textifsym}{\texttiming[timing/ifsym]} +\let\tikztiming@ifsym@def\@undefined +\endinput +%% +%% End of file `tikz-timing-ifsym.sty'. diff --git a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-interval.sty b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-interval.sty new file mode 100644 index 00000000000..ba133dea8e9 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-interval.sty @@ -0,0 +1,111 @@ +%% +%% This is file `tikz-timing-interval.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% tikz-timing.dtx (with options: `lib,lib-interval') +%% +%% Copyright (C) 2009 by Martin Scharrer +%% +%% This work 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 2008/05/04 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files tikz-timing.dtx, tikz-timing.ins +%% and the derived file tikz-timing.sty. +%% +\RequirePackage{svn-prov}[2009/05/03] +\ProvidesPackageSVN[tikz-timing-interval] + {$Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $} + [v0.7 + TikZ-Timing Library for + alternative Z transitions] +\GetFileInfoSVN*% +\RequirePackage{tikz-timing}[\filedate]% +\DefineFileInfoSVN + + +\let\tikztiming@linterval\relax +\let\tikztiming@rinterval\relax + +\tikztimingdef{LZ}{ + \tikztiming@linterval + {\newdraw [\style]} + {-- ++(\zslope,+\height/2.)} + -- ++($ (#1,0) - (\zslope,0) $) +} + +\tikztimingdef{HZ}{% + \tikztiming@linterval + {\newdraw [\style]} + {-- ++(\zslope,-\height/2.)} + -- ++($ (#1,0) - (\zslope,0) $) +} + +\tikztimingdef{TZ}{% + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + \tikztiming@linterval + {\newdraw [\style]} + {-- ++(\zslope,\value{tikztimingtrans}*\height/2.)} + -- ++($ (#1,0) - (\zslope,0) $) +} + +\tikztimingdef{ZL}{% + \tikztiming@rinterval + {\newdraw} + {-- ++(\zslope,-\height/2.)} + -- ++($ (#1,0) - (\zslope,0) $) +} + +\tikztimingdef{ZH}{% + \tikztiming@rinterval + {\newdraw} + {-- ++(\zslope,\height/2.)} + -- ++($ (#1,0) - (\zslope,0) $) +} + +\tikztimingdef{ZT}{% + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + \tikztiming@rinterval + {\newdraw [\style]} + {-- ++(\zslope,\value{tikztimingtrans}*\height/2.)} + -- ++($ (#1,0) - (\zslope,0) $) +} + +\def\tikztiming@onetwo#1#2{#1#2} +\def\tikztiming@twoone#1#2{#2#1} + +\let\tikztiming@linterval\tikztiming@onetwo +\let\tikztiming@rinterval\tikztiming@onetwo + +\tikzset{timing/interval/.code={\pgfqkeys{/tikz/timing/interval}{#1}}} +\tikzset{timing/interval/.cd, + lo/.style={/tikz/timing/interval/left open}, + lc/.style={/tikz/timing/interval/left close}, + ro/.style={/tikz/timing/interval/right open}, + rc/.style={/tikz/timing/interval/right close}, + left close/.code={\let\tikztiming@linterval\tikztiming@onetwo}, + left open/.code={\let\tikztiming@linterval\tikztiming@twoone}, + right open/.code={\let\tikztiming@rinterval\tikztiming@onetwo}, + right close/.code={\let\tikztiming@rinterval\tikztiming@twoone}, +} +\tikzset{ + timing/interval/normal/.style={/tikz/timing/interval/left close,/tikz/timing/interval/right open}, + timing/interval/verilog/.style={/tikz/timing/interval/normal}, + timing/interval/metachar/.style={/tikz/timing/metachar={#1}[2]{[timing/interval={##2}]}}, +} + +\endinput +%% +%% End of file `tikz-timing-interval.sty'. diff --git a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-nicetabs.sty b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-nicetabs.sty new file mode 100644 index 00000000000..4b4f8cc0ad8 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-nicetabs.sty @@ -0,0 +1,125 @@ +%% +%% This is file `tikz-timing-nicetabs.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% tikz-timing.dtx (with options: `lib,lib-nicetabs') +%% +%% Copyright (C) 2009 by Martin Scharrer +%% +%% This work 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 2008/05/04 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files tikz-timing.dtx, tikz-timing.ins +%% and the derived file tikz-timing.sty. +%% +\RequirePackage{svn-prov}[2009/05/03] +\ProvidesPackageSVN[tikz-timing-nicetabs] + {$Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $} + [v0.7 + TikZ-Timing Library for + nice timing tables] +\GetFileInfoSVN*% +\RequirePackage{tikz-timing}[\filedate]% +\DefineFileInfoSVN + +\RequirePackage{array} +\RequirePackage{booktabs} + +\newcommand*\tikztiming@nicetabs@tableheader[3][]{% + \path [timing/table/midrules] [/utils/exec=\xdef\@gtempa{\the\pgflinewidth}]; + \path [timing/table/header,#1] + let \p1 = (0,\belowrulesep + \aboverulesep + \@gtempa + \arraystretch * + {(\ht\strutbox + \extrarowheight)} + \arraystretch\dp\strutbox) in + node [anchor=base west] (tikztiming@header) at (0,\y1) {\ignorespaces + #3\unskip\strut} + node [anchor=base east] at (-1*{(\tikztiming@coldist)},\y1) {\ignorespaces + #2\unskip\strut} + ; + \tikztiming@tableheadtrue +} +\newcommand*\tikztiming@nicetabs@tablerules[1][]{% + \begin{scope}[#1] + \coordinate (NW) at (current bounding box.north west); + \coordinate (SE) at (current bounding box.south east); + % + \draw [timing/table/rules] + let + \p1 = (NW), + \p2 = (SE), + \p3 = (last row text.base), + \p4 = ($ (0,\y3) - (0,\arraystretch\dp\strutbox + \aboverulesep + + .5\pgflinewidth) $) + in + (\x1-\tabcolsep,\y4) -- (\x2+\tabcolsep,\y4) + \iftikztiming@tablehead + let + \p5 = (tikztiming@header.base), + \p6 = ($ (0,\y5) + (0,\arraystretch * {(\ht\strutbox + \extrarowheight + )} + \belowrulesep + .5\pgflinewidth) $) + in + (\x1-\tabcolsep,\y6) -- (\x2+\tabcolsep,\y6) + \fi + ; + \draw + \iftikztiming@tablehead [timing/table/midrules] \else [timing/table/rules] \fi + let + \p1 = (NW), + \p2 = (SE), + \p3 = (0, \arraystretch * {( \ht\strutbox + \extrarowheight )} + + \belowrulesep + .5\pgflinewidth) + in + (\x1-\tabcolsep, \y3) + -- + (\x2+\tabcolsep, \y3) + ; + \end{scope} +} +\let\tikztiming@normal@tableheader\tikztiming@tableheader +\let\tikztiming@normal@tablerules\tikztiming@tablerules +\let\tikztiming@normal@coldist\tikztiming@coldist +\let\tikztiming@normal@rowdist\tikztiming@rowdist + +\tikzset{% + timing/no nice tabs/.code={% + \let\tikztiming@coldist\tikztiming@normal@coldist + \let\tikztiming@rowdist\tikztiming@normal@rowdist + \let\tikztiming@tableheader\tikztiming@normal@tableheader + \let\tikztiming@tablerules\tikztiming@normal@tablerules + }, + timing/nice tabs/.code={% + \ifx\tikztiming@tableheader\tikztiming@nicetabs@tableheader\else + \let\tikztiming@normal@coldist\tikztiming@coldist + \let\tikztiming@normal@rowdist\tikztiming@rowdist + \fi + \def\tikztiming@rowdist{% + \arraystretch * {(\ht\strutbox+\extrarowheight)}% + +\arraystretch\dp\strutbox + }% + \def\tikztiming@coldist{2\tabcolsep}% + \let\tikztiming@tableheader\tikztiming@nicetabs@tableheader + \let\tikztiming@tablerules\tikztiming@nicetabs@tablerules + }, + timing/nicetabs/no nice tabs/.style={/tikz/timing/no nice tabs}, + timing/nicetabs/off/.style={/tikz/timing/no nice tabs}, + timing/nicetabs/nice tabs/.style={/tikz/timing/nice tabs}, + timing/nicetabs/on/.style={/tikz/timing/nice tabs}, +} +\tikzset{timing/nice tabs}% +\RequirePackage{pgfopts} +\ProcessPgfOptions{/tikz/timing/nicetabs} +\endinput +%% +%% End of file `tikz-timing-nicetabs.sty'. diff --git a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-overlays.sty b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-overlays.sty index 4a7de0dc35b..a312ca31e04 100644 --- a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-overlays.sty +++ b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-overlays.sty @@ -4,7 +4,7 @@ %% %% The original source files were: %% -%% tikz-timing.dtx (with options: `lib-overlays') +%% tikz-timing.dtx (with options: `lib,lib-overlays') %% %% Copyright (C) 2009 by Martin Scharrer %% @@ -27,36 +27,63 @@ %% \RequirePackage{svn-prov}[2009/05/03] \ProvidesPackageSVN[tikz-timing-overlays] - {$Id: tikz-timing.dtx 1158 2009-07-28 09:14:00Z martin $} - [v0.6a - TikZ-Timing Library for timing overlays] + {$Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $} + [v0.7 + TikZ-Timing Library for + timing overlays] +\GetFileInfoSVN*% +\RequirePackage{tikz-timing}[\filedate]% \DefineFileInfoSVN -\tikztiming@defcode{O}{% - \@ifnextchar\relax - {\tikztiming@\relax}% - {\tikztiming@overlay}% -} -\def\tikztiming@overlay#1#2{% - \ifx\relax#1\relax - \tikztiming@output@flush - \def\next{\tikztiming@\relax}% +\tikztiming@defcode{O}#1{% + \ifx\relax#1\empty + \def\tikztiming@next{\tikztiming@parser#1}% \else - \ifx\relax#2\relax - \def\next{\tikztiming@#1\relax}% - \else - \tikztiming@output@flush - \let\tikztiming@overlay@lastchar\lastchar - \tikztiming@addtostr{ node [timing/save] (timing@overlay@start) {} }% - \tikztiming@#1\relax - \tikztiming@output@flush - \let\lastchar\tikztiming@overlay@lastchar - \tikztiming@addtostr{ (timing@overlay@start) }% - \def\next{\tikztiming@#2}% - \fi + \let\tikztiming@overlay@lastchar\tikztiming@lastchar + \let\tikztiming@overlay@width\tikztimingwidth + \tikztiming@output@addcode{\tikztiming@overlay@begin}% + \begingroup + \def\tikztiming@parser@end{% + \def\tikztiming@output@nextchar{@}% + \tikztiming@output@flush + } + \begingroup + \tikztiming@parser #1\relax + \endgroup + \endgroup + \tikztiming@output@addcode{\tikztiming@overlay@end}% + \global\let\tikztiming@lastchar\tikztiming@overlay@lastchar + \global\let\tikztimingwidth\tikztiming@overlay@width + \def\tikztiming@next{\expandafter\tikztiming@parser\@firstofone}% \fi - \next + \tikztiming@next } +\let\tikztiming@overlay@save\empty +\let\pgf@sh@nt@tikztiming@overlay@node\empty +\def\tikztiming@overlay@begin{ + [/utils/exec={% + \xdef\tikztiming@overlay@save{% + \noexpand\global\noexpand\c@tikztimingtrans\the\c@tikztimingtrans\relax% + \noexpand\global\noexpand\c@tikztimingtranspos\the\c@tikztimingtranspos\relax% + \noexpand\gdef\noexpand\pgf@sh@nt@tikztiming@overlay@node + {\csname pgf@sh@nt@tikztiming@overlay@node\endcsname}% + \noexpand\gdef\noexpand\pgf@sh@nt@timing@refa + {\csname pgf@sh@nt@timing@refa\endcsname}% + \noexpand\gdef\noexpand\pgf@sh@nt@timing@refb + {\csname pgf@sh@nt@timing@refb\endcsname}% + \noexpand\gdef\noexpand\pgf@sh@nt@timing@ref + {\csname pgf@sh@nt@timing@ref\endcsname}% + \noexpand\gdef\noexpand\tikztiming@overlay@save{% + \expandafter\unexpanded\expandafter{\tikztiming@overlay@save}% + }% + }% + }]% + node [timing/save] (tikztiming@overlay@node) {} + }% +\def\tikztiming@overlay@end{% + \tikztiming@newdraw (tikztiming@overlay@node) + [/utils/exec={\tikztiming@overlay@save}] +}% \endinput %% %% End of file `tikz-timing-overlays.sty'. diff --git a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing.sty b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing.sty index 1328131562c..d2ff15dc603 100644 --- a/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing.sty +++ b/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing.sty @@ -27,8 +27,8 @@ %% \RequirePackage{svn-prov}[2009/05/03] \ProvidesPackageSVN - {$Id: tikz-timing.dtx 1158 2009-07-28 09:14:00Z martin $} - [v0.6a + {$Id: tikz-timing.dtx 1580 2009-12-09 11:14:01Z martin $} + [v0.7 Digital Timing Diagrams using TikZ] \DefineFileInfoSVN[tikztiming] @@ -42,89 +42,148 @@ {\RequirePackage{environ}} {\RequirePackage{amsmath}} \fi - -\newcommand*\usetikztiminglibrary[2][]{% - \edef\tikztiming@library@options{#1}% - \@ifnextchar{[}%] - {\tikztiming@library{#2}}% - {\tikztiming@library{#2}[]}% -} -\def\tikztiming@library#1[#2]{% - \edef\tikztiming@library@date{#2}% - \tikztiming@library@#1,\relax -} - -\def\tikztiming@library@#1,{% - \IfFileExists{tikz-timing-#1.sty}% - {\RequirePackage[\tikztiming@library@options]{tikz-timing-#1}% - [\tikztiming@library@date]}% - {\PackageError{tikz-timing}% - {No tikz-timing library `#1' found!}% - {}{}{}{}% - }% - \@ifnextchar\relax{}{\tikztiming@library@}% -} - \def\tikztimingwidth{0.0} \newcount\tikztiming@numint \newcount\tikztiming@numfrac -\def\tikztiming@num{1.0}% +\def\tikztiming@wscale{1.0}% +\def\tikztimingsetwscale#1{% + \pgfmathparse{#1}% + \let\tikztiming@wscale\pgfmathresult +} +\def\tikztiming@num{0.0}% \let\tikztiming@back\empty \newlength\tikztiming@xunit \newlength\tikztiming@yunit +\setlength{\tikztiming@xunit}{1.6ex}% +\setlength{\tikztiming@yunit}{1.6ex}% + +\def\tikztiming@setnum#1{% + \pgfmathparse{#1}% + \global\let\tikztiming@num\pgfmathresult +} + +\newcount\tikztiming@debug + +\def\tikztiming@xsep{0pt} +\def\tikztiming@ysep{0pt} \newcounter{tikztiming@nrows}% \def\tikztiming@rowdist{2}% \def\tikztiming@coldist{1}% -\def\tikztiminglabel#1{#1}% -\def\tikztiming@prefix{tikztiming@trans@} +\def\tikztiming@prefix{tikztiming@trans@}% +\def\tikztiming@ttt#1#2#3{#1#2#3}% +\def\tikztiming@pfxtr{% + \tikztiming@prefix\expandafter\tikztiming@ttt +} + +\def\timingwidth{1}% +\def\timingheight{1}% -\tikzset{timing/.style={% - x=1.6ex, y=1.6ex, +\tikzset{% + timing/.style={% line cap=round, line join=round, - /utils/exec={\setlength{\tikztiming@xunit}{1.6ex}\setlength{\tikztiming@yunit}{1.6ex}}, - }% + timing/adjust@xy + },% } \tikzset{% timing/.cd, + adjust@xy/.style={% + /utils/exec={% + \tikz@textfont + \setlength{\tikztiming@xunit}{1.6ex}% + \setlength{\tikztiming@yunit}{1.6ex}% + },% + /tikz/x=1.6ex, /tikz/y=1.6ex, + }, + font/.style={% + /tikz/font={#1}, + /tikz/timing/adjust@xy + },% initchar/.value required, - initchar/.code={\ifx\lastchar\empty\uppercase{\def\lastchar{#1}}\fi}, - metachar/.code 2 args={\tikztimingmetachar{#1}{#2}}, + initchar/.code={\uppercase{\gdef\tikztiming@lastchar{#1}}}, + metachar/.code={\tikztimingmetachar#1}, grid/.style={timing,help lines}, + @grid/.code={\texttiminggrid}, + draw grid/.style={% + timing/before text/.append style={timing/@grid},% + timing/before/.append style={timing/@grid}% + }, + no grid/.style={timing/@grid/.code={}}, + before/.code={}, + after/.code={}, + before text/.code={\texttimingbefore}, + after text/.code={\texttimingafter}, picture/.style={timing,line width=0.15ex}, intext/.style={timing,line width=0.15ex}, inline node/.style={shape=coordinate}, - table/.style={timing,line width=0.15ex,font=\sffamily}, + inline node/from char/.store in=\tikztiming@node@fromchar, + inline node/to char/.store in=\tikztiming@node@tochar, + table/.style={font=\sffamily,timing,line width=0.15ex}, + before table/.code={}, + after table/.code={}, coord/.style={coordinate}, - save/.style={coordinate,/utils/exec=\tikztiming@savesettings}, - restore/.style={/utils/exec=\tikztiming@restoresettings}, - name/.style={inner sep=0pt,outer sep=0pt}, + save/.style={coordinate}, + restore/.style={/utils/exec={\expandafter\tikzset\expandafter{\tikztiming@saved@options}}}, + option/.style={/utils/exec={\g@addto@macro\tikztiming@saved@options{#1,}},#1}, + nooptions/.style={/utils/exec={\gdef\tikztiming@saved@options{}}}, + name/.style={inner sep=0pt,outer sep=0pt,minimum size=0pt}, + text format/.store in=\tikztiming@textformat, + @/.style={}, + D/.style={timing/d}, + D/text/.style={timing/d/text}, + D/background/.style={timing/d/background}, + D@edge@/.style={timing/d@edge@}, + D@edge@/text/.style={timing/d@edge@/text}, + D@edge@/background/.style={timing/d@edge@/background}, + U/.style={timing/u}, + U/text/.style={timing/u/text}, + U/background/.style={timing/u/background}, + U@edge@/.style={timing/u@edge@}, + U@edge@/text/.style={timing/u@edge@/text}, + U@edge@/background/.style={timing/u@edge@/background}, + H/.style={timing/h}, + L/.style={timing/l}, + E/.style={timing/e}, + E/background/.style={timing/e/background}, + M/decoration/.style={timing/m/decoration}, + M/base/.style={timing/m/base}, + M/.style={timing/m}, + G/.style={timing/g}, + Z/.style={timing/z}, + T/.style={timing/t}, + C/.style={timing/c}, + X/.style={timing/x}, + d/.style={}, d/text/.style={timing,scale=0.6,font=\sffamily}, - d/background/.style={}, + d/background/.style={draw=none}, + d@edge@/.style={timing/d}, + d@edge@/text/.style={timing/d/text}, + d@edge@/background/.style={timing/d/background}, + u/.style={}, + u/background/.style={draw=none,fill=gray}, + u@edge@/.style={timing/u}, + u@edge@/text/.style={timing/u/text}, + u@edge@/background/.style={timing/u/background}, h/.style={}, l/.style={}, - d/.style={}, e/.style={}, - e/background/.style={}, - a/.style={->}, - w/.style={<-}, - m/.style={black!40!brown}, - m/decoration/.style={decorate,decoration={zigzag,segment - length=.25\tikztiming@xunit,amplitude=.225\tikztiming@yunit}}, - k/.style={black!40!blue,semitransparent}, - u/background/.style={fill=gray}, - u/.style={}, - o/background/.style={}, - o/.style={timing/d,line width=0.10ex,dotted}, - g/.style={}, + e/background/.style={draw=none}, + m/decoration/.style={decorate,% + decoration={zigzag,segment length=.25\tikztiming@xunit, + amplitude=.225\tikztiming@yunit}}, + m/base/.style={black!40!brown}, + m/.style={timing/m/base,timing/m/decoration}, + g/.style={decorate=false}, z/.style={blue}, t/.style={}, - c/.style={timing/slope=0.0}, + c/.style={timing/lslope=0.0}, x/.style={red}, table/grid/.style={timing/grid}, table/lines/.style={}, table/rules/.style={line width=0.08em,line cap=butt}, + table/midrules/.style={line width=0.05em,line cap=butt}, + table/header/.style={timing/name}, slope/.code={% \tikztimingsetslope{#1}% \tikztimingsetdslope{2*#1}% @@ -133,8 +192,25 @@ lslope/.code={\tikztimingsetslope{#1}}, dslope/.code={\tikztimingsetdslope{#1}}, zslope/.code={\tikztimingsetzslope{#1}}, + wscale/.code={\tikztimingsetwscale{#1}}, coldist/.store in=\tikztiming@coldist, rowdist/.store in=\tikztiming@rowdist, + outer xsep/.store in=\tikztiming@xsep, + outer ysep/.store in=\tikztiming@ysep, + outer sep/.style={/tikz/timing/outer xsep=#1,/tikz/timing/outer ysep=#1}, + % + debug/level/.code={\tikztiming@debug=#1\relax}, + debug/level/.value required, + debug/scope/.style={font=\sffamily\tiny,gray}, + debug/node/.style={above,inner sep=2pt}, + debug/nodes/.style={% + /tikz/timing/after table/.append code={\tikztiming@marknodes{\tikztiming@namednodes}}, + /tikz/timing/after text/.append code={\tikztiming@marknodes{\tikztiming@namednodes}} + }, + debug/markcmd/.store in={\tikztiming@markcmd}, +} +\tikzset{timing/inline node/.cd, + from char={}, to char={} } \def\texttimingbefore{} \def\texttimingafter{} @@ -144,179 +220,308 @@ } \DeclareRobustCommand*\texttiming[2][]{% \begingroup - \tikztiming@init + \let\tikztiming@lastchar\empty + \let\tikztiming@settings\empty + \tikzset{timing/before/.append style={timing/before text}}% + \tikzset{timing/after/.prefix style={timing/after text}}% \ifx\relax#1\relax\else \tikztiming@testoptarg#1\relax\relax% \fi - \def\@tempa{\begin{tikzpicture}[timing/intext,}%]}[ - \expandafter\@tempa\settings] - \@ifundefined{tikztiming@initcode@\lastchar}% - {}% - {\@nameuse{tikztiming@initcode@\lastchar}}% - \ifx\lastchar\empty\else - \@ifundefined{\tikztiming@prefix\lastchar @start}% - {\PackageWarning{tikz-timing}{Start value for timing character '\lastchar' - is not defined and will be ignored!}{}{}{}}% - {\tikztiming@nameaddtostr{\lastchar @start}{}}% - \fi - \tikztiming@#2\relax - %\message{^^J\meaning\tikztiming@str^^J}% - \path[use as bounding box] (0,0) rectangle - (\timingwidth*\tikztimingwidth,\timingheight);% - \texttimingbefore - \tikztiming@str;% - \node [shape=tikztiming@shape,anchor=origin,name=last texttiming] at (0,0) - {}; - \texttimingafter + \begin{tikzpicture}[timing/intext,baseline={(0,0)}] + \tikztiming@picinit + \def\@tempa{\expandafter\timing\expandafter[\tikztiming@settings] at (0,0)}% + \expandafter\@tempa\expandafter{\expandafter[\tikztiming@lastchar]#2};% \end{tikzpicture}% \endgroup } \def\tikztiming@testoptarg#1#2\relax{% \ifx\relax#2\relax - \uppercase{\def\lastchar{#1}}% + \uppercase{\def\tikztiming@lastchar{#1}}% \else - \def\settings{#1#2}% + \def\tikztiming@settings{#1#2}% \fi } +\def\tikztiming@picinit{% + \global\let\tikztiming@namednodes\empty +} +\let\tikztiming@namednodes\empty \def\tikztiming@init{% - \let\lastchar\empty% - \let\currentchar\empty - \let\settings\empty + \def\tikztiming@lastchar{@}% + \def\tikztiming@num{0}% + \let\tikztiming@currentchar\empty + \let\tikztiming@settings\empty + \let\tikztiming@fromchar\empty + \let\tikztiming@tochar\empty + \let\setwscale\tikztimingsetwscale + \def\wscale{\tikztiming@wscale}% + \let\xunit\tikztiming@xunit + \let\yunit\tikztiming@yunit + \def\slope{\timingslope}% + \def\lslope{\timingslope}% + \def\zslope{\timingzslope}% + \def\dslope{\timingdslope}% + \gdef\tikztiming@saved@settings{}% + \gdef\tikztiming@saved@options{}% + \gdef\tikztiming@oldnodecenter@{}% \def\tikztimingwidth{0.0}% \setcounter{tikztimingtrans}{-1}% \setcounter{tikztimingtranspos}{0}% - \def\tikztiming@str{\draw (0,0) coordinate (timing/start base) }% + \def\tikztiming@str{% + \useasboundingbox (0,0) rectangle (\tikztimingwidth,\timingheight); + \draw (0,0) + coordinate (timing@refa) + coordinate [shift={(0,\timingheight)}] (timing@refb) + coordinate [shift={(0,\timingheight/2)}] (timing@ref) + coordinate (timing/start) + coordinate (timing/start base) + }% } -\def\timing{% +\def\tikz@timing{% \@ifnextchar{[}% - {\timing@}% - {\timing@[]}% + {\tikz@timing@}% + {\tikz@timing@[]}% +} +\g@addto@macro\tikz@installcommands{% + \let\tikz@origtiming=\timing% + \let\timing=\tikz@timing% } -\def\timing@[#1]{% +\g@addto@macro\tikz@uninstallcommands{% + \let\timing=\tikz@origtiming% +} +\def\tikz@timing@[#1]{% \@ifnextchar{a}% - {\timing@at{#1}}% + {\tikz@timing@at{#1}}% {\PackageWarning{tikz-timing}{The \string\timing\space command awaits now an `at' before the coordinate, like the \string\node\space command is doing. Please update your source code to ensure compatibility with newer versions}{}{}{}% \@ifnextchar{+}% - {\timing@@{#1}}% + {\tikz@timing@@{#1}}% {\@ifnextchar(%) - {\timing@@{#1}}% - {\timing@@{#1}++(0,0)}% + {\tikz@timing@@{#1}}% + {\tikz@timing@@{#1}++(0,0)}% }% }% } -\def\timing@at#1at#2(#3){% - \timing@@@{#1}{#2(#3)}% +\def\tikz@timing@at#1at#2(#3){% + \tikz@timing@@@{#1}{#2(#3)}% } -\def\timing@@#1#2(#3){% - \timing@@@{#1}{#2(#3)}% +\def\tikz@timing@@#1#2(#3){% + \tikz@timing@@@{#1}{#2(#3)}% } -\def\timing@@@#1#2#3{% +\def\tikz@timing@@@#1#2#3{% \begingroup \tikztiming@init \let\tikz@alias=\pgfutil@empty% \begin{scope}[shift={#2},timing,#1]% \@ifnextchar{[}% - {\timing@@@init}% - {\timing@@@init[]}% + {\tikz@timing@@@init}% + {\tikz@timing@@@init[]}% #3\relax - %\message{^^J\meaning\tikztiming@str^^J}% + \ifnum\tikztiming@debug>1 + \message{^^J\meaning\tikztiming@str^^J}% + \ifnum\tikztiming@debug>2 + {% + \def\@protect##1{\def##1{\noexpand##1}}% + \@protect\useasboundingbox + \@protect\draw + \@protect\p + \@protect\n + \@protect\x + \@protect\y + \@protect\tikztiming@overlay@save + \edef\@tempa{\tikztiming@str}% + \message{^^J\meaning\@tempa^^J}% + }% + \fi + \fi + \tikzset{timing/before}% \tikztiming@str;% \node [shape=tikztiming@shape,anchor=origin,#1] at (0,0) {}; + \tikzset{timing/after}% \end{scope}% \endgroup - \timing@@@end + \tikz@timing@@@end } -\def\timing@@@end#1;{% - \ifx;#1;\else - \PackageError{tikz-package}{Can not parse timing path}{}{}{}% - \fi +\def\tikz@timing@@@end{% + \@ifnextchar{;}% + {\@gobble}% + {\PackageError{tikz-package}{Can not parse timing path}{}{}{}}% } -\def\timing@@@init[#1]{% +\def\tikz@timing@@@init[#1]{% + \begingroup \ifx\relax#1\relax\else - \uppercase{\def\lastchar{#1}}% + \uppercase{\def\tikztiming@lastchar{#1}}% \fi - \@ifundefined{tikztiming@initcode@\lastchar}% + \@ifundefined{tikztiming@initcode@\tikztiming@lastchar}% {}% - {\@nameuse{tikztiming@initcode@\lastchar}}% - \ifx\lastchar\empty\else - \@ifundefined{\tikztiming@prefix\lastchar @start}% - {\PackageWarning{tikz-timing}{Start value for timing character '\lastchar' - is not defined and will be ignored!}{}{}{}}% - {\tikztiming@nameaddtostr{\lastchar @start}{}}% + {\@nameuse{tikztiming@initcode@\tikztiming@lastchar}}% + \if @\tikztiming@lastchar\relax\else + \tikztiming@iftrans{@\tikztiming@lastchar}% + {\tikztiming@nameaddtostr{@}{\tikztiming@lastchar}{}}% + {\PackageWarning{tikz-timing}{Start value for timing character + '\tikztiming@lastchar' is not defined and will be ignored!}{}{}{}}% \fi - \tikztiming@ -} -\let\tikztiming@trans@\@gobble -\def\tikztiming@aftercode@T{% - \tikztiming@output@flush -} -\def\tikztiming@aftercode@t{% - \tikztiming@aftercode@T -} -\def\tikztiming@aftercode@C{% - %\tikztiming@output@flush -} -\def\tikztiming@aftercode@c{% - \tikztiming@aftercode@C + \tikztiming@parser } -\def\tikztiming@aftercode@G{% - \let\lastchar\secondlastchar - \let\tikztimingwidth\lasttikztimingwidth -} -\def\tikztiming@aftercode@g{% - \let\lastchar\secondlastchar - \let\tikztimingwidth\lasttikztimingwidth -} -\def\tikztiming@aftercode@S{% - \let\lastchar\secondlastchar -} -\def\tikztiming@aftercode@s{% - \let\lastchar\secondlastchar +\def\tikztiming@trans@#1#2#3#4{% + \csname\tikztiming@prefix #2#3#4\endcsname{#1}{#2}{#3}{#4}% } \def\tikztiming@beforenextcode@D@edge@{% - \if D\currentchar\else - \if d\currentchar\else - \def\lastchar{D}% - \fi + \if D\tikztiming@currentchar\else + \gdef\tikztiming@lastchar{D}% \fi } -\def\tikztiming@beforenextcode@d@edge@{% - \if D\currentchar\else - \if d\currentchar\else - \def\lastchar{D}% - \fi +\def\tikztiming@beforenextcode@U@edge@{% + \if U\tikztiming@currentchar\else + \gdef\tikztiming@lastchar{U}% \fi } +\def\tikztiming@initcode@{% + \gdef\tikztiming@lastchar{@}% +} \def\tikztiming@initcode@D{% - \def\lastchar{D@edge@}% + \gdef\tikztiming@lastchar{D@edge@}% } -\def\tikztiming@initcode@d{% - \def\lastchar{d@edge@}% +\def\tikztiming@initcode@U{% + \gdef\tikztiming@lastchar{U@edge@}% } -\def\tikztiming@{% - \@ifnextchar\bgroup - {\tikztiming@testfornum}% +\def\tikztiming@parser{% + \@ifnextchar\relax + {\tikztiming@parser@end}% {\tikztiming@testfornum}% } -\def\tikztiming@eaddtostr#1{% +\def\tikztiming@eaddto#1#2{% \begingroup - \tikztiming@internaldefs{}% - \@temptokena\expandafter{\tikztiming@str}% - \xdef\tikztiming@str{% + \tikztiming@internaldefs + \@temptokena\expandafter{#1}% + \xdef#1{% \the\@temptokena - #1% + #2% }% \endgroup } +\def\tikztiming@eaddtostr{% + \tikztiming@eaddto\tikztiming@str +} \def\tikztiming@addtostr{% \g@addto@macro\tikztiming@str } +\def\tikztiming@makeglobal#1{% + \global\let#1#1\relax\relax +} +\def\tikztiming@trans{}% +\def\tikztiming@iftrans#1{% + \tikztiming@iftrans@#1\empty\empty\empty\relax +} +\def\tikztiming@iftrans@#1#2#3#4\relax{% + \begingroup + \xdef\tikztiming@trans{#1#2}% + \ifx\tikztiming@trans\empty + \gdef\tikztiming@trans{{@}{}{@}}% + \else + \global\let\tikztiming@trans\relax + % Use triple macros before double macros + \@ifundefined{tikztiming@triple@#2}% + {\@ifundefined{\tikztiming@prefix#1#2}% + {}% + {\xdef\tikztiming@trans{{#1}{#2}{}}}% + }% + {% + \@ifundefined{\tikztiming@prefix#1#2#3}% + {}% + {\xdef\tikztiming@trans{{#1}{#2}{#3}}}% + }% + % If both do not exist, search for aliases: + \ifx\tikztiming@trans\relax + \@ifundefined{tikztiming@alias@#1}% + {\edef\chara{#1}}% + {\edef\chara{#1,\csname tikztiming@alias@#1\endcsname}}% + \@ifundefined{tikztiming@alias@#2}% + {\edef\charb{#2}}% + {\edef\charb{#2,\csname tikztiming@alias@#2\endcsname}}% + \@ifundefined{tikztiming@triple@#2}% + {\def\charc{\empty}}% + {% + \@ifundefined{tikztiming@alias@#3}% + {\edef\charc{#3,}}% + {\edef\charc{#3,\csname tikztiming@alias@#3\endcsname,}}% + }% + \ifx\charb\empty + \def\charb{\empty}% + \fi + \let\tikztiming@next\relax + \foreach \b in \charb {% + \foreach \a in \chara {% + \foreach \c in \charc {% + %\message{ ^^J Testing: \a\b\c ^^J}% + \@ifundefined{\tikztiming@prefix\a\b\c}% + {}{% + \xdef\tikztiming@trans{{#1}{#2}{#3}}% + \expandafter\tikztimingcpy\expandafter + {\tikztiming@trans}{\a\b\c}% + \ifnum\tikztiming@debug>0 + \message{^^J DEBUG: '#1#2#3' = '\a\b\c' ^^J}% + \fi + \expandafter\tikztiming@makeglobal + \csname\tikztiming@pfxtr\tikztiming@trans\endcsname + \ifnum\tikztiming@debug>1 + \ifnum\tikztiming@debug>2 + \expandafter\show\csname\tikztiming@pfxtr\tikztiming@trans\endcsname + \else + \message{^^J\tikztiming@trans: + \expandafter\meaning\csname\tikztiming@pfxtr\tikztiming@trans\endcsname^^J}% + \message{^^J\a\b\c: + \expandafter\meaning\csname\tikztiming@prefix\a\b\c\endcsname^^J}% + \fi + \fi + \global\let\tikztiming@next\breakforeach + }% + \tikztiming@next + }% + \tikztiming@next + }% + \tikztiming@next + }% + \fi + \fi + \endgroup + \ifx\tikztiming@trans\relax + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi +} +\def\tikztiming@nameaddtostr#1#2#3{% + \tikztiming@iftrans{{#1}{#2}{#3}}% + {% + \edef\@tempa{\noexpand\tikztiming@trans@{\tikztiming@num}\tikztiming@trans}% + \expandafter\g@addto@macro + \expandafter\tikztiming@str + \expandafter{\@tempa}% + }% + {\PackageWarning{tikz-timing}{No transitions '#1#2' (or '#1#2#3') defined!}}% +} +\def\tikztiming@output@addcode#1{% + \g@addto@macro\tikztiming@output@bufcode{\unexpanded{ #1 }}% +} +\def\tikztiming@output@eaddcode#1{% + \g@addto@macro\tikztiming@output@bufcode{ #1 }% +} +\def\tikztiming@output@Eaddcode{% + \tikztiming@eaddto\tikztiming@output@bufcode% +} +\def\tikztiming@output@bufchara{}% +\def\tikztiming@output@bufcharb{}% +\def\tikztiming@output@bufnum{0}% +\def\tikztiming@output@bufcode{}% +\def\tikztiming@output@nextchar{}% \def\tikztiming@output#1#2{% + \edef\tikztiming@fromchar{#1}% + \edef\tikztiming@tochar{#2}% \ifx\relax#2\relax - \tikztiming@nameaddtostr{#1}% + %\tikztiming@output@codeflush + \tikztiming@nameaddtostr{}{#1}{}% \else \ifcase0% \ifx\tikztiming@output@bufchara\empty @@ -327,61 +532,65 @@ % not empty \edef\tikztiming@output@currentchar{#2}% \ifcase0% - \expandafter\ifx\csname tikztiming@nocombine@#2\endcsname\relax - \ifx\tikztiming@output@currentchar\tikztiming@output@bufcharb - 1% - \fi\fi + \ifx\tikztiming@output@bufcode\empty% Stop combining if code was inserted + \expandafter\ifx\csname tikztiming@nocombine@#2\endcsname\relax + \ifx\tikztiming@output@currentchar\tikztiming@output@bufcharb + 2% + \fi + \fi + \else + 1% + \fi \relax + \edef\tikztiming@output@nextchar{#2}% + \tikztiming@output@flush + \xdef\tikztiming@output@bufchara{#1}% + \xdef\tikztiming@output@bufcharb{#2}% + \or + \edef\tikztiming@output@nextchar{#2}% \tikztiming@output@flush - \edef\tikztiming@output@bufchara{#1}% - \edef\tikztiming@output@bufcharb{#2}% + \xdef\tikztiming@output@bufchara{#1}% + \xdef\tikztiming@output@bufcharb{#2}% \or \pgfmathparse{\tikztiming@output@bufnum + \tikztiming@num}% - \let\tikztiming@output@bufnum\pgfmathresult - \def\tikztiming@num{1.0}% + \global\let\tikztiming@output@bufnum\pgfmathresult \fi \else % empty - \edef\tikztiming@output@bufchara{#1}% - \edef\tikztiming@output@bufcharb{#2}% - \let\tikztiming@output@bufnum\tikztiming@num - \def\tikztiming@num{1.0}% + \tikztiming@output@codeflush + \xdef\tikztiming@output@bufchara{#1}% + \xdef\tikztiming@output@bufcharb{#2}% + \global\let\tikztiming@output@bufnum\tikztiming@num \fi \fi } -\def\tikztiming@output@bufchara{}% -\def\tikztiming@output@bufcharb{}% -\def\tikztiming@output@bufnum{0}% \def\tikztiming@output@flush{% + \tikztiming@output@charflush + \tikztiming@output@codeflush +} +\def\tikztiming@output@codeflush{% + \tikztiming@eaddtostr{\tikztiming@output@bufcode}% + \global\let\tikztiming@output@bufcode\empty% +} +\def\tikztiming@output@charflush{% \begingroup \let\tikztiming@num\tikztiming@output@bufnum - \tikztiming@nameaddtostr{% - \tikztiming@output@bufchara - \tikztiming@output@bufcharb - }% + \tikztiming@nameaddtostr + {\tikztiming@output@bufchara}% + {\tikztiming@output@bufcharb}% + {\tikztiming@output@nextchar}% \endgroup% + \gdef\tikztiming@output@nextchar{}% \gdef\tikztiming@output@bufchara{}% \gdef\tikztiming@output@bufcharb{}% \global\let\tikztiming@output@bufnum\tikztiming@num - \gdef\tikztiming@num{1.0}% -} -\def\tikztiming@nameaddtostr#1{% - \begingroup - \edef\@tempa{\tikztiming@num}% - \expandafter\g@addto@macro - \expandafter\tikztiming@str - \expandafter{\csname\tikztiming@prefix#1\expandafter\endcsname - \expandafter{\@tempa} }% - \endgroup - \def\tikztiming@num{1.0}% } -\newcommand\tikztiming@nameedef[3][A]{% - \def\@gtempa##1{#3}% - \expandafter\let\csname\tikztiming@prefix#2@general\endcsname\@gtempa +\newcommand\tikztiming@nameedef[4]{% + \def\@gtempa##1{#4}% \begingroup - \tikztiming@internaldefs{#1}% - \xdef\@gtempa##1{\@gtempa{\width}}% + \tikztiming@internaldefs + \xdef\@gtempa##1##2##3##4{\@gtempa{\width}}% \endgroup - \expandafter\let\csname\tikztiming@prefix#2\endcsname\@gtempa + \expandafter\let\csname\tikztiming@prefix#1#2#3\endcsname\@gtempa \let\@gtempa\empty } \newcommand\tikztiming@namelet[2]{% @@ -398,7 +607,10 @@ \csname\tikztiming@prefix#2\endcsname \fi } -\def\tikztiming@@end{% +\def\tikztiming@parser@end{% + \def\tikztiming@output@nextchar{@}% + \let\tikztiming@fromchar\tikztiming@tochar + \edef\tikztiming@tochar{@}% \tikztiming@output@flush \global\let\tikztimingwidth\tikztimingwidth \tikztiming@addtostr{ coordinate (timing/end) @@ -406,42 +618,29 @@ coordinate (timing/end base) at (\x2,\y1) coordinate (timing/end top) at (\x2,1+\y1) }% + \endgroup + \tikztiming@endhook% } -\def\tikztiming@@#1{% +\let\tikztiming@endhook\relax +\def\tikztiming@parser@#1{% \ifx\relax#1\empty - \expandafter\tikztiming@@end + \expandafter\tikztiming@parser@end \else - \let\lasttikztimingwidth\tikztimingwidth \tikztiming@iflower{#1}% - {\pgfmathparse{\tikztiming@num/2.0}\let\tikztiming@num\pgfmathresult}% + {\tikztiming@setnum{\tikztiming@num/2}}% {}% \ifx\tikztiming@back\empty\else - \pgfmathparse{\tikztiming@num-\tikztiming@back}% - \let\tikztiming@num\pgfmathresult - \let\tikztiming@back\empty + \tikztiming@setnum{\tikztiming@num - \tikztiming@back}% + \global\let\tikztiming@back\empty \fi \pgfmathparse{\tikztimingwidth + \tikztiming@num}% - \let\tikztimingwidth\pgfmathresult - \def\currentchar{#1}% - \uppercase{\def\currentcharuc{#1}}% - \@ifundefined{tikztiming@beforenextcode@\lastchar}% - {}% - {\@nameuse{tikztiming@beforenextcode@\lastchar}}% - \@ifundefined{tikztiming@beforecode@\currentchar}% - {}% - {\@nameuse{tikztiming@beforecode@\currentchar}}% - \@ifundefined{\tikztiming@prefix\lastchar\currentchar}% - {\@ifundefined{\tikztiming@prefix\lastchar\currentcharuc}% - {\PackageWarning{tikz-timing}{Timing transition '\lastchar\currentchar' - is not defined and will be ignored!}{}{}{}}% - {\tikztiming@output{\lastchar}{\currentcharuc}}% - }% - {\tikztiming@output{\lastchar}{\currentchar}}% - \let\secondlastchar\lastchar - \let\lastchar\currentcharuc - \@ifundefined{tikztiming@aftercode@\currentcharuc}% - {}% - {\@nameuse{tikztiming@aftercode@\currentcharuc}}% + \global\let\tikztimingwidth\pgfmathresult + \uppercase{\gdef\tikztiming@currentchar{#1}}% + \@nameuse{tikztiming@beforenextcode@\tikztiming@lastchar}% + \@nameuse{tikztiming@beforecode@\tikztiming@currentchar}% + \tikztiming@output{\tikztiming@lastchar}{\tikztiming@currentchar}% + \global\let\tikztiming@lastchar\tikztiming@currentchar + \@nameuse{tikztiming@aftercode@\tikztiming@currentchar}% \expandafter \tikztiming@testfortext \fi @@ -449,58 +648,90 @@ \def\tikztiming@testfortext{% \@ifnextchar\bgroup {\tikztiming@handletext}% - {\tikztiming@}% + {\tikztiming@parser}% } \def\tikztiming@handletext#1{% + \@ifnextchar\relax + {\def\tikztiming@output@nextchar{@}\tikztiming@handletext@{#1}}% + {\def\tikztiming@output@nextchar{Z}\tikztiming@handletext@{#1}}% +} +\def\tikztiming@handletext@#1{% \@ifnextchar{[}% - {\tikztiming@handletext@}% - {\tikztiming@handletext@[]}% - #1\relax + {\tikztiming@handletext@@}% + {\tikztiming@handletext@@[]}% + #1\tikztiming@endoftext } -\def\tikztiming@handletext@[#1]#2\relax{% - \begingroup +\def\tikztiming@handletext@@[#1]#2\tikztiming@endoftext{% + \@ifnextchar{\relax}% + {\def\tikztiming@output@nextchar{@}% + \tikztiming@handletext@@@{#1}{#2}}% + {\tikztiming@handletext@@@{#1}{#2}}% +} +\def\tikztiming@handletext@@@#1#2{% \expandafter\lowercase\expandafter{% - \expandafter\def\expandafter\currentcharlc - \expandafter{\currentchar}% + \expandafter\def\expandafter\@tempa + \expandafter{\tikztiming@currentchar}% }% - \pgfkeysifdefined{/tikz/timing/\currentcharlc/text/.@cmd}% + \pgfkeysifdefined{/tikz/timing/\@tempa/text/.@cmd}% {% - \tikztiming@output@flush - \tikztiming@eaddtostr{% - node (timing@dend) at +(\dslope/2.0,\height/2.0) {} - node [%] - shift={($ (timing@dstart)!0.5!(timing@dend) $)},% - timing/\currentcharlc/text,% - }% - \endgroup - \tikztiming@addtostr{%[ - #1% - ] {#2}% - }% - \def\lastchar{D@edge@}% + \edef\@tempa{node [timing/\@tempa/text,}% + \expandafter\tikztiming@output@addcode\expandafter{% + \@tempa + #1] at ($ (timing@dstart) !.5! (timing@dend) $) + {\tikztiming@textformat{#2}} + }% + \ifcase0% + \if @\tikztiming@output@bufchara + 1% + \else + \ifx\tikztiming@output@bufchara\tikztiming@currentchar + 1% + \fi + \fi + \relax + \else + \fi + \xdef\tikztiming@output@bufcharb{\tikztiming@currentchar @edge@}% + \xdef\tikztiming@lastchar{\tikztiming@currentchar @edge@}% }{% \endgroup \PackageWarning{tikz-timing}{Ignoring text for character - '\currentchar'!}{}{}{}% + '\tikztiming@currentchar'!}{}{}{}% }% - \tikztiming@ + \tikztiming@parser } +\let\tikztiming@textformat\empty \def\tikztiming@defcode#1{% \@namedef{tikztiming@code@\meaning#1}% } +\tikztiming@defcode{@}#1{% + #1\relax + \tikztiming@parser +} +\begingroup + \expandafter\let\expandafter\temp + \csname tikztiming@code@\meaning @\endcsname + \makeatother + \expandafter\global\expandafter\let + \csname tikztiming@code@\meaning @\endcsname\temp +\endgroup +\tikztiming@defcode$#1${% + \pgfmathparse{#1}% + \expandafter + \tikztiming@parser\pgfmathresult +} \tikztiming@defcode{,}{% - \tikztiming@output@flush - \tikztiming@eaddtostr{% + \tikztiming@output@eaddcode{% \newdraw }% - \tikztiming@ + \tikztiming@parser } \tikztiming@defcode{;}{% - \tikztiming@output@flush - \tikztiming@eaddtostr{% + \endgroup\begingroup + \tikztiming@output@eaddcode{% \newdrawns }% - \tikztiming@ + \tikztiming@parser } \tikztiming@defcode{N}{% \@ifnextchar[%] @@ -512,6 +743,53 @@ {\tikztiming@addnode@getoptions}% {\tikztiming@addnode@getoptions[]}% } +\tikztiming@defcode{B}{% + \pgfmathparse{\tikztiming@back+\tikztiming@num}% + \global\let\tikztiming@back\pgfmathresult + \tikztiming@parser +} +\tikztiming@defcode{b}{% + \pgfmathparse{\tikztiming@back+\tikztiming@num/2}% + \global\let\tikztiming@back\pgfmathresult + \tikztiming@parser +} +\tikztiming@defcode{F}{% + \pgfmathparse{\tikztiming@back-\tikztiming@num}% + \global\let\tikztiming@back\pgfmathresult + \tikztiming@parser +} +\tikztiming@defcode{f}{% + \pgfmathparse{\tikztiming@back-\tikztiming@num/2}% + \global\let\tikztiming@back\pgfmathresult + \tikztiming@parser +} +\tikztiming@defcode[{%}]{ + \@ifnextchar[%] + {\tikztiming@bothoption}% + {\@ifnextchar{!}% + {\tikztiming@parseroption}% + {\@ifnextchar{|}% + {\tikztiming@onceoption}% + {\tikztiming@addoption}% + }% + }% +} +\def\tikztiming@parseroption!#1!]{% + \pgfqkeys{/tikz/timing}{#1}% + \tikztiming@parser +} +\def\tikztiming@addoption#1]{% + \tikztiming@output@addcode{ [timing/option={#1}] }% + \tikztiming@parser +} +\def\tikztiming@bothoption[#1]]{% + \tikzset{#1}%[ + \tikztiming@addoption{#1}]% +} +\def\tikztiming@onceoption|#1|]{% + \tikztiming@output@addcode{ [#1] }% + \tikztiming@parser +} \def\tikztiming@addnode@getoptions[#1]{% \@ifnextchar(%) {\tikztiming@addnode@getname{#1}}% @@ -523,25 +801,54 @@ {\tikztiming@addnode@{#1}{#2}{}}% } \def\tikztiming@addnode@#1#2#3{% - \tikztiming@output@flush + \def\@tempa{#2}% + \ifx\@tempa\empty + \def\@tempa{ node [timing/inline node,% + timing/inline node/from char={\tikztiming@fromchar},% + timing/inline node/to char={\tikztiming@tochar},% + \unexpanded{#1}] }% + \def\@tempb{}% + \else + \def\@tempa{ node [timing/inline node,% + timing/inline node/from char={\tikztiming@fromchar},% + timing/inline node/to char={\tikztiming@tochar},% + \unexpanded{#1}] (\unexpanded{#2}) }% + \xdef\tikztiming@namednodes{\tikztiming@namednodes,#2}% + \fi + \expandafter\tikztiming@output@eaddcode\expandafter{\@tempa \unexpanded{{#3}}}% + \tikztiming@parser +} +\newcommand*\tikztiming@marknodes[2][]{% + \scope[timing/debug/scope,#1] + \edef\@tempa{floor((\noexpand\y1-\tikztiming@xunit) / \tikztiming@rowdist\tikztiming@xunit) * \tikztiming@rowdist\tikztiming@xunit}% + \foreach \N in #2 {% + \ifx\N\empty\else + \tikztiming@markcmd + \path let \p1=(\N) in + node [timing/debug/node] at ($ (\x1,\noexpand\@tempa) + (0,1) $) {\N}; + \fi + }% + \endscope +} +\def\tikztiming@markcmd{ \draw (\N) circle (1pt); }% +\newcommand*\tikztiming@mark@nodes[2][]{% \begingroup \def\@tempa{#2}% - \ifx\@tempa\empty - \def\@tempa{ node [timing/inline node,#1] }% - \else - \def\@tempa{ node [timing/inline node,#1] (#2) }% - \fi - \expandafter\tikztiming@addtostr\expandafter{\@tempa {#3} }% + \ifx\@tempa\empty \let\@tempa\tikztiming@namednodes \fi + \ifx\@tempa\space \let\@tempa\tikztiming@namednodes \fi + \def\@tempb{\tikztiming@marknodes[#1]}% + \expandafter\@tempb\expandafter{\expandafter{\@tempa}}% \endgroup - \tikztiming@ } \def\tikztiming@testforcode{% \@ifnextchar{!}% {\tikztiming@testforcode@}% {\@ifundefined{tikztiming@code@\meaning\@let@token}% - {\tikztiming@@}% - {\csname tikztiming@code@\meaning\@let@token\expandafter - \endcsname\@gobble}% + {\tikztiming@parser@}% + {\expandafter\afterassignment + \csname tikztiming@code@\meaning\@let@token\endcsname + \let\@let@token=% + }% }% } \def\tikztiming@testforcode@#1{% @@ -550,40 +857,15 @@ {% \PackageWarning{tikz-timing}{Missing braces after '!' character. Ignoring this character}{}{}{}% - \tikztiming@ + \tikztiming@parser }% } -\tikztiming@defcode{B}{% - \pgfmathparse{\tikztiming@back+\tikztiming@num}% - \let\tikztiming@back\pgfmathresult - \tikztiming@ -} -\tikztiming@defcode{b}{% - \pgfmathparse{\tikztiming@back+\tikztiming@num/2}% - \let\tikztiming@back\pgfmathresult - \tikztiming@ -} -\tikztiming@defcode{F}{% - \pgfmathparse{\tikztiming@back-\tikztiming@num}% - \let\tikztiming@back\pgfmathresult - \tikztiming@ -} -\tikztiming@defcode{f}{% - \pgfmathparse{\tikztiming@back-\tikztiming@num/2}% - \let\tikztiming@back\pgfmathresult - \tikztiming@ -} \def\tikztiming@handlecode#1{% - \tikztiming@output@flush - \tikztiming@addtostr{ #1 }% - \tikztiming@ -} -\tikztiming@defcode[#1]{% - \tikztiming@addtostr{ [#1] }% - \tikztiming@ + \tikztiming@output@addcode{ #1 }% + \tikztiming@parser } - \def\tikztiming@testfornum{% + \global\let\tikztiming@num\tikztiming@wscale \let\tikztiming@numchars\empty \tikztiming@numfrac0\relax \afterassignment @@ -607,6 +889,9 @@ \fi } \def\tikztiming@testfornum@{% + \ifx0\@let@token + \let\tikztiming@next\tikztiming@testfornum@@ + \else \ifnum0<\tikztiming@numint \let\tikztiming@next\tikztiming@testfornum@@ \else @@ -616,18 +901,17 @@ {% \tikztiming@numint1\relax \tikztiming@numfrac0\relax - \def\tikztiming@num{1.0}% + \global\let\tikztiming@num\tikztiming@wscale \if@tikztiming@metachar {\def\@tempa{\expandafter\expandafter\expandafter - \tikztiming@testfornum@@@@ - \expandafter\expandafter\expandafter{% - \csname tikztiming@metachar@\meaning\@let@token\endcsname}}% - \expandafter\@tempa\@gobble + \tikztiming@parser + \csname tikztiming@metachar@\meaning\@let@token\endcsname{1}}% + \expandafter\@tempa\@gobble }% {\tikztiming@testforcode}% }% }% - \fi + \fi\fi \tikztiming@next } \def\tikztiming@testfornum@@{% @@ -636,7 +920,8 @@ {\tikztiming@testfornum@@@}% } \def\tikztiming@testfornum@@@{% - \xdef\tikztiming@num{\the\tikztiming@numint.\expandafter\@gobble\the\tikztiming@numfrac}% + \edef\tikztiming@num{\the\tikztiming@numint.\expandafter\@gobble\the\tikztiming@numfrac}% + \tikztiming@setnum{\tikztiming@wscale * \tikztiming@num}% \@ifnextchar\bgroup {% \expandafter\tikztiming@numfrac\expandafter0\expandafter @@ -646,31 +931,21 @@ \PackageWarning{tikz-timing}% {Can not repeat group by a non-integer factor!^^J% Rounding '\tikztiming@num' to '\pgfmathresult'.}{}{}{}% - \let\tikztiming@num\pgfmathresult + \global\let\tikztiming@num\pgfmathresult \fi \tikztiming@testfornum@@@@ }% {% \if@tikztiming@metachar {\def\@tempa{\expandafter\expandafter\expandafter - \tikztiming@testfornum@@@@ - \expandafter\expandafter\expandafter{% - \csname tikztiming@metachar@\meaning\@let@token\endcsname}}% + \tikztiming@parser + \csname tikztiming@metachar@\meaning\@let@token\expandafter\endcsname + \expandafter{\tikztiming@num}}% \expandafter\@tempa\@gobble }% {\tikztiming@testforcode}% }% } -\def\tikztimingmetachar#1#2{% - \ifx\relax#2\relax - \expandafter\let\csname tikztiming@metachar@\meaning#1\endcsname\@undefined - \else - \@namedef{tikztiming@metachar@\meaning#1}{#2}% - \fi -} -\def\if@tikztiming@metachar#1#2{% - \@ifundefined{tikztiming@metachar@\meaning\@let@token}{#2}{#1}% -} \def\tikztiming@testfornum@@@@#1{% \begingroup \@temptokena{#1}% @@ -678,43 +953,67 @@ \endgroup \tikztiming@numint1\relax \tikztiming@numfrac0\relax - \expandafter\tikztiming@\tikztiming@numchars + \expandafter\tikztiming@parser\tikztiming@numchars +} +\def\tikztimingmetachar#1{% + \@ifnextchar{[}%] + {\tikztiming@metachar{#1}}% + {\tikztiming@metachar{#1}[]}% +} +\def\tikztiming@metachar#1[#2]#3{% + \ifx\relax#3\relax + \expandafter\let\csname tikztiming@metachar@\meaning#1\endcsname\@undefined + \else + \@namedef{tikztiming@metachar@\meaning#1}{}% + \ifx\relax#2\relax + \expandafter\renewcommand\expandafter*% + \csname tikztiming@metachar@\meaning#1\expandafter + \endcsname\expandafter[1]{##1{#3}}% + \else + \expandafter\renewcommand\expandafter*% + \csname tikztiming@metachar@\meaning#1\expandafter + \endcsname\expandafter[#2]{#3}% + \fi + \fi +} +\def\if@tikztiming@metachar#1#2{% + \@ifundefined{tikztiming@metachar@\meaning\@let@token}{#2}{#1}% } \newcounter{tikztimingrows} -\def\tikztiming@extracode{\@gobble{EXTRACODE}}% - +\def\abc{\tracingassigns=1} \newenvironment{tikztimingtable}[1][]{% \begingroup \setcounter{tikztiming@nrows}{0}% \def\tikztiming@maxwidth{0.0}% \let\extracode\tikztiming@extracode + \let\endextracode\tikztiming@endextracode \let\tablegrid\tikztiming@tablegrid \let\fulltablegrid\tikztiming@fulltablegrid \let\horlines\tikztiming@horlines \let\vertlines\tikztiming@vertlines - \let\tablerules\tikztiming@tablerules + \let\marknodes\tikztiming@mark@nodes + \def\background{\pgfonlayer{background}\scope}% + \def\endbackground{\endscope\endpgfonlayer}% + \def\tablerules{\tikztiming@tablerules}% + \def\tableheader{\tikztiming@tableheader}% \def\rowdist{\tikztiming@rowdist}% \def\coldist{\tikztiming@coldist}% \def\nrows{\the\c@tikztiming@nrows}% \def\twidth{\tikztiming@maxwidth}% \tikzpicture[timing/table,#1]% \coordinate (last row) at (0,\rowdist); - \coordinate (label pos) at (-1*\coldist,0); + \coordinate (label pos) at (-1*{(\coldist)},0); \coordinate (timing/table/top left) at (0,1); \coordinate (timing/table/bottom right) at (0,0); - \collect@body\tikztiming@table + \tikztiming@picinit + \tikzset{timing/before table}% + \tikztimingtable@checkrow }{% -} - -\def\tikztiming@table#1{% - \tikztimingtable@row#1\endtikztimingtable@ + \tikzset{timing/after table}% \endtikzpicture \endgroup } - -\def\endtikztimingtable@{\@gobble{ENDTIKSTIMING}} - -\long\def\tikztimingextracode#1#2\endtikztimingtable@{% +\def\tikztiming@extracode{% \path let \p1 = (timing/table/top left), \p2 = (timing/table/bottom right) @@ -723,15 +1022,53 @@ coordinate (timing/table/top right) at (\x2,\y1) coordinate (timing/table/size) at (\x2-\x1,\y1-\y2) ; - #2% + \@ifnextchar[{\tikztiming@oset}{} +} +\def\tikztiming@endextracode{% + \@ifnextchar\@checkend + {\aftergroup\expandafter\aftergroup\tikztimingtable@checkrow}% + {\tikztimingtable@checkrow}% +}% +\def\tikztimingtable@checkrow{% + \@ifnextchar\end + {}% + {\ifx\@let@token\extracode + \let\tikztiming@next\empty + \else + \ifx\@let@token\begin + \def\tikztiming@next{\tikztimingtable@chkbegec}% + \else + \def\tikztiming@next{\tikztimingtable@row}% + \fi + \fi + \tikztiming@next + }% +} +\def\tikztimingtable@chkbegec\begin#1{ + \begingroup + \def\@tempa{#1}% + \def\@tempb{extracode}% + \ifx\@tempa\@tempb + \endgroup + \def\tikztiming@next{\begin{extracode}}% + \else + \endgroup + \def\tikztiming@next{\tikztimingtable@row\begin{#1}}% + \fi + \tikztiming@next +} +\def\tikztiming@oset[#1]{% + \let\tikz@options\pgfutil@empty + \tikzset{#1}% + \tikz@options } \def\tikztiming@emptycell{% \@gobble{tikztiming@emptycell}% } -\def\tikztimingtable@row#1\\{% +\long\def\tikztimingtable@row#1\\{% \tikztimingtable@row@#1&\tikztiming@emptycell&\\ } -\def\tikztimingtable@row@#1\\{% +\long\def\tikztimingtable@row@#1\\{% \ifx\\#3\\\else \begingroup \def\@tempa{\tikztiming@emptycell&}% @@ -744,17 +1081,17 @@ \endgroup \fi \ifx\tikztiming@emptycell#2% - \def\next{\tikztimingtable@row@@{#1}{}}% + \def\tikztiming@next{\tikztimingtable@row@@{#1}{}}% \else - \def\next{\tikztimingtable@row@@{#1}{#2}}% + \def\tikztiming@next{\tikztimingtable@row@@{#1}{#2}}% \fi - \next + \tikztiming@next }% -\def\tikztimingtable@row@@#1#2{% +\long\def\tikztimingtable@row@@#1#2{% \addtocounter{tikztiming@nrows}{1}% - \path ($ (last row) + (0,-1*\rowdist) $) coordinate (last row); - \path ($ (last row) + (-1*\coldist,0) $) node [anchor=base east,timing/name] - {\tikztiminglabel{#1}}; + \coordinate (last row) at ($ (last row) - (0,\tikztiming@rowdist) $); + \node [anchor=base east,timing/name] (last row text) + at ($ (last row) - (\tikztiming@coldist,0) $) {\ignorespaces #1\unskip}; \@ifnextchar{[}% {\tikztiming@tabletiming}% {\tikztiming@tabletiming[]}% @@ -764,26 +1101,21 @@ % \pgfmathparse{max(\tikztiming@maxwidth,\tikztimingwidth)}% \let\tikztiming@maxwidth\pgfmathresult - \@ifnextchar\extracode - {% - \let\extracode\relax - \tikztimingextracode - }% - {% - \@ifnextchar\endtikztimingtable@ - {\@gobble}{\tikztimingtable@row}% - }% + \tikztimingtable@checkrow } \def\tikztiming@tabletiming[#1]#2\relax{% - \let\lastchar\empty - \let\settings\empty + \let\tikztiming@lastchar\empty + \let\tikztiming@settings\empty \ifx\relax#1\relax\else \tikztiming@testoptarg#1\relax\relax \fi - \edef\@tempa{\noexpand\timing[name=row\the\c@tikztiming@nrows,\settings] + \ifx\tikztiming@lastchar\empty + \def\tikztiming@lastchar{@}% + \fi + \edef\@tempa{\noexpand\timing[name=row\the\c@tikztiming@nrows,\tikztiming@settings] at (last row)}% - \expandafter\@tempa\expandafter{\expandafter[\lastchar]#2}; + \expandafter\@tempa\expandafter{\expandafter[\tikztiming@lastchar]#2}; } \newcommand*\tikztiming@fulltablegrid[1][]{% @@ -795,27 +1127,62 @@ \endscope \end{pgfonlayer} } -\newcommand*\tikztiming@tablegrid[1][]{% +\def\tikztiming@tablegrid{% + \@ifnextchar{*}% + {\tikztiming@tablegrid@{row\row.high end}}% + {\tikztiming@tablegrid@{timing/table/top right}}% +} +\def\tikztiming@tablegrid@#1{% + \@ifnextchar{[}%] + {\tikztiming@tablegrid@@{#1}}% + {\tikztiming@tablegrid@@{#1}[]}% +} +\def\tikztiming@tablegrid@@#1[#2]{% \begin{pgfonlayer}{background} - \scope[xstep={\timingwidth/2.},ystep={\timingheight/2.},timing/table/grid,#1] - \foreach \y in {1,...,\nrows} {% - \draw {[shift={($ (timing/table/bottom left) + (0,\y*\rowdist) - - (0,\rowdist) $)}] let \p1 = (timing/table/bottom right) in (0,0) grid - (\x1,1)}; + \scope[xstep={\timingwidth/2.},ystep={\timingheight/2.},timing/table/grid,#2] + \foreach \row in {1,...,\nrows} {% + \draw {[shift={(row\row.low start)}] + let \p1 = (#1) in (0,0) grid (\x1,1)}; }% \endscope \end{pgfonlayer} } +\newcommand*\tikztiming@tableheader[3][]{% + \path [timing/table/header,#1] + (-1*{(\tikztiming@coldist)},1.5*{(\tikztiming@rowdist)}) node + [anchor=base east] {\ignorespaces #2\unskip\strut} + (0,1.5*{(\tikztiming@rowdist)}) node + [anchor=base west] {\ignorespaces #3\unskip\strut} + ; + \tikztiming@tableheadtrue +} +\newif\iftikztiming@tablehead \newcommand*\tikztiming@tablerules[1][]{% - \draw [timing/table/rules,#1] let - \p1 = (current bounding box.north west), - \p2 = (current bounding box.south east), + \begin{scope}[#1] + \coordinate (NW) at (current bounding box.north west); + \coordinate (SE) at (current bounding box.south east); + % + \draw [timing/table/rules] + let + \p1 = (NW), + \p2 = (SE), \p3 = (last row) + in + ($ (\x1-\tabcolsep,\y3) - (0,.5*{(\rowdist)}) $) -- + ($ (\x2+\tabcolsep,\y3) - (0,.5*{(\rowdist)}) $) + \iftikztiming@tablehead + (\x1-\tabcolsep,2.5*{(\rowdist)}) -- (\x2+\tabcolsep,2.5*{(\rowdist)}) + \fi + ; + \draw + \iftikztiming@tablehead [timing/table/midrules] \else [timing/table/rules] \fi + let + \p1 = (NW), + \p2 = (SE) in (\x1-\tabcolsep,\rowdist) -- (\x2+\tabcolsep,\rowdist) - ($ (\x1-\tabcolsep,\y3) - (0,\rowdist-1) $) -- - ($ (\x2+\tabcolsep,\y3) - (0,\rowdist-1) $) ; + \end{scope} } \newcommand*\tikztiming@horlines[2][]{% \begingroup @@ -823,11 +1190,12 @@ \ifx\list\empty \def\list{1,2,...,\nrows}% \fi - \foreach \row in \list% + \foreach \row in \list {% \draw [timing/table/lines,#1] let \p1 = (timing/table/bottom right) in - (0,\rowdist-\row*\rowdist) -- +(\x1,0); + ($ (0,\rowdist) - (0,\row * {(\rowdist)}) $) -- +(\x1,0); + }% \endgroup } \newcommand*\tikztiming@vertlines[2][]{% @@ -897,6 +1265,18 @@ \pgfpointborderrectangle{\pgfpoint{\@tempdima}{\@tempdimb}}{\northeastborder}% }% } +\gdef\tikztiming@oldnodecenter@{}% +\tikzset{timing/old@node@center/.code={\xdef\tikztiming@oldnodecenter@{% + ++($ (0,0) - #1 $) + [timing/no@old@node@center]}}% +}% +\tikzset{timing/no@old@node@center/.code={\gdef\tikztiming@oldnodecenter@{}}}% + +\def\tikztiming@oldnodecenter#1{% + [timing/old@node@center={#1}] + ++#1 +} + \def\tikztiming@iflower#1{% \begingroup \edef\@tempa{`#1}% @@ -910,12 +1290,15 @@ \@secondoftwo \fi } -\def\timingwidth{1}% -\def\timingheight{1}% -\def\tikztiming@internaldefs#1{% - \def\draw{\noexpand\draw}% - \def\path{\noexpand\path}% - \def\fill{\noexpand\fill}% +\def\tikztiming@internaldefs{% + \let\draw\relax + \let\path\relax + \let\p\relax + \let\x\relax + \let\y\relax + \let\n\relax + \let\tikztiming@oldnodecenter\relax + \let\tikztiming@oldnodecenter@\relax \def\width{####1*\noexpand\timingwidth}% \def\fwidth{\noexpand\timingwidth}% \def\height{\noexpand\timingheight}% @@ -923,10 +1306,9 @@ \def\zslope{\noexpand\timingzslope}% \def\dslope{\noexpand\timingdslope}% \def\gslope{0}% - \lowercase{% - \def\style{timing/#1}% - \def\bgstyle{timing/#1/background}% - }% + \def\style{timing/####3}% + \def\bgstyle{draw=none,timing/####3/background}% + \def\nstyle{timing/####4}% \def\newdraw{\tikztiming@newdraw}% \def\newdrawns{\tikztiming@newdraw@nosave}% \def\code##1{ [/utils/exec={\unexpanded{##1}}] }% @@ -950,39 +1332,41 @@ \tikztimingsetslope{0.10}% \tikztimingsetdslope{0.20}% \tikztimingsetzslope{0.05}% -\def\tikztiminguse#1{% - \@ifundefined{\tikztiming@prefix#1@general}% - {\PackageWarning{Can not use transition macro for '#1'.}{}{}{}}% - {\@nameuse{\tikztiming@prefix#1@general}}% +\def\tikztiminguse#1#2{% + \@nameuse{\tikztiming@prefix#1}{#2}{##2}{##3}{##4}% } \def\tikztimingdef#1{% - \tikztimingdef@#1\relax% + \tikztimingdef@#1\empty\empty\relax } -\def\tikztimingdef@#1#2\relax#3{% - \ifx\relax#2\relax - \tikztiming@nameedef[#1]{#1}{#3}% +\def\tikztimingdef@#1#2#3\relax#4{% + \ifx\empty#2\empty + \tikztiming@nameedef{}{#1}{}{#4}% \else - \tikztiming@nameedef[#2]{#1#2}{#3}% + \tikztiming@nameedef{#1}{#2}{#3}{#4}% \fi } -\def\tikztiminglet#1#2{% - \tikztiminglet@#1\relax#2\relax -} -\def\tikztiminglet@#1#2\relax#3#4\relax{% - \tikztiming@namelet{#1#2}{#3#4}% - \tikztiming@namelet{#1#2@general}{#3#4@general}% - \tikztiming@iflower{#1}{}% - {\tikztiming@iflower{#2}% - {% - \lowercase{\tikztiminglet@{#1}{#2}\relax{#3}{#4}}\relax - }% - {% - \uppercase{\lowercase{% - \uppercase{\lowercase{\tikztiminglet@{#1}}{#2}}\relax{#3}}{#4}}\relax - \lowercase{\uppercase{% - \lowercase{\uppercase{\tikztiminglet@{#1}}{#2}}\relax{#3}}{#4}}\relax +\def\tikztimingcpy#1#2{% + \begingroup + \edef\tikztimingcpy@a{#1}% + \edef\tikztimingcpy@b{#2}% + \ifx\tikztimingcpy@a\tikztimingcpy@b + \endgroup + %\message{^^J Copy macro '#2' to '#1' skipped.^^J}% + \else + \endgroup + \@ifundefined{\tikztiming@pfxtr#2\empty\empty\empty}% + {\ifnum\tikztiming@debug>0\relax + \message{^^J Copy macro '#2' to '#1' failed.^^J}\fi}% + {\ifnum\tikztiming@debug>0\relax + \message{^^J Copy macro '#2' to '#1'.^^J}\fi + \expandafter\let + \csname\tikztiming@pfxtr#1\empty\empty\empty\expandafter\endcsname + \csname\tikztiming@pfxtr#2\empty\empty\empty\endcsname }% - }% + \fi +} +\def\tikztiminglet#1#2{% + \tikztiming@namelet{#1}{#2}% } \def\tikztiming@chars#1{} \def\tikztiming@ifcharexists#1{% @@ -1006,98 +1390,108 @@ \tikztiming@addchar{#1}% \tikztimingchar@{#1}}% } -\expandafter\def\csname\tikztiming@prefix @start\endcsname#1{}% +\@namedef{\tikztiming@prefix @@}#1#2#3#4{ coordinate (timing/start)}% \def\tikztimingchar@#1#2#3{% - \tikztiming@nameedef[#1]{#1@start}{#2 coordinate (timing/start) }% - \tikztiming@nameedef[#1]{#1}{#2 coordinate (timing/start) #3}% - \tikztimingdef{#1#1}{#3}% + \tikztiming@nameedef{@}{#1}{}{#2 coordinate (timing/start) #3}% + \tikztimingdef{{#1}{#1}}{#3}% } -\def\tikztimingalias#1#2{% - \uppercase{\tikztimingalias@{#1}{#2}}% +\def\tikztimingecopy#1#2{% + \@namedef{tikztiming@alias@#1}{#2}% + \tikztiming@addchar{#1}% + \expandafter\let + \csname tikztiming@triple@#1\expandafter\endcsname + \csname tikztiming@triple@#2\endcsname + \expandafter\let + \csname tikztiming@nocombine@#1\expandafter\endcsname + \csname tikztiming@nocombine@#2\endcsname } -\def\tikztimingalias@#1#2{% - \tikztiming@namelet{#1}{#2}% - \tikztiming@namelet{#1@start}{#2@start}% - \lowercase{% - \tikztiming@namelet{#1}{#2}% - \tikztiming@namelet{#1@start}{#2@start}% - }% - \tikztiminglet{#1#1}{#2#2}% - \@for\@tempa:=\tikztiming@chars\do{% - \expandafter\tikztiminglet@@ - \expandafter{\@tempa}{#1}{#2}% - }% +\def\tikztiming@newdraw{% + node [timing/save] (timing@save) {};% + \draw [timing/restore] (timing@save) ++(0,0) } -\def\tikztimingecopy#1#2{% - \uppercase{\tikztimingecopy@{#1}{#2}}% -} -\def\tikztimingecopy@#1#2{% - \tikztimingchar{#1}{}{}% - \tikztimingdef{#1}{\tikztiminguse{#2}{##1}}% - \tikztiming@nameedef[#1]{#1@start}{\tikztiminguse{#2@start}{##1}}% - \lowercase{% - \@ifundefined{\tikztiming@prefix#2}{}{% - \tikztimingdef{#1}{\tikztiminguse{#2}{##1}}% - \tikztiming@nameedef[#1]{#1@start}{\tikztiminguse{#2@start}{##1}}% - }% - }% - \tikztimingdef{#1#1}{\tikztiminguse{#2#2}{##1}}% - \@for\@tempa:=\tikztiming@chars\do{% - \expandafter\tikztimingdef@@ - \expandafter{\@tempa}{#1}{#2}% - \expandafter\lowercase\expandafter{\expandafter\def\expandafter\@tempb - \expandafter{\@tempa}}% - \@ifundefined{\tikztiming@prefix#2\@tempb}{}{% - \expandafter\tikztimingdef@@ - \expandafter{\@tempb}{#1}{#2}% - }% + +\def\tikztiming@newdraw@nosave{% + node [timing/coord] (timing@save) {};% + \draw [timing/nooptions] (timing@save) ++(0,0) +} +\def\tikztiming@baseline{% + node [timing/save] (timing@save) {};% + \draw [timing/restore] let \p1 = (timing@save) in (\x1,0) ++(0,0) +} +\def\tikztiming@chars{H,L,Z,X,M,D,U,T,C}% +\tikztiming@defcode{S}{% + \pgfmathparse{\tikztimingwidth + \tikztiming@num}% + \global\let\tikztimingwidth\pgfmathresult + \tikztiming@output@Eaddcode{% + coordinate (timing@ref) at ($ (timing@ref) + (\tikztiming@num,0) $) + coordinate (timing@refa) at ($ (timing@refa) + (\tikztiming@num,0) $) + coordinate (timing@refb) at ($ (timing@refb) + (\tikztiming@num,0) $) + ++(\tikztiming@num,0) }% + \tikztiming@parser } -\def\tikztiminglet@@#1#2#3{% - \tikztiminglet@@@#1#2#3% - % Should stay, cause no harm: - \lowercase{\tikztiminglet@@@#1}#2#3% - \lowercase{\tikztiminglet@@@#1#2#3}% - \lowercase{\uppercase{\tikztiminglet@@@#1}#2#3}% + +\tikztiming@defcode{s}{% + \pgfmathparse{\tikztimingwidth + \tikztiming@num/2}% + \global\let\tikztimingwidth\pgfmathresult + \tikztiming@output@Eaddcode{% + coordinate (timing@ref) at ($ (timing@ref) + (\tikztiming@num/2,0) $) + coordinate (timing@refa) at ($ (timing@refa) + (\tikztiming@num/2,0) $) + coordinate (timing@refb) at ($ (timing@refb) + (\tikztiming@num/2,0) $) + ++(\tikztiming@num/2,0) + }% + \tikztiming@parser } -\def\tikztiminglet@@@#1#2#3{% - \tikztiminglet{#1#2}{#1#3}% - \tikztiminglet{#2#1}{#3#1}% +\tikztiming@defcode{G}{% + \tikztiming@output@addcode{% + \tikztiming@glitch + }% + \tikztiming@parser } -\def\tikztimingdef@@#1#2#3{% - \tikztimingdef{#1#2}{\tikztiminguse{#1#3}{##1}}% - \tikztimingdef{#2#1}{\tikztiminguse{#3#1}{##1}}% +\tikztiming@defcode{g}{% + \tikztiming@output@addcode{% + \tikztiming@glitch + }% + \tikztiming@parser } -\def\tikztiming@savesettings{% - \xdef\tikztiming@saved@settings{% - {\tikztiming@slope}% - {\tikztiming@dslope}% - {\tikztiming@zslope}% - {\the\pgflinewidth}% + +\def\tikztiming@glitch{% + {[timing/g] let \p1 = +(0,0) in (\x1,0) -- (\x1,\timingheight) + coordinate (timing@dstart) at (\x1,\timingheight/2) (\x1,\y1) }% } -\def\tikztiming@restoresettings{% - \expandafter\tikztiming@restoresettings@ - \tikztiming@saved@settings\relax +\tikztimingchar{H}{++(0,\height)}{-- ++(#1,0)} + +\tikztimingdef{HH}{ + -- ++(#1,0) } -\def\tikztiming@restoresettings@#1#2#3#4\relax{% - \tikztimingsetslope{#1}% - \tikztimingsetdslope{#2}% - \tikztimingsetzslope{#3}% - \pgfsetlinewidth{#4}% + +\tikztimingdef{LH}{ + -- +(\slope, \height) + -- ++(#1, \height) } -\def\tikztiming@newdraw{% - node [timing/save] (timing@save) {};% - \draw [timing/restore] (timing@save) ++(0,0) + +\tikztimingdef{ZH}{ + \newdraw + -- ++(\zslope,+\height/2.) + -- ++($ (#1,0) - (\zslope,0) $) } -\def\tikztiming@newdraw@nosave{% - node [timing/coord] (timing@save) {};% - \draw (timing@save) ++(0,0) +\tikztimingdef{DH}{ + \tikztiming@oldnodecenter@% + \newdraw [\style] + -- +(\dslope/2.,\height/2.) + -- ($ (timing@ref) + (#1,\height/2) $) +} + +\tikztimingdef{DL}{ + \tikztiming@oldnodecenter@ + \newdraw [\style] + -- +(\dslope/2.,-\height/2.) + -- ($ (timing@ref) + (#1,-\height/2) $) } -\tikztimingchar{H}{++(0,\height)}{-- ++(#1,0)} \tikztimingchar{L}{++(0,0)}{-- ++(#1,0)} @@ -1106,30 +1500,7 @@ -- ++(#1,0) } -\tikztimingchar{X}{}{}% -\tikztimingchar{D}{}{}% -\tikztimingchar{U}{}{}% -\tikztimingchar{M}{}{}% - -\tikztimingchar{G}{++(0,0)}{-- ++(\gslope,\height) -- ++(\gslope,-\height)} -\tikztimingchar{S}{++(0,0)}{++(#1,0)} - -\tikztimingdef{DD}{ - node [timing/save] (timing@save) {}; \path [\bgstyle] (timing@save) ++(0,0) - +(0.5*\dslope,0.5*\height) -- +(\dslope,0) - -- +(#1,0) - -- +($ (#1,0) + 0.5*(\dslope,\height) $) - -- +(#1,\height) - -- +(\dslope,\height) -- cycle; - \draw [timing/restore,\style] (timing@save) ++(0,0) - node [timing/save] (timing@dstart) at +(\dslope/2.,\height/2.) {} - -- +(\dslope,+\height) -- +(#1,+\height) ++(0,+\height) - -- +(\dslope,-\height) -- ++(#1,-\height) -} -\tikztiming@namelet{D@edge@D}{DD} -\tikztiming@namelet{D@edge@D@general}{DD@general} - -\tikztimingchar{D}{++(0,0)}{ +\tikztimingchar{D}{++(0,\height/2.)}{ node [timing/save] (timing@save) {}; \path [\bgstyle] (timing@save) ++(0,0) -- +(#1,0) -- +($ (#1,0) + 0.5*(\dslope,\height) $) @@ -1142,21 +1513,10 @@ -- ++(#1,0) ++(0,-\height) } -\tikztimingdef{DD}{ - node [timing/save] (timing@save) {}; \path [\bgstyle] (timing@save) ++(0,0) - -- +(#1,0) - -- +($ (#1,0) + 0.5*(\dslope,\height) $) - -- +(#1,\height) - -- +(0,\height) - -- cycle; - \newdraw [\style] - -- +(#1,0) ++(0,+\height) - -- ++(#1,0) ++(0,-\height) -} - -\tikztiming@namelet{D@edge@@start}{D@start} -\tikztiming@namelet{d@edge@@start}{d@start} - +\def\tikztiming@triple@D{}% +\def\tikztiming@triple@D@edge@{}% +\def\tikztiming@nocombine@D@edge@{}% +\def\tikztiming@alias@D@edge@{D}% \def\tikztiming@trans@D@fill#1#2{% node [timing/save] (timing@save) {}; \path [\bgstyle] (timing@save) ++(0,0) -- +(0.5*\dslope,-0.5*\height) @@ -1168,138 +1528,470 @@ \draw [timing/restore,\style] (timing@save) ++(0,0) node [timing/save] (timing@dstart) {} } -\tikztimingdef{HH}{-- ++(#1,0)} -\tikztimingdef{LL}{-- ++(#1,0)} -\tikztimingdef{HL}{-- ++(\slope,-\height) \tikztiminguse{HH}{#1-\slope}} -\tikztimingdef{LH}{-- ++(\slope, \height) \tikztiminguse{LL}{#1-\slope}} - -\tikztimingdef{HG}{-- ++(\gslope,-\height) -- ++(\gslope,+\height)} -\tikztimingdef{LG}{-- ++(\gslope,+\height) -- ++(\gslope,-\height)} -\tikztimingdef{ZG}{ - -- ++(\gslope,-\height/2.0) - -- ++(\gslope,+\height) - -- ++(\gslope,-\height/2.0) +\tikztimingdef{LL}{ + -- ++(#1,0) } -\tikztiminglet{DG}{LG} -\tikztiminglet{HS}{S} -\tikztiminglet{LS}{S} -\tikztiminglet{ZS}{S} -\tikztiminglet{DS}{S} -\tikztiminglet{TS}{S} +\tikztimingdef{HL}{ + -- ++(\slope,-\height) + \tikztiminguse{HH}{#1-\slope} +} \tikztimingdef{LZ}{ \newdraw [\style] - -- ++(\zslope,+\height/2.) -- ++($ (#1,0) - (\zslope,0) $) + -- ++(\zslope,+\height/2.) + -- ++($ (#1,0) - (\zslope,0) $) } \tikztimingdef{HZ}{% \newdraw [\style] - -- ++(\zslope,-\height/2.) -- ++($ (#1,0) - (\zslope,0) $) -} -\tikztimingdef{ZH}{ - \newdraw - -- ++(\zslope,+\height/2.) -- ++($ (#1,0) - (\zslope,0) $) + -- ++(\zslope,-\height/2.) + -- ++($ (#1,0) - (\zslope,0) $) } \tikztimingdef{ZL}{% \newdraw - -- ++(\zslope,-\height/2.) -- ++($ (#1,0) - (\zslope,0) $) + -- ++(\zslope,-\height/2.) + -- ++($ (#1,0) - (\zslope,0) $) } \tikztimingdef{DZ}{ - -- ++( \dslope/2.,+\height/2.) - ++(-\dslope/2.,+\height/2.) - -- ++( \dslope/2.,-\height/2.) + \tikztiming@oldnodecenter@ \newdraw [\style] - -- ++($ (#1,0) - (\dslope/2.,0) $) + -- ($ (timing@ref) + (#1,0) $) } -\tikztimingdef{ZD}{ - \tikztiming@trans@D@fill{#1}{0}% - -- ++(\dslope/2.,\height/2.) -- ++($ (#1,0) - (\dslope/2.,0) $) - ++($ -1*(#1,0) + (0,-\height/2.) $) - -- ++(\dslope/2.,-\height/2.) -- ++($ (#1,0) - (\dslope/2.,0) $) +\def\tikztiming@chard#1{% + \newdraw [\style,preaction={\bgstyle}] + coordinate (timing@dstart) + -- +(\dslope/2,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(\dslope/2,-\height/2) + -- +(0,-\height) + -- ($ (timing@dstart) + (\dslope/2,-\height/2) $) + -- (timing@dstart) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + ++(\dslope/2,0) + coordinate (timing@dend) + \tikztiming@oldnodecenter{% + (-\dslope/2,-\height/2) + }% + \newdraw } -\tikztimingdef{LD}{ - -- ++(0.5*\dslope,0.5*\height) - \tikztiming@trans@D@fill{#1}{0.5*\dslope}% - -- ++(0.5*\dslope,0.5*\height) - -- ++($ (#1,0) - (\dslope,0) $) - ++($ -1*(#1,0) + (0,-\height) $) ++(\dslope/2.,+\height/2.) - -- ++(\dslope/2.,-\height/2.) -- ++($ (#1,0) - (\dslope,0) $) +\def\tikztiming@chard@#1{% + \newdraw [\bgstyle] + -- +(\dslope/2,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(0,-\height)% + -- ($ (timing@save) + (\dslope/2,-\height/2) $) + -- (timing@save) + \newdraw [\style] + coordinate (timing@dstart) + -- +(\dslope/2,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + +(0,-\height)% + -- ($ (timing@save) + (\dslope/2,-\height/2) $) + -- (timing@save) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + coordinate [shift={(\dslope/2,0)}] (timing@dend) + \tikztiming@oldnodecenter{% + (0,-\height/2) + }% + \newdraw } -\tikztimingdef{DL}{ - -- ++( \dslope/2.,+\height/2.) - ++(-\dslope/2.,+\height/2.) - -- ++(\dslope/2.,-\height/2.) +\def\tikztiming@@chard#1{% + ++(0,\height/2) + \newdraw [\bgstyle] + -- +(0,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(\dslope/2,-\height/2) + -- +(0,-\height) + -- ($ (timing@save) + (0,-\height/2) $) + -- (timing@save) \newdraw [\style] - -- ++(\dslope/2.,-\height/2.) - -- ++($ (#1,0) - (\dslope,0) $) + +(0,0) + coordinate (timing/start) + +(-\dslope/2,0) + coordinate (timing@dstart) + +(0,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(\dslope/2,-\height/2) + -- +(0,-\height) + -- ($ (timing@save) + (0,-\height/2) $) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + ++(\dslope/2,0) + coordinate (timing@dend) + \tikztiming@oldnodecenter{% + (-\dslope/2,-\height/2) + }% + \newdraw } -\tikztimingdef{HD}{ - -- ++(0.5*\dslope,-0.5*\height) - \tikztiming@trans@D@fill{#1}{0.5*\dslope}% - -- ++(0.5*\dslope,-0.5*\height) - -- ++($ (#1,0) - (\dslope,0) $) - ++($ -1*(#1,0) + (0,+\height) $) ++(\dslope/2.,-\height/2.) - -- ++(\dslope/2.,+\height/2.) -- ++($ (#1,0) - (\dslope,0) $) - ++(0,-\height) +\def\tikztiming@@chard@#1{% + ++(0,\height/2) + \newdraw [\bgstyle] + -- +(0,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(0,-\height) + -- ($ (timing@save) + (0,-\height/2) $) + -- (timing@save) + \newdraw [\style] + +(0,0) + coordinate (timing/start) + coordinate (timing@ref) + coordinate [shift={(-\dslope/2,0)}] (timing@dstart) + +(0,\height/2) + -- +(#1,\height/2) + +(#1,-\height/2) + -- ($ (timing@save) + (0,-\height/2) $) + ++(#1,\height/2) + coordinate (timing@ref) + coordinate [shift={(\dslope/2,0)}] (timing@dend) + \tikztiming@oldnodecenter{% + (0,-\height/2) + }% + \newdraw } -\tikztimingdef{DH}{ - ++(0,+\height) - -- ++(+\dslope/2.,-\height/2.) - ++(-\dslope/2.,-\height/2.) - -- ++(\dslope/2.,+\height/2.) +\def\tikztiming@dchardu#1{% + \tikztiming@oldnodecenter@ + \newdraw [\bgstyle] + -- +(0,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(\dslope/2,-\height/2) + -- +(0,-\height) + -- ($ (timing@save) + (0,-\height/2) $) + -- (timing@save) \newdraw [\style] - -- ++(\dslope/2.,+\height/2.) - -- ++($ (#1,0) - (\dslope,0) $) + +(0,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(\dslope/2,-\height/2) + -- +(0,-\height) + -- ($ (timing@save) + (0,-\height/2) $) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + ++(\dslope/2,0) + coordinate (timing@dend) + \tikztiming@oldnodecenter{% + (-\dslope/2,-\height/2) + }% + \newdraw } -\tikztimingalias{M}{Z} -\tikztimingchar{M}{++(0,\height/2.)}{ - \newdraw [\style/decoration,\style] - -- ++(#1,0) +\def\tikztiming@uchardd#1{% + \tikztiming@oldnodecenter@ + \newdraw [\bgstyle] + -- +(\dslope/2,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(0,-\height) + -- ($ (timing@save) + (\dslope/2,-\height/2) $) + -- (timing@save) + \newdraw [\style] + coordinate (timing@dstart) + -- +(\dslope/2,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + +(0,-\height) + -- ($ (timing@save) + (\dslope/2,-\height/2) $) + -- (timing@save) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + coordinate [shift={(\dslope/2,0)}](timing@dend) + \tikztiming@oldnodecenter{% + ($ (0,0) - (0,\height/2) $) + }% + \newdraw +} + +\tikztimingdef{DD}{% + \tikztiming@dchardu{#1}% +} + +\tikztimingdef{UU}{% + \tikztiming@dchardu{#1}% +} + +\def\tikztiming@dchard@#1{% + \tikztiming@oldnodecenter@ + \newdraw [\bgstyle] + -- +(0,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + -- +(0,-\height) + -- ($ (timing@save) + (0,-\height/2) $) + -- (timing@save) + \newdraw [\style] + +(0,\height/2) + -- ($ (timing@ref) + (#1,\height/2) $) + +(0,-\height) + -- ($ (timing@save) + (0,-\height/2) $) + ($ (timing@ref) + (#1,0) $) + coordinate (timing@ref) + coordinate [shift={(\dslope/2,0)}] (timing@dend) + \tikztiming@oldnodecenter{% + (0,-\height/2) + }% + \newdraw +} + +\tikztimingdef{DD@}{ + \tikztiming@dchard@{#1}% +} + +\tikztimingcpy{DDD}{DD@} +\tikztimingcpy{UUU}{DDD} + +\tikztimingdef{{D@edge@}{D@edge@}}{% + \tikztiming@oldnodecenter@ + \tikztiming@chard{#1}% +}% + +\tikztimingdef{@{D@edge@}}{% + \tikztiming@@chard@{#1}% +}% + +\tikztimingdef{@{D@edge@}@}{% + \tikztiming@@chard@{#1}% +}% + +\tikztimingdef{@{D@edge@}D}{% + \tikztiming@@chard{#1}% +} + +\tikztimingdef{D{D@edge@}}{% + \tikztiming@dchardu{#1}% +} + +\tikztimingdef{U{U@edge@}}{% + \tikztiming@dchardu{#1}% +} + +\tikztimingdef{U{D@edge@}}{% + \tikztiming@oldnodecenter@ + \tikztiming@chard{#1}% +} + +\tikztimingdef{U{D@edge@}@}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard@{#1}% +} + +\tikztimingdef{D{U@edge@}}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard{#1}% +} + +\tikztimingdef{D{U@edge@}@}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard@{#1}% +} + +\tikztimingdef{D{D@edge@}@}{% + \tikztiming@dchard@{#1}% +}% + +\tikztimingdef{U{U@edge@}@}{% + \tikztiming@dchard@{#1}% +}% + +\tikztimingdef{{D@edge@}{D@edge@}@}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard@{#1}% +}% + +\tikztimingdef{@{D@edge@}}{% + \tikztiming@@chard{#1}% +}% + +\tikztimingdef{{D@edge@}D}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard{#1}% +}% + +\tikztimingdef{{D@edge@}D@}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard@{#1}% +}% + +\tikztimingdef{ZDZ}{ + coordinate (timing@ref) + \tikztiming@chard{#1} +} +\tikztimingcpy{ZDX}{ZDZ} +\tikztimingcpy{XDX}{ZDZ} +\tikztimingcpy{XDZ}{ZDZ} + +\tikztimingdef{ZDD}{ + coordinate (timing@ref) + \tikztiming@chard@{#1} } -\tikztimingdef{MG}{ - \newdraw [timing/m] - -- ++(\gslope,-\height/2.0) - -- ++(\gslope,+\height) - -- ++(\gslope,-\height/2.0) + +\tikztimingdef{ZDU}{ + coordinate (timing@ref) + \tikztiming@chard{#1} +} + +\tikztimingcpy{ZUD}{ZDU} +\tikztimingcpy{ZUU}{ZDD} + +\tikztimingdef{ZD}{ + coordinate (timing@ref) + \tikztiming@chard{#1} +} + +\tikztimingdef{@DD}{% + \tikztiming@@chard@{#1}% +} + +\tikztimingdef{ZD@}{% + coordinate (timing@ref) + \tikztiming@chard@{#1}% +} + +\tikztimingdef{HD@}{% + coordinate [shift={(0,-\height/2)}] (timing@ref) + -- ++(\dslope/2, -\height/2) + \tikztiming@chard@{#1}% +} + +\tikztimingdef{TD@}{% + coordinate [shift={(0,-\height/2 * \value{tikztimingtrans})}] (timing@ref) + -- ++(\dslope/2, -\height/2 * \value{tikztimingtrans}) + \tikztiming@chard@{#1}% +} + +\tikztimingdef{TD}{% + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + coordinate [shift={(0,\height/2 * \value{tikztimingtrans})}] (timing@ref) + -- ++(\dslope/2, \height/2 * \value{tikztimingtrans}) + \tikztiming@chard{#1}% +} + +\tikztimingdef{TDD}{% + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + coordinate [shift={(0,\height/2 * \value{tikztimingtrans})}] (timing@ref) + -- ++(\dslope/2, \height/2 * \value{tikztimingtrans}) + \tikztiming@chard@{#1}% +} + +\tikztimingdef{TUD}{% + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + coordinate [shift={(0,\height/2 * \value{tikztimingtrans})}] (timing@ref) + -- ++(\dslope/2, \height/2 * \value{tikztimingtrans}) + \tikztiming@chard{#1}% +} + +\tikztimingcpy{TDU}{TUD} +\tikztimingcpy{TUU}{TDD} + +\tikztimingdef{LD@}{% + coordinate [shift={(0,\height/2)}] (timing@ref) + -- ++(\dslope/2, \height/2) + \tikztiming@chard@{#1}% +} + +\tikztimingdef{@D}{% + \tikztiming@@chard@{#1}% +} + +\tikztimingdef{@D@}{% + \tikztiming@@chard@{#1}% +} + +\tikztimingcpy{H{D@edge@}@}{HD@} +\tikztimingcpy{L{D@edge@}@}{LD@} +\tikztimingcpy{Z{D@edge@}@}{ZD@} +\tikztimingcpy{T{D@edge@}@}{TD@} + +\tikztimingdef{@DZ}{% + \tikztiming@@chard{#1}% +} +\tikztimingdef{@DH}{% + \tikztiming@@chard{#1}% +} +\tikztimingdef{@DL}{% + \tikztiming@@chard{#1}% } +\tikztimingdef{@DT}{% + \tikztiming@@chard{#1}% +} + +\tikztimingdef{LD}{ + coordinate [shift={(0,\height/2)}] (timing@ref) + -- ++(\dslope/2, \height/2) + \tikztiming@chard{#1}% +} + +\tikztimingdef{LDD}{ + coordinate [shift={(0,\height/2)}] (timing@ref) + -- ++(\dslope/2, \height/2) + \tikztiming@chard@{#1} +} + +\tikztimingdef{LDU}{ + coordinate [shift={(0,\height/2)}] (timing@ref) + -- ++(\dslope/2, \height/2) + \tikztiming@chard{#1} +} + +\tikztimingcpy{LUD}{LDU} +\tikztimingcpy{LUU}{LDD} -\tikztimingdef{MZ}{ +\tikztimingdef{HD}{ + coordinate [shift={(0,-\height/2)}] (timing@ref) + -- ++(\dslope/2, -\height/2) + \tikztiming@chard{#1} +} + +\tikztimingdef{HDD}{ + coordinate [shift={(0,-\height/2)}] (timing@ref) + -- ++(\dslope/2, -\height/2) + \tikztiming@chard@{#1} +} + +\tikztimingdef{HDU}{ + coordinate [shift={(0,-\height/2)}] (timing@ref) + -- ++(\dslope/2, -\height/2) + \tikztiming@chard{#1} +} +\tikztimingcpy{HUD}{HDU} +\tikztimingcpy{HUU}{HDD} + +\tikztimingecopy{M}{Z} +\tikztimingchar{M}{++(0,\height/2.)}{ \newdraw [\style] - \tikztiminguse{ZZ}{#1} + -- ++(#1,0) + \newdraw [\style/base] } \tikztimingdef{ZM}{ \newdraw [\style] - \tikztiminguse{MM}{#1} + -- ++(#1,0) + \newdraw [\style/base] } \tikztimingdef{LM}{ - \newdraw [\style] + \newdraw [\style/base] -- ++($ (1/8,0) + (0,\height/2) $) - \newdraw [\style/decoration,\style] + \newdraw [\style] -- ++($ (-1/8,0) + (#1,0) $) + \newdraw [\style/base] } \tikztimingdef{HM}{ - \newdraw [\style] + \newdraw [\style/base] -- ++($ (1/8,0) + (0,-1*\height/2) $) - \newdraw [\style/decoration,\style] + \newdraw [\style] -- ++($ (-1/8,0) + (#1,0) $) + \newdraw [\style/base] } \tikztimingdef{DM}{ - -- +($ (1/8,0) + (0,\height*.50) $) - +(0,\height) - -- ++($ (1/8,0) + (0,\height*.50) $) - \newdraw [\style/decoration,\style] - -- ++($ (-1/8,0) + (#1,0) $) + \tikztiming@oldnodecenter@% + \newdraw [\style] + -- ($ (timing@ref) + (#1,0) $) + \newdraw [\style/base] } \newcounter{tikztimingtrans} @@ -1308,6 +2000,7 @@ \tikztimingchar{T}{++(0,0)}{ -- ++(#1,0) } +\def\tikztiming@nocombine@T{}% \tikztimingdef{HT}{% {[\style] @@ -1338,85 +2031,164 @@ \tikztimingdef{TZ}{% \newdraw [\style] \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} - -- ++(\slope,\value{tikztimingtrans}*\height/2.) - -- ++($ (#1,0) - (\slope,0) $) -} - -\tikztimingdef{TG}{% - -- +(\gslope,-1*\value{tikztimingtrans}*\height) - -- +(\gslope,0) + -- ++(\zslope,\value{tikztimingtrans}*\height/2.) + -- ++($ (#1,0) - (\zslope,0) $) } \tikztimingdef{ZT}{% - \newdraw - {[\style] + \newdraw {[\style] \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} - -- ++(\slope,\value{tikztimingtrans}*\height/2.) - -- ++($ (#1,0) - (\slope,0) $) + -- ++(\zslope,\value{tikztimingtrans}*\height/2.) + -- ++($ (#1,0) - (\zslope,0) $) } } \tikztimingdef{TT}{% {[\style] \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} - -- ++(\slope,\value{tikztimingtrans}*\height) -- ++($ (#1,0) - (\slope,0) $) + -- ++(\slope,\value{tikztimingtrans}*\height) + -- ++($ (#1,0) - (\slope,0) $) } } -\tikztimingdef{TD}{ - \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} - \code{\setcounter{tikztimingtranspos}{\value{tikztimingtrans}}% - \addtocounter{tikztimingtranspos}{-1}} - -- ++(0.5*\dslope,+0.5*\value{tikztimingtrans} * \height) - \tikztiming@trans@D@fill{#1}{0.5*\dslope}% - -- ++(0.5*\dslope,+0.5*\value{tikztimingtrans} * \height) - -- ++($ (#1,0) - (\dslope,0) $) - ++($ -1*(#1,\value{tikztimingtrans}*\height) $) - ++(\dslope/2.,+1*\value{tikztimingtrans}*\height/2.) - -- ++(\dslope/2.,-1*\value{tikztimingtrans}*\height/2.) - -- ++($ (#1,0) - (\dslope,0) $) - ++(0,\value{tikztimingtranspos}*\height/2.) -} - \tikztimingdef{DT}{ \code{\setcounter{tikztimingtrans}{-1}} - \tikztiminguse{DL}{#1}% -} - -\tikztimingdef{MT}{% - \newdraw - {[\style] - -- ++(\slope,\value{tikztimingtrans}*\height/2.) -- ++($ (#1,0) - (\slope,0) $) + \tikztiming@oldnodecenter@% + \newdraw {[\style] + -- +(\dslope/2.,-\height/2) + -- ($ (timing@ref) + (#1,-\height/2) $) } } \tikztimingdef{TM}{% - \newdraw [\style] + \newdraw [\style/base] \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} -- ++($ (1/8,0) + (0,\value{tikztimingtrans}*\height/2) $) - \newdraw [\style/decoration,\style] + \newdraw [\style] -- ++($ (-1/8,0) + (#1,0) $) + \newdraw [\style/base] } +\tikztimingecopy{C}{T} +\tikztimingecopy{U}{D} -\let\tikztiming@chars@default\tikztiming@chars +\def\tikztiming@triple@U@edge@{}% +\def\tikztiming@nocombine@U@edge@{}% +\def\tikztiming@alias@U@edge@{D@edge@}% +\tikztimingcpy{UU@}{DD@}% -\tikztimingecopy{C}{T} -\def\tikztiming@nocombine@T{}% -\def\tikztiming@nocombine@C{}% -\def\tikztiming@nocombine@t{}% -\def\tikztiming@nocombine@c{}% -\def\tikztiming@nocombine@M{}% -\def\tikztiming@nocombine@m{}% -\def\tikztiming@nocombine@W{}% -\def\tikztiming@nocombine@w{}% +\tikztimingdef{UDU}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard{#1}% +} +\tikztimingcpy{DUD}{UDU}% -\tikztimingecopy{U}{D} -\tikztimingdef{UD}{\tikztiminguse{D@edge@D}{#1}} -\tikztimingdef{DU}{\tikztiminguse{D@edge@D}{#1}} +\tikztimingdef{UDD}{% + \tikztiming@uchardd{#1}% +} + +\tikztimingcpy{{D@edge@}DD}{UDD} +\tikztimingcpy{{U@edge@}UU}{{D@edge@}DD} + +\tikztimingdef{H{D@edge@}}{ + coordinate [shift={(0,-\height/2)}] (timing@ref) + -- ++(\dslope/2, -\height/2) + \tikztiming@chard{#1}% +} + +\tikztimingdef{L{D@edge@}}{ + coordinate [shift={(0,\height/2)}] (timing@ref) + -- ++(\dslope/2, \height/2) + \tikztiming@chard{#1}% +} + +\tikztimingdef{Z{D@edge@}}{ + coordinate (timing@ref) + \tikztiming@chard{#1}% +} + +\tikztimingdef{T{D@edge@}}{ + \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}} + coordinate [shift={(0,\height/2 * \value{tikztimingtrans})}] (timing@ref) + -- ++(\dslope/2, \height/2 * \value{tikztimingtrans}) + \tikztiming@chard{#1}% +} + +\tikztimingdef{{D@edge@}DU}{ + \tikztiming@oldnodecenter@ + \tikztiming@chard{#1} +} +\tikztimingcpy{{U@edge@}UD}{{D@edge@}DU} + +\tikztimingdef{DDU}{% + \tikztiming@dchardu{#1} +} + +\tikztimingcpy{DUU}{UDD}% +\tikztimingcpy{UUD}{DDU}% + +\tikztimingdef{@UU}{% + \tikztiming@@chard@{#1}% +} + +\tikztimingdef{@UD}{% + \tikztiming@@chard{#1}% +} + +\tikztimingdef{@DU}{% + \tikztiming@@chard{#1}% +} + +\tikztimingdef{UD}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard{#1}% +} + +\tikztimingdef{DU}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard{#1}% +} + +\tikztimingdef{UD@}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard@{#1}% +} + +\tikztimingdef{DU@}{% + \tikztiming@oldnodecenter@% + \tikztiming@chard@{#1}% +} \tikztimingecopy{X}{Z} +\let\tikztiming@chars@default\tikztiming@chars +\newcommand*\usetikztiminglibrary[2][]{% + \edef\tikztiming@library@options{#1}% + \@ifnextchar{[}%] + {\tikztiming@library{#2}}% + {\tikztiming@library{#2}[]}% +} +\def\tikztiming@library#1[#2]{% + \edef\tikztiming@library@date{#2}% + \tikztiming@library@#1,\relax +} +\def\tikztiming@zap@space#1 \@empty{#1} +\def\tikztiming@library@#1,{% + \IfFileExists{tikz-timing-#1.sty}% + { \let\tikztiming@orig@zap@space\zap@space + \let\zap@space\tikztiming@zap@space + \RequirePackage + [\tikztiming@library@options]% + {tikz-timing-#1}% + [\tikztiming@library@date]% + \let\zap@space\tikztiming@orig@zap@space + }% + {\PackageError{tikz-timing}% + {No tikz-timing library `#1' found!}% + {}{}{}{}% + }% + \@ifnextchar\relax{}{\tikztiming@library@}% +} \endinput %% %% End of file `tikz-timing.sty'. -- cgit v1.2.3