Debian Codegraph @

texmf-dist/tex/latex/blox/blox.sty

raw
1 %%
2 %% This is file `blox.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% blox.dtx (with options: `package')
8 %% This is a generated file.
9 %% Copyright (C) 2014-2021 by Ben Reish
10 %% This file may be distributed and/or modified under the
11 %% conditions of the LaTeX Project Public License, either
12 %% version 1.3 of this license or (at your option) any later
13 %% version. The latest version of this license is in:
14 %% http://www.latex-project.org/lppl.txt
15 %% and version 1.3 or later is part of all distributions of
16 %% LaTeX version 1999/12/01 or later.
17 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
18 \ProvidesPackage{blox}%
19 [2021/2/22 v2.51 Just an English translation of schemabloc]
20
21
22
23
24
25
26 \typeout{* }
27 \typeout{blox: Just an English translation of schemabloc package.}
28 \typeout{blox Copyright (C) 2014-2021 Ben Reish}
29 \typeout{* }
30 \typeout{This program comes with ABSOLUTELY NO WARRANTY.}
31 \typeout{This is free software, and you are welcome to redistribute it}
32 \typeout{under certain conditions.}
33 \typeout{* }
34 \RequirePackage{ifthen}
35 \RequirePackage{tikz}
36 \RequirePackage{pgffor}
37 \usetikzlibrary{shapes,arrows}
38 \tikzstyle{bXLineStyle}=[->,>=latex',]
39 \tikzstyle{bXStyleBloc}=[draw, rectangle,]
40 \tikzstyle{bXStyleBlocPotato}=[]
41 \tikzstyle{bXStyleSum}=[draw, circle,]%style Sum CC
42 \tikzstyle{bXLabelStyle}=[]
43 \newcommand{\bXDefaultLineStyle}{
44 \tikzstyle{bXLineStyle}=[->,>=latex']
45 }
46 \newcommand{\bXLineStyle}[1]{
47 \tikzstyle{bXLineStyle}+=[#1]
48 }
49 \newcommand{\bXStyleBloc}[1]{
50 \tikzstyle{bXStyleBloc}+=[#1]
51 }
52 \newcommand{\bXStyleBlocDefault}{
53 \tikzstyle{bXStyleBloc}=[draw, rectangle,]
54 }
55 \newcommand{\bXStylePotato}[1]{
56 \tikzstyle{bXStyleBlocPotato}+=[#1]
57 }
58 \newcommand{\bXStylePotatoDefault}{
59 \tikzstyle{bXStyleBlocPotato}=[draw, cloud, cloud puffs=5,]
60 }
61 \newcommand{\bXStyleSum}[1]{
62 \tikzstyle{bXStyleSum}+=[#1]
63 }
64 \newcommand{\bXStyleSumDefault}{
65 \tikzstyle{bXStyleSum}=[draw, circle,]
66 }
67 \newcommand{\bXLabelStyle}[1]{
68 \tikzstyle{bXLabelStyle}+=[#1]
69 }
70 \newcommand{\bXLabelStyleDefault}{
71 \tikzstyle{bXLabelStyle}=[font=\normalfont,]
72 }
73 \newcommand{\bXInput}{%
74 \@ifnextchar[{\@bXInputi}{\@bXInputii}
75 }
76 \newcommand{\@bXInputi}[2][]{%
77 \node [coordinate,name=#2,bXLabelStyle] {#1};
78 \bXBranchx[0]{#2}{#2};
79 \draw (0,0) node [anchor=east,name=#2label,] {#1};
80 }
81 \newcommand{\@bXInputii}[1]{%
82 \node [coordinate,name=#1] { };
83 \bXBranchx[0]{#1}{#1};
84 }
85 \newcommand{\bXOutput}[3][2]{
86 \node [coordinate, right of=#3right,
87 node distance=#1em, minimum size=0em,right] (#2) {};
88 }
89 \newcommand{\bXBloc}[4][2]{
90 \node [draw, rectangle,
91 minimum height=3em, minimum width=3em, right of = #4right,
92 node distance=#1em,bXStyleBloc,right] (#2) {#3};
93 \node (#2right) at (#2.east){};
94 \node (Blocrightend) at (#2.east){};
95 }
96 \newcommand{\bXBlocr}[4][2]{
97 \node [
98 minimum height=3em, minimum width=3em, left of = #4left,
99 node distance=#1em, bXStyleBloc,left] (#2) {#3};
100 \node (#2left) at (#2.west){};
101 }
102 \newcommand{\bXBlocL}[4][2]{
103 \node [draw, rectangle,
104 minimum height=3em, minimum width=3em,
105 right of = #4right,node distance=#1em,bXStyleBloc,right] (#2) {#3};
106 \node (#2right) at (#2.east){};
107 \node (Blocrightend) at (#2.east){};
108 \draw [bXLineStyle,auto] (#4) -- node[name=#4-#2] {} (#2);
109 }
110 \newcommand{\bXBlocrL}[4][2]{
111 \node [draw, rectangle,
112 minimum height=3em, minimum width=3em, left of = #4left,
113 node distance=#1em, bXStyleBloc,left] (#2) {#3};
114 \node (#2left) at (#2.west){};
115 \node (Blocleftend) at (#2.west){};
116 \draw [bXLineStyle,auto] (#4) -- node[name=#4-#2] {} (#2);
117 }
118
119 \newcommand{\bXBlocPotato}[4][2]{
120 \node [draw, cloud, cloud puffs=5, draw,
121 minimum height=3em, minimum width=5em, right of = #4right,
122 node distance=#1em,bXStyleBlocPotato,right] (#2) {#3};
123 \node (#2right) at (#2.east){};
124 }
125 \newcommand{\bXonlyOneBloc}[4][1.5]{
126 \bXInput{E1}
127 \bXBloc[#1]{B1}{#3}{E1}
128 \bXOutput[#1]{S1}{B1}
129 \bXLink{E1}{B1}{#2}
130 \bXLink{B1}{S1}{#4}
131 }
132 \newcommand{\bXLink}[3][]{
133 \draw [bXLineStyle,auto] (#2) -- node[name=#2-#3] {#1} (#3);
134 }
135 \newcommand{\bXLinkyx}[2]{
136 \draw [bXLineStyle] (#1.south) |- (#2) ;
137 }
138 \newcommand{\bXLinkxy}[3][]{
139 \draw [bXLineStyle] (#2) -|
140 node[name=#2-#3,near end,right] {#1} (#3) ;
141 }
142 \newcommand{\bXLinktyx}[2]{
143 \draw [bXLineStyle] (#1.north) |- (#2) ;
144 }
145 \newcommand{\bXLinktb}[2]{
146 \draw [bXLineStyle] (#1.north) -- (#2.south) ;
147 }
148 \newcommand{\bXReturn}[4][4]{
149 \node [below of=#2, node distance=#1em,
150 minimum size=0em](return#2) {};
151 \draw [bXLineStyle] (#2.south)--(return#2.south)
152 -| node[name=#2-#3,near end,right] {#4} (#3) ;
153 }
154 \newcommand{\bXLinkName}[3][0.4]{
155 \node[above of=#2, node distance=#1em, bXLabelStyle] (#2name) at (#2) {#3};
156 }
157 \newcommand*{\bXCompSum}{\@ifstar\bX@CompSumNorm\bX@CompSumOnly}
158 \newcommand{\bX@CompSumOnly}[7][4]{
159 \node [draw, circle,minimum size=2em,
160 right of=#3,node distance=#1em] (#2) {};
161 \node [draw, cross out,minimum size=1.414em,
162 right of=#3,node distance=#1em] {};
163 \node [above of=#2,node distance=0.6em] {$#4$};
164 \node [below of=#2,node distance=0.6em] {$#5$};
165 \node [left of=#2,node distance=0.6em] {$#6$};
166 \node [right of=#2,node distance=0.6em] {$#7$};
167 \node (#2right) at (#2.east){};
168 \node (#2left) at (#2.west){};
169 }
170 \newcommand{\bX@CompSumNorm}[7][4]{
171 \node [draw, circle,minimum size=1.5em,
172 right of=#3,node distance=#1em,
173 label=85:$#4$,label=-85:$#5$,label=175:$#6$,
174 label=5:$#7$,bXStyleSum] (#2) {};
175 \node (#2right) at (#2.east){};
176 \node (#2left) at (#2.west){};
177 }
178 \newcommand*{\bXComp}{\@ifstar\bX@CompNorm\bX@CompOnly}
179 \newcommand{\bX@CompOnly}[3][4]{
180 \bXCompSum[#1]{#2}{#3}{}{-}{+}{}
181 }
182 \newcommand{\bX@CompNorm}[3][4]{
183 \bXCompSum*[#1]{#2}{#3}{}{-}{+}{}
184 }
185 \newcommand*{\bXCompa}{\@ifstar\bX@CompaNorm\bX@CompaOnly}
186 \newcommand{\bX@CompaOnly}[3][4]{
187 \bXCompSum[#1]{#2}{#3}{-}{}{+}{}
188 }
189 \newcommand{\bX@CompaNorm}[3][4]{
190 \bXCompSum*[#1]{#2}{#3}{-}{}{+}{}
191 }
192 \newcommand*{\bXSuma}{\@ifstar\bX@SumaNorm\bX@SumaOnly}
193 \newcommand{\bX@SumaOnly}[3][4]{
194 \bXCompSum[#1]{#2}{#3}{+}{}{+}{}
195 }
196 \newcommand{\bX@SumaNorm}[3][4]{
197 \bXCompSum*[#1]{#2}{#3}{+}{}{+}{}
198 }
199 \newcommand*{\bXSumb}{\@ifstar\bX@SumbNorm\bX@SumbOnly}
200 \newcommand{\bX@SumbOnly}[3][4]{
201 \bXCompSum[#1]{#2}{#3}{}{+}{+}{}
202 }
203 \newcommand{\bX@SumbNorm}[3][4]{
204 \bXCompSum*[#1]{#2}{#3}{}{+}{+}{}
205 }
206 \newcommand{\bXSum}[6][4]{
207 \node [draw, circle,minimum size=1.5em,
208 right of=#3,node distance=#1em,
209 label=175:$#4$,label=-85:$#5$,
210 label=85:$#6$,bXStyleSum] (#2) {};
211 \node (#2right) at (#2.east){};
212 \node (#2left) at (#2.west){};
213 }
214 \newcommand{\bXBranchy}[3][5]{
215 \node [below of=#2, node distance=#1em, minimum size=0em](#3) {};
216 \node (#3right) at (#3){};
217 \node (#3left) at (#3){};
218 }
219 \newcommand{\bXNodeShifty}[3][5]{
220 \bXBranchy[#1]{#2}{#3}
221 }
222 \newcommand{\bXBranchx}[3][5]{
223 \node [right of=#2, node distance=#1em, minimum size=0em](#3) {};
224 \node (#3right) at (#3){};
225 \node (#3left) at (#3){};
226 }
227 \newcommand{\bXNodeShiftx}[3][5]{
228 \bXBranchx[#1]{#2}{#3}
229 }
230 \newcommand{\bXChain}[3][4]{
231 \def\lastx{#2}%
232 \foreach \x / \y in {#3}%
233 {\bXBlocL[#1]{\x}{\y}{\lastx} %
234 \typeout{\x, \y, \lastx}%
235 \global\let\lastx\x}
236 }
237 \newcommand{\bXChainReturn}[3][4]{
238 \def\lastx{#2}%
239 \foreach \x / \y in {#3}%
240 {\bXBlocrL[#1]{\x}{\y}{\lastx} %
241 \typeout{\x, \y, \lastx}%
242 \global\let\lastx\x}
243 }
244 \newcommand{\bXLoop}[3][4]{
245 \bXComp[#1]{Comp#2}{#2}\bXLink{#2}{Comp#2}
246 \bXChain[#1]{Comp#2}{#3}
247 \draw [bXLineStyle,auto,-] (Blocrightend.base) --++
248 (1em,0)coordinate[name=EndofChain];
249 \bXReturn{EndofChain}{Comp#2}{}
250 }
251 \endinput
252 %%
253 %% End of file `blox.sty'.