Generate Python code for ports.
More...
|
| static void | generateActionVariableToSendToPythonReaction (List< String > pyObjects, Action action, ReactorDecl decl) |
| | Generate code to convert C actions to Python action capsules.
|
| static String | generateAliasTypeDef (TypeParameterizedReactor tpr, Port port, boolean isTokenType, String genericPortType) |
| static void | generateInputVariablesToSendToPythonReaction (List< String > pyObjects, Input input, ReactorDecl decl) |
| | Generate into the specified string builder the code to send local variables for input ports to a Python reaction function from the "self" struct.
|
| static void | generateOutputVariablesToSendToPythonReaction (List< String > pyObjects, Output output) |
| | Generate into the specified string builder the code to send local variables for output ports to a Python reaction function from the "self" struct.
|
| static String | generatePortVariablesToSendToPythonReaction (List< String > pyObjects, VarRef port, ReactorDecl decl) |
| | Generate code to convert C ports to Python ports capsules (.
|
| static String | generatePythonListForContainedBank (String reactorName, Port port, String widthSpec) |
| | Generate code that creates a Python list (i.e., []) for contained banks to be passed to Python reactions.
|
| static String | generatePythonPortVariableInReaction (VarRef port) |
| | Generate into the specified string builder (inits) the code to initialize local variable for port so that it can be used in the body of the Python reaction.
|
| static String | generateVariablesForSendingToContainedReactors (List< String > pyObjects, Instantiation definition, Port port) |
| | Generate into the specified string builder the code to pass local variables for sending data to an input of a contained reaction (e.g.
|
Generate Python code for ports.
◆ generateActionVariableToSendToPythonReaction()
| void org.lflang.generator.python.PythonPortGenerator.generateActionVariableToSendToPythonReaction |
( |
List< String > | pyObjects, |
|
|
Action | action, |
|
|
ReactorDecl | decl ) |
|
static |
Generate code to convert C actions to Python action capsules.
See pythontarget.h for details.
- Parameters
-
| pyObjects | A string containing a list of comma-separated expressions that will create the action capsules. |
| action | The action itself. |
| decl | The reactor decl that contains the action. |
◆ generateAliasTypeDef()
| String org.lflang.generator.python.PythonPortGenerator.generateAliasTypeDef |
( |
TypeParameterizedReactor | tpr, |
|
|
Port | port, |
|
|
boolean | isTokenType, |
|
|
String | genericPortType ) |
|
static |
◆ generateInputVariablesToSendToPythonReaction()
| void org.lflang.generator.python.PythonPortGenerator.generateInputVariablesToSendToPythonReaction |
( |
List< String > | pyObjects, |
|
|
Input | input, |
|
|
ReactorDecl | decl ) |
|
static |
Generate into the specified string builder the code to send local variables for input ports to a Python reaction function from the "self" struct.
- Parameters
-
| pyObjects | The list of Python object references. |
| input | The input port. |
| decl | The reactor declaration. |
◆ generateOutputVariablesToSendToPythonReaction()
| void org.lflang.generator.python.PythonPortGenerator.generateOutputVariablesToSendToPythonReaction |
( |
List< String > | pyObjects, |
|
|
Output | output ) |
|
static |
Generate into the specified string builder the code to send local variables for output ports to a Python reaction function from the "self" struct.
- Parameters
-
| pyObjects | The list of Python object references. |
| output | The output port. |
◆ generatePortVariablesToSendToPythonReaction()
| String org.lflang.generator.python.PythonPortGenerator.generatePortVariablesToSendToPythonReaction |
( |
List< String > | pyObjects, |
|
|
VarRef | port, |
|
|
ReactorDecl | decl ) |
|
static |
Generate code to convert C ports to Python ports capsules (.
- See also
- pythontarget.h).
The port may be an input of the reactor or an output of a contained reactor.
- Parameters
-
| pyObjects | A string containing a list of comma-separated expressions that will create the port capsules. |
| port | The port itself. |
| decl | The reactor decl that contains the port. |
◆ generatePythonListForContainedBank()
| String org.lflang.generator.python.PythonPortGenerator.generatePythonListForContainedBank |
( |
String | reactorName, |
|
|
Port | port, |
|
|
String | widthSpec ) |
|
static |
Generate code that creates a Python list (i.e., []) for contained banks to be passed to Python reactions.
The Python reaction will then subsequently be able to address each individual bank member of the contained bank using an index or an iterator. Each list member will contain the given port (which could be a multiport with a width determined by widthSpec).
This is to accommodate reactions like reaction() -> s.out where s is a bank. In this example, the generated Python function will have the signature reaction_function_0(self, s_out), where s_out is a list of out ports. This will later be turned into the proper s.out format using the Python code generated in generatePythonPortVariableInReaction.
- Parameters
-
| reactorName | The name of the bank of reactors (which is the name of the reactor class). |
| port | The port that should be put in the Python list. |
| widthSpec | A string that should be -2 for non-multiports and the width expression for multiports. |
◆ generatePythonPortVariableInReaction()
| String org.lflang.generator.python.PythonPortGenerator.generatePythonPortVariableInReaction |
( |
VarRef | port | ) |
|
|
static |
Generate into the specified string builder (inits) the code to initialize local variable for port so that it can be used in the body of the Python reaction.
- Parameters
-
| port | The port to generate code for. |
◆ generateVariablesForSendingToContainedReactors()
| String org.lflang.generator.python.PythonPortGenerator.generateVariablesForSendingToContainedReactors |
( |
List< String > | pyObjects, |
|
|
Instantiation | definition, |
|
|
Port | port ) |
|
static |
Generate into the specified string builder the code to pass local variables for sending data to an input of a contained reaction (e.g.
for a deadline violation).
- Parameters
-
| pyObjects | The list of Python object references. |
| definition | AST node defining the reactor within which this occurs |
| port | Input of the contained reactor. |
◆ NONMULTIPORT_WIDTHSPEC
| final String org.lflang.generator.python.PythonPortGenerator.NONMULTIPORT_WIDTHSPEC = "-2" |
|
static |
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/python/PythonPortGenerator.java