diff -r cc54ce075db5 -r 6acbc939af6a ChengsongTanPhdThesis/Chapters/tape.tex --- a/ChengsongTanPhdThesis/Chapters/tape.tex Fri Jun 03 16:45:30 2022 +0100 +++ b/ChengsongTanPhdThesis/Chapters/tape.tex Mon Jun 06 03:05:31 2022 +0100 @@ -1,55 +1,16 @@ -\documentclass{standalone} -\usepackage[utf8]{inputenc} -\usepackage{ifthen} -\usepackage{tikz} -\usetikzlibrary{chains} -\usetikzlibrary{calc, decorations.pathmorphing} -\tikzstyle{tape}=[thick, draw, minimum height=5mm, minimum width=7mm, fill=green!35,outer sep=0pt] -\tikzstyle{head}=[very thick, draw, minimum height=6mm, minimum width=7mm, fill=none,outer sep=0pt] +\documentclass[tikz, border=10pt]{standalone} +\usetikzlibrary{shapes} + + + -\def\DrawTape#1{ -\begin{scope}[start chain=1 going right,node distance=-0.15mm] - % start tape - \node [on chain=1,tape,draw=none, tape, fill=none, draw=none] at (0,-\i*1) (node\i0){\ldots\ }; - \draw [thick,fill=green!35] (node\i0.north east) -- ++(-.07,0) decorate [decoration={zigzag, segment length=.10cm, amplitude=.015cm}] - {-- ($(node\i0.south east)+(-.15,0)$)} -- (node\i0.south east) -- cycle; - % draw tape - \foreach [count=\j] \element in \adlist { - \ifthenelse{\j = \head}{ % read-write heads current position - \node [on chain=1,tape, fill=red!35] (node\i\j){\element}; - } - { - \node [on chain=1,tape] (node\i\j) {\element}; - } - } - % close tape - \draw [thick,fill=green!35] (node\i\j.north east) -- ++(.15,0) decorate [decoration={zigzag, segment length=.10cm, amplitude=.015cm}] - {-- ($(node\i\j.south east)+(.07,0)$)} -- (node\i\j.south east) -- cycle; - \node [on chain=1,tape, fill=none, draw=none] (end\i) {\ \ldots}; - \node [right = of end\i]{\tiny tape~\i}; - - % draw read-write head - \prevnode=\head - \advance\prevnode by -1 - \node [head,right = of node\i\the\prevnode] (head\i){}; - \node [above = of head\i]{\tiny head \i}; -\end{scope} -} -\newcount\prevnode \begin{document} -% Define the turing machine as a list of pairs, where each pair consists of the read-writes head position the delimiter "/" and the list of symbols on the tape. -\newcommand{\tapes}{ 3/{, , ,1,1, }, 1/{, 1, 0, 1 , 0,}, 2/{ , 1 , 1, 0, 1,}} -\begin{tikzpicture} -% Draw program node -\draw (-1.5,-2) node [draw, thick, rectangle, minimum height= 2.5cm, minimum width=2cm, fill=white, rounded corners] (program){program}; -% Draw tapes and heads -\foreach [count=\i] \head/\adlist in \tapes { - % Draw tape and head - \DrawTape{\i,\head,\adlist} - % Draw link to program - \draw[thick, rounded corners=3pt] (program) {-- ($(node\i0.south west) + (0,-0.15)$)} - {-- ($(head\i.south) + (0,-0.1)$)}-- (head\i.south); -} +\begin{tikzpicture}[every node/.append style={draw, rounded corners, inner sep=10pt}] + \node [rectangle split, rectangle split horizontal, rectangle split parts=3] + {Services + \nodepart{two} Event Driven Framework + \nodepart{three} OS Adapter Layer}; + \end{tikzpicture} \end{document} \ No newline at end of file