summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/blox/blox.sty
blob: b0782ba4131cc1b057078ec084fbcf1eabbb8af4 (plain)
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
%%
%% This is file `blox.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% blox.dtx  (with options: `package')
%% This is a generated file.
%% Copyright (C) 2014 by Ben Reish
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any later
%% version. The latest version of this license is in:
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 1999/12/01 or later.
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{blox}%
[2014/08/20 v2.5 Just an English translation of schemabloc]






\typeout{* }
\typeout{bloX: Just an English translation of schemabloc package.}
\typeout{bloX Copyright (C) 2014  Ben Reish}
\typeout{* }
\typeout{This program comes with ABSOLUTELY NO WARRANTY.}
\typeout{This is free software, and you are welcome to redistribute it}
\typeout{under certain conditions.}
\typeout{* }
\RequirePackage{ifthen}
\RequirePackage{tikz}
\RequirePackage{pgffor}
\usetikzlibrary{shapes,arrows}
\tikzstyle{bXLineStyle}=[->,>=latex',]
\tikzstyle{bXStyleBloc}=[draw, rectangle,]
\tikzstyle{bXStyleBlocPotato}=[]
\tikzstyle{bXStyleSum}=[draw, circle,]%style Sum CC
\tikzstyle{bXLabelStyle}=[]
\newcommand{\bXDefaultLineStyle}{
\tikzstyle{bXLineStyle}=[->,>=latex']
}
\newcommand{\bXLineStyle}[1]{
\tikzstyle{bXLineStyle}+=[#1]
}
\newcommand{\bXStyleBloc}[1]{
\tikzstyle{bXStyleBloc}+=[#1]
}
\newcommand{\bXStyleBlocDefault}{
\tikzstyle{bXStyleBloc}=[draw, rectangle,]
}
\newcommand{\bXStylePotato}[1]{
\tikzstyle{bXStyleBlocPotato}+=[#1]
}
\newcommand{\bXStylePotatoDefault}{
\tikzstyle{bXStyleBlocPotato}=[draw, cloud, cloud puffs=5,]
}
\newcommand{\bXStyleSum}[1]{
\tikzstyle{bXStyleSum}+=[#1]
}
\newcommand{\bXStyleSumDefault}{
\tikzstyle{bXStyleSum}=[draw, circle,]
}
\newcommand{\bXLabelStyle}[1]{
\tikzstyle{bXLabelStyle}+=[#1]
}
\newcommand{\bXLabelStyleDefault}{
\tikzstyle{bXLabelStyle}=[font=\normalfont,]
}
\newcommand{\bXInput}{%
    \@ifnextchar[{\@bXInputi}{\@bXInputii}
}
\newcommand{\@bXInputi}[2][]{%
    \node [coordinate,name=#2,bXLabelStyle] {#1};
    \bXBranchx[0]{#2}{#2};
    \draw (0,0) node [anchor=east,name=#2label,] {#1};
}
\newcommand{\@bXInputii}[1]{%
    \node [coordinate,name=#1] { };
    \bXBranchx[0]{#1}{#1};
}
\newcommand{\bXOutput}[3][2]{
    \node [coordinate, right of=#3right,
    node distance=#1em, minimum size=0em,right] (#2) {};
}
\newcommand{\bXBloc}[4][2]{
\node [draw, rectangle,
    minimum height=3em, minimum width=3em, right of = #4right,
node distance=#1em,bXStyleBloc,right] (#2) {#3};
\node (#2right) at (#2.east){};
\node (Blocrightend) at (#2.east){};
}
\newcommand{\bXBlocr}[4][2]{
\node [
    minimum height=3em, minimum width=3em, left of = #4left,
node distance=#1em, bXStyleBloc,left] (#2) {#3};
\node (#2left) at (#2.west){};
}
\newcommand{\bXBlocL}[4][2]{
\node [draw, rectangle,
    minimum height=3em, minimum width=3em,
    right of = #4right,node distance=#1em,bXStyleBloc,right] (#2) {#3};
\node (#2right) at (#2.east){};
\node (Blocrightend) at (#2.east){};
 \draw [bXLineStyle,auto] (#4) -- node[name=#4-#2] {} (#2);
}
\newcommand{\bXBlocrL}[4][2]{
\node [draw, rectangle,
    minimum height=3em, minimum width=3em, left of = #4left,
node distance=#1em, bXStyleBloc,left] (#2) {#3};
\node (#2left) at (#2.west){};
\node (Blocleftend) at (#2.west){};
 \draw [bXLineStyle,auto] (#4) -- node[name=#4-#2] {} (#2);
}

\newcommand{\bXBlocPotato}[4][2]{
\node [draw, cloud, cloud puffs=5, draw,
    minimum height=3em, minimum width=5em, right of = #4right,
node distance=#1em,bXStyleBlocPotato,right] (#2) {#3};
\node (#2right) at (#2.east){};
}
\newcommand{\bXonlyOneBloc}[4][1.5]{
\bXInput{E1}
\bXBloc[#1]{B1}{#3}{E1}
\bXOutput[#1]{S1}{B1}
\bXLink{E1}{B1}{#2}
\bXLink{B1}{S1}{#4}
}
\newcommand{\bXLink}[3][]{
 \draw [bXLineStyle,auto] (#2) -- node[name=#2-#3] {#1} (#3);
}
\newcommand{\bXLinkyx}[2]{
\draw [bXLineStyle] (#1.south)  |-   (#2)  ;
}
\newcommand{\bXLinkxy}[3][]{
\draw [bXLineStyle] (#2)  -|
    node[name=#2-#3,near end,right] {#1} (#3) ;
}
\newcommand{\bXReturn}[4][4]{
\node [below of=#2, node distance=#1em,
    minimum size=0em](return#2) {};
\draw [bXLineStyle] (#2.south)--(return#2.south)
-|   node[name=#2-#3,near end,right] {#4} (#3) ;
}
\newcommand{\bXLinkName}[3][0.4]{
\node[above of=#2, node distance=#1em, bXLabelStyle] (#2name) at (#2) {#3};
}
\newcommand*{\bXCompSum}{\@ifstar\bX@CompSumNorm\bX@CompSumOnly}
\newcommand{\bX@CompSumOnly}[7][4]{
    \node [draw, circle,minimum size=2em,
right of=#3,node distance=#1em] (#2) {};
    \node [draw, cross out,minimum size=1.414em,
right of=#3,node distance=#1em] {};
    \node [above of=#2,node distance=0.6em] {$#4$};
    \node [below of=#2,node distance=0.6em] {$#5$};
    \node [left of=#2,node distance=0.6em] {$#6$};
    \node [right of=#2,node distance=0.6em] {$#7$};
\node (#2right) at (#2.east){};
\node (#2left) at (#2.west){};
}
\newcommand{\bX@CompSumNorm}[7][4]{
    \node [draw, circle,minimum size=1.5em,
right of=#3,node distance=#1em,
label=85:$#4$,label=-85:$#5$,label=175:$#6$,
label=5:$#7$,bXStyleSum] (#2) {};
\node (#2right) at (#2.east){};
\node (#2left) at (#2.west){};
}
\newcommand*{\bXComp}{\@ifstar\bX@CompNorm\bX@CompOnly}
\newcommand{\bX@CompOnly}[3][4]{
\bXCompSum[#1]{#2}{#3}{}{-}{+}{}
}
\newcommand{\bX@CompNorm}[3][4]{
\bXCompSum*[#1]{#2}{#3}{}{-}{+}{}
}
\newcommand*{\bXCompa}{\@ifstar\bX@CompaNorm\bX@CompaOnly}
\newcommand{\bX@CompaOnly}[3][4]{
\bXCompSum[#1]{#2}{#3}{-}{}{+}{}
}
\newcommand{\bX@CompaNorm}[3][4]{
\bXCompSum*[#1]{#2}{#3}{-}{}{+}{}
}
\newcommand*{\bXSuma}{\@ifstar\bX@SumaNorm\bX@SumaOnly}
\newcommand{\bX@SumaOnly}[3][4]{
\bXCompSum[#1]{#2}{#3}{+}{}{+}{}
}
\newcommand{\bX@SumaNorm}[3][4]{
\bXCompSum*[#1]{#2}{#3}{+}{}{+}{}
}
\newcommand*{\bXSumb}{\@ifstar\bX@SumbNorm\bX@SumbOnly}
\newcommand{\bX@SumbOnly}[3][4]{
\bXCompSum[#1]{#2}{#3}{}{+}{+}{}
}
\newcommand{\bX@SumbNorm}[3][4]{
\bXCompSum*[#1]{#2}{#3}{}{+}{+}{}
}
\newcommand{\bXSum}[6][4]{
    \node [draw, circle,minimum size=1.5em,
right of=#3,node distance=#1em,
label=175:$#4$,label=-85:$#5$,
label=85:$#6$,bXStyleSum] (#2) {};
\node (#2right) at (#2.east){};
\node (#2left) at (#2.west){};
}
\newcommand{\bXBranchy}[3][5]{
\node [below of=#2, node distance=#1em, minimum size=0em](#3) {};
\node (#3right) at (#3){};
\node (#3left) at (#3){};
}
\newcommand{\bXNodeShifty}[3][5]{
    \bXBranchy[#1]{#2}{#3}
}
\newcommand{\bXBranchx}[3][5]{
\node [right of=#2, node distance=#1em, minimum size=0em](#3) {};
\node (#3right) at (#3){};
\node (#3left) at (#3){};
}
\newcommand{\bXNodeShiftx}[3][5]{
    \bXBranchx[#1]{#2}{#3}
}
\newcommand{\bXChain}[3][4]{
    \def\lastx{#2}%
    \foreach \x / \y  in {#3}%
    {\bXBlocL[#1]{\x}{\y}{\lastx} %
    \typeout{\x, \y, \lastx}%
    \global\let\lastx\x}
}
\newcommand{\bXChainReturn}[3][4]{
    \def\lastx{#2}%
    \foreach \x / \y  in {#3}%
    {\bXBlocrL[#1]{\x}{\y}{\lastx} %
    \typeout{\x, \y, \lastx}%
    \global\let\lastx\x}
}
\newcommand{\bXLoop}[3][4]{
\bXComp[#1]{Comp#2}{#2}\bXLink{#2}{Comp#2}
\bXChain[#1]{Comp#2}{#3}
\draw [bXLineStyle,auto,-] (Blocrightend.base) --++
    (1em,0)coordinate[name=EndofChain];
\bXReturn{EndofChain}{Comp#2}{}
}
\endinput
%%
%% End of file `blox.sty'.