%==================================================       amadeus.tex
%                  A M A D E U S
%          TEX macros for sketchy view
% By J\"uri Kiho                          26.03.99
%  	            3 CORRECTIONS FOR LaTeX: 04.04.2000 
%		    1 BUG CORRCTED, see !!!
%                   2 CORRECTIONS FOR LaTeX (strong arrow pos.): 20.09.2002 M
%==================================================

\magnification=1200 

%\def\textfont {\rm } %excluded for LaTeX
\def\scheme{\parindent=0pt %\textfont %excluded for LaTeX
\baselineskip=0pt 
\lineskip = 0pt %t\"aiendav, liikmete (hbox) vahele  
\obeylines
}

\def\hr{\hrule height 1pt width 10pt}
\def\hrbr{\hrule height 1pt width 9pt}
\def\hrbrloop{\hrbr
              \hrule width 0pt height 2pt
              \hrbr
             }
\def\HR{\hrule height 2pt width 10pt}
\def\HRBR{\hrule height 2pt width 9pt}
\def\vr{\vrule width 1pt}
\def\VR{\vrule width 2pt}
\def\ch{\vbox{\kern 6pt}}% skeemikommentaari (koha) k\~orgus
\def\vs{\vskip 4.5pt}% liikmete (hbox) vahe
\def\rowskip{\baselineskip=9pt}%teksti ridade paigutamise vahe
%\def\vs{\vskip 5pt}%reavahe
\def\vsneg{\vskip-5.5pt}%haru p\"aise lopus
\def\hs{\hskip 5.5pt}
\def\hsneg{\hskip -5.5pt}
\def\schemecomment#1{\hbox{\shift{\commentstyle #1\ch}}}
\def\shift{\kern 12pt}%hr pikkus + 2
\def\schemecommentshiftup{\vskip -3pt}
\def\schemecommentshiftdown{\vskip 3pt}

\def\commentstyle{\sl }
\def\textcomment#1{\hbox{\hs  - - - {\commentstyle #1}}}

\def\simpletag{\hskip 1pt{\bf\ \ }}
\def\looptag{\hskip 1pt{\bf$\star$\ }}
\def\switchtag{\hskip 1pt{\bf??}}
\def\casetag{\hskip 1pt{\bf?\ }}
\def\defaulttag{\hskip 1pt{\bf?\ }}
\def\trytag{\hskip 1pt{\bf!!}}
\def\catchtag{\hskip 1pt{\bf!\ }}
\def\finallytag{\hskip 1pt{\bf!\ }}
\def\onelinecondtag{{\bf[?}\hskip 2pt}
\def\onelinelooptag{{\bf[$\star$}\hskip 3pt}
\def\sketchicontag{\hskip 1pt{\vrule width 5pt height 5pt\ }}
%\def\branchicontag{\hskip 1pt{\vrule width 5pt height 5pt\ }} 
\def\branchicontag{\hskip 3pt{\vrule width 4pt height 4pt\ }}% for LaTeX 

%1:teksti read
\def\primitive#1{\hbox{\vbox{\rowskip\vs#1 {}}}}

%1:teksti read 2:kommentaar
\def\primitivec#1#2{\hbox{\vbox{\rowskip\vs#1 {\textcomment{#2}}}}}


%1:tingimuse teksti read
\def\condition#1{\hsneg\hbox{\vbox{\rowskip\vs#1 {\bf?}}}}

%1:tingimuse teksti read 2:kommentaar
\def\conditionc#1#2{\hsneg\hbox{\vbox{\rowskip\vs#1 {\bf?} {\textcomment{#2}}}}}

%1:tingimusrida 2:sisurida
\def\onelinecond#1#2{\vs\hbox{\onelinecondtag(#1) #2}}

%1:tingimusrida 2:sisurida
\def\onelineloop#1#2{\vs\hbox{\onelinelooptag(#1) #2}}

%1:tingimusrida 2:sisurida1 #3:sisurida2
\def\onelinecondelse#1#2#3{\vs\hbox{\onelinecondtag(#1) #2 {\bf:} #3}}

%1:skeemikommentaar 2:tingimusrida 3:sisurida
\def\onelinecondc#1#2#3{\vs\hbox{\onelinecondtag(#2) #3{\textcomment{#1}}}}

%1:skeemikommentaar 2:tingimusrida 3:sisurida
\def\onelineloopc#1#2#3{\vs\hbox{\onelinelooptag(#2) #3{\textcomment{#1}}}}


%1:skeemikommentaar 2:tingimusrida 3:sisurida1 4:sisurida2
\def\onelinecondelsec#1#2#3#4{\vs\hbox{\onelinecondtag(#2) #3 {\bf:} #4{\textcomment{#1}}}}


%1:teksti read
\def\simplehead#1{\vs\hbox{\simpletag\vbox{\rowskip#1}}}

%1:teksti read 2:kommentaar
\def\simpleheadc#1#2{\vs\hbox{\simpletag\vbox{\rowskip  #1 {\textcomment{#2}}}}}

%1:teksti read
\def\loophead#1{\vs\hbox{\looptag\vbox{\rowskip#1}}}

%1:teksti read 2:kommentaar
\def\loopheadc#1#2{\vs\hbox{\looptag\vbox{\rowskip#1
{\textcomment{#2}}}}}

%1:teksti read
\def\switchhead#1{\vs\hbox{\switchtag\vbox{\rowskip#1}}}

%1:teksti read 2:kommentaar
\def\switchheadc#1#2{\vs\hbox{\switchtag\vbox{\rowskip#1
{\textcomment{#2}}}}}

%1:teksti read
\def\casehead#1{\vs\hbox{\casetag\vbox{\rowskip#1}}}

%1:teksti read 2:kommentaar
\def\caseheadc#1#2{\vs\hbox{\casetag\vbox{\rowskip#1 {\textcomment{#2}}}}}

%1:teksti read
\def\tryhead#1{\vs\hbox{\trytag\vbox{\rowskip#1}}}

%1:teksti read 2:kommentaar
\def\tryheadc#1#2{\vs\hbox{\trytag\vbox{\rowskip#1
{\textcomment{#2}}}}}

%1:teksti read
\def\catchhead#1{\vs\hbox{\catchtag\vbox{\rowskip#1}}}

%1:teksti read 2:kommentaar
\def\catchheadc#1#2{\vs\hbox{\catchtag\vbox{\rowskip#1 {\textcomment{#2}}}}}




%1:kommentaari rida
\def\sketchicon#1{\vs\hbox{\sketchicontag\vbox{\commentstyle #1}}}
%1:kommentaari rida
%!!!\def\branchicon#1{\vs\hbox{\sketchicontag\vbox{\commentstyle #1}}}%
\def\branchicon#1{\vs\hbox{\branchicontag\vbox{\commentstyle #1}}}%!!!M



%tugev nool
 % pikkused
\def\lenB{21pt}
\def\lenC{34pt}
\def\lenD{47pt}
\def\lenE{60pt}
\def\lenF{73pt}
\def\lenG{86pt}
\def\lenH{99pt}
\def\lenJ{112pt}
\def\lenI{125pt}
%1:pikkus 2:\primitive[c]{...
\def\arrow#1#2{\vs\kern-3pt
          %\hbox{\kern8pt\kern-#1$<$\kern-5pt\raise2.32pt
           \hbox{\kern8pt\kern-#1$<$\kern-7pt\raise2.7702pt %for LaTeX 20.09.2002
           \hbox{\vrule height0.25pt width#1}  #2}
           }

%n\~ork nool
 %pikkused
\def\t{\thinspace-}
\def\wlenB{-\t\t\t\t}
\def\wlenC{-\t\t\t\t\t\t}
\def\wlenD{-\t\t\t\t\t\t\t\t\t}
\def\wlenE{-\t\t\t\t\t\t\t\t\t\t\t}
\def\wlenF{-\t\t\t\t\t\t\t\t\t\t\t\t\t}
\def\wlenG{-\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}
\def\wlenH{-\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}
\def\wlenI{-\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}
%nihked
\def\wshiftB{\kern -11pt}
\def\wshiftC{\kern -24pt}
\def\wshiftD{\kern -37pt}
\def\wshiftE{\kern -50pt}
\def\wshiftF{\kern -63pt}
\def\wshiftG{\kern -76pt}
\def\wshiftH{\kern -89pt}
\def\wshiftI{\kern -102pt}
%1:pikkus 2:nihe 3:\primitive[c]{...
\def\weakarrow#1#2#3{\vs
        \hbox{#2 $<$\kern-5pt\raise 0.05pt\hbox{#1} #3}
           }

%p\"aiseta monoskeem (yhe, kommentaarita ja p\"aiseta haruga)
\def\simplesketch#1#2{ %1:skeemi kommentaar,  2:haru sisu
        \vbox{\vs  
              \schemecomment{#1}
              \schemecommentshiftup                  
              \hr
              \hbox{\vr\shift\vbox{
                          #2
                         \schemecommentshiftdown \schemecommentshiftdown}}
              \hr
              \schemecommentshiftup
              \schemecomment{#1}
         }
}
\def\loopsketch#1#2{ %1:skeemi kommentaar,  2:haru sisu
        \vbox{  \vs
                \schemecomment{#1}
                 \schemecommentshiftup
                \hr
                 \hrule width 1pt height 2pt
                 \hr
                    \hbox{\vr\shift\vbox{
                         #2
                        \schemecommentshiftdown \schemecommentshiftdown}}
                \hr
                 \hrule width 1pt height 2pt
                \hr
                 \schemecommentshiftup
                  \schemecomment{#1}
         }
}
 
\def\modulesketch#1#2{ %1:skeemi kommentaar,  2:haru sisu
        \vbox{\vs
                \schemecomment{#1}
                 \schemecommentshiftup
                \HR    
                \hbox{\VR\shift\vbox{
                         \schemecommentshiftdown
                         #2
                         \schemecommentshiftdown\schemecommentshiftdown}}
                \HR
                 \schemecommentshiftup
                 \schemecomment{#1}%\hbox{\shift{\commentstyle #1}}
         }
}
\def\simplesketchB#1#2#3{ %1:skeemi kommentaar,  2:skeemi pais,
                          %3:skeemi harud  
        \vbox{  \vs
                \schemecomment{#1}%\hbox{\shift {\commentstyle #1}}
                 \schemecommentshiftup
                \hr    
                \hbox{\vr\vbox{\schemecommentshiftdown#2}}
                \hbox{\vr\vbox{%\schemecommentshiftdown
                         #3 
                         }}       
                \hr
                \schemecommentshiftup
                \schemecomment{#1}%\hbox{\shift{\commentstyle #1}}
         }
}
\def\modulesketchB#1#2#3{ %1:skeemi kommentaar,  2:skeemi pais,
                          %3:skeemi harud  
        \vbox{  \vs
                \schemecomment{#1}
                \schemecommentshiftup
                \HR    
                \hbox{\VR\vbox{\schemecommentshiftdown#2}}
                 \hbox{\VR\vbox{
                         #3
                         }}
                \HR
                \schemecommentshiftup
                 \schemecomment{#1}%\hbox{\shift{\commentstyle #1}}
         }
}
\def\loopsketchB#1#2#3{ %1:skeemi kommentaar,  2:skeemi pais,
                          %3:skeemi harud  
        \vbox{  \vs
                \schemecomment{#1}
                 \schemecommentshiftup
                \hr
                \hbox{\vr\vbox{\schemecommentshiftdown#2}}
                 \hbox{\vr\vbox{
                         #3
                         }}
                \hr
                 \hrule width 1pt height 2pt
                \hr
                 \schemecommentshiftup
                \schemecomment{#1}
         }
}
\def\simplebranch#1#2#3{ %1:haru kommentaar,  2:haru pais,
                          %3:haru sisu  
        \vbox{  \vs
                \schemecomment{#1}
                 \schemecommentshiftup
                \hrbr    
                \hbox{\vbox{\schemecommentshiftdown#2}}
                \hbox{\shift\vbox{
                         #3
                        \vs
                        }}
         }
}
\def\modulebranch#1#2#3{ %1:haru kommentaar,  2:haru pais,
                          %3:haru sisu  
        \vbox{  \vs
                \schemecomment{#1}
                 \schemecommentshiftup
                \HRBR    
                \hbox{\vbox{\schemecommentshiftdown#2}}
                \hbox{\shift\vbox{
                         #3
                        \vs
                        }}
         }
}
\def\loopbranch#1#2#3{ %1:haru kommentaar,  2:haru pais,
                          %3:haru sisu  
        \vbox{  \vs
                \schemecomment{#1}
                 \schemecommentshiftup
                \hrbrloop    
                \hbox{\vbox{\schemecommentshiftdown#2}}
                \hbox{\shift\vbox{
                         #3
                        \vs
                        }}
         }
}
% muud skeemid.

%===========================================.

