@@ -6,6 +6,20 @@ struct yyjson_val;
66struct yyjson_mut_doc ;
77struct yyjson_mut_val ;
88
9+ typedef struct FFModuleFormatArg
10+ {
11+ const char * desc ;
12+ const char * name ;
13+ } FFModuleFormatArg ;
14+
15+ typedef struct FFModuleFormatArgList
16+ {
17+ FFModuleFormatArg * args ;
18+ uint32_t count ;
19+ } FFModuleFormatArgList ;
20+
21+ #define FF_FORMAT_ARG_LIST (list ) { .args = list, .count = sizeof(list) / sizeof(FFModuleFormatArg) }
22+
923// Must be the first field of FFModuleOptions
1024typedef struct FFModuleBaseInfo
1125{
@@ -19,32 +33,10 @@ typedef struct FFModuleBaseInfo
1933 void (* parseJsonObject )(void * options , struct yyjson_val * module );
2034 void (* printModule )(void * options );
2135 void (* generateJsonResult )(void * options , struct yyjson_mut_doc * doc , struct yyjson_mut_val * module );
22- void (* printHelpFormat )(void );
2336 void (* generateJsonConfig )(void * options , struct yyjson_mut_doc * doc , struct yyjson_mut_val * obj );
37+ FFModuleFormatArgList formatArgs ;
2438} FFModuleBaseInfo ;
2539
26- static inline void ffOptionInitModuleBaseInfo (
27- FFModuleBaseInfo * baseInfo ,
28- const char * name ,
29- const char * description ,
30- void * parseCommandOptions , // bool (*const parseCommandOptions)(void* options, const char* key, const char* value)
31- void * parseJsonObject , // void (*const parseJsonObject)(void* options, yyjson_val *module)
32- void * printModule , // void (*const printModule)(void* options)
33- void * generateJsonResult , // void (*const generateJsonResult)(void* options, yyjson_mut_doc* doc, yyjson_mut_val* obj)
34- void (* printHelpFormat )(void ),
35- void * generateJsonConfig // void (*const generateJsonConfig)(void* options, yyjson_mut_doc* doc, yyjson_mut_val* obj)
36- )
37- {
38- baseInfo -> name = name ;
39- baseInfo -> description = description ;
40- baseInfo -> parseCommandOptions = (__typeof__ (baseInfo -> parseCommandOptions )) parseCommandOptions ;
41- baseInfo -> parseJsonObject = (__typeof__ (baseInfo -> parseJsonObject )) parseJsonObject ;
42- baseInfo -> printModule = (__typeof__ (baseInfo -> printModule )) printModule ;
43- baseInfo -> generateJsonResult = (__typeof__ (baseInfo -> generateJsonResult )) generateJsonResult ;
44- baseInfo -> printHelpFormat = printHelpFormat ;
45- baseInfo -> generateJsonConfig = (__typeof__ (baseInfo -> generateJsonConfig )) generateJsonConfig ;
46- }
47-
4840typedef enum __attribute__ ((__packed__ )) FFModuleKeyType
4941{
5042 FF_MODULE_KEY_TYPE_NONE = 0 ,
0 commit comments