diff --git a/src/common/format.h b/src/common/format.h index f1b1aede0..580fc06c2 100644 --- a/src/common/format.h +++ b/src/common/format.h @@ -2,7 +2,7 @@ #include "util/FFstrbuf.h" -typedef enum FFformatargtype +typedef enum FFformatArgType { FF_FORMAT_ARG_TYPE_NULL = 0, FF_FORMAT_ARG_TYPE_UINT, @@ -16,11 +16,26 @@ typedef enum FFformatargtype FF_FORMAT_ARG_TYPE_DOUBLE, FF_FORMAT_ARG_TYPE_LIST, FF_FORMAT_ARG_TYPE_BOOL -} FFformatargtype; +} FFformatArgType; + +#define FF_FORMAT_ARG(variable, var_name) { _Generic((variable), \ + uint32_t: FF_FORMAT_ARG_TYPE_UINT, \ + uint64_t: FF_FORMAT_ARG_TYPE_UINT64, \ + uint16_t: FF_FORMAT_ARG_TYPE_UINT16, \ + uint8_t: FF_FORMAT_ARG_TYPE_UINT8, \ + int32_t: FF_FORMAT_ARG_TYPE_INT, \ + char*: FF_FORMAT_ARG_TYPE_STRING, \ + const char*: FF_FORMAT_ARG_TYPE_STRING, \ + FFstrbuf: FF_FORMAT_ARG_TYPE_STRBUF, \ + float: FF_FORMAT_ARG_TYPE_FLOAT, \ + double: FF_FORMAT_ARG_TYPE_DOUBLE, \ + FFlist: FF_FORMAT_ARG_TYPE_LIST, \ + bool: FF_FORMAT_ARG_TYPE_BOOL \ + ), _Generic((variable), char*: (variable), const char*: (variable), default: &(variable) ), (var_name) } typedef struct FFformatarg { - FFformatargtype type; + FFformatArgType type; const void* value; const char* name; // argument name, must start with an alphabet } FFformatarg; diff --git a/src/common/printing.c b/src/common/printing.c index 89725b2c2..c2112b6b0 100644 --- a/src/common/printing.c +++ b/src/common/printing.c @@ -51,8 +51,8 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu { FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate(); FF_PARSE_FORMAT_STRING_CHECKED(&key, &moduleArgs->key, 2, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT8, &moduleIndex, "index"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &moduleArgs->keyIcon, "icon"}, + FF_FORMAT_ARG(moduleIndex, "index"), + FF_FORMAT_ARG(moduleArgs->keyIcon, "icon"), })); ffStrbufWriteTo(&key, stdout); } diff --git a/src/modules/battery/battery.c b/src/modules/battery/battery.c index 43b957386..743c098e2 100644 --- a/src/modules/battery/battery.c +++ b/src/modules/battery/battery.c @@ -23,8 +23,8 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin { ffStrbufClear(&key); FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 2, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT8, &index, "index"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->modelName, "name"}, + FF_FORMAT_ARG(index, "index"), + FF_FORMAT_ARG(result->modelName, "name"), })); } @@ -81,16 +81,16 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate(); ffTempsAppendNum(result->temperature, &tempStr, options->tempConfig, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(key.chars, index, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_BATTERY_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &result->manufacturer, "manufacturer"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->modelName, "model-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->technology, "technology"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &capacityNum, "capacity"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->status, "status"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &tempStr, "temperature"}, - {FF_FORMAT_ARG_TYPE_UINT, &result->cycleCount, "cycle-count"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->serial, "serial"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->manufactureDate, "manufacture-date"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &capacityBar, "capacity-bar"}, + FF_FORMAT_ARG(result->manufacturer, "manufacturer"), + FF_FORMAT_ARG(result->modelName, "model-name"), + FF_FORMAT_ARG(result->technology, "technology"), + FF_FORMAT_ARG(capacityNum, "capacity"), + FF_FORMAT_ARG(result->status, "status"), + FF_FORMAT_ARG(tempStr, "temperature"), + FF_FORMAT_ARG(result->cycleCount, "cycle-count"), + FF_FORMAT_ARG(result->serial, "serial"), + FF_FORMAT_ARG(result->manufactureDate, "manufacture-date"), + FF_FORMAT_ARG(capacityBar, "capacity-bar"), })); } } diff --git a/src/modules/bios/bios.c b/src/modules/bios/bios.c index ae1e6c7af..6e4e81dd4 100644 --- a/src/modules/bios/bios.c +++ b/src/modules/bios/bios.c @@ -44,8 +44,8 @@ void ffPrintBios(FFBiosOptions* options) { ffStrbufClear(&key); FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 2, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &bios.type, "type"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &options->moduleArgs.keyIcon, "icon"}, + FF_FORMAT_ARG(bios.type, "type"), + FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"), })); } @@ -61,11 +61,11 @@ void ffPrintBios(FFBiosOptions* options) else { FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_BIOS_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &bios.date, "date"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &bios.release, "release"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &bios.vendor, "vendor"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &bios.version, "version"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &bios.type, "type"}, + FF_FORMAT_ARG(bios.date, "date"), + FF_FORMAT_ARG(bios.release, "release"), + FF_FORMAT_ARG(bios.vendor, "vendor"), + FF_FORMAT_ARG(bios.version, "version"), + FF_FORMAT_ARG(bios.type, "type"), })); } diff --git a/src/modules/bluetooth/bluetooth.c b/src/modules/bluetooth/bluetooth.c index 037ca6335..a6bca3bce 100644 --- a/src/modules/bluetooth/bluetooth.c +++ b/src/modules/bluetooth/bluetooth.c @@ -35,12 +35,12 @@ static void printDevice(FFBluetoothOptions* options, const FFBluetoothResult* de ffPercentAppendBar(&percentageBar, device->battery, options->percent, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_BLUETOOTH_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_BLUETOOTH_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &device->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &device->address, "address"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &device->type, "type"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &percentageNum, "battery-percentage"}, - {FF_FORMAT_ARG_TYPE_BOOL, &device->connected, "connected"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &percentageBar, "battery-percentage-bar"}, + FF_FORMAT_ARG(device->name, "name"), + FF_FORMAT_ARG(device->address, "address"), + FF_FORMAT_ARG(device->type, "type"), + FF_FORMAT_ARG(percentageNum, "battery-percentage"), + FF_FORMAT_ARG(device->connected, "connected"), + FF_FORMAT_ARG(percentageBar, "battery-percentage-bar"), })); } } diff --git a/src/modules/bluetoothradio/bluetoothradio.c b/src/modules/bluetoothradio/bluetoothradio.c index 455c06df2..8782c4aca 100644 --- a/src/modules/bluetoothradio/bluetoothradio.c +++ b/src/modules/bluetoothradio/bluetoothradio.c @@ -18,9 +18,9 @@ static void printDevice(FFBluetoothRadioOptions* options, const FFBluetoothRadio else { FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 3, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT, &index, "index"}, - {FF_FORMAT_ARG_TYPE_STRING, radio->name.chars, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &options->moduleArgs.keyIcon, "icon"}, + FF_FORMAT_ARG(index, "index"), + FF_FORMAT_ARG(radio->name, "name"), + FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"), })); } @@ -56,14 +56,14 @@ static void printDevice(FFBluetoothRadioOptions* options, const FFBluetoothRadio else { FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_BLUETOOTHRADIO_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &radio->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &radio->address, "address"}, - {FF_FORMAT_ARG_TYPE_INT, &radio->lmpVersion, "lmp-version"}, - {FF_FORMAT_ARG_TYPE_INT, &radio->lmpSubversion, "lmp-subversion"}, - {FF_FORMAT_ARG_TYPE_STRING, version, "version"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &radio->vendor, "vendor"}, - {FF_FORMAT_ARG_TYPE_BOOL, &radio->discoverable, "discoverable"}, - {FF_FORMAT_ARG_TYPE_BOOL, &radio->connectable, "connectable"}, + FF_FORMAT_ARG(radio->name, "name"), + FF_FORMAT_ARG(radio->address, "address"), + FF_FORMAT_ARG(radio->lmpVersion, "lmp-version"), + FF_FORMAT_ARG(radio->lmpSubversion, "lmp-subversion"), + FF_FORMAT_ARG(version, "version"), + FF_FORMAT_ARG(radio->vendor, "vendor"), + FF_FORMAT_ARG(radio->discoverable, "discoverable"), + FF_FORMAT_ARG(radio->connectable, "connectable"), })); } } diff --git a/src/modules/board/board.c b/src/modules/board/board.c index c40f4da33..58d841b0e 100644 --- a/src/modules/board/board.c +++ b/src/modules/board/board.c @@ -38,10 +38,10 @@ void ffPrintBoard(FFBoardOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_BOARD_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_BOARD_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &result.name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.vendor, "vendor"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.version, "version"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.serial, "serial"}, + FF_FORMAT_ARG(result.name, "name"), + FF_FORMAT_ARG(result.vendor, "vendor"), + FF_FORMAT_ARG(result.version, "version"), + FF_FORMAT_ARG(result.serial, "serial"), })); } diff --git a/src/modules/bootmgr/bootmgr.c b/src/modules/bootmgr/bootmgr.c index fed105cb4..960da0e43 100644 --- a/src/modules/bootmgr/bootmgr.c +++ b/src/modules/bootmgr/bootmgr.c @@ -40,10 +40,10 @@ void ffPrintBootmgr(FFBootmgrOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_BOOTMGR_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_BOOTMGR_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &bootmgr.name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &bootmgr.firmware, "firmware-path"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &firmwareName, "firmware-name"}, - {FF_FORMAT_ARG_TYPE_BOOL, &bootmgr.secureBoot, "secure-boot"}, + FF_FORMAT_ARG(bootmgr.name, "name"), + FF_FORMAT_ARG(bootmgr.firmware, "firmware-path"), + FF_FORMAT_ARG(firmwareName, "firmware-name"), + FF_FORMAT_ARG(bootmgr.secureBoot, "secure-boot"), })); } diff --git a/src/modules/brightness/brightness.c b/src/modules/brightness/brightness.c index bb79e0a79..ca989d35b 100644 --- a/src/modules/brightness/brightness.c +++ b/src/modules/brightness/brightness.c @@ -38,9 +38,9 @@ void ffPrintBrightness(FFBrightnessOptions* options) { uint32_t moduleIndex = result.length == 1 ? 0 : index + 1; FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 3, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT, &moduleIndex, "index"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &item->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &options->moduleArgs.keyIcon, "icon"}, + FF_FORMAT_ARG(moduleIndex, "index"), + FF_FORMAT_ARG(item->name, "name"), + FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"), })); } @@ -73,12 +73,12 @@ void ffPrintBrightness(FFBrightnessOptions* options) FF_STRBUF_AUTO_DESTROY valueBar = ffStrbufCreate(); ffPercentAppendBar(&valueBar, percent, options->percent, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_BRIGHTNESS_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &valueNum, "percentage"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &item->name, "name"}, - {FF_FORMAT_ARG_TYPE_DOUBLE, &item->max, "max"}, - {FF_FORMAT_ARG_TYPE_DOUBLE, &item->min, "min"}, - {FF_FORMAT_ARG_TYPE_DOUBLE, &item->current, "current"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &item->current, "percentage-bar"}, + FF_FORMAT_ARG(valueNum, "percentage"), + FF_FORMAT_ARG(item->name, "name"), + FF_FORMAT_ARG(item->max, "max"), + FF_FORMAT_ARG(item->min, "min"), + FF_FORMAT_ARG(item->current, "current"), + FF_FORMAT_ARG(item->current, "percentage-bar"), })); } diff --git a/src/modules/camera/camera.c b/src/modules/camera/camera.c index 6a9b22d54..4615dc7e1 100644 --- a/src/modules/camera/camera.c +++ b/src/modules/camera/camera.c @@ -28,12 +28,12 @@ static void printDevice(FFCameraOptions* options, const FFCameraResult* device, else { FF_PRINT_FORMAT_CHECKED(FF_CAMERA_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CAMERA_NUM_FORMAT_ARGS, (((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &device->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &device->vendor, "vendor"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &device->colorspace, "colorspace"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &device->id, "id"}, - {FF_FORMAT_ARG_TYPE_UINT, &device->width, "width"}, - {FF_FORMAT_ARG_TYPE_UINT, &device->height, "height"}, + FF_FORMAT_ARG(device->name, "name"), + FF_FORMAT_ARG(device->vendor, "vendor"), + FF_FORMAT_ARG(device->colorspace, "colorspace"), + FF_FORMAT_ARG(device->id, "id"), + FF_FORMAT_ARG(device->width, "width"), + FF_FORMAT_ARG(device->height, "height"), }))); } } diff --git a/src/modules/chassis/chassis.c b/src/modules/chassis/chassis.c index 4e1e6c767..d87b4ad46 100644 --- a/src/modules/chassis/chassis.c +++ b/src/modules/chassis/chassis.c @@ -39,10 +39,10 @@ void ffPrintChassis(FFChassisOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_CHASSIS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CHASSIS_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &result.type, "type"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.vendor, "vendor"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.version, "version"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.serial, "serial"}, + FF_FORMAT_ARG(result.type, "type"), + FF_FORMAT_ARG(result.vendor, "vendor"), + FF_FORMAT_ARG(result.version, "version"), + FF_FORMAT_ARG(result.serial, "serial"), })); } diff --git a/src/modules/command/command.c b/src/modules/command/command.c index 6fa23c4cf..fec6e721b 100644 --- a/src/modules/command/command.c +++ b/src/modules/command/command.c @@ -40,7 +40,7 @@ void ffPrintCommand(FFCommandOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_COMMAND_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_COMMAND_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &result, "result"} + FF_FORMAT_ARG(result, "result") })); } } diff --git a/src/modules/cpu/cpu.c b/src/modules/cpu/cpu.c index 65503eb9a..6bf2de570 100644 --- a/src/modules/cpu/cpu.c +++ b/src/modules/cpu/cpu.c @@ -102,16 +102,16 @@ void ffPrintCPU(FFCPUOptions* options) FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate(); ffTempsAppendNum(cpu.temperature, &tempStr, options->tempConfig, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_CPU_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CPU_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &cpu.name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &cpu.vendor, "vendor"}, - {FF_FORMAT_ARG_TYPE_UINT16, &cpu.coresPhysical, "cores-physical"}, - {FF_FORMAT_ARG_TYPE_UINT16, &cpu.coresLogical, "cores-logical"}, - {FF_FORMAT_ARG_TYPE_UINT16, &cpu.coresOnline, "cores-online"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &freqBase, "freq-base"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &freqMax, "freq-max"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &tempStr, "temperature"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &coreTypes, "core-types"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &freqBioslimit, "freq-bios-limit"}, + FF_FORMAT_ARG(cpu.name, "name"), + FF_FORMAT_ARG(cpu.vendor, "vendor"), + FF_FORMAT_ARG(cpu.coresPhysical, "cores-physical"), + FF_FORMAT_ARG(cpu.coresLogical, "cores-logical"), + FF_FORMAT_ARG(cpu.coresOnline, "cores-online"), + FF_FORMAT_ARG(freqBase, "freq-base"), + FF_FORMAT_ARG(freqMax, "freq-max"), + FF_FORMAT_ARG(tempStr, "temperature"), + FF_FORMAT_ARG(coreTypes, "core-types"), + FF_FORMAT_ARG(freqBioslimit, "freq-bios-limit"), })); } } diff --git a/src/modules/cpucache/cpucache.c b/src/modules/cpucache/cpucache.c index ef6820617..f52ec5cfb 100644 --- a/src/modules/cpucache/cpucache.c +++ b/src/modules/cpucache/cpucache.c @@ -23,9 +23,9 @@ static void printCPUCacheNormal(const FFCPUCacheResult* result, FFCPUCacheOption { uint32_t index = i + 1; FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 3, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT, &index, "index"}, - {FF_FORMAT_ARG_TYPE_STRING, levelStr, "level"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &options->moduleArgs.keyIcon, "icon"}, + FF_FORMAT_ARG(index, "index"), + FF_FORMAT_ARG(levelStr, "level"), + FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"), })); } @@ -62,8 +62,8 @@ static void printCPUCacheNormal(const FFCPUCacheResult* result, FFCPUCacheOption FF_STRBUF_AUTO_DESTROY buffer2 = ffStrbufCreate(); ffParseSize(sum, &buffer2); FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_CPUCACHE_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &buffer, "result"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &buffer2, "sum"}, + FF_FORMAT_ARG(buffer, "result"), + FF_FORMAT_ARG(buffer2, "sum"), })); } } @@ -95,8 +95,8 @@ static void printCPUCacheCompact(const FFCPUCacheResult* result, FFCPUCacheOptio FF_STRBUF_AUTO_DESTROY buffer2 = ffStrbufCreate(); ffParseSize(sum, &buffer2); FF_PRINT_FORMAT_CHECKED(FF_CPUCACHE_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CPUCACHE_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &buffer, "result"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &buffer2, "sum"}, + FF_FORMAT_ARG(buffer, "result"), + FF_FORMAT_ARG(buffer2, "sum"), })); } } diff --git a/src/modules/cpuusage/cpuusage.c b/src/modules/cpuusage/cpuusage.c index d09ae9080..873fd77b9 100644 --- a/src/modules/cpuusage/cpuusage.c +++ b/src/modules/cpuusage/cpuusage.c @@ -86,14 +86,14 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options) FF_STRBUF_AUTO_DESTROY maxBar = ffStrbufCreate(); ffPercentAppendBar(&maxBar, maxValue, options->percent, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_CPUUSAGE_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CPUUSAGE_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &avgNum, "avg"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &maxNum, "max"}, - {FF_FORMAT_ARG_TYPE_UINT, &maxIndex, "max-index"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &minNum, "min"}, - {FF_FORMAT_ARG_TYPE_UINT, &minIndex, "min-index"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &avgBar, "avg-bar"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &maxBar, "max-bar"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &minBar, "min-bar"}, + FF_FORMAT_ARG(avgNum, "avg"), + FF_FORMAT_ARG(maxNum, "max"), + FF_FORMAT_ARG(maxIndex, "max-index"), + FF_FORMAT_ARG(minNum, "min"), + FF_FORMAT_ARG(minIndex, "min-index"), + FF_FORMAT_ARG(avgBar, "avg-bar"), + FF_FORMAT_ARG(maxBar, "max-bar"), + FF_FORMAT_ARG(minBar, "min-bar"), })); } } diff --git a/src/modules/cursor/cursor.c b/src/modules/cursor/cursor.c index 579db4d59..7026bda47 100644 --- a/src/modules/cursor/cursor.c +++ b/src/modules/cursor/cursor.c @@ -39,8 +39,8 @@ void ffPrintCursor(FFCursorOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_CURSOR_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CURSOR_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &result.theme, "theme"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.size, "size"}, + FF_FORMAT_ARG(result.theme, "theme"), + FF_FORMAT_ARG(result.size, "size"), })); } } diff --git a/src/modules/datetime/datetime.c b/src/modules/datetime/datetime.c index f7c657842..67bded503 100644 --- a/src/modules/datetime/datetime.c +++ b/src/modules/datetime/datetime.c @@ -66,28 +66,28 @@ void ffPrintDateTimeFormat(struct tm* tm, const FFModuleArgs* moduleArgs) strftime(result.timezoneName, sizeof(result.timezoneName), "%Z", tm); FF_PRINT_FORMAT_CHECKED(FF_DATETIME_DISPLAY_NAME, 0, moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_DATETIME_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_UINT16, &result.year, "year"}, // 1 - {FF_FORMAT_ARG_TYPE_UINT8, &result.yearShort, "year-short"}, // 2 - {FF_FORMAT_ARG_TYPE_UINT8, &result.month, "month"}, // 3 - {FF_FORMAT_ARG_TYPE_STRING, result.monthPretty, "month-pretty"}, // 4 - {FF_FORMAT_ARG_TYPE_STRING, result.monthName, "month-name"}, // 5 - {FF_FORMAT_ARG_TYPE_STRING, result.monthNameShort, "month-name-short"}, // 6 - {FF_FORMAT_ARG_TYPE_UINT8, &result.week, "week"}, // 7 - {FF_FORMAT_ARG_TYPE_STRING, result.weekday, "weekday"}, // 8 - {FF_FORMAT_ARG_TYPE_STRING, result.weekdayShort, "weekday-short"}, // 9 - {FF_FORMAT_ARG_TYPE_UINT16, &result.dayInYear, "day-in-year"}, // 10 - {FF_FORMAT_ARG_TYPE_UINT8, &result.dayInMonth, "day-in-month"}, // 11 - {FF_FORMAT_ARG_TYPE_UINT8, &result.dayInWeek, "day-in-week"}, // 12 - {FF_FORMAT_ARG_TYPE_UINT8, &result.hour, "hour"}, // 13 - {FF_FORMAT_ARG_TYPE_STRING, result.hourPretty, "hour-pretty"}, // 14 - {FF_FORMAT_ARG_TYPE_UINT8, &result.hour12, "hour-12"}, // 15 - {FF_FORMAT_ARG_TYPE_STRING, result.hour12Pretty, "hour-12-pretty"}, // 16 - {FF_FORMAT_ARG_TYPE_UINT8, &result.minute, "minute"}, // 17 - {FF_FORMAT_ARG_TYPE_STRING, result.minutePretty, "minute-pretty"}, // 18 - {FF_FORMAT_ARG_TYPE_UINT8, &result.second, "second"}, // 19 - {FF_FORMAT_ARG_TYPE_STRING, result.secondPretty, "second-pretty"}, // 20 - {FF_FORMAT_ARG_TYPE_STRING, result.offsetFromUtc, "offset-from-utc"}, // 21 - {FF_FORMAT_ARG_TYPE_STRING, result.timezoneName, "timezone-name"}, // 22 + FF_FORMAT_ARG(result.year, "year"), // 1 + FF_FORMAT_ARG(result.yearShort, "year-short"), // 2 + FF_FORMAT_ARG(result.month, "month"), // 3 + FF_FORMAT_ARG(result.monthPretty, "month-pretty"), // 4 + FF_FORMAT_ARG(result.monthName, "month-name"), // 5 + FF_FORMAT_ARG(result.monthNameShort, "month-name-short"), // 6 + FF_FORMAT_ARG(result.week, "week"), // 7 + FF_FORMAT_ARG(result.weekday, "weekday"), // 8 + FF_FORMAT_ARG(result.weekdayShort, "weekday-short"), // 9 + FF_FORMAT_ARG(result.dayInYear, "day-in-year"), // 10 + FF_FORMAT_ARG(result.dayInMonth, "day-in-month"), // 11 + FF_FORMAT_ARG(result.dayInWeek, "day-in-week"), // 12 + FF_FORMAT_ARG(result.hour, "hour"), // 13 + FF_FORMAT_ARG(result.hourPretty, "hour-pretty"), // 14 + FF_FORMAT_ARG(result.hour12, "hour-12"), // 15 + FF_FORMAT_ARG(result.hour12Pretty, "hour-12-pretty"), // 16 + FF_FORMAT_ARG(result.minute, "minute"), // 17 + FF_FORMAT_ARG(result.minutePretty, "minute-pretty"), // 18 + FF_FORMAT_ARG(result.second, "second"), // 19 + FF_FORMAT_ARG(result.secondPretty, "second-pretty"), // 20 + FF_FORMAT_ARG(result.offsetFromUtc, "offset-from-utc"), // 21 + FF_FORMAT_ARG(result.timezoneName, "timezone-name"), // 22 })); } diff --git a/src/modules/de/de.c b/src/modules/de/de.c index 9c293d146..3decd8318 100644 --- a/src/modules/de/de.c +++ b/src/modules/de/de.c @@ -37,9 +37,9 @@ void ffPrintDE(FFDEOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_DE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_DE_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &result->deProcessName, "process-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->dePrettyName, "pretty-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &version, "version"} + FF_FORMAT_ARG(result->deProcessName, "process-name"), + FF_FORMAT_ARG(result->dePrettyName, "pretty-name"), + FF_FORMAT_ARG(version, "version") })); } } diff --git a/src/modules/disk/disk.c b/src/modules/disk/disk.c index b66236d37..69ed5f8b6 100644 --- a/src/modules/disk/disk.c +++ b/src/modules/disk/disk.c @@ -36,10 +36,10 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk) else { FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 4, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &disk->mountpoint, "mountpoint"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &disk->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &disk->mountFrom, "mount-from"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &options->moduleArgs.keyIcon, "icon"}, + FF_FORMAT_ARG(disk->mountpoint, "mountpoint"), + FF_FORMAT_ARG(disk->name, "name"), + FF_FORMAT_ARG(disk->mountFrom, "mount-from"), + FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"), })); } @@ -121,20 +121,20 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk) bool isReadOnly = !!(disk->type & FF_DISK_VOLUME_TYPE_READONLY_BIT); FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_DISK_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty, "size-used"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty, "size-total"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &bytesPercentageNum, "size-percentage"}, - {FF_FORMAT_ARG_TYPE_UINT, &disk->filesUsed, "files-used"}, - {FF_FORMAT_ARG_TYPE_UINT, &disk->filesTotal, "files-total"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &filesPercentageNum, "files-percentage"}, - {FF_FORMAT_ARG_TYPE_BOOL, &isExternal, "is-external"}, - {FF_FORMAT_ARG_TYPE_BOOL, &isHidden, "is-hidden"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &disk->filesystem, "filesystem"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &disk->name, "name"}, - {FF_FORMAT_ARG_TYPE_BOOL, &isReadOnly, "is-readonly"}, + FF_FORMAT_ARG(usedPretty, "size-used"), + FF_FORMAT_ARG(totalPretty, "size-total"), + FF_FORMAT_ARG(bytesPercentageNum, "size-percentage"), + FF_FORMAT_ARG(disk->filesUsed, "files-used"), + FF_FORMAT_ARG(disk->filesTotal, "files-total"), + FF_FORMAT_ARG(filesPercentageNum, "files-percentage"), + FF_FORMAT_ARG(isExternal, "is-external"), + FF_FORMAT_ARG(isHidden, "is-hidden"), + FF_FORMAT_ARG(disk->filesystem, "filesystem"), + FF_FORMAT_ARG(disk->name, "name"), + FF_FORMAT_ARG(isReadOnly, "is-readonly"), {FF_FORMAT_ARG_TYPE_STRING, ffTimeToShortStr(disk->createTime), "create-time"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &bytesPercentageBar, "size-percentage-bar"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &filesPercentageBar, "files-percentage-bar"}, + FF_FORMAT_ARG(bytesPercentageBar, "size-percentage-bar"), + FF_FORMAT_ARG(filesPercentageBar, "files-percentage-bar"), })); } } diff --git a/src/modules/diskio/diskio.c b/src/modules/diskio/diskio.c index b0ac96405..086f46d9d 100644 --- a/src/modules/diskio/diskio.c +++ b/src/modules/diskio/diskio.c @@ -23,10 +23,10 @@ static void formatKey(const FFDiskIOOptions* options, FFDiskIOResult* dev, uint3 { ffStrbufClear(key); FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, 4, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT, &index, "index"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &dev->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &dev->devPath, "dev-path"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &options->moduleArgs.keyIcon, "icon"}, + FF_FORMAT_ARG(index, "index"), + FF_FORMAT_ARG(dev->name, "name"), + FF_FORMAT_ARG(dev->devPath, "dev-path"), + FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"), })); } } @@ -76,14 +76,14 @@ void ffPrintDiskIO(FFDiskIOOptions* options) if (!options->detectTotal) ffStrbufAppendS(&buffer, "/s"); FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_DISKIO_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &buffer, "size-read"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &buffer2, "size-written"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &dev->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &dev->devPath, "dev-path"}, - {FF_FORMAT_ARG_TYPE_UINT64, &dev->bytesRead, "bytes-read"}, - {FF_FORMAT_ARG_TYPE_UINT64, &dev->bytesWritten, "bytes-written"}, - {FF_FORMAT_ARG_TYPE_UINT64, &dev->readCount, "read-count"}, - {FF_FORMAT_ARG_TYPE_UINT64, &dev->writeCount, "write-count"}, + FF_FORMAT_ARG(buffer, "size-read"), + FF_FORMAT_ARG(buffer2, "size-written"), + FF_FORMAT_ARG(dev->name, "name"), + FF_FORMAT_ARG(dev->devPath, "dev-path"), + FF_FORMAT_ARG(dev->bytesRead, "bytes-read"), + FF_FORMAT_ARG(dev->bytesWritten, "bytes-written"), + FF_FORMAT_ARG(dev->readCount, "read-count"), + FF_FORMAT_ARG(dev->writeCount, "write-count"), })); } ++index; diff --git a/src/modules/display/display.c b/src/modules/display/display.c index c180d338a..4e3f67eb3 100644 --- a/src/modules/display/display.c +++ b/src/modules/display/display.c @@ -92,10 +92,10 @@ void ffPrintDisplay(FFDisplayOptions* options) else { FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 4, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT, &moduleIndex, "index"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRING, displayType, "type"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &options->moduleArgs.keyIcon, "icon"}, + FF_FORMAT_ARG(moduleIndex, "index"), + FF_FORMAT_ARG(result->name, "name"), + FF_FORMAT_ARG(displayType, "type"), + FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"), })); } @@ -152,21 +152,21 @@ void ffPrintDisplay(FFDisplayOptions* options) refreshRate[0] = 0; FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_DISPLAY_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_UINT, &result->width, "width"}, - {FF_FORMAT_ARG_TYPE_UINT, &result->height, "height"}, - {FF_FORMAT_ARG_TYPE_STRING, refreshRate, "refresh-rate"}, - {FF_FORMAT_ARG_TYPE_UINT, &result->scaledWidth, "scaled-width"}, - {FF_FORMAT_ARG_TYPE_UINT, &result->scaledHeight, "scaled-height"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRING, displayType, "type"}, - {FF_FORMAT_ARG_TYPE_UINT, &result->rotation, "rotation"}, - {FF_FORMAT_ARG_TYPE_BOOL, &result->primary, "is-primary"}, - {FF_FORMAT_ARG_TYPE_UINT, &result->physicalWidth, "physical-width"}, - {FF_FORMAT_ARG_TYPE_UINT, &result->physicalHeight, "physical-height"}, - {FF_FORMAT_ARG_TYPE_DOUBLE, &inch, "inch"}, - {FF_FORMAT_ARG_TYPE_DOUBLE, &ppi, "ppi"}, - {FF_FORMAT_ARG_TYPE_UINT8, &result->bitDepth, "bit-depth"}, - {FF_FORMAT_ARG_TYPE_BOOL, &result->hdrEnabled, "hdr-enabled"}, + FF_FORMAT_ARG(result->width, "width"), + FF_FORMAT_ARG(result->height, "height"), + FF_FORMAT_ARG(refreshRate, "refresh-rate"), + FF_FORMAT_ARG(result->scaledWidth, "scaled-width"), + FF_FORMAT_ARG(result->scaledHeight, "scaled-height"), + FF_FORMAT_ARG(result->name, "name"), + FF_FORMAT_ARG(displayType, "type"), + FF_FORMAT_ARG(result->rotation, "rotation"), + FF_FORMAT_ARG(result->primary, "is-primary"), + FF_FORMAT_ARG(result->physicalWidth, "physical-width"), + FF_FORMAT_ARG(result->physicalHeight, "physical-height"), + FF_FORMAT_ARG(inch, "inch"), + FF_FORMAT_ARG(ppi, "ppi"), + FF_FORMAT_ARG(result->bitDepth, "bit-depth"), + FF_FORMAT_ARG(result->hdrEnabled, "hdr-enabled"), })); } } diff --git a/src/modules/dns/dns.c b/src/modules/dns/dns.c index 3eef47be2..63a744885 100644 --- a/src/modules/dns/dns.c +++ b/src/modules/dns/dns.c @@ -49,7 +49,7 @@ void ffPrintDNS(FFDNSOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_DNS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_DNS_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &buf, "result"}, + FF_FORMAT_ARG(buf, "result"), })); } diff --git a/src/modules/editor/editor.c b/src/modules/editor/editor.c index 490c313a8..b814a55e9 100644 --- a/src/modules/editor/editor.c +++ b/src/modules/editor/editor.c @@ -42,11 +42,11 @@ void ffPrintEditor(FFEditorOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_EDITOR_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_EDITOR_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRING, result.type, "type"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.exe, "exe-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.path, "path"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.version, "version"}, + FF_FORMAT_ARG(result.type, "type"), + FF_FORMAT_ARG(result.name, "name"), + FF_FORMAT_ARG(result.exe, "exe-name"), + FF_FORMAT_ARG(result.path, "path"), + FF_FORMAT_ARG(result.version, "version"), })); } diff --git a/src/modules/font/font.c b/src/modules/font/font.c index a0bd9121f..3fbc9ac94 100644 --- a/src/modules/font/font.c +++ b/src/modules/font/font.c @@ -29,11 +29,11 @@ void ffPrintFont(FFFontOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_FONT_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_FONT_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &font.fonts[0], "font1"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &font.fonts[1], "font2"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &font.fonts[2], "font3"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &font.fonts[3], "font4"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &font.display, "combined"}, + FF_FORMAT_ARG(font.fonts[0], "font1"), + FF_FORMAT_ARG(font.fonts[1], "font2"), + FF_FORMAT_ARG(font.fonts[2], "font3"), + FF_FORMAT_ARG(font.fonts[3], "font4"), + FF_FORMAT_ARG(font.display, "combined"), })); } } diff --git a/src/modules/gamepad/gamepad.c b/src/modules/gamepad/gamepad.c index 988fc3a1e..b1b3457f0 100644 --- a/src/modules/gamepad/gamepad.c +++ b/src/modules/gamepad/gamepad.c @@ -31,10 +31,10 @@ static void printDevice(FFGamepadOptions* options, const FFGamepadDevice* device ffPercentAppendBar(&percentageBar, device->battery, options->percent, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_GAMEPAD_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_GAMEPAD_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &device->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &device->serial, "serial"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &percentageNum, "battery-percentage"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &percentageBar, "battery-percentage-bar"}, + FF_FORMAT_ARG(device->name, "name"), + FF_FORMAT_ARG(device->serial, "serial"), + FF_FORMAT_ARG(percentageNum, "battery-percentage"), + FF_FORMAT_ARG(percentageBar, "battery-percentage-bar"), })); } } diff --git a/src/modules/gpu/gpu.c b/src/modules/gpu/gpu.c index b16040e95..bdc2e890d 100644 --- a/src/modules/gpu/gpu.c +++ b/src/modules/gpu/gpu.c @@ -91,18 +91,18 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu ffParseFrequency(gpu->frequency, &frequency); FF_PRINT_FORMAT_CHECKED(FF_GPU_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_GPU_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &gpu->vendor, "vendor"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &gpu->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &gpu->driver, "driver"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &tempStr, "temperature"}, - {FF_FORMAT_ARG_TYPE_INT, &gpu->coreCount, "core-count"}, - {FF_FORMAT_ARG_TYPE_STRING, type, "type"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &dTotal, "dedicated-total"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &dUsed, "dedicated-used"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &sTotal, "shared-total"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &sUsed, "shared-used"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &gpu->platformApi, "platform-api"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &frequency, "frequency"}, + FF_FORMAT_ARG(gpu->vendor, "vendor"), + FF_FORMAT_ARG(gpu->name, "name"), + FF_FORMAT_ARG(gpu->driver, "driver"), + FF_FORMAT_ARG(tempStr, "temperature"), + FF_FORMAT_ARG(gpu->coreCount, "core-count"), + FF_FORMAT_ARG(type, "type"), + FF_FORMAT_ARG(dTotal, "dedicated-total"), + FF_FORMAT_ARG(dUsed, "dedicated-used"), + FF_FORMAT_ARG(sTotal, "shared-total"), + FF_FORMAT_ARG(sUsed, "shared-used"), + FF_FORMAT_ARG(gpu->platformApi, "platform-api"), + FF_FORMAT_ARG(frequency, "frequency"), })); } } diff --git a/src/modules/host/host.c b/src/modules/host/host.c index 8e2d4b9a7..c63a9896e 100644 --- a/src/modules/host/host.c +++ b/src/modules/host/host.c @@ -49,13 +49,13 @@ void ffPrintHost(FFHostOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_HOST_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_HOST_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &host.family, "family"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &host.name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &host.version, "version"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &host.sku, "sku"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &host.vendor, "vendor"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &host.serial, "serial"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &host.uuid, "uuid"}, + FF_FORMAT_ARG(host.family, "family"), + FF_FORMAT_ARG(host.name, "name"), + FF_FORMAT_ARG(host.version, "version"), + FF_FORMAT_ARG(host.sku, "sku"), + FF_FORMAT_ARG(host.vendor, "vendor"), + FF_FORMAT_ARG(host.serial, "serial"), + FF_FORMAT_ARG(host.uuid, "uuid"), })); } diff --git a/src/modules/icons/icons.c b/src/modules/icons/icons.c index cf120e61f..891aeb572 100644 --- a/src/modules/icons/icons.c +++ b/src/modules/icons/icons.c @@ -36,8 +36,8 @@ void ffPrintIcons(FFIconsOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_ICONS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_ICONS_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &result.icons1, "icons1"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.icons2, "icons2"}, + FF_FORMAT_ARG(result.icons1, "icons1"), + FF_FORMAT_ARG(result.icons2, "icons2"), })); } diff --git a/src/modules/initsystem/initsystem.c b/src/modules/initsystem/initsystem.c index fbded86b4..7a2824a60 100644 --- a/src/modules/initsystem/initsystem.c +++ b/src/modules/initsystem/initsystem.c @@ -36,10 +36,10 @@ void ffPrintInitSystem(FFInitSystemOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_INITSYSTEM_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_INITSYSTEM_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &result.name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.exe, "exe"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.version, "version"}, - {FF_FORMAT_ARG_TYPE_UINT, &result.pid, "pid"}, + FF_FORMAT_ARG(result.name, "name"), + FF_FORMAT_ARG(result.exe, "exe"), + FF_FORMAT_ARG(result.version, "version"), + FF_FORMAT_ARG(result.pid, "pid"), })); } diff --git a/src/modules/kernel/kernel.c b/src/modules/kernel/kernel.c index 089934d9a..13b96c49c 100644 --- a/src/modules/kernel/kernel.c +++ b/src/modules/kernel/kernel.c @@ -23,12 +23,12 @@ void ffPrintKernel(FFKernelOptions* options) FF_STRBUF_AUTO_DESTROY str = ffStrbufCreate(); ffParseSize(info->pageSize, &str); FF_PRINT_FORMAT_CHECKED(FF_KERNEL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_KERNEL_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &info->name, "sysname"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &info->release, "release"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &info->version, "version"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &info->architecture, "arch"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &info->displayVersion, "display-version"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &str, "page-size"}, + FF_FORMAT_ARG(info->name, "sysname"), + FF_FORMAT_ARG(info->release, "release"), + FF_FORMAT_ARG(info->version, "version"), + FF_FORMAT_ARG(info->architecture, "arch"), + FF_FORMAT_ARG(info->displayVersion, "display-version"), + FF_FORMAT_ARG(str, "page-size"), })); } } diff --git a/src/modules/lm/lm.c b/src/modules/lm/lm.c index 1775561a3..12500821a 100644 --- a/src/modules/lm/lm.c +++ b/src/modules/lm/lm.c @@ -39,9 +39,9 @@ void ffPrintLM(FFLMOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_LM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_LM_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &result.service, "service"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.type, "type"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.version, "version"}, + FF_FORMAT_ARG(result.service, "service"), + FF_FORMAT_ARG(result.type, "type"), + FF_FORMAT_ARG(result.version, "version"), })); } ffStrbufDestroy(&result.service); diff --git a/src/modules/loadavg/loadavg.c b/src/modules/loadavg/loadavg.c index 26d4ffb8d..7802c3fd2 100644 --- a/src/modules/loadavg/loadavg.c +++ b/src/modules/loadavg/loadavg.c @@ -50,9 +50,9 @@ void ffPrintLoadavg(FFLoadavgOptions* options) { ffStrbufClear(&buffer); FF_PARSE_FORMAT_STRING_CHECKED(&buffer, &options->moduleArgs.key, 3, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT, &index, "index"}, - {FF_FORMAT_ARG_TYPE_UINT, &duration, "duration"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &options->moduleArgs.keyIcon, "icon"}, + FF_FORMAT_ARG(index, "index"), + FF_FORMAT_ARG(duration, "duration"), + FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"), })); } @@ -85,9 +85,9 @@ void ffPrintLoadavg(FFLoadavgOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_LOADAVG_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_LOADAVG_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_DOUBLE, &result[0], "loadavg1"}, - {FF_FORMAT_ARG_TYPE_DOUBLE, &result[1], "loadavg2"}, - {FF_FORMAT_ARG_TYPE_DOUBLE, &result[2], "loadavg3"}, + FF_FORMAT_ARG(result[0], "loadavg1"), + FF_FORMAT_ARG(result[1], "loadavg2"), + FF_FORMAT_ARG(result[2], "loadavg3"), })); } } diff --git a/src/modules/locale/locale.c b/src/modules/locale/locale.c index 36f43de10..cfd417761 100644 --- a/src/modules/locale/locale.c +++ b/src/modules/locale/locale.c @@ -25,7 +25,7 @@ void ffPrintLocale(FFLocaleOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_LOCALE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_LOCALE_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &locale, "result"} + FF_FORMAT_ARG(locale, "result") })); } } diff --git a/src/modules/localip/localip.c b/src/modules/localip/localip.c index 2a5db4914..da9440610 100644 --- a/src/modules/localip/localip.c +++ b/src/modules/localip/localip.c @@ -26,10 +26,10 @@ static void formatKey(const FFLocalIpOptions* options, FFLocalIpResult* ip, uint { ffStrbufClear(key); FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, 4, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT, &index, "index"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &ip->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &ip->mac, "mac"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &options->moduleArgs.keyIcon, "icon"}, + FF_FORMAT_ARG(index, "index"), + FF_FORMAT_ARG(ip->name, "name"), + FF_FORMAT_ARG(ip->mac, "mac"), + FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"), })); } } @@ -120,13 +120,13 @@ void ffPrintLocalIp(FFLocalIpOptions* options) ffStrbufSetF(&speedStr, "%u Mbps", (unsigned) ip->speed); } FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_LOCALIP_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &ip->ipv4, "ipv4"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &ip->ipv6, "ipv6"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &ip->mac, "mac"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &ip->name, "ifname"}, - {FF_FORMAT_ARG_TYPE_BOOL, &ip->defaultRoute, "is-default-route"}, - {FF_FORMAT_ARG_TYPE_INT, &ip->mtu, "mtu"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &speedStr, "speed"}, + FF_FORMAT_ARG(ip->ipv4, "ipv4"), + FF_FORMAT_ARG(ip->ipv6, "ipv6"), + FF_FORMAT_ARG(ip->mac, "mac"), + FF_FORMAT_ARG(ip->name, "ifname"), + FF_FORMAT_ARG(ip->defaultRoute, "is-default-route"), + FF_FORMAT_ARG(ip->mtu, "mtu"), + FF_FORMAT_ARG(speedStr, "speed"), })); } ++index; diff --git a/src/modules/media/media.c b/src/modules/media/media.c index 64e6edd2b..6c7ac2c8e 100644 --- a/src/modules/media/media.c +++ b/src/modules/media/media.c @@ -96,11 +96,11 @@ void ffPrintMedia(FFMediaOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_MEDIA_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_MEDIA_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &songPretty, "combined"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &media->song, "title"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &media->artist, "artist"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &media->album, "album"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &media->status, "status"}, + FF_FORMAT_ARG(songPretty, "combined"), + FF_FORMAT_ARG(media->song, "title"), + FF_FORMAT_ARG(media->artist, "artist"), + FF_FORMAT_ARG(media->album, "album"), + FF_FORMAT_ARG(media->status, "status"), })); } } diff --git a/src/modules/memory/memory.c b/src/modules/memory/memory.c index 2d6bc6d83..1ce5ab8fd 100644 --- a/src/modules/memory/memory.c +++ b/src/modules/memory/memory.c @@ -61,10 +61,10 @@ void ffPrintMemory(FFMemoryOptions* options) FF_STRBUF_AUTO_DESTROY percentageBar = ffStrbufCreate(); ffPercentAppendBar(&percentageBar, percentage, options->percent, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_MEMORY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_MEMORY_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty, "used"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty, "total"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &percentageNum, "percentage"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &percentageBar, "percentage-bar"}, + FF_FORMAT_ARG(usedPretty, "used"), + FF_FORMAT_ARG(totalPretty, "total"), + FF_FORMAT_ARG(percentageNum, "percentage"), + FF_FORMAT_ARG(percentageBar, "percentage-bar"), })); } } diff --git a/src/modules/monitor/monitor.c b/src/modules/monitor/monitor.c index 71723790a..a2d43cff7 100644 --- a/src/modules/monitor/monitor.c +++ b/src/modules/monitor/monitor.c @@ -42,9 +42,9 @@ void ffPrintMonitor(FFMonitorOptions* options) { uint32_t moduleIndex = result.length == 1 ? 0 : index + 1; FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 3, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT, &moduleIndex, "index"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &display->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &options->moduleArgs.keyIcon, "icon"}, + FF_FORMAT_ARG(moduleIndex, "index"), + FF_FORMAT_ARG(display->name, "name"), + FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"), })); } @@ -72,17 +72,17 @@ void ffPrintMonitor(FFMonitorOptions* options) buf[0] = '\0'; FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_MONITOR_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &display->name, "name"}, - {FF_FORMAT_ARG_TYPE_UINT, &display->width, "width"}, - {FF_FORMAT_ARG_TYPE_UINT, &display->height, "height"}, - {FF_FORMAT_ARG_TYPE_UINT, &display->physicalWidth, "physical-width"}, - {FF_FORMAT_ARG_TYPE_UINT, &display->physicalHeight, "physical-height"}, - {FF_FORMAT_ARG_TYPE_DOUBLE, &inch, "inch"}, - {FF_FORMAT_ARG_TYPE_DOUBLE, &ppi, "ppi"}, - {FF_FORMAT_ARG_TYPE_UINT16, &display->manufactureYear, "manufacture-year"}, - {FF_FORMAT_ARG_TYPE_UINT16, &display->manufactureWeek, "manufacture-week"}, - {FF_FORMAT_ARG_TYPE_STRING, buf, "serial"}, - {FF_FORMAT_ARG_TYPE_DOUBLE, &display->refreshRate, "refresh-rate"}, + FF_FORMAT_ARG(display->name, "name"), + FF_FORMAT_ARG(display->width, "width"), + FF_FORMAT_ARG(display->height, "height"), + FF_FORMAT_ARG(display->physicalWidth, "physical-width"), + FF_FORMAT_ARG(display->physicalHeight, "physical-height"), + FF_FORMAT_ARG(inch, "inch"), + FF_FORMAT_ARG(ppi, "ppi"), + FF_FORMAT_ARG(display->manufactureYear, "manufacture-year"), + FF_FORMAT_ARG(display->manufactureWeek, "manufacture-week"), + FF_FORMAT_ARG(buf, "serial"), + FF_FORMAT_ARG(display->refreshRate, "refresh-rate"), })); } diff --git a/src/modules/netio/netio.c b/src/modules/netio/netio.c index f6d772746..e6eebd4df 100644 --- a/src/modules/netio/netio.c +++ b/src/modules/netio/netio.c @@ -26,9 +26,9 @@ static void formatKey(const FFNetIOOptions* options, FFNetIOResult* inf, uint32_ { ffStrbufClear(key); FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, 3, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT, &index, "index"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &inf->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &options->moduleArgs.keyIcon, "icon"}, + FF_FORMAT_ARG(index, "index"), + FF_FORMAT_ARG(inf->name, "name"), + FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"), })); } } @@ -81,18 +81,18 @@ void ffPrintNetIO(FFNetIOOptions* options) if (!options->detectTotal) ffStrbufAppendS(&buffer2, "/s"); FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_NETIO_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &buffer, "rx-size"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &buffer2, "tx-size"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &inf->name, "ifname"}, - {FF_FORMAT_ARG_TYPE_BOOL, &inf->defaultRoute, "is-default-route"}, - {FF_FORMAT_ARG_TYPE_UINT64, &inf->txBytes, "tx-bytes"}, - {FF_FORMAT_ARG_TYPE_UINT64, &inf->rxBytes, "rx-bytes"}, - {FF_FORMAT_ARG_TYPE_UINT64, &inf->txPackets, "tx-packets"}, - {FF_FORMAT_ARG_TYPE_UINT64, &inf->rxPackets, "rx-packets"}, - {FF_FORMAT_ARG_TYPE_UINT64, &inf->rxErrors, "rx-errors"}, - {FF_FORMAT_ARG_TYPE_UINT64, &inf->txErrors, "tx-errors"}, - {FF_FORMAT_ARG_TYPE_UINT64, &inf->rxDrops, "rx-drops"}, - {FF_FORMAT_ARG_TYPE_UINT64, &inf->txDrops, "tx-drops"}, + FF_FORMAT_ARG(buffer, "rx-size"), + FF_FORMAT_ARG(buffer2, "tx-size"), + FF_FORMAT_ARG(inf->name, "ifname"), + FF_FORMAT_ARG(inf->defaultRoute, "is-default-route"), + FF_FORMAT_ARG(inf->txBytes, "tx-bytes"), + FF_FORMAT_ARG(inf->rxBytes, "rx-bytes"), + FF_FORMAT_ARG(inf->txPackets, "tx-packets"), + FF_FORMAT_ARG(inf->rxPackets, "rx-packets"), + FF_FORMAT_ARG(inf->rxErrors, "rx-errors"), + FF_FORMAT_ARG(inf->txErrors, "tx-errors"), + FF_FORMAT_ARG(inf->rxDrops, "rx-drops"), + FF_FORMAT_ARG(inf->txDrops, "tx-drops"), })); } ++index; diff --git a/src/modules/opencl/opencl.c b/src/modules/opencl/opencl.c index cb29a155e..30f3c716c 100644 --- a/src/modules/opencl/opencl.c +++ b/src/modules/opencl/opencl.c @@ -25,9 +25,9 @@ void ffPrintOpenCL(FFOpenCLOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_OPENCL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_OPENCL_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &result->version, "version"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->vendor, "vendor"}, + FF_FORMAT_ARG(result->version, "version"), + FF_FORMAT_ARG(result->name, "name"), + FF_FORMAT_ARG(result->vendor, "vendor"), })); } } diff --git a/src/modules/opengl/opengl.c b/src/modules/opengl/opengl.c index aea90dbb6..d00c87e55 100644 --- a/src/modules/opengl/opengl.c +++ b/src/modules/opengl/opengl.c @@ -30,11 +30,11 @@ void ffPrintOpenGL(FFOpenGLOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_OPENGL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_OPENGL_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &result.version, "version"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.renderer, "renderer"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.vendor, "vendor"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.slv, "slv"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.library, "library"}, + FF_FORMAT_ARG(result.version, "version"), + FF_FORMAT_ARG(result.renderer, "renderer"), + FF_FORMAT_ARG(result.vendor, "vendor"), + FF_FORMAT_ARG(result.slv, "slv"), + FF_FORMAT_ARG(result.library, "library"), })); } diff --git a/src/modules/os/os.c b/src/modules/os/os.c index bb6edb659..c00676fce 100644 --- a/src/modules/os/os.c +++ b/src/modules/os/os.c @@ -112,18 +112,18 @@ void ffPrintOS(FFOSOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_OS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_OS_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.sysinfo.name, "sysname"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &os->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &os->prettyName, "pretty-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &os->id, "id"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &os->idLike, "id-like"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &os->variant, "variant"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &os->variantID, "variant-id"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &os->version, "version"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &os->versionID, "version-id"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &os->codename, "codename"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &os->buildID, "build-id"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.sysinfo.architecture, "arch"} + FF_FORMAT_ARG(instance.state.platform.sysinfo.name, "sysname"), + FF_FORMAT_ARG(os->name, "name"), + FF_FORMAT_ARG(os->prettyName, "pretty-name"), + FF_FORMAT_ARG(os->id, "id"), + FF_FORMAT_ARG(os->idLike, "id-like"), + FF_FORMAT_ARG(os->variant, "variant"), + FF_FORMAT_ARG(os->variantID, "variant-id"), + FF_FORMAT_ARG(os->version, "version"), + FF_FORMAT_ARG(os->versionID, "version-id"), + FF_FORMAT_ARG(os->codename, "codename"), + FF_FORMAT_ARG(os->buildID, "build-id"), + FF_FORMAT_ARG(instance.state.platform.sysinfo.architecture, "arch") })); } } diff --git a/src/modules/packages/packages.c b/src/modules/packages/packages.c index 8593a9f46..3d056c12d 100644 --- a/src/modules/packages/packages.c +++ b/src/modules/packages/packages.c @@ -82,43 +82,43 @@ void ffPrintPackages(FFPackagesOptions* options) uint32_t brewAll = counts.brew + counts.brewCask; uint32_t guixAll = counts.guixSystem + counts.guixUser + counts.guixHome; FF_PRINT_FORMAT_CHECKED(FF_PACKAGES_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PACKAGES_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT, &counts.all, "all"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.pacman, "pacman"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &counts.pacmanBranch, "pacman-branch"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.dpkg, "dpkg"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.rpm, "rpm"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.emerge, "emerge"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.eopkg, "eopkg"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.xbps, "xbps"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.nixSystem, "nix-system"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.nixUser, "nix-user"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.nixDefault, "nix-default"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.apk, "apk"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.pkg, "pkg"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.flatpakSystem, "flatpak-system"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.flatpakUser, "flatpak-user"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.snap, "snap"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.brew, "brew"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.brewCask, "brew-cask"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.macports, "macports"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.scoop, "scoop"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.choco, "choco"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.pkgtool, "pkgtool"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.paludis, "paludis"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.winget, "winget"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.opkg, "opkg"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.am, "am"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.sorcery, "sorcery"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.lpkg, "lpkg"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.lpkgbuild, "lpkgbuild"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.guixSystem, "guix-system"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.guixUser, "guix-user"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.guixHome, "guix-home"}, - {FF_FORMAT_ARG_TYPE_UINT, &counts.linglong, "linglong"}, - {FF_FORMAT_ARG_TYPE_UINT, &nixAll, "nix-all"}, - {FF_FORMAT_ARG_TYPE_UINT, &flatpakAll, "flatpak-all"}, - {FF_FORMAT_ARG_TYPE_UINT, &brewAll, "brew-all"}, - {FF_FORMAT_ARG_TYPE_UINT, &guixAll, "guix-all"}, + FF_FORMAT_ARG(counts.all, "all"), + FF_FORMAT_ARG(counts.pacman, "pacman"), + FF_FORMAT_ARG(counts.pacmanBranch, "pacman-branch"), + FF_FORMAT_ARG(counts.dpkg, "dpkg"), + FF_FORMAT_ARG(counts.rpm, "rpm"), + FF_FORMAT_ARG(counts.emerge, "emerge"), + FF_FORMAT_ARG(counts.eopkg, "eopkg"), + FF_FORMAT_ARG(counts.xbps, "xbps"), + FF_FORMAT_ARG(counts.nixSystem, "nix-system"), + FF_FORMAT_ARG(counts.nixUser, "nix-user"), + FF_FORMAT_ARG(counts.nixDefault, "nix-default"), + FF_FORMAT_ARG(counts.apk, "apk"), + FF_FORMAT_ARG(counts.pkg, "pkg"), + FF_FORMAT_ARG(counts.flatpakSystem, "flatpak-system"), + FF_FORMAT_ARG(counts.flatpakUser, "flatpak-user"), + FF_FORMAT_ARG(counts.snap, "snap"), + FF_FORMAT_ARG(counts.brew, "brew"), + FF_FORMAT_ARG(counts.brewCask, "brew-cask"), + FF_FORMAT_ARG(counts.macports, "macports"), + FF_FORMAT_ARG(counts.scoop, "scoop"), + FF_FORMAT_ARG(counts.choco, "choco"), + FF_FORMAT_ARG(counts.pkgtool, "pkgtool"), + FF_FORMAT_ARG(counts.paludis, "paludis"), + FF_FORMAT_ARG(counts.winget, "winget"), + FF_FORMAT_ARG(counts.opkg, "opkg"), + FF_FORMAT_ARG(counts.am, "am"), + FF_FORMAT_ARG(counts.sorcery, "sorcery"), + FF_FORMAT_ARG(counts.lpkg, "lpkg"), + FF_FORMAT_ARG(counts.lpkgbuild, "lpkgbuild"), + FF_FORMAT_ARG(counts.guixSystem, "guix-system"), + FF_FORMAT_ARG(counts.guixUser, "guix-user"), + FF_FORMAT_ARG(counts.guixHome, "guix-home"), + FF_FORMAT_ARG(counts.linglong, "linglong"), + FF_FORMAT_ARG(nixAll, "nix-all"), + FF_FORMAT_ARG(flatpakAll, "flatpak-all"), + FF_FORMAT_ARG(brewAll, "brew-all"), + FF_FORMAT_ARG(guixAll, "guix-all"), })); } diff --git a/src/modules/physicaldisk/physicaldisk.c b/src/modules/physicaldisk/physicaldisk.c index 10149ae65..f5ce33bc6 100644 --- a/src/modules/physicaldisk/physicaldisk.c +++ b/src/modules/physicaldisk/physicaldisk.c @@ -24,10 +24,10 @@ static void formatKey(const FFPhysicalDiskOptions* options, FFPhysicalDiskResult { ffStrbufClear(key); FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, 4, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT, &index, "index"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &dev->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &dev->devPath, "dev-path"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &options->moduleArgs.keyIcon, "icon"}, + FF_FORMAT_ARG(index, "index"), + FF_FORMAT_ARG(dev->name, "name"), + FF_FORMAT_ARG(dev->devPath, "dev-path"), + FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"), })); } } @@ -109,16 +109,16 @@ void ffPrintPhysicalDisk(FFPhysicalDiskOptions* options) if (dev->type & FF_PHYSICALDISK_TYPE_READWRITE) readOnlyType = "Read-write"; FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_PHYSICALDISK_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &buffer, "size"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &dev->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &dev->interconnect, "interconnect"}, - {FF_FORMAT_ARG_TYPE_STRING, physicalType, "type"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &dev->devPath, "dev-path"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &dev->serial, "serial"}, - {FF_FORMAT_ARG_TYPE_STRING, removableType, "removable-type"}, - {FF_FORMAT_ARG_TYPE_STRING, readOnlyType, "readonly-type"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &dev->revision, "revision"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &tempStr, "temperature"}, + FF_FORMAT_ARG(buffer, "size"), + FF_FORMAT_ARG(dev->name, "name"), + FF_FORMAT_ARG(dev->interconnect, "interconnect"), + FF_FORMAT_ARG(physicalType, "type"), + FF_FORMAT_ARG(dev->devPath, "dev-path"), + FF_FORMAT_ARG(dev->serial, "serial"), + FF_FORMAT_ARG(removableType, "removable-type"), + FF_FORMAT_ARG(readOnlyType, "readonly-type"), + FF_FORMAT_ARG(dev->revision, "revision"), + FF_FORMAT_ARG(tempStr, "temperature"), })); } ++index; diff --git a/src/modules/physicalmemory/physicalmemory.c b/src/modules/physicalmemory/physicalmemory.c index 6949b045d..747b7e709 100644 --- a/src/modules/physicalmemory/physicalmemory.c +++ b/src/modules/physicalmemory/physicalmemory.c @@ -55,17 +55,17 @@ void ffPrintPhysicalMemory(FFPhysicalMemoryOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_PHYSICALMEMORY_DISPLAY_NAME, (uint8_t) i, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PHYSICALMEMORY_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_UINT64, &device->size, "bytes"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &prettySize, "size"}, - {FF_FORMAT_ARG_TYPE_UINT, &device->maxSpeed, "max-speed"}, - {FF_FORMAT_ARG_TYPE_UINT, &device->runningSpeed, "running-speed"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &device->type, "type"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &device->formFactor, "form-factor"}, - {FF_FORMAT_ARG_TYPE_DOUBLE, &device->locator, "locator"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &device->vendor, "vendor"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &device->serial, "serial"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &device->partNumber, "part-number"}, - {FF_FORMAT_ARG_TYPE_BOOL, &device->ecc, "is-ecc-enabled"}, + FF_FORMAT_ARG(device->size, "bytes"), + FF_FORMAT_ARG(prettySize, "size"), + FF_FORMAT_ARG(device->maxSpeed, "max-speed"), + FF_FORMAT_ARG(device->runningSpeed, "running-speed"), + FF_FORMAT_ARG(device->type, "type"), + FF_FORMAT_ARG(device->formFactor, "form-factor"), + FF_FORMAT_ARG(device->locator, "locator"), + FF_FORMAT_ARG(device->vendor, "vendor"), + FF_FORMAT_ARG(device->serial, "serial"), + FF_FORMAT_ARG(device->partNumber, "part-number"), + FF_FORMAT_ARG(device->ecc, "is-ecc-enabled"), })); } } diff --git a/src/modules/player/player.c b/src/modules/player/player.c index 712d64351..2dd781a80 100644 --- a/src/modules/player/player.c +++ b/src/modules/player/player.c @@ -74,10 +74,10 @@ void ffPrintPlayer(FFPlayerOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_PLAYER_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PLAYER_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &playerPretty, "player"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &media->player, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &media->playerId, "id"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &media->url, "url"}, + FF_FORMAT_ARG(playerPretty, "player"), + FF_FORMAT_ARG(media->player, "name"), + FF_FORMAT_ARG(media->playerId, "id"), + FF_FORMAT_ARG(media->url, "url"), })); } } diff --git a/src/modules/poweradapter/poweradapter.c b/src/modules/poweradapter/poweradapter.c index cadbfbbb9..3445f7c35 100644 --- a/src/modules/poweradapter/poweradapter.c +++ b/src/modules/poweradapter/poweradapter.c @@ -39,12 +39,12 @@ void ffPrintPowerAdapter(FFPowerAdapterOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_POWERADAPTER_DISPLAY_NAME, i, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_POWERADAPTER_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_INT, &result->watts, "watts"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->manufacturer, "manufacturer"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->modelName, "model-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->description, "description"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->serial, "serial"}, + FF_FORMAT_ARG(result->watts, "watts"), + FF_FORMAT_ARG(result->name, "name"), + FF_FORMAT_ARG(result->manufacturer, "manufacturer"), + FF_FORMAT_ARG(result->modelName, "model-name"), + FF_FORMAT_ARG(result->description, "description"), + FF_FORMAT_ARG(result->serial, "serial"), })); } diff --git a/src/modules/processes/processes.c b/src/modules/processes/processes.c index f50cb3ea2..8c4d4865b 100644 --- a/src/modules/processes/processes.c +++ b/src/modules/processes/processes.c @@ -26,7 +26,7 @@ void ffPrintProcesses(FFProcessesOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_PROCESSES_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PROCESSES_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT, &numProcesses, "result"} + FF_FORMAT_ARG(numProcesses, "result") })); } } diff --git a/src/modules/publicip/publicip.c b/src/modules/publicip/publicip.c index aa94d02a0..110dea8e0 100644 --- a/src/modules/publicip/publicip.c +++ b/src/modules/publicip/publicip.c @@ -31,8 +31,8 @@ void ffPrintPublicIp(FFPublicIpOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_PUBLICIP_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PUBLICIP_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &result.ip, "ip"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.location, "location"}, + FF_FORMAT_ARG(result.ip, "ip"), + FF_FORMAT_ARG(result.location, "location"), })); } diff --git a/src/modules/shell/shell.c b/src/modules/shell/shell.c index 6d7edb177..862997156 100644 --- a/src/modules/shell/shell.c +++ b/src/modules/shell/shell.c @@ -32,14 +32,14 @@ void ffPrintShell(FFShellOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_SHELL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_SHELL_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &result->processName, "process-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->exe, "exe"}, - {FF_FORMAT_ARG_TYPE_STRING, result->exeName, "exe-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->version, "version"}, - {FF_FORMAT_ARG_TYPE_UINT, &result->pid, "pid"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->prettyName, "pretty-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->exePath, "exe-path"}, - {FF_FORMAT_ARG_TYPE_INT, &result->tty, "tty"}, + FF_FORMAT_ARG(result->processName, "process-name"), + FF_FORMAT_ARG(result->exe, "exe"), + FF_FORMAT_ARG(result->exeName, "exe-name"), + FF_FORMAT_ARG(result->version, "version"), + FF_FORMAT_ARG(result->pid, "pid"), + FF_FORMAT_ARG(result->prettyName, "pretty-name"), + FF_FORMAT_ARG(result->exePath, "exe-path"), + FF_FORMAT_ARG(result->tty, "tty"), })); } } diff --git a/src/modules/sound/sound.c b/src/modules/sound/sound.c index 4fd66f942..3d24b2be6 100644 --- a/src/modules/sound/sound.c +++ b/src/modules/sound/sound.c @@ -52,11 +52,11 @@ static void printDevice(FFSoundOptions* options, const FFSoundDevice* device, ui ffPercentAppendBar(&percentageBar, device->volume, options->percent, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_SOUND_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_SOUND_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_BOOL, &device->main, "is-main"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &device->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &percentageNum, "volume-percentage"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &device->identifier, "identifier"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &percentageBar, "volume-percentage-bar"}, + FF_FORMAT_ARG(device->main, "is-main"), + FF_FORMAT_ARG(device->name, "name"), + FF_FORMAT_ARG(percentageNum, "volume-percentage"), + FF_FORMAT_ARG(device->identifier, "identifier"), + FF_FORMAT_ARG(percentageBar, "volume-percentage-bar"), })); } } diff --git a/src/modules/swap/swap.c b/src/modules/swap/swap.c index d3e981779..6666a9c6e 100644 --- a/src/modules/swap/swap.c +++ b/src/modules/swap/swap.c @@ -70,10 +70,10 @@ void ffPrintSwap(FFSwapOptions* options) FF_STRBUF_AUTO_DESTROY percentageBar = ffStrbufCreate(); ffPercentAppendBar(&percentageBar, percentage, options->percent, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_SWAP_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_SWAP_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty, "used"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty, "total"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &percentageNum, "percentage"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &percentageBar, "percentage-bar"}, + FF_FORMAT_ARG(usedPretty, "used"), + FF_FORMAT_ARG(totalPretty, "total"), + FF_FORMAT_ARG(percentageNum, "percentage"), + FF_FORMAT_ARG(percentageBar, "percentage-bar"), })); } } diff --git a/src/modules/terminal/terminal.c b/src/modules/terminal/terminal.c index 97f15fad4..85fd84af7 100644 --- a/src/modules/terminal/terminal.c +++ b/src/modules/terminal/terminal.c @@ -30,14 +30,14 @@ void ffPrintTerminal(FFTerminalOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_TERMINAL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_TERMINAL_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &result->processName, "process-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->exe, "exe"}, - {FF_FORMAT_ARG_TYPE_STRING, result->exeName, "exe-name"}, - {FF_FORMAT_ARG_TYPE_UINT, &result->pid, "pid"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->prettyName, "pretty-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->version, "version"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->exePath, "exe-path"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->tty, "tty"}, + FF_FORMAT_ARG(result->processName, "process-name"), + FF_FORMAT_ARG(result->exe, "exe"), + FF_FORMAT_ARG(result->exeName, "exe-name"), + FF_FORMAT_ARG(result->pid, "pid"), + FF_FORMAT_ARG(result->prettyName, "pretty-name"), + FF_FORMAT_ARG(result->version, "version"), + FF_FORMAT_ARG(result->exePath, "exe-path"), + FF_FORMAT_ARG(result->tty, "tty"), })); } } diff --git a/src/modules/terminalfont/terminalfont.c b/src/modules/terminalfont/terminalfont.c index 87e772c31..a686babe5 100644 --- a/src/modules/terminalfont/terminalfont.c +++ b/src/modules/terminalfont/terminalfont.c @@ -34,10 +34,10 @@ void ffPrintTerminalFont(FFTerminalFontOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_TERMINALFONT_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_TERMINALFONT_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &terminalFont.font.pretty, "combined"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &terminalFont.font.name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &terminalFont.font.size, "size"}, - {FF_FORMAT_ARG_TYPE_LIST, &terminalFont.font.styles, "styles"}, + FF_FORMAT_ARG(terminalFont.font.pretty, "combined"), + FF_FORMAT_ARG(terminalFont.font.name, "name"), + FF_FORMAT_ARG(terminalFont.font.size, "size"), + FF_FORMAT_ARG(terminalFont.font.styles, "styles"), })); } } diff --git a/src/modules/terminalsize/terminalsize.c b/src/modules/terminalsize/terminalsize.c index db2f2e479..71272281e 100644 --- a/src/modules/terminalsize/terminalsize.c +++ b/src/modules/terminalsize/terminalsize.c @@ -30,10 +30,10 @@ void ffPrintTerminalSize(FFTerminalSizeOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_TERMINALSIZE_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_TERMINALSIZE_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT16, &result.rows, "rows"}, - {FF_FORMAT_ARG_TYPE_UINT16, &result.columns, "columns"}, - {FF_FORMAT_ARG_TYPE_UINT16, &result.width, "width"}, - {FF_FORMAT_ARG_TYPE_UINT16, &result.height, "height"}, + FF_FORMAT_ARG(result.rows, "rows"), + FF_FORMAT_ARG(result.columns, "columns"), + FF_FORMAT_ARG(result.width, "width"), + FF_FORMAT_ARG(result.height, "height"), })); } } diff --git a/src/modules/terminaltheme/terminaltheme.c b/src/modules/terminaltheme/terminaltheme.c index ab0bde18f..93e702918 100644 --- a/src/modules/terminaltheme/terminaltheme.c +++ b/src/modules/terminaltheme/terminaltheme.c @@ -30,13 +30,15 @@ void ffPrintTerminalTheme(FFTerminalThemeOptions* options) else { char fg[32], bg[32]; + const char* fgType = result.fg.dark ? "Dark" : "Light"; + const char* bgType = result.bg.dark ? "Dark" : "Light"; snprintf(fg, sizeof(fg), "#%02" PRIX16 "%02" PRIX16 "%02" PRIX16, result.fg.r, result.fg.g, result.fg.b); snprintf(bg, sizeof(bg), "#%02" PRIX16 "%02" PRIX16 "%02" PRIX16, result.bg.r, result.bg.g, result.bg.b); FF_PRINT_FORMAT_CHECKED(FF_TERMINALTHEME_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_TERMINALTHEME_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRING, fg, "fg-color"}, - {FF_FORMAT_ARG_TYPE_STRING, result.fg.dark ? "Dark" : "Light", "fg-type"}, - {FF_FORMAT_ARG_TYPE_STRING, bg, "bg-color"}, - {FF_FORMAT_ARG_TYPE_STRING, result.bg.dark ? "Dark" : "Light", "bg-type"}, + FF_FORMAT_ARG(fg, "fg-color"), + FF_FORMAT_ARG(fgType, "fg-type"), + FF_FORMAT_ARG(bg, "bg-color"), + FF_FORMAT_ARG(bgType, "bg-type"), })); } } diff --git a/src/modules/theme/theme.c b/src/modules/theme/theme.c index 8e90df093..bef3c2594 100644 --- a/src/modules/theme/theme.c +++ b/src/modules/theme/theme.c @@ -36,8 +36,8 @@ void ffPrintTheme(FFThemeOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_THEME_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_THEME_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &result.theme1, "theme1"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result.theme2, "theme2"}, + FF_FORMAT_ARG(result.theme1, "theme1"), + FF_FORMAT_ARG(result.theme2, "theme2"), })); } diff --git a/src/modules/title/title.c b/src/modules/title/title.c index cf7c2fbff..bd363ce5a 100644 --- a/src/modules/title/title.c +++ b/src/modules/title/title.c @@ -57,14 +57,14 @@ void ffPrintTitle(FFTitleOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_TITLE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_TITLE_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.userName, "user-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &hostName, "host-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.homeDir, "home-dir"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.exePath, "exe-path"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.userShell, "user-shell"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &userNameColored, "user-name-colored"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &atColored, "at-symbol-colored"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &hostNameColored, "host-name-colored"}, + FF_FORMAT_ARG(instance.state.platform.userName, "user-name"), + FF_FORMAT_ARG(hostName, "host-name"), + FF_FORMAT_ARG(instance.state.platform.homeDir, "home-dir"), + FF_FORMAT_ARG(instance.state.platform.exePath, "exe-path"), + FF_FORMAT_ARG(instance.state.platform.userShell, "user-shell"), + FF_FORMAT_ARG(userNameColored, "user-name-colored"), + FF_FORMAT_ARG(atColored, "at-symbol-colored"), + FF_FORMAT_ARG(hostNameColored, "host-name-colored"), })); } } diff --git a/src/modules/uptime/uptime.c b/src/modules/uptime/uptime.c index 8c22320c4..caccc1f86 100644 --- a/src/modules/uptime/uptime.c +++ b/src/modules/uptime/uptime.c @@ -79,11 +79,11 @@ void ffPrintUptime(FFUptimeOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_UPTIME_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_UPTIME_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT, &days, "days"}, - {FF_FORMAT_ARG_TYPE_UINT, &hours, "hours"}, - {FF_FORMAT_ARG_TYPE_UINT, &minutes, "minutes"}, - {FF_FORMAT_ARG_TYPE_UINT, &seconds, "seconds"}, - {FF_FORMAT_ARG_TYPE_UINT, &milliseconds, "milliseconds"}, + FF_FORMAT_ARG(days, "days"), + FF_FORMAT_ARG(hours, "hours"), + FF_FORMAT_ARG(minutes, "minutes"), + FF_FORMAT_ARG(seconds, "seconds"), + FF_FORMAT_ARG(milliseconds, "milliseconds"), {FF_FORMAT_ARG_TYPE_STRING, ffTimeToShortStr(result.bootTime), "boot-time"}, })); } diff --git a/src/modules/users/users.c b/src/modules/users/users.c index adbef14e4..3c7db48e0 100644 --- a/src/modules/users/users.c +++ b/src/modules/users/users.c @@ -69,10 +69,10 @@ void ffPrintUsers(FFUsersOptions* options) FFUserResult* user = (FFUserResult*)ffListGet(&users, i); FF_PRINT_FORMAT_CHECKED(FF_USERS_MODULE_NAME, users.length == 1 ? 0 : (uint8_t) (i + 1), &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_USERS_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &user->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &user->hostName, "host-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &user->sessionName, "session-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &user->clientIp, "client-ip"}, + FF_FORMAT_ARG(user->name, "name"), + FF_FORMAT_ARG(user->hostName, "host-name"), + FF_FORMAT_ARG(user->sessionName, "session-name"), + FF_FORMAT_ARG(user->clientIp, "client-ip"), {FF_FORMAT_ARG_TYPE_STRING, ffTimeToShortStr(user->loginTime), "login-time"}, })); } diff --git a/src/modules/version/version.c b/src/modules/version/version.c index f3df9f399..73b5e7dde 100644 --- a/src/modules/version/version.c +++ b/src/modules/version/version.c @@ -30,17 +30,18 @@ void ffPrintVersion(FFVersionOptions* options) } } + const char* buildType = result->debugMode ? "debug" : "release"; FF_PRINT_FORMAT_CHECKED(FF_VERSION_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_VERSION_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRING, result->projectName, "project-name"}, - {FF_FORMAT_ARG_TYPE_STRING, result->version, "version"}, - {FF_FORMAT_ARG_TYPE_STRING, result->versionTweak, "version-tweak"}, - {FF_FORMAT_ARG_TYPE_STRING, result->debugMode ? "debug" : "release", "build-type"}, - {FF_FORMAT_ARG_TYPE_STRING, result->sysName, "sysname"}, - {FF_FORMAT_ARG_TYPE_STRING, result->architecture, "arch"}, - {FF_FORMAT_ARG_TYPE_STRING, result->cmakeBuiltType, "cmake-built-type"}, - {FF_FORMAT_ARG_TYPE_STRING, result->compileTime, "compile-time"}, - {FF_FORMAT_ARG_TYPE_STRING, result->compiler, "compiler"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &buf, "libc-used"}, + FF_FORMAT_ARG(result->projectName, "project-name"), + FF_FORMAT_ARG(result->version, "version"), + FF_FORMAT_ARG(result->versionTweak, "version-tweak"), + FF_FORMAT_ARG(buildType, "build-type"), + FF_FORMAT_ARG(result->sysName, "sysname"), + FF_FORMAT_ARG(result->architecture, "arch"), + FF_FORMAT_ARG(result->cmakeBuiltType, "cmake-built-type"), + FF_FORMAT_ARG(result->compileTime, "compile-time"), + FF_FORMAT_ARG(result->compiler, "compiler"), + FF_FORMAT_ARG(buf, "libc-used"), })); } } diff --git a/src/modules/vulkan/vulkan.c b/src/modules/vulkan/vulkan.c index 76e2bba26..dbafd7ef8 100644 --- a/src/modules/vulkan/vulkan.c +++ b/src/modules/vulkan/vulkan.c @@ -44,10 +44,10 @@ void ffPrintVulkan(FFVulkanOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_VULKAN_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_VULKAN_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &vulkan->driver, "driver"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &vulkan->apiVersion, "api-version"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &vulkan->conformanceVersion, "conformance-version"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &vulkan->instanceVersion, "instance-version"}, + FF_FORMAT_ARG(vulkan->driver, "driver"), + FF_FORMAT_ARG(vulkan->apiVersion, "api-version"), + FF_FORMAT_ARG(vulkan->conformanceVersion, "conformance-version"), + FF_FORMAT_ARG(vulkan->instanceVersion, "instance-version"), })); } } diff --git a/src/modules/wallpaper/wallpaper.c b/src/modules/wallpaper/wallpaper.c index 4461c63c7..901cdd12e 100644 --- a/src/modules/wallpaper/wallpaper.c +++ b/src/modules/wallpaper/wallpaper.c @@ -36,8 +36,8 @@ void ffPrintWallpaper(FFWallpaperOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_WALLPAPER_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_WALLPAPER_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRING, filename, "file-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &fullpath, "full-path"}, + FF_FORMAT_ARG(filename, "file-name"), + FF_FORMAT_ARG(fullpath, "full-path"), })); } } diff --git a/src/modules/weather/weather.c b/src/modules/weather/weather.c index 14bb669a2..c46ea3899 100644 --- a/src/modules/weather/weather.c +++ b/src/modules/weather/weather.c @@ -26,7 +26,7 @@ void ffPrintWeather(FFWeatherOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_WEATHER_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_WEATHER_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &result, "result"}, + FF_FORMAT_ARG(result, "result"), })); } } diff --git a/src/modules/wifi/wifi.c b/src/modules/wifi/wifi.c index 2f4b34845..ace8340a1 100644 --- a/src/modules/wifi/wifi.c +++ b/src/modules/wifi/wifi.c @@ -81,17 +81,17 @@ void ffPrintWifi(FFWifiOptions* options) FF_STRBUF_AUTO_DESTROY percentBar = ffStrbufCreate(); ffPercentAppendBar(&percentBar, item->conn.signalQuality, options->percent, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_WIFI_MODULE_NAME, moduleIndex, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_WIFI_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &item->inf.description, "inf-desc"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &item->inf.status, "inf-status"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &item->conn.status, "status"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &item->conn.ssid, "ssid"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &item->conn.bssid, "bssid"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &item->conn.protocol, "protocol"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &percentNum, "signal-quality"}, - {FF_FORMAT_ARG_TYPE_DOUBLE, &item->conn.rxRate, "rx-rate"}, - {FF_FORMAT_ARG_TYPE_DOUBLE, &item->conn.txRate, "tx-rate"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &item->conn.security, "security"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &percentBar, "signal-quality-bar"}, + FF_FORMAT_ARG(item->inf.description, "inf-desc"), + FF_FORMAT_ARG(item->inf.status, "inf-status"), + FF_FORMAT_ARG(item->conn.status, "status"), + FF_FORMAT_ARG(item->conn.ssid, "ssid"), + FF_FORMAT_ARG(item->conn.bssid, "bssid"), + FF_FORMAT_ARG(item->conn.protocol, "protocol"), + FF_FORMAT_ARG(percentNum, "signal-quality"), + FF_FORMAT_ARG(item->conn.rxRate, "rx-rate"), + FF_FORMAT_ARG(item->conn.txRate, "tx-rate"), + FF_FORMAT_ARG(item->conn.security, "security"), + FF_FORMAT_ARG(percentBar, "signal-quality-bar"), })); } diff --git a/src/modules/wm/wm.c b/src/modules/wm/wm.c index 849053367..97dba1941 100644 --- a/src/modules/wm/wm.c +++ b/src/modules/wm/wm.c @@ -46,10 +46,10 @@ void ffPrintWM(FFWMOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_WM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_WM_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &result->wmProcessName, "process-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->wmPrettyName, "pretty-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->wmProtocolName, "protocol-name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &pluginName, "plugin-name"}, + FF_FORMAT_ARG(result->wmProcessName, "process-name"), + FF_FORMAT_ARG(result->wmPrettyName, "pretty-name"), + FF_FORMAT_ARG(result->wmProtocolName, "protocol-name"), + FF_FORMAT_ARG(pluginName, "plugin-name"), })); } } diff --git a/src/modules/wmtheme/wmtheme.c b/src/modules/wmtheme/wmtheme.c index 5234f2b14..6f81c89ad 100644 --- a/src/modules/wmtheme/wmtheme.c +++ b/src/modules/wmtheme/wmtheme.c @@ -20,7 +20,7 @@ void ffPrintWMTheme(FFWMThemeOptions* options) else { FF_PRINT_FORMAT_CHECKED(FF_WMTHEME_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_WMTHEME_NUM_FORMAT_ARGS, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_STRBUF, &themeOrError, "result"}, + FF_FORMAT_ARG(themeOrError, "result"), })); } } diff --git a/src/modules/zpool/zpool.c b/src/modules/zpool/zpool.c index 6a9b8780f..66a59f291 100644 --- a/src/modules/zpool/zpool.c +++ b/src/modules/zpool/zpool.c @@ -20,9 +20,10 @@ static void printZpool(FFZpoolOptions* options, FFZpoolResult* result, uint8_t i else { ffStrbufClear(&buffer); - FF_PARSE_FORMAT_STRING_CHECKED(&buffer, &options->moduleArgs.key, 2, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT8, &index, "index"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->name, "name"}, + FF_PARSE_FORMAT_STRING_CHECKED(&buffer, &options->moduleArgs.key, 3, ((FFformatarg[]){ + FF_FORMAT_ARG(index, "index"), + FF_FORMAT_ARG(result->name, "name"), + FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"), })); } @@ -60,14 +61,14 @@ static void printZpool(FFZpoolOptions* options, FFZpoolResult* result, uint8_t i ffPercentAppendBar(&fragPercentageBar, fragPercentage, options->percent, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(buffer.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_ZPOOL_NUM_FORMAT_ARGS, ((FFformatarg[]) { - {FF_FORMAT_ARG_TYPE_STRBUF, &result->name, "name"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &result->state, "state"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty, "size-used"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty, "size-total"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &bytesPercentageNum, "size-percentage"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &fragPercentage, "frag-percentage"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &bytesPercentageBar, "size-percentage-bar"}, - {FF_FORMAT_ARG_TYPE_STRBUF, &fragPercentageBar, "frag-percentage-bar"}, + FF_FORMAT_ARG(result->name, "name"), + FF_FORMAT_ARG(result->state, "state"), + FF_FORMAT_ARG(usedPretty, "size-used"), + FF_FORMAT_ARG(totalPretty, "size-total"), + FF_FORMAT_ARG(bytesPercentageNum, "size-percentage"), + FF_FORMAT_ARG(fragPercentage, "frag-percentage"), + FF_FORMAT_ARG(bytesPercentageBar, "size-percentage-bar"), + FF_FORMAT_ARG(fragPercentageBar, "frag-percentage-bar"), })); } }