Skip to content

Commit 8cc64e2

Browse files
committed
Documented --tmux, top-level param overrides, and initializing params from files
1 parent ce2ce25 commit 8cc64e2

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

docs/reference/target-declaration.mdx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,22 @@ The generated C program understands the following command-line arguments, each o
799799
- `-o, --timeout <duration> <units>`: Stop execution when logical time has advanced by the specified _duration_. The units can be any of nsec, usec, msec, sec, minute, hour, day, week, or the plurals of those.
800800
- `-w, --workers <n>`: Executed using \<n\> worker threads if possible. This option is ignored in the single-threaded version. That is, it is ignored if a `threading` option was given in the target properties with value `false`.
801801
- `-i, --id <n>`: The ID of the federation that this reactor will join.
802+
- `-x, --tmux`: Run the program in a tmux session, which splits the terminal into multiple panes, one for each federate and one for the RTI.
803+
- `-h, --help`: Print a description of the command-line arguments.
802804

803-
Any other command-line arguments result in printing the above information.
805+
In addition, if the main or federated reactor declares parameters with the primitive types `int`, `time`, `float`, `double`, `bool`, or `string`, these parameters can be overridden when invoking the binary.
806+
Each LF parameter named `param` corresponds to a CLI parameter named `--param`.
807+
For example, for a main reactor declared as follows:
808+
809+
```lf-c
810+
target C;
811+
main reactor Hello(param: int = 42) {
812+
reaction(startup) {=
813+
printf("Hello World %d\n", self->param);
814+
=}
815+
}
816+
```
817+
Running `bin/Hello --param 43` will result in "Hello World 43" being printed.
804818
</ShowIf>
805819
<ShowIf cpp>
806820
The generated C++ program understands the following command-line arguments, each of which has a short form (one character) and a long form:

docs/reference/target-language-details.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2960,6 +2960,7 @@ The threading functions are only available for platforms that support multithrea
29602960
A few utility libraries are provided, but require considerably more setup.
29612961
These also help to illustrate how to incorporate your own libraries.
29622962

2963+
- Functions for initializing parameters and state variables from files: [initialize__from__file.h](https://www.lf-lang.org/reactor-c/initialize__from__file_8h.html)
29632964
- Audio functions (for Linux and Mac only): [audio_loop.h](https://www.lf-lang.org/reactor-c/audio__loop_8h.html)
29642965
- Audio file reader: [wave_file_reader.h](https://www.lf-lang.org/reactor-c/wave__file__reader_8h.html)
29652966
- A double-ended queue: [deque.h](https://www.lf-lang.org/reactor-c/deque_8h.html)

0 commit comments

Comments
 (0)