sv_tomArchi.tex 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. \begin{figure}[h!]
  2. % Define the layers to draw the diagram
  3. \pgfdeclarelayer{background}
  4. \pgfsetlayers{background,main}
  5. % Define a new shape: page with a folded corner
  6. \makeatletter
  7. \pgfdeclareshape{flippedpage}{
  8. \inheritsavedanchors[from=rectangle] % this is nearly a rectangle
  9. \inheritanchorborder[from=rectangle]
  10. \inheritanchor[from=rectangle]{center}
  11. \inheritanchor[from=rectangle]{north}
  12. \inheritanchor[from=rectangle]{south}
  13. \inheritanchor[from=rectangle]{west}
  14. \inheritanchor[from=rectangle]{east}
  15. % ... and possibly more
  16. \backgroundpath{% this is new
  17. % store lower left in xa/ya and upper right in xb/yb
  18. \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
  19. \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
  20. % compute corner of ``flipped page''
  21. \pgf@xc=\pgf@xb \advance\pgf@xc by-5pt % this should be a parameter
  22. \pgf@yc=\pgf@yb \advance\pgf@yc by-5pt
  23. % diagonal path of the corner
  24. \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}
  25. \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}}
  26. \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yb}}
  27. \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}}
  28. \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}
  29. \pgfpathclose
  30. % add little corner
  31. \pgfpathmoveto{\pgfpoint{\pgf@xc}{\pgf@yb}}
  32. \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}
  33. \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}}
  34. \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}
  35. }
  36. }
  37. % Define block styles
  38. \tikzstyle{plugin}=[draw, fill=white, text width=0.9cm, text centered,
  39. minimum height=0.9cm, rounded corners=1]
  40. \tikzstyle{specialplugin}=[draw, fill=blue!20, text width=0.9cm, text centered,
  41. minimum height=0.9cm, rounded corners=1]
  42. \tikzstyle{code}=[draw,shape=flippedpage,text width=0.6cm, text centered, minimum height=2.6em,fill=white]
  43. \tikzstyle{texttitle}=[fill=white, rounded corners=1, draw=black!50]%, dashed]
  44. \tikzstyle{background}=[rounded corners=1, draw=black!50]%, dashed]
  45. \begin{center}
  46. \begin{tikzpicture}%[scale=0.9]
  47. % Draw diagram elements
  48. \node (typechecker) [plugin] {\minicode{type checker}};
  49. %\path (typechecker.west) node (arrowt-tc) [arrow] {};
  50. \path (typechecker)+(-5,0.0) node (transformer) [specialplugin]
  51. {\minicode{typer}};
  52. \path (typechecker)+(-1.5,0.0) node (typer) [plugin]
  53. {\minicode{typer}};
  54. %\path (typer.west) node (arrowd-t) [arrow] {};
  55. \path (typechecker)+(-3.0,0.0) node (desugarer) [plugin] {\minicode{desugarer}};
  56. %\path (desugarer.west) node (arrowsc-d) [arrow] {};
  57. \path (typechecker)+(-4.5,0.0) node (syntaxchecker) [plugin]
  58. {\minicode{syntax checker}};
  59. %\path (syntaxchecker.west) node (arrowp-sc) [arrow] {};
  60. \path (typechecker)+(-6.0,0.0) node (parser) [plugin]
  61. {\minicode{parser}};
  62. %\path (parser.west) node (inputarrow) [bigarrow] {};
  63. \path (typechecker)+(-6.0,1.9) node (tomfile) [code]
  64. {\minicode{Code {\tom}}};
  65. \path (typechecker)+(1.5,0.0) node (expander) [plugin]
  66. {\minicode{expander}};
  67. \path (typechecker)+(3.0,0.0) node (compiler) [plugin]
  68. {\minicode{compiler}};
  69. \path (typechecker)+(4.5,0.0) node (optimizer) [plugin]
  70. {\minicode{optimizer}};
  71. \path (typechecker)+(6.0,0.0) node (backend) [plugin]
  72. {\minicode{backend}};
  73. \path (typechecker)+(6.0,-1.9) node (javafile) [code]
  74. {\minicode{Code hôte}};
  75. % Draw arrows between elements
  76. \path [draw, ->] (tomfile.south) -- node [left] {} (parser);
  77. % \path [draw, ->] (parser.south) -- node [left] {} (transformer);
  78. % \path [draw, ->] (transformer.east) -- node [above] {} (syntaxchecker);
  79. \path [draw, ->] (parser.east) -- node [above] {} (syntaxchecker);
  80. \path [draw, ->] (syntaxchecker.east) -- node [above] {} (desugarer);
  81. \path [draw, ->] (desugarer.east) -- node [above] {} (typer);
  82. \path [draw, ->] (typer.east) -- node [above] {} (typechecker);
  83. \path [draw, ->] (typechecker.east) -- node [above] {} (expander);
  84. \path [draw, ->] (expander.east) -- node [above] {} (compiler);
  85. \path [draw, ->] (compiler.east) -- node [above] {} (optimizer);
  86. \path [draw, ->] (optimizer.east) -- node [above] {} (backend);
  87. \path [draw, ->] (backend.south) -- node [above] {} (javafile);
  88. % Draw layer titles
  89. \path (typechecker)+(0.0,1.0) node (tomtitle) [texttitle]
  90. {\figcode{Compilateur {\tom}}};
  91. % Draw background
  92. \begin{pgfonlayer}{background}
  93. % Left-top corner of the background rectangle
  94. \path (parser.west |- parser.north)+(-0.3,0.5) node (a) {};
  95. % Right-bottom corner of the background rectangle
  96. \path (backend.east|- backend.south)+(0.3,-0.5) node (b) {};
  97. % Draw the background
  98. \path[background]
  99. (a) rectangle (b);
  100. \end{pgfonlayer}
  101. \end{tikzpicture}
  102. \end{center}
  103. \caption{Modules of the {\tom} system.}
  104. \label{fig:architecture}
  105. \end{figure}