aboutsummaryrefslogtreecommitdiff
path: root/clooglearch.sty
blob: c87c73bbf3dc38c5f60f960d713d2ecf49b2cafb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
\RequirePackage{tikz}
\usetikzlibrary{calc,positioning}

\newcommand{\module}[2]{#2\\[-4pt]\color{gray}{\tiny(#1)}}
\newcommand{\tinymodule}[2]{\tiny\module{#1}{#2}}

\tikzstyle{block}=[rectangle,align=center]
\tikzset{
	doc/.pic={
		\coordinate (-east)  at (0.309,0);
		\coordinate (-west)  at (-0.309,0);
		\coordinate (-south) at (0,-0.4);
		\coordinate (-north) at (0,0.4);
		\draw[pic actions] (-0.309,-0.4) -- ++(0,0.8) -- ++(0.518,0) -- ++(0,-0.1) -- ++(0.1,0) -- ++(0,-0.7) -- cycle;
		\draw[pic actions] (0.209,0.4) -- ++(0.1,-0.1);
		\draw[pic actions] (-0.209,-0.1) -- ++(0.418,0);
		\draw[pic actions] (-0.209, 0)   -- ++(0.418,0);
		\draw[pic actions] (-0.209, 0.1) -- ++(0.418,0);
	},
	db/.pic={
		% https://tex.stackexchange.com/a/397862/23992
		\coordinate (-west)  at (-0.3,0);
		\coordinate (-east)  at ( 0.3,0);
		\coordinate (-south) at (0,-0.42);
		\foreach \y in {-0.33,-0.1,0.13} {
			\draw[fill=white] (-0.3,\y) to [looseness=0.5,bend right=90] ++(0.6,0)
				-- ++(0,0.2) to [looseness=0.5,bend left=90] ++(-0.6,0)
				-- ++(0,-0.2);
			\draw (-0.3,\y+0.2) edge[looseness=0.5,bend left=90] ++(0.6,0);
		}
	}
}

\def\ifold#1{\ifnum#1=0 }
\def\ifnew#1{\ifnum#1>0 }
\def\oldornew#1#2{#2\ifnew#1-1\fi}
\def\grayedout#1{\ifnum#1<2 dark\fi gray}

\def\tikzsource{%
	\pic (src)  at (-5,3) {doc};
	\node[left=3pt of src-west,draw=none,text width=3em] {\scriptsize Source\\code};
}
\def\tikzbuilddb{%
	\node (cocl) at (-2.5, 3.5 ) {\module{Clean}{Clean compiler}};
	\node (ppr)  at (-2.5, 2.5 ) {\module{Clean}{Pretty printer}};
	\pic  (db)   at ( 0,   2.98) {db};
	\node[right=3pt of db-east,draw=none] {\module{\tiny JSON}{\scriptsize Database}};
	\draw[->] ($(src-east)+(0,0.18)$) -- (cocl.west);
	\draw[->] ($(src-east)-(0,0.18)$) -- (ppr.west);
	\draw[->] (cocl.east) -- ($(db-west)+(0,0.18)$);
	\draw[->] (ppr.east)  -- ($(db-west)-(0,0.18)$);
}
\newcommand{\tikzbackend}[1][0]{%
	\node[color=\grayedout#1] (web) at (0, \oldornew{#1}{1}) {\module{Clean, PHP, JS}{\ifold#1\bf\fi cloogle.org}};
	\node (uni) at (3, 3) {\module{Clean}{Type unifier}};
	\ifold#1
		\draw[->] (db-south) -- (web);
		\draw (uni) -- (web);
	\else
		\node (core) at (0,1.5) {\module{Clean}{\textbf{Cloogle}}};
		\draw (uni) -- (core);
		\draw[->] (db-south) -- (core);
		\draw[color=\grayedout#1,->] (core) -- (web);
	\fi
}
\newcommand{\tikzcache}[1][0]{%
	\pic[color=\grayedout#1] (cch) at (2.5, \oldornew#1{1.48}) {db};
	\node[color=\grayedout#1,right=3pt of cch-east,draw=none] {\module{\tiny JSON}{\scriptsize Cache}};
	\draw[color=\grayedout#1,<->] (cch-west) -- (web);
}
\newcommand{\tikzfrontend}[1][0]{%
	\node[color=\grayedout#1] (hljs) at (-2, \oldornew#1{0.5}) {\module{JS}{clean.js}};
	\draw[color=\grayedout#1] (hljs) -- (web);
}
\newcommand{\tikzfrontendsrc}[1][0]{%
	\node[color=\grayedout#1] (pygm) at (-2.25, \oldornew#1{1.5}) {\module{Python}{pygments}};
	\draw[color=\grayedout#1,->] (src-south) -- (pygm);
	\draw[color=\grayedout#1] (pygm) -- (web);
}
\newcommand{\tikzstats}[1][0]{%
	\node[color=\grayedout#1] (stats) at (2.5, \oldornew#1{0.5}) {\module{Bash, JS, PHP, SQL}{Log \& Statistics}};
	\draw[color=\grayedout#1] (web) -- (stats);
}
\newcommand{\tikzclientA}[1][0]{%
	\def\tikzclientAcolor{\ifnum#1=3 \else dark\fi gray}
	\node[color=\tikzclientAcolor] (vim) at (-3,-2) {\tinymodule{Vim}{vim-clean}};
	\draw[color=\grayedout#1,->] (web) -- (vim);
	\ifnum#1>2
		\pic (tagfile) at (-5,-1.2) {doc};
		\draw[->] (tags) -- (tagfile-north);
		\ifnum#1>3
			\draw (tagfile-south) edge[bend right,->] (vim);
		\fi
	\fi
}
\newcommand{\tikzclientB}[1][0]{%
	\node[color=\grayedout#1] (tgm) at (-1.5,-2) {\tinymodule{Python}{Telegram bot}};
	\draw[color=\grayedout#1,->] (web) -- (tgm);
}
\newcommand{\tikzclientC}[1][0]{%
	\node[color=\grayedout#1] (cli) at (0,-2) {\tinymodule{Python}{CLI app}};
	\draw[color=\grayedout#1,->] (web) -- (cli);
}
\newcommand{\tikzclientD}[1][0]{%
	\node[color=\grayedout#1] (vim) at (1.4,-2) {\tinymodule{Python}{Email client}};
	\draw[color=\grayedout#1,->] (web) -- (vim);
}
\newcommand{\tikzclientE}[1][0]{%
	\node[color=\grayedout#1] (vim) at (2.7,-2) {\tinymodule{Clean}{IRC bot}};
	\draw[color=\grayedout#1,->] (web) -- (vim);
}
\newcommand{\tikzcloogletags}[0]{%
	\node (tags) at (-5,0) {\module{Clean}{cloogle-tags}};
	\draw[->] (core) edge[bend right,out=-15] (tags);
}