Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- typedef struct struAVClass{
- const char* class_name;
- const char* (*item_name)(void* ctx);
- const char* option;
- }AVClass;
- #define DEFINE_WRITER_CLASS(name) \
- static const char *name##_get_name(void *ctx) \
- { \
- return #name ; \
- } \
- static const AVClass name##_class = { \
- .class_name = #name, \
- .item_name = name##_get_name, \
- .option = "name##_options" \
- }
- static const char* test_options = "test_options";
- static const char* west_options = "west_options";
- DEFINE_WRITER_CLASS(test);
- DEFINE_WRITER_CLASS(west);
- int main()
- {
- printf("class_name=%s, item_name=%s, option=%s
- ", test_class.class_name, test_class.item_name(NULL), test_class.option);
- printf("class_name=%s, item_name=%s, option=%s
- ", west_class.class_name, west_class.item_name(NULL), west_class.option);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement