Mercurial > hg > graal-compiler
comparison doc/design/graphdrawing.tex @ 2551:550b291f56c4
doc: small changes to graphs, graph test file
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Thu, 28 Apr 2011 09:59:45 +0200 |
parents | 8c6e31c62fba |
children | ac868ecd3cfc 6d99b909696d |
comparison
equal
deleted
inserted
replaced
2550:d9b2a8653054 | 2551:550b291f56c4 |
---|---|
1 | 1 |
2 % graph drawing | 2 % graph drawing |
3 \newcommand{\digraph}[3][scale=1]{ | 3 \newcommand{\digraph}[3][scale=1]{ |
4 \newwrite\dotfile | 4 \newwrite\dotfile |
5 \immediate\openout\dotfile=dot_temp_#2.dot | 5 \immediate\openout\dotfile=dot_temp_#2.dot |
6 \immediate\write\dotfile{digraph dot_temp_#2 {\string#3}} | 6 \immediate\write\dotfile{digraph #2 { margin=0; pad=0; concentrate=false; \string#3}} |
7 \immediate\closeout\dotfile | 7 \immediate\closeout\dotfile |
8 \immediate\write18{bash -c "dot -Tpdf dot_temp_#2.dot > dot_temp_#2.pdf"} | 8 \immediate\write18{bash -c "dot -Tpdf dot_temp_#2.dot > dot_temp_#2.pdf"} |
9 \IfFileExists{dot_temp_#2.pdf} | 9 \IfFileExists{dot_temp_#2.pdf} |
10 % the pdf exists: include it | 10 % the pdf exists: include it |
11 { \includegraphics[#1]{dot_temp_#2} } | 11 { \includegraphics[#1]{dot_temp_#2} } |
19 the `\texttt{-shell-escape} option. | 19 the `\texttt{-shell-escape} option. |
20 \end{tabular}} | 20 \end{tabular}} |
21 } | 21 } |
22 } | 22 } |
23 | 23 |
24 \NewEnviron{digraphenv}[2]{\digraph[#1]{#2}{ margin=0; pad=0; \BODY }} | 24 \NewEnviron{digraphenv}[2]{\digraph[#1]{#2}{ \BODY }} |
25 | 25 |
26 \newcommand{\control}[2]{#1:successors:s -> #2:predecessors:n [color=red];} | 26 \newcommand{\control}[2]{#1:successors:s -> #2:predecessors:n [color=red];} |
27 \newcommand{\controllabel}[2]{#1 -> #2:predecessors:n [color=red];} | 27 \newcommand{\controllabel}[2]{#1 -> #2:predecessors:n [color=red];} |
28 \newcommand{\data}[2]{#2:usages:s -> #1:inputs [color=black,dir=back];} | 28 \newcommand{\data}[2]{#2:usages:s -> #1:inputs [color=black,dir=back];} |
29 \newcommand{\datalabel}[2]{#2:usages:s -> #1:n [color=black,dir=back];} | 29 \newcommand{\datalabel}[2]{#2:usages:s -> #1:n [color=black,dir=back];} |
31 \newcommand{\genericnodestart}[1]{#1 [shape=plaintext, label=< <TABLE BORDER="0" CELLSPACING="0"><TR><TD CELLPADDING="0"><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="0"><TR><TD WIDTH="15" HEIGHT="5" PORT="predecessors" BGCOLOR="rosybrown1"></TD></TR></TABLE></TD><TD COLSPAN="2" CELLPADDING="0" ALIGN="RIGHT"><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="0"><TR>} | 31 \newcommand{\genericnodestart}[1]{#1 [shape=plaintext, label=< <TABLE BORDER="0" CELLSPACING="0"><TR><TD CELLPADDING="0"><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="0"><TR><TD WIDTH="15" HEIGHT="5" PORT="predecessors" BGCOLOR="rosybrown1"></TD></TR></TABLE></TD><TD COLSPAN="2" CELLPADDING="0" ALIGN="RIGHT"><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="0"><TR>} |
32 \newcommand{\genericnodeend}[0]{</TR></TABLE></TD><TD CELLPADDING="0"><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="0"><TR><TD WIDTH="15" HEIGHT="5" PORT="usages" BGCOLOR="lightgrey"></TD></TR></TABLE></TD></TR></TABLE>>]} | 32 \newcommand{\genericnodeend}[0]{</TR></TABLE></TD><TD CELLPADDING="0"><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="0"><TR><TD WIDTH="15" HEIGHT="5" PORT="usages" BGCOLOR="lightgrey"></TD></TR></TABLE></TD></TR></TABLE>>]} |
33 \newcommand{\portinput}[1]{<TD WIDTH="15" HEIGHT="5" PORT="#1" BGCOLOR="lightgrey"></TD>} | 33 \newcommand{\portinput}[1]{<TD WIDTH="15" HEIGHT="5" PORT="#1" BGCOLOR="lightgrey"></TD>} |
34 \newcommand{\portsuccessor}[1]{<TD WIDTH="15" HEIGHT="5" PORT="#1" BGCOLOR="rosybrown1"></TD>} | 34 \newcommand{\portsuccessor}[1]{<TD WIDTH="15" HEIGHT="5" PORT="#1" BGCOLOR="rosybrown1"></TD>} |
35 \newcommand{\portempty}[0]{<TD WIDTH="15" HEIGHT="5"></TD>} | 35 \newcommand{\portempty}[0]{<TD WIDTH="15" HEIGHT="5"></TD>} |
36 \newcommand{\genericnodelabel}[1]{</TR></TABLE></TD></TR><TR><TD BORDER="1" COLSPAN="3">#1</TD></TR><TR><TD COLSPAN="2" CELLPADDING="0" ALIGN="RIGHT"><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="0"><TR>} | 36 \newcommand{\genericnodelabel}[2]{</TR></TABLE></TD></TR><TR><TD BORDER="1" COLSPAN="3" BGCOLOR="#2">#1</TD></TR><TR><TD COLSPAN="2" CELLPADDING="0" ALIGN="RIGHT"><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="0"><TR>} |
37 | 37 |
38 \newcommand{\node}[2]{\genericnodestart{#1} \portempty \portinput{inputs} \genericnodelabel{#2} \portsuccessor{successors} \portempty \genericnodeend } | 38 \newcommand{\nodestart}[0]{start [shape=plaintext, rank=source, label=< <TABLE BORDER="0" CELLSPACING="0"><TR><TD COLSPAN="3"><TABLE BORDER="0"><TR><TD></TD> \genericnodelabel{start}{lightyellow} \portsuccessor{successors} \portempty \genericnodeend } |
39 \newcommand{\nodebi}[2]{\genericnodestart{#1} \portinput{in1} \portinput{in2} \genericnodelabel{#2} \portsuccessor{successors} \portempty \genericnodeend } | 39 |
40 \newcommand{\nodetri}[2]{\genericnodestart{#1} \portinput{in1} \portinput{in2} \portinput{in3} \genericnodelabel{#2} \portsuccessor{successors} \portempty \portempty \genericnodeend } | 40 \newcommand{\nodeend}[0]{\genericnodestart{end} \portempty \portinput{inputs} \genericnodelabel{end}{lightyellow} <TD></TD></TR></TABLE></TD><TD></TD></TR></TABLE>>]} |
41 \newcommand{\nodesplit}[2]{\genericnodestart{#1} \portempty \portinput{inputs} \genericnodelabel{#2} \portsuccessor{succ1} \portsuccessor{succ2} \genericnodeend } | 41 |
42 \newcommand{\node}[2]{\genericnodestart{#1} \portempty \portinput{inputs} \genericnodelabel{#2}{white} \portsuccessor{successors} \portempty \genericnodeend } | |
43 \newcommand{\nodebi}[2]{\genericnodestart{#1} \portinput{in1} \portinput{in2} \genericnodelabel{#2}{white} \portsuccessor{successors} \portempty \genericnodeend } | |
44 \newcommand{\nodetri}[2]{\genericnodestart{#1} \portinput{in1} \portinput{in2} \portinput{in3} \genericnodelabel{#2}{white} \portsuccessor{successors} \portempty \portempty \genericnodeend } | |
45 \newcommand{\nodesplit}[2]{\genericnodestart{#1} \portempty \portinput{inputs} \genericnodelabel{#2}{white} \portsuccessor{succ1} \portsuccessor{succ2} \genericnodeend } | |
46 | |
47 \newcommand{\cnode}[3]{\genericnodestart{#1} \portempty \portinput{inputs} \genericnodelabel{#2}{#3} \portsuccessor{successors} \portempty \genericnodeend } | |
48 \newcommand{\cnodebi}[3]{\genericnodestart{#1} \portinput{in1} \portinput{in2} \genericnodelabel{#2}{#3} \portsuccessor{successors} \portempty \genericnodeend } | |
49 \newcommand{\cnodetri}[3]{\genericnodestart{#1} \portinput{in1} \portinput{in2} \portinput{in3} \genericnodelabel{#2}{#3} \portsuccessor{successors} \portempty \portempty \genericnodeend } | |
50 \newcommand{\cnodesplit}[3]{\genericnodestart{#1} \portempty \portinput{inputs} \genericnodelabel{#2}{#3} \portsuccessor{succ1} \portsuccessor{succ2} \genericnodeend } | |
42 | 51 |
43 %%%%%%%%%%%%%% example: | 52 %%%%%%%%%%%%%% example: |
44 | 53 |
45 % \begin{digraphenv}{scale=0.5}{MyGraph} | 54 % \begin{digraphenv}{scale=0.5}{MyGraph} |
46 % \node{start}{start} | 55 % \node{start}{start} |