44#include "common/parsing.h"
55#include "common/option.h"
66
7- enum FFPercentageTypeFlags
7+ typedef enum __attribute__ (( __packed__ )) FFPercentageTypeFlags
88{
9+ FF_PERCENTAGE_TYPE_NONE = 0 ,
910 FF_PERCENTAGE_TYPE_NUM_BIT = 1 << 0 ,
1011 FF_PERCENTAGE_TYPE_BAR_BIT = 1 << 1 ,
1112 FF_PERCENTAGE_TYPE_HIDE_OTHERS_BIT = 1 << 2 ,
1213 FF_PERCENTAGE_TYPE_NUM_COLOR_BIT = 1 << 3 ,
1314 FF_PERCENTAGE_TYPE_BAR_MONOCHROME_BIT = FF_PERCENTAGE_TYPE_NUM_COLOR_BIT ,
14- };
15+ FF_PERCENTAGE_TYPE_FORCE_UNSIGNED_ = UINT8_MAX ,
16+ } FFPercentageTypeFlags ;
17+ static_assert (sizeof (FFPercentageTypeFlags ) == 1 , "" );
18+
19+ typedef struct FFPercentageModuleConfig
20+ {
21+ uint8_t green ;
22+ uint8_t yellow ;
23+ } FFPercentageModuleConfig ;
1524
1625// if (green <= yellow)
1726// [0, green]: print green
@@ -23,12 +32,12 @@ enum FFPercentageTypeFlags
2332// [yellow, green): print yellow
2433// [0, yellow): print red
2534
26- void ffPercentAppendBar (FFstrbuf * buffer , double percent , FFColorRangeConfig config , const FFModuleArgs * module );
27- void ffPercentAppendNum (FFstrbuf * buffer , double percent , FFColorRangeConfig config , bool parentheses , const FFModuleArgs * module );
35+ void ffPercentAppendBar (FFstrbuf * buffer , double percent , FFPercentageModuleConfig config , const FFModuleArgs * module );
36+ void ffPercentAppendNum (FFstrbuf * buffer , double percent , FFPercentageModuleConfig config , bool parentheses , const FFModuleArgs * module );
2837
2938typedef struct yyjson_val yyjson_val ;
3039typedef struct yyjson_mut_doc yyjson_mut_doc ;
3140typedef struct yyjson_mut_val yyjson_mut_val ;
32- bool ffPercentParseCommandOptions (const char * key , const char * subkey , const char * value , FFColorRangeConfig * config );
33- bool ffPercentParseJsonObject (const char * key , yyjson_val * value , FFColorRangeConfig * config );
34- void ffPercentGenerateJsonConfig (yyjson_mut_doc * doc , yyjson_mut_val * module , FFColorRangeConfig defaultConfig , FFColorRangeConfig config );
41+ bool ffPercentParseCommandOptions (const char * key , const char * subkey , const char * value , FFPercentageModuleConfig * config );
42+ bool ffPercentParseJsonObject (const char * key , yyjson_val * value , FFPercentageModuleConfig * config );
43+ void ffPercentGenerateJsonConfig (yyjson_mut_doc * doc , yyjson_mut_val * module , FFPercentageModuleConfig defaultConfig , FFPercentageModuleConfig config );
0 commit comments