lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.generator.c.CActionGenerator Class Reference

Generates code for actions (logical or physical) for the C and CCpp target. More...

Static Public Member Functions

static String generateAuxiliaryStruct (TypeParameterizedReactor tpr, Action action, Target target, CTypes types, CodeBuilder federatedExtension, boolean userFacing)
 Generate the struct type definitions for the action of the reactor.
static void generateDeclarations (TypeParameterizedReactor tpr, CodeBuilder body, CodeBuilder constructorCode)
 Generate the declarations of actions in the self struct.
static String generateInitializers (ReactorInstance instance)
 For each action of the specified reactor instance, generate initialization code for the offset and period fields.
static String generateTokenInitializer (String selfStruct, String actionName, String payloadSize)
 Create a template token initialized to the payload size.

Detailed Description

Generates code for actions (logical or physical) for the C and CCpp target.

Author
Edward A. Lee
Marten Lohstroh
Mehrdad Niknami
Christian Menard
Matt Weber
{Soroush Bateni
Alexander Schulz-Rosengarten
Hou Seng Wong

Member Function Documentation

◆ generateAuxiliaryStruct()

String org.lflang.generator.c.CActionGenerator.generateAuxiliaryStruct ( TypeParameterizedReactor tpr,
Action action,
Target target,
CTypes types,
CodeBuilder federatedExtension,
boolean userFacing )
static

Generate the struct type definitions for the action of the reactor.

Parameters
tprThe type-parameterized reactor.
actionThe action to generate the struct for
targetThe target of the code generation (C, CCpp or Python)
typesThe helper object for types related stuff
federatedExtensionThe code needed to support federated execution
userFacingWhether this is user-facing code.
Returns
The auxiliary struct for the port as a string

◆ generateDeclarations()

void org.lflang.generator.c.CActionGenerator.generateDeclarations ( TypeParameterizedReactor tpr,
CodeBuilder body,
CodeBuilder constructorCode )
static

Generate the declarations of actions in the self struct.

Parameters
tprThe type-parameterized reactor.
bodyThe content of the self struct
constructorCodeThe constructor code of the reactor

◆ generateInitializers()

String org.lflang.generator.c.CActionGenerator.generateInitializers ( ReactorInstance instance)
static

For each action of the specified reactor instance, generate initialization code for the offset and period fields.

Parameters
instanceThe reactor.

◆ generateTokenInitializer()

String org.lflang.generator.c.CActionGenerator.generateTokenInitializer ( String selfStruct,
String actionName,
String payloadSize )
static

Create a template token initialized to the payload size.

This token is marked to not be freed so that the trigger_t struct always has a template token. At the start of each time step, we need to initialize the is_present field of each action's trigger object to false and free a previously allocated token if appropriate. This code sets up the table that does that.

Parameters
selfStructThe variable name of the self struct
actionNameThe action name
payloadSizeThe code that returns the size of the action's payload in C.

The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/generator/c/CActionGenerator.java