Skip to content

Commit d9003dd

Browse files
axmmisakaKagamihara Nadeshiko
authored and
Kagamihara Nadeshiko
committed
Fix SVGs by transforming them to be imports
Fix SVGs
1 parent 3367ca9 commit d9003dd

15 files changed

+113
-42
lines changed

docs/reference/Tracing.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ When the `tracing` target parameter is set to `true` in a [federated program](ht
215215

216216
Consider the following LF program:
217217

218-
<img src="./../assets/images/tracing/Feedback.svg" alt="Feedback example" width="300"/>
218+
import FeedbackSVG from "./../assets/images/tracing/Feedback.svg"
219+
220+
<FeedbackSVG title="Feedback example" width="300" role="img" />
219221

220222
Setting `tracing: true` in this program and running it produces four `.lft` files. Running `fedsd` on those files:
221223

docs/writing-reactors/Actions.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ import TS_Asynchronous from '../assets/code/ts/src/Asynchronous.lf';
141141

142142
<NoSelectorTargetCodeBlock c={C_Asynchronous} cpp={Cpp_Asynchronous} py={Py_Asynchronous} rs={Rs_Asynchronous} ts={TS_Asynchronous} lf />
143143

144-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/Asynchronous.svg" width="350"/>
144+
import AsynchronousSVG from "./../assets/images/diagrams/Asynchronous.svg"
145+
146+
<AsynchronousSVG title="Lingua Franca diagram: Asynchronous" role="img" width="350" />
145147

146148
Physical actions are the mechanism for obtaining input from the outside world. Because they are assigned a logical time derived from the physical clock, their logical time can be interpreted as a measure of the time at which some external event occurred.
147149

docs/writing-reactors/Causality Loops.mdx

+9-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import TS_Cycle from '../assets/code/ts/src/Cycle.lf';
2626

2727
This program yields the following diagram:
2828

29-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/Cycle.svg" width="400"/>
29+
import CycleSVG from "./../assets/images/diagrams/Cycle.svg"
30+
31+
<CycleSVG title="Lingua Franca diagram: Cycle" role="img" width="400" />
3032

3133
The diagram highlights a **causality loop** in the program. At each tag, in reactor `B`, the first reaction has to execute before the second if it is enabled, a precedence indicated with the red dashed arrow. But the first can't execute until the reaction of `A` has executed, and that reaction cannot execute until the second reaction `B` has executed. There is no way to satisfy these requirements, so the tools refuse to generated code.
3234

@@ -42,7 +44,9 @@ import TS_CycleWithDelay from '../assets/code/ts/src/CycleWithDelay.lf';
4244

4345
<NoSelectorTargetCodeBlock c={C_CycleWithDelay} cpp={Cpp_CycleWithDelay} py={Py_CycleWithDelay} rs={Rs_CycleWithDelay} ts={TS_CycleWithDelay} lf />
4446

45-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/CycleWithDelay.svg" width="400"/>
47+
import CycleWithDelaySVG from "./../assets/images/diagrams/CycleWithDelay.svg"
48+
49+
<CycleWithDelaySVG title="Lingua Franca diagram: CycleWithDelay" role="img" width="400" />
4650

4751
Here, we have used a delay of 0, which results in a delay of one [microstep](<../writing-reactors/Superdense Time.mdx>). We could equally well have specified a positive time value.
4852

@@ -58,6 +62,8 @@ import TS_CycleReordered from '../assets/code/ts/src/CycleReordered.lf';
5862

5963
<NoSelectorTargetCodeBlock c={C_CycleReordered} cpp={Cpp_CycleReordered} py={Py_CycleReordered} rs={Rs_CycleReordered} ts={TS_CycleReordered} lf />
6064

61-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/CycleReordered.svg" width="400"/>
65+
import CycleReorderedSVG from "./../assets/images/diagrams/CycleReordered.svg"
66+
67+
<CycleReorderedSVG title="Lingua Franca diagram: CycleReordered" role="img" width="400" />
6268

6369
There is no longer any causality loop.

docs/writing-reactors/Composing Reactors.mdx

+12-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ import TS_RegressionTest from '../assets/code/ts/src/RegressionTest.lf';
2929

3030
As soon as programs consist of more than one reactor, it becomes particularly useful to reference the diagrams that are automatically created and displayed by the Lingua Franca IDEs. The diagram for the above program is as follows:
3131

32-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/RegressionTest.svg" width="500"/>
32+
import RegressionTestSVG from "./../assets/images/diagrams/RegressionTest.svg"
33+
34+
<RegressionTestSVG title="Lingua Franca diagram: RegressionTest" role="img" width="500" />
3335

3436
In this diagram, the timer is represented by a clock-like icon, the reactions by chevron shapes, and the $shutdown$ event by a diamond. If there were a $startup$ event in this program, it would appear as a circle.
3537

@@ -111,7 +113,9 @@ A destination port (on the right) can only be connected to a single source port
111113
</ShowIf>
112114
</ShowIfs>
113115

114-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/Multicast.svg" width="250"/>
116+
import MulticastSVG from "./../assets/images/diagrams/Multicast.svg"
117+
118+
<MulticastSVG title="Lingua Franca diagram: Multicast" role="img" width="250" />
115119

116120
Lingua Franca provides a convenient shortcut for such multicast connections, where the above two lines can be replaced by one as follows:
117121

@@ -143,7 +147,9 @@ import TS_Hierarchy from '../assets/code/ts/src/Hierarchy.lf';
143147

144148
<NoSelectorTargetCodeBlock c={C_Hierarchy} cpp={Cpp_Hierarchy} py={Py_Hierarchy} rs={Rs_Hierarchy} ts={TS_Hierarchy} lf />
145149

146-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/Hierarchy.svg" width="500"/>
150+
import HierarchySVG from "./../assets/images/diagrams/Hierarchy.svg"
151+
152+
<HierarchySVG title="Lingua Franca diagram: Hierarchy" role="img" width="500" />
147153

148154
The `Container` has a parameter named `stride`, whose value is passed to the `factor` parameter of the `Scale` reactor. The line
149155

@@ -183,6 +189,8 @@ main reactor {
183189

184190
This is rendered in by the diagram synthesizer as follows:
185191

186-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/PhysicalConnection.svg" width="200"/>
192+
import PhysicalConnectionSVG from "./../assets/images/diagrams/PhysicalConnection.svg"
193+
194+
<PhysicalConnectionSVG title="Lingua Franca diagram: PhysicalConnection" role="img" width="200" />
187195

188196
In such a connection, the logical time at the recipient is derived from the local physical clock rather than being equal to the logical time at the sender. The physical time will always exceed the logical time of the sender (unless fast is set to `true`), so this type of connection incurs a nondeterministic positive logical time delay. Physical connections are useful sometimes in [Distributed-Execution](<../writing-reactors/Distributed Execution.mdx>) in situations where the nondeterministic logical delay is tolerable. Such connections are more efficient because timestamps need not be transmitted and messages do not need to flow through through a centralized coordinator (if a centralized coordinator is being used).

docs/writing-reactors/Deadlines.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ import TS_DeadlineTest from '../assets/code/ts/src/DeadlineTest.lf';
4444

4545
<NoSelectorTargetCodeBlock c={C_DeadlineTest} cpp={Cpp_DeadlineTest} py={Py_DeadlineTest} rs={"DeadlineTest.lf missing for Rust"} ts={TS_DeadlineTest} lf />
4646

47-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/DeadlineTest.svg" width="500"/>
47+
import DeadlineTestSVG from "./../assets/images/diagrams/DeadlineTest.svg"
48+
49+
<DeadlineTestSVG title="Lingua Franca diagram: DeadlineTest" role="img" width="500" />
4850

4951
Running this program will result in the following output:
5052

docs/writing-reactors/Extending Reactors.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ import TS_Extends from '../assets/code/ts/src/Extends.lf';
2323

2424
<NoSelectorTargetCodeBlock c={C_Extends} py={Py_Extends} rs={Rs_Extends} ts={TS_Extends} lf />
2525

26-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/Extends.svg" width="350"/>
26+
import ExtendsSVG from "./../assets/images/diagrams/Extends.svg"
27+
28+
<ExtendsSVG title="Lingua Franca diagram: Extends" role="img" width="350" />
2729

2830
Here, the base class `A` has a single output that it writes to in reaction to an input. The subclass inherits the input, the output, and the reaction of `A`, and adds its own input `b` and reaction. When an input event `a` arrives, both reactions will be invoked, but, once again, in a well-defined order. The reactions of the base class are invoked before those of the derived class. So in this case, `B` will overwrite the output produced by `A`.
2931

docs/writing-reactors/Modal Models.mdx

+9-3
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ As a consequence, a mode has a notion of local time that elapses only when the m
122122
From the perspective of timers and actions, time is suspended when a mode is inactive.
123123
This also applies to indirectly nested reactors within modes and connections with logical delays, if their source lies within a mode.
124124

125-
<img alt="Illustration of local time (model)" src="./../assets/images/modal_models/local_time.svg" width="400"/>
125+
import local_timeSVG from "./../assets/images/modal_models/local_time.svg"
126+
127+
<local_timeSVG title="Illustration of local time (model): local_time" />
126128

127129
The above LF model illustrates the different characteristics of local time affecting timers and actions in the presence of the two transition types.
128130

@@ -135,7 +137,9 @@ This action triggers the second reaction, which writes to the output `out`.
135137
The main difference between the modes is that `One` is entered via a history transition, continuing its behavior, while `Two` is reset.
136138
(History behavior is indicated by an "H" on the transition edge because it enters into the entire history of the mode.)
137139

138-
<img alt="Illustration of local time (trace)" src="./../assets/images/modal_models/local_time_trace.svg" width="600"/>
140+
import local_time_traceSVG from "./../assets/images/modal_models/local_time_trace.svg"
141+
142+
<local_time_traceSVG title="Illustration of local time (trace): local_time_trace" />
139143

140144
Above is the execution trace of the first 4 seconds of this program.
141145
Below the timeline is the currently active mode and above the timeline are the model elements that are executed at certain points in time, together with indicating triggering and their relation through time.
@@ -145,7 +149,9 @@ The timing diagram illustrates the different handling of time between history tr
145149
Specifically, when mode `One` is re-entered via a history transition, at time 2000 msec, the action triggered by `T1` before, at time 850 msec, resumes.
146150
In contrast, when mode `Two` is re-entered via a reset transition, at time 3000 msec, the action triggered by `T2` before, at time 1850 msec, gets discarded.
147151

148-
<img alt="Illustration of local time (plot)" src="./../assets/images/modal_models/local_time_plot.svg" width="300"/>
152+
import local_time_plotSVG from "./../assets/images/modal_models/local_time_plot.svg"
153+
154+
<local_time_plotSVG title="Illustration of local time (plot): local_time_plot" />
149155

150156
The above plot illustrates the relation between global time in the environment and the localized time for each timer in the model.
151157
Since the top-level reactor `TimingExample` is not enclosed by any mode, its time always corresponds to the global time.

docs/writing-reactors/Multiports and Banks.mdx

+20-8
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ import TS_Multiport from '../assets/code/ts/src/Multiport.lf';
4545

4646
<NoSelectorTargetCodeBlock c={C_Multiport} cpp={Cpp_Multiport} py={Py_Multiport} rs={Rs_Multiport} ts={TS_Multiport} lf />
4747

48-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/Multiport.svg" width="300"/>
48+
import MultiportSVG from "./../assets/images/diagrams/Multiport.svg"
49+
50+
<MultiportSVG title="Lingua Franca diagram: Multiport" role="img" width="300" />
4951

5052
Executing this program will yield:
5153

@@ -152,7 +154,9 @@ main reactor {
152154
}
153155
```
154156

155-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/BankToBankMultiport.svg" width="300"/>
157+
import BankToBankMultiportSVG from "./../assets/images/diagrams/BankToBankMultiport.svg"
158+
159+
<BankToBankMultiportSVG title="Lingua Franca diagram: BankToBankMultiport" role="img" width="300" />
156160

157161
If the `Source` and `Destination` reactors have multiport inputs and outputs, as in the examples above, then a warning will be issued if the total width on the left does not match the total width on the right. For example, the following is balanced:
158162

@@ -224,7 +228,9 @@ import TS_ChildBank from '../assets/code/ts/src/ChildBank.lf';
224228

225229
<NoSelectorTargetCodeBlock c={C_ChildBank} cpp={Cpp_ChildBank} py={Py_ChildBank} rs={Rs_ChildBank} ts={TS_ChildBank} lf />
226230

227-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/ChildBank.svg" width="150"/>
231+
import ChildBankSVG from "./../assets/images/diagrams/ChildBank.svg"
232+
233+
<ChildBankSVG title="Lingua Franca diagram: ChildBank" role="img" width="150" />
228234

229235
In this program, the `Parent` reactor contains a bank of `Child` reactor instances
230236
with a width of 2. In the main reactor, a bank of `Parent` reactors is
@@ -275,7 +281,9 @@ import TS_ChildParentBank2 from '../assets/code/ts/src/ChildParentBank2.lf';
275281

276282
<NoSelectorTargetCodeBlock c={C_ChildParentBank2} cpp={Cpp_ChildParentBank2} py={Py_ChildParentBank2} rs={"ChildParentBank2.lf missing for Rust"} ts={TS_ChildParentBank2} lf />
277283

278-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/ChildParentBank2.svg" width="250"/>
284+
import ChildParentBank2SVG from "./../assets/images/diagrams/ChildParentBank2.svg"
285+
286+
<ChildParentBank2SVG title="Lingua Franca diagram: ChildParentBank2" role="img" width="250" />
279287

280288
Running this program will give something like the following:
281289

@@ -323,7 +331,9 @@ import TS_MultiportToBank from '../assets/code/ts/src/MultiportToBank.lf';
323331

324332
<NoSelectorTargetCodeBlock c={C_MultiportToBank} cpp={Cpp_MultiportToBank} py={Py_MultiportToBank} rs={Rs_MultiportToBank} ts={TS_MultiportToBank} lf />
325333

326-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/MultiportToBank.svg" width="300"/>
334+
import MultiportToBankSVG from "./../assets/images/diagrams/MultiportToBank.svg"
335+
336+
<MultiportToBankSVG title="Lingua Franca diagram: MultiportToBank" role="img" width="300" />
327337

328338
The three outputs from the `Source` instance `a` will be sent, respectively, to each of three instances of `Destination`, `b[0]`, `b[1]`, and `b[2]`. The result of the program will be something like the following:
329339

@@ -376,7 +386,9 @@ import Py_Interleaved from '../assets/code/py/src/Interleaved.lf';
376386

377387
<NoSelectorTargetCodeBlock c={C_Interleaved} cpp={Cpp_Interleaved} py={Py_Interleaved} lf />
378388

379-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/Interleaved.svg" width="250"/>
389+
import InterleavedSVG from "./../assets/images/diagrams/Interleaved.svg"
390+
391+
<InterleavedSVG title="Lingua Franca diagram: Interleaved" role="img" width="250" />
380392

381393
In the above program, four instance of `Node` are created, and, at startup, each instance sends 42 to its second (index 1) output channel. The result is that the second bank member (`bank_index` 1) will receive the number 42 on each input channel of its multiport input. Running this program gives something like the following:
382394

@@ -395,11 +407,11 @@ In bank index 1, the 0-th channel receives from `bank_index` 0, the 1-th channel
395407

396408
This style of connection is accomplished using the new keyword $interleaved$ in the connection. Normally, a port reference such as `nodes.out` where `nodes` is a bank and `out` is a multiport, would list all the individual ports by first iterating over the banks and then, for each bank index, iterating over the ports. If we consider the tuple (b,p) to denote the index b within the bank and the index p within the multiport, then the following list is created: (0,0), (0,1), (0,2), (0,3), (1,0), (1,1), (1,2), (1,3), (2,0), (2,1), (2,2), (2,3), (3,0), (3,1), (3,2), (3,3). However, if we use $interleaved$`(nodes.out)` instead, the connection logic will iterate over the ports first and then the banks, creating the following list: (0,0), (1,0), (2,0), (3,0), (0,1), (1,1), (2,1), (3,1), (0,2), (1,2), (2,2), (3,2), (0,3), (1,3), (2,3), (3,3). By combining a normal port reference with a interleaved reference, we can construct a fully connected network. The figure below visualizes this how this pattern would look without banks or multiports:
397409

398-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/AddressableDesugared.png" width="600"/>
410+
![Lingua Franca diagram: AddressableDesugared](../assets/images/diagrams/AddressableDesugared.png)
399411

400412
If we were to use a normal connection `nodes.out -> nodes.in;` instead of the $interleaved$ connection, then the following pattern would be created:
401413

402-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/AddressableNaiveDesugared.png" width="600"/>
414+
![Lingua Franca diagram: AddressableNaiveDesugared](../assets/images/diagrams/AddressableNaiveDesugared.png)
403415

404416
Effectively, this connects each reactor instance to itself, which isn't very useful.
405417

docs/writing-reactors/Reactions.mdx

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ import TS_Contained from '../assets/code/ts/src/Contained.lf';
7171

7272
<NoSelectorTargetCodeBlock c={C_Contained} cpp={Cpp_Contained} py={Py_Contained} rs={Rs_Contained} ts={TS_Contained} lf />
7373

74-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/Contained.svg" width="300"/>
74+
import ContainedSVG from "./../assets/images/diagrams/Contained.svg"
75+
76+
<ContainedSVG title="Lingua Franca diagram: Contained" role="img" width="300" />
7577

7678
This instantiates the above `Overwriting` reactor and monitors its outputs.
7779

docs/writing-reactors/Superdense Time.mdx

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import TS_Microsteps from '../assets/code/ts/src/Microsteps.lf';
2626

2727
<NoSelectorTargetCodeBlock c={C_Microsteps} cpp={Cpp_Microsteps} py={Py_Microsteps} rs={Rs_Microsteps} ts={TS_Microsteps} lf />
2828

29-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/Microsteps.svg" width="150"/>
29+
import MicrostepsSVG from "./../assets/images/diagrams/Microsteps.svg"
30+
31+
<MicrostepsSVG title="Lingua Franca diagram: Microsteps" role="img" width="150" />
3032

3133
Executing this program will yield something like this:
3234

@@ -52,7 +54,9 @@ import TS_Simultaneous from '../assets/code/ts/src/Simultaneous.lf';
5254

5355
<NoSelectorTargetCodeBlock c={C_Simultaneous} cpp={Cpp_Simultaneous} py={Py_Simultaneous} rs={Rs_Simultaneous} ts={TS_Simultaneous} lf />
5456

55-
<img alt="Lingua Franca diagram" src="./../assets/images/diagrams/Simultaneous.svg" width="400"/>
57+
import SimultaneousSVG from "./../assets/images/diagrams/Simultaneous.svg"
58+
59+
<SimultaneousSVG title="Lingua Franca diagram: Simultaneous" role="img" width="400" />
5660

5761
The `Destination` reactor has two inputs, `x` and `y`, and it reports in a reaction to either input what is the logical time, the microstep, and which input is present. The main reactor reacts to $startup$ by sending data to the `x` input of `Destination`. It then schedules a `repeat` action with an `<offset>` of zero. The `repeat` reaction is invoked **strictly later**, one **microstep** later. The output printed, therefore, will look like this:
5862

0 commit comments

Comments
 (0)