Search in sources :

Example 86 with ExpressionStruct

use of org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct in project titan.EclipsePlug-ins by eclipse.

the class Call_Statement method generateCode.

@Override
public /**
 * {@inheritDoc}
 */
void generateCode(final JavaGenData aData, final StringBuilder source) {
    ExpressionStruct expression = new ExpressionStruct();
    portReference.generateCode(aData, expression);
    expression.expression.append(".call(");
    parameter.generateCode(aData, expression, TemplateRestriction.Restriction_type.TR_NONE);
    if (toClause != null) {
        expression.expression.append(", ");
        toClause.generateCodeExpression(aData, expression, true);
    }
    expression.expression.append(')');
    expression.mergeExpression(source);
    if (altGuards != null) {
        source.append("{\n");
        if (timerValue != null) {
            timerValue.getLocation().update_location_object(aData, source);
            source.append("TitanTimer call_timer = new TitanTimer(null);\n");
            expression = new ExpressionStruct();
            expression.expression.append("call_timer.start(");
            timerValue.generateCodeExpression(aData, expression, false);
            expression.expression.append(')');
            expression.mergeExpression(source);
        }
        altGuards.generateCodeCallBody(aData, source, aData.getTemporaryVariableName(), false);
        source.append("}\n");
    }
}
Also used : ExpressionStruct(org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)

Example 87 with ExpressionStruct

use of org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct in project titan.EclipsePlug-ins by eclipse.

the class Check_Getreply_Statement method generateCode.

@Override
public /**
 * {@inheritDoc}
 */
void generateCode(final JavaGenData aData, final StringBuilder source) {
    final ExpressionStruct expression = new ExpressionStruct();
    generateCodeExpression(aData, expression);
    PortGenerator.generateCodeStandalone(aData, source, expression.expression.toString(), getLocation());
}
Also used : ExpressionStruct(org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)

Example 88 with ExpressionStruct

use of org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct in project titan.EclipsePlug-ins by eclipse.

the class Check_Receive_Port_Statement method generateCode.

@Override
public /**
 * {@inheritDoc}
 */
void generateCode(final JavaGenData aData, final StringBuilder source) {
    final ExpressionStruct expression = new ExpressionStruct();
    generateCodeExpression(aData, expression);
    PortGenerator.generateCodeStandalone(aData, source, expression.expression.toString(), getLocation());
}
Also used : ExpressionStruct(org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)

Example 89 with ExpressionStruct

use of org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct in project titan.EclipsePlug-ins by eclipse.

the class Connect_Statement method generateCode.

@Override
public /**
 * {@inheritDoc}
 */
void generateCode(final JavaGenData aData, final StringBuilder source) {
    // FIXME this is actually more complex
    final ExpressionStruct expression = new ExpressionStruct();
    // FIXME generate code for translation
    expression.expression.append("TTCN_Runtime.connect_port(");
    componentReference1.generateCodeExpression(aData, expression, true);
    expression.expression.append(", ");
    // FIXME actually _portref and based on component type
    portReference1.generateCode(aData, expression);
    expression.expression.append(".get_name(), ");
    componentReference2.generateCodeExpression(aData, expression, true);
    expression.expression.append(", ");
    // FIXME actually _portref and based on component type
    portReference2.generateCode(aData, expression);
    expression.expression.append(".get_name()");
    expression.expression.append(")");
    expression.mergeExpression(source);
}
Also used : ExpressionStruct(org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)

Example 90 with ExpressionStruct

use of org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct in project titan.EclipsePlug-ins by eclipse.

the class Activate_Statement method generateCode.

@Override
public /**
 * {@inheritDoc}
 */
void generateCode(final JavaGenData aData, final StringBuilder source) {
    final ExpressionStruct expression = new ExpressionStruct();
    final Assignment assignment = reference.getRefdAssignment(CompilationTimeStamp.getBaseTimestamp(), false);
    expression.expression.append(assignment.getGenNameFromScope(aData, source, myStatementBlock, "activate_"));
    expression.expression.append('(');
    if (!reference.getSubreferences().isEmpty()) {
        final ISubReference subReference = reference.getSubreferences().get(0);
        if (Subreference_type.parameterisedSubReference.equals(subReference.getReferenceType())) {
            ((ParameterisedSubReference) subReference).getActualParameters().generateCodeNoAlias(aData, expression);
        }
    }
    expression.expression.append(')');
    expression.mergeExpression(source);
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) ISubReference(org.eclipse.titan.designer.AST.ISubReference) ExpressionStruct(org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)

Aggregations

ExpressionStruct (org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)79 IValue (org.eclipse.titan.designer.AST.IValue)38 IType (org.eclipse.titan.designer.AST.IType)22 Assignment (org.eclipse.titan.designer.AST.Assignment)21 ISubReference (org.eclipse.titan.designer.AST.ISubReference)19 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)17 Reference (org.eclipse.titan.designer.AST.Reference)15 Identifier (org.eclipse.titan.designer.AST.Identifier)10 TTCN3Template (org.eclipse.titan.designer.AST.TTCN3.templates.TTCN3Template)9 ArrayList (java.util.ArrayList)8 FieldSubReference (org.eclipse.titan.designer.AST.FieldSubReference)8 SpecificValue_Template (org.eclipse.titan.designer.AST.TTCN3.templates.SpecificValue_Template)8 ParameterisedSubReference (org.eclipse.titan.designer.AST.ParameterisedSubReference)7 Array_Type (org.eclipse.titan.designer.AST.TTCN3.types.Array_Type)7 Integer_Value (org.eclipse.titan.designer.AST.TTCN3.values.Integer_Value)7 Type (org.eclipse.titan.designer.AST.Type)7 ITTCN3Template (org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template)6 CompField (org.eclipse.titan.designer.AST.TTCN3.types.CompField)6 Referenced_Value (org.eclipse.titan.designer.AST.TTCN3.values.Referenced_Value)6 ASN1_Choice_Type (org.eclipse.titan.designer.AST.ASN1.types.ASN1_Choice_Type)4