diff options
author | tjung | 2012-01-24 07:38:21 +0000 |
---|---|---|
committer | tjung | 2012-01-24 07:38:21 +0000 |
commit | 4cf0af1ebfd6c8c9f9122da470dc8e21f721fbfa (patch) | |
tree | 627a884bf15f44c4494e3823d88b26a3c24df998 | |
parent | ec85fadf44a27b77b29883c7b902902e2d432155 (diff) | |
parent | edaf429ae3856c19eaa729d843d90febe4fd5d42 (diff) | |
download | org.eclipse.etrice-4cf0af1ebfd6c8c9f9122da470dc8e21f721fbfa.tar.gz org.eclipse.etrice-4cf0af1ebfd6c8c9f9122da470dc8e21f721fbfa.tar.xz org.eclipse.etrice-4cf0af1ebfd6c8c9f9122da470dc8e21f721fbfa.zip |
Merge branch 'master' of ssh://git.eclipse.org/gitroot/etrice/org.eclipse.etrice
86 files changed, 2285 insertions, 1638 deletions
diff --git a/examples/org.eclipse.etrice.generator.c.reference/model/CTypes.room b/examples/org.eclipse.etrice.generator.c.reference/model/CTypes.room new file mode 100644 index 000000000..9c76a085e --- /dev/null +++ b/examples/org.eclipse.etrice.generator.c.reference/model/CTypes.room @@ -0,0 +1,21 @@ +RoomModel room.basic.types.c { + + PrimitiveType boolean -> boolean (boolean) default "FALSE" + PrimitiveType char -> char (char) default "0" + PrimitiveType int8 -> int8 (int8) default "0" + PrimitiveType int16 -> int16 (int16) default "0" + PrimitiveType int32 -> int32 (int32) default "0" + PrimitiveType int64 -> int64 (int64) default "0" + + PrimitiveType uint8 -> uint8 (uint8) default "0" + PrimitiveType uint16 -> uint16 (uint16) default "0" + PrimitiveType uint32 -> uint32 (uint32) default "0" + PrimitiveType uint64 -> uint64 (uint64) default "0" + + PrimitiveType float32 -> float32 (float32) default "0" + PrimitiveType float64 -> float64 (float64) default "0" + + // TODO: define strings for C + // PrimitiveType string -> string (String) default "\"\"" + +}
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.generator.c.reference/model/cGenRef.room b/examples/org.eclipse.etrice.generator.c.reference/model/cGenRef.room index 9abeb2133..c1ec04d23 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/model/cGenRef.room +++ b/examples/org.eclipse.etrice.generator.c.reference/model/cGenRef.room @@ -1,5 +1,6 @@ RoomModel cGenRef { - + import room.basic.types.c.* from "CTypes.room" + SubSystemClass SS { ActorRef Receiver: Receiver ActorRef Sender: Sender diff --git a/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass1.c b/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass1.c index 715b0fb44..d4235dbc3 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass1.c +++ b/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass1.c @@ -9,10 +9,10 @@ // TODO: do we need setters and getters for C and C++ ? //--------------------- operations -int32 DataClass1_MultiplyWithAttr1 (DataClass1* self, int32 value){ +int32 DataClass1_MultiplyWithAttr1(DataClass1* self, int32 value) { return self->Attr1*value; } -float32 DataClass1_MultiplyWithAttr3 (DataClass1* self, float32 value){ +float32 DataClass1_MultiplyWithAttr3(DataClass1* self, float32 value) { return self->Attr3*value; } diff --git a/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass1.h b/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass1.h index 8c3708d72..dbf8dee81 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass1.h +++ b/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass1.h @@ -1,7 +1,7 @@ #ifndef _DataClass1_H_ #define _DataClass1_H_ -#include "datatypes.h" +#include "etDatatypes.h" /* TODO: includes only for used DataClasses, also for other models */ #include "DataClass2.h" @@ -23,8 +23,8 @@ typedef struct { // TODO: do we need setters and getters for C and C++ ? //--------------------- operations -int32 DataClass1_MultiplyWithAttr1 (DataClass1* self, int32 value); -float32 DataClass1_MultiplyWithAttr3 (DataClass1* self, float32 value); +int32 DataClass1_MultiplyWithAttr1(DataClass1* self, int32 value); +float32 DataClass1_MultiplyWithAttr3(DataClass1* self, float32 value); // deep copy void DataClass1_deepCopy(DataClass1* source, DataClass1* target); diff --git a/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass2.c b/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass2.c index 2a94fd07e..2150d7b41 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass2.c +++ b/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass2.c @@ -6,7 +6,7 @@ // TODO: do we need setters and getters for C and C++ ? //--------------------- operations -void DataClass2_Operation1 (DataClass2* self){ +void DataClass2_Operation1(DataClass2* self) { /*nothing to do*/ } diff --git a/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass2.h b/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass2.h index 6d7259267..2d8cbb74f 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass2.h +++ b/examples/org.eclipse.etrice.generator.c.reference/src-gen/cGenRef/DataClass2.h @@ -1,7 +1,7 @@ #ifndef _DataClass2_H_ #define _DataClass2_H_ -#include "datatypes.h" +#include "etDatatypes.h" /* TODO: includes only for used DataClasses, also for other models */ @@ -16,7 +16,7 @@ typedef struct { // TODO: do we need setters and getters for C and C++ ? //--------------------- operations -void DataClass2_Operation1 (DataClass2* self); +void DataClass2_Operation1(DataClass2* self); // deep copy void DataClass2_deepCopy(DataClass2* source, DataClass2* target); diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/RunAllTestcases.c b/examples/org.eclipse.etrice.generator.c.reference/src/RunAllTestcases.c index 6caff4b38..c21cc4074 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src/RunAllTestcases.c +++ b/examples/org.eclipse.etrice.generator.c.reference/src/RunAllTestcases.c @@ -12,8 +12,6 @@ #include <stdio.h> -#include "RUnit.h" - #include "test/generator/RunCGeneratorTestcases.h" #include "test/runtime/RunCRuntimeTestcases.h" @@ -26,11 +24,7 @@ int main(void){ void runTestCases(void){ - RUnit_open("tmp/testlog","TestMessageService"); - RunCGeneratorTestcases(); RunCRuntimeTestcases(); - - RUnit_close(); } diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.c index db8176609..cf2d11e9c 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.c +++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.c @@ -1,3 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2011 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Schuetz (initial contribution) + * + *******************************************************************************/ + /* * RunCGeneratorTestcases.c * @@ -8,7 +20,11 @@ #include "RunCGeneratorTestcases.h" #include "TestDataClass.h" +#include "etUnit.h" + void RunCGeneratorTestcases(void){ + etUnit_open("tmp/testlog","TestCGenerator"); TestDataClass_runSuite(); + etUnit_close(); } diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.h b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.h index 01472caa9..03d5c4276 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.h +++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.h @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2011 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Schuetz (initial contribution) + * + *******************************************************************************/ + + /* * RunCGeneratorTestcases.h * diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.c index 066eb97e6..e3c521dd3 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.c +++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.c @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2011 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Schuetz (initial contribution) + * + *******************************************************************************/ + + /* * TestDataClass.c * @@ -8,14 +21,27 @@ #include "TestDataClass.h" -#include "RUnit.h" +#include "etUnit.h" #include "../../../src-gen/cGenRef/DataClass1.h" -void TestDataClass_testDataClassDeepCopy(void){ - RUnit_openTestCase("testDataClassDeepCopy"); +void TestDataClass_Operations(void){ + + DataClass1 d; + d.Attr1 = 123; + d.ComplexAttr.Attr1 = 456; + d.ComplexAttr.Attr2 = (float32)789.123; + d.ComplexAttr.Attr3 = 789; + d.Attr3 = (float32)321.123; + + EXPECT_EQUAL_INT32("Operation DataClass1_MultiplyWithAttr1", 246, DataClass1_MultiplyWithAttr1(&d, 2)); + EXPECT_EQUAL_FLOAT32("Operation DataClass1_MultiplyWithAttr3", (float32)642.246, DataClass1_MultiplyWithAttr3(&d, 2), (float32)0.0001); + +} +void TestDataClass_testDataClassDeepCopy(void){ + DataClass1 d, e; d.Attr1 = 123; d.ComplexAttr.Attr1 = 456; @@ -31,15 +57,11 @@ void TestDataClass_testDataClassDeepCopy(void){ EXPECT_EQUAL_INT32("ComplexAttr.Attr3", 789, e.ComplexAttr.Attr3); EXPECT_EQUAL_FLOAT32("Attr3", (float32)321.123, e.Attr3, (float32)0.0001); - EXPECT_EQUAL_INT32("Operation DataClass1_MultiplyWithAttr1", 246, DataClass1_MultiplyWithAttr1(&d, 2)); - EXPECT_EQUAL_FLOAT32("Operation DataClass1_MultiplyWithAttr3", (float32)642.246, DataClass1_MultiplyWithAttr3(&d, 2), (float32)0.0001); - - RUnit_closeTestCase(); } void TestDataClass_runSuite(void){ - RUnit_openTestSuite("TestDataClass"); - TestDataClass_testDataClassDeepCopy(); - RUnit_closeTestSuite(); - + etUnit_openTestSuite("TestDataClass"); + ADD_TESTCASE(TestDataClass_Operations); + ADD_TESTCASE(TestDataClass_testDataClassDeepCopy); + etUnit_closeTestSuite(); } diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.h b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.h index a3c9b4078..3cbce4bc1 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.h +++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.h @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2011 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Schuetz (initial contribution) + * + *******************************************************************************/ + + /* * TestEmDataClass.h * diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.c index 7180c67b9..a9a502f3b 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.c +++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.c @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2011 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Schuetz (initial contribution) + * + *******************************************************************************/ + + /* * RunRuntimeTestcases.c * @@ -12,10 +25,25 @@ #include "TestEtMessage.h" #include "TestEtMessageQueue.h" #include "TestEtMessageService.h" +#include "TestEtUnit.h" + +#include "etUnit.h" + void RunCRuntimeTestcases(void){ + etUnit_open("tmp/testlog","TestCRuntime"); + TestEtMessage_runSuite(); TestEtMessageQueue_runSuite(); TestEtMessageService_runSuite(); + TestEtUnit_runSuite(); + + etUnit_close(); + + /* special situation for testing openAll and closeAll of etUnit + * this has to be done outside of etUnit_open and etUnit_close */ + etUnit_openAll("tmp/testlog","TestEtUnitSpecial", "etUnit", "openAll and closeAll"); + EXPECT_TRUE("Open and Close", TRUE); + etUnit_closeAll(); } diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.h b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.h index 604dc0a3e..5d17f7ddb 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.h +++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.h @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2011 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Schuetz (initial contribution) + * + *******************************************************************************/ + + /* * RunRuntimeTestcases.h * diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessage.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessage.c index a9d7b6aee..c360b0a84 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessage.c +++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessage.c @@ -13,16 +13,15 @@ #include "TestEtMessage.h" #include <stddef.h> -#include "RUnit.h" -#include "RMessage.h" +#include "etUnit.h" +#include "etMessage.h" void TestEtMessage_testBasicMessage(void){ - RUnit_openTestCase("TestMessage_testBasicMessage"); - RMessage msg1 = {(RMessage*)1234567, 123,456,}; - RMessage msg2 = {NULL, 222,333}; + etMessage msg1 = {(etMessage*)1234567, 123,456,}; + etMessage msg2 = {NULL, 222,333}; // basic checks -> detects structure changes that would cause problems for generated code EXPECT_EQUAL_PTR("Message.next", 1234567, msg1.next); @@ -36,13 +35,11 @@ void TestEtMessage_testBasicMessage(void){ EXPECT_EQUAL_INT16("msg1.NextMsg", msg2.evtID, msg1.next->evtID); EXPECT_EQUAL_INT16("msg2.NextMsg", msg1.evtID, msg2.next->evtID); - RUnit_closeTestCase(); } - void TestEtMessage_runSuite(void){ - RUnit_openTestSuite("TestMessage"); - TestEtMessage_testBasicMessage(); - RUnit_closeTestSuite(); + etUnit_openTestSuite("TestMessage"); + ADD_TESTCASE(TestEtMessage_testBasicMessage); + etUnit_closeTestSuite(); } diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageQueue.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageQueue.c index 6b03602df..3a453962c 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageQueue.c +++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageQueue.c @@ -11,29 +11,28 @@ *******************************************************************************/ #include "TestEtMessageQueue.h" -#include "RUnit.h" -#include "RMessageQueue.h" +#include "etUnit.h" +#include "etMessageQueue.h" void TestEtMessageQueue_testPushPop(void){ - RUnit_openTestCase("testPushPop"); - RMessage msg1 = {NULL, 123, 456}; - RMessage msg2 = {NULL, 222, 333}; + etMessage msg1 = {NULL, 123, 456}; + etMessage msg2 = {NULL, 222, 333}; - RMessageQueue queue1; - RMessageQueue_init(&queue1); + etMessageQueue queue1; + etMessageQueue_init(&queue1); - RMessageQueue_push(&queue1, &msg1); - RMessageQueue_push(&queue1, &msg2); + etMessageQueue_push(&queue1, &msg1); + etMessageQueue_push(&queue1, &msg2); - EXPECT_EQUAL_INT16("RMessageQueue.size before", 2,queue1.size); - EXPECT_EQUAL_INT16("RMessageQueue.highWaterMark before", 2,queue1.highWaterMark); + EXPECT_EQUAL_INT16("etMessageQueue.size before", 2, queue1.size); + EXPECT_EQUAL_INT16("etMessageQueue.highWaterMark before", 2, queue1.highWaterMark); - RMessage* rcvMsg1 = RMessageQueue_pop(&queue1); - RMessage* rcvMsg2 = RMessageQueue_pop(&queue1); + etMessage* rcvMsg1 = etMessageQueue_pop(&queue1); + etMessage* rcvMsg2 = etMessageQueue_pop(&queue1); - EXPECT_EQUAL_INT16("RMessageQueue.size after", 0,queue1.size); - EXPECT_EQUAL_INT16("RMessageQueue.highWaterMark after", 2,queue1.highWaterMark); + EXPECT_EQUAL_INT16("etMessageQueue.size after", 0, queue1.size); + EXPECT_EQUAL_INT16("etMessageQueue.highWaterMark after", 2, queue1.highWaterMark); EXPECT_EQUAL_INT16("rcvMsg1->address", 123, rcvMsg1->address); EXPECT_EQUAL_INT16("rcvMsg1->evtID", 456, rcvMsg1->evtID); @@ -43,30 +42,26 @@ void TestEtMessageQueue_testPushPop(void){ EXPECT_EQUAL_INT16("rcvMsg2->evtID", 333, rcvMsg2->evtID); EXPECT_EQUAL_PTR("rcvMsg2->next", NULL, rcvMsg2->next); - EXPECT_EQUAL_PTR("RMessageQueue->first", NULL, queue1.first); - EXPECT_EQUAL_PTR("RMessageQueue->last", NULL, queue1.last); + EXPECT_EQUAL_PTR("etMessageQueue->first", NULL, queue1.first); + EXPECT_EQUAL_PTR("etMessageQueue->last", NULL, queue1.last); - RMessage* rcvMsg3 = RMessageQueue_pop(&queue1); - EXPECT_EQUAL_PTR("RMessageQueue_pop if empty", NULL, rcvMsg3); + etMessage* rcvMsg3 = etMessageQueue_pop(&queue1); + EXPECT_EQUAL_PTR("etMessageQueue_pop if empty", NULL, rcvMsg3); - RUnit_closeTestCase(); } #define MAX 1000 void TestEtMessageQueue_testMassiveMessaging(void){ - RUnit_openTestCase("MassiveMessaging"); - RMessage msgArray[MAX]; - printf("sizeof(RMessage):%d\n", sizeof(RMessage)); - printf("size(msgArray):%d\n", sizeof(msgArray)); + etMessage msgArray[MAX]; - RMessageQueue queue1; - RMessageQueue_init(&queue1); + etMessageQueue queue1; + etMessageQueue_init(&queue1); - int32 i; + int16 i; for(i=0; i<MAX; i++){ - //RMessage_init(&msgArray[i]); + //etMessage_init(&msgArray[i]); msgArray[i].address = i; msgArray[i].evtID = i; } @@ -74,10 +69,10 @@ void TestEtMessageQueue_testMassiveMessaging(void){ int j; for(j=0; j<3; j++){ for (i=0; i<MAX; i++){ - RMessageQueue_push(&queue1, &(msgArray[i])); + etMessageQueue_push(&queue1, &(msgArray[i])); } for (i=0; i<MAX; i++){ - RMessage* msg = RMessageQueue_pop(&queue1); + etMessage* msg = etMessageQueue_pop(&queue1); // EXPECTS are hidden to avoid too many testcases in log if (msg == NULL){ EXPECT_FALSE("msg == NULL", TRUE); @@ -94,12 +89,11 @@ void TestEtMessageQueue_testMassiveMessaging(void){ } EXPECT_EQUAL_INT32("i==MAX", MAX, i); } - RUnit_closeTestCase(); } void TestEtMessageQueue_runSuite(void){ - RUnit_openTestSuite("TestRMessageQueue"); - TestEtMessageQueue_testPushPop(); - TestEtMessageQueue_testMassiveMessaging(); - RUnit_closeTestSuite(); + etUnit_openTestSuite("TestEtMessageQueue"); + ADD_TESTCASE(TestEtMessageQueue_testPushPop); + ADD_TESTCASE(TestEtMessageQueue_testMassiveMessaging); + etUnit_closeTestSuite(); } diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageService.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageService.c index ed14defb1..1d8b6cce8 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageService.c +++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageService.c @@ -11,20 +11,19 @@ *******************************************************************************/ #include "TestEtMessageService.h" -#include "RUnit.h" -#include "RMessageService.h" +#include "etUnit.h" +#include "etMessageService.h" void TestEtMessageService_init(void){ - RUnit_openTestCase("testRMessageService_init"); - RMessageService msgService; - int16 max = 6; - int16 blockSize = 32; + etMessageService msgService; + uint16 max = 6; + uint16 blockSize = 32; uint8 msgBuffer[max*blockSize]; - RMessageService_init(&msgService, msgBuffer, max, blockSize); + etMessageService_init(&msgService, msgBuffer, max, blockSize); EXPECT_EQUAL_PTR("msgService.messagePool.first", msgBuffer, msgService.messagePool.first); EXPECT_EQUAL_PTR("msgService.messagePool in between", &msgBuffer[3*blockSize], msgService.messagePool.first->next->next->next); @@ -32,22 +31,20 @@ void TestEtMessageService_init(void){ EXPECT_EQUAL_PTR("msgService.messagePool.last(2)", &msgBuffer[5*blockSize], msgService.messagePool.last); EXPECT_EQUAL_PTR("msgService.messagePool.last.next", 0, msgService.messagePool.last->next); - RUnit_closeTestCase(); } void TestEtMessageService_GetPushPopReturn(void){ - RUnit_openTestCase("testRMessageService_GetPushPopReturn"); - RMessageService msgService; - int16 max = 6; - int16 blockSize = 32; + etMessageService msgService; + uint16 max = 6; + uint16 blockSize = 32; uint8 msgBuffer[max*blockSize]; - RMessageService_init(&msgService, msgBuffer, max, blockSize); + etMessageService_init(&msgService, msgBuffer, max, blockSize); // get messages from pool - RMessage* msg1 = RMessageService_getMessageBuffer(&msgService, sizeof(RMessage)); - RMessage* msg2 = RMessageService_getMessageBuffer(&msgService, sizeof(RMessage)); + etMessage* msg1 = etMessageService_getMessageBuffer(&msgService, sizeof(etMessage)); + etMessage* msg2 = etMessageService_getMessageBuffer(&msgService, sizeof(etMessage)); EXPECT_EQUAL_INT16("msgService.messagePool.size", 4, msgService.messagePool.size); @@ -58,14 +55,14 @@ void TestEtMessageService_GetPushPopReturn(void){ msg2->evtID = 222; // push messages to queue - RMessageService_pushMessage(&msgService, msg2); - RMessageService_pushMessage(&msgService, msg1); + etMessageService_pushMessage(&msgService, msg2); + etMessageService_pushMessage(&msgService, msg1); EXPECT_EQUAL_INT16("msgService.messageQueue.size", 2, msgService.messageQueue.size); // pop messages from queue - RMessage* rcvMsg1 = RMessageService_popMessage(&msgService); - RMessage* rcvMsg2 = RMessageService_popMessage(&msgService); + etMessage* rcvMsg1 = etMessageService_popMessage(&msgService); + etMessage* rcvMsg2 = etMessageService_popMessage(&msgService); EXPECT_EQUAL_INT16("msgService.messageQueue.size",0, msgService.messageQueue.size); @@ -75,48 +72,45 @@ void TestEtMessageService_GetPushPopReturn(void){ EXPECT_EQUAL_INT16("msgService.popMessage", 11, rcvMsg2->address); EXPECT_EQUAL_INT16("msgService.popMessage", 111, rcvMsg2->evtID); - RMessageService_returnMessageBuffer(&msgService, rcvMsg1); - RMessageService_returnMessageBuffer(&msgService, rcvMsg2); + etMessageService_returnMessageBuffer(&msgService, rcvMsg1); + etMessageService_returnMessageBuffer(&msgService, rcvMsg2); EXPECT_EQUAL_INT16("msgService.messagePool.size", 6, msgService.messagePool.size); - RUnit_closeTestCase(); } void TestEtMessageService_GetReturn(void){ - RUnit_openTestCase("testRMessageService_GetReturn"); - RMessageService msgService; - int16 max = 2; - int16 blockSize = 32; + etMessageService msgService; + uint16 max = 2; + uint16 blockSize = 32; uint8 msgBuffer[max*blockSize]; - RMessageService_init(&msgService, msgBuffer, max, blockSize); + etMessageService_init(&msgService, msgBuffer, max, blockSize); // get on message too much from pool - RMessage* msg1 = RMessageService_getMessageBuffer(&msgService, sizeof(RMessage)); - RMessage* msg2 = RMessageService_getMessageBuffer(&msgService, sizeof(RMessage)); - RMessage* msg3 = RMessageService_getMessageBuffer(&msgService, sizeof(RMessage)); + etMessage* msg1 = etMessageService_getMessageBuffer(&msgService, sizeof(etMessage)); + etMessage* msg2 = etMessageService_getMessageBuffer(&msgService, sizeof(etMessage)); + etMessage* msg3 = etMessageService_getMessageBuffer(&msgService, sizeof(etMessage)); EXPECT_TRUE("msgService getMessageBuffer", msg1!=NULL); EXPECT_TRUE("msgService getMessageBuffer", msg2!=NULL); EXPECT_EQUAL_PTR("msgService getMessageBuffer", msg3, NULL); // return messages - RMessageService_returnMessageBuffer(&msgService, msg1); - RMessageService_returnMessageBuffer(&msgService, msg2); + etMessageService_returnMessageBuffer(&msgService, msg1); + etMessageService_returnMessageBuffer(&msgService, msg2); EXPECT_EQUAL_INT16("msgService.messagePool.size", 2, msgService.messagePool.size); // get message bigger than blocksize - RMessage* msg4 = RMessageService_getMessageBuffer(&msgService, 33); + etMessage* msg4 = etMessageService_getMessageBuffer(&msgService, 33); EXPECT_EQUAL_PTR("msgService getMessageBuffer", msg4, NULL); - RUnit_closeTestCase(); } void TestEtMessageService_runSuite(void){ - RUnit_openTestSuite("TestRMessageService"); - TestEtMessageService_init(); - TestEtMessageService_GetPushPopReturn(); - TestEtMessageService_GetReturn(); - RUnit_closeTestSuite(); + etUnit_openTestSuite("TestEtMessageService"); + ADD_TESTCASE(TestEtMessageService_init); + ADD_TESTCASE(TestEtMessageService_GetPushPopReturn); + ADD_TESTCASE(TestEtMessageService_GetReturn); + etUnit_closeTestSuite(); } diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageService.h b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageService.h index 287ff8c8b..43a85baee 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageService.h +++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageService.h @@ -13,7 +13,7 @@ #ifndef _TESTRMESSAGESERVICE_H_ #define _TESTRMESSAGESERVICE_H_ -#include "RMessageService.h" +#include "etMessageService.h" void TestEtMessageService_runSuite(void); diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtUnit.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtUnit.c new file mode 100644 index 000000000..3f01d0587 --- /dev/null +++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtUnit.c @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2011 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Schuetz (initial contribution) + * + *******************************************************************************/ + + +/* + * TestEtUnit.c + * + * Created on: 16.01.2012 + * Author: tschuetz + */ + +#include "TestEtUnit.h" +#include "etUnit.h" + +void TestEtUnit_Expect(void){ + EXPECT_TRUE("EXPECT_TRUE", TRUE); + EXPECT_FALSE("EXPECT_FALSE", FALSE); + + /* signed integer values */ + EXPECT_EQUAL_INT8("EXPECT_EQUAL_INT8", -123, -123); + EXPECT_EQUAL_INT16("EXPECT_EQUAL_INT16", -12345, -12345); + EXPECT_EQUAL_INT32("EXPECT_EQUAL_INT32", -1234567, -1234567); + + /* unsigned integer values */ + EXPECT_EQUAL_UINT8("EXPECT_EQUAL_INT8", 123, 123); + EXPECT_EQUAL_UINT16("EXPECT_EQUAL_INT16", 12345, 12345); + EXPECT_EQUAL_UINT32("EXPECT_EQUAL_INT32", 1234567, 1234567); + + /* float values */ + EXPECT_EQUAL_FLOAT32("EXPECT_EQUAL_FLOAT32", (etFloat32) 123.456, (etFloat32) 123.456, (etFloat32) 0.0001); + EXPECT_EQUAL_FLOAT64("EXPECT_EQUAL_FLOAT64", (etFloat64) 123.456, (etFloat64) 123.456, (etFloat64) 0.0001); + + /* Pointers */ + etUInt16 value; + etUInt16* valuePtr = &value; + + EXPECT_EQUAL_PTR("EXPECT_EQUAL_PTR", &value, valuePtr) \ + +} + + +void TestEtUnit_Expect_Order(void){ + etInt16 list[] = {1,2,3,4}; + EXPECT_ORDER_START(list, 4); + EXPECT_ORDER("id=1", 1); + EXPECT_ORDER("id=2", 2); + EXPECT_ORDER("id=3", 3); + EXPECT_ORDER_END("id=4", 4); +} + +void TestEtUnit_runSuite(void){ + etUnit_openTestSuite("TestEtUnit"); + ADD_TESTCASE(TestEtUnit_Expect_Order); + ADD_TESTCASE(TestEtUnit_Expect); + etUnit_closeTestSuite(); +} + + diff --git a/runtime/org.eclipse.etrice.runtime.c/src/RMessage.h b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtUnit.h index dd6927662..e591d27ef 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/RMessage.h +++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtUnit.h @@ -10,17 +10,17 @@ * *******************************************************************************/ -#ifndef RMESSAGE_H_ -#define RMESSAGE_H_ -#include "datatypes.h" +/* + * TestEtUnit.h + * + * Created on: 16.01.2012 + * Author: tschuetz + */ -typedef struct RMessage{ - struct RMessage* next; - int16 address; - int16 evtID; -} RMessage; +#ifndef _TESTETUNIT_H_ +#define _TESTETUNIT_H_ -void RMessage_init(RMessage* self); +void TestEtUnit_runSuite(void); -#endif /* RMESSAGE_H_ */ +#endif /* _TESTETUNIT_H_ */ diff --git a/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestCGenerator.xml b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestCGenerator.xml new file mode 100644 index 000000000..160ccd2bf --- /dev/null +++ b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestCGenerator.xml @@ -0,0 +1,6 @@ +<testsuites name="TestCGenerator" tests="0" failures="0" errors="0" time="0"> + <testsuite name="TestDataClass" tests="0" failures="0" errors="0" time="0"> + <testcase name="TestDataClass_Operations" time="0"/> + <testcase name="TestDataClass_testDataClassDeepCopy" time="0"/> + </testsuite> +</testsuites> diff --git a/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestCRuntime.xml b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestCRuntime.xml new file mode 100644 index 000000000..a5a4ad3d9 --- /dev/null +++ b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestCRuntime.xml @@ -0,0 +1,18 @@ +<testsuites name="TestCRuntime" tests="0" failures="0" errors="0" time="0"> + <testsuite name="TestMessage" tests="0" failures="0" errors="0" time="0"> + <testcase name="TestEtMessage_testBasicMessage" time="0"/> + </testsuite> + <testsuite name="TestEtMessageQueue" tests="0" failures="0" errors="0" time="0"> + <testcase name="TestEtMessageQueue_testPushPop" time="0"/> + <testcase name="TestEtMessageQueue_testMassiveMessaging" time="0"/> + </testsuite> + <testsuite name="TestEtMessageService" tests="0" failures="0" errors="0" time="0"> + <testcase name="TestEtMessageService_init" time="0"/> + <testcase name="TestEtMessageService_GetPushPopReturn" time="0"/> + <testcase name="TestEtMessageService_GetReturn" time="0"/> + </testsuite> + <testsuite name="TestEtUnit" tests="0" failures="0" errors="0" time="0"> + <testcase name="TestEtUnit_Expect_Order" time="0"/> + <testcase name="TestEtUnit_Expect" time="0"/> + </testsuite> +</testsuites> diff --git a/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestEtUnitSpecial.xml b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestEtUnitSpecial.xml new file mode 100644 index 000000000..f319d0648 --- /dev/null +++ b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestEtUnitSpecial.xml @@ -0,0 +1,5 @@ +<testsuites name="TestEtUnitSpecial" tests="0" failures="0" errors="0" time="0"> + <testsuite name="etUnit" tests="0" failures="0" errors="0" time="0"> + <testcase name="openAll and closeAll" time="0"/> + </testsuite> +</testsuites> diff --git a/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestMessageService.xml b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestMessageService.xml deleted file mode 100644 index 36d6edbba..000000000 --- a/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestMessageService.xml +++ /dev/null @@ -1,17 +0,0 @@ -<testsuites name="TestMessageService" tests="0" failures="0" errors="0" time="0"> - <testsuite name="TestDataClass" tests="0" failures="0" errors="0" time="0"> - <testcase name="testDataClassDeepCopy" time="0"/> - </testsuite> - <testsuite name="TestMessage" tests="0" failures="0" errors="0" time="0"> - <testcase name="TestMessage_testBasicMessage" time="0"/> - </testsuite> - <testsuite name="TestRMessageQueue" tests="0" failures="0" errors="0" time="0"> - <testcase name="testPushPop" time="0"/> - <testcase name="MassiveMessaging" time="0"/> - </testsuite> - <testsuite name="TestRMessageService" tests="0" failures="0" errors="0" time="0"> - <testcase name="testRMessageService_init" time="0"/> - <testcase name="testRMessageService_GetPushPopReturn" time="0"/> - <testcase name="testRMessageService_GetReturn" time="0"/> - </testsuite> -</testsuites> diff --git a/examples/org.eclipse.etrice.tutorials/model/PedLightsController/PedLightsController.room b/examples/org.eclipse.etrice.tutorials/model/PedLightsController/PedLightsController.room index 48876222e..37cf6c1e9 100644 --- a/examples/org.eclipse.etrice.tutorials/model/PedLightsController/PedLightsController.room +++ b/examples/org.eclipse.etrice.tutorials/model/PedLightsController/PedLightsController.room @@ -1,168 +1,169 @@ -RoomModel PedLightsController { - - import room.basic.service.timing.* from "../../../org.eclipse.etrice.modellib/models/TimingService.room" - - LogicalSystem LogSys_PedLights { - SubSystemRef application: SubSys_PedLights - } - - SubSystemClass SubSys_PedLights { - ActorRef PedLightsTopRef: PedLightsTop - ActorRef timingService: ATimingService - LayerConnection ref PedLightsTopRef satisfied_by timingService.timer - LayerConnection ref PedLightsTopRef satisfied_by timingService.timeout - } - - ActorClass PedLightsTop { - Structure { - ActorRef adapter: GuiAdapter - ActorRef controller: Controller - Binding adapter.ControlPort and controller.ControlPort - } - Behavior { } - } - - ActorClass GuiAdapter { - Interface { - conjugated Port ControlPort: PedControlProtocol - } - Structure { - usercode1 { - "import org.eclipse.etrice.tutorials.PedLightGUI.*;" - } - usercode2 { - "private PedestrianLightWndNoTcp lights = new PedestrianLightWndNoTcp(\"Pedestrian Lights\",\" external port connection \");" - "private TrafficLight3 carLights;" - "private TrafficLight2 pedLights;" - } - external Port ControlPort - } - Behavior { - Operation destroyUser() { - "lights.closeWindow();" - } - StateMachine { - Transition init: initial -> running { - action { - "carLights=lights.getCarLights();" - "pedLights=lights.getPedLights();" - "carLights.setState(TrafficLight3.OFF);" - "pedLights.setState(TrafficLight2.OFF);" - "lights.setPort(ControlPort);" - } - } - Transition tr0: running -> running { - triggers { - <setCarLights: ControlPort> - } - action { - "carLights.setState(state);" - } - } - Transition tr1: running -> running { - triggers { - <setPedLights: ControlPort> - } - action { - "pedLights.setState(state);" - } - } - State running - } - } - } - - ActorClass Controller { - Interface { - Port ControlPort: PedControlProtocol - } - Structure { - usercode1 { - "import org.eclipse.etrice.tutorials.PedLightGUI.*;" - } - external Port ControlPort - SAP timer: PTimeout - } - Behavior { - StateMachine { - Transition init: initial -> off { } - Transition tr0: off -> carsGreen { - triggers { - <start: ControlPort> - } - action { - "timer.Start(700);" - "ControlPort.setCarLights(TrafficLight3.GREEN);" - "ControlPort.setPedLights(TrafficLight2.RED);" - } - } - Transition tr1: carsGreen -> carsYellow { - triggers { - <timeoutTick: timer> - } - action { - "timer.Start(700);" - "ControlPort.setCarLights(TrafficLight3.YELLOW);" - "ControlPort.setPedLights(TrafficLight2.RED);" - } - } - Transition tr2: carsYellow -> carsRed { - triggers { - <timeoutTick: timer> - } - action { - "timer.Start(1500);" - "ControlPort.setCarLights(TrafficLight3.RED);" - "ControlPort.setPedLights(TrafficLight2.GREEN);" - } - } - Transition tr3: carsRed -> carsYellowRed { - triggers { - <timeoutTick: timer> - } - action { - "timer.Start(700);" - "ControlPort.setCarLights(TrafficLight3.YELLOW_RED);" - "ControlPort.setPedLights(TrafficLight2.RED);" - } - } - Transition tr4: carsYellowRed -> carsGreen2 { - triggers { - <timeoutTick: timer> - } - action { - "timer.Start(700);" - "ControlPort.setCarLights(TrafficLight3.GREEN);" - "ControlPort.setPedLights(TrafficLight2.RED);" - } - } - Transition tr5: carsGreen2 -> off { - triggers { - <timeoutTick: timer> - } - action { - "ControlPort.setCarLights(TrafficLight3.OFF);" - "ControlPort.setPedLights(TrafficLight2.OFF);" - } - } - State off - State carsGreen - State carsYellow - State carsRed - State carsYellowRed - State carsGreen2 - } - } - } - - ProtocolClass PedControlProtocol { - incoming { - Message start() - } - outgoing { - Message setCarLights(state: int32) - Message setPedLights(state: int32) - } - } - +RoomModel PedLightsController {
+
+ import room.basic.service.timing.* from "../../../org.eclipse.etrice.modellib/models/TimingService.room"
+ import room.basic.types.java.* from "../../../org.eclipse.etrice.modellib/models/JavaTypes.room"
+
+ LogicalSystem LogSys_PedLights {
+ SubSystemRef application: SubSys_PedLights
+ }
+
+ SubSystemClass SubSys_PedLights {
+ ActorRef PedLightsTopRef: PedLightsTop
+ ActorRef timingService: ATimingService
+ LayerConnection ref PedLightsTopRef satisfied_by timingService.timer
+ LayerConnection ref PedLightsTopRef satisfied_by timingService.timeout
+ }
+
+ ActorClass PedLightsTop {
+ Structure {
+ ActorRef adapter: GuiAdapter
+ ActorRef controller: Controller
+ Binding adapter.ControlPort and controller.ControlPort
+ }
+ Behavior { }
+ }
+
+ ActorClass GuiAdapter {
+ Interface {
+ conjugated Port ControlPort: PedControlProtocol
+ }
+ Structure {
+ usercode1 {
+ "import org.eclipse.etrice.tutorials.PedLightGUI.*;"
+ }
+ usercode2 {
+ "private PedestrianLightWndNoTcp lights = new PedestrianLightWndNoTcp(\"Pedestrian Lights\",\" external port connection \");"
+ "private TrafficLight3 carLights;"
+ "private TrafficLight2 pedLights;"
+ }
+ external Port ControlPort
+ }
+ Behavior {
+ Operation destroyUser() {
+ "lights.closeWindow();"
+ }
+ StateMachine {
+ Transition init: initial -> running {
+ action {
+ "carLights=lights.getCarLights();"
+ "pedLights=lights.getPedLights();"
+ "carLights.setState(TrafficLight3.OFF);"
+ "pedLights.setState(TrafficLight2.OFF);"
+ "lights.setPort(ControlPort);"
+ }
+ }
+ Transition tr0: running -> running {
+ triggers {
+ <setCarLights: ControlPort>
+ }
+ action {
+ "carLights.setState(state);"
+ }
+ }
+ Transition tr1: running -> running {
+ triggers {
+ <setPedLights: ControlPort>
+ }
+ action {
+ "pedLights.setState(state);"
+ }
+ }
+ State running
+ }
+ }
+ }
+
+ ActorClass Controller {
+ Interface {
+ Port ControlPort: PedControlProtocol
+ }
+ Structure {
+ usercode1 {
+ "import org.eclipse.etrice.tutorials.PedLightGUI.*;"
+ }
+ external Port ControlPort
+ SAP timer: PTimeout
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> off { }
+ Transition tr0: off -> carsGreen {
+ triggers {
+ <start: ControlPort>
+ }
+ action {
+ "timer.Start(700);"
+ "ControlPort.setCarLights(TrafficLight3.GREEN);"
+ "ControlPort.setPedLights(TrafficLight2.RED);"
+ }
+ }
+ Transition tr1: carsGreen -> carsYellow {
+ triggers {
+ <timeoutTick: timer>
+ }
+ action {
+ "timer.Start(700);"
+ "ControlPort.setCarLights(TrafficLight3.YELLOW);"
+ "ControlPort.setPedLights(TrafficLight2.RED);"
+ }
+ }
+ Transition tr2: carsYellow -> carsRed {
+ triggers {
+ <timeoutTick: timer>
+ }
+ action {
+ "timer.Start(1500);"
+ "ControlPort.setCarLights(TrafficLight3.RED);"
+ "ControlPort.setPedLights(TrafficLight2.GREEN);"
+ }
+ }
+ Transition tr3: carsRed -> carsYellowRed {
+ triggers {
+ <timeoutTick: timer>
+ }
+ action {
+ "timer.Start(700);"
+ "ControlPort.setCarLights(TrafficLight3.YELLOW_RED);"
+ "ControlPort.setPedLights(TrafficLight2.RED);"
+ }
+ }
+ Transition tr4: carsYellowRed -> carsGreen2 {
+ triggers {
+ <timeoutTick: timer>
+ }
+ action {
+ "timer.Start(700);"
+ "ControlPort.setCarLights(TrafficLight3.GREEN);"
+ "ControlPort.setPedLights(TrafficLight2.RED);"
+ }
+ }
+ Transition tr5: carsGreen2 -> off {
+ triggers {
+ <timeoutTick: timer>
+ }
+ action {
+ "ControlPort.setCarLights(TrafficLight3.OFF);"
+ "ControlPort.setPedLights(TrafficLight2.OFF);"
+ }
+ }
+ State off
+ State carsGreen
+ State carsYellow
+ State carsRed
+ State carsYellowRed
+ State carsGreen2
+ }
+ }
+ }
+
+ ProtocolClass PedControlProtocol {
+ incoming {
+ Message start()
+ }
+ outgoing {
+ Message setCarLights(state: int32)
+ Message setPedLights(state: int32)
+ }
+ }
+
}
\ No newline at end of file diff --git a/examples/org.eclipse.etrice.tutorials/model/SendingData/SendingData.room b/examples/org.eclipse.etrice.tutorials/model/SendingData/SendingData.room index ed6184d09..fc2bcc25f 100644 --- a/examples/org.eclipse.etrice.tutorials/model/SendingData/SendingData.room +++ b/examples/org.eclipse.etrice.tutorials/model/SendingData/SendingData.room @@ -1,137 +1,139 @@ -RoomModel SendingData { - - LogicalSystem SendingData_LogSystem { - SubSystemRef SendingDataAppl: SendingData_SubSystem - } - - SubSystemClass SendingData_SubSystem { - ActorRef SendigDataTopRef: SendingDataTop - } - - ActorClass SendingDataTop { - Structure { - ActorRef ref0: MrPing - ActorRef ref1: MrPong - Binding ref0.PingPongPort and ref1.PingPongPort - } - Behavior { } - } - - ActorClass MrPing { - Interface { - conjugated Port PingPongPort: PingPongProtocol - } - Structure { - external Port PingPongPort - } - Behavior { - - Operation printData(d: DemoData) : void { - "System.out.printf(\"d.int32Val: %d\\n\",d.int32Val);" - "System.out.printf(\"d.float64Val: %f\\n\",d.float64Val);" - "System.out.printf(\"d.int8Array: \");" - "for(int i = 0; i<d.int8Array.length; i++) {" - "System.out.printf(\"%d \",d.int8Array[i]);}" - "System.out.printf(\"\\nd.stringVal: %s\\n\",d.stringVal);" - } - - StateMachine { - Transition wait2: waitForPong -> waitForPong { - triggers { - <pong: PingPongPort> - } - action { - "printData(data);" - } - } - Transition wait1: waitForPongSimple -> waitForPongSimple { - triggers { - <pongSimple: PingPongPort guard { - "data < 10" - }> - } - action { - "// keep in mind that MrPong increments" - "PingPongPort.pingSimple(data);" - "System.out.printf(\"data: %d\\n\",data);" - } - } - Transition next: waitForPongSimple -> waitForPong { - triggers { - <pongSimple: PingPongPort> - } - action { - "System.out.printf(\"data: %d\\n\",data);" - "" - "DemoData d = new DemoData();" - "// send the default values" - "PingPongPort.ping(d);" - "d.int32Val=815;" - "for (int i = 0; i<d.int8Array.length;i++){" - "\td.int8Array[i]=(byte)(i+100);" - "\t}" - "d.stringVal=\"some contents\";" - "d.float64Val=3.141234;" - "PingPongPort.ping(d);" - } - } - Transition init0: initial -> waitForPongSimple { - action { - "PingPongPort.pingSimple(0);" - } - } - State waitForPong - State waitForPongSimple - } - } - } - - ActorClass MrPong { - Interface { - Port PingPongPort: PingPongProtocol - } - Structure { - external Port PingPongPort - } - Behavior { - StateMachine { - Transition init: initial -> looping { } - Transition tr0: looping -> looping { - triggers { - <ping: PingPongPort> - } - action { - "PingPongPort.pong(data);" - } - } - Transition tr1: looping -> looping { - triggers { - <pingSimple: PingPongPort> - } - action { - "PingPongPort.pongSimple(data+1);" - } - } - State looping - } - } - } - - ProtocolClass PingPongProtocol { - incoming { - Message ping(data: DemoData) - Message pingSimple(data: int32) - } - outgoing { - Message pong(data: DemoData) - Message pongSimple(data: int32) - } - } - - DataClass DemoData { - Attribute int32Val: int32 = "4711" - Attribute int8Array [ 10 ]: int8 = "{1,2,3,4,5,6,7,8,9,10}" - Attribute float64Val: float64 = "0.0" - Attribute stringVal: string = "\"empty\"" - } +RoomModel SendingData {
+
+ import room.basic.types.java.* from "../../../org.eclipse.etrice.modellib/models/JavaTypes.room"
+
+ LogicalSystem SendingData_LogSystem {
+ SubSystemRef SendingDataAppl: SendingData_SubSystem
+ }
+
+ SubSystemClass SendingData_SubSystem {
+ ActorRef SendigDataTopRef: SendingDataTop
+ }
+
+ ActorClass SendingDataTop {
+ Structure {
+ ActorRef ref0: MrPing
+ ActorRef ref1: MrPong
+ Binding ref0.PingPongPort and ref1.PingPongPort
+ }
+ Behavior { }
+ }
+
+ ActorClass MrPing {
+ Interface {
+ conjugated Port PingPongPort: PingPongProtocol
+ }
+ Structure {
+ external Port PingPongPort
+ }
+ Behavior {
+
+ Operation printData(d: DemoData) : void {
+ "System.out.printf(\"d.int32Val: %d\\n\",d.int32Val);"
+ "System.out.printf(\"d.float64Val: %f\\n\",d.float64Val);"
+ "System.out.printf(\"d.int8Array: \");"
+ "for(int i = 0; i<d.int8Array.length; i++) {"
+ "System.out.printf(\"%d \",d.int8Array[i]);}"
+ "System.out.printf(\"\\nd.stringVal: %s\\n\",d.stringVal);"
+ }
+
+ StateMachine {
+ Transition wait2: waitForPong -> waitForPong {
+ triggers {
+ <pong: PingPongPort>
+ }
+ action {
+ "printData(data);"
+ }
+ }
+ Transition wait1: waitForPongSimple -> waitForPongSimple {
+ triggers {
+ <pongSimple: PingPongPort guard {
+ "data < 10"
+ }>
+ }
+ action {
+ "// keep in mind that MrPong increments"
+ "PingPongPort.pingSimple(data);"
+ "System.out.printf(\"data: %d\\n\",data);"
+ }
+ }
+ Transition next: waitForPongSimple -> waitForPong {
+ triggers {
+ <pongSimple: PingPongPort>
+ }
+ action {
+ "System.out.printf(\"data: %d\\n\",data);"
+ ""
+ "DemoData d = new DemoData();"
+ "// send the default values"
+ "PingPongPort.ping(d);"
+ "d.int32Val=815;"
+ "for (int i = 0; i<d.int8Array.length;i++){"
+ "\td.int8Array[i]=(byte)(i+100);"
+ "\t}"
+ "d.stringVal=\"some contents\";"
+ "d.float64Val=3.141234;"
+ "PingPongPort.ping(d);"
+ }
+ }
+ Transition init0: initial -> waitForPongSimple {
+ action {
+ "PingPongPort.pingSimple(0);"
+ }
+ }
+ State waitForPong
+ State waitForPongSimple
+ }
+ }
+ }
+
+ ActorClass MrPong {
+ Interface {
+ Port PingPongPort: PingPongProtocol
+ }
+ Structure {
+ external Port PingPongPort
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> looping { }
+ Transition tr0: looping -> looping {
+ triggers {
+ <ping: PingPongPort>
+ }
+ action {
+ "PingPongPort.pong(data);"
+ }
+ }
+ Transition tr1: looping -> looping {
+ triggers {
+ <pingSimple: PingPongPort>
+ }
+ action {
+ "PingPongPort.pongSimple(data+1);"
+ }
+ }
+ State looping
+ }
+ }
+ }
+
+ ProtocolClass PingPongProtocol {
+ incoming {
+ Message ping(data: DemoData)
+ Message pingSimple(data: int32)
+ }
+ outgoing {
+ Message pong(data: DemoData)
+ Message pongSimple(data: int32)
+ }
+ }
+
+ DataClass DemoData {
+ Attribute int32Val: int32 = "4711"
+ Attribute int8Array [10]: int8 = "{1,2,3,4,5,6,7,8,9,10}"
+ Attribute float64Val: float64 = "0.0"
+ Attribute stringVal: string = "\"empty\""
+ }
}
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g b/plugins/org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g index 6154389b2..8fd38aebb 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g +++ b/plugins/org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g @@ -21096,7 +21096,7 @@ finally { } -RULE_MULTIPLICITY : '[' ('*'|('0'..'9')+) ']'; +RULE_MULTIPLICITY : '[' (' '|'\t')* ('*'|('0'..'9')+) (' '|'\t')* ']'; RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; diff --git a/plugins/org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoomLexer.java b/plugins/org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoomLexer.java index 4e0867fd0..ee115f14b 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoomLexer.java +++ b/plugins/org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoomLexer.java @@ -1983,52 +1983,85 @@ public class InternalRoomLexer extends Lexer { try {
int _type = RULE_MULTIPLICITY;
int _channel = DEFAULT_TOKEN_CHANNEL;
- // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:19: ( '[' ( '*' | ( '0' .. '9' )+ ) ']' )
- // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:21: '[' ( '*' | ( '0' .. '9' )+ ) ']'
+ // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:19: ( '[' ( ' ' | '\\t' )* ( '*' | ( '0' .. '9' )+ ) ( ' ' | '\\t' )* ']' )
+ // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:21: '[' ( ' ' | '\\t' )* ( '*' | ( '0' .. '9' )+ ) ( ' ' | '\\t' )* ']'
{
match('[');
- // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:25: ( '*' | ( '0' .. '9' )+ )
- int alt2=2;
- int LA2_0 = input.LA(1);
+ // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:25: ( ' ' | '\\t' )*
+ loop1:
+ do {
+ int alt1=2;
+ int LA1_0 = input.LA(1);
+
+ if ( (LA1_0=='\t'||LA1_0==' ') ) {
+ alt1=1;
+ }
+
+
+ switch (alt1) {
+ case 1 :
+ // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:
+ {
+ if ( input.LA(1)=='\t'||input.LA(1)==' ' ) {
+ input.consume();
- if ( (LA2_0=='*') ) {
- alt2=1;
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;}
+
+
+ }
+ break;
+
+ default :
+ break loop1;
+ }
+ } while (true);
+
+ // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:37: ( '*' | ( '0' .. '9' )+ )
+ int alt3=2;
+ int LA3_0 = input.LA(1);
+
+ if ( (LA3_0=='*') ) {
+ alt3=1;
}
- else if ( ((LA2_0>='0' && LA2_0<='9')) ) {
- alt2=2;
+ else if ( ((LA3_0>='0' && LA3_0<='9')) ) {
+ alt3=2;
}
else {
NoViableAltException nvae =
- new NoViableAltException("", 2, 0, input);
+ new NoViableAltException("", 3, 0, input);
throw nvae;
}
- switch (alt2) {
+ switch (alt3) {
case 1 :
- // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:26: '*'
+ // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:38: '*'
{
match('*');
}
break;
case 2 :
- // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:30: ( '0' .. '9' )+
+ // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:42: ( '0' .. '9' )+
{
- // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:30: ( '0' .. '9' )+
- int cnt1=0;
- loop1:
+ // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:42: ( '0' .. '9' )+
+ int cnt2=0;
+ loop2:
do {
- int alt1=2;
- int LA1_0 = input.LA(1);
+ int alt2=2;
+ int LA2_0 = input.LA(1);
- if ( ((LA1_0>='0' && LA1_0<='9')) ) {
- alt1=1;
+ if ( ((LA2_0>='0' && LA2_0<='9')) ) {
+ alt2=1;
}
- switch (alt1) {
+ switch (alt2) {
case 1 :
- // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:31: '0' .. '9'
+ // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:43: '0' .. '9'
{
matchRange('0','9');
@@ -2036,12 +2069,12 @@ public class InternalRoomLexer extends Lexer { break;
default :
- if ( cnt1 >= 1 ) break loop1;
+ if ( cnt2 >= 1 ) break loop2;
EarlyExitException eee =
- new EarlyExitException(1, input);
+ new EarlyExitException(2, input);
throw eee;
}
- cnt1++;
+ cnt2++;
} while (true);
@@ -2050,6 +2083,39 @@ public class InternalRoomLexer extends Lexer { }
+ // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21099:55: ( ' ' | '\\t' )*
+ loop4:
+ do {
+ int alt4=2;
+ int LA4_0 = input.LA(1);
+
+ if ( (LA4_0=='\t'||LA4_0==' ') ) {
+ alt4=1;
+ }
+
+
+ switch (alt4) {
+ case 1 :
+ // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:
+ {
+ if ( input.LA(1)=='\t'||input.LA(1)==' ' ) {
+ input.consume();
+
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;}
+
+
+ }
+ break;
+
+ default :
+ break loop4;
+ }
+ } while (true);
+
match(']');
}
@@ -2071,13 +2137,13 @@ public class InternalRoomLexer extends Lexer { // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21101:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
{
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21101:11: ( '^' )?
- int alt3=2;
- int LA3_0 = input.LA(1);
+ int alt5=2;
+ int LA5_0 = input.LA(1);
- if ( (LA3_0=='^') ) {
- alt3=1;
+ if ( (LA5_0=='^') ) {
+ alt5=1;
}
- switch (alt3) {
+ switch (alt5) {
case 1 :
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21101:11: '^'
{
@@ -2098,17 +2164,17 @@ public class InternalRoomLexer extends Lexer { throw mse;}
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21101:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
- loop4:
+ loop6:
do {
- int alt4=2;
- int LA4_0 = input.LA(1);
+ int alt6=2;
+ int LA6_0 = input.LA(1);
- if ( ((LA4_0>='0' && LA4_0<='9')||(LA4_0>='A' && LA4_0<='Z')||LA4_0=='_'||(LA4_0>='a' && LA4_0<='z')) ) {
- alt4=1;
+ if ( ((LA6_0>='0' && LA6_0<='9')||(LA6_0>='A' && LA6_0<='Z')||LA6_0=='_'||(LA6_0>='a' && LA6_0<='z')) ) {
+ alt6=1;
}
- switch (alt4) {
+ switch (alt6) {
case 1 :
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:
{
@@ -2126,7 +2192,7 @@ public class InternalRoomLexer extends Lexer { break;
default :
- break loop4;
+ break loop6;
}
} while (true);
@@ -2150,18 +2216,18 @@ public class InternalRoomLexer extends Lexer { // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21103:12: ( '0' .. '9' )+
{
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21103:12: ( '0' .. '9' )+
- int cnt5=0;
- loop5:
+ int cnt7=0;
+ loop7:
do {
- int alt5=2;
- int LA5_0 = input.LA(1);
+ int alt7=2;
+ int LA7_0 = input.LA(1);
- if ( ((LA5_0>='0' && LA5_0<='9')) ) {
- alt5=1;
+ if ( ((LA7_0>='0' && LA7_0<='9')) ) {
+ alt7=1;
}
- switch (alt5) {
+ switch (alt7) {
case 1 :
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21103:13: '0' .. '9'
{
@@ -2171,12 +2237,12 @@ public class InternalRoomLexer extends Lexer { break;
default :
- if ( cnt5 >= 1 ) break loop5;
+ if ( cnt7 >= 1 ) break loop7;
EarlyExitException eee =
- new EarlyExitException(5, input);
+ new EarlyExitException(7, input);
throw eee;
}
- cnt5++;
+ cnt7++;
} while (true);
@@ -2199,41 +2265,41 @@ public class InternalRoomLexer extends Lexer { // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21105:15: ( '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
{
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21105:15: ( '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
- int alt8=2;
- int LA8_0 = input.LA(1);
+ int alt10=2;
+ int LA10_0 = input.LA(1);
- if ( (LA8_0=='\"') ) {
- alt8=1;
+ if ( (LA10_0=='\"') ) {
+ alt10=1;
}
- else if ( (LA8_0=='\'') ) {
- alt8=2;
+ else if ( (LA10_0=='\'') ) {
+ alt10=2;
}
else {
NoViableAltException nvae =
- new NoViableAltException("", 8, 0, input);
+ new NoViableAltException("", 10, 0, input);
throw nvae;
}
- switch (alt8) {
+ switch (alt10) {
case 1 :
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21105:16: '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
{
match('\"');
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21105:20: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )*
- loop6:
+ loop8:
do {
- int alt6=3;
- int LA6_0 = input.LA(1);
+ int alt8=3;
+ int LA8_0 = input.LA(1);
- if ( (LA6_0=='\\') ) {
- alt6=1;
+ if ( (LA8_0=='\\') ) {
+ alt8=1;
}
- else if ( ((LA6_0>='\u0000' && LA6_0<='!')||(LA6_0>='#' && LA6_0<='[')||(LA6_0>=']' && LA6_0<='\uFFFF')) ) {
- alt6=2;
+ else if ( ((LA8_0>='\u0000' && LA8_0<='!')||(LA8_0>='#' && LA8_0<='[')||(LA8_0>=']' && LA8_0<='\uFFFF')) ) {
+ alt8=2;
}
- switch (alt6) {
+ switch (alt8) {
case 1 :
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21105:21: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' )
{
@@ -2267,7 +2333,7 @@ public class InternalRoomLexer extends Lexer { break;
default :
- break loop6;
+ break loop8;
}
} while (true);
@@ -2280,20 +2346,20 @@ public class InternalRoomLexer extends Lexer { {
match('\'');
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21105:91: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )*
- loop7:
+ loop9:
do {
- int alt7=3;
- int LA7_0 = input.LA(1);
+ int alt9=3;
+ int LA9_0 = input.LA(1);
- if ( (LA7_0=='\\') ) {
- alt7=1;
+ if ( (LA9_0=='\\') ) {
+ alt9=1;
}
- else if ( ((LA7_0>='\u0000' && LA7_0<='&')||(LA7_0>='(' && LA7_0<='[')||(LA7_0>=']' && LA7_0<='\uFFFF')) ) {
- alt7=2;
+ else if ( ((LA9_0>='\u0000' && LA9_0<='&')||(LA9_0>='(' && LA9_0<='[')||(LA9_0>=']' && LA9_0<='\uFFFF')) ) {
+ alt9=2;
}
- switch (alt7) {
+ switch (alt9) {
case 1 :
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21105:92: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' )
{
@@ -2327,7 +2393,7 @@ public class InternalRoomLexer extends Lexer { break;
default :
- break loop7;
+ break loop9;
}
} while (true);
@@ -2360,29 +2426,29 @@ public class InternalRoomLexer extends Lexer { match("/*");
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21107:24: ( options {greedy=false; } : . )*
- loop9:
+ loop11:
do {
- int alt9=2;
- int LA9_0 = input.LA(1);
+ int alt11=2;
+ int LA11_0 = input.LA(1);
- if ( (LA9_0=='*') ) {
- int LA9_1 = input.LA(2);
+ if ( (LA11_0=='*') ) {
+ int LA11_1 = input.LA(2);
- if ( (LA9_1=='/') ) {
- alt9=2;
+ if ( (LA11_1=='/') ) {
+ alt11=2;
}
- else if ( ((LA9_1>='\u0000' && LA9_1<='.')||(LA9_1>='0' && LA9_1<='\uFFFF')) ) {
- alt9=1;
+ else if ( ((LA11_1>='\u0000' && LA11_1<='.')||(LA11_1>='0' && LA11_1<='\uFFFF')) ) {
+ alt11=1;
}
}
- else if ( ((LA9_0>='\u0000' && LA9_0<=')')||(LA9_0>='+' && LA9_0<='\uFFFF')) ) {
- alt9=1;
+ else if ( ((LA11_0>='\u0000' && LA11_0<=')')||(LA11_0>='+' && LA11_0<='\uFFFF')) ) {
+ alt11=1;
}
- switch (alt9) {
+ switch (alt11) {
case 1 :
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21107:52: .
{
@@ -2392,7 +2458,7 @@ public class InternalRoomLexer extends Lexer { break;
default :
- break loop9;
+ break loop11;
}
} while (true);
@@ -2420,17 +2486,17 @@ public class InternalRoomLexer extends Lexer { match("//");
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21109:24: (~ ( ( '\\n' | '\\r' ) ) )*
- loop10:
+ loop12:
do {
- int alt10=2;
- int LA10_0 = input.LA(1);
+ int alt12=2;
+ int LA12_0 = input.LA(1);
- if ( ((LA10_0>='\u0000' && LA10_0<='\t')||(LA10_0>='\u000B' && LA10_0<='\f')||(LA10_0>='\u000E' && LA10_0<='\uFFFF')) ) {
- alt10=1;
+ if ( ((LA12_0>='\u0000' && LA12_0<='\t')||(LA12_0>='\u000B' && LA12_0<='\f')||(LA12_0>='\u000E' && LA12_0<='\uFFFF')) ) {
+ alt12=1;
}
- switch (alt10) {
+ switch (alt12) {
case 1 :
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21109:24: ~ ( ( '\\n' | '\\r' ) )
{
@@ -2448,29 +2514,29 @@ public class InternalRoomLexer extends Lexer { break;
default :
- break loop10;
+ break loop12;
}
} while (true);
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21109:40: ( ( '\\r' )? '\\n' )?
- int alt12=2;
- int LA12_0 = input.LA(1);
+ int alt14=2;
+ int LA14_0 = input.LA(1);
- if ( (LA12_0=='\n'||LA12_0=='\r') ) {
- alt12=1;
+ if ( (LA14_0=='\n'||LA14_0=='\r') ) {
+ alt14=1;
}
- switch (alt12) {
+ switch (alt14) {
case 1 :
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21109:41: ( '\\r' )? '\\n'
{
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21109:41: ( '\\r' )?
- int alt11=2;
- int LA11_0 = input.LA(1);
+ int alt13=2;
+ int LA13_0 = input.LA(1);
- if ( (LA11_0=='\r') ) {
- alt11=1;
+ if ( (LA13_0=='\r') ) {
+ alt13=1;
}
- switch (alt11) {
+ switch (alt13) {
case 1 :
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21109:41: '\\r'
{
@@ -2508,18 +2574,18 @@ public class InternalRoomLexer extends Lexer { // ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21111:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
{
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:21111:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
- int cnt13=0;
- loop13:
+ int cnt15=0;
+ loop15:
do {
- int alt13=2;
- int LA13_0 = input.LA(1);
+ int alt15=2;
+ int LA15_0 = input.LA(1);
- if ( ((LA13_0>='\t' && LA13_0<='\n')||LA13_0=='\r'||LA13_0==' ') ) {
- alt13=1;
+ if ( ((LA15_0>='\t' && LA15_0<='\n')||LA15_0=='\r'||LA15_0==' ') ) {
+ alt15=1;
}
- switch (alt13) {
+ switch (alt15) {
case 1 :
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:
{
@@ -2537,12 +2603,12 @@ public class InternalRoomLexer extends Lexer { break;
default :
- if ( cnt13 >= 1 ) break loop13;
+ if ( cnt15 >= 1 ) break loop15;
EarlyExitException eee =
- new EarlyExitException(13, input);
+ new EarlyExitException(15, input);
throw eee;
}
- cnt13++;
+ cnt15++;
} while (true);
@@ -2578,9 +2644,9 @@ public class InternalRoomLexer extends Lexer { public void mTokens() throws RecognitionException {
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:1:8: ( T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | T__54 | T__55 | T__56 | T__57 | T__58 | T__59 | T__60 | T__61 | T__62 | T__63 | T__64 | T__65 | T__66 | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | T__74 | T__75 | T__76 | T__77 | T__78 | T__79 | T__80 | T__81 | T__82 | T__83 | T__84 | T__85 | T__86 | T__87 | T__88 | T__89 | T__90 | T__91 | T__92 | T__93 | T__94 | T__95 | T__96 | T__97 | T__98 | T__99 | T__100 | RULE_MULTIPLICITY | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
- int alt14=97;
- alt14 = dfa14.predict(input);
- switch (alt14) {
+ int alt16=97;
+ alt16 = dfa16.predict(input);
+ switch (alt16) {
case 1 :
// ../org.eclipse.etrice.core.room.ui/src-gen/org/eclipse/etrice/core/ui/contentassist/antlr/internal/InternalRoom.g:1:10: T__12
{
@@ -3266,8 +3332,8 @@ public class InternalRoomLexer extends Lexer { }
- protected DFA14 dfa14 = new DFA14(this);
- static final String DFA14_eotS =
+ protected DFA16 dfa16 = new DFA16(this);
+ static final String DFA16_eotS =
"\1\uffff\3\67\3\uffff\1\67\1\65\1\67\2\uffff\5\67\1\uffff\1\67"+
"\1\uffff\14\67\1\uffff\5\67\3\uffff\1\166\2\uffff\1\67\1\uffff\1"+
"\65\2\uffff\3\65\2\uffff\1\67\1\uffff\1\67\1\u0082\2\67\3\uffff"+
@@ -3294,13 +3360,13 @@ public class InternalRoomLexer extends Lexer { "\67\1\u0225\5\67\2\uffff\1\u022b\1\u022c\3\uffff\1\67\1\uffff\1"+
"\67\1\u022f\1\u0230\2\67\2\uffff\1\67\1\u0234\2\uffff\3\67\1\uffff"+
"\1\u0238\1\u0239\1\67\2\uffff\4\67\1\u023f\1\uffff";
- static final String DFA14_eofS =
+ static final String DFA16_eofS =
"\u0240\uffff";
- static final String DFA14_minS =
+ static final String DFA16_minS =
"\1\0\2\157\1\145\3\uffff\1\157\1\76\1\141\2\uffff\1\156\1\141\1"+
"\156\1\163\1\143\1\uffff\1\160\1\uffff\1\141\1\155\1\146\1\145\1"+
"\157\1\145\1\141\1\156\1\101\1\145\1\141\1\162\1\uffff\1\142\1\162"+
- "\1\150\1\162\1\165\3\uffff\1\52\2\uffff\1\162\1\uffff\1\101\2\uffff"+
+ "\1\150\1\162\1\165\3\uffff\1\11\2\uffff\1\162\1\uffff\1\101\2\uffff"+
"\2\0\1\52\2\uffff\1\151\1\uffff\1\144\1\60\1\157\1\146\3\uffff\1"+
"\151\1\162\1\uffff\1\146\1\60\1\164\2\uffff\1\151\2\164\1\151\1"+
"\164\1\145\2\164\1\uffff\1\145\1\uffff\1\155\1\164\1\142\1\143\1"+
@@ -3345,7 +3411,7 @@ public class InternalRoomLexer extends Lexer { "\2\uffff\2\60\3\uffff\1\145\1\uffff\1\163\2\60\1\157\1\156\2\uffff"+
"\1\156\1\60\2\uffff\1\156\2\164\1\uffff\2\60\1\141\2\uffff\1\164"+
"\1\151\1\157\1\156\1\60\1\uffff";
- static final String DFA14_maxS =
+ static final String DFA16_maxS =
"\1\uffff\1\157\1\171\1\157\3\uffff\1\162\1\76\1\157\2\uffff\1\170"+
"\1\141\1\170\1\163\1\164\1\uffff\1\160\1\uffff\1\165\1\156\1\165"+
"\1\145\1\160\1\145\1\141\1\156\1\165\1\151\1\157\1\162\1\uffff\1"+
@@ -3395,7 +3461,7 @@ public class InternalRoomLexer extends Lexer { "\1\145\1\uffff\1\163\2\172\1\157\1\156\2\uffff\1\156\1\172\2\uffff"+
"\1\156\2\164\1\uffff\2\172\1\141\2\uffff\1\164\1\151\1\157\1\156"+
"\1\172\1\uffff";
- static final String DFA14_acceptS =
+ static final String DFA16_acceptS =
"\4\uffff\1\4\1\5\1\6\3\uffff\1\12\1\13\5\uffff\1\23\1\uffff\1\25"+
"\14\uffff\1\60\5\uffff\1\114\1\115\1\116\1\uffff\1\120\1\121\1\uffff"+
"\1\124\1\uffff\1\133\1\134\3\uffff\1\140\1\141\1\uffff\1\133\4\uffff"+
@@ -3415,9 +3481,9 @@ public class InternalRoomLexer extends Lexer { "\1\103\4\uffff\1\130\12\uffff\1\102\1\76\2\uffff\1\14\1\64\1\70"+
"\1\uffff\1\54\5\uffff\1\7\1\27\2\uffff\1\53\1\56\3\uffff\1\55\3"+
"\uffff\1\63\1\77\5\uffff\1\51";
- static final String DFA14_specialS =
- "\1\0\60\uffff\1\2\1\1\u020d\uffff}>";
- static final String[] DFA14_transitionS = {
+ static final String DFA16_specialS =
+ "\1\0\60\uffff\1\1\1\2\u020d\uffff}>";
+ static final String[] DFA16_transitionS = {
"\11\65\2\64\2\65\1\64\22\65\1\64\1\65\1\61\4\65\1\62\1\12\1"+
"\13\1\55\1\65\1\23\1\10\1\40\1\63\12\60\1\6\1\65\1\46\1\21\1"+
"\47\1\65\1\53\1\20\1\35\1\43\1\15\1\14\3\57\1\33\2\57\1\36\1"+
@@ -3465,7 +3531,7 @@ public class InternalRoomLexer extends Lexer { "",
"",
"",
- "\1\165\5\uffff\12\165",
+ "\1\165\26\uffff\1\165\11\uffff\1\165\5\uffff\12\165",
"",
"",
"\1\171",
@@ -4008,34 +4074,34 @@ public class InternalRoomLexer extends Lexer { ""
};
- static final short[] DFA14_eot = DFA.unpackEncodedString(DFA14_eotS);
- static final short[] DFA14_eof = DFA.unpackEncodedString(DFA14_eofS);
- static final char[] DFA14_min = DFA.unpackEncodedStringToUnsignedChars(DFA14_minS);
- static final char[] DFA14_max = DFA.unpackEncodedStringToUnsignedChars(DFA14_maxS);
- static final short[] DFA14_accept = DFA.unpackEncodedString(DFA14_acceptS);
- static final short[] DFA14_special = DFA.unpackEncodedString(DFA14_specialS);
- static final short[][] DFA14_transition;
+ static final short[] DFA16_eot = DFA.unpackEncodedString(DFA16_eotS);
+ static final short[] DFA16_eof = DFA.unpackEncodedString(DFA16_eofS);
+ static final char[] DFA16_min = DFA.unpackEncodedStringToUnsignedChars(DFA16_minS);
+ static final char[] DFA16_max = DFA.unpackEncodedStringToUnsignedChars(DFA16_maxS);
+ static final short[] DFA16_accept = DFA.unpackEncodedString(DFA16_acceptS);
+ static final short[] DFA16_special = DFA.unpackEncodedString(DFA16_specialS);
+ static final short[][] DFA16_transition;
static {
- int numStates = DFA14_transitionS.length;
- DFA14_transition = new short[numStates][];
+ int numStates = DFA16_transitionS.length;
+ DFA16_transition = new short[numStates][];
for (int i=0; i<numStates; i++) {
- DFA14_transition[i] = DFA.unpackEncodedString(DFA14_transitionS[i]);
+ DFA16_transition[i] = DFA.unpackEncodedString(DFA16_transitionS[i]);
}
}
- class DFA14 extends DFA {
+ class DFA16 extends DFA {
- public DFA14(BaseRecognizer recognizer) {
+ public DFA16(BaseRecognizer recognizer) {
this.recognizer = recognizer;
- this.decisionNumber = 14;
- this.eot = DFA14_eot;
- this.eof = DFA14_eof;
- this.min = DFA14_min;
- this.max = DFA14_max;
- this.accept = DFA14_accept;
- this.special = DFA14_special;
- this.transition = DFA14_transition;
+ this.decisionNumber = 16;
+ this.eot = DFA16_eot;
+ this.eof = DFA16_eof;
+ this.min = DFA16_min;
+ this.max = DFA16_max;
+ this.accept = DFA16_accept;
+ this.special = DFA16_special;
+ this.transition = DFA16_transition;
}
public String getDescription() {
return "1:1: Tokens : ( T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | T__54 | T__55 | T__56 | T__57 | T__58 | T__59 | T__60 | T__61 | T__62 | T__63 | T__64 | T__65 | T__66 | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | T__74 | T__75 | T__76 | T__77 | T__78 | T__79 | T__80 | T__81 | T__82 | T__83 | T__84 | T__85 | T__86 | T__87 | T__88 | T__89 | T__90 | T__91 | T__92 | T__93 | T__94 | T__95 | T__96 | T__97 | T__98 | T__99 | T__100 | RULE_MULTIPLICITY | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER );";
@@ -4045,132 +4111,132 @@ public class InternalRoomLexer extends Lexer { int _s = s;
switch ( s ) {
case 0 :
- int LA14_0 = input.LA(1);
+ int LA16_0 = input.LA(1);
s = -1;
- if ( (LA14_0=='v') ) {s = 1;}
+ if ( (LA16_0=='v') ) {s = 1;}
- else if ( (LA14_0=='m') ) {s = 2;}
+ else if ( (LA16_0=='m') ) {s = 2;}
- else if ( (LA14_0=='R') ) {s = 3;}
+ else if ( (LA16_0=='R') ) {s = 3;}
- else if ( (LA14_0=='{') ) {s = 4;}
+ else if ( (LA16_0=='{') ) {s = 4;}
- else if ( (LA14_0=='}') ) {s = 5;}
+ else if ( (LA16_0=='}') ) {s = 5;}
- else if ( (LA14_0==':') ) {s = 6;}
+ else if ( (LA16_0==':') ) {s = 6;}
- else if ( (LA14_0=='P') ) {s = 7;}
+ else if ( (LA16_0=='P') ) {s = 7;}
- else if ( (LA14_0=='-') ) {s = 8;}
+ else if ( (LA16_0=='-') ) {s = 8;}
- else if ( (LA14_0=='d') ) {s = 9;}
+ else if ( (LA16_0=='d') ) {s = 9;}
- else if ( (LA14_0=='(') ) {s = 10;}
+ else if ( (LA16_0=='(') ) {s = 10;}
- else if ( (LA14_0==')') ) {s = 11;}
+ else if ( (LA16_0==')') ) {s = 11;}
- else if ( (LA14_0=='E') ) {s = 12;}
+ else if ( (LA16_0=='E') ) {s = 12;}
- else if ( (LA14_0=='D') ) {s = 13;}
+ else if ( (LA16_0=='D') ) {s = 13;}
- else if ( (LA14_0=='e') ) {s = 14;}
+ else if ( (LA16_0=='e') ) {s = 14;}
- else if ( (LA14_0=='u') ) {s = 15;}
+ else if ( (LA16_0=='u') ) {s = 15;}
- else if ( (LA14_0=='A') ) {s = 16;}
+ else if ( (LA16_0=='A') ) {s = 16;}
- else if ( (LA14_0=='=') ) {s = 17;}
+ else if ( (LA16_0=='=') ) {s = 17;}
- else if ( (LA14_0=='O') ) {s = 18;}
+ else if ( (LA16_0=='O') ) {s = 18;}
- else if ( (LA14_0==',') ) {s = 19;}
+ else if ( (LA16_0==',') ) {s = 19;}
- else if ( (LA14_0=='s') ) {s = 20;}
+ else if ( (LA16_0=='s') ) {s = 20;}
- else if ( (LA14_0=='i') ) {s = 21;}
+ else if ( (LA16_0=='i') ) {s = 21;}
- else if ( (LA14_0=='o') ) {s = 22;}
+ else if ( (LA16_0=='o') ) {s = 22;}
- else if ( (LA14_0=='r') ) {s = 23;}
+ else if ( (LA16_0=='r') ) {s = 23;}
- else if ( (LA14_0=='c') ) {s = 24;}
+ else if ( (LA16_0=='c') ) {s = 24;}
- else if ( (LA14_0=='M') ) {s = 25;}
+ else if ( (LA16_0=='M') ) {s = 25;}
- else if ( (LA14_0=='h') ) {s = 26;}
+ else if ( (LA16_0=='h') ) {s = 26;}
- else if ( (LA14_0=='I') ) {s = 27;}
+ else if ( (LA16_0=='I') ) {s = 27;}
- else if ( (LA14_0=='S') ) {s = 28;}
+ else if ( (LA16_0=='S') ) {s = 28;}
- else if ( (LA14_0=='B') ) {s = 29;}
+ else if ( (LA16_0=='B') ) {s = 29;}
- else if ( (LA14_0=='L') ) {s = 30;}
+ else if ( (LA16_0=='L') ) {s = 30;}
- else if ( (LA14_0=='p') ) {s = 31;}
+ else if ( (LA16_0=='p') ) {s = 31;}
- else if ( (LA14_0=='.') ) {s = 32;}
+ else if ( (LA16_0=='.') ) {s = 32;}
- else if ( (LA14_0=='a') ) {s = 33;}
+ else if ( (LA16_0=='a') ) {s = 33;}
- else if ( (LA14_0=='T') ) {s = 34;}
+ else if ( (LA16_0=='T') ) {s = 34;}
- else if ( (LA14_0=='C') ) {s = 35;}
+ else if ( (LA16_0=='C') ) {s = 35;}
- else if ( (LA14_0=='t') ) {s = 36;}
+ else if ( (LA16_0=='t') ) {s = 36;}
- else if ( (LA14_0=='g') ) {s = 37;}
+ else if ( (LA16_0=='g') ) {s = 37;}
- else if ( (LA14_0=='<') ) {s = 38;}
+ else if ( (LA16_0=='<') ) {s = 38;}
- else if ( (LA14_0=='>') ) {s = 39;}
+ else if ( (LA16_0=='>') ) {s = 39;}
- else if ( (LA14_0=='|') ) {s = 40;}
+ else if ( (LA16_0=='|') ) {s = 40;}
- else if ( (LA14_0=='[') ) {s = 41;}
+ else if ( (LA16_0=='[') ) {s = 41;}
- else if ( (LA14_0==']') ) {s = 42;}
+ else if ( (LA16_0==']') ) {s = 42;}
- else if ( (LA14_0=='@') ) {s = 43;}
+ else if ( (LA16_0=='@') ) {s = 43;}
- else if ( (LA14_0=='f') ) {s = 44;}
+ else if ( (LA16_0=='f') ) {s = 44;}
- else if ( (LA14_0=='*') ) {s = 45;}
+ else if ( (LA16_0=='*') ) {s = 45;}
- else if ( (LA14_0=='^') ) {s = 46;}
+ else if ( (LA16_0=='^') ) {s = 46;}
- else if ( ((LA14_0>='F' && LA14_0<='H')||(LA14_0>='J' && LA14_0<='K')||LA14_0=='N'||LA14_0=='Q'||(LA14_0>='U' && LA14_0<='Z')||LA14_0=='_'||LA14_0=='b'||(LA14_0>='j' && LA14_0<='l')||LA14_0=='n'||LA14_0=='q'||(LA14_0>='w' && LA14_0<='z')) ) {s = 47;}
+ else if ( ((LA16_0>='F' && LA16_0<='H')||(LA16_0>='J' && LA16_0<='K')||LA16_0=='N'||LA16_0=='Q'||(LA16_0>='U' && LA16_0<='Z')||LA16_0=='_'||LA16_0=='b'||(LA16_0>='j' && LA16_0<='l')||LA16_0=='n'||LA16_0=='q'||(LA16_0>='w' && LA16_0<='z')) ) {s = 47;}
- else if ( ((LA14_0>='0' && LA14_0<='9')) ) {s = 48;}
+ else if ( ((LA16_0>='0' && LA16_0<='9')) ) {s = 48;}
- else if ( (LA14_0=='\"') ) {s = 49;}
+ else if ( (LA16_0=='\"') ) {s = 49;}
- else if ( (LA14_0=='\'') ) {s = 50;}
+ else if ( (LA16_0=='\'') ) {s = 50;}
- else if ( (LA14_0=='/') ) {s = 51;}
+ else if ( (LA16_0=='/') ) {s = 51;}
- else if ( ((LA14_0>='\t' && LA14_0<='\n')||LA14_0=='\r'||LA14_0==' ') ) {s = 52;}
+ else if ( ((LA16_0>='\t' && LA16_0<='\n')||LA16_0=='\r'||LA16_0==' ') ) {s = 52;}
- else if ( ((LA14_0>='\u0000' && LA14_0<='\b')||(LA14_0>='\u000B' && LA14_0<='\f')||(LA14_0>='\u000E' && LA14_0<='\u001F')||LA14_0=='!'||(LA14_0>='#' && LA14_0<='&')||LA14_0=='+'||LA14_0==';'||LA14_0=='?'||LA14_0=='\\'||LA14_0=='`'||(LA14_0>='~' && LA14_0<='\uFFFF')) ) {s = 53;}
+ else if ( ((LA16_0>='\u0000' && LA16_0<='\b')||(LA16_0>='\u000B' && LA16_0<='\f')||(LA16_0>='\u000E' && LA16_0<='\u001F')||LA16_0=='!'||(LA16_0>='#' && LA16_0<='&')||LA16_0=='+'||LA16_0==';'||LA16_0=='?'||LA16_0=='\\'||LA16_0=='`'||(LA16_0>='~' && LA16_0<='\uFFFF')) ) {s = 53;}
if ( s>=0 ) return s;
break;
case 1 :
- int LA14_50 = input.LA(1);
+ int LA16_49 = input.LA(1);
s = -1;
- if ( ((LA14_50>='\u0000' && LA14_50<='\uFFFF')) ) {s = 124;}
+ if ( ((LA16_49>='\u0000' && LA16_49<='\uFFFF')) ) {s = 124;}
else s = 53;
if ( s>=0 ) return s;
break;
case 2 :
- int LA14_49 = input.LA(1);
+ int LA16_50 = input.LA(1);
s = -1;
- if ( ((LA14_49>='\u0000' && LA14_49<='\uFFFF')) ) {s = 124;}
+ if ( ((LA16_50>='\u0000' && LA16_50<='\uFFFF')) ) {s = 124;}
else s = 53;
@@ -4178,7 +4244,7 @@ public class InternalRoomLexer extends Lexer { break;
}
NoViableAltException nvae =
- new NoViableAltException(getDescription(), 14, _s, input);
+ new NoViableAltException(getDescription(), 16, _s, input);
error(nvae);
throw nvae;
}
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java index f8f036d9b..737d2c195 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java +++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java @@ -288,7 +288,8 @@ public class RoomLabelProvider extends DefaultEObjectLabelProvider { String type = attr.getType()!=null? (" : "+attr.getType().getName()):"";
String value = (attr.getDefaultValueLiteral()!=null && !attr.getDefaultValueLiteral().isEmpty())?
(" = "+attr.getDefaultValueLiteral()) : "";
- return "Attr "+attr.getName()+type+value;
+ String mult = attr.getSize()>1? ("["+attr.getSize()+"]") : "";
+ return "Attr "+attr.getName()+mult+type+value;
}
StyledString text(Operation op) {
diff --git a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.xmi b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.xmi index 444b25a24..d3f7b3a1d 100644 --- a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.xmi +++ b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.xmi @@ -1770,6 +1770,10 @@ </type>
<alternatives xsi:type="xtext:Group">
<elements xsi:type="xtext:Keyword" value="["/>
+ <elements xsi:type="xtext:Alternatives" cardinality="*">
+ <elements xsi:type="xtext:Keyword" value=" "/>
+ <elements xsi:type="xtext:Keyword" value="	"/>
+ </elements>
<elements xsi:type="xtext:Alternatives">
<elements xsi:type="xtext:Keyword" value="*"/>
<elements xsi:type="xtext:CharacterRange" cardinality="+">
@@ -1777,6 +1781,10 @@ <right value="9"/>
</elements>
</elements>
+ <elements xsi:type="xtext:Alternatives" cardinality="*">
+ <elements xsi:type="xtext:Keyword" value=" "/>
+ <elements xsi:type="xtext:Keyword" value="	"/>
+ </elements>
<elements xsi:type="xtext:Keyword" value="]"/>
</alternatives>
</rules>
diff --git a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g index 2c8098c74..363c28e20 100644 --- a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g +++ b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g @@ -6569,7 +6569,7 @@ ruleFQN returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()] -RULE_MULTIPLICITY : '[' ('*'|('0'..'9')+) ']'; +RULE_MULTIPLICITY : '[' (' '|'\t')* ('*'|('0'..'9')+) (' '|'\t')* ']'; RULE_ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; diff --git a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoomLexer.java b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoomLexer.java index ef283e4f1..d9569a9d4 100644 --- a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoomLexer.java +++ b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoomLexer.java @@ -1983,52 +1983,85 @@ public class InternalRoomLexer extends Lexer { try {
int _type = RULE_MULTIPLICITY;
int _channel = DEFAULT_TOKEN_CHANNEL;
- // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:19: ( '[' ( '*' | ( '0' .. '9' )+ ) ']' )
- // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:21: '[' ( '*' | ( '0' .. '9' )+ ) ']'
+ // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:19: ( '[' ( ' ' | '\\t' )* ( '*' | ( '0' .. '9' )+ ) ( ' ' | '\\t' )* ']' )
+ // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:21: '[' ( ' ' | '\\t' )* ( '*' | ( '0' .. '9' )+ ) ( ' ' | '\\t' )* ']'
{
match('[');
- // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:25: ( '*' | ( '0' .. '9' )+ )
- int alt2=2;
- int LA2_0 = input.LA(1);
+ // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:25: ( ' ' | '\\t' )*
+ loop1:
+ do {
+ int alt1=2;
+ int LA1_0 = input.LA(1);
+
+ if ( (LA1_0=='\t'||LA1_0==' ') ) {
+ alt1=1;
+ }
+
+
+ switch (alt1) {
+ case 1 :
+ // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:
+ {
+ if ( input.LA(1)=='\t'||input.LA(1)==' ' ) {
+ input.consume();
- if ( (LA2_0=='*') ) {
- alt2=1;
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;}
+
+
+ }
+ break;
+
+ default :
+ break loop1;
+ }
+ } while (true);
+
+ // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:37: ( '*' | ( '0' .. '9' )+ )
+ int alt3=2;
+ int LA3_0 = input.LA(1);
+
+ if ( (LA3_0=='*') ) {
+ alt3=1;
}
- else if ( ((LA2_0>='0' && LA2_0<='9')) ) {
- alt2=2;
+ else if ( ((LA3_0>='0' && LA3_0<='9')) ) {
+ alt3=2;
}
else {
NoViableAltException nvae =
- new NoViableAltException("", 2, 0, input);
+ new NoViableAltException("", 3, 0, input);
throw nvae;
}
- switch (alt2) {
+ switch (alt3) {
case 1 :
- // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:26: '*'
+ // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:38: '*'
{
match('*');
}
break;
case 2 :
- // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:30: ( '0' .. '9' )+
+ // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:42: ( '0' .. '9' )+
{
- // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:30: ( '0' .. '9' )+
- int cnt1=0;
- loop1:
+ // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:42: ( '0' .. '9' )+
+ int cnt2=0;
+ loop2:
do {
- int alt1=2;
- int LA1_0 = input.LA(1);
+ int alt2=2;
+ int LA2_0 = input.LA(1);
- if ( ((LA1_0>='0' && LA1_0<='9')) ) {
- alt1=1;
+ if ( ((LA2_0>='0' && LA2_0<='9')) ) {
+ alt2=1;
}
- switch (alt1) {
+ switch (alt2) {
case 1 :
- // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:31: '0' .. '9'
+ // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:43: '0' .. '9'
{
matchRange('0','9');
@@ -2036,12 +2069,12 @@ public class InternalRoomLexer extends Lexer { break;
default :
- if ( cnt1 >= 1 ) break loop1;
+ if ( cnt2 >= 1 ) break loop2;
EarlyExitException eee =
- new EarlyExitException(1, input);
+ new EarlyExitException(2, input);
throw eee;
}
- cnt1++;
+ cnt2++;
} while (true);
@@ -2050,6 +2083,39 @@ public class InternalRoomLexer extends Lexer { }
+ // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6572:55: ( ' ' | '\\t' )*
+ loop4:
+ do {
+ int alt4=2;
+ int LA4_0 = input.LA(1);
+
+ if ( (LA4_0=='\t'||LA4_0==' ') ) {
+ alt4=1;
+ }
+
+
+ switch (alt4) {
+ case 1 :
+ // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:
+ {
+ if ( input.LA(1)=='\t'||input.LA(1)==' ' ) {
+ input.consume();
+
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;}
+
+
+ }
+ break;
+
+ default :
+ break loop4;
+ }
+ } while (true);
+
match(']');
}
@@ -2071,13 +2137,13 @@ public class InternalRoomLexer extends Lexer { // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6574:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
{
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6574:11: ( '^' )?
- int alt3=2;
- int LA3_0 = input.LA(1);
+ int alt5=2;
+ int LA5_0 = input.LA(1);
- if ( (LA3_0=='^') ) {
- alt3=1;
+ if ( (LA5_0=='^') ) {
+ alt5=1;
}
- switch (alt3) {
+ switch (alt5) {
case 1 :
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6574:11: '^'
{
@@ -2098,17 +2164,17 @@ public class InternalRoomLexer extends Lexer { throw mse;}
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6574:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
- loop4:
+ loop6:
do {
- int alt4=2;
- int LA4_0 = input.LA(1);
+ int alt6=2;
+ int LA6_0 = input.LA(1);
- if ( ((LA4_0>='0' && LA4_0<='9')||(LA4_0>='A' && LA4_0<='Z')||LA4_0=='_'||(LA4_0>='a' && LA4_0<='z')) ) {
- alt4=1;
+ if ( ((LA6_0>='0' && LA6_0<='9')||(LA6_0>='A' && LA6_0<='Z')||LA6_0=='_'||(LA6_0>='a' && LA6_0<='z')) ) {
+ alt6=1;
}
- switch (alt4) {
+ switch (alt6) {
case 1 :
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:
{
@@ -2126,7 +2192,7 @@ public class InternalRoomLexer extends Lexer { break;
default :
- break loop4;
+ break loop6;
}
} while (true);
@@ -2150,18 +2216,18 @@ public class InternalRoomLexer extends Lexer { // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6576:12: ( '0' .. '9' )+
{
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6576:12: ( '0' .. '9' )+
- int cnt5=0;
- loop5:
+ int cnt7=0;
+ loop7:
do {
- int alt5=2;
- int LA5_0 = input.LA(1);
+ int alt7=2;
+ int LA7_0 = input.LA(1);
- if ( ((LA5_0>='0' && LA5_0<='9')) ) {
- alt5=1;
+ if ( ((LA7_0>='0' && LA7_0<='9')) ) {
+ alt7=1;
}
- switch (alt5) {
+ switch (alt7) {
case 1 :
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6576:13: '0' .. '9'
{
@@ -2171,12 +2237,12 @@ public class InternalRoomLexer extends Lexer { break;
default :
- if ( cnt5 >= 1 ) break loop5;
+ if ( cnt7 >= 1 ) break loop7;
EarlyExitException eee =
- new EarlyExitException(5, input);
+ new EarlyExitException(7, input);
throw eee;
}
- cnt5++;
+ cnt7++;
} while (true);
@@ -2199,41 +2265,41 @@ public class InternalRoomLexer extends Lexer { // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6578:15: ( '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
{
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6578:15: ( '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
- int alt8=2;
- int LA8_0 = input.LA(1);
+ int alt10=2;
+ int LA10_0 = input.LA(1);
- if ( (LA8_0=='\"') ) {
- alt8=1;
+ if ( (LA10_0=='\"') ) {
+ alt10=1;
}
- else if ( (LA8_0=='\'') ) {
- alt8=2;
+ else if ( (LA10_0=='\'') ) {
+ alt10=2;
}
else {
NoViableAltException nvae =
- new NoViableAltException("", 8, 0, input);
+ new NoViableAltException("", 10, 0, input);
throw nvae;
}
- switch (alt8) {
+ switch (alt10) {
case 1 :
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6578:16: '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
{
match('\"');
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6578:20: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )*
- loop6:
+ loop8:
do {
- int alt6=3;
- int LA6_0 = input.LA(1);
+ int alt8=3;
+ int LA8_0 = input.LA(1);
- if ( (LA6_0=='\\') ) {
- alt6=1;
+ if ( (LA8_0=='\\') ) {
+ alt8=1;
}
- else if ( ((LA6_0>='\u0000' && LA6_0<='!')||(LA6_0>='#' && LA6_0<='[')||(LA6_0>=']' && LA6_0<='\uFFFF')) ) {
- alt6=2;
+ else if ( ((LA8_0>='\u0000' && LA8_0<='!')||(LA8_0>='#' && LA8_0<='[')||(LA8_0>=']' && LA8_0<='\uFFFF')) ) {
+ alt8=2;
}
- switch (alt6) {
+ switch (alt8) {
case 1 :
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6578:21: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' )
{
@@ -2267,7 +2333,7 @@ public class InternalRoomLexer extends Lexer { break;
default :
- break loop6;
+ break loop8;
}
} while (true);
@@ -2280,20 +2346,20 @@ public class InternalRoomLexer extends Lexer { {
match('\'');
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6578:91: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\\'' ) ) )*
- loop7:
+ loop9:
do {
- int alt7=3;
- int LA7_0 = input.LA(1);
+ int alt9=3;
+ int LA9_0 = input.LA(1);
- if ( (LA7_0=='\\') ) {
- alt7=1;
+ if ( (LA9_0=='\\') ) {
+ alt9=1;
}
- else if ( ((LA7_0>='\u0000' && LA7_0<='&')||(LA7_0>='(' && LA7_0<='[')||(LA7_0>=']' && LA7_0<='\uFFFF')) ) {
- alt7=2;
+ else if ( ((LA9_0>='\u0000' && LA9_0<='&')||(LA9_0>='(' && LA9_0<='[')||(LA9_0>=']' && LA9_0<='\uFFFF')) ) {
+ alt9=2;
}
- switch (alt7) {
+ switch (alt9) {
case 1 :
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6578:92: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | 'u' | '\"' | '\\'' | '\\\\' )
{
@@ -2327,7 +2393,7 @@ public class InternalRoomLexer extends Lexer { break;
default :
- break loop7;
+ break loop9;
}
} while (true);
@@ -2360,29 +2426,29 @@ public class InternalRoomLexer extends Lexer { match("/*");
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6580:24: ( options {greedy=false; } : . )*
- loop9:
+ loop11:
do {
- int alt9=2;
- int LA9_0 = input.LA(1);
+ int alt11=2;
+ int LA11_0 = input.LA(1);
- if ( (LA9_0=='*') ) {
- int LA9_1 = input.LA(2);
+ if ( (LA11_0=='*') ) {
+ int LA11_1 = input.LA(2);
- if ( (LA9_1=='/') ) {
- alt9=2;
+ if ( (LA11_1=='/') ) {
+ alt11=2;
}
- else if ( ((LA9_1>='\u0000' && LA9_1<='.')||(LA9_1>='0' && LA9_1<='\uFFFF')) ) {
- alt9=1;
+ else if ( ((LA11_1>='\u0000' && LA11_1<='.')||(LA11_1>='0' && LA11_1<='\uFFFF')) ) {
+ alt11=1;
}
}
- else if ( ((LA9_0>='\u0000' && LA9_0<=')')||(LA9_0>='+' && LA9_0<='\uFFFF')) ) {
- alt9=1;
+ else if ( ((LA11_0>='\u0000' && LA11_0<=')')||(LA11_0>='+' && LA11_0<='\uFFFF')) ) {
+ alt11=1;
}
- switch (alt9) {
+ switch (alt11) {
case 1 :
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6580:52: .
{
@@ -2392,7 +2458,7 @@ public class InternalRoomLexer extends Lexer { break;
default :
- break loop9;
+ break loop11;
}
} while (true);
@@ -2420,17 +2486,17 @@ public class InternalRoomLexer extends Lexer { match("//");
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6582:24: (~ ( ( '\\n' | '\\r' ) ) )*
- loop10:
+ loop12:
do {
- int alt10=2;
- int LA10_0 = input.LA(1);
+ int alt12=2;
+ int LA12_0 = input.LA(1);
- if ( ((LA10_0>='\u0000' && LA10_0<='\t')||(LA10_0>='\u000B' && LA10_0<='\f')||(LA10_0>='\u000E' && LA10_0<='\uFFFF')) ) {
- alt10=1;
+ if ( ((LA12_0>='\u0000' && LA12_0<='\t')||(LA12_0>='\u000B' && LA12_0<='\f')||(LA12_0>='\u000E' && LA12_0<='\uFFFF')) ) {
+ alt12=1;
}
- switch (alt10) {
+ switch (alt12) {
case 1 :
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6582:24: ~ ( ( '\\n' | '\\r' ) )
{
@@ -2448,29 +2514,29 @@ public class InternalRoomLexer extends Lexer { break;
default :
- break loop10;
+ break loop12;
}
} while (true);
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6582:40: ( ( '\\r' )? '\\n' )?
- int alt12=2;
- int LA12_0 = input.LA(1);
+ int alt14=2;
+ int LA14_0 = input.LA(1);
- if ( (LA12_0=='\n'||LA12_0=='\r') ) {
- alt12=1;
+ if ( (LA14_0=='\n'||LA14_0=='\r') ) {
+ alt14=1;
}
- switch (alt12) {
+ switch (alt14) {
case 1 :
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6582:41: ( '\\r' )? '\\n'
{
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6582:41: ( '\\r' )?
- int alt11=2;
- int LA11_0 = input.LA(1);
+ int alt13=2;
+ int LA13_0 = input.LA(1);
- if ( (LA11_0=='\r') ) {
- alt11=1;
+ if ( (LA13_0=='\r') ) {
+ alt13=1;
}
- switch (alt11) {
+ switch (alt13) {
case 1 :
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6582:41: '\\r'
{
@@ -2508,18 +2574,18 @@ public class InternalRoomLexer extends Lexer { // ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6584:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
{
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:6584:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
- int cnt13=0;
- loop13:
+ int cnt15=0;
+ loop15:
do {
- int alt13=2;
- int LA13_0 = input.LA(1);
+ int alt15=2;
+ int LA15_0 = input.LA(1);
- if ( ((LA13_0>='\t' && LA13_0<='\n')||LA13_0=='\r'||LA13_0==' ') ) {
- alt13=1;
+ if ( ((LA15_0>='\t' && LA15_0<='\n')||LA15_0=='\r'||LA15_0==' ') ) {
+ alt15=1;
}
- switch (alt13) {
+ switch (alt15) {
case 1 :
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:
{
@@ -2537,12 +2603,12 @@ public class InternalRoomLexer extends Lexer { break;
default :
- if ( cnt13 >= 1 ) break loop13;
+ if ( cnt15 >= 1 ) break loop15;
EarlyExitException eee =
- new EarlyExitException(13, input);
+ new EarlyExitException(15, input);
throw eee;
}
- cnt13++;
+ cnt15++;
} while (true);
@@ -2578,9 +2644,9 @@ public class InternalRoomLexer extends Lexer { public void mTokens() throws RecognitionException {
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:1:8: ( T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | T__54 | T__55 | T__56 | T__57 | T__58 | T__59 | T__60 | T__61 | T__62 | T__63 | T__64 | T__65 | T__66 | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | T__74 | T__75 | T__76 | T__77 | T__78 | T__79 | T__80 | T__81 | T__82 | T__83 | T__84 | T__85 | T__86 | T__87 | T__88 | T__89 | T__90 | T__91 | T__92 | T__93 | T__94 | T__95 | T__96 | T__97 | T__98 | T__99 | T__100 | RULE_MULTIPLICITY | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
- int alt14=97;
- alt14 = dfa14.predict(input);
- switch (alt14) {
+ int alt16=97;
+ alt16 = dfa16.predict(input);
+ switch (alt16) {
case 1 :
// ../org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/parser/antlr/internal/InternalRoom.g:1:10: T__12
{
@@ -3266,10 +3332,10 @@ public class InternalRoomLexer extends Lexer { }
- protected DFA14 dfa14 = new DFA14(this);
- static final String DFA14_eotS =
+ protected DFA16 dfa16 = new DFA16(this);
+ static final String DFA16_eotS =
"\1\uffff\1\70\3\uffff\2\70\1\65\2\uffff\6\70\1\uffff\1\70\1\uffff"+
- "\15\70\1\uffff\5\70\3\uffff\1\165\2\uffff\1\70\1\uffff\1\65\2\uffff"+
+ "\15\70\1\uffff\5\70\3\uffff\1\166\2\uffff\1\70\1\uffff\1\65\2\uffff"+
"\3\65\2\uffff\2\70\4\uffff\3\70\3\uffff\2\70\1\u008a\10\70\1\uffff"+
"\1\70\1\uffff\7\70\1\u009f\1\u00a0\1\70\1\u00a2\20\70\1\uffff\4"+
"\70\1\u00b8\1\70\7\uffff\1\70\6\uffff\2\70\1\u00bd\7\70\1\uffff"+
@@ -3294,13 +3360,13 @@ public class InternalRoomLexer extends Lexer { "\3\uffff\1\70\1\uffff\1\70\1\u022f\1\u0230\2\70\2\uffff\1\70\1\u0234"+
"\2\uffff\3\70\1\uffff\1\u0238\1\u0239\1\70\2\uffff\4\70\1\u023f"+
"\1\uffff";
- static final String DFA14_eofS =
+ static final String DFA16_eofS =
"\u0240\uffff";
- static final String DFA14_minS =
+ static final String DFA16_minS =
"\1\0\1\145\3\uffff\1\145\1\157\1\76\2\uffff\1\141\1\156\1\141\1"+
"\156\1\163\1\143\1\uffff\1\160\1\uffff\1\157\1\141\1\155\1\146\1"+
"\157\1\162\1\145\1\141\1\142\1\156\1\101\1\145\1\141\1\uffff\1\162"+
- "\1\150\1\162\1\165\1\157\3\uffff\1\52\2\uffff\1\162\1\uffff\1\101"+
+ "\1\150\1\162\1\165\1\157\3\uffff\1\11\2\uffff\1\162\1\uffff\1\101"+
"\2\uffff\2\0\1\52\2\uffff\1\157\1\146\4\uffff\1\146\1\151\1\162"+
"\3\uffff\1\146\1\164\1\60\1\151\2\164\1\151\1\164\1\145\2\164\1"+
"\uffff\1\145\1\uffff\1\151\1\155\1\164\1\142\1\143\1\160\1\164\2"+
@@ -3344,7 +3410,7 @@ public class InternalRoomLexer extends Lexer { "\60\1\163\1\155\1\144\2\151\2\uffff\2\60\3\uffff\1\145\1\uffff\1"+
"\163\2\60\1\157\1\156\2\uffff\1\156\1\60\2\uffff\1\156\2\164\1\uffff"+
"\2\60\1\141\2\uffff\1\164\1\151\1\157\1\156\1\60\1\uffff";
- static final String DFA14_maxS =
+ static final String DFA16_maxS =
"\1\uffff\1\157\3\uffff\1\145\1\162\1\76\2\uffff\1\157\1\170\1\141"+
"\1\170\1\163\1\164\1\uffff\1\160\1\uffff\1\157\1\165\1\156\1\165"+
"\1\160\1\162\1\145\1\141\2\156\1\165\1\151\1\157\1\uffff\1\162\1"+
@@ -3393,12 +3459,12 @@ public class InternalRoomLexer extends Lexer { "\uffff\1\145\1\uffff\1\163\2\172\1\157\1\156\2\uffff\1\156\1\172"+
"\2\uffff\1\156\2\164\1\uffff\2\172\1\141\2\uffff\1\164\1\151\1\157"+
"\1\156\1\172\1\uffff";
- static final String DFA14_acceptS =
+ static final String DFA16_acceptS =
"\2\uffff\1\2\1\3\1\4\3\uffff\1\10\1\11\6\uffff\1\22\1\uffff\1\24"+
"\15\uffff\1\63\5\uffff\1\120\1\121\1\122\1\uffff\1\124\1\125\1\uffff"+
"\1\131\1\uffff\1\133\1\134\3\uffff\1\140\1\141\2\uffff\1\133\1\2"+
"\1\3\1\4\3\uffff\1\7\1\10\1\11\13\uffff\1\22\1\uffff\1\24\33\uffff"+
- "\1\63\6\uffff\1\120\1\121\1\122\1\123\1\132\1\124\1\125\1\uffff"+
+ "\1\63\6\uffff\1\120\1\121\1\122\1\132\1\123\1\124\1\125\1\uffff"+
"\1\131\1\134\1\135\1\136\1\137\1\140\12\uffff\1\77\24\uffff\1\55"+
"\1\113\1\uffff\1\117\25\uffff\1\116\4\uffff\1\5\42\uffff\1\65\4"+
"\uffff\1\52\1\53\23\uffff\1\50\10\uffff\1\76\5\uffff\1\25\11\uffff"+
@@ -3413,9 +3479,9 @@ public class InternalRoomLexer extends Lexer { "\12\uffff\1\106\1\101\2\uffff\1\13\1\67\1\73\1\uffff\1\57\5\uffff"+
"\1\6\1\27\2\uffff\1\56\1\61\3\uffff\1\60\3\uffff\1\66\1\103\5\uffff"+
"\1\54";
- static final String DFA14_specialS =
- "\1\0\60\uffff\1\2\1\1\u020d\uffff}>";
- static final String[] DFA14_transitionS = {
+ static final String DFA16_specialS =
+ "\1\0\60\uffff\1\1\1\2\u020d\uffff}>";
+ static final String[] DFA16_transitionS = {
"\11\65\2\64\2\65\1\64\22\65\1\64\1\65\1\61\4\65\1\62\1\10\1"+
"\11\1\55\1\65\1\22\1\7\1\40\1\63\12\60\1\4\1\65\1\46\1\20\1"+
"\50\1\65\1\53\1\17\1\36\1\42\1\14\1\13\3\57\1\34\2\57\1\37\1"+
@@ -3463,7 +3529,7 @@ public class InternalRoomLexer extends Lexer { "",
"",
"",
- "\1\166\5\uffff\12\166",
+ "\1\165\26\uffff\1\165\11\uffff\1\165\5\uffff\12\165",
"",
"",
"\1\171",
@@ -4006,34 +4072,34 @@ public class InternalRoomLexer extends Lexer { ""
};
- static final short[] DFA14_eot = DFA.unpackEncodedString(DFA14_eotS);
- static final short[] DFA14_eof = DFA.unpackEncodedString(DFA14_eofS);
- static final char[] DFA14_min = DFA.unpackEncodedStringToUnsignedChars(DFA14_minS);
- static final char[] DFA14_max = DFA.unpackEncodedStringToUnsignedChars(DFA14_maxS);
- static final short[] DFA14_accept = DFA.unpackEncodedString(DFA14_acceptS);
- static final short[] DFA14_special = DFA.unpackEncodedString(DFA14_specialS);
- static final short[][] DFA14_transition;
+ static final short[] DFA16_eot = DFA.unpackEncodedString(DFA16_eotS);
+ static final short[] DFA16_eof = DFA.unpackEncodedString(DFA16_eofS);
+ static final char[] DFA16_min = DFA.unpackEncodedStringToUnsignedChars(DFA16_minS);
+ static final char[] DFA16_max = DFA.unpackEncodedStringToUnsignedChars(DFA16_maxS);
+ static final short[] DFA16_accept = DFA.unpackEncodedString(DFA16_acceptS);
+ static final short[] DFA16_special = DFA.unpackEncodedString(DFA16_specialS);
+ static final short[][] DFA16_transition;
static {
- int numStates = DFA14_transitionS.length;
- DFA14_transition = new short[numStates][];
+ int numStates = DFA16_transitionS.length;
+ DFA16_transition = new short[numStates][];
for (int i=0; i<numStates; i++) {
- DFA14_transition[i] = DFA.unpackEncodedString(DFA14_transitionS[i]);
+ DFA16_transition[i] = DFA.unpackEncodedString(DFA16_transitionS[i]);
}
}
- class DFA14 extends DFA {
+ class DFA16 extends DFA {
- public DFA14(BaseRecognizer recognizer) {
+ public DFA16(BaseRecognizer recognizer) {
this.recognizer = recognizer;
- this.decisionNumber = 14;
- this.eot = DFA14_eot;
- this.eof = DFA14_eof;
- this.min = DFA14_min;
- this.max = DFA14_max;
- this.accept = DFA14_accept;
- this.special = DFA14_special;
- this.transition = DFA14_transition;
+ this.decisionNumber = 16;
+ this.eot = DFA16_eot;
+ this.eof = DFA16_eof;
+ this.min = DFA16_min;
+ this.max = DFA16_max;
+ this.accept = DFA16_accept;
+ this.special = DFA16_special;
+ this.transition = DFA16_transition;
}
public String getDescription() {
return "1:1: Tokens : ( T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | T__54 | T__55 | T__56 | T__57 | T__58 | T__59 | T__60 | T__61 | T__62 | T__63 | T__64 | T__65 | T__66 | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | T__74 | T__75 | T__76 | T__77 | T__78 | T__79 | T__80 | T__81 | T__82 | T__83 | T__84 | T__85 | T__86 | T__87 | T__88 | T__89 | T__90 | T__91 | T__92 | T__93 | T__94 | T__95 | T__96 | T__97 | T__98 | T__99 | T__100 | RULE_MULTIPLICITY | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER );";
@@ -4043,132 +4109,132 @@ public class InternalRoomLexer extends Lexer { int _s = s;
switch ( s ) {
case 0 :
- int LA14_0 = input.LA(1);
+ int LA16_0 = input.LA(1);
s = -1;
- if ( (LA14_0=='R') ) {s = 1;}
+ if ( (LA16_0=='R') ) {s = 1;}
- else if ( (LA14_0=='{') ) {s = 2;}
+ else if ( (LA16_0=='{') ) {s = 2;}
- else if ( (LA14_0=='}') ) {s = 3;}
+ else if ( (LA16_0=='}') ) {s = 3;}
- else if ( (LA14_0==':') ) {s = 4;}
+ else if ( (LA16_0==':') ) {s = 4;}
- else if ( (LA14_0=='r') ) {s = 5;}
+ else if ( (LA16_0=='r') ) {s = 5;}
- else if ( (LA14_0=='P') ) {s = 6;}
+ else if ( (LA16_0=='P') ) {s = 6;}
- else if ( (LA14_0=='-') ) {s = 7;}
+ else if ( (LA16_0=='-') ) {s = 7;}
- else if ( (LA14_0=='(') ) {s = 8;}
+ else if ( (LA16_0=='(') ) {s = 8;}
- else if ( (LA14_0==')') ) {s = 9;}
+ else if ( (LA16_0==')') ) {s = 9;}
- else if ( (LA14_0=='d') ) {s = 10;}
+ else if ( (LA16_0=='d') ) {s = 10;}
- else if ( (LA14_0=='E') ) {s = 11;}
+ else if ( (LA16_0=='E') ) {s = 11;}
- else if ( (LA14_0=='D') ) {s = 12;}
+ else if ( (LA16_0=='D') ) {s = 12;}
- else if ( (LA14_0=='e') ) {s = 13;}
+ else if ( (LA16_0=='e') ) {s = 13;}
- else if ( (LA14_0=='u') ) {s = 14;}
+ else if ( (LA16_0=='u') ) {s = 14;}
- else if ( (LA14_0=='A') ) {s = 15;}
+ else if ( (LA16_0=='A') ) {s = 15;}
- else if ( (LA14_0=='=') ) {s = 16;}
+ else if ( (LA16_0=='=') ) {s = 16;}
- else if ( (LA14_0=='O') ) {s = 17;}
+ else if ( (LA16_0=='O') ) {s = 17;}
- else if ( (LA14_0==',') ) {s = 18;}
+ else if ( (LA16_0==',') ) {s = 18;}
- else if ( (LA14_0=='v') ) {s = 19;}
+ else if ( (LA16_0=='v') ) {s = 19;}
- else if ( (LA14_0=='s') ) {s = 20;}
+ else if ( (LA16_0=='s') ) {s = 20;}
- else if ( (LA14_0=='i') ) {s = 21;}
+ else if ( (LA16_0=='i') ) {s = 21;}
- else if ( (LA14_0=='o') ) {s = 22;}
+ else if ( (LA16_0=='o') ) {s = 22;}
- else if ( (LA14_0=='c') ) {s = 23;}
+ else if ( (LA16_0=='c') ) {s = 23;}
- else if ( (LA14_0=='p') ) {s = 24;}
+ else if ( (LA16_0=='p') ) {s = 24;}
- else if ( (LA14_0=='M') ) {s = 25;}
+ else if ( (LA16_0=='M') ) {s = 25;}
- else if ( (LA14_0=='h') ) {s = 26;}
+ else if ( (LA16_0=='h') ) {s = 26;}
- else if ( (LA14_0=='a') ) {s = 27;}
+ else if ( (LA16_0=='a') ) {s = 27;}
- else if ( (LA14_0=='I') ) {s = 28;}
+ else if ( (LA16_0=='I') ) {s = 28;}
- else if ( (LA14_0=='S') ) {s = 29;}
+ else if ( (LA16_0=='S') ) {s = 29;}
- else if ( (LA14_0=='B') ) {s = 30;}
+ else if ( (LA16_0=='B') ) {s = 30;}
- else if ( (LA14_0=='L') ) {s = 31;}
+ else if ( (LA16_0=='L') ) {s = 31;}
- else if ( (LA14_0=='.') ) {s = 32;}
+ else if ( (LA16_0=='.') ) {s = 32;}
- else if ( (LA14_0=='T') ) {s = 33;}
+ else if ( (LA16_0=='T') ) {s = 33;}
- else if ( (LA14_0=='C') ) {s = 34;}
+ else if ( (LA16_0=='C') ) {s = 34;}
- else if ( (LA14_0=='t') ) {s = 35;}
+ else if ( (LA16_0=='t') ) {s = 35;}
- else if ( (LA14_0=='g') ) {s = 36;}
+ else if ( (LA16_0=='g') ) {s = 36;}
- else if ( (LA14_0=='m') ) {s = 37;}
+ else if ( (LA16_0=='m') ) {s = 37;}
- else if ( (LA14_0=='<') ) {s = 38;}
+ else if ( (LA16_0=='<') ) {s = 38;}
- else if ( (LA14_0=='|') ) {s = 39;}
+ else if ( (LA16_0=='|') ) {s = 39;}
- else if ( (LA14_0=='>') ) {s = 40;}
+ else if ( (LA16_0=='>') ) {s = 40;}
- else if ( (LA14_0=='[') ) {s = 41;}
+ else if ( (LA16_0=='[') ) {s = 41;}
- else if ( (LA14_0==']') ) {s = 42;}
+ else if ( (LA16_0==']') ) {s = 42;}
- else if ( (LA14_0=='@') ) {s = 43;}
+ else if ( (LA16_0=='@') ) {s = 43;}
- else if ( (LA14_0=='f') ) {s = 44;}
+ else if ( (LA16_0=='f') ) {s = 44;}
- else if ( (LA14_0=='*') ) {s = 45;}
+ else if ( (LA16_0=='*') ) {s = 45;}
- else if ( (LA14_0=='^') ) {s = 46;}
+ else if ( (LA16_0=='^') ) {s = 46;}
- else if ( ((LA14_0>='F' && LA14_0<='H')||(LA14_0>='J' && LA14_0<='K')||LA14_0=='N'||LA14_0=='Q'||(LA14_0>='U' && LA14_0<='Z')||LA14_0=='_'||LA14_0=='b'||(LA14_0>='j' && LA14_0<='l')||LA14_0=='n'||LA14_0=='q'||(LA14_0>='w' && LA14_0<='z')) ) {s = 47;}
+ else if ( ((LA16_0>='F' && LA16_0<='H')||(LA16_0>='J' && LA16_0<='K')||LA16_0=='N'||LA16_0=='Q'||(LA16_0>='U' && LA16_0<='Z')||LA16_0=='_'||LA16_0=='b'||(LA16_0>='j' && LA16_0<='l')||LA16_0=='n'||LA16_0=='q'||(LA16_0>='w' && LA16_0<='z')) ) {s = 47;}
- else if ( ((LA14_0>='0' && LA14_0<='9')) ) {s = 48;}
+ else if ( ((LA16_0>='0' && LA16_0<='9')) ) {s = 48;}
- else if ( (LA14_0=='\"') ) {s = 49;}
+ else if ( (LA16_0=='\"') ) {s = 49;}
- else if ( (LA14_0=='\'') ) {s = 50;}
+ else if ( (LA16_0=='\'') ) {s = 50;}
- else if ( (LA14_0=='/') ) {s = 51;}
+ else if ( (LA16_0=='/') ) {s = 51;}
- else if ( ((LA14_0>='\t' && LA14_0<='\n')||LA14_0=='\r'||LA14_0==' ') ) {s = 52;}
+ else if ( ((LA16_0>='\t' && LA16_0<='\n')||LA16_0=='\r'||LA16_0==' ') ) {s = 52;}
- else if ( ((LA14_0>='\u0000' && LA14_0<='\b')||(LA14_0>='\u000B' && LA14_0<='\f')||(LA14_0>='\u000E' && LA14_0<='\u001F')||LA14_0=='!'||(LA14_0>='#' && LA14_0<='&')||LA14_0=='+'||LA14_0==';'||LA14_0=='?'||LA14_0=='\\'||LA14_0=='`'||(LA14_0>='~' && LA14_0<='\uFFFF')) ) {s = 53;}
+ else if ( ((LA16_0>='\u0000' && LA16_0<='\b')||(LA16_0>='\u000B' && LA16_0<='\f')||(LA16_0>='\u000E' && LA16_0<='\u001F')||LA16_0=='!'||(LA16_0>='#' && LA16_0<='&')||LA16_0=='+'||LA16_0==';'||LA16_0=='?'||LA16_0=='\\'||LA16_0=='`'||(LA16_0>='~' && LA16_0<='\uFFFF')) ) {s = 53;}
if ( s>=0 ) return s;
break;
case 1 :
- int LA14_50 = input.LA(1);
+ int LA16_49 = input.LA(1);
s = -1;
- if ( ((LA14_50>='\u0000' && LA14_50<='\uFFFF')) ) {s = 124;}
+ if ( ((LA16_49>='\u0000' && LA16_49<='\uFFFF')) ) {s = 124;}
else s = 53;
if ( s>=0 ) return s;
break;
case 2 :
- int LA14_49 = input.LA(1);
+ int LA16_50 = input.LA(1);
s = -1;
- if ( ((LA14_49>='\u0000' && LA14_49<='\uFFFF')) ) {s = 124;}
+ if ( ((LA16_50>='\u0000' && LA16_50<='\uFFFF')) ) {s = 124;}
else s = 53;
@@ -4176,7 +4242,7 @@ public class InternalRoomLexer extends Lexer { break;
}
NoViableAltException nvae =
- new NoViableAltException(getDescription(), 14, _s, input);
+ new NoViableAltException(getDescription(), 16, _s, input);
error(nvae);
throw nvae;
}
diff --git a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/services/RoomGrammarAccess.java b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/services/RoomGrammarAccess.java index dc6855478..bfe2c1720 100644 --- a/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/services/RoomGrammarAccess.java +++ b/plugins/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/services/RoomGrammarAccess.java @@ -5209,7 +5209,7 @@ public class RoomGrammarAccess extends AbstractGrammarElementFinder { } //terminal MULTIPLICITY returns ecore::EInt: - // "[" ("*" | "0".."9"+) "]"; + // "[" (" " | "\t")* ("*" | "0".."9"+) (" " | "\t")* "]"; public TerminalRule getMULTIPLICITYRule() { return (tMULTIPLICITY != null) ? tMULTIPLICITY : (tMULTIPLICITY = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "MULTIPLICITY")); } diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext index 668d3c200..abd915725 100644 --- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext +++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/Room.xtext @@ -411,4 +411,6 @@ ImportedFQN: FQN:
ID ('.' ID)*;
-terminal MULTIPLICITY returns ecore::EInt : '[' ('*' | ('0'..'9')+) ']';
+// with white space inside the brackets like in [ 3 ] the INT terminal will match and we get an error
+// [ * ] works though
+terminal MULTIPLICITY returns ecore::EInt : '[' (' '|'\t')* ('*' | ('0'..'9')+) (' '|'\t')* ']';
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ActorClassGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ActorClassGen.xtend index 63d522e0f..44fe509a8 100644 --- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ActorClassGen.xtend +++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ActorClassGen.xtend @@ -59,7 +59,7 @@ class ActorClassGen { #ifndef _«xpac.name»_H_ #define _«xpac.name»_H_ - #include "datatypes.h" + #include "etDatatypes.h" package «ac.getPackage»; diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/DataClassGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/DataClassGen.xtend index deefe922f..e534e9ee0 100644 --- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/DataClassGen.xtend +++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/DataClassGen.xtend @@ -53,10 +53,11 @@ class DataClassGen { #ifndef _«dc.name»_H_ #define _«dc.name»_H_ - #include "datatypes.h" + #include "etDatatypes.h" /* TODO: includes only for used DataClasses, also for other models */ - «FOR dataClass : root.getReferencedDataClasses(dc)»#include "«dataClass.name».h" + «FOR dataClass : root.getReferencedDataClasses(dc)» + #include "«dataClass.name».h" «ENDFOR» «helpers.UserCode(dc.userCode1)» diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/MainGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/MainGen.xtend index a714585ee..e959e9361 100644 --- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/MainGen.xtend +++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/MainGen.xtend @@ -42,8 +42,8 @@ class MainGen implements IGenerator { def void doGenerate(Root e) { dataClassGen.doGenerate(e); - protocolClassGen.doGenerate(e); - actorClassGen.doGenerate(e); + //protocolClassGen.doGenerate(e); + //actorClassGen.doGenerate(e); //subsystemClassGen.doGenerate(e); if (!e.library) { diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend index 21d15d69f..9107c0b46 100644 --- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend +++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend @@ -54,7 +54,7 @@ class ProtocolClassGen { #ifndef _«pc.name»_H_ #define _«pc.name»_H_ - #include "datatypes.h" + #include "etDatatypes.h" ««« import org.eclipse.etrice.runtime.java.messaging.Address; ««« import org.eclipse.etrice.runtime.java.messaging.Message; diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Validator.java b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Validator.java index d586d9155..7b6b5d98e 100644 --- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Validator.java +++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/Validator.java @@ -12,39 +12,15 @@ package org.eclipse.etrice.generator.c.gen; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.room.RoomModel; -import org.eclipse.etrice.generator.base.ILogger; import org.eclipse.etrice.generator.etricegen.Root; -import com.google.inject.Inject; - /** * @author Henrik Rentz-Reichert * */ public class Validator { - @Inject - private ILogger logger; - public boolean validate(Root genModel) { - int errorCount = 0; - for (RoomModel mdl : genModel.getUsedRoomModels()) { - TreeIterator<EObject> it = mdl.eAllContents(); - while (it.hasNext()) { - //EObject obj = it.next(); - - // currently unused - } - } - - if (errorCount>0) { - logger.logError("Java generator detected "+errorCount+" error(s) - terminating", null); - return false; - } - return true; } } diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java index b085a5340..92339fc08 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ActorClassGen.java @@ -110,7 +110,7 @@ public class ActorClassGen { _builder.append("_H_");
_builder.newLineIfNotEmpty();
_builder.newLine();
- _builder.append("#include \"datatypes.h\"");
+ _builder.append("#include \"etDatatypes.h\"");
_builder.newLine();
_builder.newLine();
_builder.append("package ");
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java index f35022db4..f53b1c5c6 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/DataClassGen.java @@ -81,7 +81,7 @@ public class DataClassGen { _builder.append("_H_");
_builder.newLineIfNotEmpty();
_builder.newLine();
- _builder.append("#include \"datatypes.h\"");
+ _builder.append("#include \"etDatatypes.h\"");
_builder.newLine();
_builder.newLine();
_builder.append("/* TODO: includes only for used DataClasses, also for other models */");
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/MainGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/MainGen.java index 5bc49067d..936151346 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/MainGen.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/MainGen.java @@ -49,8 +49,6 @@ public class MainGen implements IGenerator { public void doGenerate(final Root e) {
this.dataClassGen.doGenerate(e);
- this.protocolClassGen.doGenerate(e);
- this.actorClassGen.doGenerate(e);
boolean _isLibrary = e.isLibrary();
boolean _operator_not = BooleanExtensions.operator_not(_isLibrary);
if (_operator_not) {
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java index 30a5b3237..89410d2dd 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.java @@ -88,7 +88,7 @@ public class ProtocolClassGen { _builder.append("_H_");
_builder.newLineIfNotEmpty();
_builder.newLine();
- _builder.append("#include \"datatypes.h\"");
+ _builder.append("#include \"etDatatypes.h\"");
_builder.newLine();
_builder.newLine();
_builder.newLine();
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend index 64c79c120..cc8e22139 100644 --- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend +++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend @@ -14,6 +14,8 @@ package org.eclipse.etrice.generator.java.gen import com.google.inject.Inject
import com.google.inject.Singleton
+import java.util.List
+import org.eclipse.etrice.core.room.Attribute
import org.eclipse.etrice.core.room.DataClass
import org.eclipse.etrice.core.room.ComplexType
import org.eclipse.etrice.generator.base.ILogger
@@ -67,17 +69,18 @@ class DataClassGen { // default constructor
public «dc.name»() {
super();
+
«dc.attributes.attributeInitialization»
}
// constructor using fields
- public «dc.name»(«IF dc.base!=null»«dc.base.name» _super, «ENDIF»«FOR a : dc.attributes SEPARATOR ", "»«a.type.typeName»«IF a.size>1»[]«ENDIF» «a.name»«ENDFOR») {
- super();
+ public «dc.name»(«dc.argList») {
«IF dc.base!=null»
- «FOR a : dc.base.attributes»
- this.«a.name» = _super.«a.name»;
- «ENDFOR»
+ super(«dc.base.paramList»);
+ «ELSE»
+ super();
«ENDIF»
+
«FOR a : dc.attributes»
this.«a.name» = «a.name»;
«ENDFOR»
@@ -86,28 +89,72 @@ class DataClassGen { // deep copy
public «dc.name» deepCopy() {
«dc.name» copy = new «dc.name»();
- «FOR a : dc.attributes»
- «IF a.type instanceof ComplexType»
- «IF a.size==0»
- copy.«a.name» = «a.name».deepCopy();
- «ELSE»
- for (int i=0;i<«a.size»;i++){
- copy.«a.name»[i] = «a.name»[i].deepCopy();
- }
- «ENDIF»
- «ELSE»
- «IF a.size==0»
- copy.«a.name» = «a.name»;
- «ELSE»
- for (int i=0;i<«a.size»;i++){
- copy.«a.name»[i] = «a.name»[i];
- }
- «ENDIF»
- «ENDIF»
- «ENDFOR»
+ «deepCopy(dc)»
return copy;
}
};
'''
}
+
+ def paramList(DataClass _dc) {
+ var result = ""
+ var dc = _dc
+ while (dc!=null) {
+ result = dc.attributes.paramList.toString + result
+ dc = dc.base
+ if (dc!=null)
+ result = ", "+result
+ }
+ return result
+ }
+
+ def paramList(List<Attribute> attributes) {
+ '''«FOR a: attributes SEPARATOR ", "»«a.name»«ENDFOR»'''
+ }
+
+ def argList(DataClass _dc) {
+ var result = ""
+ var dc = _dc
+ while (dc!=null) {
+ result = dc.attributes.argList.toString + result
+ dc = dc.base
+ if (dc!=null)
+ result = ", "+result
+ }
+ return result
+ }
+
+ def deepCopy(DataClass _dc) {
+ var result = ""
+ var dc = _dc
+ while (dc!=null) {
+ result = deepCopy(dc.attributes).toString + result
+ dc = dc.base
+ }
+ return result
+ }
+
+ def deepCopy(List<Attribute> attributes) {
+ '''
+ «FOR a : attributes»
+ «IF a.type instanceof ComplexType»
+ «IF a.size==0»
+ copy.«a.name» = «a.name».deepCopy();
+ «ELSE»
+ for (int i=0;i<«a.size»;i++){
+ copy.«a.name»[i] = «a.name»[i].deepCopy();
+ }
+ «ENDIF»
+ «ELSE»
+ «IF a.size==0»
+ copy.«a.name» = «a.name»;
+ «ELSE»
+ for (int i=0;i<«a.size»;i++){
+ copy.«a.name»[i] = «a.name»[i];
+ }
+ «ENDIF»
+ «ENDIF»
+ «ENDFOR»
+ '''
+ }
}
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java index b3c29b386..8484d3186 100644 --- a/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java +++ b/plugins/org.eclipse.etrice.generator.java/xtend-gen/org/eclipse/etrice/generator/java/gen/DataClassGen.java @@ -2,6 +2,7 @@ package org.eclipse.etrice.generator.java.gen; import com.google.inject.Inject;
import com.google.inject.Singleton;
+import java.util.List;
import org.eclipse.emf.common.util.EList;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.ComplexType;
@@ -17,7 +18,6 @@ import org.eclipse.etrice.generator.generic.ProcedureHelpers; import org.eclipse.etrice.generator.generic.TypeHelpers;
import org.eclipse.etrice.generator.java.gen.JavaExtensions;
import org.eclipse.xtext.generator.JavaIoFileSystemAccess;
-import org.eclipse.xtext.xbase.lib.ComparableExtensions;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.StringExtensions;
import org.eclipse.xtext.xtend2.lib.StringConcatenation;
@@ -152,6 +152,8 @@ public class DataClassGen { _builder.append("super();");
_builder.newLine();
_builder.append("\t\t");
+ _builder.newLine();
+ _builder.append("\t\t");
EList<Attribute> _attributes_2 = dc.getAttributes();
StringConcatenation _attributeInitialization = this.helpers.attributeInitialization(_attributes_2);
_builder.append(_attributeInitialization, " ");
@@ -169,76 +171,39 @@ public class DataClassGen { String _name_6 = dc.getName();
_builder.append(_name_6, " ");
_builder.append("(");
+ String _argList = this.argList(dc);
+ _builder.append(_argList, " ");
+ _builder.append(") {");
+ _builder.newLineIfNotEmpty();
{
DataClass _base_2 = dc.getBase();
boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(_base_2, null);
if (_operator_notEquals_1) {
+ _builder.append("\t\t");
+ _builder.append("super(");
DataClass _base_3 = dc.getBase();
- String _name_7 = _base_3.getName();
- _builder.append(_name_7, " ");
- _builder.append(" _super, ");
- }
- }
- {
- EList<Attribute> _attributes_3 = dc.getAttributes();
- boolean hasAnyElements = false;
- for(final Attribute a : _attributes_3) {
- if (!hasAnyElements) {
- hasAnyElements = true;
- } else {
- _builder.appendImmediate(", ", " ");
- }
- DataType _type = a.getType();
- String _typeName = this.typeHelpers.typeName(_type);
- _builder.append(_typeName, " ");
- {
- int _size = a.getSize();
- boolean _operator_greaterThan = ComparableExtensions.<Integer>operator_greaterThan(((Integer)_size), ((Integer)1));
- if (_operator_greaterThan) {
- _builder.append("[]");
- }
- }
- _builder.append(" ");
- String _name_8 = a.getName();
- _builder.append(_name_8, " ");
+ String _paramList = this.paramList(_base_3);
+ _builder.append(_paramList, " ");
+ _builder.append(");");
+ _builder.newLineIfNotEmpty();
+ } else {
+ _builder.append("\t\t");
+ _builder.append("super();");
+ _builder.newLine();
}
}
- _builder.append(") {");
- _builder.newLineIfNotEmpty();
_builder.append("\t\t");
- _builder.append("super();");
_builder.newLine();
{
- DataClass _base_4 = dc.getBase();
- boolean _operator_notEquals_2 = ObjectExtensions.operator_notEquals(_base_4, null);
- if (_operator_notEquals_2) {
- {
- DataClass _base_5 = dc.getBase();
- EList<Attribute> _attributes_4 = _base_5.getAttributes();
- for(final Attribute a_1 : _attributes_4) {
- _builder.append("\t\t");
- _builder.append("this.");
- String _name_9 = a_1.getName();
- _builder.append(_name_9, " ");
- _builder.append(" = _super.");
- String _name_10 = a_1.getName();
- _builder.append(_name_10, " ");
- _builder.append(";");
- _builder.newLineIfNotEmpty();
- }
- }
- }
- }
- {
- EList<Attribute> _attributes_5 = dc.getAttributes();
- for(final Attribute a_2 : _attributes_5) {
+ EList<Attribute> _attributes_3 = dc.getAttributes();
+ for(final Attribute a : _attributes_3) {
_builder.append("\t\t");
_builder.append("this.");
- String _name_11 = a_2.getName();
- _builder.append(_name_11, " ");
+ String _name_7 = a.getName();
+ _builder.append(_name_7, " ");
_builder.append(" = ");
- String _name_12 = a_2.getName();
- _builder.append(_name_12, " ");
+ String _name_8 = a.getName();
+ _builder.append(_name_8, " ");
_builder.append(";");
_builder.newLineIfNotEmpty();
}
@@ -253,91 +218,189 @@ public class DataClassGen { _builder.newLine();
_builder.append("\t");
_builder.append("public ");
- String _name_13 = dc.getName();
- _builder.append(_name_13, " ");
+ String _name_9 = dc.getName();
+ _builder.append(_name_9, " ");
_builder.append(" deepCopy() {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
- String _name_14 = dc.getName();
- _builder.append(_name_14, " ");
+ String _name_10 = dc.getName();
+ _builder.append(_name_10, " ");
_builder.append(" copy = new ");
- String _name_15 = dc.getName();
- _builder.append(_name_15, " ");
+ String _name_11 = dc.getName();
+ _builder.append(_name_11, " ");
_builder.append("();");
_builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ String _deepCopy = this.deepCopy(dc);
+ _builder.append(_deepCopy, " ");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("return copy;");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("};");
+ _builder.newLine();
+ return _builder;
+ }
+
+ public String paramList(final DataClass _dc) {
+ String result = "";
+ DataClass dc = _dc;
+ boolean _operator_notEquals = ObjectExtensions.operator_notEquals(dc, null);
+ Boolean _xwhileexpression = _operator_notEquals;
+ while (_xwhileexpression) {
+ {
+ EList<Attribute> _attributes = dc.getAttributes();
+ StringConcatenation _paramList = this.paramList(_attributes);
+ String _string = _paramList.toString();
+ String _operator_plus = StringExtensions.operator_plus(_string, result);
+ result = _operator_plus;
+ DataClass _base = dc.getBase();
+ dc = _base;
+ boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(dc, null);
+ if (_operator_notEquals_1) {
+ String _operator_plus_1 = StringExtensions.operator_plus(", ", result);
+ result = _operator_plus_1;
+ }
+ }
+ boolean _operator_notEquals_2 = ObjectExtensions.operator_notEquals(dc, null);
+ _xwhileexpression = _operator_notEquals_2;
+ }
+ return result;
+ }
+
+ public StringConcatenation paramList(final List<Attribute> attributes) {
+ StringConcatenation _builder = new StringConcatenation();
+ {
+ boolean hasAnyElements = false;
+ for(final Attribute a : attributes) {
+ if (!hasAnyElements) {
+ hasAnyElements = true;
+ } else {
+ _builder.appendImmediate(", ", "");
+ }
+ String _name = a.getName();
+ _builder.append(_name, "");
+ }
+ }
+ return _builder;
+ }
+
+ public String argList(final DataClass _dc) {
+ String result = "";
+ DataClass dc = _dc;
+ boolean _operator_notEquals = ObjectExtensions.operator_notEquals(dc, null);
+ Boolean _xwhileexpression = _operator_notEquals;
+ while (_xwhileexpression) {
+ {
+ EList<Attribute> _attributes = dc.getAttributes();
+ StringConcatenation _argList = this.helpers.argList(_attributes);
+ String _string = _argList.toString();
+ String _operator_plus = StringExtensions.operator_plus(_string, result);
+ result = _operator_plus;
+ DataClass _base = dc.getBase();
+ dc = _base;
+ boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(dc, null);
+ if (_operator_notEquals_1) {
+ String _operator_plus_1 = StringExtensions.operator_plus(", ", result);
+ result = _operator_plus_1;
+ }
+ }
+ boolean _operator_notEquals_2 = ObjectExtensions.operator_notEquals(dc, null);
+ _xwhileexpression = _operator_notEquals_2;
+ }
+ return result;
+ }
+
+ public String deepCopy(final DataClass _dc) {
+ String result = "";
+ DataClass dc = _dc;
+ boolean _operator_notEquals = ObjectExtensions.operator_notEquals(dc, null);
+ Boolean _xwhileexpression = _operator_notEquals;
+ while (_xwhileexpression) {
+ {
+ EList<Attribute> _attributes = dc.getAttributes();
+ StringConcatenation _deepCopy = this.deepCopy(_attributes);
+ String _string = _deepCopy.toString();
+ String _operator_plus = StringExtensions.operator_plus(_string, result);
+ result = _operator_plus;
+ DataClass _base = dc.getBase();
+ dc = _base;
+ }
+ boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(dc, null);
+ _xwhileexpression = _operator_notEquals_1;
+ }
+ return result;
+ }
+
+ public StringConcatenation deepCopy(final List<Attribute> attributes) {
+ StringConcatenation _builder = new StringConcatenation();
{
- EList<Attribute> _attributes_6 = dc.getAttributes();
- for(final Attribute a_3 : _attributes_6) {
+ for(final Attribute a : attributes) {
{
- DataType _type_1 = a_3.getType();
- if ((_type_1 instanceof ComplexType)) {
+ DataType _type = a.getType();
+ if ((_type instanceof ComplexType)) {
{
- int _size_1 = a_3.getSize();
- boolean _operator_equals = ObjectExtensions.operator_equals(((Integer)_size_1), ((Integer)0));
+ int _size = a.getSize();
+ boolean _operator_equals = ObjectExtensions.operator_equals(((Integer)_size), ((Integer)0));
if (_operator_equals) {
- _builder.append("\t\t");
_builder.append("copy.");
- String _name_16 = a_3.getName();
- _builder.append(_name_16, " ");
+ String _name = a.getName();
+ _builder.append(_name, "");
_builder.append(" = ");
- String _name_17 = a_3.getName();
- _builder.append(_name_17, " ");
+ String _name_1 = a.getName();
+ _builder.append(_name_1, "");
_builder.append(".deepCopy();");
_builder.newLineIfNotEmpty();
} else {
- _builder.append("\t\t");
_builder.append("for (int i=0;i<");
- int _size_2 = a_3.getSize();
- _builder.append(_size_2, " ");
+ int _size_1 = a.getSize();
+ _builder.append(_size_1, "");
_builder.append(";i++){");
_builder.newLineIfNotEmpty();
- _builder.append("\t\t");
_builder.append("\t");
_builder.append("copy.");
- String _name_18 = a_3.getName();
- _builder.append(_name_18, " ");
+ String _name_2 = a.getName();
+ _builder.append(_name_2, " ");
_builder.append("[i] = ");
- String _name_19 = a_3.getName();
- _builder.append(_name_19, " ");
+ String _name_3 = a.getName();
+ _builder.append(_name_3, " ");
_builder.append("[i].deepCopy();");
_builder.newLineIfNotEmpty();
- _builder.append("\t\t");
_builder.append("}");
_builder.newLine();
}
}
} else {
{
- int _size_3 = a_3.getSize();
- boolean _operator_equals_1 = ObjectExtensions.operator_equals(((Integer)_size_3), ((Integer)0));
+ int _size_2 = a.getSize();
+ boolean _operator_equals_1 = ObjectExtensions.operator_equals(((Integer)_size_2), ((Integer)0));
if (_operator_equals_1) {
- _builder.append("\t\t");
_builder.append("copy.");
- String _name_20 = a_3.getName();
- _builder.append(_name_20, " ");
+ String _name_4 = a.getName();
+ _builder.append(_name_4, "");
_builder.append(" = ");
- String _name_21 = a_3.getName();
- _builder.append(_name_21, " ");
+ String _name_5 = a.getName();
+ _builder.append(_name_5, "");
_builder.append(";");
_builder.newLineIfNotEmpty();
} else {
- _builder.append("\t\t");
_builder.append("for (int i=0;i<");
- int _size_4 = a_3.getSize();
- _builder.append(_size_4, " ");
+ int _size_3 = a.getSize();
+ _builder.append(_size_3, "");
_builder.append(";i++){");
_builder.newLineIfNotEmpty();
- _builder.append("\t\t");
_builder.append("\t");
_builder.append("copy.");
- String _name_22 = a_3.getName();
- _builder.append(_name_22, " ");
+ String _name_6 = a.getName();
+ _builder.append(_name_6, " ");
_builder.append("[i] = ");
- String _name_23 = a_3.getName();
- _builder.append(_name_23, " ");
+ String _name_7 = a.getName();
+ _builder.append(_name_7, " ");
_builder.append("[i];");
_builder.newLineIfNotEmpty();
- _builder.append("\t\t");
_builder.append("}");
_builder.newLine();
}
@@ -346,14 +409,6 @@ public class DataClassGen { }
}
}
- _builder.append("\t\t");
- _builder.append("return copy;");
- _builder.newLine();
- _builder.append("\t");
- _builder.append("}");
- _builder.newLine();
- _builder.append("};");
- _builder.newLine();
return _builder;
}
}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/etricegen/impl/RootImpl.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/etricegen/impl/RootImpl.java index 451f8b19c..24df77a1a 100644 --- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/etricegen/impl/RootImpl.java +++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/etricegen/impl/RootImpl.java @@ -744,8 +744,6 @@ public class RootImpl extends EObjectImpl implements Root { if (message.getData()!=null) {
if (message.getData().getType() instanceof DataClass) {
DataClass dc = (DataClass) message.getData().getType();
- // TODO: other types are completely ignored
-
if (dc!=null)
dataClasses.add(dc);
}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/etricegen/util/ETriceGenSwitch.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/etricegen/util/ETriceGenSwitch.java index 0efec7f16..2aaf675cf 100644 --- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/etricegen/util/ETriceGenSwitch.java +++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/etricegen/util/ETriceGenSwitch.java @@ -13,6 +13,7 @@ import org.eclipse.etrice.core.room.ActorClass; import org.eclipse.etrice.core.room.ActorContainerClass;
import org.eclipse.etrice.core.room.RoomClass;
import org.eclipse.etrice.core.room.StructureClass;
+import org.eclipse.etrice.generator.etricegen.*;
import org.eclipse.etrice.generator.etricegen.ActiveTrigger;
import org.eclipse.etrice.generator.etricegen.ActorInstance;
import org.eclipse.etrice.generator.etricegen.BindingInstance;
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend index dedd33c69..1781fe139 100644 --- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend +++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend @@ -44,9 +44,9 @@ class ProcedureHelpers { //--------------------- attributes
«FOR attribute : attribs»
«IF attribute.size==0»
- «languageExt.accessLevelProtected()»«attribute.type.typeName» «attribute.name» = «IF attribute.defaultValueLiteral==null»«attribute.type.defaultValue»«ELSE»«attribute.defaultValueLiteral»«ENDIF»;
+ «languageExt.accessLevelProtected()»«attribute.type.typeName» «attribute.name»;
«ELSE»
- «languageExt.accessLevelProtected()»«attribute.type.typeName»[] «attribute.name» = «attribute.arrayInitializer»;
+ «languageExt.accessLevelProtected()»«attribute.type.typeName»[] «attribute.name»;
«ENDIF»
«ENDFOR»
'''
@@ -80,7 +80,10 @@ class ProcedureHelpers { «IF a.defaultValueLiteral!=null»
«IF a.size==0»
«a.name» = «a.defaultValueLiteral»;
- «ELSEIF !a.defaultValueLiteral.startsWith("{")»
+ «ELSEIF a.defaultValueLiteral.startsWith("{")»
+ «a.name» = new «a.type.typeName»[] «a.defaultValueLiteral»;
+ «ELSE»
+ «a.name» = new «a.type.typeName»[«a.size»];
for (int i=0;i<«a.size»;i++){
«a.name»[i] = «a.defaultValueLiteral»;
}
@@ -89,6 +92,7 @@ class ProcedureHelpers { «IF a.size==0»
«a.name» = «a.type.defaultValue»;
«ELSE»
+ «a.name» = new «a.type.typeName»[«a.size»];
for (int i=0;i<«a.size»;i++){
«a.name»[i] = «a.type.defaultValue»;
}
@@ -126,6 +130,10 @@ class ProcedureHelpers { def private GetterHeader(Attribute attribute, String classname){'''
«languageExt.accessLevelPublic()»«attribute.type.typeName»«IF attribute.size!=0»[]«ENDIF» get«attribute.name.toFirstUpper()» («languageExt.selfPointer(classname, 0)»)'''
}
+
+ def argList(List<Attribute> attributes) {
+ '''«FOR a : attributes SEPARATOR ", "»«a.type.typeName»«IF a.size>1»[]«ENDIF» «a.name»«ENDFOR»'''
+ }
// Operations
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java index e5aa1450b..6d88c7704 100644 --- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java +++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/ProcedureHelpers.java @@ -12,7 +12,6 @@ import org.eclipse.etrice.core.room.VarDecl; import org.eclipse.etrice.generator.base.ILogger;
import org.eclipse.etrice.generator.generic.ILanguageExtension;
import org.eclipse.etrice.generator.generic.TypeHelpers;
-import org.eclipse.xtext.xbase.lib.BooleanExtensions;
import org.eclipse.xtext.xbase.lib.ComparableExtensions;
import org.eclipse.xtext.xbase.lib.Conversions;
import org.eclipse.xtext.xbase.lib.IntegerExtensions;
@@ -72,33 +71,17 @@ public class ProcedureHelpers { _builder.append(" ");
String _name = attribute.getName();
_builder.append(_name, "");
- _builder.append(" = ");
- {
- String _defaultValueLiteral = attribute.getDefaultValueLiteral();
- boolean _operator_equals_1 = ObjectExtensions.operator_equals(_defaultValueLiteral, null);
- if (_operator_equals_1) {
- DataType _type_1 = attribute.getType();
- String _defaultValue = this._typeHelpers.defaultValue(_type_1);
- _builder.append(_defaultValue, "");
- } else {
- String _defaultValueLiteral_1 = attribute.getDefaultValueLiteral();
- _builder.append(_defaultValueLiteral_1, "");
- }
- }
_builder.append(";");
_builder.newLineIfNotEmpty();
} else {
String _accessLevelProtected_1 = this.languageExt.accessLevelProtected();
_builder.append(_accessLevelProtected_1, "");
- DataType _type_2 = attribute.getType();
- String _typeName_1 = this._typeHelpers.typeName(_type_2);
+ DataType _type_1 = attribute.getType();
+ String _typeName_1 = this._typeHelpers.typeName(_type_1);
_builder.append(_typeName_1, "");
_builder.append("[] ");
String _name_1 = attribute.getName();
_builder.append(_name_1, "");
- _builder.append(" = ");
- String _arrayInitializer = this.arrayInitializer(attribute);
- _builder.append(_arrayInitializer, "");
_builder.append(";");
_builder.newLineIfNotEmpty();
}
@@ -192,19 +175,41 @@ public class ProcedureHelpers { } else {
String _defaultValueLiteral_2 = a.getDefaultValueLiteral();
boolean _startsWith = _defaultValueLiteral_2.startsWith("{");
- boolean _operator_not = BooleanExtensions.operator_not(_startsWith);
- if (_operator_not) {
- _builder.append("for (int i=0;i<");
+ if (_startsWith) {
+ String _name_1 = a.getName();
+ _builder.append(_name_1, "");
+ _builder.append(" = new ");
+ DataType _type = a.getType();
+ String _typeName = this._typeHelpers.typeName(_type);
+ _builder.append(_typeName, "");
+ _builder.append("[] ");
+ String _defaultValueLiteral_3 = a.getDefaultValueLiteral();
+ _builder.append(_defaultValueLiteral_3, "");
+ _builder.append(";");
+ _builder.newLineIfNotEmpty();
+ } else {
+ String _name_2 = a.getName();
+ _builder.append(_name_2, "");
+ _builder.append(" = new ");
+ DataType _type_1 = a.getType();
+ String _typeName_1 = this._typeHelpers.typeName(_type_1);
+ _builder.append(_typeName_1, "");
+ _builder.append("[");
int _size_1 = a.getSize();
_builder.append(_size_1, "");
+ _builder.append("];");
+ _builder.newLineIfNotEmpty();
+ _builder.append("for (int i=0;i<");
+ int _size_2 = a.getSize();
+ _builder.append(_size_2, "");
_builder.append(";i++){");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- String _name_1 = a.getName();
- _builder.append(_name_1, " ");
+ String _name_3 = a.getName();
+ _builder.append(_name_3, " ");
_builder.append("[i] = ");
- String _defaultValueLiteral_3 = a.getDefaultValueLiteral();
- _builder.append(_defaultValueLiteral_3, " ");
+ String _defaultValueLiteral_4 = a.getDefaultValueLiteral();
+ _builder.append(_defaultValueLiteral_4, " ");
_builder.append(";");
_builder.newLineIfNotEmpty();
_builder.append("}");
@@ -214,29 +219,40 @@ public class ProcedureHelpers { }
} else {
{
- int _size_2 = a.getSize();
- boolean _operator_equals_1 = ObjectExtensions.operator_equals(((Integer)_size_2), ((Integer)0));
+ int _size_3 = a.getSize();
+ boolean _operator_equals_1 = ObjectExtensions.operator_equals(((Integer)_size_3), ((Integer)0));
if (_operator_equals_1) {
- String _name_2 = a.getName();
- _builder.append(_name_2, "");
+ String _name_4 = a.getName();
+ _builder.append(_name_4, "");
_builder.append(" = ");
- DataType _type = a.getType();
- String _defaultValue = this._typeHelpers.defaultValue(_type);
+ DataType _type_2 = a.getType();
+ String _defaultValue = this._typeHelpers.defaultValue(_type_2);
_builder.append(_defaultValue, "");
_builder.append(";");
_builder.newLineIfNotEmpty();
} else {
+ String _name_5 = a.getName();
+ _builder.append(_name_5, "");
+ _builder.append(" = new ");
+ DataType _type_3 = a.getType();
+ String _typeName_2 = this._typeHelpers.typeName(_type_3);
+ _builder.append(_typeName_2, "");
+ _builder.append("[");
+ int _size_4 = a.getSize();
+ _builder.append(_size_4, "");
+ _builder.append("];");
+ _builder.newLineIfNotEmpty();
_builder.append("for (int i=0;i<");
- int _size_3 = a.getSize();
- _builder.append(_size_3, "");
+ int _size_5 = a.getSize();
+ _builder.append(_size_5, "");
_builder.append(";i++){");
_builder.newLineIfNotEmpty();
_builder.append("\t");
- String _name_3 = a.getName();
- _builder.append(_name_3, " ");
+ String _name_6 = a.getName();
+ _builder.append(_name_6, " ");
_builder.append("[i] = ");
- DataType _type_1 = a.getType();
- String _defaultValue_1 = this._typeHelpers.defaultValue(_type_1);
+ DataType _type_4 = a.getType();
+ String _defaultValue_1 = this._typeHelpers.defaultValue(_type_4);
_builder.append(_defaultValue_1, " ");
_builder.append(";");
_builder.newLineIfNotEmpty();
@@ -364,6 +380,34 @@ public class ProcedureHelpers { return _builder;
}
+ public StringConcatenation argList(final List<Attribute> attributes) {
+ StringConcatenation _builder = new StringConcatenation();
+ {
+ boolean hasAnyElements = false;
+ for(final Attribute a : attributes) {
+ if (!hasAnyElements) {
+ hasAnyElements = true;
+ } else {
+ _builder.appendImmediate(", ", "");
+ }
+ DataType _type = a.getType();
+ String _typeName = this._typeHelpers.typeName(_type);
+ _builder.append(_typeName, "");
+ {
+ int _size = a.getSize();
+ boolean _operator_greaterThan = ComparableExtensions.<Integer>operator_greaterThan(((Integer)_size), ((Integer)1));
+ if (_operator_greaterThan) {
+ _builder.append("[]");
+ }
+ }
+ _builder.append(" ");
+ String _name = a.getName();
+ _builder.append(_name, "");
+ }
+ }
+ return _builder;
+ }
+
public StringConcatenation OperationsDeclaration(final List<? extends Operation> operations, final String classname) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("//--------------------- operations");
diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.zip Binary files differindex d320f2da7..a7770658c 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip Binary files differindex 4cb842f8e..8933aecd8 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.zip Binary files differindex ee487a8b2..734cd4df1 100644 --- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.zip +++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.zip diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/PortSupport.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/PortSupport.java index 10d3756e8..294ad9bda 100644 --- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/PortSupport.java +++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/PortSupport.java @@ -386,8 +386,9 @@ public class PortSupport extends InterfaceItemSupport { // we clear the figure and rebuild it
GraphicsAlgorithm invisibleRect = pe.getGraphicsAlgorithm();
invisibleRect.getGraphicsAlgorithmChildren().clear();
-
- createPortFigure(port, false, container, invisibleRect, dark, bright);
+
+ boolean refport = isRefItem(pe);
+ createPortFigure(port, refport, container, invisibleRect, dark, bright);
GraphicsAlgorithm ga = container.getChildren().get(0).getGraphicsAlgorithm();
if (ga instanceof Text) {
diff --git a/releng/org.eclipse.etrice.releng/buckminster.cspec b/releng/org.eclipse.etrice.releng/buckminster.cspec index 5ec53218e..23dd6bcb7 100644 --- a/releng/org.eclipse.etrice.releng/buckminster.cspec +++ b/releng/org.eclipse.etrice.releng/buckminster.cspec @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?>
<cs:cspec xmlns:cs="http://www.eclipse.org/buckminster/CSpec-1.0" name="org.eclipse.etrice.releng" componentType="buckminster" version="0.1.0.qualifier">
<cs:dependencies>
- <cs:dependency name="com.thoughtworks.qdox" componentType="osgi.bundle"/>
- <cs:dependency name="org.aopalliance" componentType="osgi.bundle"/>
- <cs:dependency name="org.eclipse.draw2d" componentType="eclipse.feature"/>
<cs:dependency name="org.eclipse.etrice.feature" componentType="eclipse.feature"/>
<cs:dependency name="org.eclipse.etrice.integration.tests" componentType="buckminster"/>
<cs:dependency name="org.eclipse.etrice.modellib" componentType="buckminster"/>
@@ -12,10 +9,6 @@ <cs:dependency name="org.eclipse.etrice.site" componentType="eclipse.feature"/>
<cs:dependency name="org.eclipse.etrice.tests.feature" componentType="eclipse.feature"/>
<cs:dependency name="org.eclipse.etrice.tutorials" componentType="buckminster"/>
- <cs:dependency name="org.eclipse.pde" componentType="eclipse.feature"/>
- <cs:dependency name="org.eclipse.pde.source" componentType="eclipse.feature"/>
- <cs:dependency name="org.eclipse.platform" componentType="eclipse.feature"/>
- <cs:dependency name="org.eclipse.platform.source" componentType="eclipse.feature"/>
</cs:dependencies>
<cs:actions>
<cs:public name="copy.sites" actor="ant">
diff --git a/releng/org.eclipse.etrice.releng/build.rmap b/releng/org.eclipse.etrice.releng/build.rmap index a6e6178d0..5337611f8 100644 --- a/releng/org.eclipse.etrice.releng/build.rmap +++ b/releng/org.eclipse.etrice.releng/build.rmap @@ -73,13 +73,6 @@ <rm:provider componentTypes="eclipse.feature,osgi.bundle" readerType="p2" source="false" mutable="false">
<rm:property key="buckminster.source" value="false"/>
<rm:property key="buckminster.mutable" value="false"/>
- <rm:uri format="{0}/tools/gef/updates/milestones/">
- <bc:propertyRef key="eclipse.downloads"/>
- </rm:uri>
- </rm:provider>
- <rm:provider componentTypes="eclipse.feature,osgi.bundle" readerType="p2" source="false" mutable="false">
- <rm:property key="buckminster.source" value="false"/>
- <rm:property key="buckminster.mutable" value="false"/>
<rm:uri format="{0}/eclipse/updates/3.7milestones">
<bc:propertyRef key="eclipse.downloads"/>
</rm:uri>
diff --git a/releng/org.eclipse.etrice.releng/local.properties b/releng/org.eclipse.etrice.releng/local.properties index 91e716e3d..0ff0cdc67 100644 --- a/releng/org.eclipse.etrice.releng/local.properties +++ b/releng/org.eclipse.etrice.releng/local.properties @@ -1,4 +1,5 @@ git.repository=http://git.eclipse.org/gitroot/etrice/org.eclipse.etrice.git
+cvs.repository.eclipse=:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse
qualifier.replacement.*=generator:lastModified
generator.lastModified.format='v'yyyyMMdd-HHmm
diff --git a/runtime/org.eclipse.etrice.modellib/jgen_modellib.launch b/runtime/org.eclipse.etrice.modellib/jgen_modellib.launch new file mode 100644 index 000000000..5074d0e3f --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib/jgen_modellib.launch @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/Main.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.etrice.generator.java.Main"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="${workspace_loc:org.eclipse.etrice.modellib}/models/ALogService.room ${workspace_loc:org.eclipse.etrice.modellib}/models/Socket.room ${workspace_loc:org.eclipse.etrice.modellib}/models/TimingService.room -lib"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.etrice.generator.java"/>
+</launchConfiguration>
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java index 0264da386..175072a53 100644 --- a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java +++ b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java @@ -7,11 +7,11 @@ public class DSocketConfiguration { //--------------------- attributes
- protected String serverName = "";
- protected int portNumber = 0;
- protected int protocol = 0;
- protected boolean checkCookie = false;
- protected int mode = 0;
+ protected String serverName;
+ protected int portNumber;
+ protected int protocol;
+ protected boolean checkCookie;
+ protected int mode;
//--------------------- attribute setters and getters
public void setServerName (String serverName) {
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java index 271a460e3..1aedbd300 100644 --- a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java +++ b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java @@ -7,8 +7,8 @@ public class DSocketData { //--------------------- attributes
- protected int size = 0;
- protected String data = "";
+ protected int size;
+ protected String data;
//--------------------- attribute setters and getters
public void setSize (int size) {
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java index 37d2e2737..ab8f18141 100644 --- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java +++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java @@ -266,8 +266,7 @@ public class ALogService extends ActorClassBase { p=null;
}
protected void action_TRANS_opened_TO_opened_BY_internalLoglog_tr1(InterfaceItemBase ifitem, InternalLogData data) {
- long s = Long.valueOf(data.timeStamp);
- p.println("Timestamp: " + Long.toString(s-tStart) + "ms");
+ p.println("Timestamp: " + Long.toString(data.timeStamp-tStart) + "ms");
p.println("SenderInstance: "+ data.sender);
p.println("UserString: " + data.userString);
p.println("--------------------------------------------------");
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java index ad18afdf3..752ab503e 100644 --- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java +++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java @@ -7,9 +7,9 @@ public class InternalLogData { //--------------------- attributes
- protected String userString = "";
- protected String sender = "";
- protected String timeStamp = "";
+ protected String userString;
+ protected String sender;
+ protected long timeStamp;
//--------------------- attribute setters and getters
public void setUserString (String userString) {
@@ -24,10 +24,10 @@ public class InternalLogData { public String getSender () {
return this.sender;
}
- public void setTimeStamp (String timeStamp) {
+ public void setTimeStamp (long timeStamp) {
this.timeStamp = timeStamp;
}
- public String getTimeStamp () {
+ public long getTimeStamp () {
return this.timeStamp;
}
@@ -39,11 +39,11 @@ public class InternalLogData { // initialize attributes
userString = "";
sender = "";
- timeStamp = "";
+ timeStamp = 0;
}
// constructor using fields
- public InternalLogData(String userString, String sender, String timeStamp) {
+ public InternalLogData(String userString, String sender, long timeStamp) {
super();
this.userString = userString;
this.sender = sender;
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java index 4036df8dc..5faabbb9c 100644 --- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java +++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java @@ -150,8 +150,7 @@ public class Log { long s;
if (logLevel>this.logLevel){
d.userString=userString;
- s=System.currentTimeMillis();
- d.timeStamp=Long.toString(s);
+ d.timeStamp=System.currentTimeMillis();
d.sender=getInstancePath();
if (getPeerAddress()!=null)
getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalLog, d));
@@ -183,7 +182,7 @@ public class Log { if (getPeerAddress()!=null)
getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalLog, data.deepCopy()));
}
- public void internalLog(String userString, String sender, String timeStamp) {
+ public void internalLog(String userString, String sender, long timeStamp) {
internalLog(new InternalLogData(userString, sender, timeStamp));
}
}
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/LogData.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/LogData.java deleted file mode 100644 index c38358251..000000000 --- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/LogData.java +++ /dev/null @@ -1,51 +0,0 @@ -package room.basic.service.logging;
-
-
-
-
-public class LogData {
-
-
- //--------------------- attributes
- protected int logLevel = 0;
- protected String userString = "";
-
- //--------------------- attribute setters and getters
- public void setLogLevel (int logLevel) {
- this.logLevel = logLevel;
- }
- public int getLogLevel () {
- return this.logLevel;
- }
- public void setUserString (String userString) {
- this.userString = userString;
- }
- public String getUserString () {
- return this.userString;
- }
-
- //--------------------- operations
-
- // default constructor
- public LogData() {
- super();
- // initialize attributes
- logLevel = 0;
- userString = "";
- }
-
- // constructor using fields
- public LogData(int logLevel, String userString) {
- super();
- this.logLevel = logLevel;
- this.userString = userString;
- }
-
- // deep copy
- public LogData deepCopy() {
- LogData copy = new LogData();
- copy.logLevel = logLevel;
- copy.userString = userString;
- return copy;
- }
-};
diff --git a/runtime/org.eclipse.etrice.runtime.c/Debug/liborg.eclipse.etrice.runtime.c.a b/runtime/org.eclipse.etrice.runtime.c/Debug/liborg.eclipse.etrice.runtime.c.a Binary files differindex 9da19117c..2def3aaec 100644 --- a/runtime/org.eclipse.etrice.runtime.c/Debug/liborg.eclipse.etrice.runtime.c.a +++ b/runtime/org.eclipse.etrice.runtime.c/Debug/liborg.eclipse.etrice.runtime.c.a diff --git a/runtime/org.eclipse.etrice.runtime.c/Release/liborg.eclipse.etrice.runtime.c.a b/runtime/org.eclipse.etrice.runtime.c/Release/liborg.eclipse.etrice.runtime.c.a Binary files differdeleted file mode 100644 index 89c30a148..000000000 --- a/runtime/org.eclipse.etrice.runtime.c/Release/liborg.eclipse.etrice.runtime.c.a +++ /dev/null diff --git a/runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.h b/runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.h deleted file mode 100644 index b2326eec8..000000000 --- a/runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.h +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz (initial contribution) - * - *******************************************************************************/ - -#ifndef _RMESSAGEQUEUE_H_ -#define _RMESSAGEQUEUE_H_ - -#include "RMessage.h" -#include <stddef.h> - -typedef struct RMessageQueue { - RMessage* first; - RMessage* last; - int16 highWaterMark; - int16 size; - -} RMessageQueue; - -void RMessageQueue_init(RMessageQueue* self); - -void RMessageQueue_push(RMessageQueue* self, RMessage* msg); - -RMessage* RMessageQueue_pop(RMessageQueue* self); - -int16 RMessageQueue_getSize(RMessageQueue* self); - -RMessage* RMessageQueue_getFirst(RMessageQueue* self); - -RMessage* RMessageQueue_getLast(RMessageQueue* self); - -boool RMessageQueue_isNotEmpty(RMessageQueue* self); - -int16 RMessageQueue_getHightWaterMark(RMessageQueue* self); - - - -#endif /* _RMESSAGEQUEUE_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.c/src/RMessageService.c b/runtime/org.eclipse.etrice.runtime.c/src/RMessageService.c deleted file mode 100644 index 2fe28406c..000000000 --- a/runtime/org.eclipse.etrice.runtime.c/src/RMessageService.c +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz (initial contribution) - * - *******************************************************************************/ - - -#include "RMessageService.h" - -void RMessageService_init(RMessageService* self, uint8* buffer, uint16 maxBlocks, uint16 blockSize){ - self->messageBuffer.buffer = buffer; - self->messageBuffer.maxBlocks = maxBlocks; - self->messageBuffer.blockSize = blockSize; - RMessageQueue_init(&self->messagePool); - RMessageQueue_init(&self->messageQueue); - - RMessageService_initMessagePool(self); -} - -/* - * initialize message pool with block buffer - * all blocks are added to pool - */ -void RMessageService_initMessagePool(RMessageService* self){ - int i; - - for (i=0; i<self->messageBuffer.maxBlocks; i++){ - RMessage* block = (RMessage*) &self->messageBuffer.buffer[i*self->messageBuffer.blockSize]; - RMessageQueue_push(&self->messagePool, block); - } -} - -void RMessageService_pushMessage(RMessageService* self, RMessage* msg){ - RMessageQueue_push(&self->messageQueue, msg); - -} - -RMessage* RMessageService_popMessage(RMessageService* self){ - return RMessageQueue_pop(&self->messageQueue); -} - - -RMessage* RMessageService_getMessageBuffer(RMessageService* self, int16 size){ - if (size<=self->messageBuffer.blockSize){ - if (self->messagePool.size>0){ - return RMessageQueue_pop(&self->messagePool); - } - } - return NULL; -} - -void RMessageService_returnMessageBuffer(RMessageService* self, RMessage* buffer){ - RMessageQueue_push(&self->messagePool, buffer); -} diff --git a/runtime/org.eclipse.etrice.runtime.c/src/RMessageService.h b/runtime/org.eclipse.etrice.runtime.c/src/RMessageService.h deleted file mode 100644 index fae4e33bb..000000000 --- a/runtime/org.eclipse.etrice.runtime.c/src/RMessageService.h +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz (initial contribution) - * - *******************************************************************************/ - -#ifndef RMESSAGESERVICE_H_ -#define RMESSAGESERVICE_H_ - -#include <stddef.h> -#include "datatypes.h" -#include "RMessageQueue.h" - - -typedef struct RBuffer{ - uint8 *buffer; - uint16 maxBlocks; - uint16 blockSize; -} RBuffer; - -typedef struct RMessageService { - RMessageQueue messageQueue; - RMessageQueue messagePool; - RBuffer messageBuffer; -} RMessageService; - -void RMessageService_init(RMessageService* self, uint8* buffer, uint16 maxBlocks, uint16 blockSize); - -void RMessageService_initMessagePool(RMessageService* self); - -void RMessageService_pushMessage(RMessageService* self, RMessage* msg); -RMessage* RMessageService_popMessage(RMessageService* self); - - -RMessage* RMessageService_getMessageBuffer(RMessageService* self, int16 size); -void RMessageService_returnMessageBuffer(RMessageService* self, RMessage* buffer); - -#endif /* RMESSAGESERVICE_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.c/src/RUnit.c b/runtime/org.eclipse.etrice.runtime.c/src/RUnit.c deleted file mode 100644 index 2a68f5f8f..000000000 --- a/runtime/org.eclipse.etrice.runtime.c/src/RUnit.c +++ /dev/null @@ -1,277 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz (initial contribution) - * - *******************************************************************************/ - -#include "RUnit.h" -#include <string.h> - -/*** member variables */ - -/* file handling */ -static FILE* RUnit_reportfile = NULL; - -/* names */ -static char* RUnit_TestFileName = NULL; -static char* RUnit_TestResultPath = NULL; - -static char* RUnit_TestSuiteName = NULL; -static char* RUnit_TestCaseName = NULL; - -/* counters */ -static etInt32 RUnit_passCount = 0; -static etInt32 RUnit_failCount = 0; - -static boool etUnit_testcaseSuccess = TRUE; - -#define ETUNIT_FAILURE_TEXT_LEN 256 - -static char etUnit_failureText[ETUNIT_FAILURE_TEXT_LEN]; - -/* time measuring */ -static clock_t RUnit_startTime = 0; -static clock_t RUnit_currentTime = 0; - -/* */ - -/* forward declarations of private functions */ -void expect_equal_int(const char* message, etInt32 expected, etInt32 actual); -void expect_equal_uint(const char* message, etUInt32 expected, etUInt32 actual); -void expect_equal_float(const char* message, float64 expected, float64 actual, float64 precision); -void RUnit_writeTestLog(const char *testcase, boool result, const char *resulttext); -void etUnit_handleExpect(boool result, const char *resulttext); - -/* public functions */ - -void RUnit_open(char* testResultPath, char* testFileName) { - RUnit_passCount = 0; - RUnit_failCount = 0; - strcpy(etUnit_failureText,""); - - RUnit_TestFileName = testFileName; - RUnit_TestResultPath = testResultPath; - - printf("************* TEST START (%s) **************\n", RUnit_TestFileName); - - char filename[ETUNIT_FAILURE_TEXT_LEN]; - sprintf(filename, "%s/%s.xml", RUnit_TestResultPath, RUnit_TestFileName); - - if (RUnit_reportfile == NULL) { - RUnit_reportfile = fopen(filename, "w+"); - if (RUnit_reportfile != NULL) { - fprintf(RUnit_reportfile, "<testsuites name=\"%s\" tests=\"0\" failures=\"0\" errors=\"0\" time=\"0\">\n", - RUnit_TestFileName); - } else { - printf("Unable to open file %s/%s.xml\n", RUnit_TestResultPath, RUnit_TestFileName); - } - } - // prepare time measurement - RUnit_startTime = clock(); - RUnit_currentTime = clock(); - printf("Start Time: %ld\n", RUnit_startTime); - -} - -void RUnit_close(void) { - printf("\n"); - if (RUnit_failCount > 0) { - printf("************* TEST FAILED *************\n"); - } else { - printf("************* TEST PASSED *************\n"); - } - printf("Number of Tests: %ld\n", RUnit_failCount + RUnit_passCount); - printf("Failed: %ld\n", RUnit_failCount); - printf("Passed: %ld\n", RUnit_passCount); - printf("Total Time: %ld\n", clock() - RUnit_startTime); - printf("End Time: %ld, CLOCKS_PER_SEC: %ld\n", clock(), CLOCKS_PER_SEC); - printf("***************************************\n"); - - if (RUnit_reportfile != NULL) { - fprintf(RUnit_reportfile, "</testsuites>\n"); - fclose(RUnit_reportfile); - RUnit_reportfile = NULL; - } -} - -void RUnit_openTestSuite(char* testSuiteName) { - RUnit_TestSuiteName = testSuiteName; - if (RUnit_reportfile != NULL) { - fprintf(RUnit_reportfile, "\t<testsuite name=\"%s\" tests=\"0\" failures=\"0\" errors=\"0\" time=\"0\">\n", - RUnit_TestSuiteName); - } -} - -void RUnit_closeTestSuite(void) { - if (RUnit_reportfile != NULL) { - fprintf(RUnit_reportfile, "\t</testsuite>\n"); - } -} - -void RUnit_openTestCase(char* testCaseName) { - RUnit_TestCaseName = testCaseName; - etUnit_testcaseSuccess = TRUE; - strcpy(etUnit_failureText,""); -} - -void RUnit_closeTestCase(void) { - if (RUnit_reportfile != NULL && RUnit_TestSuiteName != NULL) { - RUnit_writeTestLog(RUnit_TestCaseName, etUnit_testcaseSuccess, etUnit_failureText); - } -} - -void EXPECT_TRUE(const char* message, boool condition) { - if (condition == FALSE) { - char testresult[ETUNIT_FAILURE_TEXT_LEN]; - sprintf(testresult, "%s: *** EXPECT_TRUE == FALSE", message); - etUnit_handleExpect(FALSE, testresult); - } else { - etUnit_handleExpect(TRUE, ""); - } -} - -void EXPECT_FALSE(const char* message, boool condition) { - if (condition == TRUE) { - char testresult[ETUNIT_FAILURE_TEXT_LEN]; - sprintf(testresult, "%s: EXPECT_FALSE == TRUE", message); - etUnit_handleExpect(FALSE, testresult); - } else { - etUnit_handleExpect(TRUE, ""); - } -} - -void EXPECT_EQUAL_INT8(const char* message, etInt8 expected, etInt8 actual) { - expect_equal_int(message, (etInt32) expected, (etInt32) actual); -} - -void EXPECT_EQUAL_INT16(const char* message, etInt16 expected, etInt16 actual) { - expect_equal_int(message, (etInt32) expected, (etInt32) actual); -} - -void EXPECT_EQUAL_INT32(const char* message, etInt32 expected, etInt32 actual) { - expect_equal_int(message, (etInt32) expected, (etInt32) actual); -} - -void EXPECT_EQUAL_UINT8(const char* message, etUInt8 expected, etUInt8 actual) { - expect_equal_uint(message, (etUInt32) expected, (etUInt32) actual); -} - -void EXPECT_EQUAL_UINT16(const char* message, etUInt16 expected, etUInt16 actual) { - expect_equal_uint(message, (etUInt32) expected, (etUInt32) actual); -} - -void EXPECT_EQUAL_UINT32(const char* message, etUInt32 expected, etUInt32 actual) { - expect_equal_uint(message, (etUInt32) expected, (etUInt32) actual); -} - - -void EXPECT_EQUAL_FLOAT32(const char* message, float32 expected, float32 actual, float32 precision) { - expect_equal_float(message, (float64) expected, (float64) actual, (float64) precision); -} - -void EXPECT_EQUAL_FLOAT64(const char* message, float64 expected, float64 actual, float64 precision) { - expect_equal_float(message, (float64) expected, (float64) actual, (float64) precision); -} - - -/* private functions */ - -void expect_equal_int(const char* message, etInt32 expected, etInt32 actual) { - if (expected != actual) { - char testresult[ETUNIT_FAILURE_TEXT_LEN]; - sprintf(testresult, "%s: expected=%ld, actual=%ld", message, expected, actual); - etUnit_handleExpect(FALSE, testresult); - } else { - etUnit_handleExpect(TRUE, ""); - } -} - -void expect_equal_uint(const char* message, etUInt32 expected, etUInt32 actual) { - if (expected != actual) { - char testresult[ETUNIT_FAILURE_TEXT_LEN]; - sprintf(testresult, "%s: expected=%lu, actual=%lu", message, expected, actual); - etUnit_handleExpect(FALSE, testresult); - } else { - etUnit_handleExpect(TRUE, ""); - } -} - - -void expect_equal_float(const char* message, float64 expected, float64 actual, float64 precision) { - if (expected - actual < -precision || expected - actual > precision) { - char testresult[ETUNIT_FAILURE_TEXT_LEN]; - sprintf(testresult, "%s: expected=%lf, actual=%lf", message, expected, actual); - etUnit_handleExpect(FALSE, testresult); - } else { - etUnit_handleExpect(TRUE, ""); - } -} - -void expect_equal_void_ptr(const char* message, const void* expected, const void* actual) { - if (expected != actual) { - char testresult[ETUNIT_FAILURE_TEXT_LEN]; - sprintf(testresult, "%s: expected=%ld, actual=%ld", message, (etUInt32) expected, (etUInt32) actual); - etUnit_handleExpect(FALSE, testresult); - } else { - etUnit_handleExpect(TRUE, ""); - } -} - - -//_________ - -void etUnit_handleExpect(boool result, const char *resulttext){ - if (result == TRUE) { - /* nothing to do because no failure */ - } - else { - if (etUnit_testcaseSuccess == TRUE){ - /* first failure will be remembered */ - etUnit_testcaseSuccess = FALSE; - strcpy(etUnit_failureText, resulttext); - } - else{ - /* more than one error will be ignored */ - } - } -} - -void RUnit_buildTestLogXML(char* xml, const char *testcase, boool result, const char *resulttext, clock_t time) { - if (result == TRUE) { - sprintf(xml, "\t\t<testcase name=\"%s\" time=\"%ld\"/>\n", testcase, time); - } else { - sprintf( - xml, - "\t\t<testcase name=\"%s\" classname=\"none\" time=\"%ld\">\n\t\t<failure>%s</failure>\n\t</testcase>\n", - testcase, time, resulttext); - } -} - -void RUnit_writeTestLog(const char *testcase, boool result, const char *resulttext) { - char writeBuffer[ETUNIT_FAILURE_TEXT_LEN]; - - // counting - if (result == TRUE) { - RUnit_passCount++; - printf("PASS: %s: %s\n", testcase, resulttext); - } else { - RUnit_failCount++; - printf("FAIL: %s: %s\n", testcase, resulttext); - } - - clock_t time = clock() - RUnit_currentTime; - RUnit_currentTime = clock(); - - // writing to file - if (RUnit_reportfile != NULL) { - RUnit_buildTestLogXML(writeBuffer, testcase, result, resulttext, time); - fprintf(RUnit_reportfile, writeBuffer); - } -} - diff --git a/runtime/org.eclipse.etrice.runtime.c/src/datatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/etDatatypes.h index 7bcc4826a..f1edfa670 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/datatypes.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/etDatatypes.h @@ -10,14 +10,16 @@ * *******************************************************************************/ -#ifndef _DATATYPES_H_ -#define _DATATYPES_H_ +#ifndef _ETDATATYPES_H_ +#define _ETDATATYPES_H_ /* * typedefs for platform specific datatypes * * */ +#include <stdio.h> + /* unsigned integer datatypes */ typedef unsigned char uint8; typedef unsigned short int uint16; @@ -36,7 +38,7 @@ typedef float float32; typedef double float64; /* boolean datatypes and values */ -typedef char boool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/ +typedef char boolean; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/ #ifndef TRUE #define TRUE 1 #endif @@ -45,11 +47,11 @@ typedef char boool; /* TODO: bool, Bool, Boolean, and boolean are already defin #endif /* - * typedefs for Runtime and Testing + * typedefs for eTrice Runtime and Testing * * */ -typedef uint8 etInt8; +typedef int8 etInt8; typedef int16 etInt16; typedef int32 etInt32; @@ -57,9 +59,11 @@ typedef uint8 etUInt8; typedef uint16 etUInt16; typedef uint32 etUInt32; -typedef boool etBool; +typedef boolean etBool; typedef float32 etFloat32; typedef float64 etFloat64; +typedef FILE* etFileHandle; + #endif /* _DATATYPES_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.c/src/etLogger.c b/runtime/org.eclipse.etrice.runtime.c/src/etLogger.c new file mode 100644 index 000000000..bbba4a628 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.c/src/etLogger.c @@ -0,0 +1,82 @@ +/******************************************************************************* + * Copyright (c) 2011 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Schuetz (initial contribution) + * + *******************************************************************************/ + +/* + * etLogger.c + * + * Created on: 16.01.2012 + * Author: tschuetz + */ + + +#include "etLogger.h" + +#include <stdarg.h> + + +void etLogger_logError(const char* message){ + printf("ERROR: %s", message); + printf("\n"); +} + +void etLogger_logWarning(const char* message){ + printf("WARNING: %s", message); + printf("\n"); +} + +void etLogger_logInfo(const char* message){ + printf("INFO: %s", message); + printf("\n"); +} + +void etLogger_logErrorF(const char* format, ... ){ + printf("ERROR: "); + va_list arglist; + va_start( arglist, format ); + vprintf( format, arglist ); + va_end( arglist ); + printf("\n"); +} + +void etLogger_logWarningF(const char* format, ... ){ + printf("WARNING: "); + va_list arglist; + va_start( arglist, format ); + vprintf( format, arglist ); + va_end( arglist ); + printf("\n"); +} + +void etLogger_logInfoF(const char* format, ... ){ + printf("INFO: "); + va_list arglist; + va_start( arglist, format ); + vprintf( format, arglist ); + va_end( arglist ); + printf("\n"); +} + +etFileHandle etLogger_fopen(const char* filename, const char* mode){ + return( fopen(filename, mode) ); +} + +int etLogger_fclose(etFileHandle file){ + return( fclose(file) ); +} + +void etLogger_fprintf(etFileHandle file, const char* format, ... ){ + va_list arglist; + va_start( arglist, format ); + vfprintf(file, format, arglist ); + va_end( arglist ); + +} diff --git a/runtime/org.eclipse.etrice.runtime.c/src/etLogger.h b/runtime/org.eclipse.etrice.runtime.c/src/etLogger.h new file mode 100644 index 000000000..b353e6f1a --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.c/src/etLogger.h @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2011 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Schuetz (initial contribution) + * + *******************************************************************************/ + +/* + * etLogger.h + * + * Created on: 16.01.2012 + * Author: tschuetz + */ + +#ifndef _ETLOGGER_H_ +#define _ETLOGGER_H_ + +#include <stdio.h> +#include "etDatatypes.h" +/* logging */ + +void etLogger_logError(const char* message); + +void etLogger_logWarning(const char* message); + +void etLogger_logInfo(const char* message); + +void etLogger_logErrorF(const char* format, ... ); + +void etLogger_logWarningF(const char* format, ... ); + +void etLogger_logInfoF(const char* format, ... ); + + +/* File handling */ + +etFileHandle etLogger_fopen(const char* filename, const char* mode); + +int etLogger_fclose(etFileHandle file); + +void etLogger_fprintf(etFileHandle file, const char* format, ... ); + +#endif /* _ETLOGGER_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.c/src/RMessage.c b/runtime/org.eclipse.etrice.runtime.c/src/etMessage.c index 9e67a84c2..940dc61c2 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/RMessage.c +++ b/runtime/org.eclipse.etrice.runtime.c/src/etMessage.c @@ -10,11 +10,11 @@ * *******************************************************************************/ -#include "RMessage.h" +#include "etMessage.h" #include <stddef.h> -void RMessage_init(RMessage* self){ +void etMessage_init(etMessage* self){ self->next = NULL; self->address = 0; self->evtID = 0; diff --git a/runtime/org.eclipse.etrice.runtime.c/src/etMessage.h b/runtime/org.eclipse.etrice.runtime.c/src/etMessage.h new file mode 100644 index 000000000..7bba6a1f3 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.c/src/etMessage.h @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2011 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Schuetz (initial contribution) + * + *******************************************************************************/ + +#ifndef _ETMESSAGE_H_ +#define _ETMESSAGE_H_ + +#include "etDatatypes.h" + +typedef struct etMessage{ + struct etMessage* next; + etInt16 address; + etInt16 evtID; +} etMessage; + +void etMessage_init(etMessage* self); + +#endif /* _ETMESSAGE_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.c b/runtime/org.eclipse.etrice.runtime.c/src/etMessageQueue.c index 0c28cdec9..2575d1a1d 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.c +++ b/runtime/org.eclipse.etrice.runtime.c/src/etMessageQueue.c @@ -10,9 +10,9 @@ * *******************************************************************************/ -#include "RMessageQueue.h" +#include "etMessageQueue.h" -void RMessageQueue_init(RMessageQueue* self){ +void etMessageQueue_init(etMessageQueue* self){ self->first = NULL; self->last = NULL; self->highWaterMark = 0; @@ -20,7 +20,7 @@ void RMessageQueue_init(RMessageQueue* self){ } -void RMessageQueue_push(RMessageQueue* self, RMessage* msg){ +void etMessageQueue_push(etMessageQueue* self, etMessage* msg){ // TODO: optimize queue for concurrent push / pop if (self->first == NULL) { /*no message in queue*/ @@ -37,8 +37,8 @@ void RMessageQueue_push(RMessageQueue* self, RMessage* msg){ self->highWaterMark++; } -RMessage* RMessageQueue_pop(RMessageQueue* self){ - RMessage* pop_msg = self->first; +etMessage* etMessageQueue_pop(etMessageQueue* self){ + etMessage* pop_msg = self->first; if(self->first == NULL){ /*no message in queue*/ return NULL; @@ -58,22 +58,22 @@ RMessage* RMessageQueue_pop(RMessageQueue* self){ return pop_msg; } -int16 RMessageQueue_getSize(RMessageQueue* self) { +etInt16 etMessageQueue_getSize(etMessageQueue* self) { return self->size; } -RMessage* RMessageQueue_getFirst(RMessageQueue* self){ +etMessage* etMessageQueue_getFirst(etMessageQueue* self){ return self->first; } -RMessage* RMessageQueue_getLast(RMessageQueue* self){ +etMessage* etMessageQueue_getLast(etMessageQueue* self){ return self->last; } -boool RMessageQueue_isNotEmpty(RMessageQueue* self){ +etBool etMessageQueue_isNotEmpty(etMessageQueue* self){ return self->last != NULL; } -int16 RMessageQueue_getHightWaterMark(RMessageQueue* self) { +etInt16 etMessageQueue_getHightWaterMark(etMessageQueue* self) { return self->highWaterMark; } diff --git a/runtime/org.eclipse.etrice.runtime.c/src/etMessageQueue.h b/runtime/org.eclipse.etrice.runtime.c/src/etMessageQueue.h new file mode 100644 index 000000000..7fa27ff8a --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.c/src/etMessageQueue.h @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2011 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Schuetz (initial contribution) + * + *******************************************************************************/ + +#ifndef _ETMESSAGEQUEUE_H_ +#define _ETMESSAGEQUEUE_H_ + +#include "etMessage.h" +#include <stddef.h> + +typedef struct etMessageQueue { + etMessage* first; + etMessage* last; + etInt16 highWaterMark; + etInt16 size; + +} etMessageQueue; + +void etMessageQueue_init(etMessageQueue* self); + +void etMessageQueue_push(etMessageQueue* self, etMessage* msg); + +etMessage* etMessageQueue_pop(etMessageQueue* self); + +etMessage* etMessageQueue_getFirst(etMessageQueue* self); + +etMessage* etMessageQueue_getLast(etMessageQueue* self); + +etBool etMessageQueue_isNotEmpty(etMessageQueue* self); + +etInt16 etMessageQueue_getHightWaterMark(etMessageQueue* self); + +etInt16 etMessageQueue_getSize(etMessageQueue* self); + + + +#endif /* _RMESSAGEQUEUE_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.c/src/etMessageService.c b/runtime/org.eclipse.etrice.runtime.c/src/etMessageService.c new file mode 100644 index 000000000..dcf04e0ba --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.c/src/etMessageService.c @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2011 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Schuetz (initial contribution) + * + *******************************************************************************/ + + +#include "etMessageService.h" + +void etMessageService_init(etMessageService* self, etUInt8* buffer, etUInt16 maxBlocks, etUInt16 blockSize){ + self->messageBuffer.buffer = buffer; + self->messageBuffer.maxBlocks = maxBlocks; + self->messageBuffer.blockSize = blockSize; + etMessageQueue_init(&self->messagePool); + etMessageQueue_init(&self->messageQueue); + + etMessageService_initMessagePool(self); +} + +/* + * initialize message pool with block buffer + * all blocks are added to pool + */ +void etMessageService_initMessagePool(etMessageService* self){ + etInt16 i; + + for (i=0; i<self->messageBuffer.maxBlocks; i++){ + etMessage* block = (etMessage*) &self->messageBuffer.buffer[i*self->messageBuffer.blockSize]; + etMessageQueue_push(&self->messagePool, block); + } +} + +void etMessageService_pushMessage(etMessageService* self, etMessage* msg){ + etMessageQueue_push(&self->messageQueue, msg); + +} + +etMessage* etMessageService_popMessage(etMessageService* self){ + return etMessageQueue_pop(&self->messageQueue); +} + + +etMessage* etMessageService_getMessageBuffer(etMessageService* self, etUInt16 size){ + if (size<=self->messageBuffer.blockSize){ + if (self->messagePool.size>0){ + return etMessageQueue_pop(&self->messagePool); + } + } + return NULL; +} + +void etMessageService_returnMessageBuffer(etMessageService* self, etMessage* buffer){ + etMessageQueue_push(&self->messagePool, buffer); +} diff --git a/runtime/org.eclipse.etrice.runtime.c/src/etMessageService.h b/runtime/org.eclipse.etrice.runtime.c/src/etMessageService.h new file mode 100644 index 000000000..12f02885b --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.c/src/etMessageService.h @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2011 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Schuetz (initial contribution) + * + *******************************************************************************/ + +#ifndef _ETMESSAGESERVICE_H_ +#define _ETMESSAGESERVICE_H_ + +#include <stddef.h> +#include "etDatatypes.h" +#include "etMessageQueue.h" + + +typedef struct RBuffer{ + etUInt8 *buffer; + etUInt16 maxBlocks; + etUInt16 blockSize; +} RBuffer; + +typedef struct etMessageService { + etMessageQueue messageQueue; + etMessageQueue messagePool; + RBuffer messageBuffer; +} etMessageService; + +void etMessageService_init(etMessageService* self, etUInt8* buffer, etUInt16 maxBlocks, etUInt16 blockSize); + +void etMessageService_initMessagePool(etMessageService* self); + +void etMessageService_pushMessage(etMessageService* self, etMessage* msg); +etMessage* etMessageService_popMessage(etMessageService* self); + + +etMessage* etMessageService_getMessageBuffer(etMessageService* self, etUInt16 size); +void etMessageService_returnMessageBuffer(etMessageService* self, etMessage* buffer); + +#endif /* RMESSAGESERVICE_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.c/src/etUnit.c b/runtime/org.eclipse.etrice.runtime.c/src/etUnit.c new file mode 100644 index 000000000..30460e278 --- /dev/null +++ b/runtime/org.eclipse.etrice.runtime.c/src/etUnit.c @@ -0,0 +1,338 @@ +/******************************************************************************* + * Copyright (c) 2011 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Thomas Schuetz (initial contribution) + * + *******************************************************************************/ + +#include "etUnit.h" +#include <string.h> +#include <time.h> +#include "etLogger.h" + + +/*** member variables */ + +/* file handling */ +static FILE* etUnit_reportfile = NULL; + +/* names */ +static char* etUnit_TestFileName = NULL; +static char* etUnit_TestResultPath = NULL; + +static char* etUnit_TestSuiteName = NULL; +static char* etUnit_TestCaseName = NULL; + +/* counters */ +static etInt32 etUnit_passCount = 0; +static etInt32 etUnit_failCount = 0; +static etInt32 etUnit_passCountTotal = 0; +static etInt32 etUnit_failCountTotal = 0; + +static etBool etUnit_testcaseSuccess = TRUE; + +#define ETUNIT_FAILURE_TEXT_LEN 256 + +static char etUnit_failureText[ETUNIT_FAILURE_TEXT_LEN]; + +/* time measuring */ +static clock_t etUnit_startTime = 0; +static clock_t etUnit_currentTime = 0; + +/* forward declarations of private functions */ +void expect_equal_int(const char* message, etInt32 expected, etInt32 actual); +void expect_equal_uint(const char* message, etUInt32 expected, etUInt32 actual); +void expect_equal_float(const char* message, etFloat64 expected, etFloat64 actual, etFloat64 precision); +void etUnit_writeTestLog(const char *testcase, etBool result, const char *resulttext); +void etUnit_handleExpect(etBool result, const char *resulttext); + +/* public functions */ + +void etUnit_open(char* testResultPath, char* testFileName) { + etUnit_passCount = 0; + etUnit_failCount = 0; + strcpy(etUnit_failureText,""); + + etUnit_TestFileName = testFileName; + etUnit_TestResultPath = testResultPath; + + etLogger_logInfoF("************* TEST START (%s) **************", etUnit_TestFileName); + + char filename[ETUNIT_FAILURE_TEXT_LEN]; + sprintf(filename, "%s/%s.xml", etUnit_TestResultPath, etUnit_TestFileName); + + if (etUnit_reportfile == NULL) { + etUnit_reportfile = etLogger_fopen(filename, "w+"); + if (etUnit_reportfile != NULL) { + etLogger_fprintf(etUnit_reportfile, "<testsuites name=\"%s\" tests=\"0\" failures=\"0\" errors=\"0\" time=\"0\">\n", etUnit_TestFileName); + } else { + etLogger_logErrorF("Unable to open file %s/%s.xml", etUnit_TestResultPath, etUnit_TestFileName); + } + } + // prepare time measurement + etUnit_startTime = clock(); + etUnit_currentTime = clock(); + etLogger_logInfoF("Start Time: %ld", etUnit_startTime); + +} + +void etUnit_close(void) { + etLogger_logInfoF(""); + if (etUnit_failCount > 0) { + etLogger_logInfoF("************* TEST FAILED *************"); + } else { + etLogger_logInfoF("************* TEST PASSED *************"); + } + etLogger_logInfoF("Number of Tests: %ld", etUnit_failCount + etUnit_passCount); + etLogger_logInfoF("Failed: %ld", etUnit_failCount); + etLogger_logInfoF("Passed: %ld", etUnit_passCount); + etLogger_logInfoF("Time: %ld", clock() - etUnit_startTime); + etLogger_logInfoF("End Time: %ld[ms]", (clock() / 1000) * CLOCKS_PER_SEC ); + etLogger_logInfoF("***************************************"); + if (etUnit_failCountTotal > 0) { + etLogger_logInfoF(" ******* %d TEST(S) FAILED *****", etUnit_failCountTotal); + } else { + etLogger_logInfoF(" ******* ALL TESTS PASSED ******"); + } + etLogger_logInfoF("***************************************"); + + if (etUnit_reportfile != NULL) { + etLogger_fprintf(etUnit_reportfile, "</testsuites>\n"); + etLogger_fclose(etUnit_reportfile); + etUnit_reportfile = NULL; + } +} + +void etUnit_openTestSuite(char* testSuiteName) { + etUnit_TestSuiteName = testSuiteName; + if (etUnit_reportfile != NULL) { + etLogger_fprintf(etUnit_reportfile, "\t<testsuite name=\"%s\" tests=\"0\" failures=\"0\" errors=\"0\" time=\"0\">\n", + etUnit_TestSuiteName); + } +} + +void etUnit_closeTestSuite(void) { + if (etUnit_reportfile != NULL) { + etLogger_fprintf(etUnit_reportfile, "\t</testsuite>\n"); + } +} + +void etUnit_openTestCase(char* testCaseName) { + etUnit_TestCaseName = testCaseName; + etUnit_testcaseSuccess = TRUE; + strcpy(etUnit_failureText,""); +} + +void etUnit_closeTestCase(void) { + if (etUnit_reportfile != NULL && etUnit_TestSuiteName != NULL) { + etUnit_writeTestLog(etUnit_TestCaseName, etUnit_testcaseSuccess, etUnit_failureText); + } +} + +void etUnit_openAll(char* testResultPath, char* testFileName, char* testSuiteName, char* testCaseName){ + etUnit_open(testResultPath, testFileName); + etUnit_openTestSuite(testSuiteName); + etUnit_openTestCase(testCaseName); +} + +void etUnit_closeAll(void){ + etUnit_closeTestCase(); + etUnit_closeTestSuite(); + etUnit_close(); +} + +void EXPECT_TRUE(const char* message, etBool condition) { + if (condition == FALSE) { + char testresult[ETUNIT_FAILURE_TEXT_LEN]; + sprintf(testresult, "%s: *** EXPECT_TRUE == FALSE", message); + etUnit_handleExpect(FALSE, testresult); + } else { + etUnit_handleExpect(TRUE, ""); + } +} + +void EXPECT_FALSE(const char* message, etBool condition) { + if (condition == TRUE) { + char testresult[ETUNIT_FAILURE_TEXT_LEN]; + sprintf(testresult, "%s: EXPECT_FALSE == TRUE", message); + etUnit_handleExpect(FALSE, testresult); + } else { + etUnit_handleExpect(TRUE, ""); + } +} + +void EXPECT_EQUAL_INT8(const char* message, etInt8 expected, etInt8 actual) { + expect_equal_int(message, (etInt32) expected, (etInt32) actual); +} + +void EXPECT_EQUAL_INT16(const char* message, etInt16 expected, etInt16 actual) { + expect_equal_int(message, (etInt32) expected, (etInt32) actual); +} + +void EXPECT_EQUAL_INT32(const char* message, etInt32 expected, etInt32 actual) { + expect_equal_int(message, (etInt32) expected, (etInt32) actual); +} + +void EXPECT_EQUAL_UINT8(const char* message, etUInt8 expected, etUInt8 actual) { + expect_equal_uint(message, (etUInt32) expected, (etUInt32) actual); +} + +void EXPECT_EQUAL_UINT16(const char* message, etUInt16 expected, etUInt16 actual) { + expect_equal_uint(message, (etUInt32) expected, (etUInt32) actual); +} + +void EXPECT_EQUAL_UINT32(const char* message, etUInt32 expected, etUInt32 actual) { + expect_equal_uint(message, (etUInt32) expected, (etUInt32) actual); +} + + +void EXPECT_EQUAL_FLOAT32(const char* message, etFloat32 expected, etFloat32 actual, etFloat32 precision) { + expect_equal_float(message, (etFloat64) expected, (etFloat64) actual, (etFloat64) precision); +} + +void EXPECT_EQUAL_FLOAT64(const char* message, etFloat64 expected, etFloat64 actual, etFloat64 precision) { + expect_equal_float(message, (etFloat64) expected, (etFloat64) actual, (etFloat64) precision); +} + +/* order */ +static etInt16 etUnit_orderCurrentIndex = 0; +static etInt16 etUnit_orderSize = 0; +static etInt16* etUnit_orderList = NULL; + +void EXPECT_ORDER_START(etInt16* list, etInt16 size){ + etUnit_orderCurrentIndex = 0; + etUnit_orderSize = size; + etUnit_orderList = list; +} + +void EXPECT_ORDER(const char* message, etInt16 identifier){ + if (etUnit_orderCurrentIndex < etUnit_orderSize) { + if (etUnit_orderList[etUnit_orderCurrentIndex] != identifier){ + char testresult[ETUNIT_FAILURE_TEXT_LEN]; + sprintf(testresult, "EXPECT_ORDER %s: index=%d, expected=%d, actual=%d", message, etUnit_orderCurrentIndex, identifier, etUnit_orderList[etUnit_orderCurrentIndex]); + etUnit_handleExpect(FALSE, testresult); + } + else { + etUnit_handleExpect(TRUE, ""); + etUnit_orderCurrentIndex++; + } + } + else { + char testresult[ETUNIT_FAILURE_TEXT_LEN]; + sprintf(testresult, "EXPECT_ORDER: index(%d) is too big in %s", etUnit_orderCurrentIndex, message); + etUnit_handleExpect(FALSE, testresult); + etLogger_logInfoF("EXPECT_ORDER: index too big in %s", message); + } +} + +void EXPECT_ORDER_END(const char* message, etInt16 identifier){ + EXPECT_ORDER(message, identifier); + if (etUnit_orderCurrentIndex != etUnit_orderSize){ + char testresult[ETUNIT_FAILURE_TEXT_LEN]; + sprintf(testresult, "EXPECT_ORDER_END %s: wrong index at the end: expected=%d, actual=%d", message, etUnit_orderSize, etUnit_orderCurrentIndex); + etUnit_handleExpect(FALSE, testresult); + } +} + +/* private functions */ + +void expect_equal_int(const char* message, etInt32 expected, etInt32 actual) { + if (expected != actual) { + char testresult[ETUNIT_FAILURE_TEXT_LEN]; + sprintf(testresult, "%s: expected=%ld, actual=%ld", message, expected, actual); + etUnit_handleExpect(FALSE, testresult); + } else { + etUnit_handleExpect(TRUE, ""); + } +} + +void expect_equal_uint(const char* message, etUInt32 expected, etUInt32 actual) { + if (expected != actual) { + char testresult[ETUNIT_FAILURE_TEXT_LEN]; + sprintf(testresult, "%s: expected=%lu, actual=%lu", message, expected, actual); + etUnit_handleExpect(FALSE, testresult); + } else { + etUnit_handleExpect(TRUE, ""); + } +} + + +void expect_equal_float(const char* message, etFloat64 expected, etFloat64 actual, etFloat64 precision) { + if (expected - actual < -precision || expected - actual > precision) { + char testresult[ETUNIT_FAILURE_TEXT_LEN]; + sprintf(testresult, "%s: expected=%lf, actual=%lf", message, expected, actual); + etUnit_handleExpect(FALSE, testresult); + } else { + etUnit_handleExpect(TRUE, ""); + } +} + +void expect_equal_void_ptr(const char* message, const void* expected, const void* actual) { + if (expected != actual) { + char testresult[ETUNIT_FAILURE_TEXT_LEN]; + sprintf(testresult, "%s: expected=%ld, actual=%ld", message, (etUInt32) expected, (etUInt32) actual); + etUnit_handleExpect(FALSE, testresult); + } else { + etUnit_handleExpect(TRUE, ""); + } +} + + +//_________ + +void etUnit_handleExpect(etBool result, const char *resulttext){ + if (result == TRUE) { + /* nothing to do because no failure */ + } + else { + if (etUnit_testcaseSuccess == TRUE){ + /* first failure will be remembered */ + etUnit_testcaseSuccess = FALSE; + strcpy(etUnit_failureText, resulttext); + } + else{ + /* more than one error will be ignored */ + } + } +} + +void etUnit_buildTestLogXML(char* xml, const char *testcase, etBool result, const char *resulttext, clock_t time) { + if (result == TRUE) { + sprintf(xml, "\t\t<testcase name=\"%s\" time=\"%ld\"/>\n", testcase, time); + } else { + sprintf( + xml, + "\t\t<testcase name=\"%s\" classname=\"none\" time=\"%ld\">\n\t\t<failure>%s</failure>\n\t</testcase>\n", + testcase, time, resulttext); + } +} + +void etUnit_writeTestLog(const char *testcase, etBool result, const char *resulttext) { + char writeBuffer[ETUNIT_FAILURE_TEXT_LEN]; + + // counting + if (result == TRUE) { + etUnit_passCount++; + etUnit_passCountTotal++; + etLogger_logInfoF("PASS: %s %s", testcase, resulttext); + } else { + etUnit_failCount++; + etUnit_failCountTotal++; + etLogger_logInfoF("FAIL: %s : %s", testcase, resulttext); + } + + clock_t time = clock() - etUnit_currentTime; + etUnit_currentTime = clock(); + + // writing to file + if (etUnit_reportfile != NULL) { + etUnit_buildTestLogXML(writeBuffer, testcase, result, resulttext, time); + etLogger_fprintf(etUnit_reportfile, writeBuffer); + } +} + diff --git a/runtime/org.eclipse.etrice.runtime.c/src/RUnit.h b/runtime/org.eclipse.etrice.runtime.c/src/etUnit.h index a3badcc7e..dcaa28306 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/RUnit.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/etUnit.h @@ -10,21 +10,24 @@ * *******************************************************************************/ -#ifndef _RUNIT_H_ -#define _RUNIT_H_ +#ifndef _ETUNIT_H_ +#define _ETUNIT_H_ -#include "datatypes.h" -#include <stdio.h> -#include <time.h> +#include "etDatatypes.h" -// open / close -void RUnit_open(char* testResultPath, char* testFileName); -void RUnit_close(void); -void RUnit_openTestSuite(char* testSuiteName); -void RUnit_closeTestSuite(void); -void RUnit_openTestCase(char* testCaseName); -void RUnit_closeTestCase(void); +/* open / close */ +void etUnit_open(char* testResultPath, char* testFileName); +void etUnit_close(void); +void etUnit_openTestSuite(char* testSuiteName); +void etUnit_closeTestSuite(void); +void etUnit_openTestCase(char* testCaseName); +void etUnit_closeTestCase(void); + +/* functions for more convenience for model and generator tests */ + +void etUnit_openAll(char* testResultPath, char* testFileName, char* testSuiteName, char* testCaseName); +void etUnit_closeAll(void); /* boolean values */ void EXPECT_TRUE(const char* testcase, etBool condition); @@ -50,4 +53,18 @@ void EXPECT_EQUAL_FLOAT64(const char* testcase, etFloat64 expected, etFloat64 ac void expect_equal_void_ptr(const char* testcase, const void* expected, const void* actual); -#endif /* _RUNIT_H_ */ +/* more specialized functions */ +void EXPECT_ORDER_START(etInt16* list, etInt16 size); +void EXPECT_ORDER(const char* message, etInt16 identifier); +void EXPECT_ORDER_END(const char* message, etInt16 identifier); + + +/* Helpers for adding testcases */ + +#define ADD_TESTCASE(testcase) \ + etUnit_openTestCase(#testcase); \ + testcase(); \ + etUnit_closeTestCase(); + + +#endif /* _ETUNIT_H_ */ diff --git a/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/ChoicePointTest/CPUser.java b/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/ChoicePointTest/CPUser.java index 13a4657ba..1172d9aca 100644 --- a/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/ChoicePointTest/CPUser.java +++ b/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/ChoicePointTest/CPUser.java @@ -32,7 +32,7 @@ public class CPUser extends ActorClassBase { protected static final int IFITEM_TestPort1 = 1;
//--------------------- attributes
- protected int counter = 0;
+ protected int counter;
//--------------------- operations
//--------------------- construction
diff --git a/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/HandlerTest/HandlerUser.java b/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/HandlerTest/HandlerUser.java index 1d78210d8..a43945dd1 100644 --- a/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/HandlerTest/HandlerUser.java +++ b/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/HandlerTest/HandlerUser.java @@ -32,7 +32,7 @@ public class HandlerUser extends ActorClassBase { protected static final int IFITEM_TestPort1 = 1;
//--------------------- attributes
- protected int counter = 0;
+ protected int counter;
//--------------------- operations
//--------------------- construction
diff --git a/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/PingPongThreadTest/MrPingActor.java b/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/PingPongThreadTest/MrPingActor.java index 5d6daf09a..e6d4384c4 100644 --- a/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/PingPongThreadTest/MrPingActor.java +++ b/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/PingPongThreadTest/MrPingActor.java @@ -36,8 +36,8 @@ public class MrPingActor extends ActorClassBase { protected static final int IFITEM_timer = 4;
//--------------------- attributes
- protected int count = 0;
- protected int pongCount = 0;
+ protected int count;
+ protected int pongCount;
//--------------------- operations
//--------------------- construction
diff --git a/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/PingPongThreadTestReplPort/MrPingActor.java b/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/PingPongThreadTestReplPort/MrPingActor.java index 1b3d3090c..cd19c4098 100644 --- a/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/PingPongThreadTestReplPort/MrPingActor.java +++ b/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/PingPongThreadTestReplPort/MrPingActor.java @@ -32,8 +32,8 @@ public class MrPingActor extends ActorClassBase { protected static final int IFITEM_timer = 2;
//--------------------- attributes
- protected int count = 0;
- protected int pongCount = 0;
+ protected int count;
+ protected int pongCount;
//--------------------- operations
//--------------------- construction
diff --git a/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/SendingDataByValueTest/MrPing.java b/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/SendingDataByValueTest/MrPing.java index 2a57ae280..5cefa4b1f 100644 --- a/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/SendingDataByValueTest/MrPing.java +++ b/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/SendingDataByValueTest/MrPing.java @@ -32,8 +32,8 @@ public class MrPing extends ActorClassBase { protected static final int IFITEM_PingPongPort = 1;
//--------------------- attributes
- protected int[] i32Array = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- protected PingPongData data = new PingPongData();
+ protected int[] i32Array;
+ protected PingPongData data;
//--------------------- operations
public void printData(PingPongData d) {
System.out.printf("MrPing:\n");
@@ -54,6 +54,7 @@ public class MrPing extends ActorClassBase { setClassName("MrPing");
// initialize attributes
+ i32Array = new int[10];
for (int i=0;i<10;i++){
i32Array[i] = 0;
}
diff --git a/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/SendingDataByValueTest/PingPongData.java b/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/SendingDataByValueTest/PingPongData.java index f59e79ba1..d2953579f 100644 --- a/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/SendingDataByValueTest/PingPongData.java +++ b/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/SendingDataByValueTest/PingPongData.java @@ -7,15 +7,15 @@ public class PingPongData { //--------------------- attributes
- protected byte i8Val = 34;
- protected short i16Val = 24;
- protected int i32Val = 12;
- protected char charVal = 'c';
- protected float f32Val = 4711.0815f;
- protected double f64Val = 47114711.08150815;
- protected String stringVal = "Du alter Depp !";
- protected int[] arrayFromInt32 = {1,2,3,4,5};
- protected PingPongDataDeep ownType = new PingPongDataDeep();
+ protected byte i8Val;
+ protected short i16Val;
+ protected int i32Val;
+ protected char charVal;
+ protected float f32Val;
+ protected double f64Val;
+ protected String stringVal;
+ protected int[] arrayFromInt32;
+ protected PingPongDataDeep ownType;
//--------------------- attribute setters and getters
public void setI8Val (byte i8Val) {
@@ -86,6 +86,7 @@ public class PingPongData { f32Val = 4711.0815f;
f64Val = 47114711.08150815;
stringVal = "Du alter Depp !";
+ arrayFromInt32 = new int[] {1,2,3,4,5};
ownType = new PingPongDataDeep();
}
diff --git a/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/SendingDataByValueTest/PingPongDataDeep.java b/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/SendingDataByValueTest/PingPongDataDeep.java index d73594ef6..46eef63d5 100644 --- a/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/SendingDataByValueTest/PingPongDataDeep.java +++ b/tests/org.eclipse.etrice.integration.tests/src-gen/org/eclipse/etrice/integration/SendingDataByValueTest/PingPongDataDeep.java @@ -7,14 +7,14 @@ public class PingPongDataDeep { //--------------------- attributes
- protected byte i8Val = 0;
- protected short i16Val = 0;
- protected int i32Val = 0;
- protected char charVal = 0;
- protected float f32Val = 0;
- protected double f64Val = 0;
- protected String stringVal = "";
- protected int[] arrayFromInt32 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ protected byte i8Val;
+ protected short i16Val;
+ protected int i32Val;
+ protected char charVal;
+ protected float f32Val;
+ protected double f64Val;
+ protected String stringVal;
+ protected int[] arrayFromInt32;
//--------------------- attribute setters and getters
public void setI8Val (byte i8Val) {
@@ -79,6 +79,7 @@ public class PingPongDataDeep { f32Val = 0;
f64Val = 0;
stringVal = "";
+ arrayFromInt32 = new int[10];
for (int i=0;i<10;i++){
arrayFromInt32[i] = 0;
}
|