...
 
Commits (2)
......@@ -41,6 +41,16 @@ operation Any getPackage() : Any {
}
}
operation Any getPackageableElement() : Any {
if (self.eContainer.isDefined()) {
if (not self.eContainer.isKindOf(TDL!PackageableElement)) {
return self.eContainer.getPackageableElement();
} else {
return self.eContainer;
}
}
}
operation Any getTestDescription() : Any {
if (self.eContainer.isDefined()) {
......
......@@ -10,12 +10,16 @@ operation TDL!Interaction executeSource() : TTCN!FunctionStatementList {
var sfs = new TTCN!FunctionStatement();
sfs.communication = new TTCN!CommunicationStatements();
sfs.communication.send = new TTCN!SendStatement();
//sfs.communication.send.port = self.sourceGate.gate.equivalent();
//sfs.communication.send.port = self.sourceGate.gate.equivalent();
sfs.communication.send.port = self.sourceGate.equivalent().port;
sfs.communication.send.send = new TTCN!PortSendOp();
sfs.communication.send.send.template = new TTCN!InLineTemplate();
self.argument.~rule = self.~rule;
sfs.communication.send.send.template.template = self.argument.getTemplateBody();
//TODO: a bit of an escape hack
sfs.communication.send.send.template.type = sfs.communication.send.send.template.template.~type;
ssl.statements.add(sfs);
ssl.sc.add(";");
return ssl;
......@@ -33,6 +37,9 @@ operation TDL!Interaction executeTarget(t : TDL!Target) : TTCN!FunctionStatement
tfs.communication.receive.receive = new TTCN!PortReceiveOp();
tfs.communication.receive.receive.template = new TTCN!InLineTemplate();
tfs.communication.receive.receive.template.template = self.argument.getTemplateBody();
//TODO: a bit of an escape hack
tfs.communication.receive.receive.template.type = tfs.communication.receive.receive.template.template.~type;
if (not t.valueAssignment.isEmpty()) {
var pr = new TTCN!PortRedirect();
......@@ -533,6 +540,7 @@ operation TDL!VerdictAssignment execute() {
operation TDL!CompoundBehaviour execute() {
//TODO
for (b in self.block.behaviour) {
b.~rule = self.~rule;
b.execute();
}
}
......@@ -609,6 +617,7 @@ operation TDL!Behaviour execute() {
var i = 0;
for (block in self.block) {
for (b in block.behaviour) {
b.~rule = self.~rule;
b.execute(indent+" ");
}
if (i <= block.size()) {
......
......@@ -65,6 +65,15 @@ operation TTCN!TTCN3Module createTypeDefBody() : TTCN!TypeDefBody{
return md.def.body;
}
operation String getStringBody() : TTCN!TemplateBody {
var tb = new TTCN!TemplateBody();
tb.simple = new TTCN!SimpleSpec();
tb.simple.expr = new TTCN!Value();
tb.simple.expr.predef = new TTCN!PredefinedValue();
tb.simple.expr.predef.charString = "\""+self+"\"";
return tb;
}
operation Any transformSingleMemberAssignment(m : TDL!Member, mad : TDL!DataUse) : TTCN!TemplateBody {
var body = new TTCN!TemplateBody();
if (mad.isDefined() and mad.isKindOf(TDL!DataInstanceUse)) {
......@@ -171,19 +180,17 @@ operation Any transformDefaultMatchingSymbol(m : TDL!Member, mad : TDL!DataUse)
} else if (mad.isDefined()
and mad.isKindOf(TDL!AnyValueOrOmit)) {
body.simple.spec.expr.symbol.anyornone = "*";
} else if (mad.isDefined()
and mad.isKindOf(TDL!LiteralValueUse)) {
//("TODO: Implement full support for literal values : "+mad).log(1);
body.simple.spec = null;
body.simple.expr = new TTCN!Value();
body.simple.expr.predef = new TTCN!PredefinedValue();
body.simple.expr.predef.charString = mad.value;
} else if (mad.isDefined()) {
(" TODO: "+self.~rule+" : Not Implemented Yet : "+mad).log(1);
body.simple.spec = null;
body.simple.spec = null;
body.simple.expr = new TTCN!Value();
body.simple.expr.predef = new TTCN!PredefinedValue();
body.simple.expr.predef.charString = "\"TODO_NOT_SUPPORTED_YET\"";
if (mad.isKindOf(TDL!LiteralValueUse)) {
//("TODO: Implement full support for literal values : "+mad).log(1);
body.simple.expr.predef.charString = mad.value;
} else {
(" TODO: "+self.~rule+" : Not Implemented Yet : "+mad).log(1);
body.simple.expr.predef.charString = "\"TODO_NOT_SUPPORTED_YET\"";
}
}
return body;
}
......@@ -256,7 +263,7 @@ operation TDL!StaticDataUse transformWildcardMemberAssignment() : TTCN!FieldSpec
(" TODO: "+self.~rule+" : Context Not Implemented Yet").log(1);
}
}
if (self.item.isDefined() or t.isKindOf(TDL!CcollectionDataType)) {
if (self.item.isDefined() or t.isKindOf(TDL!CollectionDataType)) {
(" TODO: "+self.~rule+" : Collections not supported yet: "+self).log(1);
(" "+t.name).log(1);
var it = t.itemType;
......@@ -446,7 +453,22 @@ operation TDL!GateReference createConnectionPort() {
}
operation TDL!LiteralValueUse getTemplateBody() : TTCN!TemplateBody {
//TODO: add support for integer?
return self.value.replaceAll("\"", "").getStringBody();
}
operation TDL!LiteralValueUse getTemplateBody(flat : Boolean) : TTCN!TemplateBody {
//TODO: add support for integer?
return self.getTemplateBody();
}
operation TDL!DataInstanceUse getTemplateBody() : TTCN!TemplateBody {
return self.getTemplateBody(false);
}
operation TDL!DataInstanceUse getTemplateBody(flat : Boolean) : TTCN!TemplateBody {
var tb = new TTCN!TemplateBody();
tb.simple = new TTCN!SimpleSpec();
tb.simple.expr = new TTCN!Value();
......@@ -467,9 +489,23 @@ operation TDL!DataInstanceUse getTemplateBody() : TTCN!TemplateBody {
tb.simple.expr.ref.head = new TTCN!Head();
tb.simple.expr.ref.head.target = self.dataInstance.equivalent().base;
} else if (self.dataType.isDefined()) {
(" TODO: "+self.~rule+" : Not supported yet: "+self).log(1);
tb.simple.expr.predef = new TTCN!PredefinedValue();
tb.simple.expr.predef.charString = "\"TODO_INLINE_DATA_INSTANCE_FOR_"+self.dataType.name+"\"";
if (flat) {
(" TODO: "+self.~rule+" : Not supported yet: "+self).log(1);
tb.simple.expr.predef = new TTCN!PredefinedValue();
tb.simple.expr.predef.charString = "\"TODO_INLINE_DATA_INSTANCE_FOR_"+self.dataType.name+"\"";
} else {
tb.simple=null;
tb.~type = self.dataType.getTTCNType();
tb.field = new TTCN!FieldSpecList();
for (a in self.argument) {
var fs = new TTCN!FieldSpec();
fs.ref = a.parameter.equivalent();
fs.body = a.dataUse.getTemplateBody(true);
tb.field.spec.add(fs);
}
}
} else if (self.item.isDefined()) {
(" TODO: "+self.~rule+" : Not supported yet: "+self).log(1);
tb.simple.expr.predef = new TTCN!PredefinedValue();
......@@ -509,6 +545,9 @@ operation TDL!Interaction getGuardOp() : TTCN!GuardOp {
op.receive.receive.template = new TTCN!InLineTemplate();
op.receive.receive.template.template = self.argument.getTemplateBody();
//TODO: a bit of an escape hack
op.receive.receive.template.type = op.receive.receive.template.template.~type;
var t = self.target.first();
if (not t.valueAssignment.isEmpty()) {
var pr = new TTCN!PortRedirect();
......
......@@ -471,6 +471,7 @@ rule TD2FD
}
if (td.behaviourDescription.isDefined()) {
td.behaviourDescription.behaviour.~rule = self;
td.behaviourDescription.behaviour.execute();
}
......@@ -526,9 +527,7 @@ rule TD2FD
tsl.statements.add(tsd);
tsl.sc.add(";");
}
}
rule GR2PR
......@@ -723,13 +722,7 @@ rule SimpleDI2TD
td.base.name = di.TTCNname();
td.base.type = di.dataType.getTTCNType();
var tb = new TTCN!TemplateBody();
td.body = tb;
tb.simple = new TTCN!SimpleSpec();
tb.simple.expr = new TTCN!Value();
tb.simple.expr.predef = new TTCN!PredefinedValue();
tb.simple.expr.predef.charString = "\""+di.name+"\"";
td.body = di.name.getStringBody();
}
rule SimpleDI2C
......@@ -876,6 +869,7 @@ rule CollectionDI2TD
tb.simple.expr.list.expr.add(v);
} else {
//TODO: inline definition
(" TODO: "+self+" : Not Implemented Yet : "+di.item.type.name).log(1);
var v = new TTCN!Value();
v.predef = new TTCN!PredefinedValue();
v.predef.charString = "\"TODO_NOT_SUPPORTED_YET\"";
......@@ -898,7 +892,6 @@ rule CollectionDI2C
var m = di.eContainer.equivalent();
m.defs.definitions.add(md);
cd.type = di.dataType.getTTCNType();
cd.defs = new TTCN!ConstList();
......
......@@ -31,7 +31,7 @@ public class Transform {
if (module.getParseProblems().size() > 0) {
System.err.println("Parse errors occured...");
for (ParseProblem problem : module.getParseProblems()) {
System.err.println(problem.toString());
System.err.println(" ETL: "+problem.toString());
}
}
......@@ -53,7 +53,7 @@ public class Transform {
//module.reset();
} catch (EolRuntimeException e) {
System.out.println(e);
System.out.println(" EOL: "+e.getAst().getModule().getSourceUri().getPath()+" : "+e.getLine() +" : "+e.getMessage()+"");
} catch (Exception e) {
e.printStackTrace();
}
......