@@ -6,6 +6,20 @@ struct yyjson_val;
6
6
struct yyjson_mut_doc ;
7
7
struct yyjson_mut_val ;
8
8
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
+
9
23
// Must be the first field of FFModuleOptions
10
24
typedef struct FFModuleBaseInfo
11
25
{
@@ -19,32 +33,10 @@ typedef struct FFModuleBaseInfo
19
33
void (* parseJsonObject )(void * options , struct yyjson_val * module );
20
34
void (* printModule )(void * options );
21
35
void (* generateJsonResult )(void * options , struct yyjson_mut_doc * doc , struct yyjson_mut_val * module );
22
- void (* printHelpFormat )(void );
23
36
void (* generateJsonConfig )(void * options , struct yyjson_mut_doc * doc , struct yyjson_mut_val * obj );
37
+ FFModuleFormatArgList formatArgs ;
24
38
} FFModuleBaseInfo ;
25
39
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
-
48
40
typedef enum __attribute__ ((__packed__ )) FFModuleKeyType
49
41
{
50
42
FF_MODULE_KEY_TYPE_NONE = 0 ,
0 commit comments