2022-07-25 13:15:01 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "fastfetch.h"
|
2022-07-25 14:26:08 +02:00
|
|
|
#include "common/format.h"
|
2022-07-25 13:15:01 +02:00
|
|
|
|
2023-08-15 21:40:22 +08:00
|
|
|
typedef enum FFPrintType {
|
|
|
|
|
FF_PRINT_TYPE_DEFAULT = 0,
|
2024-06-27 17:49:30 +08:00
|
|
|
FF_PRINT_TYPE_NO_CUSTOM_KEY = 1 << 0, // key has been formatted outside
|
2023-08-15 21:40:22 +08:00
|
|
|
FF_PRINT_TYPE_NO_CUSTOM_KEY_COLOR = 1 << 1,
|
|
|
|
|
FF_PRINT_TYPE_NO_CUSTOM_KEY_WIDTH = 1 << 2,
|
|
|
|
|
FF_PRINT_TYPE_NO_CUSTOM_OUTPUT_FORMAT = 1 << 3, // reserved
|
|
|
|
|
} FFPrintType;
|
|
|
|
|
|
|
|
|
|
void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType);
|
2024-03-07 10:47:28 +08:00
|
|
|
void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments);
|
|
|
|
|
#define FF_PRINT_FORMAT_CHECKED(moduleName, moduleIndex, moduleArgs, printType, numArgs, arguments) do {\
|
2024-10-18 16:15:48 +08:00
|
|
|
static_assert(sizeof(arguments) / sizeof(*arguments) == (numArgs), "Invalid number of format arguments");\
|
2024-03-07 10:47:28 +08:00
|
|
|
ffPrintFormat((moduleName), (moduleIndex), (moduleArgs), (printType), (numArgs), (arguments));\
|
|
|
|
|
} while (0)
|
2024-03-07 11:10:18 +08:00
|
|
|
FF_C_PRINTF(5, 6) void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...);
|
2022-07-25 13:15:01 +02:00
|
|
|
void ffPrintColor(const FFstrbuf* colorValue);
|
|
|
|
|
void ffPrintCharTimes(char c, uint32_t times);
|
|
|
|
|
|
2023-10-07 13:40:40 +08:00
|
|
|
void ffPrintModuleFormatHelp(const char* name, const char* def, uint32_t numArgs, const char* args[]);
|
2024-03-07 10:47:28 +08:00
|
|
|
#define FF_PRINT_MODULE_FORMAT_HELP_CHECKED(moduleName, def, numArgs, args) do {\
|
2024-10-18 16:15:48 +08:00
|
|
|
static_assert(sizeof(args) / sizeof(*args) == (numArgs), "Invalid number of format arguments");\
|
2024-03-07 10:47:28 +08:00
|
|
|
ffPrintModuleFormatHelp((moduleName), (def), (numArgs), (args));\
|
|
|
|
|
} while (0)
|