Revise modeling and code generation for default string size#913
Revise modeling and code generation for default string size#913
Conversation
… from fpp-to-dict and fpp-to-cpp, regenerate tests
|
|
||
| val formatLoop = indexIterator(lines( | ||
| s"""|Fw::String tmp; | ||
| s"""|// Array data |
There was a problem hiding this comment.
@Kronos3 I decided to simplify the code generation here. Testing the old code was difficult, and IMO it is over-optimized. If you are hitting this case (trying to write a large array of strings into a much smaller string) then your system is mistuned anyway -- so I don't think we should try to optimize it.
|
|
||
| case object DictionaryJsonEncoderState { | ||
|
|
||
| /** The default string size */ |
| val hppLines = { | ||
| val defLine = line(s"$name = $value") | ||
| List( | ||
| line(s"enum FppConstant_$name {"), |
There was a problem hiding this comment.
I removed the enum type here. It was causing the compiler to complain about comparing enum values with different types.
There was a problem hiding this comment.
Update: I had to add static casts to remove the warnings on gcc. So removing the enum type isn't necessary. However, I also think that the enum type doesn't really add anything there, so we can remove it.
Add static cast to eliminate gcc warnings
jwest115
left a comment
There was a problem hiding this comment.
Looks good to me, thanks!
Supersedes #909. I needed to make a new PR with a branch in the repo, because this work is exposing bugs in FPP Test, so this is a tandem development with F Prime.
Tandem development is on this branch: https://github.com/bocchino/fprime/tree/fpp-issue-903-default-string-size.
Closes #903.