% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%
% DCTD -- A LaTeX style for typesetting timing diagrams as used with DC
% 
% Author: Bernd Westphal <westphal@informatik.uni-oldenburg.de> 
% 
% Copyright (c) 2009 Bernd Westphal.  All rights reserved.
%
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, either version 1.3 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.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is the copyright holder.
%
% This work consists of the files README, lsc.sty, lsc.tex, lsc.bib.
%
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{dctd}[2009/06/18 Typesetting timing diagrams]

\RequirePackage{pstricks}


\newlength{\tdd}
\pssetlength{\tdd}{0.3}
%
\newcommand{\tdlo}[2]{%
  \psline(#1,-\tdd)(#2,-\tdd)}%
\newcommand{\tdme}[2]{%
  \psline(#1,0)(#2,0)}%
\newcommand{\tdhi}[2]{%
  \psline(#1,\tdd)(#2,\tdd)}%
\newcommand{\tdbar}[1]{%
  \psline[linestyle=dashed](#1,-\tdd)(#1,\tdd)}%
\newcommand{\tdLbar}[1]{%
  \psline[linestyle=dashed](#1,-\tdd)(#1,0)}%
\newcommand{\tdHbar}[1]{%
  \psline[linestyle=dashed](#1,0)(#1,\tdd)}%
%
\newcommand{\tdiLlbl}{$0$}
\newcommand{\tdiMlbl}{}
\newcommand{\tdiHlbl}{$1$}
%
\newenvironment{tdi}[1]{%
  \rput[r](-0.2,\tdd){\tdiHlbl}%
  \rput[r](-0.2,0){\tdiMlbl}%
  \rput[r](-0.2,-\tdd){\tdiLlbl}%
  \rput(-0.6,0){#1}%
  %
  \begin{pssetenv}{linewidth=2\pslinewidth,dash=1pt 2pt}%
}{%
  \end{pssetenv}%
}

\endinput
