Skip to content

Commit 504e9db

Browse files
authored
Merge pull request #280 from AneesHl/main
fixed various minor errors
2 parents fdf9a27 + b4f40a6 commit 504e9db

35 files changed

+136
-46
lines changed

docs/assets/code/rs/src/SlowingClock.lf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ main reactor SlowingClock(start: time = 100 ms, incr: time = 100 ms) {
44
state start = start
55
state incr = incr
66
state interval: time = start
7-
state expected_time: time()
7+
state expected_time: time
88
logical action a
99

1010
reaction(startup) -> a {=

docs/reference/target-declaration.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ This parameter takes a non-negative integer and specifies the number of worker t
599599
</ShowIf>
600600
</ShowIfs>
601601

602-
# Command-Line Arguments
602+
## Command-Line Arguments
603603

604604
<ShowIfs>
605605
<ShowIf ts >

docs/reference/target-language-details.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ You can use a development version of the runtime library by setting the LFC opti
148148
<ShowIfs>
149149
<ShowIf c>
150150

151-
- The C target does make any distinction between `private` and `public` `preamble`.
151+
- The C target does not make any distinction between `private` and `public` `preamble`.
152152

153153
</ShowIf>
154154
<ShowIf cpp>

docs/writing-reactors/a-first-reactor.mdx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,14 @@ The general structure of a reactor definition is as follows:
9494
timer <name>([<offset>[, <period>]])
9595
logical action <name>[: <type>]
9696
physical action <name>[: <type>]
97+
[const] method <name>(parameters):<type> {= ... body ...=}
9798
reaction [<name>] (triggers) [<uses>] [-> <effects>] [{= ... body ...=}]
9899
<instance-name> = new <class-name>([<parameter-assignments>])
99100
<port-name> [, ...] -> <port-name> [, ...] [after <delay>]
100101
}
101102
```
102103
</ShowIf>
103-
<ShowIf cpp rs>
104+
<ShowIf cpp>
104105
```lf
105106
[main] reactor <class-name> [(parameters)] {
106107
input <name>: <type>
@@ -116,6 +117,21 @@ The general structure of a reactor definition is as follows:
116117
}
117118
```
118119
</ShowIf>
120+
<ShowIf rs>
121+
```lf
122+
[main] reactor <class-name> [(parameters)] {
123+
input <name>: <type>
124+
output <name>: <type>
125+
state <name>: <type> [= <value>]
126+
timer <name>([<offset>[, <period>]])
127+
logical action <name>[: <type>]
128+
physical action <name>[: <type>]
129+
reaction [<name>] (triggers) [<uses>] [-> <effects>] [{= ... body ...=}]
130+
<instance-name> = new <class-name>([<parameter-assignments>])
131+
<port-name> [, ...] -> <port-name> [, ...] [after <delay>]
132+
}
133+
```
134+
</ShowIf>
119135
<ShowIf py>
120136
```lf
121137
[main or federated] reactor <class-name> [(parameters)] {

docs/writing-reactors/multiports-and-banks.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ In `Destination`, the reaction is triggered by `in`, not by some individual chan
6565
c="if (in[i]->is_present) ..."
6666
cpp="if (in[i]->is_present()) ..."
6767
py="if port.is_present: ..."
68-
rs="if (val) ..."
69-
ts="if let Some(v) = ctx.get(&i) ..."
68+
ts="if (val) ..."
69+
rs="if let Some(v) = ctx.get(&i) ...
70+
// Or using is_present()
71+
if ctx.is_present(&inp[0]) ..."
7072
/>
7173
:::
7274

docs/writing-reactors/reaction-declarations.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ directory.
8888
## The Generated Header Files
8989
9090
The generated header files are necessary in order to separate your C code from your LF code because
91-
the describe the signatures of the reaction functions that you must implement.
91+
they describe the signatures of the reaction functions that you must implement.
9292
9393
In addition, they define structs that will be referenced by the reaction bodies. This includes the
9494
`self` struct of the reactor to which the header file corresponds, as well as structs for its ports,

docs/writing-reactors/time-and-timers.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515

1616
A key property of Lingua Franca is **logical time**. All events occur at an instant in logical time. By default, the runtime system does its best to align logical time with **physical time**, which is some measurement of time on the execution platform. The **lag** is defined to be physical time minus logical time, and the goal of the runtime system is maintain a small non-negative lag.
1717

18-
The **lag** is allowed to go negative only if the [`fast` target property](<../introduction.md#fast>) or the [`--fast`](<../introduction.md#command-line-arguments>) command-line argument is set to `true`. In that case, the program will execute as fast as possible with no regard to physical time.
18+
The **lag** is allowed to go negative only if the [`fast`](<../reference/target-declaration#fast>) target property or the [`--fast`](<../reference/target-declaration#command-line-arguments>) command-line argument is set to `true`. In that case, the program will execute as fast as possible with no regard to physical time.
1919

2020
<ShowOnly c cpp rs>
2121

@@ -93,8 +93,8 @@ import TS_Timer from '../assets/code/ts/src/Timer.lf';
9393
This specifies a timer named `t` that will first trigger at the start of execution and then repeatedly trigger at intervals of one second. Notice that the time units can be left off if the value is zero.
9494

9595
This target provides a built-in function for retrieving the logical time at which the reaction is invoked,
96-
<ShowOnly c inline>`get_logical_time()`</ShowOnly>
97-
<ShowOnly cpp inline>`FIXME`</ShowOnly>
96+
<ShowOnly c inline>`lf_time_logical()`</ShowOnly>
97+
<ShowOnly cpp inline>`get_logical_time()`</ShowOnly>
9898
<ShowOnly py inline>`lf.time.logical()`</ShowOnly>
9999
<ShowOnly ts inline>`util.getCurrentLogicalTime()`</ShowOnly>
100100
<ShowOnly rs inline>`get_logical_time()`</ShowOnly>

versioned_docs/version-0.5.0/assets/code/rs/src/SlowingClock.lf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ main reactor SlowingClock(start: time = 100 ms, incr: time = 100 ms) {
44
state start = start
55
state incr = incr
66
state interval: time = start
7-
state expected_time: time()
7+
state expected_time: time
88
logical action a
99

1010
reaction(startup) -> a {=

versioned_docs/version-0.5.0/reference/target-declaration.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ This parameter takes a non-negative integer and specifies the number of worker t
684684
</ShowIf>
685685
</ShowIfs>
686686

687-
# Command-Line Arguments
687+
## Command-Line Arguments
688688

689689
<ShowIfs>
690690
<ShowIf ts >

versioned_docs/version-0.5.0/reference/target-language-details.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ You can use a development version of the runtime library by setting the LFC opti
148148
<ShowIfs>
149149
<ShowIf c>
150150

151-
- The C target does make any distinction between `private` and `public` `preamble`.
151+
- The C target does not make any distinction between `private` and `public` `preamble`.
152152

153153
</ShowIf>
154154
<ShowIf cpp>

versioned_docs/version-0.5.0/writing-reactors/a-first-reactor.mdx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,14 @@ The general structure of a reactor definition is as follows:
9494
timer <name>([<offset>[, <period>]])
9595
logical action <name>[: <type>]
9696
physical action <name>[: <type>]
97+
[const] method <name>(parameters):<type> {= ... body ...=}
9798
reaction [<name>] (triggers) [<uses>] [-> <effects>] [{= ... body ...=}]
9899
<instance-name> = new <class-name>([<parameter-assignments>])
99100
<port-name> [, ...] -> <port-name> [, ...] [after <delay>]
100101
}
101102
```
102103
</ShowIf>
103-
<ShowIf cpp rs>
104+
<ShowIf cpp>
104105
```lf
105106
[main] reactor <class-name> [(parameters)] {
106107
input <name>: <type>
@@ -116,6 +117,21 @@ The general structure of a reactor definition is as follows:
116117
}
117118
```
118119
</ShowIf>
120+
<ShowIf rs>
121+
```lf
122+
[main] reactor <class-name> [(parameters)] {
123+
input <name>: <type>
124+
output <name>: <type>
125+
state <name>: <type> [= <value>]
126+
timer <name>([<offset>[, <period>]])
127+
logical action <name>[: <type>]
128+
physical action <name>[: <type>]
129+
reaction [<name>] (triggers) [<uses>] [-> <effects>] [{= ... body ...=}]
130+
<instance-name> = new <class-name>([<parameter-assignments>])
131+
<port-name> [, ...] -> <port-name> [, ...] [after <delay>]
132+
}
133+
```
134+
</ShowIf>
119135
<ShowIf py>
120136
```lf
121137
[main or federated] reactor <class-name> [(parameters)] {

versioned_docs/version-0.5.0/writing-reactors/multiports-and-banks.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ In `Destination`, the reaction is triggered by `in`, not by some individual chan
6565
c="if (in[i]->is_present) ..."
6666
cpp="if (in[i]->is_present()) ..."
6767
py="if port.is_present: ..."
68-
rs="if (val) ..."
69-
ts="if let Some(v) = ctx.get(&i) ..."
68+
ts="if (val) ..."
69+
rs="if let Some(v) = ctx.get(&i) ...
70+
// Or using is_present()
71+
if ctx.is_present(&inp[0]) ..."
7072
/>
7173
:::
7274

versioned_docs/version-0.5.0/writing-reactors/reaction-declarations.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ directory.
8888
## The Generated Header Files
8989
9090
The generated header files are necessary in order to separate your C code from your LF code because
91-
the describe the signatures of the reaction functions that you must implement.
91+
they describe the signatures of the reaction functions that you must implement.
9292
9393
In addition, they define structs that will be referenced by the reaction bodies. This includes the
9494
`self` struct of the reactor to which the header file corresponds, as well as structs for its ports,

versioned_docs/version-0.5.0/writing-reactors/time-and-timers.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515

1616
A key property of Lingua Franca is **logical time**. All events occur at an instant in logical time. By default, the runtime system does its best to align logical time with **physical time**, which is some measurement of time on the execution platform. The **lag** is defined to be physical time minus logical time, and the goal of the runtime system is maintain a small non-negative lag.
1717

18-
The **lag** is allowed to go negative only if the [`fast` target property](<../introduction.md#fast>) or the [`--fast`](<../introduction.md#command-line-arguments>) command-line argument is set to `true`. In that case, the program will execute as fast as possible with no regard to physical time.
18+
The **lag** is allowed to go negative only if the [`fast`](<../reference/target-declaration#fast>) target property or the [`--fast`](<../reference/target-declaration#command-line-arguments>) command-line argument is set to `true`. In that case, the program will execute as fast as possible with no regard to physical time.
1919

2020
<ShowOnly c cpp rs>
2121

@@ -93,8 +93,8 @@ import TS_Timer from '../assets/code/ts/src/Timer.lf';
9393
This specifies a timer named `t` that will first trigger at the start of execution and then repeatedly trigger at intervals of one second. Notice that the time units can be left off if the value is zero.
9494

9595
This target provides a built-in function for retrieving the logical time at which the reaction is invoked,
96-
<ShowOnly c inline>`get_logical_time()`</ShowOnly>
97-
<ShowOnly cpp inline>`FIXME`</ShowOnly>
96+
<ShowOnly c inline>`lf_time_logical()`</ShowOnly>
97+
<ShowOnly cpp inline>`get_logical_time()`</ShowOnly>
9898
<ShowOnly py inline>`lf.time.logical()`</ShowOnly>
9999
<ShowOnly ts inline>`util.getCurrentLogicalTime()`</ShowOnly>
100100
<ShowOnly rs inline>`get_logical_time()`</ShowOnly>

versioned_docs/version-0.6.0/assets/code/rs/src/SlowingClock.lf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ main reactor SlowingClock(start: time = 100 ms, incr: time = 100 ms) {
44
state start = start
55
state incr = incr
66
state interval: time = start
7-
state expected_time: time()
7+
state expected_time: time
88
logical action a
99

1010
reaction(startup) -> a {=

versioned_docs/version-0.6.0/reference/target-declaration.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ This parameter takes a non-negative integer and specifies the number of worker t
625625
</ShowIf>
626626
</ShowIfs>
627627
628-
# Command-Line Arguments
628+
## Command-Line Arguments
629629
630630
<ShowIfs>
631631
<ShowIf ts >

versioned_docs/version-0.6.0/reference/target-language-details.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ You can use a development version of the runtime library by setting the LFC opti
148148
<ShowIfs>
149149
<ShowIf c>
150150

151-
- The C target does make any distinction between `private` and `public` `preamble`.
151+
- The C target does not make any distinction between `private` and `public` `preamble`.
152152

153153
</ShowIf>
154154
<ShowIf cpp>

versioned_docs/version-0.6.0/writing-reactors/a-first-reactor.mdx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,14 @@ The general structure of a reactor definition is as follows:
9494
timer <name>([<offset>[, <period>]])
9595
logical action <name>[: <type>]
9696
physical action <name>[: <type>]
97+
[const] method <name>(parameters):<type> {= ... body ...=}
9798
reaction [<name>] (triggers) [<uses>] [-> <effects>] [{= ... body ...=}]
9899
<instance-name> = new <class-name>([<parameter-assignments>])
99100
<port-name> [, ...] -> <port-name> [, ...] [after <delay>]
100101
}
101102
```
102103
</ShowIf>
103-
<ShowIf cpp rs>
104+
<ShowIf cpp>
104105
```lf
105106
[main] reactor <class-name> [(parameters)] {
106107
input <name>: <type>
@@ -116,6 +117,21 @@ The general structure of a reactor definition is as follows:
116117
}
117118
```
118119
</ShowIf>
120+
<ShowIf rs>
121+
```lf
122+
[main] reactor <class-name> [(parameters)] {
123+
input <name>: <type>
124+
output <name>: <type>
125+
state <name>: <type> [= <value>]
126+
timer <name>([<offset>[, <period>]])
127+
logical action <name>[: <type>]
128+
physical action <name>[: <type>]
129+
reaction [<name>] (triggers) [<uses>] [-> <effects>] [{= ... body ...=}]
130+
<instance-name> = new <class-name>([<parameter-assignments>])
131+
<port-name> [, ...] -> <port-name> [, ...] [after <delay>]
132+
}
133+
```
134+
</ShowIf>
119135
<ShowIf py>
120136
```lf
121137
[main or federated] reactor <class-name> [(parameters)] {

versioned_docs/version-0.6.0/writing-reactors/multiports-and-banks.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ In `Destination`, the reaction is triggered by `in`, not by some individual chan
6565
c="if (in[i]->is_present) ..."
6666
cpp="if (in[i]->is_present()) ..."
6767
py="if port.is_present: ..."
68-
rs="if (val) ..."
69-
ts="if let Some(v) = ctx.get(&i) ..."
68+
ts="if (val) ..."
69+
rs="if let Some(v) = ctx.get(&i) ...
70+
// Or using is_present()
71+
if ctx.is_present(&inp[0]) ..."
7072
/>
7173
:::
7274

versioned_docs/version-0.6.0/writing-reactors/reaction-declarations.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ directory.
8888
## The Generated Header Files
8989
9090
The generated header files are necessary in order to separate your C code from your LF code because
91-
the describe the signatures of the reaction functions that you must implement.
91+
they describe the signatures of the reaction functions that you must implement.
9292
9393
In addition, they define structs that will be referenced by the reaction bodies. This includes the
9494
`self` struct of the reactor to which the header file corresponds, as well as structs for its ports,

versioned_docs/version-0.6.0/writing-reactors/time-and-timers.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515

1616
A key property of Lingua Franca is **logical time**. All events occur at an instant in logical time. By default, the runtime system does its best to align logical time with **physical time**, which is some measurement of time on the execution platform. The **lag** is defined to be physical time minus logical time, and the goal of the runtime system is maintain a small non-negative lag.
1717

18-
The **lag** is allowed to go negative only if the [`fast` target property](<../introduction.md#fast>) or the [`--fast`](<../introduction.md#command-line-arguments>) command-line argument is set to `true`. In that case, the program will execute as fast as possible with no regard to physical time.
18+
The **lag** is allowed to go negative only if the [`fast`](<../reference/target-declaration#fast>) target property or the [`--fast`](<../reference/target-declaration#command-line-arguments>) command-line argument is set to `true`. In that case, the program will execute as fast as possible with no regard to physical time.
1919

2020
<ShowOnly c cpp rs>
2121

@@ -93,8 +93,8 @@ import TS_Timer from '../assets/code/ts/src/Timer.lf';
9393
This specifies a timer named `t` that will first trigger at the start of execution and then repeatedly trigger at intervals of one second. Notice that the time units can be left off if the value is zero.
9494

9595
This target provides a built-in function for retrieving the logical time at which the reaction is invoked,
96-
<ShowOnly c inline>`get_logical_time()`</ShowOnly>
97-
<ShowOnly cpp inline>`FIXME`</ShowOnly>
96+
<ShowOnly c inline>`lf_time_logical()`</ShowOnly>
97+
<ShowOnly cpp inline>`get_logical_time()`</ShowOnly>
9898
<ShowOnly py inline>`lf.time.logical()`</ShowOnly>
9999
<ShowOnly ts inline>`util.getCurrentLogicalTime()`</ShowOnly>
100100
<ShowOnly rs inline>`get_logical_time()`</ShowOnly>

versioned_docs/version-0.7.0/assets/code/rs/src/SlowingClock.lf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ main reactor SlowingClock(start: time = 100 ms, incr: time = 100 ms) {
44
state start = start
55
state incr = incr
66
state interval: time = start
7-
state expected_time: time()
7+
state expected_time: time
88
logical action a
99

1010
reaction(startup) -> a {=

versioned_docs/version-0.7.0/reference/target-declaration.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ This parameter takes a non-negative integer and specifies the number of worker t
599599
</ShowIf>
600600
</ShowIfs>
601601

602-
# Command-Line Arguments
602+
## Command-Line Arguments
603603

604604
<ShowIfs>
605605
<ShowIf ts >

versioned_docs/version-0.7.0/reference/target-language-details.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ You can use a development version of the runtime library by setting the LFC opti
148148
<ShowIfs>
149149
<ShowIf c>
150150

151-
- The C target does make any distinction between `private` and `public` `preamble`.
151+
- The C target does not make any distinction between `private` and `public` `preamble`.
152152

153153
</ShowIf>
154154
<ShowIf cpp>

versioned_docs/version-0.7.0/writing-reactors/a-first-reactor.mdx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,14 @@ The general structure of a reactor definition is as follows:
9494
timer <name>([<offset>[, <period>]])
9595
logical action <name>[: <type>]
9696
physical action <name>[: <type>]
97+
[const] method <name>(parameters):<type> {= ... body ...=}
9798
reaction [<name>] (triggers) [<uses>] [-> <effects>] [{= ... body ...=}]
9899
<instance-name> = new <class-name>([<parameter-assignments>])
99100
<port-name> [, ...] -> <port-name> [, ...] [after <delay>]
100101
}
101102
```
102103
</ShowIf>
103-
<ShowIf cpp rs>
104+
<ShowIf cpp>
104105
```lf
105106
[main] reactor <class-name> [(parameters)] {
106107
input <name>: <type>
@@ -116,6 +117,21 @@ The general structure of a reactor definition is as follows:
116117
}
117118
```
118119
</ShowIf>
120+
<ShowIf rs>
121+
```lf
122+
[main] reactor <class-name> [(parameters)] {
123+
input <name>: <type>
124+
output <name>: <type>
125+
state <name>: <type> [= <value>]
126+
timer <name>([<offset>[, <period>]])
127+
logical action <name>[: <type>]
128+
physical action <name>[: <type>]
129+
reaction [<name>] (triggers) [<uses>] [-> <effects>] [{= ... body ...=}]
130+
<instance-name> = new <class-name>([<parameter-assignments>])
131+
<port-name> [, ...] -> <port-name> [, ...] [after <delay>]
132+
}
133+
```
134+
</ShowIf>
119135
<ShowIf py>
120136
```lf
121137
[main or federated] reactor <class-name> [(parameters)] {

versioned_docs/version-0.7.0/writing-reactors/multiports-and-banks.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ In `Destination`, the reaction is triggered by `in`, not by some individual chan
6565
c="if (in[i]->is_present) ..."
6666
cpp="if (in[i]->is_present()) ..."
6767
py="if port.is_present: ..."
68-
rs="if (val) ..."
69-
ts="if let Some(v) = ctx.get(&i) ..."
68+
ts="if (val) ..."
69+
rs="if let Some(v) = ctx.get(&i) ...
70+
// Or using is_present()
71+
if ctx.is_present(&inp[0]) ..."
7072
/>
7173
:::
7274

0 commit comments

Comments
 (0)