-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #274 from lf-lang/preamble
Fixed instructions for setting parameters from a table
- Loading branch information
Showing
5 changed files
with
18 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
target C; | ||
preamble {= | ||
int table[] = {4, 3, 2, 1}; | ||
=} | ||
reactor A(bank_index:int = 0, value:int = 0) { | ||
reaction (startup) {= | ||
printf("bank_index: %d, value: %d\n", self->bank_index, self->value); | ||
=} | ||
} | ||
main reactor { | ||
a = new[4] A(value = {= table[bank_index] =}); | ||
main reactor( | ||
table: int[] = {4, 3, 2, 1} | ||
) { | ||
a = new[4] A(value = {= self->table[bank_index] =}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
target Python; | ||
preamble {= | ||
table = [4, 3, 2, 1] | ||
=} | ||
reactor A(bank_index = 0, value = 0) { | ||
reaction (startup) {= | ||
print("bank_index: {:d}, value: {:d}".format(self.bank_index, self.value)) | ||
=} | ||
} | ||
main reactor { | ||
a = new[4] A(value = {= table[bank_index] =}) | ||
main reactor( | ||
table = [4, 3, 2, 1] | ||
) { | ||
a = new[4] A(value = {= self.table[bank_index] =}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
target C; | ||
preamble {= | ||
int table[] = {4, 3, 2, 1}; | ||
=} | ||
reactor A(bank_index:int = 0, value:int = 0) { | ||
reaction (startup) {= | ||
printf("bank_index: %d, value: %d\n", self->bank_index, self->value); | ||
=} | ||
} | ||
main reactor { | ||
a = new[4] A(value = {= table[bank_index] =}); | ||
main reactor( | ||
table: int[] = {4, 3, 2, 1} | ||
) { | ||
a = new[4] A(value = {= self->table[bank_index] =}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters