chiark / gitweb /
doc/concepts.tex: Typeset method rĂ´le names as identifiers.
[sod] / doc / stdmeth.tex
1 %%% -*- mode: latex; TeX-PDF-mode: t -*-
2
3 \documentclass{article}
4 \usepackage[palatino, helvetica, courier, maths=cmr]{mdwfonts}
5
6 \usepackage{syntax}
7 \usepackage{tikz}
8 \usetikzlibrary{calc}
9 \usetikzlibrary{positioning}
10
11 \errorcontextlines=999
12
13 \begin{document}
14
15 \begin{tikzpicture}
16   [>=stealth, thick,
17    order/.append style={color=green!70!black},
18    code/.append style={font=\sffamily},
19    action/.append style={font=\itshape},
20    method/.append style={rectangle, draw=black, thin, fill=blue!30,
21                          text height=\ht\strutbox, text depth=\dp\strutbox,
22                          minimum width=40mm}]
23
24   \def\delgstack#1#2#3{
25     \node (#10) [method, #2] {#3};
26     \node (#11) [method, above=6mm of #10] {#3};
27     \draw [->] ($(#10.north)!.5!(#10.north west) + (0mm, 1mm)$) --
28                ++(0mm, 4mm)
29       node [code, left=4pt, midway] {next_method};
30     \draw [<-] ($(#10.north)!.5!(#10.north east) + (0mm, 1mm)$) --
31                ++(0mm, 4mm)
32       node [action, right=4pt, midway] {return};
33     \draw [->] ($(#11.north)!.5!(#11.north west) + (0mm, 1mm)$) --
34                ++(0mm, 4mm)
35       node [code, left=4pt, midway] {next_method}
36       node (ld) [above] {$\smash\vdots\mathstrut$};
37     \draw [<-] ($(#11.north)!.5!(#11.north east) + (0mm, 1mm)$) --
38                ++(0mm, 4mm)
39       node [action, right=4pt, midway] {return}
40       node (rd) [above] {$\smash\vdots\mathstrut$};
41     \draw [->] ($(ld.north) + (0mm, 1mm)$) -- ++(0mm, 4mm)
42       node [code, left=4pt, midway] {next_method};
43     \draw [<-] ($(rd.north) + (0mm, 1mm)$) -- ++(0mm, 4mm)
44       node [action, right=4pt, midway] {return};
45     \node (p) at ($(ld.north)!.5!(rd.north)$) {};
46     \node (#1n) [method, above=5mm of p] {#3};
47     \draw [->, order] ($(#10.south east) + (4mm, 1mm)$) --
48                         ($(#1n.north east) + (4mm, -1mm)$)
49       node [midway, right, align=left] {Most to \\ least \\ specific};}
50
51   \delgstack{a}{}{Around method}
52   \draw [<-] ($(a0.south)!.5!(a0.south west) - (0mm, 1mm)$) --
53              ++(0mm, -4mm);
54   \draw [->] ($(a0.south)!.5!(a0.south east) - (0mm, 1mm)$) --
55              ++(0mm, -4mm)
56     node [action, right=4pt, midway] {return};
57
58   \draw [->] ($(an.north)!.6!(an.north west) + (0mm, 1mm)$) --
59              ++(-8mm, 8mm)
60     node [code, midway, left=3mm] {next_method}
61     node (b0) [method, above left = 1mm + 4mm and -6mm - 4mm] {};
62   \node (b1) [method] at ($(b0) - (2mm, 2mm)$) {};
63   \node (bn) [method] at ($(b1) - (2mm, 2mm)$) {Before method};
64   \draw [->, order] ($(bn.west) - (6mm, 0mm)$) -- ++(12mm, 12mm)
65     node [midway, above left, align=center] {Most to \\ least \\ specific};
66   \draw [->] ($(b0.north east) + (-10mm, 1mm)$) -- ++(8mm, 8mm)
67     node (p) {};
68
69   \delgstack{m}{above right=1mm and 0mm of an.west |- p}{Primary method}
70   \draw [->] ($(mn.north)!.5!(mn.north west) + (0mm, 1mm)$) -- ++(0mm, 4mm)
71     node [code, left=4pt, midway] {next_method}
72     node [above right = 0mm and -8mm]
73     {$\vcenter{\hbox{\Huge\textcolor{red}{!}}}
74       \vcenter{\hbox{\begin{tabular}[c]{l}
75                        \textsf{next_method} \\
76                        pointer is null
77                      \end{tabular}}}$};
78
79   \draw [->, color=blue, dotted]
80       ($(m0.south)!.2!(m0.south east) - (0mm, 1mm)$) --
81       ($(an.north)!.2!(an.north east) + (0mm, 1mm)$)
82     node [midway, sloped, below] {Return value};
83
84   \draw [<-] ($(an.north)!.6!(an.north east) + (0mm, 1mm)$) --
85              ++(8mm, 8mm)
86     node [action, midway, right=3mm] {return}
87     node (f0) [method, above right = 1mm and -6mm] {};
88   \node (f1) [method] at ($(f0) + (-2mm, 2mm)$) {};
89   \node (fn) [method] at ($(f1) + (-2mm, 2mm)$) {After method};
90   \draw [<-, order] ($(f0.east) + (6mm, 0mm)$) -- ++(-12mm, 12mm)
91     node [midway, above right, align=center] {Least to \\ most \\ specific};
92   \draw [<-] ($(fn.north west) + (6mm, 1mm)$) -- ++(-8mm, 8mm);
93
94 \end{tikzpicture}
95
96 \end{document}