Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

choice generation bug #80

Open
Mike-M0 opened this issue Jul 3, 2024 · 1 comment
Open

choice generation bug #80

Mike-M0 opened this issue Jul 3, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Mike-M0
Copy link

Mike-M0 commented Jul 3, 2024

Describe the bug

From my understanding: For any element which is marked as "choice" in xsd, the generated c structure should look like:
typedef struct mainType { union { typeA elementA; typeB elementB; ... }; int elementA_isUsed:1; int elementB_isUsed:1; ... };
currently all elements are added to the structure directly instead.

This is very inefficient in memory usage and can easily lead to en/decoding errors.

To Reproduce

This happens for all din, iso-2 and -20 types.
In multiple structures, e.g. in ParameterSetType -> ParameterType, where the parameter could be one of type per standard:
bool, byte, short, int, physical, or string, but never multiple at once.

Anything else?

The general functionality of union seems to be there.
The PGPData a union is generated, but in completely wrong way which overwrites itself.

@Mike-M0 Mike-M0 added the bug Something isn't working label Jul 3, 2024
@SiebrenW
Copy link
Contributor

PGPData is not really used in a valid ISO15118 or DIN 70121 (see here: #56 (comment))

Though I think this is a case for excluding its generation altogether, because this is a recurring report, or generate a comment explaining the situation.

I think it's trivial to fix, but also trivial to bump something more important over in the process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants