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

A collection of utilities for C code generation. More...

Inherited by org.lflang.generator.python.PyUtil.

Classes

interface  ReportCommandErrors
 A ReportCommandErrors is a way to analyze command output and report any errors that it describes. More...

Static Public Member Functions

static String actionRef (ActionInstance instance, String runtimeIndex)
 Return a reference to the action struct of the specified action instance.
static HashSet< String > allIncludes (TypeParameterizedReactor tpr)
 Given a reactor Class, return a set of include names for interacting reactors which includes all instantiations of base class that it extends.
static String bankIndex (ReactorInstance instance)
 Return a default name of a variable to refer to the bank index of a reactor in a bank.
static String bankIndexName (ReactorInstance instance)
 Return a default name of a variable to refer to the bank index of a reactor in a bank.
static String channelIndex (PortInstance port)
 Return a default name of a variable to refer to the channel index of a port in a bank.
static String channelIndexName (PortInstance port)
 Return a default name of a variable to refer to the channel index of a port in a bank.
static void deleteBinFiles (FileConfig fileConfig)
 Remove files in the bin directory that may have been created.
static int fixedSizeArrayTypeLength (InferredType type)
 Given a type for an input or output, if it is a fixed-size array (declared with type[int]), then return the int and otherwise return 1, which is the default length for non-arrays and variable-size arrays.
static String generateWidthVariable (String var)
static String getEnvironmentStruct (CEnclaveInstance inst)
 Return a string representing a global C variable that is the struct of the environment of the specified enclave.
static String getEnvironmentStructPtr (ReactorInstance inst)
 Return a string representing a pointer to the C variable that is the struct of the environment of the specified enclave.
static String getName (TypeParameterizedReactor reactor)
 Return the name of the reactor.
static String getShortenedName (ReactorInstance instance)
 Return the full name of the specified instance without the leading name of the top-level reactor, unless this is the top-level reactor, in which case return its name.
static String internalIncludeGuard (TypeParameterizedReactor tpr)
 Return the name used in the internal (non-user-facing) include guard for the given reactor.
static boolean isFixedSizeArrayType (InferredType type)
 Given a type for an input or output, return true if it is a fixed-size array (declared with type[int]).
static boolean isTokenType (InferredType type)
 Given a type for an input or output, return true if it should be carried by a lf_token_t struct rather than the type itself.
static String multiportWidthExpression (Variable variable)
 If the argument is a multiport, then return a string that gives the width as an expression, and otherwise, return null.
static String portRef (PortInstance port)
 Return a reference to the port on the self struct of the port's parent.
static String portRef (PortInstance port, boolean isNested, boolean includeChannelIndex, String runtimeIndex, String bankIndex, String channelIndex)
 Return a reference to the specified port.
static String portRef (PortInstance port, String runtimeIndex, String bankIndex, String channelIndex)
 Return a reference to the port on the self struct of the port's parent using the specified index variables.
static String portRefInReaction (VarRef reference, Integer bankIndex, Integer multiportIndex)
 Return code for referencing a port within a reaction body possibly indexed by a bank index and/or a multiport index.
static String portRefName (PortInstance port)
 Return a reference to a port without any channel indexing.
static String portRefName (PortInstance port, String runtimeIndex, String bankIndex, String channelIndex)
 Return the portRef without the channel indexing.
static String portRefNested (PortInstance port)
 Return a port reference to a port on the self struct of the parent of the port's parent.
static String portRefNested (PortInstance port, String runtimeIndex, String bankIndex, String channelIndex)
 Return a reference to the port on the self struct of the parent of the port's parent.
static String portRefNestedName (PortInstance port)
 Return a reference to the port on the self struct of the parent of the port's parent, but without the channel indexing, even if it is a multiport.
static String portRefNestedName (PortInstance port, String runtimeIndex, String bankIndex, String channelIndex)
 Return a reference to the port on the self struct of the parent of the port's parent, but without the channel indexing, even if it is a multiport.
static String reactionRef (ReactionInstance reaction)
 Return a reference to the reaction entry on the self struct of the parent of the specified reaction.
static String reactionRef (ReactionInstance reaction, String runtimeIndex)
 Return a reference to the reaction entry on the self struct of the parent of the specified reaction.
static String reactorRef (ReactorInstance instance)
 Return a reference to the "self" struct of the specified reactor instance.
static String reactorRef (ReactorInstance instance, String runtimeIndex)
 Return a reference to the "self" struct of the specified reactor instance.
static String reactorRefName (ReactorInstance instance)
 Return the name of the array of "self" structs of the specified reactor instance.
static String reactorRefNested (ReactorInstance reactor)
 For situations where a reaction reacts to or reads from an output of a contained reactor or sends to an input of a contained reactor, then the container's self struct will have a field (or an array of fields if the contained reactor is a bank) that is a struct with fields corresponding to those inputs and outputs.
static String reactorRefNested (ReactorInstance reactor, String runtimeIndex, String bankIndex)
 For situations where a reaction reacts to or reads from an output of a contained reactor or sends to an input of a contained reactor, then the container's self struct will have a field (or an array of fields if the contained reactor is a bank) that is a struct with fields corresponding to those inputs and outputs.
static String rootType (String type)
 If the type specification of the form type[], type*, or type, return the type.
static void runBuildCommand (FileConfig fileConfig, TargetConfig targetConfig, GeneratorCommandFactory commandFactory, MessageReporter messageReporter, ReportCommandErrors reportCommandErrors, LFGeneratorContext.Mode mode)
 Run the custom build command specified with the "build" parameter.
static String runtimeIndex (ReactorInstance reactor)
 Return an expression that, when evaluated, gives the index of a runtime instance of the specified ReactorInstance.
static String selfType (ReactorInstance instance)
 Construct a unique type for the "self" struct of the class of the given reactor.
static String selfType (TypeParameterizedReactor reactor)
 Return a unique type for the "self" struct of the specified reactor class from the reactor class.
static String triggerRef (TriggerInstance<? extends Variable > instance)
 Return a reference to the trigger_t struct of the specified trigger instance (input port or action).
static String triggerRef (TriggerInstance<? extends Variable > instance, String runtimeIndex)
 Return a reference to the trigger_t struct of the specified trigger instance (input port or action).
static String triggerRefNested (PortInstance port)
 Return a reference to the trigger_t struct for the specified port of a contained reactor.
static String triggerRefNested (PortInstance port, String runtimeIndex, String bankIndex)
 Return a reference to the trigger_t struct for the specified port of a contained reactor.

Static Public Attributes

static final String ENVIRONMENT_VARIABLE_NAME = "environments"
static final String NUM_ENVIRONMENT_VARIABLE_NAME = "num_environments"
static final String RTI_BIN_SUFFIX = "_RTI"
 Suffix that when appended to the name of a federated reactor yields the name of its corresponding RTI executable.
static final String RTI_DISTRIBUTION_SCRIPT_SUFFIX = "_distribute.sh"
 Suffix that when appended to the name of a federated reactor yields the name of its corresponding distribution script.

Detailed Description

A collection of utilities for C code generation.

This class codifies the coding conventions for the C target code generator. I.e., it defines how variables are named and referenced.

Author
Edward A. Lee

Member Function Documentation

◆ actionRef()

String org.lflang.generator.c.CUtil.actionRef ( ActionInstance instance,
String runtimeIndex )
static

Return a reference to the action struct of the specified action instance.

This action_base_t struct is on the self struct.

Parameters
instanceThe action instance.
runtimeIndexAn optional index variable name to use to address runtime instances.

◆ allIncludes()

HashSet< String > org.lflang.generator.c.CUtil.allIncludes ( TypeParameterizedReactor tpr)
static

Given a reactor Class, return a set of include names for interacting reactors which includes all instantiations of base class that it extends.

◆ bankIndex()

String org.lflang.generator.c.CUtil.bankIndex ( ReactorInstance instance)
static

Return a default name of a variable to refer to the bank index of a reactor in a bank.

This has the form uniqueID_i, where uniqueID is an identifier for the instance that is guaranteed to be different from the ID of any other instance in the program. If the instance is not a bank, return "0".

Parameters
instanceA reactor instance.

◆ bankIndexName()

String org.lflang.generator.c.CUtil.bankIndexName ( ReactorInstance instance)
static

Return a default name of a variable to refer to the bank index of a reactor in a bank.

This has the form uniqueID_i, where uniqueID is an identifier for the instance that is guaranteed to be different from the ID of any other instance in the program.

Parameters
instanceA reactor instance.

◆ channelIndex()

String org.lflang.generator.c.CUtil.channelIndex ( PortInstance port)
static

Return a default name of a variable to refer to the channel index of a port in a bank.

This has the form uniqueID_c where uniqueID is an identifier for the instance that is guaranteed to be different from the ID of any other instance in the program. If the port is not a multiport, then return the string "0".

◆ channelIndexName()

String org.lflang.generator.c.CUtil.channelIndexName ( PortInstance port)
static

Return a default name of a variable to refer to the channel index of a port in a bank.

This is has the form uniqueID_c where uniqueID is an identifier for the instance that is guaranteed to be different from the ID of any other instance in the program.

◆ deleteBinFiles()

void org.lflang.generator.c.CUtil.deleteBinFiles ( FileConfig fileConfig)
static

Remove files in the bin directory that may have been created.

Call this if a compilation occurs so that files from a previous version do not accidentally get executed.

Parameters
fileConfig

◆ fixedSizeArrayTypeLength()

int org.lflang.generator.c.CUtil.fixedSizeArrayTypeLength ( InferredType type)
static

Given a type for an input or output, if it is a fixed-size array (declared with type[int]), then return the int and otherwise return 1, which is the default length for non-arrays and variable-size arrays.

Parameters
typeThe type specification

◆ generateWidthVariable()

String org.lflang.generator.c.CUtil.generateWidthVariable ( String var)
static

◆ getEnvironmentStruct()

String org.lflang.generator.c.CUtil.getEnvironmentStruct ( CEnclaveInstance inst)
static

Return a string representing a global C variable that is the struct of the environment of the specified enclave.

Parameters
instThe enclave instance.

◆ getEnvironmentStructPtr()

String org.lflang.generator.c.CUtil.getEnvironmentStructPtr ( ReactorInstance inst)
static

Return a string representing a pointer to the C variable that is the struct of the environment of the specified enclave.

Parameters
instThe enclave instance.

◆ getName()

String org.lflang.generator.c.CUtil.getName ( TypeParameterizedReactor reactor)
static

Return the name of the reactor.

A _main is appended to the name if the reactor is main (to allow for instantiations that have the same name as the main reactor or the .lf file).

◆ getShortenedName()

String org.lflang.generator.c.CUtil.getShortenedName ( ReactorInstance instance)
static

Return the full name of the specified instance without the leading name of the top-level reactor, unless this is the top-level reactor, in which case return its name.

Parameters
instanceThe instance.
Returns
A shortened instance name.

◆ internalIncludeGuard()

String org.lflang.generator.c.CUtil.internalIncludeGuard ( TypeParameterizedReactor tpr)
static

Return the name used in the internal (non-user-facing) include guard for the given reactor.

◆ isFixedSizeArrayType()

boolean org.lflang.generator.c.CUtil.isFixedSizeArrayType ( InferredType type)
static

Given a type for an input or output, return true if it is a fixed-size array (declared with type[int]).

For such types, the memory is allocated in the output struct.

Parameters
typeThe type specification.

◆ isTokenType()

boolean org.lflang.generator.c.CUtil.isTokenType ( InferredType type)
static

Given a type for an input or output, return true if it should be carried by a lf_token_t struct rather than the type itself.

It should be carried by such a struct if the type ends with * (it is a pointer) or [] (it is a array with unspecified length).

Parameters
typeThe type specification.

◆ multiportWidthExpression()

String org.lflang.generator.c.CUtil.multiportWidthExpression ( Variable variable)
static

If the argument is a multiport, then return a string that gives the width as an expression, and otherwise, return null.

The string will be empty if the width is variable (specified as '[]'). Otherwise, if is a single term or a sum of terms (separated by '+'), where each term is either an integer or a parameter reference in the target language.

◆ portRef() [1/3]

String org.lflang.generator.c.CUtil.portRef ( PortInstance port)
static

Return a reference to the port on the self struct of the port's parent.

This is used when an input port triggers a reaction in the port's parent or when an output port is written to by a reaction in the port's parent. This is equivalent to calling portRef(port, false, true, null, null).

Parameters
portAn instance of the port to be referenced.

◆ portRef() [2/3]

String org.lflang.generator.c.CUtil.portRef ( PortInstance port,
boolean isNested,
boolean includeChannelIndex,
String runtimeIndex,
String bankIndex,
String channelIndex )
static

Return a reference to the specified port.

The returned string will have one of the following forms:

  • selfStructs[k]->_lf_portName
  • selfStructs[k]->_lf_portName
  • selfStructs[k]->_lf_portName[i]
  • selfStructs[k]->_lf_parent.portName
  • selfStructs[k]->_lf_parent.portName[i]
  • selfStructs[k]->_lf_parent[j].portName
  • selfStructs[k]->_lf_parent[j].portName[i]

where k is the runtime index of either the port's parent or the port's parent's parent, the latter when isNested is true. The index j is present if the parent is a bank, and the index i is present if the port is a multiport.

The first two forms are used if isNested is false, and the remaining four are used if isNested is true. Set isNested to true when referencing a port belonging to a contained reactor.

Parameters
portThe port.
isNestedTrue to return a reference relative to the parent's parent.
includeChannelIndexTrue to include the channel index at the end.
runtimeIndexA variable name to use to index the runtime instance or null to use the default, the string returned by CUtil#runtimeIndex(ReactorInstance).
bankIndexA variable name to use to index the bank or null to use the default, the string returned by CUtil#bankIndex(ReactorInstance).
channelIndexA variable name to use to index the channel or null to use the default, the string returned by CUtil#channelIndex(PortInstance).

◆ portRef() [3/3]

String org.lflang.generator.c.CUtil.portRef ( PortInstance port,
String runtimeIndex,
String bankIndex,
String channelIndex )
static

Return a reference to the port on the self struct of the port's parent using the specified index variables.

This is used when an input port triggers a reaction in the port's parent or when an output port is written to by a reaction in the port's parent. This is equivalent to calling portRef(port, false, true, bankIndex, channelIndex).

Parameters
portAn instance of the port to be referenced.
runtimeIndexA variable name to use to index the runtime instance or null to use the default, the string returned by CUtil#runtimeIndex(ReactorInstance).
bankIndexA variable name to use to index the bank or null to use the default, the string returned by CUtil#bankIndex(ReactorInstance).
channelIndexA variable name to use to index the channel or null to use the default, the string returned by CUtil#channelIndex(PortInstance).

◆ portRefInReaction()

String org.lflang.generator.c.CUtil.portRefInReaction ( VarRef reference,
Integer bankIndex,
Integer multiportIndex )
static

Return code for referencing a port within a reaction body possibly indexed by a bank index and/or a multiport index.

If the provided reference is not a port, then this returns the string "ERROR: not a port."

Parameters
referenceThe reference to the port.
bankIndexA bank index or null or negative if not in a bank.
multiportIndexA multiport index or null or negative if not in a multiport.

◆ portRefName() [1/2]

String org.lflang.generator.c.CUtil.portRefName ( PortInstance port)
static

Return a reference to a port without any channel indexing.

This is useful for deriving a reference to the _width variable.

Parameters
portAn instance of the port to be referenced.

◆ portRefName() [2/2]

String org.lflang.generator.c.CUtil.portRefName ( PortInstance port,
String runtimeIndex,
String bankIndex,
String channelIndex )
static

Return the portRef without the channel indexing.

This is useful for deriving a reference to the _width variable.

Parameters
portAn instance of the port to be referenced.
runtimeIndexA variable name to use to index the runtime instance or null to use the default, the string returned by CUtil#runtimeIndex(ReactorInstance).
bankIndexA variable name to use to index the bank or null to use the default, the string returned by CUtil#bankIndex(ReactorInstance).
channelIndexA variable name to use to index the channel or null to use the default, the string returned by CUtil#channelIndex(PortInstance).

◆ portRefNested() [1/2]

String org.lflang.generator.c.CUtil.portRefNested ( PortInstance port)
static

Return a port reference to a port on the self struct of the parent of the port's parent.

This is used when an input port is written to by a reaction in the parent of the port's parent, or when an output port triggers a reaction in the parent of the port's parent. This is equivalent to calling portRef(port, true, true, null, null, null).

Parameters
portThe port.

◆ portRefNested() [2/2]

String org.lflang.generator.c.CUtil.portRefNested ( PortInstance port,
String runtimeIndex,
String bankIndex,
String channelIndex )
static

Return a reference to the port on the self struct of the parent of the port's parent.

This is used when an input port is written to by a reaction in the parent of the port's parent, or when an output port triggers a reaction in the parent of the port's parent. This is equivalent to calling portRef(port, true, true, runtimeIndex, bankIndex, channelIndex).

Parameters
portThe port.
runtimeIndexA variable name to use to index the runtime instance or null to use the default, the string returned by CUtil#runtimeIndex(ReactorInstance).
bankIndexA variable name to use to index the bank or null to use the default, the string returned by CUtil#bankIndex(ReactorInstance).
channelIndexA variable name to use to index the channel or null to use the default, the string returned by CUtil#channelIndex(PortInstance).

◆ portRefNestedName() [1/2]

String org.lflang.generator.c.CUtil.portRefNestedName ( PortInstance port)
static

Return a reference to the port on the self struct of the parent of the port's parent, but without the channel indexing, even if it is a multiport.

This is used when an input port is written to by a reaction in the parent of the port's parent, or when an output port triggers a reaction in the parent of the port's parent. This is equivalent to calling portRef(port, true, false, null, null, null).

Parameters
portThe port.

◆ portRefNestedName() [2/2]

String org.lflang.generator.c.CUtil.portRefNestedName ( PortInstance port,
String runtimeIndex,
String bankIndex,
String channelIndex )
static

Return a reference to the port on the self struct of the parent of the port's parent, but without the channel indexing, even if it is a multiport.

This is used when an input port is written to by a reaction in the parent of the port's parent, or when an output port triggers a reaction in the parent of the port's parent. This is equivalent to calling portRefNested(port, true, false, runtimeIndex, bankIndex, channelIndex).

Parameters
portThe port.
runtimeIndexA variable name to use to index the runtime instance or null to use the default, the string returned by CUtil#runtimeIndex(ReactorInstance).
bankIndexA variable name to use to index the bank or null to use the default, the string returned by CUtil#bankIndex(ReactorInstance).
channelIndexA variable name to use to index the channel or null to use the default, the string returned by CUtil#channelIndex(PortInstance).

◆ reactionRef() [1/2]

String org.lflang.generator.c.CUtil.reactionRef ( ReactionInstance reaction)
static

Return a reference to the reaction entry on the self struct of the parent of the specified reaction.

Parameters
reactionThe reaction.

◆ reactionRef() [2/2]

String org.lflang.generator.c.CUtil.reactionRef ( ReactionInstance reaction,
String runtimeIndex )
static

Return a reference to the reaction entry on the self struct of the parent of the specified reaction.

Parameters
reactionThe reaction.
runtimeIndexAn index into the array of self structs for the parent.

◆ reactorRef() [1/2]

String org.lflang.generator.c.CUtil.reactorRef ( ReactorInstance instance)
static

Return a reference to the "self" struct of the specified reactor instance.

The returned string has the form self[j], where self is the name of the array of self structs for this reactor instance and j is the expression returned by runtimeIndex(ReactorInstance) or 0 if there are no banks.

Parameters
instanceThe reactor instance.

Reimplemented in org.lflang.generator.python.PyUtil.

◆ reactorRef() [2/2]

String org.lflang.generator.c.CUtil.reactorRef ( ReactorInstance instance,
String runtimeIndex )
static

Return a reference to the "self" struct of the specified reactor instance.

The returned string has the form self[runtimeIndex], where self is the name of the array of self structs for this reactor instance. If runtimeIndex is null, then it is replaced by the expression returned by runtimeIndex(ReactorInstance) or 0 if there are no banks.

Parameters
instanceThe reactor instance.
runtimeIndexAn optional expression to use to address bank members. If this is null, the expression used will be that returned by runtimeIndex(ReactorInstance).

Reimplemented in org.lflang.generator.python.PyUtil.

◆ reactorRefName()

String org.lflang.generator.c.CUtil.reactorRefName ( ReactorInstance instance)
static

Return the name of the array of "self" structs of the specified reactor instance.

This is similar to reactorRef(ReactorInstance) except that it does not index into the array.

Parameters
instanceThe reactor instance.

Reimplemented in org.lflang.generator.python.PyUtil.

◆ reactorRefNested() [1/2]

String org.lflang.generator.c.CUtil.reactorRefNested ( ReactorInstance reactor)
static

For situations where a reaction reacts to or reads from an output of a contained reactor or sends to an input of a contained reactor, then the container's self struct will have a field (or an array of fields if the contained reactor is a bank) that is a struct with fields corresponding to those inputs and outputs.

This method returns a reference to that struct or array of structs. Note that the returned reference is not to the self struct of the contained reactor. Use reactorRef(ReactorInstance) for that.

Parameters
reactorThe contained reactor.

◆ reactorRefNested() [2/2]

String org.lflang.generator.c.CUtil.reactorRefNested ( ReactorInstance reactor,
String runtimeIndex,
String bankIndex )
static

For situations where a reaction reacts to or reads from an output of a contained reactor or sends to an input of a contained reactor, then the container's self struct will have a field (or an array of fields if the contained reactor is a bank) that is a struct with fields corresponding to those inputs and outputs.

This method returns a reference to that struct or array of structs. Note that the returned reference is not to the self struct of the contained reactor. Use CUtil#reactorRef(ReactorInstance) for that.

Parameters
reactorThe contained reactor.
runtimeIndexA variable name to use to index the runtime instance or null to use the default, the string returned by CUtil#runtimeIndex(ReactorInstance).
bankIndexA variable name to use to index the bank or null to use the default, the string returned by CUtil#bankIndex(ReactorInstance).

◆ rootType()

String org.lflang.generator.c.CUtil.rootType ( String type)
static

If the type specification of the form type[], type*, or type, return the type.

Parameters
typeA string describing the type.

◆ runBuildCommand()

void org.lflang.generator.c.CUtil.runBuildCommand ( FileConfig fileConfig,
TargetConfig targetConfig,
GeneratorCommandFactory commandFactory,
MessageReporter messageReporter,
ReportCommandErrors reportCommandErrors,
LFGeneratorContext.Mode mode )
static

Run the custom build command specified with the "build" parameter.

This command is executed in the same directory as the source file.

The following environment variables will be available to the command:

  • LF_CURRENT_WORKING_DIRECTORY: The directory in which the command is invoked.
  • LF_SOURCE_DIRECTORY: The directory containing the .lf file being compiled.
  • LF_PACKAGE_DIRECTORY: The directory that is the root of the package.
  • LF_SOURCE_GEN_DIRECTORY: The directory in which generated files are placed.
  • LF_BIN_DIRECTORY: The directory into which to put binaries.

◆ runtimeIndex()

String org.lflang.generator.c.CUtil.runtimeIndex ( ReactorInstance reactor)
static

Return an expression that, when evaluated, gives the index of a runtime instance of the specified ReactorInstance.

If the reactor is not within any banks, then this will return "0". Otherwise, it will return an expression that evaluates a mixed-radix number d0w0, d1w1, ... , dnwn, where n is the depth minus one of the reactor. The radixes, w0 to wn, are the widths of this reactor, its parent reactor, on up to the top-level reactor. Since the top-level reactor is never a bank, dn = 0 and wn = 1. The digits, di, are either 0 (of the parent is not a bank) or the variable name returned by bankIndexName(ReactorInstance) if the parent is a bank. The returned expression, when evaluated, will yield the following value:

    d0 + w0 * (d1 + w1 * ( ... (dn-1 + wn-1 * dn) ... )
Parameters
reactorThe reactor.

◆ selfType() [1/2]

String org.lflang.generator.c.CUtil.selfType ( ReactorInstance instance)
static

Construct a unique type for the "self" struct of the class of the given reactor.

◆ selfType() [2/2]

String org.lflang.generator.c.CUtil.selfType ( TypeParameterizedReactor reactor)
static

Return a unique type for the "self" struct of the specified reactor class from the reactor class.

Parameters
reactorThe reactor class.
Returns
The type of a self struct for the specified reactor class.

◆ triggerRef() [1/2]

String org.lflang.generator.c.CUtil.triggerRef ( TriggerInstance<? extends Variable > instance)
static

Return a reference to the trigger_t struct of the specified trigger instance (input port or action).

This trigger_t struct is on the self struct.

Parameters
instanceThe port or action instance.

◆ triggerRef() [2/2]

String org.lflang.generator.c.CUtil.triggerRef ( TriggerInstance<? extends Variable > instance,
String runtimeIndex )
static

Return a reference to the trigger_t struct of the specified trigger instance (input port or action).

This trigger_t struct is on the self struct.

Parameters
instanceThe port or action instance.
runtimeIndexAn optional index variable name to use to address runtime instances.

◆ triggerRefNested() [1/2]

String org.lflang.generator.c.CUtil.triggerRefNested ( PortInstance port)
static

Return a reference to the trigger_t struct for the specified port of a contained reactor.

Parameters
portThe output port of a contained reactor.

◆ triggerRefNested() [2/2]

String org.lflang.generator.c.CUtil.triggerRefNested ( PortInstance port,
String runtimeIndex,
String bankIndex )
static

Return a reference to the trigger_t struct for the specified port of a contained reactor.

Parameters
portThe output port of a contained reactor.
runtimeIndexAn optional index variable name to use to index the runtime instance of the port's parent's parent, or null to get the default returned by CUtil#runtimeIndex(ReactorInstance).
bankIndexAn optional index variable name to use to index the the bank of the port's parent, or null to get the default returned by CUtil#bankIndex(ReactorInstance).

Member Data Documentation

◆ ENVIRONMENT_VARIABLE_NAME

final String org.lflang.generator.c.CUtil.ENVIRONMENT_VARIABLE_NAME = "environments"
static

◆ NUM_ENVIRONMENT_VARIABLE_NAME

final String org.lflang.generator.c.CUtil.NUM_ENVIRONMENT_VARIABLE_NAME = "num_environments"
static

◆ RTI_BIN_SUFFIX

final String org.lflang.generator.c.CUtil.RTI_BIN_SUFFIX = "_RTI"
static

Suffix that when appended to the name of a federated reactor yields the name of its corresponding RTI executable.

◆ RTI_DISTRIBUTION_SCRIPT_SUFFIX

final String org.lflang.generator.c.CUtil.RTI_DISTRIBUTION_SCRIPT_SUFFIX = "_distribute.sh"
static

Suffix that when appended to the name of a federated reactor yields the name of its corresponding distribution script.


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/CUtil.java