-
Notifications
You must be signed in to change notification settings - Fork 11
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
Enum c support #72
Enum c support #72
Conversation
@@ -181,10 +181,14 @@ defmodule Unifex.Specs.DSL do | |||
|
|||
Elixir definition of %My.Struct{} should contain every field listed in specification and is not generated by Unifex | |||
""" | |||
defmacro type(struct) do | |||
defmacro type({:"::", _, [_, {:%, _, _}]} = struct) do |
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.
Please update the doc, and also extend the example in the moduledoc so that it contained a struct and an enum
#{if_condition} { | ||
char* enum_as_string = "#{type}"; | ||
res = #{ | ||
BaseType.generate_arg_serialize( |
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.
let's call the implementation directly here too
~g""" | ||
char* enum_as_string = "#{type}"; | ||
#{ | ||
BaseType.generate_arg_serialize( |
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.
let's call the implementation directly here too
@@ -0,0 +1,169 @@ | |||
defmodule Unifex.CodeGenerator.BaseTypes.Enum do |
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.
lot's of duplicated code in this module, let's reuse some parts
1628497
to
936fa61
Compare
Support for mapping C/C++ enums into Elixir atoms and vice versa
closes #61