tomGomCompiler.tex 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. \begin{figure}[H]
  2. % Define the layers to draw the diagram
  3. \pgfdeclarelayer{tomgombackground}
  4. \pgfdeclarelayer{tombackground}
  5. \pgfsetlayers{tomgombackground,tombackground,main}
  6. % Define a new shape: page with a folded corner
  7. \makeatletter
  8. \pgfdeclareshape{flippedpage}{
  9. \inheritsavedanchors[from=rectangle] % this is nearly a rectangle
  10. \inheritanchorborder[from=rectangle]
  11. \inheritanchor[from=rectangle]{center}
  12. \inheritanchor[from=rectangle]{north}
  13. \inheritanchor[from=rectangle]{south}
  14. \inheritanchor[from=rectangle]{west}
  15. \inheritanchor[from=rectangle]{east}
  16. % ... and possibly more
  17. \backgroundpath{% this is new
  18. % store lower left in xa/ya and upper right in xb/yb
  19. \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
  20. \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
  21. % compute corner of ``flipped page''
  22. \pgf@xc=\pgf@xb \advance\pgf@xc by-5pt % this should be a parameter
  23. \pgf@yc=\pgf@yb \advance\pgf@yc by-5pt
  24. % diagonal path of the corner
  25. \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}
  26. \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}}
  27. \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yb}}
  28. \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}}
  29. \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}
  30. \pgfpathclose
  31. % add little corner
  32. \pgfpathmoveto{\pgfpoint{\pgf@xc}{\pgf@yb}}
  33. \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}
  34. \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}}
  35. \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}
  36. }
  37. }
  38. % Define block styles
  39. \tikzstyle{compiler}=[draw, fill=blue!20, text width=6em, text centered, minimum height=2.5em, rounded corners]
  40. %\tikzstyle{compiler2}=[diamond, aspect=2, draw, fill=blue!20, text centered, rounded corners=1]
  41. \tikzstyle{compiler2}=[diamond, aspect=2, draw, text centered, rounded corners=1]
  42. %\tikzstyle{code}=[draw,shape=flippedpage,text width=2.7em, text centered, minimum height=3.7em,fill=white]
  43. \tikzstyle{code}=[draw,shape=flippedpage,text width=3em, text centered,
  44. minimum height=4.2em,fill=white]
  45. \tikzstyle{texttitle}=[fill=white, rounded corners, draw=black!50, dashed]
  46. \tikzstyle{background}=[fill=yellow!20, rounded corners, draw=black!50, dashed]
  47. \begin{center}
  48. \begin{tikzpicture}
  49. % Draw diagram elements
  50. % Draw an invisible paper and back papers
  51. \node (mapping) [code] {\figcode{Ancrages algébriques}};
  52. \path (mapping.east)+(3,-2.5) node (datastruct)[code]
  53. {\figcode{Structures \\ de \\ données \\ Java}};
  54. \path (mapping.west)+(-3,2.5) node (tomcode)[code]
  55. {\figcode{Tom \\ + \\ Java}};
  56. \path (tomcode.east)+(3,0) node (tomcomp)[compiler2]
  57. {\figcode{\textbf{Compilateur {\tom}}}};
  58. \path (mapping.east)+(3,2.5) node (javacode)[code]
  59. {\figcode{Code Java}};
  60. \path (mapping.east)+(6,2.5) node (javacomp)[compiler2]
  61. {\figcode{\textbf{Compilateur {\java}}}};
  62. \path (mapping.east)+(9,2.5) node (bytecode)[code]
  63. {\figcode{110010}\\\figcode{101110}\\\figcode{010100}};
  64. % Draw gom side
  65. \path (mapping.west)+(-3.0,-2.5) node[code] (gomsig) {\figcode{Signature} \\ \figcode{Gom}};
  66. \path (gomsig.east)+(3,0) node (gomcomp)[compiler2]
  67. {\figcode{\textbf{Compilateur {\gom}}}};
  68. % Draw arrows between elements
  69. \path [->] (gomsig.east) edge (gomcomp);
  70. \path [->] (gomcomp.north) edge (mapping);
  71. % Use invisible mapping to avoid arrow cover back papers
  72. \path [->] (mapping.north) edge (tomcomp);
  73. \path [->] (gomcomp.east) edge (datastruct);
  74. %\path [draw, ->] (datastruct.east) -- ++(3,0) -- node [below] {} (javacomp);
  75. \draw[->] (datastruct) -- ++(3,0) -- (javacomp);
  76. %\path [->] (datastruct.east) edge (javacomp);
  77. \path [->] (tomcode.east) edge (tomcomp);
  78. \path [->] (tomcomp.east) edge (javacode);
  79. \path [->] (javacode.east) edge (javacomp);
  80. \path [->] (javacomp.east) edge (bytecode);
  81. \end{tikzpicture}
  82. \end{center}
  83. \caption{Processus de compilation d'un programme {\tom}}
  84. \label{fig:tomGomCompiler}
  85. \end{figure}