Skip to content

Revise modeling and code generation for default string size#913

Merged
bocchino merged 11 commits intomainfrom
issue-903-default-string-size
Feb 5, 2026
Merged

Revise modeling and code generation for default string size#913
bocchino merged 11 commits intomainfrom
issue-903-default-string-size

Conversation

@bocchino
Copy link
Collaborator

@bocchino bocchino commented Jan 29, 2026

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.


val formatLoop = indexIterator(lines(
s"""|Fw::String tmp;
s"""|// Array data
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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 */
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwest115 I completely removed the default default string size. The code generation now depends only on the symbolic constant FW_FIXED_LENGTH_STRING_SIZE. That is what we said in #903.

val hppLines = {
val defLine = line(s"$name = $value")
List(
line(s"enum FppConstant_$name {"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the enum type here. It was causing the compiler to complain about comparing enum values with different types.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@bocchino bocchino marked this pull request as ready for review January 30, 2026 00:39
@bocchino bocchino added the fprime-fpp tandem F Prime and FPP tandem development label Jan 30, 2026
Copy link
Collaborator

@jwest115 jwest115 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

@bocchino bocchino merged commit 390659b into main Feb 5, 2026
17 checks passed
@bocchino bocchino deleted the issue-903-default-string-size branch February 5, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fprime-fpp tandem F Prime and FPP tandem development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make default string size configurable in the model

2 participants