mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-07 21:50:08 +01:00
Modules: major code refactor
Also fix some bugs found when refactoring
This commit is contained in:
@@ -105,7 +105,7 @@ void ffPrintBattery(FFBatteryOptions* options)
|
||||
|
||||
void ffInitBatteryOptions(FFBatteryOptions* options)
|
||||
{
|
||||
options->moduleName = FF_BATTERY_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BATTERY_MODULE_NAME, ffParseBatteryCommandOptions, ffParseBatteryJsonObject, ffPrintBattery);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->temp = false;
|
||||
|
||||
@@ -147,11 +147,8 @@ void ffDestroyBatteryOptions(FFBatteryOptions* options)
|
||||
#endif
|
||||
}
|
||||
|
||||
void ffParseBatteryJsonObject(yyjson_val* module)
|
||||
void ffParseBatteryJsonObject(FFBatteryOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFBatteryOptions __attribute__((__cleanup__(ffDestroyBatteryOptions))) options;
|
||||
ffInitBatteryOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -162,7 +159,7 @@ void ffParseBatteryJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
#ifdef __linux__
|
||||
@@ -175,13 +172,11 @@ void ffParseBatteryJsonObject(yyjson_val* module)
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "temp"))
|
||||
{
|
||||
options.temp = yyjson_get_bool(val);
|
||||
options->temp = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintError(FF_BATTERY_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_BATTERY_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintBattery(&options);
|
||||
}
|
||||
|
||||
@@ -9,4 +9,4 @@ void ffPrintBattery(FFBatteryOptions* options);
|
||||
void ffInitBatteryOptions(FFBatteryOptions* options);
|
||||
bool ffParseBatteryCommandOptions(FFBatteryOptions* options, const char* key, const char* value);
|
||||
void ffDestroyBatteryOptions(FFBatteryOptions* options);
|
||||
void ffParseBatteryJsonObject(yyjson_val* module);
|
||||
void ffParseBatteryJsonObject(FFBatteryOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
typedef struct FFBatteryOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
bool temp;
|
||||
|
||||
@@ -55,7 +55,7 @@ exit:
|
||||
|
||||
void ffInitBiosOptions(FFBiosOptions* options)
|
||||
{
|
||||
options->moduleName = FF_BIOS_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BIOS_MODULE_NAME, ffParseBiosCommandOptions, ffParseBiosJsonObject, ffPrintBios);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -74,11 +74,8 @@ void ffDestroyBiosOptions(FFBiosOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseBiosJsonObject(yyjson_val* module)
|
||||
void ffParseBiosJsonObject(FFBiosOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFBiosOptions __attribute__((__cleanup__(ffDestroyBiosOptions))) options;
|
||||
ffInitBiosOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -89,12 +86,10 @@ void ffParseBiosJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_BIOS_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_BIOS_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintBios(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintBios(FFBiosOptions* options);
|
||||
void ffInitBiosOptions(FFBiosOptions* options);
|
||||
bool ffParseBiosCommandOptions(FFBiosOptions* options, const char* key, const char* value);
|
||||
void ffDestroyBiosOptions(FFBiosOptions* options);
|
||||
void ffParseBiosJsonObject(yyjson_val* module);
|
||||
void ffParseBiosJsonObject(FFBiosOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFBiosOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFBiosOptions;
|
||||
|
||||
@@ -75,7 +75,7 @@ void ffPrintBluetooth(FFBluetoothOptions* options)
|
||||
|
||||
void ffInitBluetoothOptions(FFBluetoothOptions* options)
|
||||
{
|
||||
options->moduleName = FF_BLUETOOTH_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BLUETOOTH_MODULE_NAME, ffParseBluetoothCommandOptions, ffParseBluetoothJsonObject, ffPrintBluetooth);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->showDisconnected = false;
|
||||
}
|
||||
@@ -101,11 +101,8 @@ void ffDestroyBluetoothOptions(FFBluetoothOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseBluetoothJsonObject(yyjson_val* module)
|
||||
void ffParseBluetoothJsonObject(FFBluetoothOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFBluetoothOptions __attribute__((__cleanup__(ffDestroyBluetoothOptions))) options;
|
||||
ffInitBluetoothOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -116,18 +113,16 @@ void ffParseBluetoothJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showDisconnected"))
|
||||
{
|
||||
options.showDisconnected = yyjson_get_bool(val);
|
||||
options->showDisconnected = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintError(FF_BLUETOOTH_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_BLUETOOTH_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintBluetooth(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintBluetooth(FFBluetoothOptions* options);
|
||||
void ffInitBluetoothOptions(FFBluetoothOptions* options);
|
||||
bool ffParseBluetoothCommandOptions(FFBluetoothOptions* options, const char* key, const char* value);
|
||||
void ffDestroyBluetoothOptions(FFBluetoothOptions* options);
|
||||
void ffParseBluetoothJsonObject(yyjson_val* module);
|
||||
void ffParseBluetoothJsonObject(FFBluetoothOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
typedef struct FFBluetoothOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
bool showDisconnected;
|
||||
|
||||
@@ -51,7 +51,7 @@ exit:
|
||||
|
||||
void ffInitBoardOptions(FFBoardOptions* options)
|
||||
{
|
||||
options->moduleName = FF_BOARD_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BOARD_MODULE_NAME, ffParseBoardCommandOptions, ffParseBoardJsonObject, ffPrintBoard);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -70,11 +70,8 @@ void ffDestroyBoardOptions(FFBoardOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseBoardJsonObject(yyjson_val* module)
|
||||
void ffParseBoardJsonObject(FFBoardOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFBoardOptions __attribute__((__cleanup__(ffDestroyBoardOptions))) options;
|
||||
ffInitBoardOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -85,12 +82,10 @@ void ffParseBoardJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_BOARD_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_BOARD_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintBoard(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintBoard(FFBoardOptions* options);
|
||||
void ffInitBoardOptions(FFBoardOptions* options);
|
||||
bool ffParseBoardCommandOptions(FFBoardOptions* options, const char* key, const char* value);
|
||||
void ffDestroyBoardOptions(FFBoardOptions* options);
|
||||
void ffParseBoardJsonObject(yyjson_val* module);
|
||||
void ffParseBoardJsonObject(FFBoardOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFBoardOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFBoardOptions;
|
||||
|
||||
@@ -1,13 +1,28 @@
|
||||
#include "common/printing.h"
|
||||
#include "modules/break/break.h"
|
||||
|
||||
void ffPrintBreak(void)
|
||||
void ffPrintBreak(FF_MAYBE_UNUSED FFBreakOptions* options)
|
||||
{
|
||||
ffLogoPrintLine();
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
void ffParseBreakJsonObject(FF_MAYBE_UNUSED yyjson_val* module)
|
||||
void ffInitBreakOptions(FF_MAYBE_UNUSED FFBreakOptions* options)
|
||||
{
|
||||
return ffPrintBreak();
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BREAK_MODULE_NAME, ffParseBreakCommandOptions, ffParseBreakJsonObject, ffPrintBreak);
|
||||
}
|
||||
|
||||
bool ffParseBreakCommandOptions(FF_MAYBE_UNUSED FFBreakOptions* options, FF_MAYBE_UNUSED const char* key, FF_MAYBE_UNUSED const char* value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void ffDestroyBreakOptions(FF_MAYBE_UNUSED FFBreakOptions* options)
|
||||
{
|
||||
}
|
||||
|
||||
void ffParseBreakJsonObject(FF_MAYBE_UNUSED FFBreakOptions* options, FF_MAYBE_UNUSED yyjson_val* module)
|
||||
{
|
||||
ffPrintBreak(options);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4,5 +4,8 @@
|
||||
|
||||
#define FF_BREAK_MODULE_NAME "Break"
|
||||
|
||||
void ffPrintBreak();
|
||||
void ffParseBreakJsonObject(yyjson_val* module);
|
||||
void ffPrintBreak(FFBreakOptions* options);
|
||||
void ffInitBreakOptions(FFBreakOptions* options);
|
||||
bool ffParseBreakCommandOptions(FFBreakOptions* options, const char* key, const char* value);
|
||||
void ffDestroyBreakOptions(FFBreakOptions* options);
|
||||
void ffParseBreakJsonObject(FFBreakOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFBreakOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
} FFBreakOptions;
|
||||
@@ -80,7 +80,7 @@ void ffPrintBrightness(FFBrightnessOptions* options)
|
||||
|
||||
void ffInitBrightnessOptions(FFBrightnessOptions* options)
|
||||
{
|
||||
options->moduleName = FF_BRIGHTNESS_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BRIGHTNESS_MODULE_NAME, ffParseBrightnessCommandOptions, ffParseBrightnessJsonObject, ffPrintBrightness);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -99,11 +99,8 @@ void ffDestroyBrightnessOptions(FFBrightnessOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseBrightnessJsonObject(yyjson_val* module)
|
||||
void ffParseBrightnessJsonObject(FFBrightnessOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFBrightnessOptions __attribute__((__cleanup__(ffDestroyBrightnessOptions))) options;
|
||||
ffInitBrightnessOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -114,12 +111,10 @@ void ffParseBrightnessJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_BRIGHTNESS_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_BRIGHTNESS_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintBrightness(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintBrightness(FFBrightnessOptions* options);
|
||||
void ffInitBrightnessOptions(FFBrightnessOptions* options);
|
||||
bool ffParseBrightnessCommandOptions(FFBrightnessOptions* options, const char* key, const char* value);
|
||||
void ffDestroyBrightnessOptions(FFBrightnessOptions* options);
|
||||
void ffParseBrightnessJsonObject(yyjson_val* module);
|
||||
void ffParseBrightnessJsonObject(FFBrightnessOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFBrightnessOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFBrightnessOptions;
|
||||
|
||||
@@ -52,7 +52,7 @@ exit:
|
||||
|
||||
void ffInitChassisOptions(FFChassisOptions* options)
|
||||
{
|
||||
options->moduleName = FF_CHASSIS_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CHASSIS_MODULE_NAME, ffParseChassisCommandOptions, ffParseChassisJsonObject, ffPrintChassis);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -71,11 +71,8 @@ void ffDestroyChassisOptions(FFChassisOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseChassisJsonObject(yyjson_val* module)
|
||||
void ffParseChassisJsonObject(FFChassisOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFChassisOptions __attribute__((__cleanup__(ffDestroyChassisOptions))) options;
|
||||
ffInitChassisOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -86,12 +83,10 @@ void ffParseChassisJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_CHASSIS_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_CHASSIS_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintChassis(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintChassis(FFChassisOptions* options);
|
||||
void ffInitChassisOptions(FFChassisOptions* options);
|
||||
bool ffParseChassisCommandOptions(FFChassisOptions* options, const char* key, const char* value);
|
||||
void ffDestroyChassisOptions(FFChassisOptions* options);
|
||||
void ffParseChassisJsonObject(yyjson_val* module);
|
||||
void ffParseChassisJsonObject(FFChassisOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFChassisOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFChassisOptions;
|
||||
|
||||
@@ -57,7 +57,7 @@ void ffPrintColors(FFColorsOptions* options)
|
||||
|
||||
void ffInitColorsOptions(FFColorsOptions* options)
|
||||
{
|
||||
options->moduleName = FF_COLORS_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_COLORS_MODULE_NAME, ffParseColorsCommandOptions, ffParseColorsJsonObject, ffPrintColors);
|
||||
options->symbol = FF_COLORS_SYMBOL_BLOCK;
|
||||
options->paddingLeft = 0;
|
||||
}
|
||||
@@ -94,11 +94,8 @@ void ffDestroyColorsOptions(FF_MAYBE_UNUSED FFColorsOptions* options)
|
||||
{
|
||||
}
|
||||
|
||||
void ffParseColorsJsonObject(yyjson_val* module)
|
||||
void ffParseColorsJsonObject(FFColorsOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFColorsOptions __attribute__((__cleanup__(ffDestroyColorsOptions))) options;
|
||||
ffInitColorsOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -124,19 +121,17 @@ void ffParseColorsJsonObject(yyjson_val* module)
|
||||
if (error)
|
||||
ffPrintErrorString(FF_COLORS_MODULE_NAME, 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "Invalid %s value: %s", key, error);
|
||||
else
|
||||
options.symbol = (FFColorsSymbol) value;
|
||||
options->symbol = (FFColorsSymbol) value;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "paddingLeft"))
|
||||
{
|
||||
options.paddingLeft = (uint32_t) yyjson_get_uint(val);
|
||||
options->paddingLeft = (uint32_t) yyjson_get_uint(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintErrorString(FF_COLORS_MODULE_NAME, 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintColors(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintColors(FFColorsOptions* options);
|
||||
void ffInitColorsOptions(FFColorsOptions* options);
|
||||
void ffDestroyColorsOptions(FFColorsOptions* options);
|
||||
bool ffParseColorsCommandOptions(FFColorsOptions* options, const char* key, const char* value);
|
||||
void ffParseColorsJsonObject(yyjson_val* module);
|
||||
void ffParseColorsJsonObject(FFColorsOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -16,7 +16,7 @@ typedef enum FFColorsSymbol
|
||||
|
||||
typedef struct FFColorsOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFColorsSymbol symbol;
|
||||
uint32_t paddingLeft;
|
||||
} FFColorsOptions;
|
||||
|
||||
@@ -36,7 +36,7 @@ void ffPrintCommand(FFCommandOptions* options)
|
||||
|
||||
void ffInitCommandOptions(FFCommandOptions* options)
|
||||
{
|
||||
options->moduleName = FF_COMMAND_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_COMMAND_MODULE_NAME, ffParseCommandCommandOptions, ffParseCommandJsonObject, ffPrintCommand);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
ffStrbufInitStatic(&options->shell,
|
||||
@@ -79,11 +79,8 @@ void ffDestroyCommandOptions(FFCommandOptions* options)
|
||||
ffStrbufDestroy(&options->text);
|
||||
}
|
||||
|
||||
void ffParseCommandJsonObject(yyjson_val* module)
|
||||
void ffParseCommandJsonObject(FFCommandOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFCommandOptions __attribute__((__cleanup__(ffDestroyCommandOptions))) options;
|
||||
ffInitCommandOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -94,24 +91,22 @@ void ffParseCommandJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "shell"))
|
||||
{
|
||||
ffStrbufSetS(&options.shell, yyjson_get_str(val));
|
||||
ffStrbufSetS(&options->shell, yyjson_get_str(val));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "text"))
|
||||
{
|
||||
ffStrbufSetS(&options.text, yyjson_get_str(val));
|
||||
ffStrbufSetS(&options->text, yyjson_get_str(val));
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintError(FF_COMMAND_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_COMMAND_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintCommand(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintCommand(FFCommandOptions* options);
|
||||
void ffInitCommandOptions(FFCommandOptions* options);
|
||||
bool ffParseCommandCommandOptions(FFCommandOptions* options, const char* key, const char* value);
|
||||
void ffDestroyCommandOptions(FFCommandOptions* options);
|
||||
void ffParseCommandJsonObject(yyjson_val* module);
|
||||
void ffParseCommandJsonObject(FFCommandOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
typedef struct FFCommandOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFstrbuf shell;
|
||||
|
||||
+5
-10
@@ -79,7 +79,7 @@ void ffPrintCPU(FFCPUOptions* options)
|
||||
|
||||
void ffInitCPUOptions(FFCPUOptions* options)
|
||||
{
|
||||
options->moduleName = FF_CPU_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CPU_MODULE_NAME, ffParseCPUCommandOptions, ffParseCPUJsonObject, ffPrintCPU);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->temp = false;
|
||||
}
|
||||
@@ -105,11 +105,8 @@ void ffDestroyCPUOptions(FFCPUOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseCPUJsonObject(yyjson_val* module)
|
||||
void ffParseCPUJsonObject(FFCPUOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFCPUOptions __attribute__((__cleanup__(ffDestroyCPUOptions))) options;
|
||||
ffInitCPUOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -120,18 +117,16 @@ void ffParseCPUJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "temp"))
|
||||
{
|
||||
options.temp = yyjson_get_bool(val);
|
||||
options->temp = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintError(FF_CPU_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_CPU_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintCPU(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintCPU(FFCPUOptions* options);
|
||||
void ffInitCPUOptions(FFCPUOptions* options);
|
||||
bool ffParseCPUCommandOptions(FFCPUOptions* options, const char* key, const char* value);
|
||||
void ffDestroyCPUOptions(FFCPUOptions* options);
|
||||
void ffParseCPUJsonObject(yyjson_val* module);
|
||||
void ffParseCPUJsonObject(FFCPUOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
typedef struct FFCPUOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
bool temp;
|
||||
|
||||
@@ -44,7 +44,7 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options)
|
||||
|
||||
void ffInitCPUUsageOptions(FFCPUUsageOptions* options)
|
||||
{
|
||||
options->moduleName = FF_CPUUSAGE_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CPUUSAGE_MODULE_NAME, ffParseCPUUsageCommandOptions, ffParseCPUUsageJsonObject, ffPrintCPUUsage);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -63,11 +63,8 @@ void ffDestroyCPUUsageOptions(FFCPUUsageOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseCPUUsageJsonObject(yyjson_val* module)
|
||||
void ffParseCPUUsageJsonObject(FFCPUUsageOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFCPUUsageOptions __attribute__((__cleanup__(ffDestroyCPUUsageOptions))) options;
|
||||
ffInitCPUUsageOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -78,12 +75,10 @@ void ffParseCPUUsageJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_CPUUSAGE_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_CPUUSAGE_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintCPUUsage(&options);
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options);
|
||||
void ffInitCPUUsageOptions(FFCPUUsageOptions* options);
|
||||
bool ffParseCPUUsageCommandOptions(FFCPUUsageOptions* options, const char* key, const char* value);
|
||||
void ffDestroyCPUUsageOptions(FFCPUUsageOptions* options);
|
||||
void ffParseCPUUsageJsonObject(yyjson_val* module);
|
||||
void ffParseCPUUsageJsonObject(FFCPUUsageOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFCPUUsageOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFCPUUsageOptions;
|
||||
|
||||
@@ -52,7 +52,7 @@ void ffPrintCursor(FFCursorOptions* options)
|
||||
|
||||
void ffInitCursorOptions(FFCursorOptions* options)
|
||||
{
|
||||
options->moduleName = FF_CURSOR_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CURSOR_MODULE_NAME, ffParseCursorCommandOptions, ffParseCursorJsonObject, ffPrintCursor);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -71,11 +71,8 @@ void ffDestroyCursorOptions(FFCursorOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseCursorJsonObject(yyjson_val* module)
|
||||
void ffParseCursorJsonObject(FFCursorOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFCursorOptions __attribute__((__cleanup__(ffDestroyCursorOptions))) options;
|
||||
ffInitCursorOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -86,12 +83,10 @@ void ffParseCursorJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_CURSOR_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_CURSOR_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintCursor(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintCursor(FFCursorOptions* options);
|
||||
void ffInitCursorOptions(FFCursorOptions* options);
|
||||
bool ffParseCursorCommandOptions(FFCursorOptions* options, const char* key, const char* value);
|
||||
void ffDestroyCursorOptions(FFCursorOptions* options);
|
||||
void ffParseCursorJsonObject(yyjson_val* module);
|
||||
void ffParseCursorJsonObject(FFCursorOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFCursorOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFCursorOptions;
|
||||
|
||||
@@ -19,7 +19,7 @@ void ffPrintCustom(FFCustomOptions* options)
|
||||
|
||||
void ffInitCustomOptions(FFCustomOptions* options)
|
||||
{
|
||||
options->moduleName = FF_CUSTOM_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CUSTOM_MODULE_NAME, ffParseCustomCommandOptions, ffParseCustomJsonObject, ffPrintCustom);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -38,11 +38,8 @@ void ffDestroyCustomOptions(FFCustomOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseCustomJsonObject(yyjson_val* module)
|
||||
void ffParseCustomJsonObject(FFCustomOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFCustomOptions __attribute__((__cleanup__(ffDestroyCustomOptions))) options;
|
||||
ffInitCustomOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -53,12 +50,10 @@ void ffParseCustomJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_CUSTOM_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_CUSTOM_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintCustom(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintCustom(FFCustomOptions* options);
|
||||
void ffInitCustomOptions(FFCustomOptions* options);
|
||||
bool ffParseCustomCommandOptions(FFCustomOptions* options, const char* key, const char* value);
|
||||
void ffDestroyCustomOptions(FFCustomOptions* options);
|
||||
void ffParseCustomJsonObject(yyjson_val* module);
|
||||
void ffParseCustomJsonObject(FFCustomOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFCustomOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFCustomOptions;
|
||||
|
||||
@@ -51,7 +51,7 @@ void ffPrintDateTime(FFDateTimeOptions* options)
|
||||
|
||||
void ffInitDateTimeOptions(FFDateTimeOptions* options)
|
||||
{
|
||||
options->moduleName = FF_DATETIME_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_DATETIME_MODULE_NAME, ffParseDateTimeCommandOptions, ffParseDateTimeJsonObject, ffPrintDateTime);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -70,11 +70,8 @@ void ffDestroyDateTimeOptions(FFDateTimeOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseDateTimeJsonObject(yyjson_val* module)
|
||||
void ffParseDateTimeJsonObject(FFDateTimeOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFDateTimeOptions __attribute__((__cleanup__(ffDestroyDateTimeOptions))) options;
|
||||
ffInitDateTimeOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -85,12 +82,10 @@ void ffParseDateTimeJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_DATETIME_DISPLAY_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_DATETIME_DISPLAY_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintDateTime(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintDateTime(FFDateTimeOptions* options);
|
||||
void ffInitDateTimeOptions(FFDateTimeOptions* options);
|
||||
bool ffParseDateTimeCommandOptions(FFDateTimeOptions* options, const char* key, const char* value);
|
||||
void ffDestroyDateTimeOptions(FFDateTimeOptions* options);
|
||||
void ffParseDateTimeJsonObject(yyjson_val* module);
|
||||
void ffParseDateTimeJsonObject(FFDateTimeOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFDateTimeOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFDateTimeOptions;
|
||||
|
||||
+4
-9
@@ -42,7 +42,7 @@ void ffPrintDE(FFDEOptions* options)
|
||||
|
||||
void ffInitDEOptions(FFDEOptions* options)
|
||||
{
|
||||
options->moduleName = FF_DE_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_DE_MODULE_NAME, ffParseDECommandOptions, ffParseDEJsonObject, ffPrintDE);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -61,11 +61,8 @@ void ffDestroyDEOptions(FFDEOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseDEJsonObject(yyjson_val* module)
|
||||
void ffParseDEJsonObject(FFDEOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFDEOptions __attribute__((__cleanup__(ffDestroyDEOptions))) options;
|
||||
ffInitDEOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -76,12 +73,10 @@ void ffParseDEJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_DE_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_DE_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintDE(&options);
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,4 +8,4 @@ void ffPrintDE(FFDEOptions* options);
|
||||
void ffInitDEOptions(FFDEOptions* options);
|
||||
bool ffParseDECommandOptions(FFDEOptions* options, const char* key, const char* value);
|
||||
void ffDestroyDEOptions(FFDEOptions* options);
|
||||
void ffParseDEJsonObject(yyjson_val* module);
|
||||
void ffParseDEJsonObject(FFDEOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFDEOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFDEOptions;
|
||||
|
||||
+13
-19
@@ -184,10 +184,9 @@ void ffPrintDisk(FFDiskOptions* options)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ffInitDiskOptions(FFDiskOptions* options)
|
||||
{
|
||||
options->moduleName = FF_DISK_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_DISK_MODULE_NAME, ffParseDiskCommandOptions, ffParseDiskJsonObject, ffPrintDisk);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
ffStrbufInit(&options->folders);
|
||||
@@ -260,11 +259,8 @@ void ffDestroyDiskOptions(FFDiskOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseDiskJsonObject(yyjson_val* module)
|
||||
void ffParseDiskJsonObject(FFDiskOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFDiskOptions __attribute__((__cleanup__(ffDestroyDiskOptions))) options;
|
||||
ffInitDiskOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -275,54 +271,52 @@ void ffParseDiskJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "folders"))
|
||||
{
|
||||
ffStrbufSetS(&options.folders, yyjson_get_str(val));
|
||||
ffStrbufSetS(&options->folders, yyjson_get_str(val));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showExternal"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showTypes |= FF_DISK_TYPE_EXTERNAL_BIT;
|
||||
options->showTypes |= FF_DISK_TYPE_EXTERNAL_BIT;
|
||||
else
|
||||
options.showTypes &= ~FF_DISK_TYPE_EXTERNAL_BIT;
|
||||
options->showTypes &= ~FF_DISK_TYPE_EXTERNAL_BIT;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showHidden"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showTypes |= FF_DISK_TYPE_HIDDEN_BIT;
|
||||
options->showTypes |= FF_DISK_TYPE_HIDDEN_BIT;
|
||||
else
|
||||
options.showTypes &= ~FF_DISK_TYPE_HIDDEN_BIT;
|
||||
options->showTypes &= ~FF_DISK_TYPE_HIDDEN_BIT;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showSubvolumes"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showTypes |= FF_DISK_TYPE_SUBVOLUME_BIT;
|
||||
options->showTypes |= FF_DISK_TYPE_SUBVOLUME_BIT;
|
||||
else
|
||||
options.showTypes &= ~FF_DISK_TYPE_SUBVOLUME_BIT;
|
||||
options->showTypes &= ~FF_DISK_TYPE_SUBVOLUME_BIT;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showUnknown"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showTypes |= FF_DISK_TYPE_UNKNOWN_BIT;
|
||||
options->showTypes |= FF_DISK_TYPE_UNKNOWN_BIT;
|
||||
else
|
||||
options.showTypes &= ~FF_DISK_TYPE_UNKNOWN_BIT;
|
||||
options->showTypes &= ~FF_DISK_TYPE_UNKNOWN_BIT;
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintError(FF_DISK_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_DISK_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintDisk(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintDisk(FFDiskOptions* options);
|
||||
void ffInitDiskOptions(FFDiskOptions* options);
|
||||
bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const char* value);
|
||||
void ffDestroyDiskOptions(FFDiskOptions* options);
|
||||
void ffParseDiskJsonObject(yyjson_val* module);
|
||||
void ffParseDiskJsonObject(FFDiskOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -16,7 +16,7 @@ typedef enum FFDiskType
|
||||
|
||||
typedef struct FFDiskOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFstrbuf folders;
|
||||
|
||||
@@ -109,7 +109,7 @@ void ffPrintDisplay(FFDisplayOptions* options)
|
||||
|
||||
void ffInitDisplayOptions(FFDisplayOptions* options)
|
||||
{
|
||||
options->moduleName = FF_DISPLAY_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_DISPLAY_MODULE_NAME, ffParseDisplayCommandOptions, ffParseDisplayJsonObject, ffPrintDisplay);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->compactType = FF_DISPLAY_COMPACT_TYPE_NONE;
|
||||
options->preciseRefreshRate = false;
|
||||
@@ -147,11 +147,8 @@ void ffDestroyDisplayOptions(FFDisplayOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseDisplayJsonObject(yyjson_val* module)
|
||||
void ffParseDisplayJsonObject(FFDisplayOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFDisplayOptions __attribute__((__cleanup__(ffDestroyDisplayOptions))) options;
|
||||
ffInitDisplayOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -162,7 +159,7 @@ void ffParseDisplayJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "compactType"))
|
||||
@@ -175,21 +172,19 @@ void ffParseDisplayJsonObject(yyjson_val* module)
|
||||
{},
|
||||
});
|
||||
if (error)
|
||||
ffPrintError(FF_DISPLAY_MODULE_NAME, 0, &options.moduleArgs, "Invalid %s value: %s", key, error);
|
||||
ffPrintError(FF_DISPLAY_MODULE_NAME, 0, &options->moduleArgs, "Invalid %s value: %s", key, error);
|
||||
else
|
||||
options.compactType = (FFDisplayCompactType) value;
|
||||
options->compactType = (FFDisplayCompactType) value;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "preciseRefreshRate"))
|
||||
{
|
||||
options.preciseRefreshRate = yyjson_get_bool(val);
|
||||
options->preciseRefreshRate = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintError(FF_DISPLAY_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_DISPLAY_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintDisplay(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintDisplay(FFDisplayOptions* options);
|
||||
void ffInitDisplayOptions(FFDisplayOptions* options);
|
||||
bool ffParseDisplayCommandOptions(FFDisplayOptions* options, const char* key, const char* value);
|
||||
void ffDestroyDisplayOptions(FFDisplayOptions* options);
|
||||
void ffParseDisplayJsonObject(yyjson_val* module);
|
||||
void ffParseDisplayJsonObject(FFDisplayOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -13,7 +13,7 @@ typedef enum FFDisplayCompactType
|
||||
|
||||
typedef struct FFDisplayOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFDisplayCompactType compactType;
|
||||
|
||||
@@ -45,7 +45,7 @@ void ffPrintFont(FFFontOptions* options)
|
||||
|
||||
void ffInitFontOptions(FFFontOptions* options)
|
||||
{
|
||||
options->moduleName = FF_FONT_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_FONT_MODULE_NAME, ffParseFontCommandOptions, ffParseFontJsonObject, ffPrintFont);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -64,11 +64,8 @@ void ffDestroyFontOptions(FFFontOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseFontJsonObject(yyjson_val* module)
|
||||
void ffParseFontJsonObject(FFFontOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFFontOptions __attribute__((__cleanup__(ffDestroyFontOptions))) options;
|
||||
ffInitFontOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -79,12 +76,10 @@ void ffParseFontJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_FONT_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_FONT_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintFont(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintFont(FFFontOptions* options);
|
||||
void ffInitFontOptions(FFFontOptions* options);
|
||||
bool ffParseFontCommandOptions(FFFontOptions* options, const char* key, const char* value);
|
||||
void ffDestroyFontOptions(FFFontOptions* options);
|
||||
void ffParseFontJsonObject(yyjson_val* module);
|
||||
void ffParseFontJsonObject(FFFontOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFFontOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFFontOptions;
|
||||
|
||||
@@ -51,7 +51,7 @@ void ffPrintGamepad(FFGamepadOptions* options)
|
||||
|
||||
void ffInitGamepadOptions(FFGamepadOptions* options)
|
||||
{
|
||||
options->moduleName = FF_GAMEPAD_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_GAMEPAD_MODULE_NAME, ffParseGamepadCommandOptions, ffParseGamepadJsonObject, ffPrintGamepad);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -70,11 +70,8 @@ void ffDestroyGamepadOptions(FFGamepadOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseGamepadJsonObject(yyjson_val* module)
|
||||
void ffParseGamepadJsonObject(FFGamepadOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFGamepadOptions __attribute__((__cleanup__(ffDestroyGamepadOptions))) options;
|
||||
ffInitGamepadOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -85,12 +82,10 @@ void ffParseGamepadJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_GAMEPAD_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_GAMEPAD_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintGamepad(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintGamepad(FFGamepadOptions* options);
|
||||
void ffInitGamepadOptions(FFGamepadOptions* options);
|
||||
bool ffParseGamepadCommandOptions(FFGamepadOptions* options, const char* key, const char* value);
|
||||
void ffDestroyGamepadOptions(FFGamepadOptions* options);
|
||||
void ffParseGamepadJsonObject(yyjson_val* module);
|
||||
void ffParseGamepadJsonObject(FFGamepadOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFGamepadOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFGamepadOptions;
|
||||
|
||||
+8
-13
@@ -121,7 +121,7 @@ void ffPrintGPU(FFGPUOptions* options)
|
||||
|
||||
void ffInitGPUOptions(FFGPUOptions* options)
|
||||
{
|
||||
options->moduleName = FF_GPU_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_GPU_MODULE_NAME, ffParseGPUCommandOptions, ffParseGPUJsonObject, ffPrintGPU);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
options->forceVulkan = false;
|
||||
@@ -166,11 +166,8 @@ void ffDestroyGPUOptions(FFGPUOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseGPUJsonObject(yyjson_val* module)
|
||||
void ffParseGPUJsonObject(FFGPUOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFGPUOptions __attribute__((__cleanup__(ffDestroyGPUOptions))) options;
|
||||
ffInitGPUOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -181,18 +178,18 @@ void ffParseGPUJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "temp"))
|
||||
{
|
||||
options.temp = yyjson_get_bool(val);
|
||||
options->temp = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "forceVulkan"))
|
||||
{
|
||||
options.forceVulkan = yyjson_get_bool(val);
|
||||
options->forceVulkan = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -206,15 +203,13 @@ void ffParseGPUJsonObject(yyjson_val* module)
|
||||
{},
|
||||
});
|
||||
if (error)
|
||||
ffPrintError(FF_GPU_MODULE_NAME, 0, &options.moduleArgs, "Invalid %s value: %s", key, error);
|
||||
ffPrintError(FF_GPU_MODULE_NAME, 0, &options->moduleArgs, "Invalid %s value: %s", key, error);
|
||||
else
|
||||
options.hideType = (FFGPUType) value;
|
||||
options->hideType = (FFGPUType) value;
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintError(FF_GPU_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_GPU_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintGPU(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintGPU(FFGPUOptions* options);
|
||||
void ffInitGPUOptions(FFGPUOptions* options);
|
||||
bool ffParseGPUCommandOptions(FFGPUOptions* options, const char* key, const char* value);
|
||||
void ffDestroyGPUOptions(FFGPUOptions* options);
|
||||
void ffParseGPUJsonObject(yyjson_val* module);
|
||||
void ffParseGPUJsonObject(FFGPUOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -13,7 +13,7 @@ typedef enum FFGPUType
|
||||
|
||||
typedef struct FFGPUOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFGPUType hideType;
|
||||
|
||||
@@ -67,7 +67,7 @@ exit:
|
||||
|
||||
void ffInitHostOptions(FFHostOptions* options)
|
||||
{
|
||||
options->moduleName = FF_HOST_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_HOST_MODULE_NAME, ffParseHostCommandOptions, ffParseHostJsonObject, ffPrintHost);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -86,11 +86,8 @@ void ffDestroyHostOptions(FFHostOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseHostJsonObject(yyjson_val* module)
|
||||
void ffParseHostJsonObject(FFHostOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFHostOptions __attribute__((__cleanup__(ffDestroyHostOptions))) options;
|
||||
ffInitHostOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -101,12 +98,10 @@ void ffParseHostJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_HOST_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_HOST_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintHost(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintHost(FFHostOptions* options);
|
||||
void ffInitHostOptions(FFHostOptions* options);
|
||||
bool ffParseHostCommandOptions(FFHostOptions* options, const char* key, const char* value);
|
||||
void ffDestroyHostOptions(FFHostOptions* options);
|
||||
void ffParseHostJsonObject(yyjson_val* module);
|
||||
void ffParseHostJsonObject(FFHostOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFHostOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFHostOptions;
|
||||
|
||||
@@ -32,7 +32,7 @@ void ffPrintIcons(FFIconsOptions* options)
|
||||
|
||||
void ffInitIconsOptions(FFIconsOptions* options)
|
||||
{
|
||||
options->moduleName = FF_ICONS_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_ICONS_MODULE_NAME, ffParseIconsCommandOptions, ffParseIconsJsonObject, ffPrintIcons);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -51,11 +51,8 @@ void ffDestroyIconsOptions(FFIconsOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseIconsJsonObject(yyjson_val* module)
|
||||
void ffParseIconsJsonObject(FFIconsOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFIconsOptions __attribute__((__cleanup__(ffDestroyIconsOptions))) options;
|
||||
ffInitIconsOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -66,12 +63,10 @@ void ffParseIconsJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_ICONS_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_ICONS_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintIcons(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintIcons(FFIconsOptions* options);
|
||||
void ffInitIconsOptions(FFIconsOptions* options);
|
||||
bool ffParseIconsCommandOptions(FFIconsOptions* options, const char* key, const char* value);
|
||||
void ffDestroyIconsOptions(FFIconsOptions* options);
|
||||
void ffParseIconsJsonObject(yyjson_val* module);
|
||||
void ffParseIconsJsonObject(FFIconsOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFIconsOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFIconsOptions;
|
||||
|
||||
@@ -32,7 +32,7 @@ void ffPrintKernel(FFKernelOptions* options)
|
||||
|
||||
void ffInitKernelOptions(FFKernelOptions* options)
|
||||
{
|
||||
options->moduleName = FF_KERNEL_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_KERNEL_MODULE_NAME, ffParseKernelCommandOptions, ffParseKernelJsonObject, ffPrintKernel);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -51,11 +51,8 @@ void ffDestroyKernelOptions(FFKernelOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseKernelJsonObject(yyjson_val* module)
|
||||
void ffParseKernelJsonObject(FFKernelOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFKernelOptions __attribute__((__cleanup__(ffDestroyKernelOptions))) options;
|
||||
ffInitKernelOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -66,12 +63,10 @@ void ffParseKernelJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_KERNEL_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_KERNEL_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintKernel(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintKernel(FFKernelOptions* options);
|
||||
void ffInitKernelOptions(FFKernelOptions* options);
|
||||
bool ffParseKernelCommandOptions(FFKernelOptions* options, const char* key, const char* value);
|
||||
void ffDestroyKernelOptions(FFKernelOptions* options);
|
||||
void ffParseKernelJsonObject(yyjson_val* module);
|
||||
void ffParseKernelJsonObject(FFKernelOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFKernelOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFKernelOptions;
|
||||
|
||||
+4
-9
@@ -51,7 +51,7 @@ void ffPrintLM(FFLMOptions* options)
|
||||
|
||||
void ffInitLMOptions(FFLMOptions* options)
|
||||
{
|
||||
options->moduleName = FF_LM_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_LM_MODULE_NAME, ffParseLMCommandOptions, ffParseLMJsonObject, ffPrintLM);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -70,11 +70,8 @@ void ffDestroyLMOptions(FFLMOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseLMJsonObject(yyjson_val* module)
|
||||
void ffParseLMJsonObject(FFLMOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFLMOptions __attribute__((__cleanup__(ffDestroyLMOptions))) options;
|
||||
ffInitLMOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -85,12 +82,10 @@ void ffParseLMJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_LM_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_LM_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintLM(&options);
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,4 +8,4 @@ void ffPrintLM(FFLMOptions* options);
|
||||
void ffInitLMOptions(FFLMOptions* options);
|
||||
bool ffParseLMCommandOptions(FFLMOptions* options, const char* key, const char* value);
|
||||
void ffDestroyLMOptions(FFLMOptions* options);
|
||||
void ffParseLMJsonObject(yyjson_val* module);
|
||||
void ffParseLMJsonObject(FFLMOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFLMOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFLMOptions;
|
||||
|
||||
@@ -32,7 +32,7 @@ void ffPrintLocale(FFLocaleOptions* options)
|
||||
|
||||
void ffInitLocaleOptions(FFLocaleOptions* options)
|
||||
{
|
||||
options->moduleName = FF_LOCALE_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_LOCALE_MODULE_NAME, ffParseLocaleCommandOptions, ffParseLocaleJsonObject, ffPrintLocale);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -51,11 +51,8 @@ void ffDestroyLocaleOptions(FFLocaleOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseLocaleJsonObject(yyjson_val* module)
|
||||
void ffParseLocaleJsonObject(FFLocaleOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFLocaleOptions __attribute__((__cleanup__(ffDestroyLocaleOptions))) options;
|
||||
ffInitLocaleOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -66,12 +63,10 @@ void ffParseLocaleJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_LOCALE_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_LOCALE_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintLocale(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintLocale(FFLocaleOptions* options);
|
||||
void ffInitLocaleOptions(FFLocaleOptions* options);
|
||||
bool ffParseLocaleCommandOptions(FFLocaleOptions* options, const char* key, const char* value);
|
||||
void ffDestroyLocaleOptions(FFLocaleOptions* options);
|
||||
void ffParseLocaleJsonObject(yyjson_val* module);
|
||||
void ffParseLocaleJsonObject(FFLocaleOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFLocaleOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFLocaleOptions;
|
||||
|
||||
@@ -139,7 +139,7 @@ void ffPrintLocalIp(FFLocalIpOptions* options)
|
||||
|
||||
void ffInitLocalIpOptions(FFLocalIpOptions* options)
|
||||
{
|
||||
options->moduleName = FF_LOCALIP_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_LOCALIP_MODULE_NAME, ffParseLocalIpCommandOptions, ffParseLocalIpJsonObject, ffPrintLocalIp);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
options->showType = FF_LOCALIP_TYPE_IPV4_BIT;
|
||||
@@ -220,11 +220,8 @@ void ffDestroyLocalIpOptions(FFLocalIpOptions* options)
|
||||
ffStrbufDestroy(&options->namePrefix);
|
||||
}
|
||||
|
||||
void ffParseLocalIpJsonObject(yyjson_val* module)
|
||||
void ffParseLocalIpJsonObject(FFLocalIpOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFLocalIpOptions __attribute__((__cleanup__(ffDestroyLocalIpOptions))) options;
|
||||
ffInitLocalIpOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -235,69 +232,67 @@ void ffParseLocalIpJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showIpv4"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showType |= FF_LOCALIP_TYPE_IPV4_BIT;
|
||||
options->showType |= FF_LOCALIP_TYPE_IPV4_BIT;
|
||||
else
|
||||
options.showType &= ~FF_LOCALIP_TYPE_IPV4_BIT;
|
||||
options->showType &= ~FF_LOCALIP_TYPE_IPV4_BIT;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showIpv6"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showType |= FF_LOCALIP_TYPE_IPV6_BIT;
|
||||
options->showType |= FF_LOCALIP_TYPE_IPV6_BIT;
|
||||
else
|
||||
options.showType &= ~FF_LOCALIP_TYPE_IPV6_BIT;
|
||||
options->showType &= ~FF_LOCALIP_TYPE_IPV6_BIT;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showMac"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showType |= FF_LOCALIP_TYPE_MAC_BIT;
|
||||
options->showType |= FF_LOCALIP_TYPE_MAC_BIT;
|
||||
else
|
||||
options.showType &= ~FF_LOCALIP_TYPE_MAC_BIT;
|
||||
options->showType &= ~FF_LOCALIP_TYPE_MAC_BIT;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showLoop"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showType |= FF_LOCALIP_TYPE_LOOP_BIT;
|
||||
options->showType |= FF_LOCALIP_TYPE_LOOP_BIT;
|
||||
else
|
||||
options.showType &= ~FF_LOCALIP_TYPE_LOOP_BIT;
|
||||
options->showType &= ~FF_LOCALIP_TYPE_LOOP_BIT;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "compact"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showType |= FF_LOCALIP_TYPE_COMPACT_BIT;
|
||||
options->showType |= FF_LOCALIP_TYPE_COMPACT_BIT;
|
||||
else
|
||||
options.showType &= ~FF_LOCALIP_TYPE_COMPACT_BIT;
|
||||
options->showType &= ~FF_LOCALIP_TYPE_COMPACT_BIT;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "namePrefix"))
|
||||
{
|
||||
ffStrbufSetS(&options.namePrefix, yyjson_get_str(val));
|
||||
ffStrbufSetS(&options->namePrefix, yyjson_get_str(val));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "defaultRouteOnly"))
|
||||
{
|
||||
options.defaultRouteOnly = yyjson_get_bool(val);
|
||||
options->defaultRouteOnly = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintError(FF_LOCALIP_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_LOCALIP_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintLocalIp(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintLocalIp(FFLocalIpOptions* options);
|
||||
void ffInitLocalIpOptions(FFLocalIpOptions* options);
|
||||
bool ffParseLocalIpCommandOptions(FFLocalIpOptions* options, const char* key, const char* value);
|
||||
void ffDestroyLocalIpOptions(FFLocalIpOptions* options);
|
||||
void ffParseLocalIpJsonObject(yyjson_val* module);
|
||||
void ffParseLocalIpJsonObject(FFLocalIpOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -17,7 +17,7 @@ typedef enum FFLocalIpType
|
||||
|
||||
typedef struct FFLocalIpOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFLocalIpType showType;
|
||||
|
||||
@@ -107,7 +107,7 @@ void ffPrintMedia(FFMediaOptions* options)
|
||||
|
||||
void ffInitMediaOptions(FFMediaOptions* options)
|
||||
{
|
||||
options->moduleName = FF_MEDIA_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_MEDIA_MODULE_NAME, ffParseMediaCommandOptions, ffParseMediaJsonObject, ffPrintMedia);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -126,11 +126,8 @@ void ffDestroyMediaOptions(FFMediaOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseMediaJsonObject(yyjson_val* module)
|
||||
void ffParseMediaJsonObject(FFMediaOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFMediaOptions __attribute__((__cleanup__(ffDestroyMediaOptions))) options;
|
||||
ffInitMediaOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -141,12 +138,10 @@ void ffParseMediaJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_MEDIA_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_MEDIA_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintMedia(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintMedia(FFMediaOptions* options);
|
||||
void ffInitMediaOptions(FFMediaOptions* options);
|
||||
bool ffParseMediaCommandOptions(FFMediaOptions* options, const char* key, const char* value);
|
||||
void ffDestroyMediaOptions(FFMediaOptions* options);
|
||||
void ffParseMediaJsonObject(yyjson_val* module);
|
||||
void ffParseMediaJsonObject(FFMediaOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFMediaOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFMediaOptions;
|
||||
|
||||
@@ -66,7 +66,7 @@ void ffPrintMemory(FFMemoryOptions* options)
|
||||
|
||||
void ffInitMemoryOptions(FFMemoryOptions* options)
|
||||
{
|
||||
options->moduleName = FF_MEMORY_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_MEMORY_MODULE_NAME, ffParseMemoryCommandOptions, ffParseMemoryJsonObject, ffPrintMemory);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -85,11 +85,8 @@ void ffDestroyMemoryOptions(FFMemoryOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseMemoryJsonObject(yyjson_val* module)
|
||||
void ffParseMemoryJsonObject(FFMemoryOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFMemoryOptions __attribute__((__cleanup__(ffDestroyMemoryOptions))) options;
|
||||
ffInitMemoryOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -100,12 +97,10 @@ void ffParseMemoryJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_MEMORY_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_MEMORY_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintMemory(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintMemory(FFMemoryOptions* options);
|
||||
void ffInitMemoryOptions(FFMemoryOptions* options);
|
||||
bool ffParseMemoryCommandOptions(FFMemoryOptions* options, const char* key, const char* value);
|
||||
void ffDestroyMemoryOptions(FFMemoryOptions* options);
|
||||
void ffParseMemoryJsonObject(yyjson_val* module);
|
||||
void ffParseMemoryJsonObject(FFMemoryOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFMemoryOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFMemoryOptions;
|
||||
|
||||
@@ -77,7 +77,7 @@ void ffPrintMonitor(FFMonitorOptions* options)
|
||||
|
||||
void ffInitMonitorOptions(FFMonitorOptions* options)
|
||||
{
|
||||
options->moduleName = FF_MONITOR_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_MONITOR_MODULE_NAME, ffParseMonitorCommandOptions, ffParseMonitorJsonObject, ffPrintMonitor);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -96,11 +96,8 @@ void ffDestroyMonitorOptions(FFMonitorOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseMonitorJsonObject(yyjson_val* module)
|
||||
void ffParseMonitorJsonObject(FFMonitorOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFMonitorOptions __attribute__((__cleanup__(ffDestroyMonitorOptions))) options;
|
||||
ffInitMonitorOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -111,12 +108,10 @@ void ffParseMonitorJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_MONITOR_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_MONITOR_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintMonitor(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintMonitor(FFMonitorOptions* options);
|
||||
void ffInitMonitorOptions(FFMonitorOptions* options);
|
||||
bool ffParseMonitorCommandOptions(FFMonitorOptions* options, const char* key, const char* value);
|
||||
void ffDestroyMonitorOptions(FFMonitorOptions* options);
|
||||
void ffParseMonitorJsonObject(yyjson_val* module);
|
||||
void ffParseMonitorJsonObject(FFMonitorOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFMonitorOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFMonitorOptions;
|
||||
|
||||
@@ -41,7 +41,7 @@ void ffPrintOpenCL(FFOpenCLOptions* options)
|
||||
|
||||
void ffInitOpenCLOptions(FFOpenCLOptions* options)
|
||||
{
|
||||
options->moduleName = FF_OPENCL_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_OPENCL_MODULE_NAME, ffParseOpenCLCommandOptions, ffParseOpenCLJsonObject, ffPrintOpenCL);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -60,11 +60,8 @@ void ffDestroyOpenCLOptions(FFOpenCLOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseOpenCLJsonObject(yyjson_val* module)
|
||||
void ffParseOpenCLJsonObject(FFOpenCLOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFOpenCLOptions __attribute__((__cleanup__(ffDestroyOpenCLOptions))) options;
|
||||
ffInitOpenCLOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -75,12 +72,10 @@ void ffParseOpenCLJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_OPENCL_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_OPENCL_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintOpenCL(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintOpenCL(FFOpenCLOptions* options);
|
||||
void ffInitOpenCLOptions(FFOpenCLOptions* options);
|
||||
bool ffParseOpenCLCommandOptions(FFOpenCLOptions* options, const char* key, const char* value);
|
||||
void ffDestroyOpenCLOptions(FFOpenCLOptions* options);
|
||||
void ffParseOpenCLJsonObject(yyjson_val* module);
|
||||
void ffParseOpenCLJsonObject(FFOpenCLOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFOpenCLOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFOpenCLOptions;
|
||||
|
||||
@@ -44,7 +44,7 @@ void ffPrintOpenGL(FFOpenGLOptions* options)
|
||||
|
||||
void ffInitOpenGLOptions(FFOpenGLOptions* options)
|
||||
{
|
||||
options->moduleName = FF_OPENGL_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_OPENGL_MODULE_NAME, ffParseOpenGLCommandOptions, ffParseOpenGLJsonObject, ffPrintOpenGL);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
@@ -80,11 +80,8 @@ void ffDestroyOpenGLOptions(FFOpenGLOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseOpenGLJsonObject(yyjson_val* module)
|
||||
void ffParseOpenGLJsonObject(FFOpenGLOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFOpenGLOptions __attribute__((__cleanup__(ffDestroyOpenGLOptions))) options;
|
||||
ffInitOpenGLOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -95,7 +92,7 @@ void ffParseOpenGLJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
@@ -110,16 +107,14 @@ void ffParseOpenGLJsonObject(yyjson_val* module)
|
||||
{},
|
||||
});
|
||||
if (error)
|
||||
ffPrintError(FF_OPENGL_MODULE_NAME, 0, &options.moduleArgs, "Invalid %s value: %s", key, error);
|
||||
ffPrintError(FF_OPENGL_MODULE_NAME, 0, &options->moduleArgs, "Invalid %s value: %s", key, error);
|
||||
else
|
||||
options.library = (FFOpenGLLibrary) value;
|
||||
options->library = (FFOpenGLLibrary) value;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
ffPrintError(FF_OPENGL_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_OPENGL_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintOpenGL(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintOpenGL(FFOpenGLOptions* options);
|
||||
void ffInitOpenGLOptions(FFOpenGLOptions* options);
|
||||
bool ffParseOpenGLCommandOptions(FFOpenGLOptions* options, const char* key, const char* value);
|
||||
void ffDestroyOpenGLOptions(FFOpenGLOptions* options);
|
||||
void ffParseOpenGLJsonObject(yyjson_val* module);
|
||||
void ffParseOpenGLJsonObject(FFOpenGLOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -16,7 +16,7 @@ typedef enum FFOpenGLLibrary
|
||||
|
||||
typedef struct FFOpenGLOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "modules/bios/option.h"
|
||||
#include "modules/bluetooth/option.h"
|
||||
#include "modules/board/option.h"
|
||||
#include "modules/break/option.h"
|
||||
#include "modules/brightness/option.h"
|
||||
#include "modules/chassis/option.h"
|
||||
#include "modules/cpu/option.h"
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFOSOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFOSOptions;
|
||||
|
||||
+4
-9
@@ -139,7 +139,7 @@ void ffPrintOS(FFOSOptions* options)
|
||||
|
||||
void ffInitOSOptions(FFOSOptions* options)
|
||||
{
|
||||
options->moduleName = FF_OS_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_OS_MODULE_NAME, ffParseOSCommandOptions, ffParseOSJsonObject, ffPrintOS);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -158,11 +158,8 @@ void ffDestroyOSOptions(FFOSOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseOSJsonObject(yyjson_val* module)
|
||||
void ffParseOSJsonObject(FFOSOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFOSOptions __attribute__((__cleanup__(ffDestroyOSOptions))) options;
|
||||
ffInitOSOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -173,12 +170,10 @@ void ffParseOSJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_OS_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_OS_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintOS(&options);
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,4 +8,4 @@ void ffPrintOS(FFOSOptions* options);
|
||||
void ffInitOSOptions(FFOSOptions* options);
|
||||
bool ffParseOSCommandOptions(FFOSOptions* options, const char* key, const char* value);
|
||||
void ffDestroyOSOptions(FFOSOptions* options);
|
||||
void ffParseOSJsonObject(yyjson_val* module);
|
||||
void ffParseOSJsonObject(FFOSOptions* options, yyjson_val* module);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
typedef struct FFPackagesOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFPackagesOptions;
|
||||
|
||||
@@ -99,7 +99,7 @@ void ffPrintPackages(FFPackagesOptions* options)
|
||||
|
||||
void ffInitPackagesOptions(FFPackagesOptions* options)
|
||||
{
|
||||
options->moduleName = FF_PACKAGES_MODULE_NAME;
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_PACKAGES_MODULE_NAME, ffParsePackagesCommandOptions, ffParsePackagesJsonObject, ffPrintPackages);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -118,11 +118,8 @@ void ffDestroyPackagesOptions(FFPackagesOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParsePackagesJsonObject(yyjson_val* module)
|
||||
void ffParsePackagesJsonObject(FFPackagesOptions* options, yyjson_val* module)
|
||||
{
|
||||
FFPackagesOptions __attribute__((__cleanup__(ffDestroyPackagesOptions))) options;
|
||||
ffInitPackagesOptions(&options);
|
||||
|
||||
if (module)
|
||||
{
|
||||
yyjson_val *key_, *val;
|
||||
@@ -133,12 +130,10 @@ void ffParsePackagesJsonObject(yyjson_val* module)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(FF_PACKAGES_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_PACKAGES_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintPackages(&options);
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ void ffPrintPackages(FFPackagesOptions* options);
|
||||
void ffInitPackagesOptions(FFPackagesOptions* options);
|
||||
bool ffParsePackagesCommandOptions(FFPackagesOptions* options, const char* key, const char* value);
|
||||
void ffDestroyPackagesOptions(FFPackagesOptions* options);
|
||||
void ffParsePackagesJsonObject(yyjson_val* module);
|
||||
void ffParsePackagesJsonObject(FFPackagesOptions* options, yyjson_val* module);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user