Commit 23904383 authored by Gergo Ujhelyi's avatar Gergo Ujhelyi
Browse files

added stop to titanport


Signed-off-by: Gergo Ujhelyi's avatarGergoUjhelyi <ujhelyi.gergo@ericsson.com>
parent 41e160f0
......@@ -7,6 +7,7 @@
******************************************************************************/
package org.eclipse.titan.designer.AST.TTCN3.statements;
import java.text.MessageFormat;
import java.util.List;
import org.eclipse.titan.designer.AST.ASTVisitor;
......@@ -15,6 +16,7 @@ import org.eclipse.titan.designer.AST.Reference;
import org.eclipse.titan.designer.AST.ReferenceFinder;
import org.eclipse.titan.designer.AST.ReferenceFinder.Hit;
import org.eclipse.titan.designer.AST.Scope;
import org.eclipse.titan.designer.compiler.JavaGenData;
import org.eclipse.titan.designer.parsers.CompilationTimeStamp;
import org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException;
import org.eclipse.titan.designer.parsers.ttcn3parser.TTCN3ReparseUpdater;
......@@ -110,4 +112,10 @@ public final class Stop_Port_Statement extends Statement {
}
return true;
}
@Override
/** {@inheritDoc} */
public void generateCode( final JavaGenData aData, final StringBuilder source ) {
source.append(MessageFormat.format("{0}.stop();\n", portReference.getRefdAssignment(getLastTimeChecked(), false).getGenName()));
}
}
......@@ -163,9 +163,19 @@ public class TitanPort {
if (!is_active) {
throw new TtcnError(MessageFormat.format("Internal error: Inactive port {0} cannot be stopped.", portName));
}
//FIXME implement
is_started = false;
userStop();
if(is_started) {
is_started = false;
is_halted = false;
userStop();
// dropping all messages from the queue because they cannot be extracted by receiving operations anymore
clearQueue();
} else if(is_halted) {
is_halted = false;
clearQueue();
} else {
TtcnError.TtcnWarning(MessageFormat.format("Performing stop operation on port {0}, which is already stopped. The operation has no effect.", portName));
}
//TODO: TTCN_Logger::log_port_state
}
public TitanAlt_Status receive(final TitanComponent_template sender_template, final TitanComponent sender_pointer) {
......@@ -641,7 +651,7 @@ public class TitanPort {
}
portName = name;
}
public void log() {
TtcnLogger.log_event("port %s", portName);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment