statecharts icon indicating copy to clipboard operation
statecharts copied to clipboard

Add Type Conversion for String and Number types

Open andreasmuelder opened this issue 9 years ago • 6 comments

It should be possible to write var x : string var y : integer var z : string = x + y Like in Java

andreasmuelder avatar May 08 '15 12:05 andreasmuelder

Created branch String_Type_Conversion

andreasmuelder avatar May 18 '15 15:05 andreasmuelder

added testmodel (.sct) and testcase (.sctunit) added generated tests for Java, interpreter, C and C++ (c and c++ still fails)

bohl-itemis avatar May 20 '15 14:05 bohl-itemis

@muehlbrandt can you extend C and C++ code generator?

andreasmuelder avatar May 20 '15 14:05 andreasmuelder

Should be possible by the end of this week.

muehlbrandt avatar May 20 '15 14:05 muehlbrandt

Anything new on this, Markus?

andreasmuelder avatar Jul 13 '15 14:07 andreasmuelder

The problem with string concat in C is the dynamic memory allocation which is necessary to increase the string buffer sizes. An advantage of the currently generated code base is that it is internally completly free of dynamic memory allocation.

The implementation of memory allocation often depends on the used target platform. In the context of embedded systems it is often not possible to dynamically allocate memory because of security requirements or due to limitations of the target platform. For this reasons i would avoid to do the dynamic memory allocation within the generated statemachine code.

A possible solution could be to do the string concatenation within some external functions which will be part of the required API. So the client has to implement the concat functionality and has full control of the memory management.

To make things easier we could provide a default implementation of the concat function with memory management which could be compiled with the GNU Compiler Collection.

muehlbrandt avatar Aug 07 '15 13:08 muehlbrandt