tomCompiler.tex 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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{mycompiler}=[diamond, aspect=2, draw, fill=blue!20, text centered, rounded corners=1]
  41. \tikzstyle{mycompiler}=[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=2.7em, 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 (invisiblemapping) [text width=2.7em, minimum height=3.7em] {};
  52. %\path (invisiblemapping)+(0.0,0.16) node (mappingzero) [code] {};
  53. %\path (mappingzero)+(-0.08,-0.08) node (mappingone) [code] {};
  54. %\path (mappingone)+(-0.08,-0.08) node (mapping) [code] {\figcode{Ancrage}};
  55. \node (mapping) [code] {\figcode{Ancrages algébriques}};
  56. \path (mapping.east)+(3,-2.5) node (datastruct)[code]
  57. {\figcode{Structures de données Java}};
  58. %\path (mapping.north)+(0.0,2) node (tomcomp)[mycompiler]
  59. %{\figcode{Compilateur {\tom}}};
  60. \path (mapping.west)+(-3,2.5) node (tomcode)[code]
  61. {\figcode{Tom \\ + \\ Java}};
  62. \path (tomcode.east)+(3,0) node (tomcomp)[mycompiler]
  63. {\figcode{Compilateur {\tom}}};
  64. \path (mapping.east)+(3,2.5) node (javacode)[code]
  65. {\figcode{Code Java}};
  66. \path (mapping.east)+(6,2.5) node (javacomp)[mycompiler]
  67. {\figcode{Compilateur Java}};
  68. \path (mapping.east)+(9,2.5) node (bytecode)[code]
  69. {\figcode{110010}\\\figcode{101110}\\\figcode{010100}};
  70. % Draw gom side
  71. \path (mapping.west)+(-3.0,-2.5) node[code] (gomsig) {\figcode{Signature} \\ \figcode{Gom}};
  72. \path (gomsig.east)+(3,0) node (gomcomp)[mycompiler]
  73. {\figcode{Compilateur {\gom}}};
  74. % Draw arrows between elements
  75. \path [draw, ->] (gomsig.east) -- node [left] {} (gomcomp);
  76. \path [draw, ->] (gomcomp.north) -- node [below] {} (mapping);
  77. % Use invisible mapping to avoid arrow cover back papers
  78. %\path [draw, ->] (mappingzero.north) -- node [below] {} (tomcomp);
  79. %\path [draw, ->] (mappinginvisible.north) -- node [below] {} (tomcomp);
  80. \path [draw, ->] (mapping.north) -- node [below] {} (tomcomp);
  81. \path [draw, ->] (gomcomp.east) -- node [left] {} (datastruct);
  82. \path [draw, ->] (datastruct.east) -- node [below] {} (javacomp);
  83. \path [draw, ->] (tomcode.east) -- node [left] {} (tomcomp);
  84. \path [draw, ->] (tomcomp.east) -- node [left] {} (javacode);
  85. \path [draw, ->] (javacode.east) -- node [left] {} (javacomp);
  86. \path [draw, ->] (javacomp.east) -- node [left] {} (bytecode);
  87. % Draw layer titles
  88. %\path (gomsig)+(-0.5,1.7) node (tomgomtitle) [texttitle]
  89. % {\code{tom + gom}};
  90. %\path (mapping)+(0.0,3.0) node (tomtitle) [texttitle]
  91. % {\code{tom}};
  92. %% Draw tomgombackground
  93. %\begin{pgfonlayer}{tomgombackground}
  94. % % Left-top corner of the background rectangle
  95. % \path (gomsig.west |- gomsig.north)+(-1.0,1.0) node (a) {};
  96. % % Right-bottom corner of the background rectangle
  97. % \path (bytecode.east|- bytecode.south)+(1.5,-1.0) node (b) {};
  98. % % Draw the background
  99. % \path[background]
  100. % (a) rectangle (b);
  101. %\end{pgfonlayer}
  102. %% Draw tombackground
  103. %\begin{pgfonlayer}{tombackground}
  104. % % Left-top corner of the background rectangle
  105. % \path (mapping.west |- mapping.north)+(-0.5,2.3) node (a) {};
  106. % % Right-bottom corner of the background rectangle
  107. % \path (bytecode.east|- bytecode.south)+(1.0,-0.5) node (b) {};
  108. % % Draw the background
  109. % \path[background]
  110. % (a) rectangle (b);
  111. %\end{pgfonlayer}
  112. \end{tikzpicture}
  113. \end{center}
  114. \caption{Processus de compilation d'un programme {\tom}}
  115. \label{fig:tomCompiler}
  116. \end{figure}