%% $Id: pst-circ.tex 1015 2024-10-10 12:02:54Z herbert $
%% This is file `pst-circ.tex'
%%
%% IMPORTANT NOTICE:
%%
%% Package `pst-circ.tex'
%%
%% Herbert Voss <hvoss@tug.org>
%%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN archives
%% in directory CTAN:/macros/latex/base/lppl.txt.
%%
%% DESCRIPTION:
%%   `pst-circ' is a PSTricks package to draw electric circuits
%%
%% For a ChangeLog go the the end
%%
\csname PSTcircLoaded\endcsname
\let\PSTcircLoaded\endinput
%
% Require PSTricks and pst-node packages
%
\ifx\PSTricksLoaded\endinput  \else\input pstricks.tex\fi
\ifx\PSTnodeLoaded\endinput   \else\input pst-node.tex\fi
\ifx\PSTXKeyLoaded\endinput   \else\input pst-xkey \fi
\ifx\PSTMultidoLoaded\endinput\else\input multido.tex\fi
%
\def\fileversion{2.20}
\def\filedate{2024/10/10}
\message{`pst-circ' v\fileversion (hv)}
%
\edef\PstAtCode{\the\catcode`\@}
\catcode`\@=11\relax
\pst@addfams{pst-circ}
%
\pstheader{pst-circ.pro}
\SpecialCoor
%
\newdimen\Pst@position
%
\newcount\pst@count@i
\newcount\pst@count@ii
\newcount\pst@count@iii
%
\newif\ifPst@Dconvention
\newif\ifPst@parallel
\newif\ifPst@parallel@node
\newif\ifPst@T@changeLR
\newif\ifPst@Ttype
\newif\ifPst@FETchanneltype% Ted
\newif\ifPst@Trafo@iprimary
\newif\ifPst@Trafo@isecondary
%
\def\pst@Dconvention@receptor{receptor}
\def\pst@Dconvention@generator{generator}
\def\pst@Ttype@PNP{PNP}
\def\pst@Ttype@NPN{NPN}
\def\pst@Ttype@FET{FET}
\def\pst@Ttype@JFET{JFET}
\def\pst@Ttype@IGBT{IGBT}
\def\pst@Ttype@NMOS{NMOS}
\def\pst@Ttype@PMOS{PMOS}
%
\def\pst@FETchanneltype@P{P}% Ted
\def\pst@FETchanneltype@N{N}% Ted
\def\pst@Dstyle@twoCircles{twoCircles}
\def\pst@Dstyle@varistor{varistor}
\def\pst@Dstyle@thyristor{thyristor}
\def\pst@Dstyle@GTO{GTO}
\def\pst@Dstyle@photo{photo}
\def\pst@Dstyle@triac{triac}
\def\pst@Dstyle@Z{Z}
\def\pst@Dstyle@schottky{schottky}
\def\pst@Dstyle@normal{normal}
\def\pst@Dstyle@chemical{chemical}
\def\pst@Dstyle@elektor{elektor}
\def\pst@Dstyle@crystal{crystal}
\def\pst@Dstyle@elektorchemical{elektorchemical}
\def\pst@Dstyle@elektorcurved{elektorcurved}
\def\pst@Dstyle@curved{curved}
\def\pst@Dstyle@rectangle{rectangle}
\def\pst@Dstyle@open{open}
\def\pst@Dstyle@close{close}
\def\pst@Dstyle@zigzag{zigzag}
\def\pst@Dstyle@diamond{diamond}
\def\pst@Dstyle@normalCei{normalCei}
\def\pst@Dstyle@diamondCei{diamondCei}
\def\pst@tripole@style@left{left}
\def\pst@tripole@style@right{right}
\def\pst@tripole@style@center{center}
\def\pst@tripole@style@french{french}
%
\define@boolkey[psset]{pst-circ}[Pst@]{intensity}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{mathlabel}[true]{}
\define@key[psset]{}{circ}{\psset[pst-circ]{#1}}
\define@key[psset]{pst-circ}{labelstyle}[]{\def\pst@labelstyle{#1}}
\define@key[psset]{pst-circ}{intensitylabel}[]{\def\psk@I@label{#1}}
\define@key[psset]{pst-circ}{intensitylabelcolor}[black]{\def\psk@I@labelcolor{#1}}
\define@key[psset]{pst-circ}{intensitylabeloffset}[0.5]{\def\psk@I@label@offset{#1}}
\define@key[psset]{pst-circ}{intensitycolor}[black]{\def\psk@I@color{#1}}
\define@key[psset]{pst-circ}{intensitywidth}[\pslinewidth]{\def\psk@I@width{#1}}
\define@boolkey[psset]{pst-circ}[Pst@]{tension}[true]{}
\define@key[psset]{pst-circ}{tensionstyle}[line]{\expandafter\psk@tension@style@@#1\@nil}
\def\psk@tension@style@@#1#2\@nil{\ifx#1p \def\psk@tension@style{1}\else\def\psk@tension@style{0}\fi}
\define@key[psset]{pst-circ}{tensionlabel}[]{\def\psk@tension@label{#1}}
\define@key[psset]{pst-circ}{tensionlabelcolor}[black]{\def\psk@tension@labelcolor{#1}}
\define@key[psset]{pst-circ}{tensionoffset}[1]{\def\psk@tension@offset{#1}}
\define@key[psset]{pst-circ}{tensionlabeloffset}[1.2]{\def\psk@tension@label@offset{#1}}
\define@key[psset]{pst-circ}{tensioncolor}[black]{\def\psk@tension@color{#1}}
\define@key[psset]{pst-circ}{tensionwidth}[\pslinewidth]{\def\psk@tension@width{#1}}
\define@key[psset]{pst-circ}{labeloffset}[0.7]{\def\psk@label@offset{#1}}
\define@key[psset]{pst-circ}{labelangle}[0]{\def\psk@label@angle{#1}}
\define@key[psset]{pst-circ}{labelInside}[0]{\def\psk@labelInside{#1}}
\define@key[psset]{pst-circ}{dipoleconvention}[receptor]{\def\psk@Dconvention{#1}}
\define@boolkey[psset]{pst-circ}[Pst@]{directconvention}[true]{}
\define@key[psset]{pst-circ}{dipolestyle}[normal]{\def\psk@Dstyle{#1}}
\define@key[psset]{pst-circ}{parallel}[true]{\@nameuse{Pst@parallel#1}}
\define@key[psset]{pst-circ}{parallelarm}[1.5]{\def\psk@parallel@arm{#1}}
\define@key[psset]{pst-circ}{parallelsep}[0]{\def\psk@parallel@sep{#1}}
\define@key[psset]{pst-circ}{parallelnode}[true]{\@nameuse{Pst@parallel@node#1}}
\define@boolkey[psset]{pst-circ}[Pst@wire@]{intersect}[true]{}
\define@key[psset]{pst-circ}{intersectA}{\def\psk@wire@intersectA{#1}}
\define@key[psset]{pst-circ}{intersectB}{\def\psk@wire@intersectB{#1}}
\define@boolkey[psset]{pst-circ}[Pst@]{OAperfect}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{OApower}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{OAinvert}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{OAiplus}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{OAiminus}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{OAiout}[true]{}
\define@key[psset]{pst-circ}{OAipluslabel}[]{\def\psk@label@OAiplus{#1}}
\define@key[psset]{pst-circ}{OAiminuslabel}[]{\def\psk@label@OAiminus{#1}}
\define@key[psset]{pst-circ}{OAioutlabel}[]{\def\psk@label@OAiout{#1}}
\define@boolkey[psset]{pst-circ}[Pst@]{GMperfect}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{GMpower}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{GMinvert}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{GMiplus}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{GMiminus}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{GMiout}[true]{}	
\define@key[psset]{pst-circ}{GMipluslabel}[]{\def\psk@label@GMiplus{#1}}
\define@key[psset]{pst-circ}{GMiminuslabel}[]{\def\psk@label@GMiminus{#1}}
\define@key[psset]{pst-circ}{GMioutlabel}[]{\def\psk@label@GMiout{#1}}

\define@boolkey[psset]{pst-circ}[Pst@]{IGBTinvert}[true]{}	
\define@boolkey[psset]{pst-circ}[Pst@]{transistorcircle}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{transistorinvert}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{transistoribase}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{transistoricollector}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{transistoriemitter}[true]{}
\define@key[psset]{pst-circ}{transistoribaselabel}[]{\def\psk@labeltransistoribase{#1}}
\define@key[psset]{pst-circ}{transistoricollectorlabel}[]{\def\psk@labeltransistoricollector{#1}}
\define@key[psset]{pst-circ}{transistoriemitterlabel}[]{\def\psk@labeltransistoriemitter{#1}}
\define@key[psset]{pst-circ}{FETchanneltype}{\def\psk@FETchanneltype{#1}}% Ted 2007-10-15
\define@boolkey[psset]{pst-circ}[Pst@]{FETmemory}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{DMOSFET}[false]{}
\define@key[psset]{pst-circ}{transistortype}[NPN]{%
  \def\psk@Ttype{#1}%
  \ifx\psk@Ttype\pst@Ttype@JFET \Pst@transistorcirclefalse\fi
  \ifx\psk@Ttype\pst@Ttype@NMOS \Pst@transistorcirclefalse\fi
  \ifx\psk@Ttype\pst@Ttype@PMOS \Pst@transistorcirclefalse\fi
  \ifx\psk@Ttype\pst@Ttype@IGBT \Pst@transistorcirclefalse\fi
  \ifx\psk@Ttype\pst@Ttype@FET \Pst@transistorcirclefalse\fi}
\newdimen\Pst@basesep
\define@key[psset]{pst-circ}{basesep}[0]{\pst@getlength{#1}\Pst@basesep}
%\define@key[psset]{pst-circ}{TRot}[0]{\def\Pst@TRot{#1}}
\define@key[psset]{pst-circ}{TRot}[0]{\pst@checknum{#1}\Pst@TRot}
\define@key[psset]{pst-circ}{circedge}[\pcangle]{%
  \let\pscirc@edge#1%
  \ifx\pscirc@edge\@none\def\pscirc@edge(##1)(##2){}\fi%
  \ifx\pscirc@edge\pcangles\def\pscirc@edge@sector{2.5}\else\def\pscirc@edge@sector{1.5}\fi%
}
%
\define@key[psset]{pst-circ}{primarylabel}[]{\def\psk@Trafo@primary@label{#1}}
\define@key[psset]{pst-circ}{secondarylabel}[]{\def\psk@Trafo@secondary@label{#1}}
\define@key[psset]{pst-circ}{transformeriprimary}[true]{\@nameuse{Pst@Trafo@iprimary#1}}
\define@key[psset]{pst-circ}{transformerisecondary}[true]{\@nameuse{Pst@Trafo@isecondary#1}}
\define@key[psset]{pst-circ}{transformeriprimarylabel}[]{\def\psk@Trafo@iprimary@label{#1}}
\define@key[psset]{pst-circ}{transformerisecondarylabel}[]{\def\psk@Trafo@isecondary@label{#1}}
\define@key[psset]{pst-circ}{tripolestyle}[normal]{\def\psk@tripole@style{#1}}
\define@boolkey[psset]{pst-circ}[Pst@]{variable}[true]{}
%
\define@boolkey[psset]{pst-circ}[Pst@]{logicChangeLR}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{logicShowDot}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{logicShowNode}[true]{}
\define@key[psset]{pst-circ}{logicWidth}[1.5]{\def\psk@logic@width{#1}}% hv
\define@key[psset]{pst-circ}{logicHeight}[2.5]{\def\psk@logic@height{#1}}% hv
\define@key[psset]{pst-circ}{logicType}[and]{\def\psk@logic@type{#1}}% hv
\define@key[psset]{pst-circ}{logicNInput}[2]{\def\psk@logic@nInput{#1}}% hv
\define@key[psset]{pst-circ}{logicJInput}[2]{\def\psk@logic@JInput{#1}}% hv
\define@key[psset]{pst-circ}{logicKInput}[2]{\def\psk@logic@KInput{#1}}% hv
\define@key[psset]{pst-circ}{logicWireLength}[0.5]{\def\psk@logic@wireLength{#1}}% hv
\define@key[psset]{pst-circ}{logicLabelstyle}[\small]{\def\psk@logic@labelstyle{#1}}% hv
\define@key[psset]{pst-circ}{logicSymbolstyle}[\large]{\def\psk@logic@symbolstyle{#1}}% hv
\define@key[psset]{pst-circ}{logicSymbolpos}[0.5]{\def\psk@logic@symbolpos{#1}}% hv
\define@key[psset]{pst-circ}{logicNodestyle}[\footnotesize]{\def\psk@logic@nodestyle{#1}}% hv
%
\def\pst@logic@type@and{and}
\def\pst@logic@type@or{or}
\def\pst@logic@type@nand{nand}
\def\pst@logic@type@nor{nor}
\def\pst@logic@type@not{not}
\def\pst@logic@type@exor{exor}
\def\pst@logic@type@exnor{exnor}
%
\def\pst@logic@type@RS{RS}
\def\pst@logic@type@D{D}
\def\pst@logic@type@JK{JK}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Logic If Statements
\newif\ifPst@iec
\newif\ifPst@iecinvert
\newif\ifPst@input
\newif\ifPst@invertinput
\newif\ifPst@inputa
\newif\ifPst@invertinputa
\newif\ifPst@inputb
\newif\ifPst@invertinputb
\newif\ifPst@inputc
\newif\ifPst@invertinputc
\newif\ifPst@inputd
\newif\ifPst@invertinputd
\newif\ifPst@enable
\newif\ifPst@invertenable
\newif\ifPst@clock
\newif\ifPst@invertclock
\newif\ifPst@set
\newif\ifPst@invertset
\newif\ifPst@reset
\newif\ifPst@invertreset

\newif\ifPst@output
\newif\ifPst@invertoutput
\newif\ifPst@outputa
\newif\ifPst@invertoutputa
\newif\ifPst@outputb
\newif\ifPst@invertoutputb

\newif\ifPst@segmentlabels

% IC If Statements
\newif\ifPst@pina
\newif\ifPst@invertpina
\newif\ifPst@pinb
\newif\ifPst@invertpinb
\newif\ifPst@pinc
\newif\ifPst@invertpinc
\newif\ifPst@pind
\newif\ifPst@invertpind
\newif\ifPst@pine
\newif\ifPst@invertpine
\newif\ifPst@pinf
\newif\ifPst@invertpinf
\newif\ifPst@ping
\newif\ifPst@invertping
\newif\ifPst@pinh
\newif\ifPst@invertpinh
\newif\ifPst@pini
\newif\ifPst@invertpini
\newif\ifPst@pinj
\newif\ifPst@invertpinj
\newif\ifPst@pink
\newif\ifPst@invertpink
\newif\ifPst@pinl
\newif\ifPst@invertpinl
\newif\ifPst@pinm
\newif\ifPst@invertpinm
\newif\ifPst@pinn
\newif\ifPst@invertpinn
\newif\ifPst@pino
\newif\ifPst@invertpino
\newif\ifPst@pinp
\newif\ifPst@invertpinp
\newif\ifPst@pinq
\newif\ifPst@invertpinq
\newif\ifPst@pinr
\newif\ifPst@invertpinr
\newif\ifPst@pins
\newif\ifPst@invertpins
\newif\ifPst@pint
\newif\ifPst@invertpint
\newif\ifPst@pinu
\newif\ifPst@invertpinu
\newif\ifPst@pinv
\newif\ifPst@invertpinv
\newif\ifPst@pinw
\newif\ifPst@invertpinw
\newif\ifPst@pinx
\newif\ifPst@invertpinx
\newif\ifPst@piny
\newif\ifPst@invertpiny
\newif\ifPst@pinz
\newif\ifPst@invertpinz
\newif\ifPst@pinaa
\newif\ifPst@invertpinaa
\newif\ifPst@pinab
\newif\ifPst@invertpinab
\newif\ifPst@pinac
\newif\ifPst@invertpinac
\newif\ifPst@pinad
\newif\ifPst@invertpinad
\newif\ifPst@pinae
\newif\ifPst@invertpinae
\newif\ifPst@pinaf
\newif\ifPst@invertpinaf


\newif\ifPst@pinla
\newif\ifPst@invertpinla
\newif\ifPst@pinlb
\newif\ifPst@invertpinlb
\newif\ifPst@pinlc
\newif\ifPst@invertpinlc
\newif\ifPst@pinld
\newif\ifPst@invertpinld
\newif\ifPst@pinle
\newif\ifPst@invertpinle
\newif\ifPst@pinlf
\newif\ifPst@invertpinlf
\newif\ifPst@pinlg
\newif\ifPst@invertpinlg
\newif\ifPst@pinlh
\newif\ifPst@invertpinlh
\newif\ifPst@pinli
\newif\ifPst@invertpinli
\newif\ifPst@pinlj
\newif\ifPst@invertpinlj
\newif\ifPst@pinlk
\newif\ifPst@invertpinlk
\newif\ifPst@pinll
\newif\ifPst@invertpinll
\newif\ifPst@pinlm
\newif\ifPst@invertpinlm
\newif\ifPst@pinln
\newif\ifPst@invertpinln
\newif\ifPst@pinlo
\newif\ifPst@invertpinlo
\newif\ifPst@pinlp
\newif\ifPst@invertpinlp

\newif\ifPst@pinra
\newif\ifPst@invertpinra
\newif\ifPst@pinrb
\newif\ifPst@invertpinrb
\newif\ifPst@pinrc
\newif\ifPst@invertpinrc
\newif\ifPst@pinrd
\newif\ifPst@invertpinrd
\newif\ifPst@pinre
\newif\ifPst@invertpinre
\newif\ifPst@pinrf
\newif\ifPst@invertpinrf
\newif\ifPst@pinrg
\newif\ifPst@invertpinrg
\newif\ifPst@pinrh
\newif\ifPst@invertpinrh
\newif\ifPst@pinri
\newif\ifPst@invertpinri
\newif\ifPst@pinrj
\newif\ifPst@invertpinrj
\newif\ifPst@pinrk
\newif\ifPst@invertpinrl
\newif\ifPst@pinrl
\newif\ifPst@invertpinrl
\newif\ifPst@pinrm
\newif\ifPst@invertpinrm
\newif\ifPst@pinrn
\newif\ifPst@invertpinrn
\newif\ifPst@pinro
\newif\ifPst@invertpinro
\newif\ifPst@pinrp
\newif\ifPst@invertpinrp


\newif\ifPst@pintl
\newif\ifPst@invertpintl
\newif\ifPst@pintc
\newif\ifPst@invertpintc
\newif\ifPst@pintr
\newif\ifPst@invertpintr

\newif\ifPst@pinbl
\newif\ifPst@invertpinbl
\newif\ifPst@pinbc
\newif\ifPst@invertpinbc
\newif\ifPst@pinbr
\newif\ifPst@invertpinbr

\newif\ifPst@pinta
\newif\ifPst@invertpinta
\newif\ifPst@pintb
\newif\ifPst@invertpintb
\newif\ifPst@pintc
\newif\ifPst@invertpintc
\newif\ifPst@pintd
\newif\ifPst@invertpintd
\newif\ifPst@pinte
\newif\ifPst@invertpinte

\newif\ifPst@pinba
\newif\ifPst@invertpinba
\newif\ifPst@pinbb
\newif\ifPst@invertpinbb
\newif\ifPst@pinbc
\newif\ifPst@invertpinbc
\newif\ifPst@pinbd
\newif\ifPst@invertpinbd
\newif\ifPst@pinbe
\newif\ifPst@invertpinbe

\newif\ifPst@dpright
\newif\ifPst@dpleft

% Ladder Logic If Statements
\newif\ifPst@latch
\newif\ifPst@unlatch
\newif\ifPst@contactclosed

% Bipole If Statements
\newif\ifPst@polarized

% Diodes
\newif\ifPst@ison

% Define Integer Keys
\define@choicekey[psset]{pst-circ}{ninputs}{0,1,2,3,4}[2]{\def\psk@ninputs{#1}}
\define@choicekey[psset]{pst-circ}{segmentdisplay}{0,1,2,3,4,5,6,7,8,9,10}[10]{\def\psk@segmentdisplay{#1}}
\define@choicekey[psset]{pst-circ}{nicpins}[\val\nr]{8,14,16,20,32}[8]{
	\ifcase\nr\relax
		\def\psk@nicpins{0}
	\or
		\def\psk@nicpins{1}
	\or
		\def\psk@nicpins{2}
	\or
		\def\psk@nicpins{3}
	\or
		\def\psk@nicpins{4}
	\fi
}
\define@choicekey[psset]{pst-circ}{bubblesize}{0.05,0.1,0.15,0.2}[0.15]{\def\psk@bubblesize{#1}}

%
\define@key[psset]{pst-circ}{segmentcolor}[black]{\def\psk@segmentcolor{#1}}

% Define Logic String Keys
\define@key[psset]{pst-circ}{inputalabel}[]{\def\psk@inputalabel{#1}}
\define@key[psset]{pst-circ}{inputblabel}[]{\def\psk@inputblabel{#1}}
\define@key[psset]{pst-circ}{inputclabel}[]{\def\psk@inputclabel{#1}}
\define@key[psset]{pst-circ}{inputenlabel}[]{\def\psk@inputenlabel{#1}}
\define@key[psset]{pst-circ}{inputcllabel}[]{\def\psk@inputcllabel{#1}}
\define@key[psset]{pst-circ}{outputalabel}[]{\def\psk@outputalabel{#1}}
\define@key[psset]{pst-circ}{outputblabel}[]{\def\psk@outputblabel{#1}}
\define@key[psset]{pst-circ}{outputclabel}[]{\def\psk@outputclabel{#1}}

% Define IC String Keys
\define@key[psset]{pst-circ}{pinalabel}[]{\def\psk@pinalabel{#1}}
\define@key[psset]{pst-circ}{pinanumber}[]{\def\psk@pinanumber{#1}}
\define@key[psset]{pst-circ}{pinblabel}[]{\def\psk@pinblabel{#1}}
\define@key[psset]{pst-circ}{pinbnumber}[]{\def\psk@pinbnumber{#1}}
\define@key[psset]{pst-circ}{pinclabel}[]{\def\psk@pinclabel{#1}}
\define@key[psset]{pst-circ}{pincnumber}[]{\def\psk@pincnumber{#1}}
\define@key[psset]{pst-circ}{pindlabel}[]{\def\psk@pindlabel{#1}}
\define@key[psset]{pst-circ}{pindnumber}[]{\def\psk@pindnumber{#1}}
\define@key[psset]{pst-circ}{pinelabel}[]{\def\psk@pinelabel{#1}}
\define@key[psset]{pst-circ}{pinenumber}[]{\def\psk@pinenumber{#1}}
\define@key[psset]{pst-circ}{pinflabel}[]{\def\psk@pinflabel{#1}}
\define@key[psset]{pst-circ}{pinfnumber}[]{\def\psk@pinfnumber{#1}}
\define@key[psset]{pst-circ}{pinglabel}[]{\def\psk@pinglabel{#1}}
\define@key[psset]{pst-circ}{pingnumber}[]{\def\psk@pingnumber{#1}}
\define@key[psset]{pst-circ}{pinhlabel}[]{\def\psk@pinhlabel{#1}}
\define@key[psset]{pst-circ}{pinhnumber}[]{\def\psk@pinhnumber{#1}}
\define@key[psset]{pst-circ}{pinilabel}[]{\def\psk@pinilabel{#1}}
\define@key[psset]{pst-circ}{pininumber}[]{\def\psk@pininumber{#1}}
\define@key[psset]{pst-circ}{pinjlabel}[]{\def\psk@pinjlabel{#1}}
\define@key[psset]{pst-circ}{pinjnumber}[]{\def\psk@pinjnumber{#1}}
\define@key[psset]{pst-circ}{pinklabel}[]{\def\psk@pinklabel{#1}}
\define@key[psset]{pst-circ}{pinknumber}[]{\def\psk@pinknumber{#1}}
\define@key[psset]{pst-circ}{pinllabel}[]{\def\psk@pinllabel{#1}}
\define@key[psset]{pst-circ}{pinlnumber}[]{\def\psk@pinlnumber{#1}}
\define@key[psset]{pst-circ}{pinmlabel}[]{\def\psk@pinmlabel{#1}}
\define@key[psset]{pst-circ}{pinmnumber}[]{\def\psk@pinmnumber{#1}}
\define@key[psset]{pst-circ}{pinnlabel}[]{\def\psk@pinnlabel{#1}}
\define@key[psset]{pst-circ}{pinnnumber}[]{\def\psk@pinnnumber{#1}}
\define@key[psset]{pst-circ}{pinolabel}[]{\def\psk@pinolabel{#1}}
\define@key[psset]{pst-circ}{pinonumber}[]{\def\psk@pinonumber{#1}}
\define@key[psset]{pst-circ}{pinplabel}[]{\def\psk@pinplabel{#1}}
\define@key[psset]{pst-circ}{pinpnumber}[]{\def\psk@pinpnumber{#1}}
\define@key[psset]{pst-circ}{pinqlabel}[]{\def\psk@pinqlabel{#1}}
\define@key[psset]{pst-circ}{pinqnumber}[]{\def\psk@pinqnumber{#1}}
\define@key[psset]{pst-circ}{pinrlabel}[]{\def\psk@pinrlabel{#1}}
\define@key[psset]{pst-circ}{pinrnumber}[]{\def\psk@pinrnumber{#1}}
\define@key[psset]{pst-circ}{pinslabel}[]{\def\psk@pinslabel{#1}}
\define@key[psset]{pst-circ}{pinsnumber}[]{\def\psk@pinsnumber{#1}}
\define@key[psset]{pst-circ}{pintlabel}[]{\def\psk@pintlabel{#1}}
\define@key[psset]{pst-circ}{pintnumber}[]{\def\psk@pintnumber{#1}}
\define@key[psset]{pst-circ}{pinulabel}[]{\def\psk@pinulabel{#1}}
\define@key[psset]{pst-circ}{pinunumber}[]{\def\psk@pinunumber{#1}}
\define@key[psset]{pst-circ}{pinvlabel}[]{\def\psk@pinvlabel{#1}}
\define@key[psset]{pst-circ}{pinvnumber}[]{\def\psk@pinvnumber{#1}}
\define@key[psset]{pst-circ}{pinwlabel}[]{\def\psk@pinwlabel{#1}}
\define@key[psset]{pst-circ}{pinwnumber}[]{\def\psk@pinwnumber{#1}}
\define@key[psset]{pst-circ}{pinxlabel}[]{\def\psk@pinxlabel{#1}}
\define@key[psset]{pst-circ}{pinxnumber}[]{\def\psk@pinxnumber{#1}}
\define@key[psset]{pst-circ}{pinylabel}[]{\def\psk@pinylabel{#1}}
\define@key[psset]{pst-circ}{pinynumber}[]{\def\psk@pinynumber{#1}}
\define@key[psset]{pst-circ}{pinzlabel}[]{\def\psk@pinzlabel{#1}}
\define@key[psset]{pst-circ}{pinznumber}[]{\def\psk@pinznumber{#1}}
\define@key[psset]{pst-circ}{pinaalabel}[]{\def\psk@pinaalabel{#1}}
\define@key[psset]{pst-circ}{pinaanumber}[]{\def\psk@pinaanumber{#1}}
\define@key[psset]{pst-circ}{pinablabel}[]{\def\psk@pinablabel{#1}}
\define@key[psset]{pst-circ}{pinabnumber}[]{\def\psk@pinabnumber{#1}}
\define@key[psset]{pst-circ}{pinaclabel}[]{\def\psk@pinaclabel{#1}}
\define@key[psset]{pst-circ}{pinacnumber}[]{\def\psk@pinacnumber{#1}}
\define@key[psset]{pst-circ}{pinadlabel}[]{\def\psk@pinadlabel{#1}}
\define@key[psset]{pst-circ}{pinadnumber}[]{\def\psk@pinadnumber{#1}}
\define@key[psset]{pst-circ}{pinaelabel}[]{\def\psk@pinaelabel{#1}}
\define@key[psset]{pst-circ}{pinaenumber}[]{\def\psk@pinaenumber{#1}}
\define@key[psset]{pst-circ}{pinaflabel}[]{\def\psk@pinaflabel{#1}}
\define@key[psset]{pst-circ}{pinafnumber}[]{\def\psk@pinafnumber{#1}}



\define@key[psset]{pst-circ}{pinralabel}[]{\def\psk@pinralabel{#1}}
\define@key[psset]{pst-circ}{pinranumber}[]{\def\psk@pinranumber{#1}}
\define@key[psset]{pst-circ}{pinrblabel}[]{\def\psk@pinrblabel{#1}}
\define@key[psset]{pst-circ}{pinrbnumber}[]{\def\psk@pinrbnumber{#1}}
\define@key[psset]{pst-circ}{pinrclabel}[]{\def\psk@pinrclabel{#1}}
\define@key[psset]{pst-circ}{pinrcnumber}[]{\def\psk@pinrcnumber{#1}}
\define@key[psset]{pst-circ}{pinrdlabel}[]{\def\psk@pinrdlabel{#1}}
\define@key[psset]{pst-circ}{pinrdnumber}[]{\def\psk@pinrdnumber{#1}}
\define@key[psset]{pst-circ}{pinrelabel}[]{\def\psk@pinrelabel{#1}}
\define@key[psset]{pst-circ}{pinrenumber}[]{\def\psk@pinrenumber{#1}}
\define@key[psset]{pst-circ}{pinrflabel}[]{\def\psk@pinrflabel{#1}}
\define@key[psset]{pst-circ}{pinrfnumber}[]{\def\psk@pinrfnumber{#1}}
\define@key[psset]{pst-circ}{pinrglabel}[]{\def\psk@pinrglabel{#1}}
\define@key[psset]{pst-circ}{pinrgnumber}[]{\def\psk@pinrgnumber{#1}}
\define@key[psset]{pst-circ}{pinrhlabel}[]{\def\psk@pinrhlabel{#1}}
\define@key[psset]{pst-circ}{pinrhnumber}[]{\def\psk@pinrhnumber{#1}}
\define@key[psset]{pst-circ}{pinrilabel}[]{\def\psk@pinrilabel{#1}}
\define@key[psset]{pst-circ}{pinrinumber}[]{\def\psk@pinrinumber{#1}}
\define@key[psset]{pst-circ}{pinrjlabel}[]{\def\psk@pinrjlabel{#1}}
\define@key[psset]{pst-circ}{pinrjnumber}[]{\def\psk@pinrjnumber{#1}}
\define@key[psset]{pst-circ}{pinrklabel}[]{\def\psk@pinrklabel{#1}}
\define@key[psset]{pst-circ}{pinrknumber}[]{\def\psk@pinrknumber{#1}}
\define@key[psset]{pst-circ}{pinrllabel}[]{\def\psk@pinrllabel{#1}}
\define@key[psset]{pst-circ}{pinrlnumber}[]{\def\psk@pinrlnumber{#1}}
\define@key[psset]{pst-circ}{pinrmlabel}[]{\def\psk@pinrmlabel{#1}}
\define@key[psset]{pst-circ}{pinrmnumber}[]{\def\psk@pinrmnumber{#1}}
\define@key[psset]{pst-circ}{pinrnlabel}[]{\def\psk@pinrnlabel{#1}}
\define@key[psset]{pst-circ}{pinrnnumber}[]{\def\psk@pinrnnumber{#1}}
\define@key[psset]{pst-circ}{pinrolabel}[]{\def\psk@pinrolabel{#1}}
\define@key[psset]{pst-circ}{pinronumber}[]{\def\psk@pinronumber{#1}}
\define@key[psset]{pst-circ}{pinrplabel}[]{\def\psk@pinrplabel{#1}}
\define@key[psset]{pst-circ}{pinrpnumber}[]{\def\psk@pinrpnumber{#1}}

\define@key[psset]{pst-circ}{pinlalabel}[]{\def\psk@pinlalabel{#1}}
\define@key[psset]{pst-circ}{pinlanumber}[]{\def\psk@pinlanumber{#1}}
\define@key[psset]{pst-circ}{pinlblabel}[]{\def\psk@pinlblabel{#1}}
\define@key[psset]{pst-circ}{pinlbnumber}[]{\def\psk@pinlbnumber{#1}}
\define@key[psset]{pst-circ}{pinlclabel}[]{\def\psk@pinlclabel{#1}}
\define@key[psset]{pst-circ}{pinlcnumber}[]{\def\psk@pinlcnumber{#1}}
\define@key[psset]{pst-circ}{pinldlabel}[]{\def\psk@pinldlabel{#1}}
\define@key[psset]{pst-circ}{pinldnumber}[]{\def\psk@pinldnumber{#1}}
\define@key[psset]{pst-circ}{pinlelabel}[]{\def\psk@pinlelabel{#1}}
\define@key[psset]{pst-circ}{pinlenumber}[]{\def\psk@pinlenumber{#1}}
\define@key[psset]{pst-circ}{pinlflabel}[]{\def\psk@pinlflabel{#1}}
\define@key[psset]{pst-circ}{pinlfnumber}[]{\def\psk@pinlfnumber{#1}}
\define@key[psset]{pst-circ}{pinlglabel}[]{\def\psk@pinlglabel{#1}}
\define@key[psset]{pst-circ}{pinlgnumber}[]{\def\psk@pinlgnumber{#1}}
\define@key[psset]{pst-circ}{pinlhlabel}[]{\def\psk@pinlhlabel{#1}}
\define@key[psset]{pst-circ}{pinlhnumber}[]{\def\psk@pinlhnumber{#1}}
\define@key[psset]{pst-circ}{pinlilabel}[]{\def\psk@pinlilabel{#1}}
\define@key[psset]{pst-circ}{pinlinumber}[]{\def\psk@pinlinumber{#1}}
\define@key[psset]{pst-circ}{pinljlabel}[]{\def\psk@pinljlabel{#1}}
\define@key[psset]{pst-circ}{pinljnumber}[]{\def\psk@pinljnumber{#1}}
\define@key[psset]{pst-circ}{pinlklabel}[]{\def\psk@pinlklabel{#1}}
\define@key[psset]{pst-circ}{pinlknumber}[]{\def\psk@pinlknumber{#1}}
\define@key[psset]{pst-circ}{pinlllabel}[]{\def\psk@pinlllabel{#1}}
\define@key[psset]{pst-circ}{pinllnumber}[]{\def\psk@pinllnumber{#1}}
\define@key[psset]{pst-circ}{pinlmlabel}[]{\def\psk@pinlmlabel{#1}}
\define@key[psset]{pst-circ}{pinlmnumber}[]{\def\psk@pinlmnumber{#1}}
\define@key[psset]{pst-circ}{pinlnlabel}[]{\def\psk@pinlnlabel{#1}}
\define@key[psset]{pst-circ}{pinlnnumber}[]{\def\psk@pinlnnumber{#1}}
\define@key[psset]{pst-circ}{pinlolabel}[]{\def\psk@pinlolabel{#1}}
\define@key[psset]{pst-circ}{pinlonumber}[]{\def\psk@pinlonumber{#1}}
\define@key[psset]{pst-circ}{pinlplabel}[]{\def\psk@pinlplabel{#1}}
\define@key[psset]{pst-circ}{pinlpnumber}[]{\def\psk@pinlpnumber{#1}}

\define@key[psset]{pst-circ}{pintllabel}[]{\def\psk@pintllabel{#1}}
\define@key[psset]{pst-circ}{pintlnumber}[]{\def\psk@pintlnumber{#1}}
\define@key[psset]{pst-circ}{pintclabel}[]{\def\psk@pintclabel{#1}}
\define@key[psset]{pst-circ}{pintcnumber}[]{\def\psk@pintcnumber{#1}}
\define@key[psset]{pst-circ}{pintrlabel}[]{\def\psk@pintrlabel{#1}}
\define@key[psset]{pst-circ}{pintrnumber}[]{\def\psk@pintrnumber{#1}}

\define@key[psset]{pst-circ}{pinbllabel}[]{\def\psk@pinbllabel{#1}}
\define@key[psset]{pst-circ}{pinblnumber}[]{\def\psk@pinblnumber{#1}}
\define@key[psset]{pst-circ}{pinbclabel}[]{\def\psk@pinbclabel{#1}}
\define@key[psset]{pst-circ}{pinbcnumber}[]{\def\psk@pinbcnumber{#1}}
\define@key[psset]{pst-circ}{pinbrlabel}[]{\def\psk@pinbrlabel{#1}}
\define@key[psset]{pst-circ}{pinbrnumber}[]{\def\psk@pinbrnumber{#1}}

\define@key[psset]{pst-circ}{pintalabel}[]{\def\psk@pintalabel{#1}}
\define@key[psset]{pst-circ}{pintanumber}[]{\def\psk@pintanumber{#1}}
\define@key[psset]{pst-circ}{pintblabel}[]{\def\psk@pintblabel{#1}}
\define@key[psset]{pst-circ}{pintbnumber}[]{\def\psk@pintbnumber{#1}}
\define@key[psset]{pst-circ}{pintclabel}[]{\def\psk@pintclabel{#1}}
\define@key[psset]{pst-circ}{pintcnumber}[]{\def\psk@pintcnumber{#1}}
\define@key[psset]{pst-circ}{pintdlabel}[]{\def\psk@pintdlabel{#1}}
\define@key[psset]{pst-circ}{pintdnumber}[]{\def\psk@pintdnumber{#1}}
\define@key[psset]{pst-circ}{pintelabel}[]{\def\psk@pintelabel{#1}}
\define@key[psset]{pst-circ}{pintenumber}[]{\def\psk@pintenumber{#1}}

\define@key[psset]{pst-circ}{pinbalabel}[]{\def\psk@pinbalabel{#1}}
\define@key[psset]{pst-circ}{pinbanumber}[]{\def\psk@pinbanumber{#1}}
\define@key[psset]{pst-circ}{pinbblabel}[]{\def\psk@pinbblabel{#1}}
\define@key[psset]{pst-circ}{pinbbnumber}[]{\def\psk@pinbbnumber{#1}}
\define@key[psset]{pst-circ}{pinbclabel}[]{\def\psk@pinbclabel{#1}}
\define@key[psset]{pst-circ}{pinbcnumber}[]{\def\psk@pinbcnumber{#1}}
\define@key[psset]{pst-circ}{pinbdlabel}[]{\def\psk@pinbdlabel{#1}}
\define@key[psset]{pst-circ}{pinbdnumber}[]{\def\psk@pinbdnumber{#1}}
\define@key[psset]{pst-circ}{pinbelabel}[]{\def\psk@pinbelabel{#1}}
\define@key[psset]{pst-circ}{pinbenumber}[]{\def\psk@pinbenumber{#1}}

% Define Ladder logic String Keys
\define@key[psset]{pst-circ}{plcaddress}[]{\def\psk@plcaddress{#1}}
\define@key[psset]{pst-circ}{plcsymbol}[]{\def\psk@plcsymbol{#1}}

% Define Logic Boolean Keys
\define@key[psset]{pst-circ}{iec}[false]{\@nameuse{Pst@iec#1}}
\define@key[psset]{pst-circ}{iecinvert}[false]{\@nameuse{Pst@iecinvert#1}}
\define@key[psset]{pst-circ}{input}[true]{\@nameuse{Pst@input#1}}
\define@key[psset]{pst-circ}{invertinput}[false]{\@nameuse{Pst@invertinput#1}}
\define@key[psset]{pst-circ}{inputa}[true]{\@nameuse{Pst@inputa#1}}
\define@key[psset]{pst-circ}{invertinputa}[false]{\@nameuse{Pst@invertinputa#1}}
\define@key[psset]{pst-circ}{inputb}[true]{\@nameuse{Pst@inputb#1}}
\define@key[psset]{pst-circ}{invertinputb}[false]{\@nameuse{Pst@invertinputb#1}}
\define@key[psset]{pst-circ}{inputc}[true]{\@nameuse{Pst@inputc#1}}
\define@key[psset]{pst-circ}{invertinputc}[false]{\@nameuse{Pst@invertinputc#1}}
\define@key[psset]{pst-circ}{inputd}[true]{\@nameuse{Pst@inputd#1}}
\define@key[psset]{pst-circ}{invertinputd}[false]{\@nameuse{Pst@invertinputd#1}}
\define@key[psset]{pst-circ}{enable}[false]{\@nameuse{Pst@enable#1}}
\define@key[psset]{pst-circ}{invertenable}[false]{\@nameuse{Pst@invertenable#1}}
\define@key[psset]{pst-circ}{clock}[false]{\@nameuse{Pst@clock#1}}
\define@key[psset]{pst-circ}{invertclock}[false]{\@nameuse{Pst@invertclock#1}}
\define@key[psset]{pst-circ}{set}[false]{\@nameuse{Pst@set#1}}
\define@key[psset]{pst-circ}{invertset}[false]{\@nameuse{Pst@invertset#1}}
\define@key[psset]{pst-circ}{reset}[false]{\@nameuse{Pst@reset#1}}
\define@key[psset]{pst-circ}{invertreset}[false]{\@nameuse{Pst@invertreset#1}}

\define@key[psset]{pst-circ}{output}[true]{\@nameuse{Pst@output#1}}
\define@key[psset]{pst-circ}{invertoutput}[false]{\@nameuse{Pst@invertoutput#1}}
\define@key[psset]{pst-circ}{outputa}[true]{\@nameuse{Pst@outputa#1}}
\define@key[psset]{pst-circ}{invertoutputa}[false]{\@nameuse{Pst@invertoutputa#1}}
\define@key[psset]{pst-circ}{outputb}[true]{\@nameuse{Pst@outputb#1}}
\define@key[psset]{pst-circ}{invertoutputb}[true]{\@nameuse{Pst@invertoutputb#1}}
%\define@key[psset]{pst-circ}{outputc}[true]{\@nameuse{Pst@outputc#1}}
%\define@key[psset]{pst-circ}{invertoutputc}[false]{\@nameuse{Pst@invertoutputc#1}}
\define@key[psset]{pst-circ}{segmentlabels}[true]{\@nameuse{Pst@segmentlabels#1}}

% Define IC Boolean Keys
\define@key[psset]{pst-circ}{pina}[true]{\@nameuse{Pst@pina#1}}
\define@key[psset]{pst-circ}{invertpina}[false]{\@nameuse{Pst@invertpina#1}}
\define@key[psset]{pst-circ}{pinb}[true]{\@nameuse{Pst@pinb#1}}
\define@key[psset]{pst-circ}{invertpinb}[false]{\@nameuse{Pst@invertpinb#1}}
\define@key[psset]{pst-circ}{pinc}[true]{\@nameuse{Pst@pinc#1}}
\define@key[psset]{pst-circ}{invertpinc}[false]{\@nameuse{Pst@invertpinc#1}}
\define@key[psset]{pst-circ}{pind}[true]{\@nameuse{Pst@pind#1}}
\define@key[psset]{pst-circ}{invertpind}[false]{\@nameuse{Pst@invertpind#1}}
\define@key[psset]{pst-circ}{pine}[true]{\@nameuse{Pst@pine#1}}
\define@key[psset]{pst-circ}{invertpine}[false]{\@nameuse{Pst@invertpine#1}}
\define@key[psset]{pst-circ}{pinf}[true]{\@nameuse{Pst@pinf#1}}
\define@key[psset]{pst-circ}{invertpinf}[false]{\@nameuse{Pst@invertpinf#1}}
\define@key[psset]{pst-circ}{ping}[true]{\@nameuse{Pst@ping#1}}
\define@key[psset]{pst-circ}{invertping}[false]{\@nameuse{Pst@invertping#1}}
\define@key[psset]{pst-circ}{pinh}[true]{\@nameuse{Pst@pinh#1}}
\define@key[psset]{pst-circ}{invertpinh}[false]{\@nameuse{Pst@invertpinh#1}}
\define@key[psset]{pst-circ}{pini}[true]{\@nameuse{Pst@pini#1}}
\define@key[psset]{pst-circ}{invertpini}[false]{\@nameuse{Pst@invertpini#1}}
\define@key[psset]{pst-circ}{pinj}[true]{\@nameuse{Pst@pinj#1}}
\define@key[psset]{pst-circ}{invertpinj}[false]{\@nameuse{Pst@invertpinj#1}}
\define@key[psset]{pst-circ}{pink}[true]{\@nameuse{Pst@pink#1}}
\define@key[psset]{pst-circ}{invertpink}[false]{\@nameuse{Pst@invertpink#1}}
\define@key[psset]{pst-circ}{pinl}[true]{\@nameuse{Pst@pinl#1}}
\define@key[psset]{pst-circ}{invertpinl}[false]{\@nameuse{Pst@invertpinl#1}}
\define@key[psset]{pst-circ}{pinm}[true]{\@nameuse{Pst@pinm#1}}
\define@key[psset]{pst-circ}{invertpinm}[false]{\@nameuse{Pst@invertpinm#1}}
\define@key[psset]{pst-circ}{pinn}[true]{\@nameuse{Pst@pinn#1}}
\define@key[psset]{pst-circ}{invertpinn}[false]{\@nameuse{Pst@invertpinn#1}}
\define@key[psset]{pst-circ}{pino}[true]{\@nameuse{Pst@pino#1}}
\define@key[psset]{pst-circ}{invertpino}[false]{\@nameuse{Pst@invertpino#1}}
\define@key[psset]{pst-circ}{pinp}[true]{\@nameuse{Pst@pinp#1}}
\define@key[psset]{pst-circ}{invertpinp}[false]{\@nameuse{Pst@invertpinp#1}}
\define@key[psset]{pst-circ}{pinq}[true]{\@nameuse{Pst@pinq#1}}
\define@key[psset]{pst-circ}{invertpinq}[false]{\@nameuse{Pst@invertpinq#1}}
\define@key[psset]{pst-circ}{pinr}[true]{\@nameuse{Pst@pinr#1}}
\define@key[psset]{pst-circ}{invertpinr}[false]{\@nameuse{Pst@invertpinr#1}}
\define@key[psset]{pst-circ}{pins}[true]{\@nameuse{Pst@pins#1}}
\define@key[psset]{pst-circ}{invertpins}[false]{\@nameuse{Pst@invertpins#1}}
\define@key[psset]{pst-circ}{pint}[true]{\@nameuse{Pst@pint#1}}
\define@key[psset]{pst-circ}{invertpint}[false]{\@nameuse{Pst@invertpint#1}}
\define@key[psset]{pst-circ}{pinu}[true]{\@nameuse{Pst@pinu#1}}
\define@key[psset]{pst-circ}{invertpinu}[false]{\@nameuse{Pst@invertpinu#1}}
\define@key[psset]{pst-circ}{pinv}[true]{\@nameuse{Pst@pinv#1}}
\define@key[psset]{pst-circ}{invertpinv}[false]{\@nameuse{Pst@invertpinv#1}}
\define@key[psset]{pst-circ}{pinw}[true]{\@nameuse{Pst@pinw#1}}
\define@key[psset]{pst-circ}{invertpinw}[false]{\@nameuse{Pst@invertpinw#1}}
\define@key[psset]{pst-circ}{pinx}[true]{\@nameuse{Pst@pinx#1}}
\define@key[psset]{pst-circ}{invertpinx}[false]{\@nameuse{Pst@invertpinx#1}}
\define@key[psset]{pst-circ}{piny}[true]{\@nameuse{Pst@piny#1}}
\define@key[psset]{pst-circ}{invertpiny}[false]{\@nameuse{Pst@invertpiny#1}}
\define@key[psset]{pst-circ}{pinz}[true]{\@nameuse{Pst@pinz#1}}
\define@key[psset]{pst-circ}{invertpinz}[false]{\@nameuse{Pst@invertpinz#1}}
\define@key[psset]{pst-circ}{pinaa}[true]{\@nameuse{Pst@pinaa#1}}
\define@key[psset]{pst-circ}{invertpinaa}[false]{\@nameuse{Pst@invertpinaa#1}}
\define@key[psset]{pst-circ}{pinab}[true]{\@nameuse{Pst@pinab#1}}
\define@key[psset]{pst-circ}{invertpinab}[false]{\@nameuse{Pst@invertpinab#1}}
\define@key[psset]{pst-circ}{pinac}[true]{\@nameuse{Pst@pinac#1}}
\define@key[psset]{pst-circ}{invertpinac}[false]{\@nameuse{Pst@invertpinac#1}}
\define@key[psset]{pst-circ}{pinad}[true]{\@nameuse{Pst@pinad#1}}
\define@key[psset]{pst-circ}{invertpinad}[false]{\@nameuse{Pst@invertpinad#1}}
\define@key[psset]{pst-circ}{pinae}[true]{\@nameuse{Pst@pinae#1}}
\define@key[psset]{pst-circ}{invertpinae}[false]{\@nameuse{Pst@invertpinae#1}}
\define@key[psset]{pst-circ}{pinaf}[true]{\@nameuse{Pst@pinaf#1}}
\define@key[psset]{pst-circ}{invertpinaf}[false]{\@nameuse{Pst@invertpinaf#1}}

\define@key[psset]{pst-circ}{pinla}[true]{\@nameuse{Pst@pinla#1}}
\define@key[psset]{pst-circ}{invertpinla}[false]{\@nameuse{Pst@invertpinla#1}}
\define@key[psset]{pst-circ}{pinlb}[true]{\@nameuse{Pst@pinlb#1}}
\define@key[psset]{pst-circ}{invertpinlb}[false]{\@nameuse{Pst@invertpinlb#1}}
\define@key[psset]{pst-circ}{pinlc}[true]{\@nameuse{Pst@pinlc#1}}
\define@key[psset]{pst-circ}{invertpinlc}[false]{\@nameuse{Pst@invertpinlc#1}}
\define@key[psset]{pst-circ}{pinld}[true]{\@nameuse{Pst@pinld#1}}
\define@key[psset]{pst-circ}{invertpinld}[false]{\@nameuse{Pst@invertpinld#1}}
\define@key[psset]{pst-circ}{pinle}[true]{\@nameuse{Pst@pinle#1}}
\define@key[psset]{pst-circ}{invertpinle}[false]{\@nameuse{Pst@invertpinle#1}}
\define@key[psset]{pst-circ}{pinlf}[true]{\@nameuse{Pst@pinlf#1}}
\define@key[psset]{pst-circ}{invertpinlf}[false]{\@nameuse{Pst@invertpinlf#1}}
\define@key[psset]{pst-circ}{pinlg}[true]{\@nameuse{Pst@pinlg#1}}
\define@key[psset]{pst-circ}{invertpinlg}[false]{\@nameuse{Pst@invertpinlg#1}}
\define@key[psset]{pst-circ}{pinlh}[true]{\@nameuse{Pst@pinlh#1}}
\define@key[psset]{pst-circ}{invertpinlh}[false]{\@nameuse{Pst@invertpinlh#1}}
\define@key[psset]{pst-circ}{pinli}[true]{\@nameuse{Pst@pinli#1}}
\define@key[psset]{pst-circ}{invertpinli}[false]{\@nameuse{Pst@invertpinli#1}}
\define@key[psset]{pst-circ}{pinlj}[true]{\@nameuse{Pst@pinlj#1}}
\define@key[psset]{pst-circ}{invertpinlj}[false]{\@nameuse{Pst@invertpinlj#1}}
\define@key[psset]{pst-circ}{pinlk}[true]{\@nameuse{Pst@pinlk#1}}
\define@key[psset]{pst-circ}{invertpinlk}[false]{\@nameuse{Pst@invertpinlk#1}}
\define@key[psset]{pst-circ}{pinll}[true]{\@nameuse{Pst@pinll#1}}
\define@key[psset]{pst-circ}{invertpinll}[false]{\@nameuse{Pst@invertpinll#1}}
\define@key[psset]{pst-circ}{pinlm}[true]{\@nameuse{Pst@pinlm#1}}
\define@key[psset]{pst-circ}{invertpinlm}[false]{\@nameuse{Pst@invertpinlm#1}}
\define@key[psset]{pst-circ}{pinln}[true]{\@nameuse{Pst@pinln#1}}
\define@key[psset]{pst-circ}{invertpinln}[false]{\@nameuse{Pst@invertpinln#1}}
\define@key[psset]{pst-circ}{pinlo}[true]{\@nameuse{Pst@pinlo#1}}
\define@key[psset]{pst-circ}{invertpinlo}[false]{\@nameuse{Pst@invertpinlo#1}}
\define@key[psset]{pst-circ}{pinlp}[true]{\@nameuse{Pst@pinlp#1}}
\define@key[psset]{pst-circ}{invertpinlp}[false]{\@nameuse{Pst@invertpinlp#1}}



\define@key[psset]{pst-circ}{pinra}[true]{\@nameuse{Pst@pinra#1}}
\define@key[psset]{pst-circ}{invertpinra}[false]{\@nameuse{Pst@invertpinra#1}}
\define@key[psset]{pst-circ}{pinrb}[true]{\@nameuse{Pst@pinrb#1}}
\define@key[psset]{pst-circ}{invertpinrb}[false]{\@nameuse{Pst@invertpinrb#1}}
\define@key[psset]{pst-circ}{pinrc}[true]{\@nameuse{Pst@pinrc#1}}
\define@key[psset]{pst-circ}{invertpinrc}[false]{\@nameuse{Pst@invertpinrc#1}}
\define@key[psset]{pst-circ}{pinrd}[true]{\@nameuse{Pst@pinrd#1}}
\define@key[psset]{pst-circ}{invertpinrd}[false]{\@nameuse{Pst@invertpinrd#1}}
\define@key[psset]{pst-circ}{pinre}[true]{\@nameuse{Pst@pinre#1}}
\define@key[psset]{pst-circ}{invertpinre}[false]{\@nameuse{Pst@invertpinre#1}}
\define@key[psset]{pst-circ}{pinrf}[true]{\@nameuse{Pst@pinrf#1}}
\define@key[psset]{pst-circ}{invertpinrf}[false]{\@nameuse{Pst@invertpinrf#1}}
\define@key[psset]{pst-circ}{pinrg}[true]{\@nameuse{Pst@pinrg#1}}
\define@key[psset]{pst-circ}{invertpinrg}[false]{\@nameuse{Pst@invertpinrg#1}}
\define@key[psset]{pst-circ}{pinrh}[true]{\@nameuse{Pst@pinrh#1}}
\define@key[psset]{pst-circ}{invertpinrh}[false]{\@nameuse{Pst@invertpinrh#1}}
\define@key[psset]{pst-circ}{pinri}[true]{\@nameuse{Pst@pinri#1}}
\define@key[psset]{pst-circ}{invertpinri}[false]{\@nameuse{Pst@invertpinri#1}}
\define@key[psset]{pst-circ}{pinrj}[true]{\@nameuse{Pst@pinrj#1}}
\define@key[psset]{pst-circ}{invertpinrj}[false]{\@nameuse{Pst@invertpinrj#1}}
\define@key[psset]{pst-circ}{pinrk}[true]{\@nameuse{Pst@pinrk#1}}
\define@key[psset]{pst-circ}{invertpinrk}[false]{\@nameuse{Pst@invertpinrk#1}}
\define@key[psset]{pst-circ}{pinrl}[true]{\@nameuse{Pst@pinrl#1}}
\define@key[psset]{pst-circ}{invertpinrl}[false]{\@nameuse{Pst@invertpinrl#1}}
\define@key[psset]{pst-circ}{pinrm}[true]{\@nameuse{Pst@pinrm#1}}
\define@key[psset]{pst-circ}{invertpinrm}[false]{\@nameuse{Pst@invertpinrm#1}}
\define@key[psset]{pst-circ}{pinrn}[true]{\@nameuse{Pst@pinrn#1}}
\define@key[psset]{pst-circ}{invertpinrn}[false]{\@nameuse{Pst@invertpinrn#1}}
\define@key[psset]{pst-circ}{pinro}[true]{\@nameuse{Pst@pinro#1}}
\define@key[psset]{pst-circ}{invertpinro}[false]{\@nameuse{Pst@invertpinro#1}}
\define@key[psset]{pst-circ}{pinrp}[true]{\@nameuse{Pst@pinrp#1}}
\define@key[psset]{pst-circ}{invertpinrp}[false]{\@nameuse{Pst@invertpinrp#1}}

\define@key[psset]{pst-circ}{pintl}[false]{\@nameuse{Pst@pintl#1}}
\define@key[psset]{pst-circ}{invertpintl}[false]{\@nameuse{Pst@invertpintl#1}}
\define@key[psset]{pst-circ}{pintc}[false]{\@nameuse{Pst@pintc#1}}
\define@key[psset]{pst-circ}{invertpintc}[false]{\@nameuse{Pst@invertpintc#1}}
\define@key[psset]{pst-circ}{pintr}[false]{\@nameuse{Pst@pintr#1}}
\define@key[psset]{pst-circ}{invertpintr}[false]{\@nameuse{Pst@invertpintr#1}}

\define@key[psset]{pst-circ}{pinbl}[false]{\@nameuse{Pst@pinbl#1}}
\define@key[psset]{pst-circ}{invertpinbl}[false]{\@nameuse{Pst@invertpinbl#1}}
\define@key[psset]{pst-circ}{pinbc}[false]{\@nameuse{Pst@pinbc#1}}
\define@key[psset]{pst-circ}{invertpinbc}[false]{\@nameuse{Pst@invertpinbc#1}}
\define@key[psset]{pst-circ}{pinbr}[false]{\@nameuse{Pst@pinbr#1}}
\define@key[psset]{pst-circ}{invertpinbr}[false]{\@nameuse{Pst@invertpinbr#1}}

\define@key[psset]{pst-circ}{pinta}[false]{\@nameuse{Pst@pinta#1}}
\define@key[psset]{pst-circ}{invertpinta}[false]{\@nameuse{Pst@invertpinta#1}}
\define@key[psset]{pst-circ}{pintb}[false]{\@nameuse{Pst@pintb#1}}
\define@key[psset]{pst-circ}{invertpintb}[false]{\@nameuse{Pst@invertpintb#1}}
\define@key[psset]{pst-circ}{pintc}[false]{\@nameuse{Pst@pintc#1}}
\define@key[psset]{pst-circ}{invertpintc}[false]{\@nameuse{Pst@invertpintc#1}}
\define@key[psset]{pst-circ}{pintd}[false]{\@nameuse{Pst@pintd#1}}
\define@key[psset]{pst-circ}{invertpintd}[false]{\@nameuse{Pst@invertpintd#1}}
\define@key[psset]{pst-circ}{pinte}[false]{\@nameuse{Pst@pinte#1}}
\define@key[psset]{pst-circ}{invertpinte}[false]{\@nameuse{Pst@invertpinte#1}}

\define@key[psset]{pst-circ}{pinba}[false]{\@nameuse{Pst@pinba#1}}
\define@key[psset]{pst-circ}{invertpinba}[false]{\@nameuse{Pst@invertpinba#1}}
\define@key[psset]{pst-circ}{pinbb}[false]{\@nameuse{Pst@pinbb#1}}
\define@key[psset]{pst-circ}{invertpinbb}[false]{\@nameuse{Pst@invertpinbb#1}}
\define@key[psset]{pst-circ}{pinbc}[false]{\@nameuse{Pst@pinbc#1}}
\define@key[psset]{pst-circ}{invertpinbc}[false]{\@nameuse{Pst@invertpinbc#1}}
\define@key[psset]{pst-circ}{pinbd}[false]{\@nameuse{Pst@pinbd#1}}
\define@key[psset]{pst-circ}{invertpinbd}[false]{\@nameuse{Pst@invertpinbd#1}}
\define@key[psset]{pst-circ}{pinbe}[false]{\@nameuse{Pst@pinbe#1}}
\define@key[psset]{pst-circ}{invertpinbe}[false]{\@nameuse{Pst@invertpinbe#1}}

\define@key[psset]{pst-circ}{dpleft}[false]{\@nameuse{Pst@dpleft#1}}
\define@key[psset]{pst-circ}{dpright}[true]{\@nameuse{Pst@dpright#1}}

% Define Ladder Boolean Keys
\define@key[psset]{pst-circ}{latch}[false]{\@nameuse{Pst@latch#1}}
\define@key[psset]{pst-circ}{unlatch}[false]{\@nameuse{Pst@unlatch#1}}
\define@key[psset]{pst-circ}{contactclosed}[false]{\@nameuse{Pst@contactclosed#1}}

% Define Ladder Bipole Keys
\define@key[psset]{pst-circ}{polarized}[false]{\@nameuse{Pst@polarized#1}}

% Define Diodes
\define@key[psset]{pst-circ}{ison}[true]{\@nameuse{Pst@ison#1}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\psset[pst-circ]{%
  labelstyle=,mathlabel=false,labelInside=0,circedge=\pcangle,
  intensity=false,intensitylabel={},
  intensitylabeloffset=0.5,
  intensitycolor=black,intensitylabelcolor=black,intensitywidth=\pslinewidth,
  tensionstyle=line,
  tension=false,tensionlabel={},tensionoffset=1,tensionlabeloffset=1.2,
  tensioncolor=black,tensionlabelcolor=black,tensionwidth=\pslinewidth,
  labeloffset=0.7,labelangle=0,dipoleconvention=receptor,directconvention=true,dipolestyle=normal
  parallel=false,parallelarm=1.5,parallelsep=0,parallelnode=false,
  intersect=false,OAperfect=true,OAinvert=true,
  OAiplus=false,OAiminus=false,OAiout=false,OAipluslabel={},
  OAiminuslabel={},OAioutlabel={},OApower=false,
  GMperfect=false,GMinvert=true,	% pv 2014-12-14
  GMiplus=false,GMiminus=false,GMiout=false,GMipluslabel={}, %
  GMiminuslabel={},GMioutlabel={},GMpower=false,%			% END of ADD
  transistorcircle=true, transistorinvert=false, % hv 2003-07-23
  transistoribase=false,transistoricollector=false,transistoriemitter=false,%
  transistoribaselabel={},basesep=0pt,
  transistoricollectorlabel={},transistoriemitterlabel={},
  transistortype=NPN,TRot=0,%
  FETmemory=false,						% atosch
  DMOSFET=false, % MOSFET type: D or E
  primarylabel={},secondarylabel={},transformeriprimary=false,transformerisecondary=false,
  transformeriprimarylabel={},transformerisecondarylabel={},
  tripolestyle=normal,variable=false,
  logicShowDot=false, logicShowNode=false, logicChangeLR=false, % hv
  logicWireLength=0.5, logicWidth=1.5, logicHeight=2.5,       	% hv
  logicNInput=2, logicJInput=2, logicKInput=2, logicType=and, 	% hv
  logicLabelstyle=\small, logicSymbolstyle=\large,
  logicSymbolpos=0.5,logicNodestyle=\footnotesize,
  segmentcolor=black,ninputs=2,segmentdisplay=10,nicpins=8,bubblesize=0.15,
  plcaddress={},plcsymbol={},inputalabel={},inputblabel={},inputclabel={},
  inputenlabel={$EN$},inputcllabel={$CL$},outputalabel={$Q$},outputblabel={$\bar{Q}$},
  pinalabel={},pinanumber={},pinblabel={},pinbnumber={},pinclabel={},pincnumber={},
  pindlabel={},pindnumber={},pinelabel={},pinenumber={},pinflabel={},pinfnumber={},
  pinglabel={},pingnumber={},pinhlabel={},pinhnumber={},pinilabel={},pininumber={},
  pinjlabel={},pinjnumber={},pinklabel={},pinknumber={},pinllabel={},pinlnumber={},
  pinmlabel={},pinmnumber={},pinnlabel={},pinnnumber={},pinolabel={},pinonumber={},
  pinplabel={},pinpnumber={},pinqlabel={},pinqnumber={},pinrlabel={},pinrnumber={},
  pinslabel={},pinsnumber={},pintlabel={},pintnumber={},pinulabel={},pinunumber={},
  pinvlabel={},pinvnumber={},pinwlabel={},pinwnumber={},pinxlabel={},pinxnumber={},
  pinylabel={},pinynumber={},pinzlabel={},pinznumber={},pinaalabel={},pinaanumber={},
  pinablabel={},pinabnumber={},pinaclabel={},pinacnumber={},pinadlabel={},pinadnumber={},
  pinaelabel={},pinaenumber={},pinaflabel={},pinafnumber={},pinlalabel={},pinlanumber={},
  pinlblabel={},pinlbnumber={},pinlclabel={},pinlcnumber={},pinldlabel={},pinldnumber={},
  pinlelabel={},pinlenumber={},pinlflabel={},pinlfnumber={},pinlglabel={},pinlgnumber={},
  pinlhlabel={},pinlhnumber={},pinlilabel={},pinlinumber={},pinljlabel={},pinljnumber={},
  pinlklabel={},pinlknumber={},pinlllabel={},pinllnumber={},pinlmlabel={},pinlmnumber={},
  pinlnlabel={},pinlnnumber={},pinlolabel={},pinlonumber={},pinlplabel={},pinlpnumber={},
  pinralabel={},pinranumber={},pinrblabel={},pinrbnumber={},pinrclabel={},pinrcnumber={},
  pinrdlabel={},pinrdnumber={},pinrelabel={},pinrenumber={},pinrflabel={},pinrfnumber={},
  pinrglabel={},pinrgnumber={},pinrhlabel={},pinrhnumber={},pinrilabel={},pinrinumber={},
  pinrjlabel={},pinrjnumber={},pinrklabel={},pinrknumber={},pinrllabel={},pinrlnumber={},
  pinrmlabel={},pinrmnumber={},pinrnlabel={},pinrnnumber={},pinrolabel={},pinronumber={},
  pinrplabel={},pinrpnumber={},pintllabel={},pintlnumber={},pintclabel={},pintcnumber={},
  pintrlabel={},pintrnumber={},pinbllabel={},pinblnumber={},pinbclabel={},pinbcnumber={},
  pinbrlabel={},pinbrnumber={},pintalabel={},pintanumber={},pintblabel={},pintbnumber={},
  pintclabel={},pintcnumber={},pintdlabel={},pintdnumber={},pintelabel={},pintenumber={},
  pinbalabel={},pinbanumber={},pinbblabel={},pinbbnumber={},pinbclabel={},pinbcnumber={},
  pinbdlabel={},pinbdnumber={},pinbelabel={},pinbenumber={},
  iec=false,iecinvert=false,input=true,invertinput=false,inputa=true,invertinputa=false,
  inputb=true,invertinputb=false,inputc=true,invertinputc=false,inputd=true,invertinputd=false,
  enable=false,invertenable=false,clock=false,invertclock=false,set=false,invertset=false,
  reset=false,invertreset=false,invertoutput=false,outputa=true,invertoutputa=false,outputb=true,
  invertoutputb=true,segmentlabels=true,pina=true,invertpina=false,pinb=true,invertpinb=false,
  pinc=true,invertpinc=false,pind=true,invertpind=false,pine=true,invertpine=false,
  pinf=true,invertpinf=false,ping=true,invertping=false,pinh=true,invertpinh=false,
  pini=true,invertpini=false,pinj=true,invertpinj=false,pink=true,invertpink=false,
  pinl=true,invertpinl=false,pinm=true,invertpinm=false,pinn=true,invertpinn=false,
  pino=true,invertpino=false,pinp=true,invertpinp=false,pinq=true,invertpinq=false,
  pinr=true,invertpinr=false,pins=true,invertpins=false,pint=true,invertpint=false,
  pinu=true,invertpinu=false,pinv=true,invertpinv=false,pinw=true,invertpinw=false,
  pinx=true,invertpinx=false,piny=true,invertpiny=false,pinz=true,invertpinz=false,
  pinaa=true,invertpinaa=false,pinab=true,invertpinab=false,pinac=true,invertpinac=false,
  pinad=true,invertpinad=false,pinae=true,invertpinae=false,pinaf=true,invertpinaf=false,
  pinla=true,invertpinla=false,pinlb=true,invertpinlb=false,pinlc=true,invertpinlc=false,
  pinld=true,invertpinld=false,pinle=true,invertpinle=false,pinlf=true,invertpinlf=false,
  pinlg=true,invertpinlg=false,pinlh=true,invertpinlh=false,pinli=true,invertpinli=false,
  pinlj=true,invertpinlj=false,pinlk=true,invertpinlk=false,pinll=true,invertpinll=false,
  pinlm=true,invertpinlm=false,pinln=true,invertpinln=false,pinlo=true,invertpinlo=false,
  pinlp=true,invertpinlp=false,pinra=true,invertpinra=false,pinrb=true,invertpinrb=false,
  pinrc=true,invertpinrc=false,pinrd=true,invertpinrd=false,pinre=true,invertpinre=false,
  pinrf=true,invertpinrf=false,pinrg=true,invertpinrg=false,pinrh=true,invertpinrh=false,
  pinri=true,invertpinri=false,pinrj=true,invertpinrj=false,pinrk=true,invertpinrk=false,
  pinrl=true,invertpinrl=false,pinrm=true,invertpinrm=false,pinrn=true,invertpinrn=false,
  pinro=true,invertpinro=false,pinrp=true,invertpinrp=false,pintl=false,invertpintl=false,
  pintc=false,invertpintc=false,pintr=false,invertpintr=false,pinbl=false,invertpinbl=false,
  pinbc=false,invertpinbc=false,pinbr=false,invertpinbr=false,pinta=false,invertpinta=false,
  pintb=false,invertpintb=false,pintc=false,invertpintc=false,pintd=false,invertpintd=false,
  pinte=false,invertpinte=false,pinba=false,invertpinba=false,pinbb=false,invertpinbb=false,
  pinbc=false,invertpinbc=false,pinbd=false,invertpinbd=false,pinbe=false,invertpinbe=false,
  dpleft=false,dpright=true,latch=false,unlatch=false,contactclosed=false,polarized=false,
  ison=true, IGBTinvert=false	% pv 2014-12-14
}% hv
%\psset[pstricks]{radius=0.5}

%
\newpsstyle{baseOpt}{circedge=\pcline,arrows=-,arm=.5,angleA=0,angleB=180}
\newpsstyle{emitterOpt}{arrows=-,arm=.5,angleA=180,angleB=-90}%
\newpsstyle{collectorOpt}{arrows=-,arm=.5,angleA=180,angleB=90}
%
\def\wire{\@ifnextchar[{\pst@draw@wire}{\pst@draw@wire[]}}
\def\tension{\@ifnextchar[{\pst@draw@tension@}{\pst@draw@tension@[]}}
%
% cb 2010-08-12, new macro for defining generic dipole macros
\def\newCircDipole{\@ifnextchar[{\newCircDipole@i}{\newCircDipole@i[]}}
% the optional argument can be used to preset options (like 'radius=2pt' in OpenDipol
\def\newCircDipole@i[#1]#2{%
   \@ifundefined{pst@#2}{%
      \@namedef{#2}{\@ifnextchar[{\@nameuse{pst@#2}}{\@nameuse{pst@#2}[]}}%
      \expandafter\def\csname pst@#2\endcsname[##1](##2)(##3)##4{{%
         \pst@draw@dipole{#1,##1}{##2}{##3}{##4}{\@nameuse{pst@draw@#2}}}\ignorespaces}%
      %
      \@namedef{pst@multidipole@#2}{\@ifnextchar[{\@nameuse{pst@multidipole@#2@}}{\@nameuse{pst@multidipole@#2@}[]}}
      \expandafter\def\csname pst@multidipole@#2@\endcsname[##1]##2{%
  \expandafter\def\csname pst@tmp@\number\pst@count@iii\endcsname{##2}%
  {\psset{##1}%
  \ifPst@parallel\aftergroup\advance\aftergroup\pst@count@i\aftergroup\m@ne\fi}%
  \pst@count@ii=\pst@count@i
  \advance\pst@count@ii\@ne
  \toks0\expandafter{\pst@multidipole@output}%
  \edef\pst@multidipole@output{%
    \the\toks0
    \pst@multidipole@def@coor
    \noexpand\@nameuse{#2}[##1]%
  (! X@\the\pst@count@i\space Y@\the\pst@count@i)%
  (! X@\the\pst@count@ii\space Y@\the\pst@count@ii)%
      {\noexpand\csname pst@tmp@\number\pst@count@iii\endcsname}
  }%
  \pst@multidipole@%
}}\ignorespaces}%
%
\newCircDipole{RFLine}
\newCircDipole{resistor}
\newCircDipole{capacitor}
\newCircDipole{battery}
\newCircDipole{coil}
\newCircDipole{Ucc}
\newCircDipole{Icc}
\newCircDipole{switch}
\newCircDipole{diode}
\newCircDipole{Zener}
\newCircDipole{lamp}
\newCircDipole[radius=0.5]{circledipole}
\newCircDipole{LED}
\newCircDipole[radius=2pt]{OpenDipol}
\newCircDipole[radius=2pt]{OpenTripol}
\newCircDipole{Suppressor}
\newCircDipole{Arrestor}
\newCircDipole{RelayNOP}
\newCircDipole{dashpot}
%
%
\def\OA{\pst@object{OA}}
\def\OA@i(#1)(#2)(#3){%
  \addbefore@par{dimen=middle}%
  \begin@ClosedObj%
  \if\psk@label@OAiplus\@empty\else\psset{OAiplus=true}\fi%
  \if\psk@label@OAiminus\@empty\else\psset{OAiminus=true}\fi%
  \if\psk@label@OAiout\@empty\else\psset{OAiout=true}\fi%
  \ifPst@intensity\psset{OAiplus=true,OAiminus=true,OAiout=true}\fi%
  \pst@getcoor{#1}\pst@tempa
  \pst@getcoor{#2}\pst@tempb
  \pst@getcoor{#3}\pst@tempc
  \pnode(! 10 dict begin
    \pst@tempa /Y1 exch \pst@number\psyunit div def
    /X1 exch \pst@number\psxunit div def
    \pst@tempb /Y2 exch \pst@number\psyunit div def
    /X2 exch \pst@number\psxunit div def
    \pst@tempc /Y3 exch \pst@number\psyunit div def
    /X3 exch \pst@number\psxunit div def
    /XC X1 X2 lt {X3 X2} {X3 X1} ifelse add 2 div def
    /YC Y1 Y2 add 2 div def
    XC YC end ){C@}
  \rput(C@){\pst@draw@OA}
  \psset{fillstyle=none}%  reset, otherwise the connectionlines are also used for a fillstyle
  \ncangle[arrows=-,arm=.5,angleA=0,angleB=180]{#1}{\ifPst@OAinvert Minus@\else Plus@\fi}
  \ncput[npos=2]{\pnode{\ifPst@OAinvert Minus@@\else Plus@@\fi}}
  \ifPst@OAiplus
    \ifPst@OAinvert\else
      \ncput[npos=2.5]{%
        \psline[linecolor=\psk@I@color,
          linewidth=\psk@I@width,arrowinset=0]{->}(-.1,0)(.1,0)}
      \naput[npos=2.5]{\color{\psk@I@labelcolor}\psk@label@OAiplus}
    \fi
  \fi
  \ifPst@OAiminus
    \ifPst@OAinvert
      \ncput[npos=2.5]{%
        \psline[linecolor=\psk@I@color,
          linewidth=\psk@I@width,arrowinset=0]{->}(-.1,0)(.1,0)}
      \naput[npos=2.5]{\color{\psk@I@labelcolor}\psk@label@OAiminus}
    \fi
  \fi
  \ncangle[arrows=-,arm=.5,angleA=0,angleB=180]{#2}{\ifPst@OAinvert Plus@\else Minus@\fi}
  \ncput[npos=2]{\pnode{\ifPst@OAinvert Plus@@\else Minus@@\fi}}
  \ifPst@OAiplus
    \ifPst@OAinvert
      \ncput[npos=2.5]{%
        \psline[linecolor=\psk@I@color,
          linewidth=\psk@I@width,arrowinset=0]{->}(-.1,0)(.1,0)}
      \nbput[npos=2.5]{\color{\psk@I@labelcolor}\psk@label@OAiplus}
    \fi
  \fi
  \ifPst@OAiminus
    \ifPst@OAinvert\else
      \ncput[npos=2.5]{%
        \psline[linecolor=\psk@I@color,
          linewidth=\psk@I@width,arrowinset=0]{->}(-.1,0)(.1,0)}
      \nbput[npos=2.5]{\color{\psk@I@labelcolor}\psk@label@OAiminus}
    \fi
  \fi
  \ncangle[arrows=-,arm=.5,angleA=180,angleB=0]{#3}{S@}
  \ncput[npos=2]{\pnode{S@@}}
  \ifPst@OAiout
    \ncput[npos=2.5]{%
      \psline[linecolor=\psk@I@color,
        linewidth=\psk@I@width,arrowinset=0]{->}(-.1,0)(.1,0)}
    \naput[npos=2.5]{\color{\psk@I@labelcolor}\psk@label@OAiout}
  \fi
  \psline[linestyle=none](#1)(#2)% for the end arrows
  \psline[linestyle=none](#1)(#3)% for the end arrows
  \end@ClosedObj
  \ignorespaces%
}
%

%
\def\GM{\pst@object{GM}}
\def\GM@i(#1)(#2)(#3){%
  \addbefore@par{dimen=middle}%
  \begin@ClosedObj%
  \if\psk@label@GMiplus\@empty\else\psset{GMiplus=true}\fi%
  \if\psk@label@GMiminus\@empty\else\psset{GMiminus=true}\fi%
  \if\psk@label@GMiout\@empty\else\psset{GMiout=true}\fi%
  \ifPst@intensity\psset{GMiplus=true,GMiminus=true,GMiout=true}\fi%
  \pst@getcoor{#1}\pst@tempa
  \pst@getcoor{#2}\pst@tempb
  \pst@getcoor{#3}\pst@tempc
  \pnode(! 10 dict begin
    \pst@tempa /Y1 exch \pst@number\psyunit div def
    /X1 exch \pst@number\psxunit div def
    \pst@tempb /Y2 exch \pst@number\psyunit div def
    /X2 exch \pst@number\psxunit div def
    \pst@tempc /Y3 exch \pst@number\psyunit div def
    /X3 exch \pst@number\psxunit div def
    /XC X1 X2 lt {X3 X2} {X3 X1} ifelse add 2 div def
    /YC Y1 Y2 add 2 div def
    XC YC end){C@}
  \rput(C@){\pst@draw@GM}
  \ncangle[arrows=-,arm=.5,angleA=0,angleB=180]{#1}{\ifPst@GMinvert Minus@\else Plus@\fi}
  \ncput[npos=2]{\pnode{\ifPst@GMinvert Minus@@\else Plus@@\fi}}
  \ifPst@GMiplus
    \ifPst@GMinvert\else
      \ncput[npos=2.5]{%
        \psline[linecolor=\psk@I@color,
          linewidth=\psk@I@width,arrowinset=0]{->}(-.1,0)(.1,0)}
      \naput[npos=2.5]{\color{\psk@I@labelcolor}\psk@label@GMiplus}
    \fi
  \fi
  \ifPst@GMiminus
    \ifPst@GMinvert
      \ncput[npos=2.5]{%
        \psline[linecolor=\psk@I@color,
          linewidth=\psk@I@width,arrowinset=0]{->}(-.1,0)(.1,0)}
      \naput[npos=2.5]{\color{\psk@I@labelcolor}\psk@label@GMiminus}
    \fi
  \fi
  \ncangle[arrows=-,arm=.5,angleA=0,angleB=180]{#2}{\ifPst@GMinvert Plus@\else Minus@\fi}
  \ncput[npos=2]{\pnode{\ifPst@GMinvert Plus@@\else Minus@@\fi}}
  \ifPst@GMiplus
    \ifPst@GMinvert
      \ncput[npos=2.5]{%
        \psline[linecolor=\psk@I@color,
          linewidth=\psk@I@width,arrowinset=0]{->}(-.1,0)(.1,0)}
      \nbput[npos=2.5]{\color{\psk@I@labelcolor}\psk@label@GMiplus}
    \fi
  \fi
  \ifPst@GMiminus
    \ifPst@GMinvert\else
      \ncput[npos=2.5]{%
        \psline[linecolor=\psk@I@color,
          linewidth=\psk@I@width,arrowinset=0]{->}(-.1,0)(.1,0)}
      \nbput[npos=2.5]{\color{\psk@I@labelcolor}\psk@label@GMiminus}
    \fi
  \fi
  \ncangle[arrows=-,arm=.5,angleA=180,angleB=0]{#3}{S@}
  \ncput[npos=2]{\pnode{S@@}}
  \ifPst@GMiout
    \ncput[npos=2.5]{%
      \psline[linecolor=\psk@I@color,
        linewidth=\psk@I@width,arrowinset=0]{->}(-.1,0)(.1,0)}
    \naput[npos=2.5]{\color{\psk@I@labelcolor}\psk@label@GMiout}
  \fi
  \psline[linestyle=none](#1)(#2)% for the end arrows
  \psline[linestyle=none](#1)(#3)% for the end arrows
  \end@ClosedObj
  \ignorespaces%
}
% % pv 2014-12-14


%
\def\pst@draw@battery{%
  \psline[arrows=-,linewidth=1.5\pslinewidth](-0.10,-0.5)(-0.10,0.5)
  \psline[arrows=-,linewidth=3\pslinewidth](0.10,-0.25)(0.10,0.25)
  \pnode(-0.1,0){dipole@1}
  \pnode(0.1,0){dipole@2}
  \ifPst@variable%
    \psline{->}(-0.75,-0.5)(0.75,0.5)%
  \fi
  }
%
%
\newif\ifPst@temp
\def\transistor{\def\pst@par{}\pst@object{transistor}}
\def\transistor@i(#1){%
  \addbefore@par{dimen=inner}
  \pst@killglue
  \begingroup
  \use@par
  \@ifnextchar(% do we have more coordinates?
    {\transistor@iii(#1)}{\Pst@tempfalse\transistor@ii(#1)}%
}
%
\def\transistor@ii(#1)#2#3{% with one node, the base
  \pst@killglue%
  \ifPst@temp\pnode(#1){TBaseNode}% Base
  \else
    \pst@getcoor{#1}\pst@tempA%
    \pnode(!
      \pst@tempA /YB_t exch \pst@number\psyunit div def
      /XB_t exch \pst@number\psxunit div def
      /basesep \Pst@basesep\space \pst@number\psxunit div def
      XB_t basesep \Pst@TRot\space cos mul add
      YB_t basesep \Pst@TRot\space sin mul add){TBaseNode}% base node
  \fi % Base
  \rput[c]{\Pst@TRot}(!
    \pst@tempA /YB_t exch \pst@number\psyunit div def
    /XB_t exch \pst@number\psxunit div def
    /basesep \Pst@basesep\space \pst@number\psxunit div def
    XB_t basesep \Pst@TRot\space cos mul add
    YB_t basesep \Pst@TRot\space sin mul add){%
		\ifdim180pt=\Pst@TRot pt\relax % rotate 180?
			\ifPst@transistorcircle\pscircle(0.3,0){0.7}\fi % circle drawing
			\ifx\psk@Ttype\pst@Ttype@NPN\relax % NPN
				\ifPst@transistorinvert
					\pnode(0.5,-0.5){#2}% Emitter
					\pnode(0.5,0.5){#3}% Collector
				\else
					\pnode(0.5,-0.5){#3}% Collector
					\pnode(0.5,0.5){#2}% Emitter
				\fi % no NPN
				\psline[linewidth=4\pslinewidth,arrows=-](TBaseNode|0,0.4)(TBaseNode|0,-0.4)%
				\psline[arrowinset=0,arrowsize=8\pslinewidth,arrows=->](#2)(TBaseNode)(#3)%
			\else % not NPN
				\ifx\psk@Ttype\pst@Ttype@PNP\relax % PNP
					\ifPst@transistorinvert
						\pnode(0.5,-0.5){#2}\pnode(0.5,0.5){#3}% E C
					\else
		            	\pnode(0.5,-0.5){#3}\pnode(0.5,0.5){#2}% C E
		          	\fi
					\psline[linewidth=4\pslinewidth,arrows=-](TBaseNode|0,0.4)(TBaseNode|0,-0.4)%
					\psline[arrowinset=0,arrowsize=8\pslinewidth,arrows=->,dimen=middle](0.5,-0.5)(TBaseNode)%
					\psline(0.5,0.5)(TBaseNode)
				\else % not PNP
					\ifx\psk@Ttype\pst@Ttype@FET\relax%  FET
						\ifPst@transistorinvert\pnode(0.75,-0.5){#2}\else\pnode(0.75,-0.5){#3}\fi%
						\ifPst@transistorinvert\pnode(0.75,0.5){#3}\else\pnode(0.75,0.5){#2}\fi%
				    	% Main drawings
			    		\psline[arrows=-](0.75,0.5)(0.2,0.5)
                		\ifPst@DMOSFET% MOSFET type: D or E
                   			\psline[linewidth=\psk@I@width,arrows=-](0.2,0.6)(0.2,-0.6)
	                	\else
    	               		\psline[linestyle=dashed,dash=8pt 3pt,arrows=-](0.2,0.6)(0.2,-0.6)
        	        	\fi % MOSFET type: D or E
            	    	\psline[arrows=-](0.2,-0.5)(0.75,-0.5)%
                		\ifPst@FETmemory% atosch
                   			\psline[arrows=-,linewidth=\psk@I@width](-0.15,0.5)(-0.15,-0.5)%
	               		\fi%
    	           		\psline[arrows=-,linewidth=\psk@I@width](TBaseNode|0,0.5)(TBaseNode|0,-0.5)%
        	        	\ifx\psk@FETchanneltype\pst@FETchanneltype@P\relax% Ted 2007-10-15
            	   			\psline[arrowinset=0,arrowsize=8\pslinewidth]{->}(0.2,0)(0.75,0)%
							\ifPst@transistorinvert
       							\qdisk(#3){1.5pt}\psline[origin={#3}]{-}(0,-0.5)%
							\else
								\qdisk(#3){1.5pt}\psline[origin={#3}]{-}(0,0.5)%
							\fi
        	   			\else%
           					\psline[arrowinset=0,arrowsize=8\pslinewidth]{<-}(0.2,0)(0.75,0)%
							\ifPst@transistorinvert
       							\qdisk(#2){1.5pt}\psline[origin={#2}]{-}(0,0.5)%
							\else
								\qdisk(#2){1.5pt}\psline[origin={#2}]{-}(0,-0.5)%
							\fi
    	       			\fi%
					\else % JFET, NMOS or PMOS
						\ifx\psk@Ttype\pst@Ttype@JFET\relax%  JFET
							% JFET Main drawings
							\psline[arrows=-](0.65,0.4)(0.15,0.4) % upper line
							\psline[arrows=-](0.65,-0.4)(0.15,-0.4)% lower line
							\psline[arrows=-,linewidth=3\psk@I@width](0.15,0.6)(0.15,-0.6)% gate
							\ifPst@transistorinvert\pnode(0.65,-0.4){#2}\else\pnode(0.65,-0.4){#3}\fi%
							\ifPst@transistorinvert\pnode(0.65,0.4){#3}\else\pnode(0.65,0.4){#2}\fi%
							\ifx\psk@FETchanneltype\pst@FETchanneltype@P
								\psline[arrowinset=0,arrowsize=8\pslinewidth]{->}(0.15,0.0)(-0.35,0.0)%
							\else
								\psline[arrowinset=0,arrowsize=8\pslinewidth]{->}(-0.35,0.0)(0.15,0.0)%
							\fi
						\else % IGBT, NMOS or PMOS
							\ifx\psk@Ttype\pst@Ttype@IGBT\relax%  IGBT
								% IGBT Main drawings
								\ifPst@transistorinvert
									\pnode(0.65,-0.5){#2}\pnode(0.65,0.5){#3}
									\pnode(0.15,0.12){#3c}\pnode(0.15,-0.12){#2c}
								\else
									\pnode(0.65,-0.5){#3}\pnode(0.65,0.5){#2}
									\pnode(0.15,-0.12){#3c}\pnode(0.15,0.12){#2c}
								\fi%
								\psline[linewidth=\psk@I@width,arrows=-](0.15,0.6)(0.15,-0.6)
								\psline[arrows=-,linewidth=\psk@I@width](TBaseNode|0,0.5)(TBaseNode|0,-0.5)%
								\psline[arrows=-](#3)(#3c)%
								\psline[arrowinset=0,arrowsize=8\pslinewidth]{->}(#2c)(#2)%
							\else % NMOS or PMOS
								\ifPst@transistorinvert\pnode(0.75,-0.4){#2}\else\pnode(0.75,-0.4){#3}\fi%
    			   				\ifPst@transistorinvert\pnode(0.75,0.4){#3}\else\pnode(0.75,0.4){#2}\fi%
								% Main drawings
   								\psline[arrows=-](0.75,0.4)(0.15,0.4)
        	        			\psline[linewidth=3\psk@I@width,arrows=-](0.15,0.6)(0.15,-0.6)
            	    			\psline[arrows=-](0.75,-0.4)(0.15,-0.4)%
								\ifx\psk@Ttype\pst@Ttype@NMOS\relax% NMOS?
						 			\ifPst@transistorinvert
       									\psline[arrowinset=0,arrowsize=8\pslinewidth]{->}(0.15,0.4)(0.75,0.4)%
									\else
										\psline[arrowinset=0,arrowsize=8\pslinewidth]{->}(0.15,-0.4)(0.75,-0.4)%
									\fi
									\psline[arrows=-,linewidth=1.5\psk@I@width](TBaseNode|0,0.4)(TBaseNode|0,-0.4)%
								\else % PMOS
									\ifPst@transistorinvert
	       								\psline[arrowinset=0,arrowsize=8\pslinewidth]{<-}(0.15,0.4)(0.75,0.4)%
									\else
										\psline[arrowinset=0,arrowsize=8\pslinewidth]{<-}(0.15,-0.4)(0.75,-0.4)%
									\fi
									\psline[arrows=-,linewidth=1.5\psk@I@width](TBaseNode|0,0.4)(TBaseNode|0,-0.4)%
								\fi
							\fi % NMOS or PMOS
						\fi % IGBT, NMOS or PMOS
					\fi % JFET, NMOS or PMOS
       			\fi % PNP
	   		\fi% NPN
	    \else % not 180
    		\ifPst@transistorcircle\pscircle(0.3,0){0.7}\fi
			\ifx\psk@Ttype\pst@Ttype@FET\relax% FET
				\ifPst@transistorinvert\pnode(0.65,0.5){#2}\else\pnode(0.65,0.5){#3}\fi%
    	    	\ifPst@transistorinvert\pnode(0.65,-0.5){#3}\else\pnode(0.65,-0.5){#2}\fi%
				% FET Main drawings
			    \psline[arrows=-](0.65,0.5)(0.15,0.5) % upper line
        	    \ifPst@DMOSFET% MOSFET type: D or E
					\psline[linewidth=\psk@I@width,arrows=-](0.15,0.6)(0.15,-0.6)
				\else
					\psline[linestyle=dashed,dash=8pt 3pt,arrows=-](0.15,0.6)(0.15,-0.6)
				\fi %
            	\psline[arrows=-](0.15,-0.5)(0.65,-0.5)% lower line
	            \ifPst@FETmemory% atosch
    	        	\psline[arrows=-,linewidth=\psk@I@width](-0.15,0.5)(-0.15,-0.5)%
        	  	\fi%
	          	\psline[arrows=-,linewidth=\psk@I@width](TBaseNode|0,0.5)(TBaseNode|0,-0.5)%
    	        \ifx\psk@FETchanneltype\pst@FETchanneltype@P\relax% Ted 2007-10-15
        			\psline[arrowinset=0,arrowsize=8\pslinewidth]{->}(0.15,0)(0.65,0)%
					\qdisk(#3){1.5pt}\psline{-}(#3)(0.65,0.0)%
	      		\else%
    	  			\psline[arrowinset=0,arrowsize=8\pslinewidth]{<-}(0.15,0)(0.65,0)%
					\qdisk(#2){1.5pt}\psline{-}(#2)(0.65,0.0)%
     			\fi%
			\else % not FET
				\ifx\psk@Ttype\pst@Ttype@NMOS\relax% NMOS
					% NMOS Main drawings
					\psline[arrows=-](0.65,0.4)(0.15,0.4) % upper line
            	    \psline[linewidth=3\psk@I@width,arrows=-](0.15,0.6)(0.15,-0.6) % gate
                	\psline[arrows=-](0.65,-0.4)(0.15,-0.4)% lower line
	                \psline[arrows=-,linewidth=1.5\psk@I@width](TBaseNode|0,0.4)(TBaseNode|0,-0.4)%
    	    		\ifPst@transistorinvert\pnode(0.65,0.4){#2}\else\pnode(0.65,0.4){#3}\fi%
        			\ifPst@transistorinvert\pnode(0.65,-0.4){#3}\else\pnode(0.65,-0.4){#2}\fi%
					\ifPst@transistorinvert
        				\psline[arrowinset=0,arrowsize=8\pslinewidth]{->}(0.15,0.4)(0.65,0.4)%
					\else
						\psline[arrowinset=0,arrowsize=8\pslinewidth]{->}(0.15,-0.4)(0.65,-0.4)%
					\fi
				\else % not NMOS
					\ifx\psk@Ttype\pst@Ttype@PMOS\relax% PMOS
						% PMOS Main drawings
    					\psline[arrows=-](0.65,0.4)(0.15,0.4) % upper line
            	        \psline[linewidth=3\psk@I@width,arrows=-](0.15,0.6)(0.15,-0.6) % gate
                	    \psline[arrows=-](0.65,-0.4)(0.15,-0.4)% lower line
                		\psline[arrows=-,linewidth=1.5\psk@I@width](TBaseNode|0,0.4)(TBaseNode|0,-0.4)%
	            		\ifPst@transistorinvert
							\pnode(0.65,0.4){#2}\pnode(0.65,-0.4){#3}
       	                \else
							\pnode(0.65,0.4){#3}\pnode(0.65,-0.4){#2}
               	        \fi%
		    			\ifPst@transistorinvert
							\psline[arrowinset=0,arrowsize=8\pslinewidth]{<-}(0.15,0.4)(0.65,0.4)%
						\else
    			  			\psline[arrowinset=0,arrowsize=8\pslinewidth]{<-}(0.15,-0.4)(0.65,-0.4)%
    					\fi
		   			\else % not NMOS -> JFET, IGBT, PNP or NPN
						\ifx\psk@Ttype\pst@Ttype@JFET\relax%  JFET
							% JFET Main drawings
							\psline[arrows=-](0.65,0.4)(0.15,0.4) % upper line
							%\psline[linewidth=3\psk@I@width,arrows=-](0.15,0.6)(0.15,-0.6) % gate large
							\psline[arrows=-](0.65,-0.4)(0.15,-0.4)% lower line
							%\psline[arrows=-,linewidth=1.5\psk@I@width](TBaseNode|0,0.4)(TBaseNode|0,-0.4)%
							\psline[arrows=-,linewidth=3\psk@I@width](0.15,0.6)(0.15,-0.6)% gate
							\ifPst@transistorinvert\pnode(0.65,0.4){#2}\else\pnode(0.65,0.4){#3}\fi%
							\ifPst@transistorinvert\pnode(0.65,-0.4){#3}\else\pnode(0.65,-0.4){#2}\fi%
							\ifx\psk@FETchanneltype\pst@FETchanneltype@P
								\psline[arrowinset=0,arrowsize=8\pslinewidth]{->}(0.15,0.0)(-0.35,0.0)%
							\else
								\psline[arrowinset=0,arrowsize=8\pslinewidth]{->}(-0.35,0.0)(0.15,0.0)%
							\fi
						\else % IGBT, NPN or PNP
							\ifx\psk@Ttype\pst@Ttype@IGBT\relax%  IGBT
								% IGBT Main drawings
								\ifPst@transistorinvert
									\pnode(0.65,0.5){#2}\pnode(0.65,-0.5){#3}
									\pnode(0.15,-0.12){#3c}\pnode(0.15,0.12){#2c}
								\else
									\pnode(0.65,0.5){#3}\pnode(0.65,-0.5){#2}
									\pnode(0.15,0.12){#3c}\pnode(0.15,-0.12){#2c}
								\fi%
								\psline[linewidth=\psk@I@width,arrows=-](0.15,0.6)(0.15,-0.6)
								\psline[arrows=-,linewidth=\psk@I@width](TBaseNode|0,0.5)(TBaseNode|0,-0.5)%
								\psline[arrows=-](#3)(#3c)%
								\psline[arrowinset=0,arrowsize=8\pslinewidth]{->}(#2c)(#2)%
							\else % NPN or PNP
						   		\ifPst@transistorinvert
									\pnode(0.5,0.5){#2}\pnode(0.5,-0.5){#3}% E C
								\else                  
									\pnode(0.5,0.5){#3}\pnode(0.5,-0.5){#2}% C E
								\fi
								\ifx\psk@Ttype\pst@Ttype@NPN\relax% % NPN
									\psline[arrowinset=0,arrowsize=8\pslinewidth]{->}(TBaseNode)(#2)%
									\psline[arrows=-,linewidth=4\pslinewidth](TBaseNode|0,0.4)(TBaseNode|0,-0.4)%
									\psline[arrows=-](0.5,0.5)(TBaseNode)(0.5,-0.5)%
								\else%	% PNP
									\psline[arrowinset=0,arrowsize=8\pslinewidth]{->}(#3)(TBaseNode)%
									\psline[arrows=-,linewidth=4\pslinewidth](TBaseNode|0,0.4)(TBaseNode|0,-0.4)%
									\psline[arrows=-](0.5,0.5)(TBaseNode)(0.5,-0.5)%
								\fi % NPN or PNP
		      		    	\fi % IGBT
	      		    	\fi % JFET
       		    	\fi %JFET, PNP or NPN
      			\fi % NMOS
			\fi %FET
   		\fi % 180
  }%
  \ifPst@temp\else\endgroup\fi%
  \ignorespaces%
}
%
\def\transistor@iii(#1)(#2)(#3){% with three nodes
  \pst@getcoor{#1}\pst@tempA%
  \pst@getcoor{#2}\pst@tempB%
  \pst@getcoor{#3}\pst@tempC%
  \pnode(!%
    \pst@tempA /Y1 exch \pst@number\psyunit div def
    /X1 exch \pst@number\psxunit div def
    \pst@tempB /Y2 exch \pst@number\psyunit div def
    /X2 exch \pst@number\psxunit div def
    \pst@tempC /Y3 exch \pst@number\psyunit div def
    /X3 exch \pst@number\psxunit div def
    /LR X1 X2 lt { false }{ true } ifelse def % change left-right
    /basesep \Pst@basesep\space \pst@number\psxunit div def
    /XB_tase X1 basesep \Pst@TRot\space cos mul add def
    /YB_tase Y1 basesep \Pst@TRot\space sin mul add def
    XB_tase YB_tase ){@@base}% base node
%
  \global\Pst@temptrue%
  \transistor@ii(@@base){@@emitter}{@@collector}%
%
  \if\psk@labeltransistoribase\@empty\else\psset{transistoribase=true}\fi
  \if\psk@labeltransistoriemitter\@empty\else\psset{transistoriemitter=true}\fi
  \if\psk@labeltransistoricollector\@empty\else\psset{transistoricollector=true}\fi
  \ifPst@intensity\psset{transistoribase=true,transistoriemitter=true,transistoricollector=true}\fi
%
  \bgroup\psset{style=baseOpt}\pscirc@edge(#1)(TBaseNode)\egroup
  \ifPst@transistoribase% base current?
    \ncput[npos=0.5,nrot=\Pst@TRot]{%
      \psline[linecolor=\psk@I@color,linewidth=\psk@I@width,%
        arrowsize=6\pslinewidth,arrowinset=0]{->}(-.1,0)(.1,0)}%
    \naput[npos=0.5]{\color{\psk@I@labelcolor}\psk@labeltransistoribase}%
  \fi
  \bgroup
    \psset{style=collectorOpt}%
    \ifPst@transistorinvert
      \pscirc@edge(#3)(@@emitter)
    \else
      \pscirc@edge(#3)(@@collector)
    \fi
  \egroup
  \ncput[npos=2]{\pnode{\ifPst@transistorinvert @@emitter\else @@collector\fi}}%
  \ifPst@transistoriemitter% emitter current?
    \ifPst@transistorinvert% emitter/collector changed?
      \ncput[npos=\pscirc@edge@sector,nrot=:U]{%
        \psline[linecolor=\psk@I@color,linewidth=\psk@I@width,%
    arrowsize=6\pslinewidth,arrowinset=0]{->}(-0.1,0)(0.1,0)}%
      \nbput[npos=\pscirc@edge@sector]{\color{\psk@I@labelcolor}\psk@labeltransistoriemitter}%
    \fi\fi
  \ifPst@transistoricollector% collector current?
    \ifPst@transistorinvert\else% emitter/collector changed?
      \ncput[npos=\pscirc@edge@sector,nrot=:U]{%
        \psline[linecolor=\psk@I@color,linewidth=\psk@I@width,
    arrowsize=6\pslinewidth,arrowinset=0]{->}(-.1,0)(.1,0)}
      \nbput[npos=\pscirc@edge@sector]{\color{\psk@I@labelcolor}\psk@labeltransistoricollector}%
    \fi\fi
  \bgroup
  \psset{style=emitterOpt}%
  \ifPst@transistorinvert\pscirc@edge(#2)(@@collector)\else\pscirc@edge(#2)(@@emitter)\fi
  \egroup
  \ncput[npos=2]{\pnode{\ifPst@transistorinvert @@collector\else @@emitter\fi}}%
  \ifPst@transistoriemitter
    \ifPst@transistorinvert\else
      \ncput[npos=\pscirc@edge@sector,nrot=:U]{%
        \psline[linecolor=\psk@I@color,linewidth=\psk@I@width,
    arrowsize=6\pslinewidth,arrowinset=0]{<-}(-.1,0)(.1,0)}
      \naput[npos=\pscirc@edge@sector]{\color{\psk@I@labelcolor}\psk@labeltransistoriemitter}%
    \fi\fi
  \ifPst@transistoricollector% collector current?
    \ifPst@transistorinvert% emitter/collector changed?
      \ncput[npos=\pscirc@edge@sector,nrot=:U]{%
        \psline[linecolor=\psk@I@color,linewidth=\psk@I@width,
    arrowsize=6\pslinewidth,arrowinset=0]{<-}(-.1,0)(.1,0)}
      \naput[npos=\pscirc@edge@sector]{\color{\psk@I@labelcolor}\psk@labeltransistoricollector}%
    \fi\fi
  \psline[linestyle=none](#1)(#2)% for the end arrows
  \psline[linestyle=none](#1)(#3)% for the end arrows
  \endgroup
  \ignorespaces
}
%
\def\Tswitch{\pst@object{Tswitch}}
\def\Tswitch@i(#1)(#2)(#3)#4{%
  \addbefore@par{dimen=middle}%
  \begin@ClosedObj
  \pst@getcoor{#1}\pst@tempa
  \pst@getcoor{#2}\pst@tempb
  \pst@getcoor{#3}\pst@tempc
  \pnode(! 10 dict begin
    \pst@tempa /Y1 exch \pst@number\psyunit div def
    /X1 exch \pst@number\psxunit div def
    \pst@tempb /Y2 exch \pst@number\psyunit div def
    /X2 exch \pst@number\psxunit div def
    \pst@tempc /Y3 exch \pst@number\psyunit div def
    /X3 exch \pst@number\psxunit div def
    /XC X1 X2 add 2 div def
    /YC Y2 def
    XC YC end ){C@}
  \rput(C@){\pst@draw@Tswitch}
  \ncangle[arrows=-,arm=0.5,angleB=180]{#1}{Tswi@left}
  \ncangle[arrows=-,arm=0.5,angleB=0]{#2}{Tswi@right}
  \ncangle[arrows=-,arm=0.5,angleB=-90]{#3}{Tswi@center}
  \ncline[arrows=-,linestyle=none,fillstyle=none]{Tswi@left}{Tswi@right}
  \naput{#4}
  \pcline[linestyle=none](#1)(#2)% for the endarrows
  \pcline[linestyle=none](#2)(#3)% for the endarrows
  \end@ClosedObj
  \ignorespaces%
}
%
% 20030830 hv
%
\def\potentiometer{\pst@object{potentiometer}}
\def\potentiometer@i(#1)(#2)(#3)#4{%
  \begin@ClosedObj
    \resistor(#1)(#2){#4}
    \pst@getcoor{#1}\pst@tempa
    \pst@getcoor{#2}\pst@tempb
    \pst@getcoor{#3}\pst@tempc
    \pnode(! tx@CircDict begin
        \pst@tempa /Y1_p exch \pst@number\psyunit div def
        /X1_p exch \pst@number\psxunit div def
        \pst@tempb /Y2_p exch \pst@number\psyunit div def
        /X2_p exch \pst@number\psxunit div def
        \pst@tempc /Y3_p exch \pst@number\psyunit div def
        /X3_p exch \pst@number\psxunit div def
        /dx X2_p X1_p sub def
        /dy Y2_p Y1_p sub def
        dx 2 div X1_p add
        dy 2 div Y1_p add end ){Center@}
    \pst@getcoor{Center@}\pst@tempd
    \pnode(! tx@CircDict  begin
        \pst@tempd /Y4_p exch \pst@number\psyunit div def
        /X4_p exch \pst@number\psxunit div def
        dx abs 0.01 lt{
            X3_p Y4_p
        }{dy abs 0.01 lt {
            X4_p Y3_p
            }{/m dy dx div def
                /x_p Y4_p Y3_p sub m X3_p mul add X4_p m div add m 1 m div add div def
                x_p dup X3_p sub m mul Y3_p add
            } ifelse
        }ifelse end ){@tempNodeB}
    \pnode(! tx@CircDict  begin
        /Alpha dy dx atan def
        /dx Alpha sin 0.25 mul def
        /dy Alpha cos 0.25 mul def
        Y3_p Y2_p gt { X4_p dx sub Y4_p dy add}{X4_p dx add Y4_p dy sub}ifelse end ){@tempNodeC}
    \psline[arrows=->,arrowsize=0.2](#3)(@tempNodeB)(@tempNodeC)
    \pcline[linestyle=none](#1)(#3)% for the endarrows
  \end@ClosedObj%
  \ignorespaces%
}
%
% quadrupoles
%
\def\transformer{\pst@object{transformer}}
\def\transformer@i(#1)(#2)(#3)(#4)#5{%
  \addbefore@par{dimen=middle,arm=0}%
  \begin@ClosedObj%
  \if\psk@Trafo@iprimary@label\@empty\else
    \psset{transformeriprimary=true}%
  \fi
  \if\psk@Trafo@isecondary@label\@empty\else
    \psset{transformerisecondary=true}%
  \fi
  \ifPst@intensity
    \psset{transformeriprimary=true,transformerisecondary=true}%
  \fi
  \pst@getcoor{#1}\pst@tempA
  \pst@getcoor{#2}\pst@tempB
  \pst@getcoor{#3}\pst@tempC
  \pst@getcoor{#4}\pst@tempD
  \pnode(! 10 dict begin
    \pst@tempA /Y1 exch \pst@number\psyunit div def
               /X1 exch \pst@number\psxunit div def
    \pst@tempB /Y2 exch \pst@number\psyunit div def
               /X2 exch \pst@number\psxunit div def
    \pst@tempC /Y3 exch \pst@number\psyunit div def
               /X3 exch \pst@number\psxunit div def
    \pst@tempD /Y4 exch \pst@number\psyunit div def
               /X4 exch \pst@number\psxunit div def
    /XC X1 X2 lt {X2} {X1} ifelse X3 X4 lt {X3} {X4} ifelse add 2 div def
    /YC Y1 Y3 lt {Y1} {Y3} ifelse Y2 Y4 lt {Y2} {Y4} ifelse add 2 div def
    XC YC end){C@}
  \rput(C@){\pst@draw@transformer}
  \pnode(#1){@endA}\pnode(#2){@endB}\pnode(#3){@endC}\pnode(#4){@endD}%
  \ncangle[arrows=-,arm=0.5,angleB=90]{@endA}{inup@}
  \ifPst@Trafo@iprimary
    \ncput[npos=2.5,nrot=:U]{\psline[linecolor=\psk@I@color,
      linewidth=\psk@I@width,arrowinset=0]{->}(-.1,0)(.1,0)}
    \nbput[npos=2.5]{\color{\psk@I@labelcolor}\psk@Trafo@iprimary@label}
  \fi
  \ncangle[arrows=-,arm=0.5,angleB=-90]{@endB}{indown@}
  \ncangle[arrows=-,arm=0.5,angleB=90]{@endC}{outup@}
  \ifPst@Trafo@isecondary
    \ncput[npos=2.5,nrot=:U]{\psline[linecolor=\psk@I@color,
      linewidth=\psk@I@width,arrowinset=0]{->}(-.1,0)(.1,0)}
    \naput[npos=2.5]{\color{\psk@I@labelcolor}\psk@Trafo@isecondary@label}
  \fi
  \ncangle[arrows=-,arm=0.5,angleB=-90]{@endD}{outdown@}
  \ncline[arrows=-,linestyle=none,fillstyle=none]{indown@}{inup@}
  \naput{\psk@Trafo@primary@label}
  \ncline[arrows=-,linestyle=none,fillstyle=none]{outdown@}{outup@}
  \nbput{\psk@Trafo@secondary@label}
  \ncline[arrows=-,linestyle=none,fillstyle=none]{indown@}{outdown@}
  \nbput{#5}
  \pcline[linestyle=none](#1)(#3)% for the end arrows
  \pcline[linestyle=none](#2)(#4)% for the end arrows
  \end@ClosedObj%
  \ignorespaces%
}
%
% Start hv 2003-07-23
\def\optoCoupler{\pst@object{optoCoupler}}
\def\optoCoupler@i(#1)(#2)(#3)(#4)#5{%
  \addbefore@par{dimen=middle,arm=0}%
  \begin@ClosedObj%
  \pst@getcoor{#1}\pst@tempa
  \pst@getcoor{#2}\pst@tempb
  \pst@getcoor{#3}\pst@tempc
  \pst@getcoor{#4}\pst@tempd
  \pnode(! 10 dict begin
    \pst@tempa /Y1 exch \pst@number\psyunit div def
    /X1 exch \pst@number\psxunit div def
    \pst@tempb /Y2 exch \pst@number\psyunit div def
    /X2 exch \pst@number\psxunit div def
    \pst@tempc /Y3 exch \pst@number\psyunit div def
    /X3 exch \pst@number\psxunit div def
    \pst@tempd /Y4 exch \pst@number\psyunit div def
    /X4 exch \pst@number\psxunit div def
    /XC X1 X2 lt {X2} {X1} ifelse X3 X4 lt {X3} {X4} ifelse add 2 div def
    /YC Y1 Y3 lt {Y1} {Y3} ifelse Y2 Y4 lt {Y2} {Y4} ifelse add 2 div def
    XC YC end){C@}
  \rput(C@){\pst@draw@optoCoupler}
  \ncangle[arrows=-,arm=0.5,angleB=90]{#1}{inup@}
  \ncangle[arrows=-,arm=0.5,angleB=-90]{#2}{indown@}
  \ncangle[arrows=-,arm=0.5,angleB=90]{#3}{outup@}
  \ncangle[arrows=-,arm=0.5,angleB=-90]{#4}{outdown@}
  \ncline[arrows=-,linestyle=none,fillstyle=none]{indown@}{outdown@}
  \nbput{#5}
  \pcline[linestyle=none](#1)(#3)% for the end arrows
  \pcline[linestyle=none](#2)(#4)% for the end arrows
  \end@ClosedObj%
  \ignorespaces%
}
%
\def\quadripole{\pst@object{quadripole}}% Markus Graube
\def\quadripole@i(#1)(#2)(#3)(#4)#5{%
  \addbefore@par{dimen=middle,arm=0}%
  \begin@ClosedObj%
  \pst@getcoor{#1}\pst@tempa
  \pst@getcoor{#2}\pst@tempb
  \pst@getcoor{#3}\pst@tempc
  \pst@getcoor{#4}\pst@tempd
  \pnode(! 10 dict begin
    \pst@tempa /Y1 exch \pst@number\psyunit div def
    /X1 exch \pst@number\psxunit div def
    \pst@tempb /Y2 exch \pst@number\psyunit div def
    /X2 exch \pst@number\psxunit div def
    \pst@tempc /Y3 exch \pst@number\psyunit div def
    /X3 exch \pst@number\psxunit div def
    \pst@tempd /Y4 exch \pst@number\psyunit div def
    /X4 exch \pst@number\psxunit div def
    /XC X1 X2 lt {X2} {X1} ifelse X3 X4 lt {X3} {X4} ifelse add 2 div def
    /YC Y1 Y3 lt {Y1} {Y3} ifelse Y2 Y4 lt {Y2} {Y4} ifelse add 2 div def
    XC YC end){C@}
  \rput(C@){#5}
  \rput(C@){\psframe[linewidth=1.5\pslinewidth](-1.5,-1.2)(1.5,1.2)
    \pnode(-1.5,1){inup@}    \pnode(-1.5,-1){indown@}
    \pnode(1.5,-1){outdown@} \pnode(1.5,1){outup@}}
  \ncangle[arrows=-,arm=0.5,angleB=180]{#1}{inup@}
  \ncangle[arrows=-,arm=0.5,angleB=180]{#2}{indown@}
  \ncangle[arrows=-,arm=0.5,angleB=0]{#3}{outup@}
  \ncangle[arrows=-,arm=0.5,angleB=0]{#4}{outdown@}
  \ncline[arrows=-,linestyle=none,fillstyle=none]{indown@}{outdown@}
  \pcline[linestyle=none](#1)(#3)% for the end arrows
  \pcline[linestyle=none](#2)(#4)% for the end arrows
  \end@ClosedObj%
  \ignorespaces%
}
%
% The logical circuits part
%
\def\logic{\@ifnextchar[{\pst@draw@logic}{\pst@draw@logic[]}}
\def\ground{\@ifnextchar[{\pst@ground}{\pst@ground[]}}
\def\pst@ground[#1]{%
    \@ifnextchar({\pst@groundi[#1]{0}}{\pst@groundi[#1]}%
}
\def\pst@groundi[#1]#2(#3){{%
    \psset{#1}%
    \rput{#2}(#3){%
        \psframe[fillstyle=vlines,%
            linestyle=none,%
            fillstyle=none,%
            hatchwidth=0.5\pslinewidth](-0.5,-0.7)(0.5,-0.5)
        \psline[linewidth=1.5\pslinewidth](-0.5,-0.5)(0.5,-0.5)
        \psline(0,0)(0,-0.5)
         \ifPst@connectingdot
            \pscircle*(0,0){2\pslinewidth}
        \fi
    }
    \ignorespaces%
}}
%
% end hv 2003-08-29
%
%% SQUID def added 2009-02-18 Amit Finkler
\newCircDipole{SQUID}
%
\def\pst@draw@SQUID{%
  \pscircle[linewidth=1.5\pslinewidth](0,0){0.5}
  \psline(0.1,-0.6)(-0.1,-0.4)
  \psline(0.1,-0.4)(-0.1,-0.6)
  \psline(0.1,0.6)(-0.1,0.4)
  \psline(0.1,0.4)(-0.1,0.6)
  \pnode(-0.5,0){dipole@1}
  \pnode(0.5,0){dipole@2}%
}
%% End of SQUID def

%
%%%%%%%%%%%%%
\def\multidipole{\@ifnextchar[{\pst@multidipole}{\pst@multidipole[]}}
\def\pst@multidipole[#1](#2)(#3)#4{%
  \psset{#1}%
  \pst@getcoor{#2}\pst@tempA
  \pst@getcoor{#3}\pst@tempB
  \pst@Verb{%
    gsave
      STV CP T
      \pst@tempA /Ybegin@ exch \pst@number\psyunit div def
      /Xbegin@ exch \pst@number\psxunit div def
      \pst@tempB /Yend@ exch \pst@number\psyunit div def
      /Xend@ exch \pst@number\psxunit div def
      /Xbegin Xbegin@ Xend@ lt {Xbegin@} {Xend@} ifelse def
      /Xend Xbegin@ Xend@ lt {Xend@} {Xbegin@} ifelse def
      /Ybegin Ybegin@ Yend@ lt {Ybegin@} {Yend@} ifelse def
      /Yend Ybegin@ Yend@ lt {Yend@} {Ybegin@} ifelse def
      /@angle Yend Ybegin sub Xend Xbegin sub Atan def
      /X@length Xend Xbegin sub Yend Ybegin sub Pyth @angle cos mul Xend@ Xbegin@ lt {neg} if def
      /Y@length Xend Xbegin sub Yend Ybegin sub Pyth @angle sin mul Yend@ Ybegin@ lt {neg} if def
    grestore}%
  \pst@count@i=\z@
  \let\pst@multidipole@output\@empty
  \ifx\resistor         #4\let\pscirc@next\pst@multidipole@resistor%       1
  \else\ifx\RFLine      #4\let\pscirc@next\pst@multidipole@RFLine
  \else\ifx\capacitor   #4\let\pscirc@next\pst@multidipole@capacitor
  \else\ifx\battery     #4\let\pscirc@next\pst@multidipole@battery
  \else\ifx\coil        #4\let\pscirc@next\pst@multidipole@coil
  \else\ifx\Ucc         #4\let\pscirc@next\pst@multidipole@Ucc
  \else\ifx\Icc         #4\let\pscirc@next\pst@multidipole@Icc
  \else\ifx\switch      #4\let\pscirc@next\pst@multidipole@switch
  \else\ifx\diode       #4\let\pscirc@next\pst@multidipole@diode
  \else\ifx\Zener       #4\let\pscirc@next\pst@multidipole@Zener%       10
  \else\ifx\wire        #4\let\pscirc@next\pst@multidipole@wire
  \else\ifx\lamp        #4\let\pscirc@next\pst@multidipole@lamp
  \else\ifx\circledipole#4\let\pscirc@next\pst@multidipole@circledipole
  \else\ifx\LED         #4\let\pscirc@next\pst@multidipole@LED
  \else\ifx\dashpot     #4\let\pscirc@next\pst@multidipole@dashpot	%15
  \else\ifx\filter      #4\let\pscirc@next\pst@multidipole@filter
  \else\ifx\isolator    #4\let\pscirc@next\pst@multidipole@isolator%   
  \else\ifx\freqmult    #4\let\pscirc@next\pst@multidipole@freqmult%   
  \else\ifx\phaseshifter#4\let\pscirc@next\pst@multidipole@phaseshifter% 
  \else\ifx\vco         #4\let\pscirc@next\pst@multidipole@vco %   	20
  \else\ifx\amplifier   #4\let\pscirc@next\pst@multidipole@amplifier%   
  \else\ifx\detector    #4\let\pscirc@next\pst@multidipole@detector%   22
  \else\ifx\SQUID       #4\let\pscirc@next\pst@multidipole@SQUID%   23
  \else\ifx\Suppressor  #4\let\pscirc@next\pst@multidipole@Suppressor %%% mla change
  \else\ifx\Arrestor    #4\let\pscirc@next\pst@multidipole@Arrestor %%% mla change 25
  \else\ifx\RelayNOP    #4\let\pscirc@next\pst@multidipole@RelayNOP %%% mla 26
  \else\ifx\OpenDipol   #4\let\pscirc@next\pst@multidipole@OpenDipol% 27
  \else\ifx\OpenTripol  #4\let\pscirc@next\pst@multidipole@OpenTripol% 28
  \else\ifx\arrowswitch #4\let\pscirc@next\pst@multidipole@arrowswitch% 29
  \else\let\pscirc@next\ignorespaces
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% 1..10
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%11..20 
  \fi\fi\fi\fi\fi\fi\fi\fi\fi%		 21..29
  \advance\pst@count@i\@ne
  \advance\pst@count@iii\@ne
  \pscirc@next}
%
\def\pst@multidipole@#1{%
  \ifx\resistor#1\let\pscirc@next\pst@multidipole@resistor	%1
  \else\ifx\RFLine#1\let\pscirc@next\pst@multidipole@RFLine
  \else\ifx\capacitor#1\let\pscirc@next\pst@multidipole@capacitor
  \else\ifx\battery#1\let\pscirc@next\pst@multidipole@battery
  \else\ifx\coil#1\let\pscirc@next\pst@multidipole@coil		%5
  \else\ifx\Ucc      #1\let\pscirc@next\pst@multidipole@Ucc
  \else\ifx\Icc      #1\let\pscirc@next\pst@multidipole@Icc
  \else\ifx\switch   #1\let\pscirc@next\pst@multidipole@switch %off
  \else\ifx\diode#1\let\pscirc@next\pst@multidipole@diode
  \else\ifx\Zener    #1\let\pscirc@next\pst@multidipole@Zener	%10
  \else\ifx\wire     #1\let\pscirc@next\pst@multidipole@wire
  \else\ifx\lamp     #1\let\pscirc@next\pst@multidipole@lamp
  \else\ifx\circledipole#1\let\pscirc@next\pst@multidipole@circledipole
  \else\ifx\LED      #1\let\pscirc@next\pst@multidipole@LED
  \else\ifx\dashpot  #1\let\pscirc@next\pst@multidipole@dashpot	%15
  \else\ifx\filter   #1\let\pscirc@next\pst@multidipole@filter
  \else\ifx\isolator #1\let\pscirc@next\pst@multidipole@isolator
  \else\ifx\freqmult #1\let\pscirc@next\pst@multidipole@freqmult%   
  \else\ifx\phaseshifter#1\let\pscirc@next\pst@multidipole@phaseshifter% 
  \else\ifx\vco      #1\let\pscirc@next\pst@multidipole@vco %   	20
  \else\ifx\amplifier#1\let\pscirc@next\pst@multidipole@amplifier%   
  \else\ifx\detector #1\let\pscirc@next\pst@multidipole@detector%   22
  \else\ifx\SQUID    #1\let\pscirc@next\pst@multidipole@SQUID%   23
  \else\ifx\Suppressor #1\let\pscirc@next\pst@multidipole@Suppressor%% mla change
  \else\ifx\Arrestor #1\let\pscirc@next\pst@multidipole@Arrestor%% mla change 25
  \else\ifx\RelayNOP #1\let\pscirc@next\pst@multidipole@RelayNOP%% mla change 26
  \else\ifx\OpenDipol#1\let\pscirc@next\pst@multidipole@OpenDipol% 27
  \else\ifx\OpenTripol#1\let\pscirc@next\pst@multidipole@OpenTripol% 28
  \else\ifx\arrowswitch#1\let\pscirc@next\pst@multidipole@arrowswitch% 29
  \else\let\pscirc@next\ignorespaces\pst@multidipole@output
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  \fi\fi\fi\fi\fi\fi\fi\fi\fi
  \advance\pst@count@i\@ne
  \advance\pst@count@iii\@ne
  \pscirc@next
}
%
%
\def\pst@multidipole@wire{\@ifnextchar[{\pst@multidipole@wire@}{\pst@multidipole@wire@[]}}
\def\pst@multidipole@wire@[#1]{%
  {\psset{#1}%
  \ifPst@parallel\aftergroup\advance\aftergroup\pst@count@i\aftergroup\m@ne\fi}%
  \pst@count@ii=\pst@count@i
  \advance\pst@count@ii\@ne
  \toks0\expandafter{\pst@multidipole@output}%
  \edef\pst@multidipole@output{%
    \the\toks0
    \pst@multidipole@def@coor
    \noexpand\wire[#1]%
      (! X@\the\pst@count@i\space Y@\the\pst@count@i)(! X@\the\pst@count@ii\space Y@\the\pst@count@ii)
  }%
  \pst@multidipole@
}
%
\def\pst@multidipole@def@coor{%
  \noexpand\pst@Verb{%
    /X@\the\pst@count@i\space \the\pst@count@i\space 1 sub X@length \noexpand\the\pst@count@i\space div mul Xbegin@ add def
    /Y@\the\pst@count@i\space \the\pst@count@i\space 1 sub Y@length \noexpand\the\pst@count@i\space div mul Ybegin@ add def
    /X@\the\pst@count@ii\space \the\pst@count@i\space X@length \noexpand\the\pst@count@i\space div mul Xbegin@ add def
    /Y@\the\pst@count@ii\space \the\pst@count@i\space Y@length \noexpand\the\pst@count@i\space div mul Ybegin@ add def
    }%
\ignorespaces}
%
%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\pst@draw@dipole#1#2#3#4#5{%   suggestion by Alain Ristow
  \psset{dimen=middle,#1}%
  \if\psk@I@label\@empty\else\psset[pst-circ]{intensity=true}\fi
  \if\psk@tension@label\@empty\else\psset[pst-circ]{tension=true}\fi
  \ifx\psk@Dconvention\pst@Dconvention@generator
     \Pst@Dconventiontrue
  \else
     \ifx\psk@Dconvention\pst@Dconvention@receptor\Pst@Dconventionfalse\fi
  \fi
  \pcline[arrowscale=1,arrows=-,linestyle=none,fillstyle=none](#2)(#3)
  \ncput[nrot=:U]{\pnode{dipole@M}}
  \ifPst@parallel
     \pcline[arrows=-,linestyle=none,fillstyle=none](#2)(dipole@M)
     \ncput[npos=\psk@parallel@sep]{\pnode{dipole@@1}}
     \pcline[arrows=-,linestyle=none,fillstyle=none](#3)(dipole@M)
     \ncput[npos=\psk@parallel@sep]{\pnode{dipole@@2}}
     \pcline[arrows=-,linestyle=none,fillstyle=none,offset=\psk@parallel@arm](dipole@@1)(dipole@@2)
     \ncput[npos=0]{\pnode{dipole@@@1}}
     \ncput[npos=1]{\pnode{dipole@@@2}}
     \ncput[nrot=:U]{\ifPst@mathlabel$\pst@labelstyle#5$\else\pst@labelstyle#5\fi}
     \pcline[arrows=-](dipole@@1)(dipole@@@1)
     \pcline[arrows=-](dipole@@@1)(dipole@1)
     \pcline[arrows=-](dipole@2)(dipole@@@2)
     \pcline[arrows=-](dipole@@@2)(dipole@@2)
     \ifPst@parallel@node
       \pscircle*(dipole@@1){2\pslinewidth}
       \pscircle*(dipole@@2){2\pslinewidth}
     \fi
     \pcline[arrows=-,linestyle=none,fillstyle=none,offset=\psk@label@offset](dipole@@@1)(dipole@@@2)
     \ncput[nrot=\psk@label@angle]{\ifPst@mathlabel$\pst@labelstyle#4$\else\pst@labelstyle#4\fi}
     \pst@intensity{dipole@@@1}{dipole@@@2}
     \pst@tension{dipole@@@1}{dipole@@@2}
   \else
     \ncput[nrot=:U]{\ifPst@mathlabel$\pst@labelstyle#5$\else\pst@labelstyle#5\fi}
     \pcline[arrowscale=1,arrows=-,linestyle=none,fillstyle=none,offset=\psk@label@offset](#2)(#3)
     \ncput[nrot=\psk@label@angle]{\ifPst@mathlabel$\pst@labelstyle#4$\else\pst@labelstyle#4\fi}
%%%%%
     \ifPst@inputarrow
        \ifx\psk@Dinput\pst@Dinput@right
            \pcline[fillstyle=none,arrows=-C](#2)(dipole@1)
            \pcline[fillstyle=none,arrows=->,arrowinset=0](#3)(dipole@2)
         \else
            \pcline[fillstyle=none,arrows=->,arrowinset=0](#2)(dipole@1)
            \pcline[fillstyle=none,arrows=C-](dipole@2)(#3)
        \fi
     \else
        \pcline[arrowscale=1,fillstyle=none,arrows=-C](#2)(dipole@1)
        \pcline[arrowscale=1,fillstyle=none,arrows=C-](dipole@2)(#3)
     \fi
     \pcline[fillstyle=none,linestyle=none](#2)(#3)
%%%%%
     \pst@intensity{#2}{#3}%
     \pst@tension{#2}{#3}%
   \fi
}%
%
\def\pst@intensity#1#2{%
  \ifPst@intensity
    \ifPst@directconvention
      \pcline[arrows=-,linestyle=none,fillstyle=none](#1)(dipole@1)
      \ncput[nrot=:U]{%
        \psline[linecolor=\psk@I@color,
          linewidth=\psk@I@width,arrowinset=0]{->}(-.1,0)(.1,0)}
      \pcline[arrows=-,linestyle=none,fillstyle=none,offset=\psk@I@label@offset](#1)(dipole@1)
      \ncput[nrot=\psk@label@angle]{\color{\psk@I@labelcolor}\psk@I@label}
    \else
      \pcline[arrows=-,linestyle=none,fillstyle=none](dipole@2)(#2)
      \ncput[nrot=:U]{%
        \psline[linecolor=\psk@I@color,linewidth=\psk@I@width,arrowinset=0]{<-}(-.1,0)(.1,0)}
      \pcline[arrows=-,linestyle=none,fillstyle=none,offset=\psk@I@label@offset](dipole@2)(#2)
      \ncput[nrot=\psk@label@angle]{\color{\psk@I@labelcolor}\psk@I@label}
    \fi
  \fi
}
%
\def\pst@tension#1#2{%
  \ifPst@tension
    \pcline[arrows=-,linestyle=none,fillstyle=none,offset=\psk@tension@offset](#1)(dipole@1)
    \ncput[npos=.5]{\pnode{tension@1}}
    \pcline[arrows=-,linestyle=none,fillstyle=none,offset=-\psk@tension@offset](#2)(dipole@2)
    \ncput[npos=.5]{\pnode{tension@2}}
    \ifPst@directconvention
      \ifPst@Dconvention
        \ifnum\psk@tension@style=1 
            \pcline[linestyle=none](tension@1)(tension@2)
            \ncput[npos=0.25]{$-$}\ncput[npos=0.75]{$+$}%
        \else
            \pcline[linecolor=\psk@tension@color,linewidth=\psk@tension@width,arrowinset=0]{<-}(tension@1)(tension@2)
        \fi
      \else
        \ifnum\psk@tension@style=1 
            \pcline[linestyle=none](tension@1)(tension@2)
            \ncput[npos=0.25]{$+$}\ncput[npos=0.75]{$-$}%
        \else
            \pcline[linecolor=\psk@tension@color,linewidth=\psk@tension@width,arrowinset=0]{->}(tension@1)(tension@2)
        \fi
      \fi
    \else
      \ifPst@Dconvention
        \ifnum\psk@tension@style=1 
            \pcline[linestyle=none](tension@1)(tension@2)
            \ncput[npos=0.25]{$-$}\ncput[npos=0.75]{$+$}%
        \else
            \pcline[linecolor=\psk@tension@color,linewidth=\psk@tension@width,arrowinset=0]{->}(tension@1)(tension@2)
        \fi
      \else
        \ifnum\psk@tension@style=1 
            \pcline[linestyle=none](tension@1)(tension@2)
            \ncput[npos=0.25]{$+$}\ncput[npos=0.75]{$-$}%
        \else
            \pcline[linecolor=\psk@tension@color,linewidth=\psk@tension@width,arrowinset=0]{<-}(tension@1)(tension@2)
        \fi
      \fi
    \fi
    \pcline[arrows=-,linestyle=none,fillstyle=none,offset=\psk@tension@label@offset](dipole@1)(dipole@2)
    \ncput[nrot=\psk@label@angle]{\color{\psk@tension@labelcolor}\psk@tension@label}
  \fi
}
%
\def\pst@draw@resistor{%
  \ifx\psk@Dstyle\pst@Dstyle@zigzag
    \pnode(-0.75,0){dipole@1}
    \pnode(0.75,0){dipole@2}
    \multips(-0.75,0)(0.5,0){3}{%
      \psline[arrows=-,linewidth=1.5\pslinewidth]%
          (0,0)(0.125,0.25)(0.375,-0.25)(0.5,0)}%
  \else
    \pnode(-0.5,0){dipole@1}\pnode(0.5,0){dipole@2}
    \psframe[linewidth=1.5\pslinewidth](-0.5,-0.25)(0.5,0.25)
  \fi
  \ifPst@variable\psline{->}(-0.5,-0.55)(0.5,0.55)\fi
  \ifx\psk@Dstyle\pst@Dstyle@varistor
    \psline[linewidth=0.8pt](-0.75,-0.55)(-0.5,-0.55)(0.5,0.55)%
  \fi
}
%
\def\pst@draw@RFLine{%
  \pnode(-1.5,0){dipole@1} \pnode(1.5,0){dipole@2}
  \pscustom[arrows=-]{%
    \psellipticarcn(-0.8,0)(0.2,0.3){90}{-90}
    \psline(-0.8,-.3)(0.8,-.3)
    \psellipticarc(0.8,0)(0.2,0.3){-90}{90}
    \psline(-0.8,.3)(0.8,.3)}
  \psellipse(-0.8,0)(0.2,0.3)
  \pcline[arrows=-](dipole@1)(-0.8,0)\pcline[arrows=-](dipole@2)(1,0)}
%
% pd start ====================================================
\def\pst@draw@dashpot{%
  \pnode(0,0){dipole@1}%
  \pnode(0.5,0){dipole@2}%
  \psline[linewidth=1.5\pslinewidth]%
  (-0.5,-0.5)(0.5,-0.5)(0.5,0.5)(-0.5,0.5)%
  \psline[linewidth=1.5\pslinewidth](0,-0.4)(0,0.4)%
}
% pd end ======================================================
\def\pst@draw@capacitor{%
  \bgroup
  \psset{linewidth=1.5\pslinewidth}%
  \ifx\psk@Dstyle\pst@Dstyle@chemical
    \psline[arrows=-](-0.2,-0.5)(-0.2,0.5)
    \psarc[arrows=-](1.1875,0){1.0625}{154.8}{205.2}
    \pnode(-0.2,0){dipole@1}
    \pnode(0.125,0){dipole@2}
  \else
    \ifx\psk@Dstyle\pst@Dstyle@elektorchemical
      \psframe[framearc=0.01,dimen=outer](-0.2284123,0.2743733)(-0.0557103,-0.2743733)
      \psframe[framearc=0.01,dimen=outer,fillstyle=solid,fillcolor=black](0.0557103,0.2743733)(0.2284123,-0.2743733)
      \pnode(-0.2284123,0){dipole@1}
      \pnode(0.2284123,0){dipole@2}
    \else
      \ifx\psk@Dstyle\pst@Dstyle@elektor
        \psframe[framearc=0.01,dimen=outer,fillstyle=solid,fillcolor=black](-0.2284123,0.2743733)(-0.0557103,-0.2743733)
        \psframe[framearc=0.01,dimen=outer,fillstyle=solid,fillcolor=black](0.0557103,0.2743733)(0.2284123,-0.2743733)
        \pnode(-0.2284123,0){dipole@1}
        \pnode(0.2284123,0){dipole@2}
      \else
        \ifx\psk@Dstyle\pst@Dstyle@crystal
          \psline[arrows=-](-0.3,-0.4)(-0.3,0.4)
          \psline[arrows=-](0.3,-0.4)(0.3,0.4)
	  \psframe(-0.2,-0.5)(0.2,0.5)
          \pnode(-0.3,0){dipole@1}
          \pnode(0.3,0){dipole@2}
	\else
          \psline[arrows=-](-0.2,-0.5)(-0.2,0.5)
          \psline[arrows=-](0.2,-0.5)(0.2,0.5)
          \pnode(-0.2,0){dipole@1}
          \pnode(0.2,0){dipole@2}
	\fi
      \fi
    \fi
  \fi
  \ifPst@variable%
    \psline[arrows=->](-0.5,-0.55)(0.5,0.55)%
  \fi
  \egroup
}
%
\def\pst@draw@OA{%
  \ifx\psk@tripole@style\pst@tripole@style@french
    \psframe[linewidth=1.5\pslinewidth](-1,-0.75)(1,0.75)
    \pspolygon(-0.4,-0.2)(-0.4,0.2)(-0.05,0)
  \else
% USUAL AOP
    \pspolygon[arrows=-,linewidth=1.5\pslinewidth](-1,-1)(-1,1)(1,0)(-1,-1)
   	 %\pspolygon[arrows=-](-1,-0.75)(-1,0.75)(1,0)(-1,-0.75)
    
% Supply pins Position
    \ifPst@OApower
      \psline{-}(0,0.5)(0,0.75)%\uput[90](0,1){$+$}
     	 %\psline{-o}(0,0.375)(0,0.75)\uput[90](0,0.75){$+$}
      \psline{-}(0,-0.5)(0,-0.75)%\uput[-90](0,-1){$-$}
     	 %\psline{-o}(0,-0.375)(0,-0.75)\uput[-90](0,-0.75){$-$}
    \fi
  \fi
% Input Pins Position
  \pnode(-1,0.5){\ifPst@OAinvert Minus@\else Plus@\fi}
  \pnode(-1,-0.5){\ifPst@OAinvert Plus@\else Minus@\fi}
  \pnode(1,0){S@}
% + and - Position
  \uput{0.1}[0](-1,0.5){\ifPst@OAinvert$-$\else$+$\fi}
 	 %\uput{0.1}[0](-1,0.25){\ifPst@OAinvert$-$\else$+$\fi}
  \uput{0.1}[0](-1,-0.5){\ifPst@OAinvert$+$\else$-$\fi}
 	 %\uput{0.1}[0](-1,-0.25){\ifPst@OAinvert$+$\else$-$\fi}
  \ifPst@OAperfect\rput(0.25,0){$\infty$}\fi%
}
%
\def\pst@draw@coil{%
  \ifx\psk@Dstyle\pst@Dstyle@curved
    \pscurve[arrows=-](-0.7,0)(-0.6,0.3)(-0.35,0)(-0.4,-0.2)%
      (-0.5,0)(-0.4,0.3)(-0.15,0)(-0.2,-0.2)(-0.3,0)%
      (-0.2,0.3)(0.05,0)(0,-0.2)(-0.1,0)%
      (0,0.3)(0.25,0)(0.2,-0.2)(0.1,0)%
      (0.2,0.3)(0.45,0)(0.4,-0.2)(0.3,0)%
      (0.4,0.3)(0.65,0)(0.6,-0.2)(0.5,0)%
    \pnode(-0.7,0){dipole@1}
    \pnode(0.5,0){dipole@2}
  \else
    \ifx\psk@Dstyle\pst@Dstyle@elektor
      \psarcn[arrows=c-](-0.3885794,0){0.1295265}{-180}{0}
      \psarcn[arrows=-](-0.1295265,0){0.1295265}{-180}{0}
      \psarcn[arrows=-](0.1295265,0){0.1295265}{-180}{0}
      \psarcn[arrows=-c](0.3885794,0){0.1295265}{-180}{0}
      \pnode(-0.5181058,0){dipole@1}
      \pnode(0.5181058,0){dipole@2}
    \else
      \ifx\psk@Dstyle\pst@Dstyle@elektorcurved
        \psarcn[arrows=c-c](-0.408167,0.089453){0.211665}{-155}{-410}
        \psarcn[arrows=-c](-0.136056,0.089453){0.211665}{-130}{-410}
        \psarcn[arrows=-c](0.136055,0.089453){0.211665}{-130}{-410}
        \psarcn[arrows=-c](0.408167,0.089453){0.211665}{-130}{-385}
        \pnode(-0.6,0){dipole@1}
        \pnode(0.6,0){dipole@2}
    \else
      \ifx\psk@Dstyle\pst@Dstyle@rectangle
        \pnode(-0.5,0){dipole@1}
        \pnode(0.5,0){dipole@2}
        \psframe[linewidth=1.5\pslinewidth,fillstyle=solid,fillcolor=black](-0.5,-0.25)(0.5,0.25)
    \else
      \pscurve[arrows=-,linewidth=1.5\pslinewidth](-1,0)(-0.75,0.5)(-0.5,0)%
      \pscurve[arrows=-,linewidth=1.5\pslinewidth](-0.5,0)(-0.25,0.5)(0,0)%
      \pscurve[arrows=-,linewidth=1.5\pslinewidth](0,0)(0.25,0.5)(0.5,0)%
      \pscurve[arrows=-,linewidth=1.5\pslinewidth](0.5,0)(0.75,0.5)(1,0)%
      \pnode(-1,0){dipole@1}%
      \pnode(1,0){dipole@2}%
    \fi\fi\fi\fi
  \ifPst@variable\psline{->}(-0.75,-0.5)(0.75,0.5)\fi
}
%
\def\pst@draw@Ucc{%
  \pnode(-0.5,0){dipole@1}
  \pnode(0.5,0){dipole@2}
  \ifx\psk@Dstyle\pst@Dstyle@diamond
    \pspolygon[linewidth=1.5\pslinewidth](-0.5,0)(0,0.5)(0.5,0)(0,-0.5)
  \else
    \ifx\psk@Dstyle\pst@Dstyle@diamondCei
    \pspolygon[linewidth=1.5\pslinewidth](-0.5,0)(0,0.5)(0.5,0)(0,-0.5)
    \psline[linewidth=1.5\pslinewidth](-0.5,0)(0.5,0) 
    \else
      \ifx\psk@Dstyle\pst@Dstyle@normalCei
      \pscircle[linewidth=1.5\pslinewidth](0,0){0.5}
	  \psline[linewidth=1.5\pslinewidth](-0.5,0)(0.5,0)
      \else
        \pscircle[linewidth=1.5\pslinewidth](0,0){0.5}
      \fi
    \fi 
  \fi
  \ifcase\psk@labelInside\or% do nothing
    \psline[arrows=-,linewidth=2\pslinewidth]{->}(-0.35,0)(0.35,0)\or% case 1
    \uput{0.1}[0]{90}(-0.5,0){$-$}% case 2
    \uput{0.1}[0]{90}(0,0){$+$}\or% case 3
    \rput(0,0){\large\bf =}
  \fi
}
%
\def\pst@draw@Icc{%
  \ifx\psk@Dstyle\pst@Dstyle@twoCircles
    \pnode(-0.7,0){dipole@1}
    \pnode(0.7,0){dipole@2}
    \pscircle[linewidth=1.5\pslinewidth](-0.175,0){0.5}
    \pscircle[linewidth=1.5\pslinewidth](0.175,0){0.5}
  \else
    \pnode(-0.5,0){dipole@1}
    \pnode(0.5,0){dipole@2}
    \ifx\psk@Dstyle\pst@Dstyle@diamond
	  \pspolygon[linewidth=1.5\pslinewidth](-0.5,0)(0,0.5)(0.5,0)(0,-0.5)
    \else
	  \pscircle[linewidth=1.5\pslinewidth](0,0){0.5}
	\fi
    \psline[arrows=-,linewidth=1.5\pslinewidth](0,-0.5)(0,0.5)
  \fi%
}
%
\def\pst@draw@switch{%
  \ifx\psk@Dstyle\pst@Dstyle@close
    \pnode(-0.5,0){dipole@1}
    \pnode(0.5,0){dipole@2}
    \qdisk(-0.5,0){1.5pt}
    \qdisk(0.5,0){1.5pt}
    \psline[arrows=-,linewidth=2\pslinewidth](-0.5,0.05)(0.5,0.05)
  \else
    \pnode(-0.55,0){dipole@1}
    \pnode(0.5,0){dipole@2}
    \psline[arrows=-,linewidth=2\pslinewidth](-0.5,0)(0.5,0.5)
    \psarcn[arrowinset=0]{->}(-0.5,0){0.75}{45}{-45}
    \pscircle[fillstyle=solid](-0.5,0){0.07}
    \qdisk(0.5,0){1.5pt}
  \fi
}
%
\def\pst@draw@diode{%
  \ifx\psk@Dstyle\pst@Dstyle@triac
    \pspolygon[linewidth=1.5\pslinewidth](-0.25,-0.4)(-0.25,0)(0.25,-0.2)
    \pspolygon[linewidth=1.5\pslinewidth](0.25,0)(-0.25,0.2)(0.25,0.4)
    \psline[arrows=-,linewidth=1.5\pslinewidth](-0.25,-0.4)(-0.25,0.4)
    \psline[arrows=-,linewidth=1.5\pslinewidth](0.25,-0.4)(0.25,0.4)
    \psline[arrows=-,linewidth=\pslinewidth](0.25,-0.2)(0.5,-0.3)(0.5,-0.6)
  \else%
    \pspolygon[arrows=-,linewidth=1.5\pslinewidth](-0.25,-0.2)(-0.25,0.2)(0.25,0)
    \ifx\psk@Dstyle\pst@Dstyle@schottky 
      \psline[linewidth=1.1\pslinewidth](0.4,0.2)(0.4,0.3)(0.3,0.3)(0.3,-0.3)(0.2,-0.3)(0.2,-0.2)
    \else
      \psline[arrows=-,linewidth=1.5\pslinewidth](0.25,0.2)(0.25,-0.2)% for all following
    \fi
    \ifx\psk@Dstyle\pst@Dstyle@thyristor
      \psline[arrows=-,linewidth=1.5\pslinewidth](0,-0.1)(0,-0.35)
    \fi%
    \ifx\psk@Dstyle\pst@Dstyle@GTO
      \psline[arrows=-,linewidth=1.5\pslinewidth](-0.1,-0.12)(-0.1,-0.35)
      \psline[arrows=-,linewidth=1.5\pslinewidth](0,-0.1)(0,-0.35)
    \else
      \ifx\psk@Dstyle\pst@Dstyle@photo
        \multips(-0.15,0.3)(0.25,0){2}{\psline[arrows=<-](0.25,0.22)}%
      \fi%
    \fi%
  \fi%
  \pnode(-0.25,0){dipole@1}%
  \pnode(0.25,0){dipole@2}%
}
%
\def\pst@draw@Zener{%
  \pspolygon[linewidth=1.5\pslinewidth](-0.25,-0.2)(-0.25,0.2)(0.25,0)
  \ifx\psk@Dstyle\pst@Dstyle@Z
    \psline[arrows=-,linewidth=1.5\pslinewidth](0.1,0.35)(0.25,0.25)(0.25,-0.25)(0.4,-0.35)
  \else
    \psline[arrows=-,linewidth=1.5\pslinewidth](0.25,0.25)(0.25,-0.25)(0,-0.25)
  \fi
  \pnode(-0.25,0){dipole@1}
  \pnode(0.25,0){dipole@2}
}
%
%-------------------mla change
\def\pst@draw@Suppressor{%
  \pspolygon[linewidth=1.5\pslinewidth](-0.5,-0.2)(-0.5,0.2)(0.0,0.0)
  \pspolygon[linewidth=1.5\pslinewidth](0.5,-0.2)(0.5,0.2)(0.0,0.0)
  \psline[arrows=-,linewidth=1.5\pslinewidth](-0.5,0.0)(0.5,0.0)
  \psline[arrows=-,linewidth=1.5\pslinewidth](-0.15,0.35)(0.0,0.25)(0.0,-0.25)(0.15,-0.35)
%  \ifx\psk@Dstyle\pst@Dstyle@Z
%    \psline[arrows=-,linewidth=1.5\pslinewidth](0.1,0.35)(0.25,0.25)(0.25,-0.25)(0.4,-0.35)
%  \else
%    \psline[arrows=-,linewidth=1.5\pslinewidth](0.25,0.25)(0.25,-0.25)(0,-0.25)
%  \fi
  \pnode(-0.5,0.0){dipole@1}
  \pnode(0.50,0.0){dipole@2}
}
\def\pst@draw@Arrestor{%
  \pscircle[linewidth=1.5\pslinewidth](0.0,0.0){0.3}
  \psline[arrows=-,linewidth=1.5\pslinewidth](-0.1,-0.12)(-0.1,0.12)
  \psline[arrows=-,linewidth=1.5\pslinewidth](0.1,-0.12)(0.1,0.12)
  \psline[arrows=-,linewidth=1.5\pslinewidth](0,-0.12)(0.0,0.3)
%  \ifx\psk@Dstyle\pst@Dstyle@Z
%    \psline[arrows=-,linewidth=1.5\pslinewidth](0.1,0.35)(0.25,0.25)(0.25,-0.25)(0.4,-0.35)
%  \else
%    \psline[arrows=-,linewidth=1.5\pslinewidth](0.25,0.25)(0.25,-0.25)(0,-0.25)
%  \fi
  \pnode(-0.3,0.0){dipole@1}
  \pnode(0.3,0.0){dipole@2}
}
%
\def\pst@draw@RelayNOP{%
%  \pscircle[linewidth=1.5\pslinewidth](0.0,0.0){0.3}
  \psframe[arrows=-,linewidth=1.5\pslinewidth](-0.2,0.5)(0.2,1.3)
  \psline[arrows=-,linewidth=1.5\pslinewidth](-0.2,1.3)(0.2,0.5)
  \psline[arrows=-,linewidth=1.5\pslinewidth](-0.2,0.9)(-0.5,0.9)
  \psline[arrows=-,linewidth=1.5\pslinewidth](0.2,0.9)(0.5,0.9)
%
  \psline[arrows=-,linewidth=1.5\pslinewidth](-0.5,0.0)(-0.2,0.0)
  \psline[arrows=-,linewidth=1.5\pslinewidth](-0.2,0.0)(0.2,0.1)
  \psline[arrows=-,linewidth=1.5\pslinewidth](0.2,0.0)(0.5,0.0)
  \psline[linestyle=dashed,arrows=-,linewidth=1.5\pslinewidth](0.0,0.5)(0.0,0.1)
%  \ifx\psk@Dstyle\pst@Dstyle@Z
%    \psline[arrows=-,linewidth=1.5\pslinewidth](0.1,0.35)(0.25,0.25)(0.25,-0.25)(0.4,-0.35)
%  \else
%    \psline[arrows=-,linewidth=1.5\pslinewidth](0.25,0.25)(0.25,-0.25)(0,-0.25)
%  \fi
  \pnode(-0.5,0){dipole@1}
  \pnode(0.5,0){dipole@2}
}
%%%----------------------mla change end
\def\pst@draw@lamp{%
  \pscircle[linewidth=1.5\pslinewidth]{0.5}
  \psline[arrows=-,linewidth=1.5\pslinewidth](0.5;45)(0.5;225)
  \psline[arrows=-,linewidth=1.5\pslinewidth](0.5;135)(0.5;315)
  \pnode(-0.5,0){dipole@1}
  \pnode(0.5,0){dipole@2}
}
%
\def\pst@draw@circledipole{%
  \pscircle[linewidth=1.5\pslinewidth]{\psk@radius}
  \pnode(-\psk@radius,0){dipole@1}
  \pnode(\psk@radius,0){dipole@2}
}
%
\def\pst@draw@LED{%
  \pspolygon[arrows=-,linewidth=1.5\pslinewidth](-0.25,-0.2)(-0.25,0.2)(0.25,0)
  \psline[arrows=-,linewidth=1.5\pslinewidth](0.25,0.2)(0.25,-0.2)
  \pnode(-0.25,0){dipole@1}
  \pnode(0.25,0){dipole@2}
  \multips(-0.25,0.3)(0.25,0){3}{\psline[arrows=->](0.25,0.22)}%
}
%
\def\pst@draw@OpenDipol{%
  \pscircle(-0.5,0){\psk@radius}
  \pscircle(0.5,0){\psk@radius}
  \pst@getlength{\psk@radius}\pst@tempA
  \pnode(!-0.5 \pst@tempA\space \pst@number\psxunit div sub 0){dipole@1}
  \pnode(! 0.5 \pst@tempA\space \pst@number\psxunit div add 0){dipole@2}
}
%
\def\pst@draw@OpenTripol{%
  \pst@getlength{\psk@radius}\pst@tempA
  \pscircle(0.65,0){\psk@radius}
  \pscircle(-0.65,0){\psk@radius}
  \pscircle(0,0){\psk@radius}
  \psline(!0 \pst@tempA\space \pst@number\psxunit div neg)(0,-5mm)
  \psline(-2mm,-5mm)(2mm,-5mm)
  \pnode(!-0.65 \pst@tempA\space \pst@number\psxunit div sub 0){dipole@1}
  \pnode(! 0.65 \pst@tempA\space \pst@number\psxunit div add 0){dipole@2}
}
%
\def\pst@draw@Tswitch{%
  \ifx\psk@tripole@style\pst@tripole@style@right
    \psline[arrows=-,linewidth=2\pslinewidth](0.5,0)(0,-1)
    \psarcn[arrowinset=0]{<-}(0,-1){0.75}{135}{45}
  \else
    \ifx\psk@tripole@style\pst@tripole@style@left
      \psline[arrows=-,linewidth=2\pslinewidth](-0.5,0)(0,-1)
      \psarcn[arrowinset=0]{->}(0,-1){0.75}{135}{45}
    \else
      \psline[arrows=-,linewidth=2\pslinewidth](0,0.1)(0,-1)
      \psarcn[linewidth=1pt,arrowinset=0]{<->}(0,-1){0.75}{135}{45}
    \fi
  \fi
  \qdisk(-0.5,0){1.5pt}
  \qdisk(0.5,0){1.5pt}
  \pscircle[fillstyle=solid](0,-1){0.07}
  \pnode(-0.5,0){Tswi@left}
  \pnode(0.5,0){Tswi@right}
  \pnode(0,-1.05){Tswi@center}
}
%
\def\pst@draw@transformer{
  \ifx\psk@Dstyle\pst@Dstyle@rectangle
    \psframe[fillstyle=solid,fillcolor=black](-0.7,-0.75)(-0.2,0.75)
    \psframe[fillstyle=solid,fillcolor=black](0.7,-0.75)(0.2,0.75)
    \psline[arrows=-,linewidth=0.1cm](0,-0.75)(0,0.75)
    \pnode(-0.5,0.75){inup@}
    \pnode(-0.5,-0.75){indown@}
  \else
    \pscurve[arrows=-](-0.5,0.9)(-0.2,0.8)(-0.5,0.7)(-0.7,0.8)(-0.5,0.82)(-0.2,0.6)
      (-0.5,0.5)(-0.7,0.6)(-0.5,0.62)(-0.2,0.4)
      (-0.5,0.3)(-0.7,0.4)(-0.5,0.42)(-0.2,0.2)
      (-0.5,0.1)(-0.7,0.2)(-0.5,0.22)(-0.2,0)
      (-0.5,-0.1)(-0.7,0)(-0.5,0.02)(-0.2,-0.2)
      (-0.5,-0.3)(-0.7,-0.2)(-0.5,-0.18)(-0.2,-0.4)
      (-0.5,-0.5)(-0.7,-0.4)(-0.5,-0.38)(-0.2,-0.6)
      (-0.5,-0.7)(-0.7,-0.6)(-0.5,-0.58)(-.2,-0.8)(-0.5,-0.9)
    \pscurve[arrows=-](0.5,0.7)(0.2,0.6)(0.5,0.5)(0.7,0.6)(0.5,0.62)
      (0.2,0.4)(0.5,0.3)(0.7,0.4)(0.5,0.42)
      (0.2,0.2)(0.5,0.1)(0.7,0.2)(0.5,0.22)
      (0.2,0.)(0.5,-0.1)(0.7,0)(0.5,0.02)
      (0.2,-0.2)(0.5,-0.3)(0.7,-0.2)(0.5,-0.18)
      (0.2,-0.4)(0.5,-0.5)(0.7,-0.4)(0.5,-0.38)
      (0.2,-0.6)(0.5,-0.7)
    \psline[arrows=-](-0.1,0.7)(-0.1,-0.7)
    \psline[arrows=-](0,0.7)(0,-0.7)
    \psline[arrows=-](0.1,0.7)(0.1,-0.7)
    \pnode(-0.5,0.9){inup@}
    \pnode(-0.5,-0.9){indown@}
  \fi
  \pnode(0.5,-0.7){outdown@}
  \pnode(0.5,0.7){outup@}
}
% start hv 2003-07-23
\def\pst@draw@optoCoupler{%
% diode
  \pspolygon[linewidth=1.5\pslinewidth](-0.5,-0.25)(-0.7,0.25)(-0.3,0.25)
  \psline[arrows=-,linewidth=1.5\pslinewidth](-0.7,-0.25)(-0.3,-0.25)
  \psline{->}(-0.2,0.2)(0,0.1)
  \psline{->}(-0.2,0)(0,-0.1)
% transistor
  \psline[arrows=-,linewidth=4\pslinewidth](0.25,-0.3)(0.25,0.3)
  \psline[arrows=-,linewidth=1.5\pslinewidth](0.25,0)(0.75,0.5)
  \psline[arrows=-,linewidth=1.5\pslinewidth](0.25,0)(0.75,-0.5)
  \pnode(0.75,-0.5){d@1}
  \pnode(0.25,0){d@2}
  \ifx\psk@Ttype\pst@Ttype@PNP
    \ncline[arrows=-,linestyle=none,fillstyle=none]{d@1}{d@2}
  \else
    \ncline[arrows=-,linestyle=none,fillstyle=none]{d@2}{d@1}
  \fi
  \ncput[nrot=:U]{\psline[arrowinset=0,arrowscale=2]{->}(0,0)(.2,0)}
  \pnode(-0.5,0.25){inup@}
  \pnode(-0.5,-0.25){indown@}
  \pnode(0.75,-0.5){outdown@}
  \pnode(0.75,0.5){outup@}
}
%
\def\pst@draw@logic[#1]{\@ifnextchar({\pst@draw@logici[#1]}{\pst@draw@logici[#1](0,0)}}
%
\def\pst@draw@logici[#1](#2)#3{{%
  \psset{#1}%
  \rput[lb](#2){%
    \psframe[linewidth=2\pslinewidth](0,0)(\psk@logic@width,\psk@logic@height)%
  }
  \pst@getcoor{#2}\pst@tempa
  \ifPst@logicChangeLR\def\logic@LR{true}\else\def\logic@LR{false}\fi
  \pstVerb{
    /YA_log \pst@tempa exch pop \pst@number\psyunit div def
    /YB_log YA_log \psk@logic@height\space add def
    \logic@LR {%
      /XB_log \pst@tempa pop \pst@number\psxunit div def
      /XA_log XB_log \psk@logic@width\space add def
    }{%
      /XA_log \pst@tempa pop \pst@number\psxunit div def
      /XB_log XA_log \psk@logic@width\space add def
    } ifelse
    /dy YB_log YA_log sub def
  }
  \ifx\psk@logic@type\pst@logic@type@RS%---------------- RS -----------------
    \pnode(! XA_log YA_log dy 4 div add){#3S}
    \pnode(! XA_log YA_log dy 4 div 3 mul add){#3R}
    \psline(#3R)(! XA_log 0.5 \logic@LR {add}{sub} ifelse YA_log dy 4 div 3 mul add)
    \psline(#3S)(! XA_log 0.5 \logic@LR {add}{sub} ifelse YA_log dy 4 div add)
    \uput[\ifPst@logicChangeLR 180\else 0\fi](#3R){\psk@logic@nodestyle R}
    \uput[\ifPst@logicChangeLR 180\else 0\fi](#3S){\psk@logic@nodestyle S}
    \pnode(! XB_log 0.2 \logic@LR {sub}{add} ifelse YA_log dy 4 div add){#3Qneg}
    \pscircle[linewidth=0.5pt](! XB_log 0.1 \logic@LR {sub}{add} ifelse YA_log dy 4 div add){0.1}
    \pnode(! XB_log YA_log dy 4 div 3 mul add){#3Q}
    \psline(#3Q)(! XB_log \psk@logic@wireLength\space \logic@LR {sub}{add} ifelse YA_log dy 4 div 3 mul add)
    \psline(#3Qneg)(! XB_log \psk@logic@wireLength\space \logic@LR {sub}{add} ifelse YA_log dy 4 div add)
    \uput[\ifPst@logicChangeLR 0\else 180\fi](#3Q){\psk@logic@nodestyle Q}
    \uput{0.4}[\ifPst@logicChangeLR 0\else 180\fi](#3Qneg){\psk@logic@nodestyle $\mathrm{\overline{Q}}$}
    \ifPst@logicShowDot
      \qdisk(! XA_log \psk@logic@wireLength\space \logic@LR {add}{sub} ifelse YA_log dy 4 div 3 mul add){3pt}
      \qdisk(! XA_log \psk@logic@wireLength\space \logic@LR {add}{sub} ifelse YA_log dy 4 div add){3pt}
      \qdisk(! XB_log \psk@logic@wireLength\space \logic@LR {sub}{add} ifelse YA_log dy 4 div 3 mul add){3pt}
      \qdisk(! XB_log \psk@logic@wireLength\space \logic@LR {sub}{add} ifelse YA_log dy 4 div add){3pt}
    \fi
    \rput[b](!%
      /dx XB_log XA_log sub 2 div def
      XA_log dx add YA_log 0.1 add){\if$\psk@logic@labelstyle$\else\psk@logic@labelstyle#3\fi}
  \else
    \ifx\psk@logic@type\pst@logic@type@D%---------------- D -----------------
      \pnode(! XA_log YA_log dy 2 div add){#3C}
      \pnode(! XA_log YA_log dy 4 div 3 mul add){#3D}
      \psline(#3D)(! XA_log 0.5 \logic@LR {add}{sub} ifelse YA_log dy 4 div 3 mul add)
      \psline(#3C)(! XA_log 0.5 \logic@LR {add}{sub} ifelse YA_log dy 2 div add)
      \psline[linewidth=0.5pt](! XA_log YA_log dy 2 div add 0.15 add)
        (! XA_log 0.4 \logic@LR {sub}{add} ifelse YA_log dy 2 div add)(! XA_log YA_log dy 2 div add 0.15 sub)
      \uput[\ifPst@logicChangeLR 180\else 0\fi](#3D){\psk@logic@nodestyle D}
      \uput{0.5}[\ifPst@logicChangeLR 180\else 0\fi](#3C){\psk@logic@nodestyle C}
      \pnode(! XB_log 0.2 \logic@LR {sub}{add} ifelse YA_log dy 4 div add){#3Qneg}
      \pscircle[linewidth=0.5pt](! XB_log 0.1 \logic@LR {sub}{add} ifelse YA_log dy 4 div add){0.1}
      \pnode(! XB_log YA_log dy 4 div 3 mul add){#3Q}
      \psline(#3Q)(! XB_log 0.5 \logic@LR {sub}{add} ifelse YA_log dy 4 div 3 mul add)
      \psline(#3Qneg)(! XB_log 0.5 \logic@LR {sub}{add} ifelse YA_log dy 4 div add)
      \uput[\ifPst@logicChangeLR 0\else 180\fi](#3Q){\psk@logic@nodestyle Q}
      \uput{0.4}[\ifPst@logicChangeLR 0\else 180\fi](#3Qneg){\psk@logic@nodestyle $\mathrm{\overline{Q}}$}
      \ifPst@logicShowDot
        \qdisk(! XA_log 0.5 \logic@LR {add}{sub} ifelse YA_log dy 4 div 3 mul add){3pt}
        \qdisk(! XA_log 0.5 \logic@LR {add}{sub} ifelse YA_log dy 2 div add){3pt}
        \qdisk(! XB_log 0.5 \logic@LR {sub}{add} ifelse YA_log dy 4 div 3 mul add){3pt}
        \qdisk(! XB_log 0.5 \logic@LR {sub}{add} ifelse YA_log dy 4 div add){3pt}
      \fi
      \rput[b](!%
        /dx XB_log XA_log sub 2 div def
        XA_log dx add YA_log 0.1 add){\if$\psk@logic@labelstyle$\else\psk@logic@labelstyle#3\fi}
    \else
      \ifx\psk@logic@type\pst@logic@type@JK%---------------- JK -----------------
        \multido{\n=1+1}{\psk@logic@JInput}{%
          \pnode(!%
            /Step dy 2 div \psk@logic@JInput\space div def
            /yNew Step \n\space mul def
            XA_log YA_log yNew add Step 2 div sub){#3J\n}
          \pst@getcoor{#3J\n}\pst@tempc
          \uput[\ifPst@logicChangeLR 180\else 0\fi](#3J\n){\psk@logic@nodestyle J\n}
          \pnode(!
            /YC \pst@tempc exch pop \pst@number\psyunit div def
            /XC \pst@tempc pop \pst@number\psxunit div def
            XC 0.5 \logic@LR {add}{sub} ifelse YC){tempJ\n}
          \psline(#3J\n)(tempJ\n)% input
          \ifPst@logicShowDot
            \qdisk(tempJ\n){3pt}
          \fi
        }
        \multido{\n=1+1}{\psk@logic@KInput}{%
          \pnode(!%
            /Step dy 2 div \psk@logic@KInput\space div def
            /yNew Step \n\space mul def
            XA_log YB_log yNew sub Step 2 div add){#3K\n}
          \pst@getcoor{#3K\n}\pst@tempc
          \uput[\ifPst@logicChangeLR 180\else 0\fi](#3K\n){\psk@logic@nodestyle K\n}
          \pnode(!
            /YC \pst@tempc exch pop \pst@number\psyunit div def
            /XC \pst@tempc pop \pst@number\psxunit div def
            XC 0.5 \logic@LR {add}{sub} ifelse YC){tempK\n}
          \psline(#3K\n)(tempK\n)% input
          \ifPst@logicShowDot
            \qdisk(tempK\n){3pt}
          \fi
        }
        \psline[linewidth=0.5pt](! XA_log YA_log dy 2 div add 0.15 add)
          (! XA_log 0.4 \logic@LR {sub}{add} ifelse YA_log dy 2 div add)(! XA_log YA_log dy 2 div add 0.15 sub)
        \pnode(! XA_log YA_log dy 2 div add){#3C}
        \psline(#3C)(! XA_log 0.5 \logic@LR {add}{sub} ifelse YA_log dy 2 div add)
        \uput{0.5}[\ifPst@logicChangeLR 180\else 0\fi](#3C){\psk@logic@nodestyle C}
        \pnode(! XB_log 0.2 \logic@LR {sub}{add} ifelse YA_log dy 4 div add){#3Qneg}
        \pscircle[linewidth=0.5pt](! XB_log 0.1 \logic@LR {sub}{add} ifelse YA_log dy 4 div add){0.1}
        \pnode(! XB_log YA_log dy 4 div 3 mul add){#3Q}
        \psline(#3Q)(! XB_log 0.5 \logic@LR {sub}{add} ifelse YA_log dy 4 div 3 mul add)
        \psline(#3Qneg)(! XB_log 0.5 \logic@LR {sub}{add} ifelse YA_log dy 4 div add)
        \uput[\ifPst@logicChangeLR 0\else 180\fi](#3Q){\psk@logic@nodestyle Q}
        \uput{0.4}[\ifPst@logicChangeLR 0\else 180\fi](#3Qneg){\psk@logic@nodestyle $\mathrm{\overline{Q}}$}
        \ifPst@logicShowDot
          \qdisk(! XB_log 0.5 \logic@LR {sub}{add} ifelse YA_log dy 4 div 3 mul add){3pt}
          \qdisk(! XB_log 0.5 \logic@LR {sub}{add} ifelse YA_log dy 4 div add){3pt}
          \qdisk(! XA_log 0.5 \logic@LR {add}{sub} ifelse YA_log dy 2 div add){3pt}
    \fi
        \rput[b](!%
          /dx XB_log XA_log sub 2 div def
          XA_log dx add YA_log 0.1 add){\if$\psk@logic@labelstyle$\else\psk@logic@labelstyle#3\fi}
      \else%---------------- default AND/NAND/OR/NOR/NOT/EXOR/ENOR -----------------
        \ifx\psk@logic@type\pst@logic@type@not \def\@nMax{1}\else \def\@nMax{\psk@logic@nInput}\fi
        \multido{\n=1+1}{\@nMax}{%
          \pnode(!%
            /Step dy \psk@logic@nInput\space div def
            /yNew Step \n\space mul def
            XA_log YA_log yNew add \@nMax\space 1 gt {Step 2 div sub} if){#3\n}
          \pst@getcoor{#3\n}\pst@tempc
          \pnode(!
            /YC \pst@tempc exch pop \pst@number\psyunit div def
            /XC \pst@tempc pop \pst@number\psxunit div def
            XC \psk@logic@wireLength\space \logic@LR {add}{sub} ifelse YC){temp#3\n}
          \expandafter\psline\expandafter(#3\n)(temp#3\n)% input
          \ifPst@logicShowDot \qdisk(temp#3\n){3pt}\fi
          \ifPst@logicShowNode
            \uput[\ifPst@logicChangeLR 180\else 0\fi](#3\n){\psk@logic@nodestyle\n}
          \fi
        }
        \ifx\psk@logic@type\pst@logic@type@not\else
          \ifx\psk@logic@type\pst@logic@type@nand\else
            \ifx\psk@logic@type\pst@logic@type@nor\else
              \ifx\psk@logic@type\pst@logic@type@exnor\else
                \pnode(! XB_log YA_log dy 2 div add){#3Q}
                \psline(#3Q)(! XB_log \psk@logic@wireLength\space \logic@LR {sub}{add} ifelse YA_log dy 2 div add)% output
                \ifPst@logicShowDot
                  \qdisk(! XB_log \psk@logic@wireLength\space \logic@LR {sub}{add} ifelse YA_log dy 2 div add){3pt}
                \fi
                \ifPst@logicShowNode
                  \uput[\ifPst@logicChangeLR 0\else 180\fi](#3Q){\psk@logic@nodestyle Q}
                \fi
          \fi
        \fi
      \fi
    \fi
        \ifx\psk@logic@type\pst@logic@type@and\else%  NotX output
          \ifx\psk@logic@type\pst@logic@type@or\else
            \ifx\psk@logic@type\pst@logic@type@exor\else
              \pnode(! XB_log 0.2 \logic@LR {sub}{add} ifelse YA_log dy 2 div add){#3Q}
              \pscircle[linewidth=0.5pt](! XB_log 0.1 \logic@LR {sub}{add} ifelse YA_log dy 2 div add){0.1}
              \psline(#3Q)(! XB_log \psk@logic@wireLength\space \logic@LR {sub}{add} ifelse YA_log dy 2 div add)% output
              \ifPst@logicShowDot
                \qdisk(! XB_log \psk@logic@wireLength\space \logic@LR {sub}{add} ifelse YA_log dy 2 div add){3pt}
              \fi
              \ifPst@logicShowNode
                \uput{0.4}[\ifPst@logicChangeLR 0\else 180\fi](#3Q){\psk@logic@nodestyle Q}
              \fi
            \fi
          \fi
    \fi
        \ifx\psk@logic@type\pst@logic@type@or
          \def\logic@type{$\ge\kern-5pt 1$}
        \else
          \ifx\psk@logic@type\pst@logic@type@not
            \def\logic@type{1}
          \else
            \ifx\psk@logic@type\pst@logic@type@nand
              \def\logic@type{\&}
            \else
              \ifx\psk@logic@type\pst@logic@type@nor
                \def\logic@type{$\ge\kern-5pt 1$}
              \else
                \ifx\psk@logic@type\pst@logic@type@exor
                  \def\logic@type{=1}
                \else
                  \ifx\psk@logic@type\pst@logic@type@exnor
                    \def\logic@type{=}
                  \else
                    \def\logic@type{\&}
          \fi
        \fi
          \fi
            \fi
      \fi
        \fi
        \rput(!%
          /dx XB_log XA_log sub \psk@logic@symbolpos\space mul def
          XA_log dx add YB_log 0.3 sub){\if$\psk@logic@symbolstyle$\else\psk@logic@symbolstyle\textbf{\logic@type}\fi}
        \rput[b](!%
          /dx XB_log XA_log sub 2 div def
          XA_log dx add YA_log 0.1 add){\if$\psk@logic@labelstyle$\else\psk@logic@labelstyle#3\fi}
      \fi
    \fi
  \fi% end of no special RS/JK/D
}\ignorespaces}
%
% end hv 2003-07-28
%
\def\pst@draw@wire[#1](#2)(#3){{%
  \psset{#1}
  \ifx\psk@I@label\@empty\else\psset{intensity=true}\fi
  \ifx\psk@Dconvention\pst@Dconvention@generator
    \Pst@Dconventiontrue
  \else\ifx\psk@Dconvention\pst@Dconvention@receptor\Pst@Dconventionfalse\fi
  \fi
  \bgroup
  \pnode(#2){Inter@1}
  \pnode(#3){Inter@2}
  \psset{arrows=-}
  \ifPst@wire@intersect
    \rput(!
     /N@Inter@1 GetNode /N@Inter@2 GetNode /N@\psk@wire@intersectA\space
     GetNode /N@\psk@wire@intersectB\space GetNode InterLines
     \pst@number\psyunit div exch \pst@number\psxunit div exch){\pnode{@M}}%
    \ncline[linestyle=none,fillstyle=none]{Inter@1}{@M}
    \ncput[nrot=:U,npos=.85]{\pnode{@M1}}
    \ncline[linestyle=none,fillstyle=none]{@M}{Inter@2}
    \ncput[nrot=:U,npos=.15]{\pnode{@M2}}
    \psline(Inter@1)(@M1)
    \psline(@M2)(Inter@2)
    \ncarc[arcangle=90]{@M1}{@M2}
  \else
    \pcline(#2)(#3)
    \ifPst@intensity
      \ifPst@directconvention
        \ncput[nrot=:U]{%
          \psline[linecolor=\psk@I@color,
            linewidth=\psk@I@width,arrowinset=0]{->}(-.1,0)(.1,0)}
        \pcline[linestyle=none,fillstyle=none,offset=\psk@I@label@offset](#2)(#3)
        \ncput[nrot=\psk@label@angle]{\color{\psk@I@labelcolor}\psk@I@label}
      \else
        \ncput[nrot=:U]{%
          \psline[linecolor=\psk@I@color,linewidth=\psk@I@width]{<-}(-.1,0)(.1,0)}
        \pcline[linestyle=none,fillstyle=none,offset=\psk@I@label@offset](#2)(#3)
        \ncput[nrot=\psk@label@angle]{\color{\psk@I@labelcolor}\psk@I@label}
      \fi
    \fi
  \fi
  \egroup
  \ncline[linestyle=none]{Inter@1}{Inter@2}
}\ignorespaces}
%
%
\def\pst@draw@tension@[#1](#2)(#3)#4{{%
  \psset{#1}%
  \pnode(#2){pst@tempa} % hv
  \pnode(#3){pst@tempb} % hv
  \ncline[linestyle=none,fillstyle=none]{pst@tempa}{pst@tempb}
  \ncput[nrot=:U,npos=0.05]{\pnode{@M1}}
  \ncput[nrot=:U,npos=0.95]{\pnode{@M2}}
  \ncline[arrowinset=0,linecolor=\psk@tension@color]{->}{@M1}{@M2}
  \pcline[arrows=-,linestyle=none,fillstyle=none,offset=\psk@label@offset](@M1)(@M2)
  \ncput[nrot=\psk@label@angle]{\color{\psk@tension@labelcolor}#4}
}\ignorespaces}
%
\def\node(#1){\pscircle*(#1){2\pslinewidth}}
%
%
%
\define@boolkey[psset]{pst-circ}[Pst@]{inputarrow}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{programmable}[true]{}
\define@boolkey[psset]{pst-circ}[Pst@]{connectingdot}[true]{}
%
\def\pst@Gstyle@old{old}          \def\pst@Gstyle@ads{ads}       \def\pst@Gstyle@triangle{triangle}
\def\pst@Astyle@two{two}          \def\pst@Astyle@three{three}   \def\pst@Astyle@triangle{triangle}
\def\pst@LOoutput@left{left}      \def\pst@LOoutput@top{top}     \def\pst@LOoutput@right{right}
\def\pst@LOoutput@bottom{bottom}  \def\pst@LOstyle@crystal{crystal}\def\pst@Dstyle@lowpass{lowpass}
\def\pst@Dstyle@highpass{highpass}\def\pst@Dinput@right{right}   \def\pst@Dinput@left{left}
\def\pst@Dstyle@multiplier{multiplier}\def\pst@Dstyle@divider{divider}\def\pst@FMvalue@value{0}
\def\pst@tripole@style@bottom{bottom}\def\pst@tripole@style@top{top}\def\pst@Tinput@left{left}
\def\pst@Tinput@right{right}      \def\pst@tripole@style@circulator{circulator}
\def\pst@tripole@style@isolator{isolator}\def\pst@Tconfig@left{left}\def\pst@Tconfig@right{right}
\def\pst@Qstyle@directional{directional}\def\pst@Qstyle@hybrid{hybrid}\def\pst@Qinput@left{left}
\def\pst@Qinput@right{right}
\define@key[psset]{pst-circ}{groundstyle}[ads]{\def\psk@Gstyle{#1}}
\define@key[psset]{pst-circ}{antennastyle}[two]{\def\psk@Astyle{#1}}
\define@key[psset]{pst-circ}{output}[top]{\def\psk@LOoutput{#1}}
\define@key[psset]{pst-circ}{LOstyle}[]{\def\psk@LOstyle{#1}}
\define@key[psset]{pst-circ}{dipoleinput}[left]{\def\psk@Dinput{#1}}
\define@key[psset]{pst-circ}{value}[0]{\def\psk@FMvalue{#1}}
\define@key[psset]{pst-circ}{tripoleinput}[left]{\def\psk@Tinput{#1}}
\define@key[psset]{pst-circ}{tripoleconfig}[left]{\def\psk@Tconfig{#1}}
\define@key[psset]{pst-circ}{couplerstyle}[hxbrid]{\def\psk@Qstyle{#1}}
\define@key[psset]{pst-circ}{quadripoleinput}[left]{\def\psk@Qinput{#1}}
%
%
\psset{groundstyle=ads,     antennastyle=two,       output=top,%
        dipoleinput=left,   dipolestyle=multiplier, value=0,%
        dipoleinput=left,   inputarrow=false,       tripoleinput=left,%
        tripolestyle=bottom,tripoleconfig=left,     quadripoleinput=left,%
        couplerstyle=hybrid, connectingdot=true,    LOstyle={} }
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% monopole
%%% newground: groundstyle: (ads), old, triangle
%%% Antenna: antennastyle: (two), three, triangle
%%% Oscillator: oscioutput: (top), right, bottom, left, 
%%%             inputarrow: (false), true
%%% connectingdot: (true), false
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% newground %%%
\def\newground{\@ifnextchar[{\pst@newground}{\pst@newground[]}}
\def\pst@newground[#1]{%
    \@ifnextchar({\pst@newgroundi[#1]{0}}{\pst@newgroundi[#1]}%
}
\def\pst@newgroundi[#1]#2(#3){{% 
    \psset{#1}%
    \rput{#2}(#3){%
        \ifx\psk@Gstyle\pst@Gstyle@ads
            \psline[linewidth=1.5\pslinewidth]{c-c}(-0.3,-0.5)(0.3,-0.5)
            \psline[linewidth=1.5\pslinewidth]{c-c}(-0.2,-0.6)(0.2,-0.6)
            \psline[linewidth=1.5\pslinewidth]{c-c}(-0.1,-0.7)(0.1,-0.7)
        \fi
        \ifx\psk@Gstyle\pst@Gstyle@old
            \psline[linewidth=1.5\pslinewidth](-0.5,-0.5)(0.5,-0.5)
        \fi
        \ifx\psk@Gstyle\pst@Gstyle@triangle
            \pstriangle[linewidth=1.5\pslinewidth](0,-0.5)(0.4,-0.4)
        \fi
        \psline(0,0)(0,-0.5)
         \ifPst@connectingdot
            \pscircle*(0,0){2\pslinewidth}
        \fi
    }}%
    \ignorespaces%
}
%
%%% antenna %%%
%
\def\antenna{\@ifnextchar[{\pst@antenna}{\pst@antenna[]}}
\def\pst@antenna[#1]{%
    \@ifnextchar({\pst@antennai[#1]{0}}{\pst@antennai[#1]}%
}
\def\pst@antennai[#1]#2(#3){{%
    \psset{#1}%
    \rput{#2}(#3){%
        \ifx\psk@Astyle\pst@Astyle@two
            \psline[linewidth=1.5\pslinewidth](0,.75)(-0.2,1.25)
            \psline[linewidth=1.5\pslinewidth](0,.75)(0.2,1.25)
        \fi
        \ifx\psk@Astyle\pst@Astyle@three
            \psline[linewidth=1.5\pslinewidth](0,.75)(-0.2,1.25)
            \psline[linewidth=1.5\pslinewidth](0,.75)(0,1.25)
            \psline[linewidth=1.5\pslinewidth](0,.75)(0.2,1.25)
        \fi
        \ifx\psk@Astyle\pst@Astyle@triangle
            \pstriangle[linewidth=1.5\pslinewidth](0,1.25)(0.4,-0.5)
        \fi
        \psline(0,0)(0,.75)
    }}%
    \ignorespaces%
}
%
%%% oscillator %%%
%
\def\oscillator{\@ifnextchar[{\pst@oscillator}{\pst@oscillator[]}}
\def\pst@oscillator[#1]{%
    \@ifnextchar({\pst@oscillatori[#1]{0}}{\pst@oscillatori[#1]}%
}
\def\pst@oscillatori[#1]#2(#3)#4#5{{%
    \psset{#1}%
    \rput{#2}(#3){%
        \pscircle[#5,linewidth=1.5\pslinewidth](0,0){0.5}
        \ifx\psk@LOstyle\pst@LOstyle@crystal
            \psline(-0.2,-0.35)(-0.2,0.35)
            \psframe(-0.15,-0.3)(0.15,0.3)
            \psline(0.2,-0.35)(0.2,0.35)
        \else
          \pscurve[linewidth=1.5\pslinewidth]{cc}(-0.3,0.000)(-0.225,0.088375)(-0.15,0.1250)(-0.075,0.088375)%
		(0,0.000)(0.075,-0.088375)(0.15,-0.125)(0.225,-0.088375)(0.3,0.000)
        \fi
        \ifx\psk@LOoutput\pst@LOoutput@left
            \pst@getcoor{#3}\pst@tempa
            \pnode(! 5 dict begin
              \pst@tempa /Y1 exch \pst@number\psyunit div def
              /X1 exch \pst@number\psxunit div def
              /XC X1 def
              /YC Y1 -0.6 add def
              XC YC end){C@osciA}
            \rput[t]{#2}(C@osciA){#4}
            \ifPst@inputarrow
                \psline[arrows=->,arrowinset=0](-0.5,0)(-1,0)
            \else
                \psline(-0.5,0)(-1,0)
            \fi
        \fi
        \ifx\psk@LOoutput\pst@LOoutput@top
            \pst@getcoor{#3}\pst@tempa
            \pnode(! 5 dict begin
              \pst@tempa /Y1 exch \pst@number\psyunit div def
              /X1 exch \pst@number\psxunit div def
              /XC X1 def
              /YC Y1 -0.6 add def
              XC YC end ){C@osciB}
            \rput[t]{#2}(C@osciB){#4}
            \ifPst@inputarrow
                \psline[arrows=->,arrowinset=0](0,0.5)(0,1)
            \else
                \psline(0,0.5)(0,1)
            \fi
        \fi
        \ifx\psk@LOoutput\pst@LOoutput@right
            \pst@getcoor{#3}\pst@tempa
            \pnode(! 5 dict begin
              \pst@tempa /Y1 exch \pst@number\psyunit div def
              /X1 exch \pst@number\psxunit div def
              /XC X1 def
              /YC Y1 -0.6 add def
              XC YC end){C@osciC}
            \rput[t]{#2}(C@osciC){#4}
            \ifPst@inputarrow
                \psline[arrows=->,arrowinset=0](0.5,0)(1,0)
            \else
                \psline(0.5,0)(1,0)
            \fi
        \fi
        \ifx\psk@LOoutput\pst@LOoutput@bottom
            \pst@getcoor{#3}\pst@tempa
            \pnode(! 5 dict begin
              \pst@tempa /Y1 exch \pst@number\psyunit div def
              /X1 exch \pst@number\psxunit div def
              /XC X1 def
              /YC Y1 0.6 add def
              XC YC end){C@osciD}
            \rput[b]{#2}(C@osciD){#4}
            \ifPst@inputarrow
                \psline[arrows=->,arrowinset=0](0,-0.5)(0,-1)
            \else
                \psline(0,-0.5)(0,-1)
            \fi
        \fi
    }
  }\ignorespaces
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Dipole
%%% filtre:    dipolestyle: (bandpass), lowpass, highpass
%%%             inputarrow: (false), true
%%%             dipoleinput: (left), right
%%% isolator:  dipoleinput: (left), right
%%%             inputarrow: (false), true
%%% freqmult:    dipolestyle: (multiplier), divider, 
%%%                    value: (N), integer
%%%             programmable: (false) true
%%%             inputarrow: (false), true
%%%             dipoleinput: (left), right
%%% phaseshifter:
%%%             inputarrow: (false), true
%%%             dipoleinput: (left), right
%%% vco:
%%%             inputarrow: (false), true
%%%             dipoleinput: (left), right
%%% amplifier: 
%%%             inputarrow: (false), true
%%%             dipoleinput: (left), right
%%% detector: 
%%%             inputarrow: (false), true
%%%             dipoleinput: (left), right
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% FILTER %%%
%
\newCircDipole{filter}%
\def\pst@draw@filter{%
    \pnode(-0.5,0){dipole@1}
    \pnode(0.5,0){dipole@2}
    \psframe[linewidth=1.5\pslinewidth](-0.5,-0.5)(0.5,0.5)
    \pscurve[linewidth=1.5\pslinewidth]{c-c}(-0.4,0.250)(-0.2,0.3750)(0,0.250)(0.2,0.1250)(0.4,0.250)
    \pscurve[linewidth=1.5\pslinewidth]{c-c}(-0.4,0.000)(-0.2,0.1250)(0,0.000)(0.2,-0.125)(0.4,0.000)
    \pscurve[linewidth=1.5\pslinewidth]{c-c}(-0.4,-0.25)(-0.2,-0.125)(0,-0.25)(0.2,-0.375)(0.4,-0.25)
%        \psline{c-c}(-0.1,0.2)(0.1,0.3)
    \ifx\psk@Dstyle\pst@Dstyle@lowpass
        \psline[fillstyle=none]{c-c}(-0.1,0.2)(0.1,0.3)
        \psline[fillstyle=none]{c-c}(-0.1,-0.05)(0.1,0.05)
    \else
        \ifx\psk@Dstyle\pst@Dstyle@highpass
            \psline[fillstyle=none]{c-c}(-0.1,-0.3)(0.1,-0.2)
            \psline[fillstyle=none]{c-c}(-0.1,-0.05)(0.1,0.05)
        \else
            \psline[fillstyle=none]{c-c}(-0.1,0.2)(0.1,0.3)
            \psline[fillstyle=none]{c-c}(-0.1,-0.3)(0.1,-0.2)
        \fi
    \fi
}

%%% ISOLATOR %%%
%
\newCircDipole{isolator}
\def\pst@draw@isolator{%
    \pnode(-0.5,0){dipole@1}
    \pnode(0.5,0){dipole@2}
    \psframe[linewidth=1.5\pslinewidth](-0.5,-0.5)(0.5,0.5)
    \ifx\psk@Dinput\pst@Dinput@right
        \psline[fillstyle=none,linewidth=1.5\pslinewidth,arrowinset=0]{<-}(-0.4,0)(0.4,0)
    \else
        \psline[fillstyle=none,linewidth=1.5\pslinewidth,arrowinset=0]{->}(-0.4,0)(0.4,0)
    \fi
}
%
%%% Frequency Multiplier or Divider %%%
\newCircDipole{freqmult}
\def\pst@draw@freqmult{%
    \pnode(-0.5,0){dipole@1}
    \pnode(0.5,0){dipole@2}
    \psframe[linewidth=1.5\pslinewidth](-0.5,-0.5)(0.5,0.5)
    \ifPst@programmable%
        \psline[fillstyle=none](-0.4,-0.75)(-0.4,-0.5)
        \psline[fillstyle=none](-0.2,-0.75)(-0.2,-0.5)
        \psline(0,-0.75)(0,-0.5)
        \psline[fillstyle=none](0.2,-0.75)(0.2,-0.5)
        \psline[fillstyle=none](0.4,-0.75)(0.4,-0.5)
        \ifx\psk@Dstyle\pst@Dstyle@divider
            \rput(0,0){$\div\textrm{N}$}
        \else
            \rput(0,0){$\times\textrm{N}$}
        \fi
    \else
        \ifx\psk@FMvalue\pst@FMvalue@value
            \ifx\psk@Dstyle\pst@Dstyle@divider
                \rput(0,0){$\div\textrm{N}$}
            \else
                \rput(0,0){$\times\textrm{N}$}
            \fi
        \else
            \ifx\psk@Dstyle\pst@Dstyle@divider
                \rput(0,0){$\div\textrm{\psk@FMvalue}$}
            \else
                \rput(0,0){$\times\textrm{\psk@FMvalue}$}
            \fi
        \fi
    \fi%
}
%
%%% phaseshifter
\newCircDipole{phaseshifter}
\def\pst@draw@phaseshifter{%
    \pnode(-0.4,0){dipole@1}
    \pnode(0.4,0){dipole@2}
    \pscircle[linewidth=1.5\pslinewidth](0,0){0.4}
    \psline[fillstyle=none,linewidth=1.5\pslinewidth,arrowinset=0]{->}(-0.5,-0.5)(0.5,0.5)
}
%
%%% VCO
\newCircDipole{vco}
\def\pst@draw@vco{%
    \pnode(-0.5,0){dipole@1}
    \pnode(0.5,0){dipole@2}
    \pscircle[linewidth=1.5\pslinewidth](0,0){0.5}
    \pscurve[linewidth=1.5\pslinewidth]{c-c}(-0.3,0.000)(-0.225,0.088375)(-0.15,0.1250)(-0.075,0.088375)%
                                    (0,0.000)(0.075,-0.088375)(0.15,-0.125)(0.225,-0.088375)(0.3,0.000)
}
%
%%% amplifier %%%
%
\newCircDipole{amplifier}
\def\pst@draw@amplifier{%
    \pnode(-0.433,0){dipole@1}
    \pnode(0.433,0){dipole@2}
    \ifx\psk@Dinput\pst@Dinput@right
        \pstriangle[gangle=90,linewidth=1.5\pslinewidth](0.433,0)(1,0.866)
    \else
        \pstriangle[gangle=-90,linewidth=1.5\pslinewidth](-0.433,0)(1,0.866)
    \fi
}
%
%%% detector %%%
%
\newCircDipole{detector}
\def\pst@draw@detector{%
    \pnode(-0.5,0){dipole@1}
    \psline[fillstyle=none](-0.5,0)(-0.2165,0)
    \pnode(0.5,0){dipole@2}
    \psline[fillstyle=none](0.5,0)(0.2165,0)
    \psframe[linewidth=1.5\pslinewidth](-0.5,-0.5)(0.5,0.5)
    \ifx\psk@Dinput\pst@Dinput@right
        \pstriangle[gangle=90,linewidth=1.5\pslinewidth,fillstyle=none](0.2165,0)(0.5,0.433)
        \psline[fillstyle=none,linewidth=1.5\pslinewidth](-0.2165,-0.25)(-0.2165,0.25)
    \else
        \pstriangle[gangle=-90,linewidth=1.5\pslinewidth,fillstyle=none](-0.2165,0)(0.5,0.433)
        \psline[fillstyle=none,linewidth=1.5\pslinewidth](0.2165,-0.25)(0.2165,0.25)
    \fi
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Tripole
%%% mixer: tripolestyle:(bottom), top
%%%          inputarrow: (false) | true
%%%       tripoleinput: (left) | right
%%% Circulator: tripolestyle=(circulator), isolator
%%%       tripoleconfig: (left) | right
%%%          inputarrow: (false) | true
%%%       tripoleinput: (left) | right
%%% AGC: tripoleinput=(left)|right
%%%          inputarrow: (false) | true
%%%       tripoleinput: (left) | right
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\mixer{\pst@object{mixer}}
\def\mixer@i(#1)(#2)(#3)#4#5{%
  \pst@getcoor{#1}\pst@tempa
  \pst@getcoor{#2}\pst@tempb
  \pst@getcoor{#3}\pst@tempc
  \pnode(!%
    \pst@tempa /Y1 exch \pst@number\psyunit div def
    /X1 exch \pst@number\psxunit div def
    \pst@tempb /Y2 exch \pst@number\psyunit div def
    /X2 exch \pst@number\psxunit div def
    \pst@tempc /Y3 exch \pst@number\psyunit div def
    /X3 exch \pst@number\psxunit div def
    /XC X1 X2 add 2 div def
    /YC Y2 def
    XC YC){C@}
  \begingroup
  \use@keep@par
  \ifx\psk@tripole@style\pst@tripole@style@top
    \addbefore@par{labeloffset=-0.9,dimen=middle}%
  \else
    \addbefore@par{labeloffset=0.9,dimen=middle}%
  \fi
  \use@par
  \rput(C@){\pst@draw@mixer{#3}{#4}{#5}}
  \endgroup
  \ifx\psk@Tinput\pst@Tinput@left%
    \ifPst@inputarrow
        \ncangle[arrows=->,arrowinset=0,arm=0.5,angleB=180]{#1}{Tport@left}
    \else
        \ncangle[arrows=-,arm=0.5,angleB=180]{#1}{Tport@left}
    \fi
    \ncangle[arrows=-,arm=0.5,angleB=0]{#2}{Tport@right}
  \else
    \ifPst@inputarrow
        \ncangle[arrows=<-,arrowinset=0,arm=0.5,angleB=180]{Tport@right}{#2}
    \else
        \ncangle[arrows=-,arm=0.5,angleB=180]{Tport@right}{#2}
    \fi
    \ncangle[arrows=-,arm=0.5,angleB=180]{#1}{Tport@left}
  \fi
  \pcline[linestyle=none](#1)(#2)% for the endarrows
  \pcline[linestyle=none](#2)(#3)% for the endarrows
  \ignorespaces%
}
\def\pst@draw@mixer#1#2#3{%
  \pscircle[#3,linewidth=1.5\pslinewidth](0,0){0.5}
  \let\psk@fillstyle\psfs@none
  \psline[linewidth=1.5\pslinewidth](-0.3535,-0.3535)(0.3535,0.3535)
  \psline[linewidth=1.5\pslinewidth](-0.3535,0.3535)(0.3535,-0.3535)
  \pnodes(-0.5,0){Tport@left}(0.5,0){Tport@right}
  \pcline[linestyle=none,offset=\psk@label@offset](Tport@left)(Tport@right)\ncput{#2}
  \ifx\psk@tripole@style\pst@tripole@style@top%
    \pnode(0,0.5){Tport@center}
    \ifPst@inputarrow
        \ncangle[arrows=->,arrowinset=0,arm=0.5,angleB=90]{#1}{Tport@center}
    \else
        \ncangle[arrows=-,arm=0.5,angleB=90]{#1}{Tport@center}
    \fi
  \else
    \pnode(0,-0.5){Tport@center}
    \ifPst@inputarrow
        \ncangle[arrows=->,arrowinset=0,arm=0.5,angleB=-90]{#1}{Tport@center}
    \else
        \ncangle[arrows=-,arm=0.5,angleB=-90]{#1}{Tport@center}
    \fi%
  \fi%
}
%
%%% Circulator
%
\def\circulator{\pst@object{circulator}}
\def\circulator@i#1(#2)(#3)(#4)#5#6{%
  \addbefore@par{dimen=middle}%
  \begin@ClosedObj
  \pst@getcoor{#2}\pst@tempa
  \pst@getcoor{#3}\pst@tempb
  \pst@getcoor{#4}\pst@tempc
  \pnode(!%
    \pst@tempa /Y1 exch \pst@number\psyunit div def
    /X1 exch \pst@number\psxunit div def
    \pst@tempb /Y2 exch \pst@number\psyunit div def
    /X2 exch \pst@number\psxunit div def
    \pst@tempc /Y3 exch \pst@number\psyunit div def
    /X3 exch \pst@number\psxunit div def
    /XC X1 X2 add 2 div def
    /YC Y1 Y2 add 2 div def
    XC YC){C@}
  \rput{#1}(C@){\pst@draw@circulator{#4}{#5}{#6}}
  \nput{! 90 #1 add}{Tport@label}{#5}
  \ifPst@inputarrow
    \ncline[arrows=->,arrowinset=0]{#2}{Tport@input} %,arm=0.5,angleB=180
  \else
    \ncline[arrows=-]{#2}{Tport@input}
  \fi
  \ncline[arrows=-]{#3}{Tport@output} %,arm=0.5,angleB=0
  \pcline[linestyle=none](#2)(#3)% for the endarrows
  \pcline[linestyle=none](#3)(#4)% for the endarrows
  \end@ClosedObj
  \ignorespaces%
}
\def\pst@draw@circulator#1#2#3{%
  \pscircle[#3,linewidth=1.5\pslinewidth](0,0){0.5}%
  \pnode(0,0.6){Tport@label}%
  \ifx\psk@Tconfig\pst@Tconfig@left%
    \psarc[linewidth=1.5\pslinewidth,arrowinset=0]{<-}{0.35}{15}{155}
    \pnode(-0.5,0){Tport@input}
    \pnode(0.5,0){Tport@output}
  \else
    \psarc[linewidth=1.5\pslinewidth,arrowinset=0]{->}{0.35}{25}{165}
    \pnode(-0.5,0){Tport@output}
    \pnode(0.5,0){Tport@input}
  \fi%
  \ifx\psk@tripole@style\pst@tripole@style@isolator%
    \psline(0,-0.5)(0,-0.95)%
    \multips{0}(-0.225,-1)(0.1,0){5}%
        {\psline[arrows=-,linewidth=1.5\pslinewidth](0,0)(0.025,0.05)(0.075,-0.05)(0.1,0)}%
  \else
    \pnode(0,-0.5){Tport@center}%
    \ncline[arrows=-]{#1}{Tport@center}
  \fi%
}
%
%%% AGC
\def\agc{\pst@object{agc}}
\def\agc@i(#1)(#2)(#3)#4#5{%
  \addbefore@par{dimen=middle}%
  \begin@ClosedObj
  \pst@getcoor{#1}\pst@tempa
  \pst@getcoor{#2}\pst@tempb
  \pst@getcoor{#3}\pst@tempc
  \pnode(!%
    \pst@tempa /Y1 exch \pst@number\psyunit div def
    /X1 exch \pst@number\psxunit div def
    \pst@tempb /Y2 exch \pst@number\psyunit div def
    /X2 exch \pst@number\psxunit div def
    \pst@tempc /Y3 exch \pst@number\psyunit div def
    /X3 exch \pst@number\psxunit div def
    /XC X1 X2 add 2 div def
    /YC Y2 def
    XC YC){C@}
  \rput(C@){\pst@draw@agc{#1}{#2}{#4}{#5}}
  \ncangle[arrows=-,arm=0.5,angleB=-90]{#3}{Tport@center}
  \pcline[linestyle=none](#1)(#2)% for the endarrows
  \pcline[linestyle=none](#2)(#3)% for the endarrows
  \end@ClosedObj
  \ignorespaces%
}
\def\pst@draw@agc#1#2#3#4{%
  \pnode(-0.433,0){Tport@left}
  \pnode(0.433,0){Tport@right}
  \pnode(0,-0.5){Tport@center}
  \rput[b](0,0.6){#3}
  \psline[arrows=->,arrowinset=0](0,-0.5)(0,-0.25)
  \ifx\psk@Tinput\pst@Tinput@left%
    \pstriangle[#4,gangle=-90,linewidth=1.5\pslinewidth](-0.433,0)(1,0.866)
    \psline[linewidth=1.5\pslinewidth,arrows=->,arrowinset=0](-0.55,-0.5)(0.25,0.5)
    \ifPst@inputarrow
        \ncangle[arrows=->,arrowinset=0,arm=0.5,angleB=180]{#1}{Tport@left}
    \else
        \ncangle[arrows=-,arm=0.5,angleB=180]{#1}{Tport@left}
    \fi
    \ncangle[arrows=-,arm=0.5,angleB=0]{#2}{Tport@right}
  \else
    \pstriangle[#4,gangle=90,linewidth=1.5\pslinewidth](0.433,0)(1,0.866)
    \psline[linewidth=1.5\pslinewidth,arrows=->,arrowinset=0](0.55,-0.5)(-0.25,0.5)
    \ifPst@inputarrow
        \ncangle[arrows=<-,arrowinset=0,arm=0.5,angleB=180]{Tport@right}{#2}
    \else
        \ncangle[arrows=-,arm=0.5,angleB=180]{Tport@right}{#2}
    \fi
    \ncangle[arrows=-,arm=0.5,angleB=180]{#1}{Tport@left}%
  \fi%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Quadripole
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Coupler %%%
\def\coupler{\pst@object{coupler}}
\def\coupler@i(#1)(#2)(#3)(#4)#5#6{%
  \addbefore@par{dimen=middle,arm=0}%
  \begin@ClosedObj%
  \pst@getcoor{#1}\pst@tempa
  \pst@getcoor{#2}\pst@tempb
  \pst@getcoor{#3}\pst@tempc
  \pst@getcoor{#4}\pst@tempd
  \pnode(!%
    \pst@tempa /Y1 exch \pst@number\psyunit div def
    /X1 exch \pst@number\psxunit div def
    \pst@tempb /Y2 exch \pst@number\psyunit div def
    /X2 exch \pst@number\psxunit div def
    \pst@tempc /Y3 exch \pst@number\psyunit div def
    /X3 exch \pst@number\psxunit div def
    \pst@tempd /Y4 exch \pst@number\psyunit div def
    /X4 exch \pst@number\psxunit div def
    /XC X1 X2 lt {X2} {X1} ifelse X3 X4 lt {X3} {X4} ifelse add 2 div def
    /YC Y1 -0.4 add def
    XC YC){C@}
  \rput(C@){\pst@draw@coupler{#6}}
  \ncangle[arrows=-,angleA=0,angleB=-180]{#1}{inup@}
  \ncangle[arrows=-,angleA=180,angleB=0]{#3}{outup@}
  \ifx\psk@Qinput\pst@Qinput@left%
    \ifx\psk@Qstyle\pst@Qstyle@hybrid
        \ncangle[arrows=-,angleA=0,angleB=-180]{#2}{indown@}
    \fi
    \ncangle[arrows=-,angleA=180,angleB=0]{#4}{outdown@}
  \else
    \ncangle[arrows=-,angleA=0,angleB=-180]{#2}{indown@}
    \ifx\psk@Qstyle\pst@Qstyle@hybrid
        \ncangle[arrows=-,angleA=180,angleB=0]{#4}{outdown@}
    \fi
  \fi
%  \ncangle[arrows=-,angleA=180,angleB=0]{#4}{outdown@}
  \ncline[arrows=-,linestyle=none,fillstyle=none]{inup@}{outup@}
  \naput{#5}
  \pcline[linestyle=none](#1)(#3)% for the end arrows
  \pcline[linestyle=none](#2)(#4)% for the end arrows
  \end@ClosedObj%
  \ignorespaces%
}
%
\def\pst@draw@coupler#1{%
    \pnode(-0.75,0.4){inup@}
    \pnode(0.75,0.4){outup@}
    \psframe[#1,linewidth=1.5\pslinewidth](-0.5,-0.5)(0.5,0.5)
    \psline(-0.5,0.4)(0.5,0.4)
    \psline(-0.5,-0.4)(0.5,-0.4)
    \psline(-0.4,0.35)(0.4,-0.35)
    \psline(-0.4,-0.35)(0.4,0.35)
%
    \ifx\psk@Qinput\pst@Qinput@left%
        \pnode(0.75,-0.4){outdown@}
        \ifPst@inputarrow%
            \psline[arrows=->,arrowinset=0](-0.75,0.4)(-0.5,0.4)
        \else
            \psline(-0.75,0.4)(-0.5,0.4)
        \fi
        \psline(0.5,0.4)(0.75,0.4)
        \psline(0.5,-0.4)(0.75,-0.4)
        \ifx\psk@Qstyle\pst@Qstyle@hybrid
            \pnode(-0.75,-0.4){indown@}
            \ifPst@inputarrow%
                \psline[arrows=->,arrowinset=0](-0.75,-0.4)(-0.5,-0.4)
            \else
                \psline(-0.75,-0.4)(-0.5,-0.4)
            \fi
        \else
            \ifx\psk@Qstyle\pst@Qstyle@directional
                \psline[arrows=-,linewidth=1.5\pslinewidth](-0.8,-0.75)(-0.8,-0.675)
                \multips{90}(-0.8,-0.675)(0,0.1){4}%
                    {\psline[arrows=-,linewidth=1.5\pslinewidth](0,0)(0.025,0.05)(0.075,-0.05)(0.1,0)}%
                \psline[arrows=-,linewidth=1.5\pslinewidth](-0.8,-0.275)(-0.8,-0.2)
                \psline(-0.75,-0.4)(-0.5,-0.4)
            \fi
        \fi
    \else
        \pnode(-0.75,-0.4){indown@}
        \ifPst@inputarrow
            \psline[arrows=->,arrowinset=0](0.75,0.4)(0.5,0.4)
        \else
            \psline(0.75,0.4)(0.5,0.4)
        \fi
        \psline(-0.5,0.4)(-0.75,0.4)
        \psline(-0.5,-0.4)(-0.75,-0.4)
        \ifx\psk@Qstyle\pst@Qstyle@hybrid
            \pnode(0.75,-0.4){outdown@}
            \ifPst@inputarrow%
                \psline[arrows=->,arrowinset=0](0.75,-0.4)(0.5,-0.4)
            \else
                \psline(0.75,-0.4)(0.5,-0.4)
            \fi
        \else
            \ifx\psk@Qstyle\pst@Qstyle@directional
                \psline[arrows=-,linewidth=1.5\pslinewidth](0.8,-0.75)(0.8,-0.675)
                \multips{90}(0.8,-0.675)(0,0.1){4}%
                    {\psline[arrows=-,linewidth=1.5\pslinewidth](0,0)(0.025,0.05)(0.075,-0.05)(0.1,0)}%
                \psline[arrows=-,linewidth=1.5\pslinewidth](0.8,-0.275)(0.8,-0.2)
                \psline(0.75,-0.4)(0.5,-0.4)
            \fi%
        \fi%
    \fi%
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\logicic{\@ifnextchar[{\pst@intcirc}{\pst@intcirc[]}}
\def\pst@intcirc[#1]{\@ifnextchar({\pst@intcirci[#1]{0}}{\pst@intcirci[#1]}}
\def\pst@intcirci[#1]#2(#3)#4{{%
	\psset{#1}%		
	\rput{#2}(#3){
	% IC Styles
	\ifcase\psk@nicpins
		%
		% 8-Pin DIP IC
		%
		\def\icheight{2.5}
		\def\icwidth{3.5}
		\def\icleft{1.75}
		\def\icmid{2.25}
		\def\icright{2.75}
		% a
		\ifPst@pina
			\psline(0,2)(1,2) % Input a
			\uput[r](1,2){\small{\psk@pinalabel}} % Name a
			\uput[u](0.5,1.9){\small{\psk@pinanumber}} % Number a
			\ifPst@invertpina
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 2){{\psk@bubblesize}} % Invert Input a
			\fi
		\fi
		% b
		\ifPst@pinb
			\psline(0,1.5)(1,1.5) % Input b
			\uput[r](1,1.5){{\psk@pinblabel}} % Name b
			\uput[u](0.5,1.4){{\psk@pinbnumber}} % Number b
			\ifPst@invertpinb
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.5){{\psk@bubblesize}} % Invert Input b
			\fi
		\fi
		% c
		\ifPst@pinc
			\psline(0,1)(1,1) % Input c
			\uput[r](1,1){{\psk@pinclabel}} % Name c
			\uput[u](0.5,0.9){{\psk@pincnumber}} % Number c
			\ifPst@invertpinc
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1){{\psk@bubblesize}} % Invert Input c
			\fi
		\fi
		% d
		\ifPst@pind
			\psline(0,0.5)(1,0.5) % Input d
			\uput[r](1,0.5){{\psk@pindlabel}} % Name d
			\uput[u](0.5,0.4){{\psk@pindnumber}} % Number d
			\ifPst@invertpind
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 0.5){{\psk@bubblesize}} % Invert Input d
			\fi
		\fi
		% e
		\ifPst@pine
			\psline(3.5,0.5)(4.5,0.5) % Input e
			\uput[l](3.5,0.5){{\psk@pinelabel}} % Name e
			\uput[u](4,0.4){{\psk@pinenumber}} % Number e
			\ifPst@invertpine
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 0.5){{\psk@bubblesize}} % Invert Input e
			\fi
		\fi
		% f
		\ifPst@pinf
			\psline(3.5,1)(4.5,1) % Input f
			\uput[l](3.5,1){{\psk@pinflabel}} % Name f
			\uput[u](4,0.9){{\psk@pinfnumber}} % Number f
			\ifPst@invertpinf
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 1){{\psk@bubblesize}} % Invert Input f
			\fi
		\fi
		% g
		\ifPst@ping
			\psline(3.5,1.5)(4.5,1.5) % Input g
			\uput[l](3.5,1.5){{\psk@pinglabel}} % Name g
			\uput[u](4,1.4){{\psk@pingnumber}} % Number g
			\ifPst@invertping
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 1.5){{\psk@bubblesize}} % Invert Input g
			\fi
		\fi
		% h
		\ifPst@pinh
			\psline(3.5,2)(4.5,2) % Input h
			\uput[l](3.5,2){{\psk@pinhlabel}} % Name h
			\uput[u](4,1.9){{\psk@pinhnumber}} % Number h
			\ifPst@invertpinh
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 2){{\psk@bubblesize}} % Invert Input h
			\fi
		\fi
		% Body
		\psline[linewidth=1.5\pslinewidth](1,0)(1,2.5)(3.5,2.5)(3.5,0)(1,0)
	\or
		%
		% 14-Pin DIP IC
		%
		\def\icheight{4}
		\def\icwidth{3.5}
		\def\icleft{1.75}
		\def\icmid{2.25}
		\def\icright{2.75}
		% a
		\ifPst@pina
			\psline(0,3.5)(1,3.5) % Input a
			\uput[r](1,3.5){{\psk@pinalabel}} % Name a
			\uput[u](0.5,3.4){{\psk@pinanumber}} % Number a
			\ifPst@invertpina
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 3.5){{\psk@bubblesize}} % Invert Input a
			\fi
		\fi
		% b
		\ifPst@pinb
			\psline(0,3)(1,3) % Input b
			\uput[r](1,3){{\psk@pinblabel}} % Name b
			\uput[u](0.5,2.9){{\psk@pinbnumber}} % Number b
			\ifPst@invertpinb
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 3){{\psk@bubblesize}} % Invert Input b
			\fi
		\fi
		% c
		\ifPst@pinc
			\psline(0,2.5)(1,2.5) % Input c
			\uput[r](1,2.5){{\psk@pinclabel}} % Name c
			\uput[u](0.5,2.4){{\psk@pincnumber}} % Number c
			\ifPst@invertpinc
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 2.5){{\psk@bubblesize}} % Invert Input c
			\fi
		\fi
		% d
		\ifPst@pind
			\psline(0,2)(1,2) % Input d
			\uput[r](1,2){{\psk@pindlabel}} % Name d
			\uput[u](0.5,1.9){{\psk@pindnumber}} % Number d
			\ifPst@invertpind
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 2){{\psk@bubblesize}} % Invert Input d
			\fi
		\fi
		% e
		\ifPst@pine
			\psline(0,1.5)(1,1.5) % Input e
			\uput[r](1,1.5){{\psk@pinelabel}} % Name e
			\uput[u](0.5,1.4){{\psk@pinenumber}} % Number e
			\ifPst@invertpine
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.5){{\psk@bubblesize}} % Invert Input e
			\fi
		\fi
		% f
		\ifPst@pinf
			\psline(0,1)(1,1) % Input f
			\uput[r](1,1){{\psk@pinflabel}} % Name f
			\uput[u](0.5,0.9){{\psk@pinfnumber}} % Number f
			\ifPst@invertpinf
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1){{\psk@bubblesize}} % Invert Input f
			\fi
		\fi
		% g
		\ifPst@ping
			\psline(0,0.5)(1,0.5) % Input g
			\uput[r](1,0.5){{\psk@pinglabel}} % Name g
			\uput[u](0.5,0.4){{\psk@pingnumber}} % Number g
			\ifPst@invertping
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 0.5){{\psk@bubblesize}} % Invert Input g
			\fi
		\fi
		% h
		\ifPst@pinh
			\psline(3.5,0.5)(4.5,0.5) % Input h
			\uput[l](3.5,0.5){{\psk@pinhlabel}} % Name h
			\uput[u](4,0.4){{\psk@pinhnumber}} % Number h
			\ifPst@invertpinh
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 0.5){{\psk@bubblesize}} % Invert Input h
			\fi
		\fi
		% i
		\ifPst@pini
			\psline(3.5,1)(4.5,1) % Input i
			\uput[l](3.5,1){{\psk@pinilabel}} % Name i
			\uput[u](4,0.9){{\psk@pininumber}} % Number i
			\ifPst@invertpini
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 1){{\psk@bubblesize}} % Invert Input i
			\fi
		\fi
		% j
		\ifPst@pinj
			\psline(3.5,1.5)(4.5,1.5) % Input j
			\uput[l](3.5,1.5){{\psk@pinjlabel}} % Name j
			\uput[u](4,1.4){{\psk@pinjnumber}} % Number j
			\ifPst@invertpinj
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 1.5){{\psk@bubblesize}} % Invert Input j
			\fi
		\fi
		% k
		\ifPst@pink
			\psline(3.5,2)(4.5,2) % Input k
			\uput[l](3.5,2){{\psk@pinklabel}} % Name k
			\uput[u](4,1.9){{\psk@pinknumber}} % Number k
			\ifPst@invertpink
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 2){{\psk@bubblesize}} % Invert Input k
			\fi
		\fi
		% l
		\ifPst@pinl
			\psline(3.5,2.5)(4.5,2.5) % Input l
			\uput[l](3.5,2.5){{\psk@pinllabel}} % Name l
			\uput[u](4,2.4){{\psk@pinlnumber}} % Number l
			\ifPst@invertpinl
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 2.5){{\psk@bubblesize}} % Invert Input l
			\fi
		\fi
		% m
		\ifPst@pinm
			\psline(3.5,3)(4.5,3) % Input m
			\uput[l](3.5,3){{\psk@pinmlabel}} % Name m
			\uput[u](4,2.9){{\psk@pinmnumber}} % Number m
			\ifPst@invertpinm
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 3){{\psk@bubblesize}} % Invert Input m
			\fi
		\fi
		% n
		\ifPst@pinn
			\psline(3.5,3.5)(4.5,3.5) % Input n
			\uput[l](3.5,3.5){{\psk@pinnlabel}} % Name n
			\uput[u](4,3.4){{\psk@pinnnumber}} % Number n
			\ifPst@invertpinn
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 3.5){{\psk@bubblesize}} % Invert Input n
			\fi
		\fi
		% Body
		\psline[linewidth=1.5\pslinewidth](1,0)(1,4)(3.5,4)(3.5,0)(1,0)
	\or
		%
		% 16-Pin DIP IC
		%
		\def\icheight{4.5}
		\def\icwidth{3.5}
		\def\icleft{1.75}
		\def\icmid{2.25}
		\def\icright{2.75}
		% a
		\ifPst@pina
			\psline(0,4)(1,4) % Input a
			\uput[r](1,4){{\psk@pinalabel}} % Name a
			\uput[u](0.5,3.9){{\psk@pinanumber}} % Number a
			\ifPst@invertpina
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 4){{\psk@bubblesize}} % Invert Input a
			\fi
		\fi
		% b
		\ifPst@pinb
			\psline(0,3.5)(1,3.5) % Input b
			\uput[r](1,3.5){{\psk@pinblabel}} % Name b
			\uput[u](0.5,3.4){{\psk@pinbnumber}} % Number b
			\ifPst@invertpinb
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 3.5){{\psk@bubblesize}} % Invert Input b
			\fi
		\fi
		% c
		\ifPst@pinc
			\psline(0,3)(1,3) % Input c
			\uput[r](1,3){{\psk@pinclabel}} % Name c
			\uput[u](0.5,2.9){{\psk@pincnumber}} % Number c
			\ifPst@invertpinc
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 3){{\psk@bubblesize}} % Invert Input c
			\fi
		\fi
		% d
		\ifPst@pind
			\psline(0,2.5)(1,2.5) % Input d
			\uput[r](1,2.5){{\psk@pindlabel}} % Name d
			\uput[u](0.5,2.4){{\psk@pindnumber}} % Number d
			\ifPst@invertpind
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 2.5){{\psk@bubblesize}} % Invert Input d
			\fi
		\fi
		% e
		\ifPst@pine
			\psline(0,2)(1,2) % Input e
			\uput[r](1,2){{\psk@pinelabel}} % Name e
			\uput[u](0.5,1.9){{\psk@pinenumber}} % Number e
			\ifPst@invertpine
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 2){{\psk@bubblesize}} % Invert Input e
			\fi
		\fi
		% f
		\ifPst@pinf
			\psline(0,1.5)(1,1.5) % Input f
			\uput[r](1,1.5){{\psk@pinflabel}} % Name f
			\uput[u](0.5,1.4){{\psk@pinfnumber}} % Number f
			\ifPst@invertpinf
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.5){{\psk@bubblesize}} % Invert Input f
			\fi
		\fi
		% g
		\ifPst@ping
			\psline(0,1)(1,1) % Input g
			\uput[r](1,1){{\psk@pinglabel}} % Name g
			\uput[u](0.5,0.9){{\psk@pingnumber}} % Number g
			\ifPst@invertping
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1){{\psk@bubblesize}} % Invert Input g
			\fi
		\fi
		% h
		\ifPst@pinh
			\psline(0,0.5)(1,0.5) % Input h
			\uput[r](1,0.5){{\psk@pinhlabel}} % Name h
			\uput[u](0.5,0.4){{\psk@pinhnumber}} % Number h
			\ifPst@invertpinh
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 0.5){{\psk@bubblesize}} % Invert Input h
			\fi
		\fi
		% i
		\ifPst@pini
			\psline(3.5,0.5)(4.5,0.5) % Input i
			\uput[l](3.5,0.5){{\psk@pinilabel}} % Name i
			\uput[u](4,0.4){{\psk@pininumber}} % Number i
			\ifPst@invertpini
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 0.5){{\psk@bubblesize}} % Invert Input i
			\fi
		\fi
		% j
		\ifPst@pinj
			\psline(3.5,1)(4.5,1) % Input j
			\uput[l](3.5,1){{\psk@pinjlabel}} % Name j
			\uput[u](4,0.9){{\psk@pinjnumber}} % Number j
			\ifPst@invertpinj
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 1){{\psk@bubblesize}} % Invert Input j
			\fi
		\fi
		% k
		\ifPst@pink
			\psline(3.5,1.5)(4.5,1.5) % Input k
			\uput[l](3.5,1.5){{\psk@pinklabel}} % Name k
			\uput[u](4,1.4){{\psk@pinknumber}} % Number k
			\ifPst@invertpink
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 1.5){{\psk@bubblesize}} % Invert Input k
			\fi
		\fi
		% l
		\ifPst@pinl
			\psline(3.5,2)(4.5,2) % Input l
			\uput[l](3.5,2){{\psk@pinllabel}} % Name l
			\uput[u](4,1.9){{\psk@pinlnumber}} % Number l
			\ifPst@invertpinl
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 2){{\psk@bubblesize}} % Invert Input l
			\fi
		\fi
		% m
		\ifPst@pinm
			\psline(3.5,2.5)(4.5,2.5) % Input m
			\uput[l](3.5,2.5){{\psk@pinmlabel}} % Name m
			\uput[u](4,2.4){{\psk@pinmnumber}} % Number m
			\ifPst@invertpinm
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 2.5){{\psk@bubblesize}} % Invert Input m
			\fi
		\fi
		% n
		\ifPst@pinn
			\psline(3.5,3)(4.5,3) % Input n
			\uput[l](3.5,3){{\psk@pinnlabel}} % Name n
			\uput[u](4,2.9){{\psk@pinnnumber}} % Number n
			\ifPst@invertpinn
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 3){{\psk@bubblesize}} % Invert Input n
			\fi
		\fi
		% o
		\ifPst@pino
			\psline(3.5,3.5)(4.5,3.5) % Input o
			\uput[l](3.5,3.5){{\psk@pinolabel}} % Name o
			\uput[u](4,3.4){{\psk@pinonumber}} % Number o
			\ifPst@invertpino
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 3.5){{\psk@bubblesize}} % Invert Input o
			\fi
		\fi
		% p
		\ifPst@pinp
			\psline(3.5,4)(4.5,4) % Input p
			\uput[l](3.5,4){{\psk@pinplabel}} % Name p
			\uput[u](4,3.9){{\psk@pinpnumber}} % Number p
			\ifPst@invertpinp
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 4){{\psk@bubblesize}} % Invert Input p
			\fi
		\fi
		% Body
		\psline[linewidth=1.5\pslinewidth](1,0)(1,4.5)(3.5,4.5)(3.5,0)(1,0)
	\or
		%
		% 20-Pin DIP IC
		%
		\def\icheight{5.5}
		\def\icwidth{3.5}
		\def\icleft{1.75}
		\def\icmid{2.25}
		\def\icright{2.75}
		% a
		\ifPst@pina
			\psline(0,5)(1,5) % Input a
			\uput[r](1,5){{\psk@pinalabel}} % Name a
			\uput[u](0.5,4.9){{\psk@pinanumber}} % Number a
			\ifPst@invertpina
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 5){{\psk@bubblesize}} % Invert Input a
			\fi
		\fi
		% b
		\ifPst@pinb
			\psline(0,4.5)(1,4.5) % Input b
			\uput[r](1,4.5){{\psk@pinblabel}} % Name b
			\uput[u](0.5,4.4){{\psk@pinbnumber}} % Number b
			\ifPst@invertpinb
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 4.5){{\psk@bubblesize}} % Invert Input b
			\fi
		\fi
		% c
		\ifPst@pinc
			\psline(0,4)(1,4) % Input c
			\uput[r](1,4){{\psk@pinclabel}} % Name c
			\uput[u](0.5,3.9){{\psk@pincnumber}} % Number c
			\ifPst@invertpinc
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 4){{\psk@bubblesize}} % Invert Input c
			\fi
		\fi
		% d
		\ifPst@pind
			\psline(0,3.5)(1,3.5) % Input d
			\uput[r](1,3.5){{\psk@pindlabel}} % Name d
			\uput[u](0.5,3.4){{\psk@pindnumber}} % Number d
			\ifPst@invertpind
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 3.5){{\psk@bubblesize}} % Invert Input d
			\fi
		\fi
		% e
		\ifPst@pine
			\psline(0,3)(1,3) % Input e
			\uput[r](1,3){{\psk@pinelabel}} % Name e
			\uput[u](0.5,2.9){{\psk@pinenumber}} % Number e
			\ifPst@invertpine
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 3){{\psk@bubblesize}} % Invert Input e
			\fi
		\fi
		% f
		\ifPst@pinf
			\psline(0,2.5)(1,2.5) % Input f
			\uput[r](1,2.5){{\psk@pinflabel}} % Name f
			\uput[u](0.5,2.4){{\psk@pinfnumber}} % Number f
			\ifPst@invertpinf
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 2.5){{\psk@bubblesize}} % Invert Input f
			\fi
		\fi
		% g
		\ifPst@ping
			\psline(0,2)(1,2) % Input g
			\uput[r](1,2){{\psk@pinglabel}} % Name g
			\uput[u](0.5,1.9){{\psk@pingnumber}} % Number g
			\ifPst@invertping
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 2){{\psk@bubblesize}} % Invert Input g
			\fi
		\fi
		% h
		\ifPst@pinh
			\psline(0,1.5)(1,1.5) % Input h
			\uput[r](1,1.5){{\psk@pinhlabel}} % Name h
			\uput[u](0.5,1.4){{\psk@pinhnumber}} % Number h
			\ifPst@invertpinh
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.5){{\psk@bubblesize}} % Invert Input h
			\fi
		\fi
		% i
		\ifPst@pini
			\psline(0,1)(1,1) % Input i
			\uput[r](1,1){{\psk@pinilabel}} % Name i
			\uput[u](0.5,0.9){{\psk@pininumber}} % Number i
			\ifPst@invertpini
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1){{\psk@bubblesize}} % Invert Input i
			\fi
		\fi
		% j
		\ifPst@pinj
			\psline(0,0.5)(1,0.5) % Input j
			\uput[r](1,0.5){{\psk@pinjlabel}} % Name j
			\uput[u](0.5,0.4){{\psk@pinjnumber}} % Number j
			\ifPst@invertpinj
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 0.5){{\psk@bubblesize}} % Invert Input j
			\fi
		\fi
		% k
		\ifPst@pink
			\psline(3.5,0.5)(4.5,0.5) % Input k
			\uput[l](3.5,0.5){{\psk@pinklabel}} % Name k
			\uput[u](4,0.4){{\psk@pinknumber}} % Number k
			\ifPst@invertpink
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 0.5){{\psk@bubblesize}} % Invert Input k
			\fi
		\fi
		% l
		\ifPst@pinl
			\psline(3.5,1)(4.5,1) % Input l
			\uput[l](3.5,1){{\psk@pinllabel}} % Name l
			\uput[u](4,0.9){{\psk@pinlnumber}} % Number l
			\ifPst@invertpinl
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 1){{\psk@bubblesize}} % Invert Input l
			\fi
		\fi
		% m
		\ifPst@pinm
			\psline(3.5,1.5)(4.5,1.5) % Input m
			\uput[l](3.5,1.5){{\psk@pinmlabel}} % Name m
			\uput[u](4,1.4){{\psk@pinmnumber}} % Number m
			\ifPst@invertpinm
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 1.5){{\psk@bubblesize}} % Invert Input m
			\fi
		\fi
		% n
		\ifPst@pinn
			\psline(3.5,2)(4.5,2) % Input n
			\uput[l](3.5,2){{\psk@pinnlabel}} % Name n
			\uput[u](4,1.9){{\psk@pinnnumber}} % Number n
			\ifPst@invertpinn
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 2){{\psk@bubblesize}} % Invert Input n
			\fi
		\fi
		% o
		\ifPst@pino
			\psline(3.5,2.5)(4.5,2.5) % Input o
			\uput[l](3.5,2.5){{\psk@pinolabel}} % Name o
			\uput[u](4,2.4){{\psk@pinonumber}} % Number o
			\ifPst@invertpino
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 2.5){{\psk@bubblesize}} % Invert Input o
			\fi
		\fi
		% p
		\ifPst@pinp
			\psline(3.5,3)(4.5,3) % Input p
			\uput[l](3.5,3){{\psk@pinplabel}} % Name p
			\uput[u](4,2.9){{\psk@pinpnumber}} % Number p
			\ifPst@invertpinp
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 3){{\psk@bubblesize}} % Invert Input p
			\fi
		\fi
		% q
		\ifPst@pinq
			\psline(3.5,3.5)(4.5,3.5) % Input q
			\uput[l](3.5,3.5){{\psk@pinqlabel}} % Name q
			\uput[u](4,3.4){{\psk@pinqnumber}} % Number q
			\ifPst@invertpinq
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 3.5){{\psk@bubblesize}} % Invert Input q
			\fi
		\fi
		% r
		\ifPst@pinr
			\psline(3.5,4)(4.5,4) % Input r
			\uput[l](3.5,4){{\psk@pinrlabel}} % Name r
			\uput[u](4,3.9){{\psk@pinrnumber}} % Number r
			\ifPst@invertpinr
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 4){{\psk@bubblesize}} % Invert Input r
			\fi
		\fi
		% s
		\ifPst@pins
			\psline(3.5,4.5)(4.5,4.5) % Input s
			\uput[l](3.5,4.5){{\psk@pinslabel}} % Name s
			\uput[u](4,4.4){{\psk@pinsnumber}} % Number s
			\ifPst@invertpins
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 4.5){{\psk@bubblesize}} % Invert Input s
			\fi
		\fi
		% t
		\ifPst@pint
			\psline(3.5,5)(4.5,5) % Input t
			\uput[l](3.5,5){{\psk@pintlabel}} % Name t
			\uput[u](4,4.9){{\psk@pintnumber}} % Number t
			\ifPst@invertpint
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 5){{\psk@bubblesize}} % Invert Input t		
			\fi
		\fi
		% Body
		\psline[linewidth=1.5\pslinewidth](1,0)(1,5.5)(3.5,5.5)(3.5,0)(1,0)
	\or
		%
		% 32-Pin DIP IC
		%
		\def\icheight{8.5}
		\def\icwidth{4}
		\def\icleft{2}
		\def\icmid{2.5}
		\def\icright{3}
		% a
		\ifPst@pina
			\psline(0,8)(1,8) % Input a
			\uput[r](1,8){{\psk@pinalabel}} % Name a
			\uput[u](0.5,7.9){{\psk@pinanumber}} % Number a
			\ifPst@invertpina
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 8){{\psk@bubblesize}} % Invert Input a
			\fi
		\fi
		% b
		\ifPst@pinb
			\psline(0,7.5)(1,7.5) % Input b
			\uput[r](1,7.5){{\psk@pinblabel}} % Name b
			\uput[u](0.5,7.4){{\psk@pinbnumber}} % Number b
			\ifPst@invertpinb
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 7.5){{\psk@bubblesize}} % Invert Input b
			\fi
		\fi
		% c
		\ifPst@pinc
			\psline(0,7)(1,7) % Input c
			\uput[r](1,7){{\psk@pinclabel}} % Name c
			\uput[u](0.5,6.9){{\psk@pincnumber}} % Number c
			\ifPst@invertpinc
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 7){{\psk@bubblesize}} % Invert Input c
			\fi
		\fi
		% d
		\ifPst@pind
			\psline(0,6.5)(1,6.5) % Input d
			\uput[r](1,6.5){{\psk@pindlabel}} % Name d
			\uput[u](0.5,6.4){{\psk@pindnumber}} % Number d
			\ifPst@invertpind
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 6.5){{\psk@bubblesize}} % Invert Input d
			\fi
		\fi
		% e
		\ifPst@pine
			\psline(0,6)(1,6) % Input e
			\uput[r](1,6){{\psk@pinelabel}} % Name e
			\uput[u](0.5,5.9){{\psk@pinenumber}} % Number e
			\ifPst@invertpine
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 6){{\psk@bubblesize}} % Invert Input e
			\fi
		\fi
		% f
		\ifPst@pinf
			\psline(0,5.5)(1,5.5) % Input f
			\uput[r](1,5.5){{\psk@pinflabel}} % Name f
			\uput[u](0.5,5.4){{\psk@pinfnumber}} % Number f
			\ifPst@invertpinf
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 5.5){{\psk@bubblesize}} % Invert Input f
			\fi
		\fi
		% g
		\ifPst@ping
			\psline(0,5)(1,5) % Input g
			\uput[r](1,5){{\psk@pinglabel}} % Name g
			\uput[u](0.5,4.9){{\psk@pingnumber}} % Number g
			\ifPst@invertping
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 5){{\psk@bubblesize}} % Invert Input g
			\fi
		\fi
		% h
		\ifPst@pinh
			\psline(0,4.5)(1,4.5) % Input h
			\uput[r](1,4.5){{\psk@pinhlabel}} % Name h
			\uput[u](0.5,4.4){{\psk@pinhnumber}} % Number h
			\ifPst@invertpinh
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 4.5){{\psk@bubblesize}} % Invert Input h
			\fi
		\fi
		% i
		\ifPst@pini
			\psline(0,4)(1,4) % Input i
			\uput[r](1,4){{\psk@pinilabel}} % Name i
			\uput[u](0.5,3.9){{\psk@pininumber}} % Number i
			\ifPst@invertpini
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 4){{\psk@bubblesize}} % Invert Input i
			\fi
		\fi
		% j
		\ifPst@pinj
			\psline(0,3.5)(1,3.5) % Input j
			\uput[r](1,3.5){{\psk@pinjlabel}} % Name j
			\uput[u](0.5,3.4){{\psk@pinjnumber}} % Number j
			\ifPst@invertpinj
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 3.5){{\psk@bubblesize}} % Invert Input j
			\fi
		\fi
		% k
		\ifPst@pink
			\psline(0,3)(1,3) % Input k
			\uput[r](1,3){{\psk@pinklabel}} % Name k
			\uput[u](0.5,2.9){{\psk@pinknumber}} % Number k
			\ifPst@invertpink
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 3){{\psk@bubblesize}} % Invert Input k
			\fi
		\fi
		% l
		\ifPst@pinl
			\psline(0,2.5)(1,2.5) % Input l
			\uput[r](1,2.5){{\psk@pinllabel}} % Name l
			\uput[u](0.5,2.4){{\psk@pinlnumber}} % Number l
			\ifPst@invertpinl
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 2.5){{\psk@bubblesize}} % Invert Input l
			\fi
		\fi
		% m
		\ifPst@pinm
			\psline(0,2)(1,2) % Input m
			\uput[r](1,2){{\psk@pinmlabel}} % Name m
			\uput[u](0.5,1.9){{\psk@pinmnumber}} % Number m
			\ifPst@invertpinm
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 2){{\psk@bubblesize}} % Invert Input m
			\fi
		\fi
		% n
		\ifPst@pinn
			\psline(0,1.5)(1,1.5) % Input n
			\uput[r](1,1.5){{\psk@pinnlabel}} % Name n
			\uput[u](0.5,1.4){{\psk@pinnnumber}} % Number n
			\ifPst@invertpinn
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.5){{\psk@bubblesize}} % Invert Input n
			\fi
		\fi
		% o
		\ifPst@pino
			\psline(0,1)(1,1) % Input o
			\uput[r](1,1){{\psk@pinolabel}} % Name o
			\uput[u](0.5,0.9){{\psk@pinonumber}} % Number o
			\ifPst@invertpino
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1){{\psk@bubblesize}} % Invert Input o
			\fi
		\fi
		% p
		\ifPst@pinp
			\psline(0,0.5)(1,0.5) % Input p
			\uput[r](1,0.5){{\psk@pinplabel}} % Name p
			\uput[u](0.5,0.4){{\psk@pinpnumber}} % Number p
			\ifPst@invertpinp
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 0.5){{\psk@bubblesize}} % Invert Input p
			\fi
		\fi				
		% q
		\ifPst@pinq
			\psline(4,0.5)(5,0.5) % Input q
			\uput[l](4,0.5){{\psk@pinqlabel}} % Name q
			\uput[u](4.5,0.4){{\psk@pinqnumber}} % Number q
			\ifPst@invertpinq
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 0.5){{\psk@bubblesize}} % Invert Input q
			\fi
		\fi	
		% r
		\ifPst@pinr
			\psline(4,1)(5,1) % Input r
			\uput[l](4,1){{\psk@pinrlabel}} % Name r
			\uput[u](4.5,0.9){{\psk@pinrnumber}} % Number r
			\ifPst@invertpinr
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 1){{\psk@bubblesize}} % Invert Input r
			\fi
		\fi
		% s
		\ifPst@pins
			\psline(4,1.5)(5,1.5) % Input s
			\uput[l](4,1.5){{\psk@pinslabel}} % Name s
			\uput[u](4.5,1.4){{\psk@pinsnumber}} % Number s
			\ifPst@invertpins
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 1.5){{\psk@bubblesize}} % Invert Input s
			\fi
		\fi
		% t
		\ifPst@pint
			\psline(4,2)(5,2) % Input t
			\uput[l](4,2){{\psk@pintlabel}} % Name t
			\uput[u](4.5,1.9){{\psk@pintnumber}} % Number t
			\ifPst@invertpint
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 2){{\psk@bubblesize}} % Invert Input t
			\fi
		\fi		
		% u
		\ifPst@pinu
			\psline(4,2.5)(5,2.5) % Input u
			\uput[l](4,2.5){{\psk@pinulabel}} % Name u
			\uput[u](4.5,2.4){{\psk@pinunumber}} % Number u
			\ifPst@invertpinu
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 2.5){{\psk@bubblesize}} % Invert Input u
			\fi
		\fi
		% v
		\ifPst@pinv
			\psline(4,3)(5,3) % Input v
			\uput[l](4,3){{\psk@pinvlabel}} % Name v
			\uput[u](4.5,2.9){{\psk@pinvnumber}} % Number v
			\ifPst@invertpinv
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 3){{\psk@bubblesize}} % Invert Input v
			\fi
		\fi
		% w
		\ifPst@pinw
			\psline(4,3.5)(5,3.5) % Input w
			\uput[l](4,3.5){{\psk@pinwlabel}} % Name w
			\uput[u](4.5,3.4){{\psk@pinwnumber}} % Number w
			\ifPst@invertpinw
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 3.5){{\psk@bubblesize}} % Invert Input w
			\fi
		\fi
		% x
		\ifPst@pinx
			\psline(4,4)(5,4) % Input x
			\uput[l](4,4){{\psk@pinxlabel}} % Name x
			\uput[u](4.5,3.9){{\psk@pinxnumber}} % Number x
			\ifPst@invertpinx
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 4){{\psk@bubblesize}} % Invert Input x
			\fi
		\fi		
		% y
		\ifPst@piny
			\psline(4,4.5)(5,4.5) % Input y
			\uput[l](4,4.5){{\psk@pinylabel}} % Name y
			\uput[u](4.5,4.4){{\psk@pinynumber}} % Number y
			\ifPst@invertpiny
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 4.5){{\psk@bubblesize}} % Invert Input y
			\fi
		\fi
		% z
		\ifPst@pinz
			\psline(4,5)(5,5) % Input z
			\uput[l](4,5){{\psk@pinzlabel}} % Name z
			\uput[u](4.5,4.9){{\psk@pinznumber}} % Number z
			\ifPst@invertpinz
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 5){{\psk@bubblesize}} % Invert Input z
			\fi
		\fi
		% aa
		\ifPst@pinaa
			\psline(4,5.5)(5,5.5) % Input aa
			\uput[l](4,5.5){{\psk@pinaalabel}} % Name aa
			\uput[u](4.5,5.4){{\psk@pinaanumber}} % Number aa
			\ifPst@invertpinaa
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 5.5){{\psk@bubblesize}} % Invert Input aa
			\fi
		\fi
		% ab
		\ifPst@pinab
			\psline(4,6)(5,6) % Input ab
			\uput[l](4,6){{\psk@pinablabel}} % Name ab
			\uput[u](4.5,5.9){{\psk@pinabnumber}} % Number ab
			\ifPst@invertpinab
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 6){{\psk@bubblesize}} % Invert Input ab
			\fi
		\fi
		% ac
		\ifPst@pinac
			\psline(4,6.5)(5,6.5) % Input ac
			\uput[l](4,6.5){{\psk@pinaclabel}} % Name ac
			\uput[u](4.5,6.4){{\psk@pinacnumber}} % Number ac
			\ifPst@invertpinac
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 6.5){{\psk@bubblesize}} % Invert Input ac
			\fi
		\fi	
		% ad
		\ifPst@pinad
			\psline(4,7)(5,7) % Input ad
			\uput[l](4,7){{\psk@pinadlabel}} % Name ad
			\uput[u](4.5,6.9){{\psk@pinadnumber}} % Number ad
			\ifPst@invertpinad
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 7){{\psk@bubblesize}} % Invert Input ad
			\fi
		\fi
		% ae
		\ifPst@pinae
			\psline(4,7.5)(5,7.5) % Input ae
			\uput[l](4,7.5){{\psk@pinaelabel}} % Name ae
			\uput[u](4.5,7.4){{\psk@pinaenumber}} % Number ae
			\ifPst@invertpinae
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 7.5){{\psk@bubblesize}} % Invert Input ae
			\fi
		\fi					
		% af
		\ifPst@pinaf
			\psline(4,8)(5,8) % Input af
			\uput[l](4,8){{\psk@pinaflabel}} % Name af
			\uput[u](4.5,7.9){{\psk@pinafnumber}} % Number af
			\ifPst@invertpinaf
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 8){{\psk@bubblesize}} % Invert Input af
			\fi
		\fi	
	% Body
		\psline[linewidth=1.5\pslinewidth](1,0)(1,8.5)(4,8.5)(4,0)(1,0)
	\fi
	%
	% Top Pins
	%
	% tl
	\ifPst@pintl
		\pnode(\icleft,\icheight){A}
		\pnode([angle=90,offset=-0.1]A){B}
		\psline(A)([angle=0,offset=1]A) % Input tl
		\uput[d](A){{\psk@pintllabel}} % Name tl
		\uput[l]([angle=0,offset=0.55]B){{\psk@pintlnumber}} % Number tl
		\ifPst@invertpintl
			\pscircle[fillstyle=solid]([angle=0,offset=\psk@bubblesize]A){{\psk@bubblesize}} % Invert Input tl
		\fi
	\fi
	% tc
	\ifPst@pintc
		\pnode(\icmid,\icheight){A}
		\pnode([angle=90,offset=-0.1]A){B}
		\psline(A)([angle=0,offset=1]A) % Input tc
		\uput[d](A){{\psk@pintclabel}} % Name tc
		\uput[l]([angle=0,offset=0.55]B){{\psk@pintcnumber}} % Number tc
		\ifPst@invertpintc
			\pscircle[fillstyle=solid]([angle=0,offset=\psk@bubblesize]A){{\psk@bubblesize}} % Invert Input tc
		\fi
	\fi
	% tr
	\ifPst@pintr
		\pnode(\icright,\icheight){A}
		\pnode([angle=90,offset=-0.1]A){B}
		\psline(A)([angle=0,offset=1]A) % Input tr
		\uput[d](A){{\psk@pintrlabel}} % Name tr
		\uput[l]([angle=0,offset=0.55]B){{\psk@pintrnumber}} % Number tr
		\ifPst@invertpintc
			\pscircle[fillstyle=solid]([angle=0,offset=\psk@bubblesize]A){{\psk@bubblesize}} % Invert Input tr
		\fi
	\fi
	%
	% Bottom Pins
	%
	% bl
	\ifPst@pinbl
		\pnode(\icleft,0){A}
		\pnode([angle=-90,offset=0.1]A){B}
		\psline(A)([angle=0,offset=-1]A) % Input bl
		\uput[u](A){{\psk@pinbllabel}} % Name bl
		\uput[l]([angle=0,offset=-0.55]B){{\psk@pinblnumber}} % Number bl
		\ifPst@invertpinbl
			\pscircle[fillstyle=solid]([angle=0,offset=-\psk@bubblesize]A){{\psk@bubblesize}} % Invert Input bl
		\fi
	\fi
	% bc
	\ifPst@pinbc
		\pnode(\icmid,0){A}
		\pnode([angle=-90,offset=0.1]A){B}
		\psline(A)([angle=0,offset=-1]A) % Input bc
		\uput[u](A){{\psk@pinbclabel}} % Name bc
		\uput[l]([angle=0,offset=-0.55]B){{\psk@pinbcnumber}} % Number bc
		\ifPst@invertpinbc
			\pscircle[fillstyle=solid]([angle=0,offset=-\psk@bubblesize]A){{\psk@bubblesize}} % Invert Input bc
		\fi
	\fi
	% br
	\ifPst@pinbr
		\pnode(\icright,0){A}
		\pnode([angle=-90,offset=0.1]A){B}
		\psline(A)([angle=0,offset=-1]A) % Input br
		\uput[u](A){{\psk@pinbrlabel}} % Name br
		\uput[l]([angle=0,offset=-0.55]B){{\psk@pinbrnumber}} % Number br
		\ifPst@invertpinbc
			\pscircle[fillstyle=solid]([angle=0,offset=-\psk@bubblesize]A){{\psk@bubblesize}} % Invert Input br
		\fi
	\fi	
	% Name
	\uput[r](\icwidth,0){#4}
	}}%
\ignorespaces
}

% NOT Gate \logicnot
%
% Input at (+0,+1)
% Output at (+3.5,+1)
%
\def\logicnot{\@ifnextchar[{\pst@logicnot}{\pst@logicnot[]}}
\def\pst@logicnot[#1]{\@ifnextchar({\pst@logicnoti[#1]{0}}{\pst@logicnoti[#1]}}
\def\pst@logicnoti[#1]#2(#3)#4{{%
	\psset{#1}%		
	\rput{#2}(#3){
	% Input
	\psline(0,1)(1,1) % Input
	\ifPst@invertinput
		\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1){{\psk@bubblesize}} % Invert Input
	\fi
	% Body
	\ifPst@iec
		\psline[linewidth=1.5\pslinewidth](1,0)(2.5,0)(2.5,2)(1,2)(1,0)
		\uput[u](1.75,1.25){1}
	\else
		\psline[linewidth=1.5\pslinewidth](1,0)(1,2)(2.5,1)(1,0)
	\fi
	% Output
	\psline(2.5,1)(3.5,1)
	\ifPst@invertoutput
		\ifPst@iecinvert
			\psline(2.5,1.25)(3,1)
		\else
			\pscircle[fillstyle=solid](! 2.5 \space\psk@bubblesize\space add 1){{\psk@bubblesize}} % Invert Output
		\fi
	\fi
	% Name
	\uput[r](2.5,0){#4}
	\psset{}
	}}%
\ignorespaces
}

% AND Gate (NAND Gate) \logicand
%	
% 2-Input
% Input A at (+0,+1)
% Input B at ()
% Output at (+3.5,+1)
%
% 3-Input
% Input A at (+0,+1)
% Input B at ()
% Input C at ()
% Output at (+3.5,+1)
%
% 4-Input
% Input A at (+0,+1)
% Input B at ()
% Input C at ()
% Input D at ()
% Output at (+3.5,+1)
%

\def\logicand{\@ifnextchar[{\pst@logicand}{\pst@logicand[]}}
\def\pst@logicand[#1]{\@ifnextchar({\pst@logicandi[#1]{0}}{\pst@logicandi[#1]}}
\def\pst@logicandi[#1]#2(#3)#4{{%
	\psset{#1}	
	\rput{#2}(#3){
	% Inputs
	\ifcase\psk@ninputs\or
		\ifPst@inputa
			\psline(0,1)(1,1) % Input A
			\ifPst@invertinputa
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1){{\psk@bubblesize}} % Invert Input A
			\fi
		\fi
	\or
		\ifPst@inputa
			\psline(0,1.5)(1,1.5) % Input A
			\ifPst@invertinputa
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.5){{\psk@bubblesize}} % Invert Input A
			\fi
		\fi
		\ifPst@inputb
			\psline(0,0.5)(1,0.5) % Input B
			\ifPst@invertinputb
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 0.5){{\psk@bubblesize}} % Invert Input B
			\fi
		\fi
	\or
		\ifPst@inputa
			\psline(0,1.5)(1,1.5) % Input A
			\ifPst@invertinputa
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.5){{\psk@bubblesize}} % Invert Input A
			\fi
		\fi
		\ifPst@inputb
			\psline(0,1)(1,1) % Input B
			\ifPst@invertinputb
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1){{\psk@bubblesize}} % Invert Input B
			\fi
		\fi
		\ifPst@inputc
			\psline(0,0.5)(1,0.5) % Input C
			\ifPst@invertinputc
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 0.5){{\psk@bubblesize}} % Invert Input C
			\fi
		\fi
	\or
		\ifPst@inputa
			\psline(0,1.75)(1,1.75) % Input A
			\ifPst@invertinputa
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.75){{\psk@bubblesize}} % Invert Input A
			\fi
		\fi
		\ifPst@inputb
			\psline(0,1.25)(1,1.25) % Input B
			\ifPst@invertinputb
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.25){{\psk@bubblesize}} % Invert Input B
			\fi
		\fi
		\ifPst@inputc
			\psline(0,0.75)(1,0.75) % Input C
			\ifPst@invertinputc
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 0.75){{\psk@bubblesize}} % Invert Input C
			\fi
		\fi
		\ifPst@inputd
			\psline(0,0.25)(1,0.25) % Input D
			\ifPst@invertinputd
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 0.25){{\psk@bubblesize}} % Invert Input D
			\fi
		\fi
	\fi
	% Body
	\ifPst@iec
		\psline[linewidth=1.5\pslinewidth](1,0)(2.5,0)(2.5,2)(1,2)(1,0)
		\uput[u](1.75,1.25){\&}
	\else
		\psline[linewidth=1.5\pslinewidth](1,0)(1,2)
		\psline[linewidth=1.5\pslinewidth](1,0)(2.5,0)
		\psline[linewidth=1.5\pslinewidth](1,2)(2.5,2)
		\psbezier[linewidth=1.5\pslinewidth](2.5,0)(3.5,0)(3.5,1)(3.5,1)
		\psbezier[linewidth=1.5\pslinewidth](3.5,1)(3.5,1)(3.5,2)(2.5,2)
	\fi
	% Output
	\ifPst@iec
		\psline(2.5,1)(3.5,1)
	\else
		\psline(3.5,1)(4.5,1)
	\fi
	\ifPst@invertoutput
		\ifPst@iecinvert
			\psline(2.5,1.25)(3,1)
		\else
			\ifPst@iec
				\pscircle[fillstyle=solid](! 2.5 \space\psk@bubblesize\space add 1){{\psk@bubblesize}} % Invert Output
			\else
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 1){{\psk@bubblesize}} % Invert Output
			\fi
		\fi
	\fi
	% Name
	\ifPst@iec
		\uput[r](2.5,0){#4}
	\else
		\uput[r](3.25,0){#4}
	\fi
	}}%
\ignorespaces
}

% OR Gate (NOR Gate) \logicor
%
% Input at (+0,+1)
% Output at (+3.5,+1)
%
\def\logicor{\@ifnextchar[{\pst@logicor}{\pst@logicor[]}}
\def\pst@logicor[#1]{\@ifnextchar({\pst@logicori[#1]{0}}{\pst@logicori[#1]}}
\def\pst@logicori[#1]#2(#3)#4{{%
	\psset{#1}%
	\rput{#2}(#3){
	% Inputs
	\ifcase\psk@ninputs\or
		\ifPst@inputa
			\psline(0,1)(1.08,1) % Input A
			\ifPst@invertinputa
				\pscircle[fillstyle=solid](! 1.08 \space\psk@bubblesize\space sub 1){{\psk@bubblesize}} % Invert Input A
			\fi
		\fi
	\or
		\ifPst@inputa
			\psline(0,1.5)(1,1.5) % Input A
			\ifPst@invertinputa
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.5){{\psk@bubblesize}} % Invert Input A
			\fi
		\fi
		\ifPst@inputb
			\psline(0,0.5)(1,0.5) % Input B
			\ifPst@invertinputb
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 0.5){{\psk@bubblesize}} % Invert Input B
			\fi
		\fi
	\or
		\ifPst@inputa
			\psline(0,1.5)(1,1.5) % Input A
			\ifPst@invertinputa
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.5){{\psk@bubblesize}} % Invert Input A
			\fi
		\fi
		\ifPst@inputb
			\psline(0,1)(1.06,1) % Input B
			\ifPst@invertinputb
				\pscircle[fillstyle=solid](! 1.09 \space\psk@bubblesize\space sub 1){{\psk@bubblesize}} % Invert Input B
			\fi
		\fi
		\ifPst@inputc
			\psline(0,0.5)(1,0.5) % Input C
			\ifPst@invertinputc
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 0.5){{\psk@bubblesize}} % Invert Input C
			\fi
		\fi
	\or	
		\ifPst@inputa
			\psline(0,1.75)(0.88,1.75) % Input A
			\ifPst@invertinputa
				\pscircle[fillstyle=solid](! 0.87 \space\psk@bubblesize\space sub 1.75){{\psk@bubblesize}} % Invert Input A
			\fi
		\fi
		\ifPst@inputb
			\psline(0,1.25)(1.05,1.25) % Input B
			\ifPst@invertinputb
				\pscircle[fillstyle=solid](! 1.07 \space\psk@bubblesize\space sub 1.25){{\psk@bubblesize}} % Invert Input B
			\fi
		\fi
		\ifPst@inputc
			\psline(0,0.75)(1.05,0.75) % Input C
			\ifPst@invertinputc
				\pscircle[fillstyle=solid](! 1.07 \space\psk@bubblesize\space sub 0.75){{\psk@bubblesize}} % Invert Input C
			\fi
		\fi
		\ifPst@inputc
			\psline(0,0.25)(0.88,0.25) % Input D
			\ifPst@invertinputd
				\pscircle[fillstyle=solid](! 0.87 \space\psk@bubblesize\space sub 0.25){{\psk@bubblesize}} % Invert Input D
			\fi
		\fi
	\fi
	% Body
	\ifPst@iec
		\psline[linewidth=1.5\pslinewidth](1,0)(2.5,0)(2.5,2)(1,2)(1,0)
		\uput[u](1.75,1.25){$\geq 1$}
	\else
		\psbezier[linewidth=1.5\pslinewidth](0.7,0)(1.2,0.5)(1.2,1.5)(0.7,2)
		\psline[linewidth=1.5\pslinewidth](0.7,0)(2,0)
		\psline[linewidth=1.5\pslinewidth](0.7,2)(2,2)
		\psbezier[linewidth=1.5\pslinewidth](2,0)(3,0)(3.5,1)(3.5,1)
		\psbezier[linewidth=1.5\pslinewidth](3.5,1)(3.5,1)(3,2)(2,2)
	\fi
	% Output
	\ifPst@iec
		\psline(2.5,1)(3.5,1)
	\else
		\psline(3.5,1)(4.5,1)
	\fi
	\ifPst@invertoutput
		\ifPst@iecinvert
			\psline(2.5,1.25)(3,1)
		\else
			\ifPst@iec
				\pscircle[fillstyle=solid](! 2.5 \space\psk@bubblesize\space add 1){{\psk@bubblesize}} % Invert Output
			\else
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 1){{\psk@bubblesize}} % Invert Output
			\fi
		\fi
	\fi
	% Name
	\ifPst@iec
		\uput[r](2.5,0){#4}
	\else
		\uput[r](3.25,0){#4}
	\fi
	}}%
\ignorespaces
}

% Exclusive-OR Gate (Exclusive NOR Gate) \logicxor
%
% Input at (+0,+1)
% Output at (+3.5,+1)
%
\def\logicxor{\@ifnextchar[{\pst@logicxor}{\pst@logicxor[]}}
\def\pst@logicxor[#1]{\@ifnextchar({\pst@logicxori[#1]{0}}{\pst@logicxori[#1]}}
\def\pst@logicxori[#1]#2(#3)#4{{%
	\psset{#1}%			
	\rput{#2}(#3){%
	% Inputs
	\ifcase\psk@ninputs\or
		\ifPst@inputa
			\psline(0,1)(1.08,1) % Input A
			\ifPst@invertinputa
				\pscircle[fillstyle=solid](! 1.08 \space\psk@bubblesize\space sub 1.5){{\psk@bubblesize}} % Invert Input A
			\fi
		\fi
	\or	
		\ifPst@inputa
			\psline(0,1.5)(1,1.5) % Input A
			\ifPst@invertinputa
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.5){{\psk@bubblesize}} % Invert Input A
			\fi
		\fi
		\ifPst@inputb
			\psline(0,0.5)(1,0.5) % Input B
			\ifPst@invertinputb
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 0.5){{\psk@bubblesize}} % Invert Input B
			\fi
		\fi
	\or
		\ifPst@inputa
			\psline(0,1.5)(1,1.5) % Input A
			\ifPst@invertinputa
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.5){{\psk@bubblesize}} % Invert Input A
			\fi
		\fi
		\ifPst@inputb
			\psline(0,1)(1.06,1) % Input B
			\ifPst@invertinputb
				\pscircle[fillstyle=solid](! 1.09 \space\psk@bubblesize\space sub 1){{\psk@bubblesize}} % Invert Input B
			\fi
		\fi
		\ifPst@inputc
			\psline(0,0.5)(1,0.5) % Input C
			\ifPst@invertinputc
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 0.5){{\psk@bubblesize}} % Invert Input C
			\fi
		\fi
	\or
		\ifPst@inputa
			\psline(0,1.75)(0.88,1.75) % Input A
			\ifPst@invertinputa
				\pscircle[fillstyle=solid](! 0.87 \space\psk@bubblesize\space sub 1.75){{\psk@bubblesize}} % Invert Input A
			\fi
		\fi
		\ifPst@inputb
			\psline(0,1.25)(1.05,1.25) % Input B
			\ifPst@invertinputb
				\pscircle[fillstyle=solid](! 1.07 \space\psk@bubblesize\space sub 1.25){{\psk@bubblesize}} % Invert Input B
			\fi
		\fi
		\ifPst@inputc
			\psline(0,0.75)(1.05,0.75) % Input C
			\ifPst@invertinputc
				\pscircle[fillstyle=solid](! 1.07 \space\psk@bubblesize\space sub 0.75){{\psk@bubblesize}} % Invert Input C
			\fi
		\fi
		\ifPst@inputd
			\psline(0,0.25)(0.88,0.25) % Input D
			\ifPst@invertinputd
				\pscircle[fillstyle=solid](! 0.87 \space\psk@bubblesize\space sub 0.25){{\psk@bubblesize}} % Invert Input D
			\fi
		\fi
	\fi
	% Body
	\ifPst@iec
		\psline[linewidth=1.5\pslinewidth](1,0)(2.5,0)(2.5,2)(1,2)(1,0)
		\uput[u](1.75,1.25){$= 1$}
	\else
		\psbezier[linewidth=1.5\pslinewidth](0.7,0)(1.2,0.5)(1.2,1.5)(0.7,2)
		\psbezier[linewidth=1.5\pslinewidth](1,0)(1.5,0.5)(1.5,1.5)(1,2)
		\psline[linewidth=1.5\pslinewidth](1,0)(2,0)
		\psline[linewidth=1.5\pslinewidth](1,2)(2,2)
		\psbezier[linewidth=1.5\pslinewidth](2,0)(3,0)(3.5,1)(3.5,1)
		\psbezier[linewidth=1.5\pslinewidth](3.5,1)(3.5,1)(3,2)(2,2)
	\fi
	% Output
	\ifPst@iec
		\psline(2.5,1)(3.5,1)
	\else
		\psline(3.5,1)(4.5,1)
	\fi
	\ifPst@invertoutput
		\ifPst@iecinvert
			\psline(2.5,1.25)(3,1)
		\else
			\ifPst@iec
				\pscircle[fillstyle=solid](! 2.5 \space\psk@bubblesize\space add 1){{\psk@bubblesize}} % Invert Output
			\else
				\pscircle[fillstyle=solid](! 3.5 \space\psk@bubblesize\space add 1){{\psk@bubblesize}} % Invert Output
			\fi
		\fi
	\fi
	% Name
	\ifPst@iec
		\uput[r](2.5,0){#4}
	\else
		\uput[r](3.25,0){#4}
	\fi
	}}%
\ignorespaces
}

% Flip-Flop
%
% Input A at (+0,+2.25)
% Input B at (+0,+0.75)
% Output Q at (+3.5,+2.25)
% Output Not Q at (+3.5,+0.75)
%
\def\logicff{\@ifnextchar[{\pst@logicff}{\pst@logicff[]}}
\def\pst@logicff[#1]{\@ifnextchar({\pst@logicffi[#1]{0}}{\pst@logicffi[#1]}}
\def\pst@logicffi[#1]#2(#3)#4{{%
	\psset{#1}%
	\rput{#2}(#3){%
		% Inputs
		\ifPst@inputa
			\psline(0,2.25)(1,2.25) % Input A
			\uput[r](1,2.25){\psk@inputalabel} % Input A Label
			\ifPst@invertinputa
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 2.25){{\psk@bubblesize}} % Invert Input A
			\fi
		\fi
		\ifPst@inputb
			\psline(0,0.75)(1,0.75) % Input B
			\uput[r](1,0.75){\psk@inputblabel} % Input B Label
			\ifPst@invertinputb
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 0.75){{\psk@bubblesize}} % Invert Input B
			\fi
		\fi
		\ifPst@enable
			\psline(0,1.5)(1,1.5) % Enable
			\uput[r](1,1.5){\psk@inputenlabel} % Enable Label
			\ifPst@invertenable
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.5){{\psk@bubblesize}} % Invert Enable
			\fi
		\fi
		\ifPst@clock
			\psline(0,1.5)(1,1.5) % Clock
			\psline(1,1.7)(1.4,1.5)(1,1.3)
			\uput[r](1.4,1.5){\psk@inputcllabel} % Clock Label
			\ifPst@invertclock
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.5){{\psk@bubblesize}} % Invert Clock
			\fi
		\fi
		\ifPst@set
			\psline(2,4)(2,3) % Set
			\uput[d](2,3){$S$} % Set Label
			\ifPst@invertset
				\pscircle[fillstyle=solid](! 2 3 \space\psk@bubblesize\space add){{\psk@bubblesize}} % Invert Set
			\fi
		\fi
		\ifPst@reset
			\psline(2,-1)(2,0) % Reset
			\uput[u](2,0){$R$} % Reset Label
			\ifPst@invertreset
				\pscircle[fillstyle=solid](2,-\psk@bubblesize){{\psk@bubblesize}} % Invert Reset
			\fi
		\fi
		% Body
		\psline[linewidth=1.5\pslinewidth](1,0)(1,3)(3,3)(3,0)(1,0)
		% Outputs
		\ifPst@outputa
			\psline(3,2.25)(4,2.25) % Output Q
			\uput[l](3,2.25){\psk@outputalabel}
			\ifPst@invertoutputa
				\pscircle[fillstyle=solid](! 3 \space\psk@bubblesize\space add 2.25){{\psk@bubblesize}} % Invert Q
			\fi
		\fi
		\ifPst@outputb
			\psline(3,0.75)(4,0.75) % Output Not Q
			\uput[l](3,0.75){\psk@outputblabel}
			\ifPst@invertoutputb
				\pscircle[fillstyle=solid](! 3 \space\psk@bubblesize\space add 0.75){{\psk@bubblesize}}
			\fi
		\fi
		% Name
		\uput[r](3,0){#4}
	}}%
\ignorespaces
}


%
% 7-Segment Display \sevensegmentdisplay
%

\def\sevensegmentdisplay{\@ifnextchar[{\pst@sevensegmentdisplay}{\pst@sevensegmentdisplay[]}}
\def\pst@sevensegmentdisplay[#1]{\@ifnextchar({\pst@sevensegmentdisplayi[#1]{0}}{\pst@sevensegmentdisplayi[#1]}}
\def\pst@sevensegmentdisplayi[#1]#2(#3)#4{{%
	\psset{#1}%
	\rput{#2}(#3){%
		% Left Side Pins
		% la
		\ifPst@pinla
			\psline(0,3.75)(1,3.75) % Input la
			\uput[r](1,3.75){{\psk@pinlalabel}} % Name la
			\uput[u](0.5,3.65){{\psk@pinlanumber}} % Number la
			\ifPst@invertpinla
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 3.75){{\psk@bubblesize}} % Invert Input la
			\fi
		\fi
		% lb
		\ifPst@pinlb
			\psline(0,3.25)(1,3.25) % Input lb
			\uput[r](1,3.25){{\psk@pinlblabel}} % Name lb
			\uput[u](0.5,3.15){{\psk@pinlbnumber}} % Number lb
			\ifPst@invertpinlb
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 3.25){{\psk@bubblesize}} % Invert Input lb
			\fi
		\fi
		% lc
		\ifPst@pinlc
			\psline(0,2.75)(1,2.75) % Input lc
			\uput[r](1,2.75){{\psk@pinlclabel}} % Name lc
			\uput[u](0.5,2.65){{\psk@pinlcnumber}} % Number lc
			\ifPst@invertpinlc
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 2.75){{\psk@bubblesize}} % Invert Input lc
			\fi
		\fi
		% ld
		\ifPst@pinld
			\psline(0,2.25)(1,2.25) % Input ld
			\uput[r](1,2.25){{\psk@pinldlabel}} % Name ld
			\uput[u](0.5,2.15){{\psk@pinldnumber}} % Number ld
			\ifPst@invertpinld
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 2.25){{\psk@bubblesize}} % Invert Input ld
			\fi
		\fi
		% le
		\ifPst@pinle
			\psline(0,1.75)(1,1.75) % Input le
			\uput[r](1,1.75){{\psk@pinlelabel}} % Name le
			\uput[u](0.5,1.65){{\psk@pinlenumber}} % Number le
			\ifPst@invertpinle
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.75){{\psk@bubblesize}} % Invert Input le
			\fi
		\fi
		% lf
		\ifPst@pinlf
			\psline(0,1.25)(1,1.25) % Input lf
			\uput[r](1,1.25){{\psk@pinlflabel}} % Name lf
			\uput[u](0.5,1.15){{\psk@pinlfnumber}} % Number lf
			\ifPst@invertpinlf
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 1.25){{\psk@bubblesize}} % Invert Input lf
			\fi
		\fi
		% lg
		\ifPst@pinlg
			\psline(0,0.75)(1,0.75) % Input lg
			\uput[r](1,0.75){{\psk@pinlglabel}} % Name lg
			\uput[u](0.5,0.65){{\psk@pinlgnumber}} % Number lg
			\ifPst@invertpinlg
				\pscircle[fillstyle=solid](! 1 \space\psk@bubblesize\space sub 0.75){{\psk@bubblesize}} % Invert Input lg
			\fi
		\fi
		% Right Side Pins
		% rg
		\ifPst@pinrg
			\psline(4.5,0.75)(5.5,0.75) % Input rg
			\uput[l](4.5,0.75){{\psk@pinrglabel}} % Name rg
			\uput[u](5,0.65){{\psk@pinrgnumber}} % Number rg
			\ifPst@invertpinrg
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 0.75){{\psk@bubblesize}} % Invert Input rg
			\fi
		\fi
		% rf
		\ifPst@pinrf
			\psline(4.5,1.25)(5.5,1.25) % Input rf
			\uput[l](4.5,1.25){{\psk@pinrflabel}} % Name rf
			\uput[u](5,1.15){{\psk@pinrfnumber}} % Number rf
			\ifPst@invertpinf
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 1.25){{\psk@bubblesize}} % Invert Input rf
			\fi
		\fi
		% re
		\ifPst@pinre
			\psline(4.5,1.75)(5.5,1.75) % Input re
			\uput[l](4.5,1.75){{\psk@pinrelabel}} % Name re
			\uput[u](5,1.65){{\psk@pinrenumber}} % Number re
			\ifPst@invertpinre
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 1.75){{\psk@bubblesize}} % Invert Input re
			\fi
		\fi
		% rd
		\ifPst@pinrd
			\psline(4.5,2.25)(5.5,2.25) % Input rd
			\uput[l](4.5,2.25){{\psk@pinrdlabel}} % Name rd
			\uput[u](5,2.15){{\psk@pinrdnumber}} % Number rd
			\ifPst@invertpinrd
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 2.25){{\psk@bubblesize}} % Invert Input rd
			\fi
		\fi
		% rc
		\ifPst@pinrc
			\psline(4.5,2.75)(5.5,2.75) % Input rc
			\uput[l](4.5,2.75){{\psk@pinrclabel}} % Name rc
			\uput[u](5,2.65){{\psk@pinrcnumber}} % Number rc
			\ifPst@invertpinrc
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 2.75){{\psk@bubblesize}} % Invert Input rc
			\fi
		\fi
		% rb
		\ifPst@pinrb
			\psline(4.5,3.25)(5.5,3.25) % Input rb
			\uput[l](4.5,3.25){{\psk@pinrblabel}} % Name rb
			\uput[u](5,3.15){{\psk@pinrbnumber}} % Number rb
			\ifPst@invertpinrb
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 3.25){{\psk@bubblesize}} % Invert Input rb
			\fi
		\fi
		% ra
		\ifPst@pinra
			\psline(4.5,3.75)(5.5,3.75) % Input ra
			\uput[l](4.5,3.75){{\psk@pinralabel}} % Name ra
			\uput[u](5,3.65){{\psk@pinranumber}} % Number ra
			\ifPst@invertpinra
				\pscircle[fillstyle=solid](! 4 \space\psk@bubblesize\space add 3.75){{\psk@bubblesize}} % Invert Input ra
			\fi
		\fi
		% Top Pins
		% ta
		\ifPst@pinta
			\psline(1.75,4.5)(1.75,5.5) % Input ta
			\uput[d](1.75,4.5){{\psk@pintalabel}} % Name ta
			\uput[l](1.75,5.05){{\psk@pintanumber}} % Number ta
			\ifPst@invertpinta
				\pscircle[fillstyle=solid](1.75,4.5){{\psk@bubblesize}} % Invert Input ta
			\fi
		\fi
		% tb
		\ifPst@pintb
			\psline(2.25,4.5)(2.25,5.5) % Input tb
			\uput[d](2.25,4.5){{\psk@pintblabel}} % Name tb
			\uput[l](2.25,5.05){{\psk@pintbnumber}} % Number tb
			\ifPst@invertpintb
				\pscircle[fillstyle=solid](2.25,4.5){{\psk@bubblesize}} % Invert Input tb
			\fi
		\fi
		% tc
		\ifPst@pintc
			\psline(2.75,4.5)(2.75,5.5) % Input tc
			\uput[d](2.75,4.5){{\psk@pintclabel}} % Name tc
			\uput[l](2.75,5.05){{\psk@pintcnumber}} % Number tc
			\ifPst@invertpintc
				\pscircle[fillstyle=solid](2.75,4.5){{\psk@bubblesize}} % Invert Input tc
			\fi
		\fi
		% td
		\ifPst@pintd
			\psline(3.25,4.5)(3.25,5.5) % Input td
			\uput[d](3.25,4.5){{\psk@pintdlabel}} % Name td
			\uput[l](3.25,5.05){{\psk@pintdnumber}} % Number td
			\ifPst@invertpintd
				\pscircle[fillstyle=solid](3.25,4.5){{\psk@bubblesize}} % Invert Input td
			\fi
		\fi
		% te
		\ifPst@pinte
			\psline(3.75,4.5)(3.75,5.5) % Input te
			\uput[d](3.75,4.5){{\psk@pintelabel}} % Name te
			\uput[l](3.75,5.05){{\psk@pintenumber}} % Number te
			\ifPst@invertpinte
				\pscircle[fillstyle=solid](3.75,4.5){{\psk@bubblesize}} % Invert Input te
			\fi
		\fi
		% Bottom Pins
		% ba
		\ifPst@pinba
			\psline(1.75,0)(1.75,-1) % Input ba
			\uput[u](1.75,0){{\psk@pinbalabel}} % Name ba
			\uput[l](1.75,-0.55){{\psk@pinbanumber}} % Number ba
			\ifPst@invertpinba
				\pscircle[fillstyle=solid](1.75,0){{\psk@bubblesize}} % Invert Input ba
			\fi
		\fi
		% bb
		\ifPst@pinbb
			\psline(2.25,0)(2.25,-1) % Input bb
			\uput[u](2.25,0){{\psk@pinbblabel}} % Name bb
			\uput[l](2.25,-0.55){{\psk@pinbbnumber}} % Number bb
			\ifPst@invertpinbb
				\pscircle[fillstyle=solid](2.25,0){{\psk@bubblesize}} % Invert Input bb
			\fi
		\fi
		% bc
		\ifPst@pinbc
			\psline(2.75,0)(2.75,-1) % Input bc
			\uput[u](2.75,0){{\psk@pinbclabel}} % Name bc
			\uput[l](2.75,-0.55){{\psk@pinbcnumber}} % Number bc
			\ifPst@invertpinbc
				\pscircle[fillstyle=solid](2.75,0){{\psk@bubblesize}} % Invert Input bc
			\fi
		\fi
		% bd
		\ifPst@pinbd
			\psline(3.25,0)(3.25,-1) % Input bd
			\uput[u](3.25,0){{\psk@pinbdlabel}} % Name bd
			\uput[l](3.25,-0.55){{\psk@pinbdnumber}} % Number bd
			\ifPst@invertpinbd
				\pscircle[fillstyle=solid](3.25,0){{\psk@bubblesize}} % Invert Input bd
			\fi
		\fi
		% be
		\ifPst@pinbe
			\psline(3.75,0)(3.75,-1) % Input be
			\uput[u](3.75,0){{\psk@pinbelabel}} % Name be
			\uput[l](3.75,-0.55){{\psk@pinbenumber}} % Number be
			\ifPst@invertpinbe
				\pscircle[fillstyle=solid](3.75,0){{\psk@bubblesize}} % Invert Input be
			\fi
		\fi	
		% Right Decimal Point
		\ifPst@dpright
			\pscircle[linewidth=0.5\pslinewidth](3.75,0.75){0.1}
		\fi
		% Left Decimal Point
		\ifPst@dpleft
			\pscircle[linewidth=0.5\pslinewidth](1.75,0.75){0.1}
		\fi	
		% Body
		\psline[linewidth=1.5\pslinewidth](1,0)(1,4.5)(4.5,4.5)(4.5,0)(1,0)
		% Segments
		\ifcase\psk@segmentdisplay
			% Display 0
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,3.65)(3.45,3.85) % a
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,2.35)(3.65,3.65) % b
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,0.85)(3.65,2.15) % c
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,0.65)(3.45,0.85) % d
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](1.85,0.85)(2.05,2.15) % e
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](1.85,2.35)(2.05,3.65) % f
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](2.05,2.15)(3.45,2.35) % g
		\or 
			% Display 1
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](2.05,3.65)(3.45,3.85) % a
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,2.35)(3.65,3.65) % b
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,0.85)(3.65,2.15) % c
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](2.05,0.65)(3.45,0.85) % d
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](1.85,0.85)(2.05,2.15) % e
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](1.85,2.25)(2.05,3.65) % f
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](2.05,2.15)(3.45,2.35) % g
		\or 
			% Display 2
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,3.65)(3.45,3.85) % a
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,2.35)(3.65,3.65) % b
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](3.45,0.85)(3.65,2.15) % c
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,0.65)(3.45,0.85) % d
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](1.85,0.85)(2.05,2.15) % e
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](1.85,2.35)(2.05,3.65) % f
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,2.15)(3.45,2.35) % g
		\or 
			% Display 3
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,3.65)(3.45,3.85) % a
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,2.35)(3.65,3.65) % b
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,0.85)(3.65,2.15) % c
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,0.65)(3.45,0.85) % d
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](1.85,0.85)(2.05,2.15) % e
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](1.85,2.35)(2.05,3.65) % f
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,2.15)(3.45,2.35) % g
		\or 
			% Display 4
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](2.05,3.65)(3.45,3.85) % a
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,2.25)(3.65,3.65) % b
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,0.85)(3.65,2.15) % c
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](2.05,0.65)(3.45,0.85) % d
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](1.85,0.85)(2.05,2.15) % e
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](1.85,2.35)(2.05,3.65) % f
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,2.15)(3.45,2.35) % g
		\or 
			% Display 5
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,3.65)(3.45,3.85) % a
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](3.45,2.35)(3.65,3.65) % b
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,0.85)(3.65,2.15) % c
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,0.65)(3.45,0.85) % d
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](1.85,0.85)(2.05,2.15) % e
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](1.85,2.35)(2.05,3.65) % f
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,2.15)(3.45,2.35) % g
		\or 
			% Display 6
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](2.05,3.65)(3.45,3.85) % a
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](3.45,2.35)(3.65,3.65) % b
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,0.85)(3.65,2.15) % c
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,0.65)(3.45,0.85) % d
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](1.85,0.85)(2.05,2.15) % e
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](1.85,2.35)(2.05,3.65) % f
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,2.15)(3.45,2.35) % g
		\or 
			% Display 7
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,3.65)(3.45,3.85) % a
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,2.35)(3.65,3.65) % b
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,0.85)(3.65,2.15) % c
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](2.05,0.65)(3.45,0.85) % d
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](1.85,0.85)(2.05,2.15) % e
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](1.85,2.35)(2.05,3.65) % f
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](2.05,2.15)(3.45,2.35) % g
		\or 
			% Display 8
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,3.65)(3.45,3.85) % a
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,2.35)(3.65,3.65) % b
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,0.85)(3.65,2.15) % c
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,0.65)(3.45,0.85) % d
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](1.85,0.85)(2.05,2.15) % e
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](1.85,2.35)(2.05,3.65) % f
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,2.15)(3.45,2.35) % g
		\or 
			% Display 9
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,3.65)(3.45,3.85) % a
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,2.35)(3.65,3.65) % b
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](3.45,0.85)(3.65,2.15) % c
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](2.05,0.65)(3.45,0.85) % d
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](1.85,0.85)(2.05,2.15) % e
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](1.85,2.35)(2.05,3.65) % f
			\psframe[linewidth=0.5\pslinewidth,framearc=.9,fillstyle=solid,fillcolor=\psk@segmentcolor](2.05,2.15)(3.45,2.35) % g
		\or 
			% Display Blank
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](2.05,3.65)(3.45,3.85) % a
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](3.45,2.35)(3.65,3.65) % b
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](3.45,0.85)(3.65,2.15) % c
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](2.05,0.65)(3.45,0.85) % d
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](1.85,0.85)(2.05,2.15) % e
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](1.85,2.35)(2.05,3.65) % f
			\psframe[linewidth=0.5\pslinewidth,framearc=.9](2.05,2.15)(3.45,2.35) % g
		\fi
		% Segment Labels
		\ifPst@segmentlabels
			\uput[d](2.75,3.75){\footnotesize{a}}
			\uput[l](3.55,3.05){\footnotesize{b}}
			\uput[l](3.55,1.55){\footnotesize{c}}
			\uput[u](2.75,0.75){\footnotesize{d}}
			\uput[r](1.95,1.55){\footnotesize{e}}
			\uput[r](1.95,3.05){\footnotesize{f}}
			\uput[u](2.75,2.35){\footnotesize{g}}
		\fi
		% Name
		\uput[r](4.5,0){#4}%
	}}%
\ignorespaces
}

%
% PLC Ladder Logic
%

%
% \xic (XIC)
%
\def\xic{\@ifnextchar[{\pst@xic}{\pst@xic[]}}
\def\pst@xic[#1](#2){{%
	\psset{#1}%		
	\rput(#2){
	% Input
	\psline(-1,0)(-0.25,0) % Input
	% Body
	\psline(-0.6,-0.35)(-0.25,-0.35)(-0.25,0.35)(-0.6,0.35)
	\psline(0.6,-0.35)(0.25,-0.35)(0.25,0.35)(0.6,0.35)
	% Output
	\psline(1,0)(0.25,0)
	% Names
	\uput[u](0,0.3){\psk@plcaddress}
	\uput[d](0,-0.35){\psk@plcsymbol}
	\psset{}
	}}%
\ignorespaces
}

%
% \xio (XIO)
%
\def\xio{\@ifnextchar[{\pst@xio}{\pst@xio[]}}
\def\pst@xio[#1](#2){{%
	\psset{#1}%		
	\rput(#2){
	% Input
	\psline(-1,0)(-0.25,0) % Input
	% Body
	\psline(-0.6,-0.35)(-0.25,-0.35)(-0.25,0.35)(-0.6,0.35)
	\psline(0.6,-0.35)(0.25,-0.35)(0.25,0.35)(0.6,0.35)
	\psline(-0.6,-0.35)(0.6,0.35)
	% Output
	\psline(1,0)(0.25,0)
	% Name
	\uput[u](0,0.3){\psk@plcaddress}
	\uput[d](0,-0.35){\psk@plcsymbol}
	}}%
\ignorespaces
}

%
% \ote (OTE)
%
\def\ote{\@ifnextchar[{\pst@ote}{\pst@ote[]}}
\def\pst@ote[#1](#2){{%
	\psset{#1}%		
	\rput(#2){%
	% Input
	\psline(-1,0)(-0.6,0) % Input
	% Body
	\psline(-0.2,-0.35)(-0.6,-0.1)(-0.6,0.1)(-0.2,0.35)
	\psline(0.2,-0.35)(0.6,-0.1)(0.6,0.1)(0.2,0.35)
	% Output
	\psline(1,0)(0.6,0)
	% Name
	\ifPst@latch
		\uput[u](0,-0.3){L} % Latch
	\fi
	\ifPst@unlatch
		\uput[u](0,-0.3){U} % Unlatch
	\fi
	\uput[u](0,0.3){\psk@plcaddress}
	\uput[d](0,-0.35){\psk@plcsymbol}
	}}%
\ignorespaces
}
%
% \osr (OSR)
%
\def\osr{\@ifnextchar[{\pst@osr}{\pst@osr[]}}
\def\pst@osr[#1](#2){{%
	\psset{#1}%		
	\rput(#2){%
	% Input
	\psline(-1,0)(-0.7,0) % Input
	% Body
	\psline(-0.4,-0.35)(-0.7,-0.35)(-0.7,0.35)(-0.4,0.35)
	\psline(0.4,-0.35)(0.7,-0.35)(0.7,0.35)(0.4,0.35)
	% Output
	\psline(1,0)(0.7,0)
	% Name
	\uput[u](0,-0.3){OSR} % OSR
	\uput[u](0,0.3){\psk@plcaddress}
	\uput[d](0,-0.35){\psk@plcsymbol}
	}}%
\ignorespaces
}

%
% \res (RES)
%
\def\res{\@ifnextchar[{\pst@res}{\pst@res[]}}
\def\pst@res[#1](#2){{%
	\psset{#1}%		
	\rput(#2){%
	% Input
	\psline(-1,0)(-0.7,0) % Input
	% Body
	\psline(-0.4,-0.35)(-0.7,-0.1)(-0.7,0.1)(-0.4,0.35)
	\psline(0.4,-0.35)(0.7,-0.1)(0.7,0.1)(0.4,0.35)
	% Output
	\psline(1,0)(0.7,0)
	% Name
	\uput[u](0,-0.3){RES} % RES
	\uput[u](0,0.3){\psk@plcaddress}
	\uput[d](0,-0.35){\psk@plcsymbol}
	}}%
\ignorespaces
}

%
% Relay Ladder Logic
%

%
% \swpb (Switch PB)
%
\def\swpb{\@ifnextchar[{\pst@swpb}{\pst@swpb[]}}
\def\pst@swpb[#1](#2){{%
	\psset{#1}%		
	\rput(#2){%
	% Input
	\psline(-1,0)(-0.5,0) % Input
	% Body
	\pscircle[fillstyle=solid](-0.4,0){0.1}
	\pscircle[fillstyle=solid](0.4,0){0.1}
	\ifPst@contactclosed
		\psline[linewidth=1.5\pslinewidth](-0.4,-0.1)(0.4,-0.1)
		\psline[linewidth=1.5\pslinewidth](0,-0.1)(0,0.4)
	\else	
		\psline[linewidth=1.5\pslinewidth](-0.4,0.3)(0.4,0.3)
		\psline[linewidth=1.5\pslinewidth](0,0.3)(0,0.7)
	\fi
	% Output
	\psline(1,0)(0.5,0)
	}}%
\ignorespaces
}

%
% \swtog (Switch NO Toggle)
%
\def\swtog{\@ifnextchar[{\pst@swtog}{\pst@swtog[]}}
\def\pst@swtog[#1](#2){{%
	\psset{#1}%		
	\rput(#2){%
	% Input
	\psline(-1,0)(-0.5,0) % Input
	% Body
	\pscircle[fillstyle=solid](-0.4,0){0.1}
	\pscircle[fillstyle=solid](0.4,0){0.1}
	\ifPst@contactclosed
		\psline[linewidth=1.5\pslinewidth](-0.3,0)(0.4,0.1)
	\else
		\psline[linewidth=1.5\pslinewidth](-0.3,0)(0.3,0.4)
	\fi
	% Output
	\psline(1,0)(0.5,0)
	}}%
\ignorespaces
}

%
% \contact (Contact)
%
\def\contact{\@ifnextchar[{\pst@contact}{\pst@contact[]}}
\def\pst@contact[#1](#2){{%
	\psset{#1}%		
	\rput(#2){%
	% Input
	\psline(-1,0)(-0.2,0) % Input
	% Body
	\psline(-0.2,-0.35)(-0.2,0.35)
	\psline(0.2,-0.35)(0.2,0.35)
	\ifPst@contactclosed
		\psline(-0.6,-0.35)(0.6,0.35)
	\fi
	% Output
	\psline(1,0)(0.2,0)
	% Name
	\uput[u](0,0.3){\psk@plcaddress}
	\uput[d](0,-0.35){\psk@plcsymbol}
	}}%
\ignorespaces
}

%
% \motor (Motor Armature)
%
\def\armature{\@ifnextchar[{\pst@armature}{\pst@armature[]}}
\def\pst@armature[#1](#2){{%
	\psset{#1}%		
	\rput(#2){%
	% Input
	\psline(-1,0)(-0.7,0)
	%\psline[linewidth=8pt](-0.75,0)(-0.5,0)
	% Body
	\psline(-0.7,0.2)(0.7,0.2)(0.7,-0.2)(-0.7,-0.2)(-0.7,0.2)
	\pscircle[fillstyle=solid](0,0){0.5}
	% Output
	\psline(1,0)(0.7,0)
	%\psline[linewidth=8pt](0.75,0)(0.5,0)
	% Name
	\uput[u](0,0.3){\psk@plcaddress}
	\uput[d](0,-0.35){\psk@plcsymbol}
	}}%
\ignorespaces
}

%
% Modified pst-circ Components
%
%
% \newcapacitor
%
\def\newcapacitor{\@ifnextchar[{\pst@newcapacitor}{\pst@newcapacitor[]}}
\def\pst@newcapacitor[#1](#2)(#3)#4{{%
  \pst@draw@dipole{#1}{#2}{#3}{#4}\pst@draw@newcapacitor}\ignorespaces}
%
\def\pst@draw@newcapacitor{{%
  \psset{linewidth=1.5\pslinewidth}%
		\psline[arrows=-](-0.1,-0.3)(-0.1,0.3)
		\psline[arrows=-](0.1,-0.3)(0.1,0.3)
		\pnode(-0.1,0){dipole@1}
    \pnode(0.1,0){dipole@2}
		\ifPst@variable%
			\psline[arrows=->](-0.5,-0.55)(0.5,0.55)%
		\fi
		\ifPst@polarized%
			\rput[u](0,0){$+$}%
		\fi
}}

%
% \newDiode
%
\def\newdiode{\@ifnextchar[{\pst@newdiode}{\pst@newdiode[]}}
\def\pst@newdiode[#1](#2)(#3)#4{{%
	\pst@draw@dipole{#1}{#2}{#3}{#4}\pst@draw@newdiode}
	\ignorespaces}
%
\def\pst@draw@newdiode{{%
	\ifx\psk@Dstyle\pst@Dstyle@triac
		\pspolygon[linewidth=1.5\pslinewidth](-0.25,-0.4)(-0.25,0)(0.25,-0.2)
		\pspolygon[linewidth=1.5\pslinewidth](0.25,0)(-0.25,0.2)(0.25,0.4)
		\psline[arrows=-,linewidth=1.5\pslinewidth](-0.25,-0.4)(-0.25,0.4)
		\psline[arrows=-,linewidth=1.5\pslinewidth](0.25,-0.4)(0.25,0.4)
		\psline[arrows=-,linewidth=\pslinewidth](0.25,-0.2)(0.5,-0.3)(0.5,-0.6)
	\else
		\ifPst@ison%
	  		\pspolygon[arrows=-,linewidth=1.5\pslinewidth,%
			fillstyle=solid,fillcolor=black](-0.25,-0.3)(-0.25,0.3)(0.25,0)
		\else
			\pspolygon[arrows=-,linewidth=1.5\pslinewidth]%
			(-0.25,-0.3)(-0.25,0.3)(0.25,0)
		\fi
		\psline[arrows=-,linewidth=1.5\pslinewidth](0.25,0.3)(0.25,-0.3)
		\ifx\psk@Dstyle\pst@Dstyle@thyristor
			\psline[arrows=-,linewidth=1.5\pslinewidth](0,-0.1)(0,-0.35)
		\fi
		\ifx\psk@Dstyle\pst@Dstyle@GTO
			\psline[arrows=-,linewidth=1.5\pslinewidth](-0.1,-0.12)(-0.1,-0.35)
			\psline[arrows=-,linewidth=1.5\pslinewidth](0,-0.1)(0,-0.35)
		\fi
	\fi
	\pnode(-0.25,0){dipole@1}
	\pnode(0.25,0){dipole@2}
}}

%
% \newZener
%
\def\newZener{\@ifnextchar[{\pst@newZener}{\pst@newZener[]}}
\def\pst@newZener[#1](#2)(#3)#4{{%
	\pst@draw@dipole{#1}{#2}{#3}{#4}\pst@draw@newZener}
	\ignorespaces}
%
\def\pst@draw@newZener{{%
	\ifPst@ison%
		\pspolygon[arrows=-,linewidth=1.5\pslinewidth,%
		fillstyle=solid,fillcolor=black](-0.25,-0.3)(-0.25,0.3)(0.25,0)
	\else
		\pspolygon[arrows=-,linewidth=1.5\pslinewidth]%
		(-0.25,-0.3)(-0.25,0.3)(0.25,0)
	\fi
	\psline[arrows=-,linewidth=1.5\pslinewidth](0.1,0.4)(0.25,0.3)(0.25,-0.3)(0.4,-0.4)
	\pnode(-0.25,0){dipole@1}
	\pnode(0.25,0){dipole@2}
}}

%
% \newLED
%
\def\newLED{\@ifnextchar[{\pst@newLED}{\pst@newLED[]}}
\def\pst@newLED[#1](#2)(#3)#4{{%
  \pst@draw@dipole{#1}{#2}{#3}{#4}\pst@draw@newLED}
	\pst@getcoor{#2}\pst@tempa
  \pst@getcoor{#3}\pst@tempb
  \ignorespaces}
%
\def\pst@draw@newLED{{%
	\ifPst@ison%
		\pspolygon[arrows=-,linewidth=1.5\pslinewidth,%
		fillstyle=solid,fillcolor=black](-0.25,-0.3)(-0.25,0.3)(0.25,0)
	\else
		\pspolygon[arrows=-,linewidth=1.5\pslinewidth]%
		(-0.25,-0.3)(-0.25,0.3)(0.25,0)
	\fi
	\psline[arrows=-,linewidth=1.5\pslinewidth](0.25,0.3)(0.25,-0.3)
	\multips(-0.15,0.35)(0.2,0){2}{\psline[arrows=->](0,0)(0.2,0.25)}
	\pnode(-0.25,0){dipole@1}
	\pnode(0.25,0){dipole@2}
}}

%
% \newarmature
%
\def\newarmature{\@ifnextchar[{\pst@newarmature}{\pst@newarmature[]}}
\def\pst@newarmature[#1](#2)(#3)#4{{%
  \pst@draw@dipole{#1}{#2}{#3}{#4}\pst@draw@newarmature}\ignorespaces}
%
\def\pst@draw@newarmature{{%
  \pnode(-1,0){dipole@1}
  \pnode(1,0){dipole@2}
  % Input
  \psline(-1,0)(-0.7,0)
  % Body
  \psline(-0.7,0.2)(0.7,0.2)(0.7,-0.2)(-0.7,-0.2)(-0.7,0.2)
  \pscircle[fillstyle=solid](0,0){0.5}
  % Output
  \psline(1,0)(0.7,0)
  % Name
  \ifcase\psk@labelInside\or% do nothing
    \rput(0,0){\large\bf M}\or% case 1 - motor
    \rput(0,0){\large\bf G}% case 2 - generator
  \fi
}}

%
% \vdc
%
\def\vdc{\@ifnextchar[{\pst@vdc}{\pst@vdc[]}}
\def\pst@vdc[#1](#2)(#3)#4{{%
  \pst@draw@dipole{#1}{#2}{#3}{#4}\pst@draw@vdc}\ignorespaces}
%
\def\pst@draw@vdc{{%
  \psline[arrows=-,linewidth=1.5\pslinewidth](-0.30,-0.5)(-0.30,0.5)
  \psline[arrows=-,linewidth=3\pslinewidth](-0.10,-0.25)(-0.10,0.25)
  \psline[arrows=-,linewidth=1.5\pslinewidth](0.10,-0.5)(0.10,0.5)
  \psline[arrows=-,linewidth=3\pslinewidth](0.30,-0.25)(0.30,0.25)
  \pnode(-0.3,0){dipole@1}
  \pnode(0.3,0){dipole@2}
  \ifPst@variable%
    \psline{->}(-0.75,-0.5)(0.75,0.5)%
  \fi
}}

%
% \vac
%
\def\vac{\@ifnextchar[{\pst@vac}{\pst@vac[]}}
\def\pst@vac[#1](#2)(#3)#4{{%
  \pst@draw@dipole{#1}{#2}{#3}{#4}\pst@draw@vac
	\pst@getcoor{#2}\pst@tempa
  \pst@getcoor{#3}\pst@tempb
	\rput(! 5 dict begin
	\pst@tempa \pst@number{\psyunit} div /YA ED
	\pst@number{\psxunit} div /XA ED
	\pst@tempb \pst@number{\psyunit} div /YB ED
	\pst@number{\psxunit} div /XB ED
	XA XB add 2 div
	YA YB add 2 div
	end ){\pscurve(-0.25,0)(-0.125,0.25)(0.125,-0.25)(0.25,0)}}\ignorespaces}
%
\def\pst@draw@vac{{%
  \pnode(-0.5,0){dipole@1}
  \pnode(0.5,0){dipole@2}
  \pscircle[linewidth=1.5\pslinewidth](0,0){0.5}	
}}

%
% \newSwitch (New Switch)
%
\def\newSwitch{\@ifnextchar[{\pst@newSwitch}{\pst@newSwitch[]}}
\def\pst@newSwitch[#1](#2)(#3)#4{{%
  \pst@draw@dipole{#1}{#2}{#3}{#4}\pst@draw@newSwitch}
	\pst@getcoor{#2}\pst@tempa
  \pst@getcoor{#3}\pst@tempb
  \ignorespaces}
%
\def\pst@draw@newSwitch{{%
  \ifPst@ison
    \pnode(-0.6,0){dipole@1}
    \pnode(0.6,0){dipole@2}
    \psline[arrows=-,linewidth=4\pslinewidth](-0.5,-0.005)(0.5,-0.005)
    \pscircle[fillstyle=solid,fillcolor=black](-0.5,0){0.1}
    \pscircle[fillstyle=solid,fillcolor=black](0.5,0){0.1}
  \else
    \pnode(-0.6,0){dipole@1}
    \pnode(0.6,0){dipole@2}
    \psline[arrows=-,linewidth=2\pslinewidth](-0.5,0)(0.5,0.5)
    \pscircle[fillstyle=solid](-0.5,0){0.1}
    \pscircle[fillstyle=solid](0.5,0){0.1}
  \fi
}}
%
% PHOTOVOLTAIC CELL
%
% \cell
%
\def\cell{\@ifnextchar[{\pst@cell}{\pst@cell[]}}
\def\pst@cell[#1](#2)(#3)#4{{%
	\pst@draw@dipole{#1}{#2}{#3}{#4}\pst@draw@cell}
%  \pst@getcoor{#2}\pst@tempa
%  \pst@getcoor{#3}\pst@tempb
  \ignorespaces}
%
\def\pst@draw@cell{{%
  \pscircle(0.1,0){0.5}
  \psline[linewidth=2.5\pslinewidth](-0.1,-0.2)(-0.1, 0.2)
  \psline[linewidth=2\pslinewidth](0.1,-0.4)(0.1, 0.4)
  \psline[arrows=->](0.9,1)(0.5,0.6)
  \psline[arrows=->](0.6,1)(0.2,0.6)
  \wire(-0.6,0)(-0.1,0)
  \wire(0.6,0)(0.1,0)
  \pnode(-0.6,0){dipole@1}
  \pnode(0.6,0){dipole@2}%
}\ignorespaces}%
%
% \splitter
%
\def\splitter{\pst@object{splitter}}
\def\splitter@i(#1)(#2)(#3)#4#5{%
  \pst@getcoor{#1}\pst@tempa
  \pst@getcoor{#2}\pst@tempb
  \pst@getcoor{#3}\pst@tempc
  \pnode(!%
    \pst@tempa /Y1 exch \pst@number\psyunit div def
    /X1 exch \pst@number\psxunit div def
    \pst@tempb /Y2 exch \pst@number\psyunit div def
    /X2 exch \pst@number\psxunit div def
    \pst@tempc /Y3 exch \pst@number\psyunit div def
    /X3 exch \pst@number\psxunit div def
    /XC X1 X2 add 2 div def
    /YC Y2 def
    XC YC){C@}
  \begingroup
  \use@keep@par
  \ifx\psk@tripole@style\pst@tripole@style@top
    \addbefore@par{labeloffset=-0.9,dimen=middle}%
  \else
    \addbefore@par{labeloffset=0.9,dimen=middle}%
  \fi
  \use@par
  \rput(C@){\pst@draw@splitter{#3}{#4}{#5}}
  \ifx\psk@Tinput\pst@Tinput@left%
    \ifPst@inputarrow
        \ncangle[arrows=->,arrowinset=0,arm=0.5,angleB=180]{#1}{Tport@left}
    \else
        \ncangle[arrows=-,arm=0.5,angleB=180]{#1}{Tport@left}
    \fi
    \ncangle[arrows=-, arm=0.5,angleB=0]{#2}{Tport@right}
  \else
    \ifPst@inputarrow
        \ncangle[arrows=->,arrowinset=0,arm=0.5,angleB=0]{#2}{Tport@right}
    \else
        \ncangle[arrows=-,arm=0.5,angleB=0]{#2}{Tport@right}
    \fi
    \ncangle[arrows=-,arm=0.5,angleB=180]{#1}{Tport@left}
  \fi
  \endgroup
  \pcline[linestyle=none](#1)(#2)% for the endarrows
  \pcline[linestyle=none](#2)(#3)% for the endarrows
  \ignorespaces%
}
\def\pst@draw@splitter#1#2#3{%
  \psframe[linewidth=1.5\pslinewidth](-0.5,-0.5)(0.5,0.5)
  \let\psk@fillstyle\psfs@none
 %% Diagonal line within the square
  \ifx\psk@Tinput\pst@Tinput@left%
	\ifx\psk@tripole@style\pst@tripole@style@top%
  	\psline[linewidth=1.5\pslinewidth](-0.5,0.5)(0.5,-0.5)
	\else
	\psline[linewidth=1.5\pslinewidth](-0.5,-0.5)(0.5,0.5)
	\fi
  \else
     \ifx\psk@tripole@style\pst@tripole@style@top%
       \psline[linewidth=1.5\pslinewidth](-0.5,-0.5)(0.5,0.5)
     \else
	\psline[linewidth=1.5\pslinewidth](-0.5,0.5)(0.5,-0.5)
     \fi
  \fi
  \pnodes(-0.5,0){Tport@left}(0.5,0){Tport@right}%
  \pcline[offset=\psk@label@offset,linestyle=none](Tport@left)(Tport@right)\ncput{#2}%
  \ifx\psk@tripole@style\pst@tripole@style@top%
    \pnode(0,0.5){Tport@center}
    \ncangle[arrows=-,arm=0.5,angleB=90]{#1}{Tport@center}
  \else
    \pnode(0,-0.5){Tport@center}
    \ncangle[arrows=-,arm=0.5,angleB=270]{#1}{Tport@center}
  \fi% 
}
%
%%% Attenuator %%%
%
\newCircDipole{attenuator}
\def\pst@draw@attenuator{%
    \pnode(-0.433,0){dipole@1}
    \pnode(0.433,0){dipole@2}
    \psline[fillstyle=none, arrowinset=0](-0.5,0)(0.5,0)
    \ifx\psk@Dinput\pst@Dinput@right
	\psline[linewidth=1.5\pslinewidth,fillstyle=none](-0.10825,0.433)(0.10825,0.2165)(-0.10825,0)(0.10825,-0.2165)(-0.10825,-0.433)
    \else
   	\psline[linewidth=1.5\pslinewidth, fillstyle=none](0.10825,0.433)(-0.10825,0.2165)(0.10825,0)(-0.10825,-0.2165)(0.10825,-0.433)
    \fi
}
%
% THIS CAN BE SET AS AN OPTION OF THE OSCILLATOR...
% IT'S UP TO YOU...
%
%%% Modulator
%
\newCircDipole{modulator}
\def\pst@draw@modulator{%
    \pnode(-0.5,0){dipole@1}
    \pnode(0.5,0){dipole@2}
    \pscircle[linewidth=1.5\pslinewidth](0,0){0.5}
    \ifx\psk@Dinput\pst@Dinput@right
      	\psline[linewidth=1.5\pslinewidth]{cc-cc}(-0.3,-0.1)(0,0.2)(0,-0.1)(0.3,-0.1)
    \else
    	\psline[linewidth=1.5\pslinewidth]{cc-cc}(-0.3,-0.1)(0,-0.1)(0,0.2)(0.3,-0.1)
    \fi
}
%
%%% Plug %%%
%
\def\plug{\@ifnextchar[{\pst@plug}{\pst@plug[]}}
\def\pst@plug[#1]{%
    \@ifnextchar({\pst@plugi[#1]{0}}{\pst@plugi[#1]}%
}
\def\pst@plugi[#1]#2(#3){{%
    \psset{#1}%
    \rput{#2}(#3){%
        \psline[linewidth=1.5\pslinewidth](0,0)(0,-0.3)(1.2,-0.3)(1.5,0)(1.2,0.3)(0,0.3)(0,0)
    }}%
    \ignorespaces%
}
%
% \ampsinu
%
% THIS CAN ALSO BE SET AS AN OPTION FOR THE AMPLIFIER...
% IT'S UP TO YOU
\newCircDipole{ampsinu}
\def\pst@draw@ampsinu{%
    \pnode(-0.433,0){dipole@1}
    \pnode(0.433,0){dipole@2}
    \ifx\psk@Dinput\pst@Dinput@right
        \pstriangle[gangle=90,linewidth=1.5\pslinewidth](0.433,0)(1,0.866)
        \pscurve[fillstyle=none,linewidth=1\pslinewidth](0.071625,-0.20)(0.025,-0.125)(0.061625,-0.05)%
                                    (0.15,0.025)(0.238375,0.1)(0.275,0.175)(0.238375,0.25)
    \else
        \pstriangle[gangle=-90,linewidth=1.5\pslinewidth](-0.433,0)(1,0.866)
        \pscurve[fillstyle=none,linewidth=1\pslinewidth](-0.071625,-0.20)(-0.025,-0.125)(-0.061625,-0.05)%
                                    (-0.15,0.025)(-0.238375,0.1)(-0.275,0.175)(-0.238375,0.25)
    \fi
}
%
%%% newtransformer %%%
%
\newCircDipole{newtransformer}
\def\pst@draw@newtransformer{%
    \pnode(-0.8,0){dipole@1}
    \pnode(0.8,0){dipole@2}
    \pscircle[linewidth=1.5\pslinewidth](-0.3,0){0.5}
    \pscircle[linewidth=1.5\pslinewidth](0.3,0){0.5}
}
%


\def\newtransformerquad{\pst@object{newtransformerquad}}% 
\def\newtransformerquad@i(#1)(#2)(#3)(#4)#5{%
  \addbefore@par{dimen=middle,arm=0}%
  \begin@ClosedObj%
  \pst@getcoor{#1}\pst@tempa
  \pst@getcoor{#2}\pst@tempb
  \pst@getcoor{#3}\pst@tempc
  \pst@getcoor{#4}\pst@tempd
  \pnode(!%
    \pst@tempa /Y1 exch \pst@number\psyunit div def
    /X1 exch \pst@number\psxunit div def
    \pst@tempb /Y2 exch \pst@number\psyunit div def
    /X2 exch \pst@number\psxunit div def
    \pst@tempc /Y3 exch \pst@number\psyunit div def
    /X3 exch \pst@number\psxunit div def
    \pst@tempd /Y4 exch \pst@number\psyunit div def
    /X4 exch \pst@number\psxunit div def
    /XC X1 X2 lt {X2} {X1} ifelse X3 X4 lt {X3} {X4} ifelse add 2 div def
    /YC Y1 Y3 lt {Y1} {Y3} ifelse Y2 Y4 lt {Y2} {Y4} ifelse add 2 div def
    XC YC){C@}
  \rput(C@){#5}
  \rput(C@){\pscircle[linewidth=1.5\pslinewidth](-0.3,0){0.5}
			\pscircle[linewidth=1.5\pslinewidth](0.3,0){0.5}
			\pnode(-1,0.3){inup@}    \pnode(-1,-0.3){indown@}
			\pnode(1,-0.3){outdown@} \pnode(1,0.3){outup@}
			\psline(inup@)(-0.7,0.3) \psline(indown@)(-0.7,-0.3)
			\psline(outup@)(0.7,0.3) \psline(outdown@)(0.7,-0.3)}
  \ncangle[arrows=-,arm=0.5,angleB=180]{#1}{inup@}
  \ncangle[arrows=-,arm=0.5,angleB=180]{#2}{indown@}
  \ncangle[arrows=-,arm=0.5,angleB=0]{#3}{outup@}
  \ncangle[arrows=-,arm=0.5,angleB=0]{#4}{outdown@}
  \ncline[arrows=-,linestyle=none,fillstyle=none]{indown@}{outdown@}
  \pcline[linestyle=none](#1)(#3)% for the end arrows
  \pcline[linestyle=none](#2)(#4)% for the end arrows
  \end@ClosedObj%
  \ignorespaces%
}

\newCircDipole{arrowswitch}
\def\pst@draw@arrowswitch{%
  \ifx\psk@Dstyle\pst@Dstyle@close
    \pnode(-0.5,0){dipole@1}
    \pnode(0.5,0){dipole@2}
    \qdisk(-0.5,0){1.5pt}
    \qdisk(0.5,0){1.5pt}
    \psline[arrows=-,linewidth=2\pslinewidth](-0.5,0.05)(0.5,0.05)
    \psarc[arrowinset=0]{->}(-0.5,0){0.75}{-45}{45}
  \else
    \pnode(-0.55,0){dipole@1}
    \pnode(0.5,0){dipole@2}
    \psline[arrows=-,linewidth=2\pslinewidth](-0.5,0)(0.5,0.5)
    \psarcn[arrowinset=0]{->}(-0.5,0){0.75}{45}{-45}
    \pscircle[fillstyle=solid](-0.5,0){0.07}
    \qdisk(0.5,0){1.5pt}
  \fi
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Tripole
%%% powermeter: tripolestyle:(bottom) | top
%%%             tripoleconfig: (left) | right
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\powermeter{\pst@object{powermeter}}
\def\powermeter@i(#1)(#2)(#3)#4{%
  \addbefore@par{dimen=middle,arm=0}%
  \begin@ClosedObj%
  \pst@getcoor{#1}\pst@tempa
  \pst@getcoor{#2}\pst@tempb
  \pst@getcoor{#3}\pst@tempc
  \pnode(!%
    \pst@tempa /Y1 exch \pst@number\psyunit div def
    /X1 exch \pst@number\psxunit div def
    \pst@tempb /Y2 exch \pst@number\psyunit div def
    /X2 exch \pst@number\psxunit div def
    \pst@tempc /Y3 exch \pst@number\psyunit div def
    /X3 exch \pst@number\psxunit div def
    /XC X1 X2 add 2 div def
    /YC Y2 def
    XC YC){C@}
  \rput(C@){#4}
  \rput(C@){%
  \pscircle[linewidth=1.5\pslinewidth](0,0){0.5}
  \pnodes(-1,0){Tport@left}(1,0){Tport@right}%
  \psline[arrows=-](Tport@left)(-0.5,0)
  \psline[arrows=-](Tport@right)(0.5,0)
  \ifx\psk@tripole@style\pst@tripole@style@top%
    \pnode(0,1){Tport@center}
    \ifx\psk@Tconfig\pst@Tconfig@left
    \psdot(-0.8,0)
    \psline[arrows=-](-0.8,0)(-0.8,-0.8)(0,-0.8)(0,-0.5)
    \psline[arrows=-](0,0.5)(Tport@center)
    \else
    \psdot(0.8,0)
    \psline[arrows=-](0.8,0)(0.8,-0.8)(0,-0.8)(0,-0.5)
    \psline[arrows=-](0,0.5)(Tport@center)
    \fi%
    \ncangle[arrows=-,arm=0.25,angleB=-90]{#3}{Tport@center}
  \else  
    \pnode(0,-1){Tport@center}
    \ifx\psk@Tconfig\pst@Tconfig@left
    \psdot(-0.8,0)
    \psline[arrows=-](-0.8,0)(-0.8,0.8)(0,0.8)(0,0.5)
    \psline[arrows=-](0,-0.5)(Tport@center)
    \else
    \psdot(0.8,0)
    \psline[arrows=-](0.8,0)(0.8,0.8)(0,0.8)(0,0.5)
    \psline[arrows=-](0,-0.5)(Tport@center)
    \fi%
    \ncangle[arrows=-,arm=0.25,angleB=90]{#3}{Tport@center}
  \fi%
  }
  \ncangle[arrows=-,arm=0.25,angleB=180]{#1}{Tport@left}
  \ncangle[arrows=-,arm=0.25,angleB=0]{#2}{Tport@right}
  \pcline[linestyle=none](#1)(#2)% for the endarrows
  \pcline[linestyle=none](#2)(#3)% for the endarrows
  \end@ClosedObj%
  \ignorespaces%
}
%
%%% POWER IGBT %%%
%
\newCircDipole{igbt}
\def\pst@draw@igbt{%
    \pnode(-0.433,0){dipole@1}
    \pnode(0.433,0){dipole@2}
    %\psline[fillstyle=none, arrowinset=0](-0.433,-0.5)(0.5,0)
	\psdot(dipole@1)
	\psdot(dipole@2)
	\ifPst@IGBTinvert
		\psline[arrows=->,linewidth=1.5\pslinewidth, arrowsize =0.2, arrowinset=0](0.433,0)(-0.457,-0.457)
	\else
		\psline[arrows=->,linewidth=1.5\pslinewidth, arrowsize =0.2, arrowinset=0](0.433,0)(-0.457,0.457)
	\fi
}
%
%
%%% TRANSCONDUCTOR %%%
%
\def\pst@draw@GM{%
  \ifx\psk@tripole@style\pst@tripole@style@french
    \psframe[linewidth=1.5\pslinewidth](-1,-0.75)(1,0.75)
    \pspolygon(-0.4,-0.2)(-0.4,0.2)(-0.05,0)
  \else
% USUAL Transconductor
	\pspolygon[arrows=-, linewidth=1.5\pslinewidth](-0.5, -1)(-0.5, 1)(0.5, 0.6)(0.5, -0.6)(-0.5, -1)
% Supply pins Position
    \ifPst@GMpower
		  \psline{-}(0,0.8)(0,1)%\uput[90](0,1){$+$}
         	 %\psline{-o}(0,0.375)(0,0.75)\uput[90](0,0.75){$+$}
          \psline{-}(0,-0.8)(0,-1)%\uput[-90](0,-1){$-$}
         	 %\psline{-o}(0,-0.375)(0,-0.75)\uput[-90](0,-0.75){$-$}
    \fi
  \fi
% Input Pins Position
  \pnode(-0.5,0.5){\ifPst@GMinvert Minus@\else Plus@\fi}
  \pnode(-0.5,-0.5){\ifPst@GMinvert Plus@\else Minus@\fi}
  \pnode(0.5,0){S@}

% + and - Position
  \uput{0.1}[0](-0.5,0.5){\ifPst@GMinvert$-$\else$+$\fi}
 	 %\uput{0.1}[0](-1,0.25){\ifPst@OAinvert$-$\else$+$\fi}
  \uput{0.1}[0](-0.5,-0.5){\ifPst@GMinvert$+$\else$-$\fi}
 	 %\uput{0.1}[0](-1,-0.25){\ifPst@OAinvert$+$\else$-$\fi}
  \ifPst@GMperfect\rput(0.25,0){$\infty$}\fi%
}
%

\catcode`\@=\PstAtCode\relax
%
\endinput