| 1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
% wotree.sty 2000-06-29-20:18 % |
| 3 |
% Copyright (C) 2000 Eitan M. Gurari % |
| 4 |
% % |
| 5 |
% This program can redistributed and/or modified under % |
| 6 |
% the terms of the LaTeX Project Public License % |
| 7 |
% Distributed from CTAN archives in directory % |
| 8 |
% macros/latex/base/lppl.txt; either version 1 of the % |
| 9 |
% License, or (at your option) any later version. % |
| 10 |
% % |
| 11 |
% However, you are allowed to modify this program % |
| 12 |
% without changing its name, if you modify its % |
| 13 |
% signature. Changes to the signature can be introduced % |
| 14 |
% with a directive of the form % |
| 15 |
% \message{signature} % |
| 16 |
% % |
| 17 |
% [email protected] % |
| 18 |
% http://www.cse.ohio-state.edu/~gurari % |
| 19 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 20 |
\immediate\write-1{version 2000-06-29-20:18} |
| 21 |
|
| 22 |
\expandafter\edef\csname wo:recall\endcsname{\catcode`:=\the\catcode`:} |
| 23 |
\catcode`\:=11 |
| 24 |
|
| 25 |
\Define\WO:GetY(2){\Vb=#2;} |
| 26 |
|
| 27 |
\Define\WOEdge(2){ |
| 28 |
\CSeg\WO:GetY(#2,EdgeGuide) |
| 29 |
\IF \GtDec(\Vb,0) |
| 30 |
\MoveToNode(#2,0,-1) |
| 31 |
\ELSE |
| 32 |
\MoveToNode(#2,0,1) |
| 33 |
\FI |
| 34 |
\MarkLoc(*1) \Move(10,0) \MarkLoc(*2) |
| 35 |
\MoveToLoc(EdgeGuide) \Move(0,10) \MarkLoc(*3) |
| 36 |
\MoveToLL(*1,*2)(EdgeGuide,*3) \MarkLoc(*3) |
| 37 |
\MoveToNode(#1,1,0) \Move(5,0) \LineToLoc(EdgeGuide) |
| 38 |
\LineToLoc(*3) \CSeg[2]\Line(*1,#2) |
| 39 |
} |
| 40 |
\def\WOTree#1{% |
| 41 |
\let\WO:tree=\empty |
| 42 |
\def\:queue{\init:count#1,,//}\put:queue |
| 43 |
\TreeSpec()()(\WOEdge) |
| 44 |
\TreeAlign(H,-1,0)(0,0,0)% |
| 45 |
\WO:TreeSpace |
| 46 |
\def\wo:temp{\Tree()(}% |
| 47 |
\expandafter\wo:temp\expandafter{\WO:tree}) |
| 48 |
} |
| 49 |
|
| 50 |
\def\put:queue{% |
| 51 |
\let\put:woitem=\empty |
| 52 |
\ifx \WO:tree\empty \else |
| 53 |
\expandafter\def\expandafter\WO:tree\expandafter{\WO:tree//}% |
| 54 |
\fi |
| 55 |
\ifx \:queue\empty \def\wo:temp##1{}\else |
| 56 |
\let\wo:temp=\:queue \let\:queue=\empty \fi |
| 57 |
\wo:temp\put:queue } |
| 58 |
|
| 59 |
\def\init:count#1,{% |
| 60 |
\def\WO:root{#1}\I=0;\WO:count} |
| 61 |
|
| 62 |
\edef\wo:temp{\catcode`\noexpand\&=\the\catcode`\&} |
| 63 |
\catcode`\&=13 |
| 64 |
|
| 65 |
\def\WO:count#1,{% |
| 66 |
\def\wo:temp{#1}\ifx \wo:temp\empty |
| 67 |
\expandafter\checkWO:root\WO:root//% |
| 68 |
\edef\wo:temp{\put:woitem\Val\I,\beforeWO:root}% |
| 69 |
\def\put:woitem{\noexpand&}% |
| 70 |
\expandafter\expandafter\expandafter\def |
| 71 |
\expandafter\expandafter\expandafter\WO:root |
| 72 |
\expandafter\expandafter\expandafter |
| 73 |
{\expandafter\wo:temp\WO:root}% |
| 74 |
\expandafter\expandafter\expandafter\def |
| 75 |
\expandafter\expandafter\expandafter\WO:tree |
| 76 |
\expandafter\expandafter\expandafter |
| 77 |
{\expandafter\WO:tree \WO:root}% |
| 78 |
\def\WO:root##1//{}\expandafter\WO:root |
| 79 |
\else |
| 80 |
\expandafter\def\expandafter\:queue |
| 81 |
\expandafter{\:queue\init:count#1,,//}% |
| 82 |
\I+1;\expandafter\WO:count |
| 83 |
\fi } |
| 84 |
|
| 85 |
\wo:temp |
| 86 |
|
| 87 |
\def\checkWO:root{\futurelet\wo:temp\ckWO:root} |
| 88 |
\def\ckWO:root#1//{\edef\beforeWO:root{\ifx \wo:temp\WO \else |
| 89 |
\ifx \WO:tree\empty\else |
| 90 |
\noexpand\noexpand\noexpand\WO{}\fi\fi}} |
| 91 |
|
| 92 |
\def\WO#1{\csname :WO:#1\endcsname} |
| 93 |
\def\defWO#1#2{\expandafter\def\csname :WO:#1\endcsname{#2}} |
| 94 |
|
| 95 |
\defWO{}{\llap{$\triangleright$ }} |
| 96 |
\defWO{not}{\hrulefill~~\WO{}} |
| 97 |
\defWO{or}{~$\bigoplus$} |
| 98 |
\defWO{plus}{~$+$} |
| 99 |
\defWO{xor}{~$\bigotimes$} |
| 100 |
|
| 101 |
\Define\WOSpace(2){\def\WO:TreeSpace{\TreeSpace(C,#1,#2)}} |
| 102 |
\WOSpace(10,20) |
| 103 |
|
| 104 |
\wo:recall |
| 105 |
\endinput |
| 106 |
|