-
Notifications
You must be signed in to change notification settings - Fork 390
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
Feature/c code generation tagged unions #168
Conversation
…itbox.apache.org/repos/asf/plc4x into feature/c-code-generation
…nality into a new BaseFreemarkerLanguageTemplateHelper - Finished support of array fields - Finished supporting static function calls in expressions - Finished supporting enum properties in expressions
…ava version - Introduced a BaseFreemarkerLanguageTemplateHelper which contains methods usable for multiple code generations - Updated the mspec definitions to now use the discriminators directly
-- Fixed a lot of little issues. -- Cleaned up the usage of pointers and no-pointers
@@ -436,8 +476,45 @@ private String toExpression(Field field, Term term, Function<Term, String> varia | |||
} | |||
} | |||
|
|||
public String toVariableParseExpression(Field field, Term term, Argument[] parserArguments) { | |||
public String toVariableParseExpression(ComplexTypeDefinition baseType, Field field, Term term, Argument[] parserArguments) { | |||
VariableLiteral vl = (VariableLiteral) term; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"CAST" could be a constant. If there are other things you could do that too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah ... correct ... but I think there's only one place where it's used ...
that is too much to look through all of it.
None of these things are for this PR |
…d arrays/lists - Worked on the expression builders to correctly access indexed items of lists
…of the parser code.
- Added NULL-checks after the malloc of complex types
Well I would rather have the code generated in a way that it doesn't require formatting ... I didn't generate any logging as I didn't know of any logging framework to use ... we could whip up a skeleton of functions that we can use for logging and plug in a "printf" logger or whatever we like to do the actual logging ... that might be a good idea. As I mentioned before ... I wanted to ensure the internal variable names don't clash with the ones a user can use in mspec ... people tent to get anoyed if they have to use other named due to internal stuff. Why do we need to typedef that ... It's not that anyone is ever going to write that code ... but if you like, of course that's probably a really simple change. |
@chrisdutz that is fair enough. no reason not to keep it like it is |
- Fixed the generation of the padding code (which used the "serializer"-arg "lastItem") - Added skeletons for the lengthInBytes code.
- Made the switch type also save a reference to the enum constant for that type
This is the new approach using tagged unions instead of separate types for every sub-type.