Skip to content

Commit d528bad

Browse files
authored
Merge pull request #236 from lf-lang/target-file-property
Update docs to match PR #2204 in lingua-franca
2 parents 8d704c3 + b95d5ff commit d528bad

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

docs/reference/target-declaration.mdx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -496,15 +496,11 @@ preamble {=
496496

497497
Your reactions can then invoke functions defined in that `.c` file.
498498

499-
Sometimes, you will need access to these files from target code in a reaction. For the C target (at least), the generated program will contain a line like this:
500-
501-
```c
502-
#define TARGET_FILES_DIRECTORY "path"
503-
```
504-
505-
where `path` is the full path to the directory containing these files. This can be used in reactions, for example, to read those files.
499+
Sometimes, you will need access to these files from target code in a reaction. For the C target (at least), the generated program can use a variable `LF_TARGET_FILES_DIRECTORY`, which evaluates to a string giving the full path of the directory containing the supporting files. For example, the `audio_loop_mac.c` file will be located in the directory given by the string `LF_TARGET_FILES_DIRECTORY`. This can be used in reactions, for example, to read those files.
506500
</ShowOnly>
507-
Moreover, the `files` target specification works in conjunction with the `import` statement. If a `.lf` file is imported and has designated supporting files using the `files` target parameter, those files will be resolved relative to that `.lf` file and copied to the directory that contains the generated sources. This is done to make code that imports other `.lf` files more modular. [Rhythm.lf](https://github.com/lf-lang/examples-lingua-franca/blob/main/C/src/Rhythm/Rhythm.lf) is an example that demonstrates most of these features.
501+
Moreover, the `files` target specification works in conjunction with the `import` statement. If a `.lf` file is imported and has designated supporting files using the `files` target parameter, those files will be resolved relative to that `.lf` file and copied to the directory that contains the generated sources. This is done to make code that imports other `.lf` files more modular.
502+
503+
[Rhythm.lf, which imports PlayWaveform.lf](https://github.com/lf-lang/playground-lingua-franca/tree/main/examples/C/src/rhythm) is an example that demonstrates most of these features.
508504
</ShowIf>
509505
</ShowIfs>
510506

0 commit comments

Comments
 (0)