|
| static void | generateBuiltinTriggeredReactionsArray (Set< Integer > reactions, String name, CodeBuilder body, CodeBuilder constructorCode) |
| static String | generateDeadlineFunctionHeader (TypeParameterizedReactor tpr, int reactionIndex) |
| | Return the top level C function header for the deadline function numbered "reactionIndex" in "r".
|
| static String | generateDeadlineFunctionName (TypeParameterizedReactor tpr, int reactionIndex) |
| | Returns the name of the deadline function for reaction.
|
| static String | generateDelayBody (String ref, String actionName, InferredType type) |
| | Generate code for the body of a reaction that takes an input and schedules an action with the value of that input.
|
| static String | generateForwardBody (String outputName, String targetType, String actionName, InferredType type) |
| static String | generateFunction (String header, String init, Code code, boolean suppressLineDirectives) |
| static String | generateFunctionHeader (String functionName) |
| | Return the start of a function declaration for a function that takes a void* argument and returns void.
|
| static String | generateInitializationForReaction (String body, Reaction reaction, TypeParameterizedReactor tpr, int reactionIndex, CTypes types, MessageReporter messageReporter, Instantiation mainDef, boolean requiresTypes) |
| | Generate necessary initialization code inside the body of the reaction that belongs to reactor decl.
|
| static String | generateOutputVariablesInReaction (VarRef effect, TypeParameterizedReactor tpr, MessageReporter messageReporter, boolean requiresTypes) |
| | Generate into the specified string builder the code to initialize local variables for outputs in a reaction function from the "self" struct.
|
| static String | generateReaction (Reaction reaction, TypeParameterizedReactor tpr, int reactionIndex, Instantiation mainDef, MessageReporter messageReporter, CTypes types, TargetConfig targetConfig, boolean requiresType) |
| | Generate a reaction function definition for a reactor.
|
| static void | generateReactionAndTriggerStructs (CodeBuilder body, TypeParameterizedReactor tpr, CodeBuilder constructorCode, CTypes types) |
| | Generate the fields of the self struct and statements for the constructor to create and initialize a reaction_t struct for each reaction in the specified reactor and a trigger_t struct for each trigger (input, action, timer, or output of a contained reactor).
|
| static String | generateReactionFunctionHeader (TypeParameterizedReactor tpr, int reactionIndex) |
| | Return the top level C function header for the reaction numbered "reactionIndex" in "r".
|
| static String | generateReactionFunctionName (TypeParameterizedReactor tpr, int reactionIndex) |
| | Return the function name for specified reaction of the specified reactor.
|
| static String | generateStpFunctionHeader (TypeParameterizedReactor tpr, int reactionIndex) |
| static String | generateStpFunctionName (TypeParameterizedReactor tpr, int reactionIndex) |
| | Returns the name of the stp function for reaction.
|
| static String | generateWatchdogVariablesInReaction (VarRef effect) |
| | Generate into the specified string builder the code to initialize local variables for watchdogs in a reaction function from the "self" struct.
|
| static int | maxContainedReactorBankWidth (Instantiation containedReactor, LinkedList< Instantiation > breadcrumbs, int max, Instantiation mainDef) |
| | Return the maximum bank width for the given instantiation within all instantiations of its parent reactor.
|
Generate code for reactions.
| int org.lflang.generator.c.CReactionGenerator.maxContainedReactorBankWidth |
( |
Instantiation | containedReactor, |
|
|
LinkedList< Instantiation > | breadcrumbs, |
|
|
int | max, |
|
|
Instantiation | mainDef ) |
|
static |
Return the maximum bank width for the given instantiation within all instantiations of its parent reactor.
On the first call to this method, the breadcrumbs should be null and the max argument should be zero. On recursive calls, breadcrumbs is a list of nested instantiations, the max is the maximum width found so far. The search for instances of the parent reactor will begin with the last instantiation in the specified list.
This rather complicated method is used when a reaction sends or receives data to or from a bank of contained reactors. There will be an array of structs on the self struct of the parent, and the size of the array is conservatively set to the maximum of all the identified bank widths. This is a bit wasteful of memory, but it avoids having to malloc the array for each instance, and in typical usage, there will be few instances or instances that are all the same width.
- Parameters
-
| containedReactor | The contained reactor instantiation. |
| breadcrumbs | null on first call (non-recursive). |
| max | 0 on first call. |
| mainDef | The main reactor instantiation. |