[v0.99] Small refactoring

This commit is contained in:
Dr-Noob
2021-08-19 13:35:40 +02:00
parent 137b51fc99
commit d8fe4f5a6b
2 changed files with 72 additions and 72 deletions

View File

@@ -37,33 +37,33 @@ struct args_struct {
};
const char args_chr[] = {
/* [ARG_CHAR_STYLE] = */ 's',
/* [ARG_CHAR_COLOR] = */ 'c',
/* [ARG_CHAR_HELP] = */ 'h',
/* [ARG_CHAR_RAW] = */ 'r',
/* [ARG_CHAR_FULLCPUNAME] = */ 'F',
/* [ARG_CHAR_LOGO_LONG] = */ 1,
/* [ARG_CHAR_LOGO_SHORT] = */ 2,
/* [ARG_CHAR_LOGO_INTEL_NEW] = */ 3,
/* [ARG_CHAR_LOGO_INTEL_OLD] = */ 4,
/* [ARG_CHAR_DEBUG] = */ 'd',
/* [ARG_CHAR_VERBOSE] = */ 'v',
/* [ARG_CHAR_VERSION] = */ 'V',
/* [ARG_STYLE] = */ 's',
/* [ARG_COLOR] = */ 'c',
/* [ARG_HELP] = */ 'h',
/* [ARG_RAW] = */ 'r',
/* [ARG_FULLCPUNAME] = */ 'F',
/* [ARG_LOGO_LONG] = */ 1,
/* [ARG_LOGO_SHORT] = */ 2,
/* [ARG_LOGO_INTEL_NEW] = */ 3,
/* [ARG_LOGO_INTEL_OLD] = */ 4,
/* [ARG_DEBUG] = */ 'd',
/* [ARG_VERBOSE] = */ 'v',
/* [ARG_VERSION] = */ 'V',
};
const char *args_str[] = {
/* [ARG_CHAR_STYLE] = */ "style",
/* [ARG_CHAR_COLOR] = */ "color",
/* [ARG_CHAR_HELP] = */ "help",
/* [ARG_CHAR_RAW] = */ "raw",
/* [ARG_CHAR_FULLCPUNAME] = */ "full-cpu-name",
/* [ARG_CHAR_LOGO_LONG] = */ "logo-long",
/* [ARG_CHAR_LOGO_SHORT] = */ "logo-short",
/* [ARG_CHAR_LOGO_INTEL_NEW] = */ "logo-intel-new",
/* [ARG_CHAR_LOGO_INTEL_OLD] = */ "logo-intel-old",
/* [ARG_CHAR_DEBUG] = */ "debug",
/* [ARG_CHAR_VERBOSE] = */ "verbose",
/* [ARG_CHAR_VERSION] = */ "version",
/* [ARG_STYLE] = */ "style",
/* [ARG_COLOR] = */ "color",
/* [ARG_HELP] = */ "help",
/* [ARG_RAW] = */ "raw",
/* [ARG_FULLCPUNAME] = */ "full-cpu-name",
/* [ARG_LOGO_LONG] = */ "logo-long",
/* [ARG_LOGO_SHORT] = */ "logo-short",
/* [ARG_LOGO_INTEL_NEW] = */ "logo-intel-new",
/* [ARG_LOGO_INTEL_OLD] = */ "logo-intel-old",
/* [ARG_DEBUG] = */ "debug",
/* [ARG_VERBOSE] = */ "verbose",
/* [ARG_VERSION] = */ "version",
};
static struct args_struct args;

View File

@@ -1,32 +1,32 @@
#ifndef __ASCII__
#define __ASCII__
#define COLOR_NONE ""
#define COLOR_FG_BLACK "\x1b[30;1m"
#define COLOR_FG_RED "\x1b[31;1m"
#define COLOR_FG_GREEN "\x1b[32;1m"
#define COLOR_FG_YELLOW "\x1b[33;1m"
#define COLOR_FG_BLUE "\x1b[34;1m"
#define COLOR_FG_MAGENTA "\x1b[35;1m"
#define COLOR_FG_CYAN "\x1b[36;1m"
#define COLOR_FG_WHITE "\x1b[37;1m"
#define COLOR_BG_BLACK "\x1b[40;1m"
#define COLOR_BG_RED "\x1b[41;1m"
#define COLOR_BG_GREEN "\x1b[42;1m"
#define COLOR_BG_YELLOW "\x1b[43;1m"
#define COLOR_BG_BLUE "\x1b[44;1m"
#define COLOR_BG_MAGENTA "\x1b[45;1m"
#define COLOR_BG_CYAN "\x1b[46;1m"
#define COLOR_BG_WHITE "\x1b[47;1m"
#define COLOR_FG_B_BLACK "\x1b[90;1m"
#define COLOR_FG_B_RED "\x1b[91;1m"
#define COLOR_FG_B_GREEN "\x1b[92;1m"
#define COLOR_FG_B_YELLOW "\x1b[93;1m"
#define COLOR_FG_B_BLUE "\x1b[94;1m"
#define COLOR_FG_B_MAGENTA "\x1b[95;1m"
#define COLOR_FG_B_CYAN "\x1b[96;1m"
#define COLOR_FG_B_WHITE "\x1b[97;1m"
#define COLOR_RESET "\x1b[m"
#define C_NONE ""
#define C_FG_BLACK "\x1b[30;1m"
#define C_FG_RED "\x1b[31;1m"
#define C_FG_GREEN "\x1b[32;1m"
#define C_FG_YELLOW "\x1b[33;1m"
#define C_FG_BLUE "\x1b[34;1m"
#define C_FG_MAGENTA "\x1b[35;1m"
#define C_FG_CYAN "\x1b[36;1m"
#define C_FG_WHITE "\x1b[37;1m"
#define C_BG_BLACK "\x1b[40;1m"
#define C_BG_RED "\x1b[41;1m"
#define C_BG_GREEN "\x1b[42;1m"
#define C_BG_YELLOW "\x1b[43;1m"
#define C_BG_BLUE "\x1b[44;1m"
#define C_BG_MAGENTA "\x1b[45;1m"
#define C_BG_CYAN "\x1b[46;1m"
#define C_BG_WHITE "\x1b[47;1m"
#define C_FG_B_BLACK "\x1b[90;1m"
#define C_FG_B_RED "\x1b[91;1m"
#define C_FG_B_GREEN "\x1b[92;1m"
#define C_FG_B_YELLOW "\x1b[93;1m"
#define C_FG_B_BLUE "\x1b[94;1m"
#define C_FG_B_MAGENTA "\x1b[95;1m"
#define C_FG_B_CYAN "\x1b[96;1m"
#define C_FG_B_WHITE "\x1b[97;1m"
#define C_RESET "\x1b[m"
struct ascii_logo {
char* art;
@@ -47,7 +47,7 @@ struct ascii_logo {
*
* Logos with replace_blocks=true are replaced by character
* blocks (actually, spaces with background color), so
* the color in the structure must be COLOR_BG_XXX. When
* the color in the structure must be C_BG_XXX. When
* replace_blocks is true, the characters '#' are replaced
* by spaces printed with color_ascii[0], and '@' are
* printed with color_ascii[1]. If replace_blocks=true,
@@ -304,26 +304,26 @@ $C1 ############ ################ ######### ## ######### "
typedef struct ascii_logo asciiL;
// -------------------------------------------------------------------------------------------------------------
// | LOGO | W | H | REPLACE | COLORS LOGO (>0 && <10) | COLORS TEXT (=2) |
// -------------------------------------------------------------------------------------------------------------
asciiL logo_amd = { ASCII_AMD, 39, 15, false, {COLOR_FG_WHITE, COLOR_FG_GREEN}, {COLOR_FG_WHITE, COLOR_FG_GREEN} };
asciiL logo_intel = { ASCII_INTEL, 48, 14, false, {COLOR_FG_CYAN}, {COLOR_FG_CYAN, COLOR_FG_WHITE} };
asciiL logo_intel_new = { ASCII_INTEL_NEW, 51, 9, false, {COLOR_FG_CYAN}, {COLOR_FG_CYAN, COLOR_FG_WHITE} };
asciiL logo_snapd = { ASCII_SNAPD, 39, 16, false, {COLOR_FG_RED, COLOR_FG_WHITE}, {COLOR_FG_RED, COLOR_FG_WHITE} };
asciiL logo_mtk = { ASCII_MTK, 59, 5, false, {COLOR_FG_BLUE, COLOR_FG_YELLOW}, {COLOR_FG_BLUE, COLOR_FG_YELLOW} };
asciiL logo_exynos = { ASCII_EXYNOS, 22, 13, true, {COLOR_BG_BLUE, COLOR_FG_WHITE}, {COLOR_FG_BLUE, COLOR_FG_WHITE} };
asciiL logo_kirin = { ASCII_KIRIN, 53, 12, false, {COLOR_FG_RED}, {COLOR_FG_WHITE, COLOR_FG_RED} };
asciiL logo_broadcom = { ASCII_BROADCOM, 44, 19, false, {COLOR_FG_WHITE, COLOR_FG_RED}, {COLOR_FG_WHITE, COLOR_FG_RED} };
asciiL logo_arm = { ASCII_ARM, 42, 5, false, {COLOR_FG_CYAN}, {COLOR_FG_WHITE, COLOR_FG_CYAN} };
asciiL logo_ibm = { ASCII_IBM, 42, 9, false, {COLOR_FG_CYAN, COLOR_FG_WHITE}, {COLOR_FG_CYAN, COLOR_FG_WHITE} };
asciiL logo_apple = { ASCII_APPLE, 32, 17, false, {COLOR_FG_WHITE}, {COLOR_FG_B_BLACK, COLOR_FG_B_WHITE} };
// Long variants | ----------------------------------------------------------------------------------------------------------|
asciiL logo_amd_l = { ASCII_AMD_L, 62, 19, true, {COLOR_BG_WHITE, COLOR_BG_GREEN}, {COLOR_FG_WHITE, COLOR_FG_GREEN} };
asciiL logo_intel_l = { ASCII_INTEL_L, 62, 19, true, {COLOR_BG_CYAN, COLOR_BG_WHITE}, {COLOR_FG_CYAN, COLOR_FG_WHITE} };
asciiL logo_intel_l_new = { ASCII_INTEL_L_NEW, 57, 14, true, {COLOR_BG_CYAN, COLOR_BG_WHITE, COLOR_BG_BLUE}, {COLOR_FG_CYAN, COLOR_FG_WHITE} };
asciiL logo_arm_l = { ASCII_ARM_L, 60, 8, true, {COLOR_BG_CYAN}, {COLOR_FG_WHITE, COLOR_FG_CYAN} };
asciiL logo_ibm_l = { ASCII_IBM_L, 62, 13, true, {COLOR_BG_CYAN, COLOR_FG_WHITE}, {COLOR_FG_CYAN, COLOR_FG_WHITE} };
asciiL logo_unknown = { NULL, 0, 0, false, {COLOR_NONE}, {COLOR_NONE, COLOR_NONE} };
// ------------------------------------------------------------------------------------------------------+
// | LOGO | W | H | REPLACE | COLORS LOGO (>0 && <10) | COLORS TEXT (=2) |
// ------------------------------------------------------------------------------------------------------+
asciiL logo_amd = { ASCII_AMD, 39, 15, false, {C_FG_WHITE, C_FG_GREEN}, {C_FG_WHITE, C_FG_GREEN} };
asciiL logo_intel = { ASCII_INTEL, 48, 14, false, {C_FG_CYAN}, {C_FG_CYAN, C_FG_WHITE} };
asciiL logo_intel_new = { ASCII_INTEL_NEW, 51, 9, false, {C_FG_CYAN}, {C_FG_CYAN, C_FG_WHITE} };
asciiL logo_snapd = { ASCII_SNAPD, 39, 16, false, {C_FG_RED, C_FG_WHITE}, {C_FG_RED, C_FG_WHITE} };
asciiL logo_mtk = { ASCII_MTK, 59, 5, false, {C_FG_BLUE, C_FG_YELLOW}, {C_FG_BLUE, C_FG_YELLOW} };
asciiL logo_exynos = { ASCII_EXYNOS, 22, 13, true, {C_BG_BLUE, C_FG_WHITE}, {C_FG_BLUE, C_FG_WHITE} };
asciiL logo_kirin = { ASCII_KIRIN, 53, 12, false, {C_FG_RED}, {C_FG_WHITE, C_FG_RED} };
asciiL logo_broadcom = { ASCII_BROADCOM, 44, 19, false, {C_FG_WHITE, C_FG_RED}, {C_FG_WHITE, C_FG_RED} };
asciiL logo_arm = { ASCII_ARM, 42, 5, false, {C_FG_CYAN}, {C_FG_WHITE, C_FG_CYAN} };
asciiL logo_ibm = { ASCII_IBM, 42, 9, false, {C_FG_CYAN, C_FG_WHITE}, {C_FG_CYAN, C_FG_WHITE} };
asciiL logo_apple = { ASCII_APPLE, 32, 17, false, {C_FG_WHITE}, {C_FG_B_BLACK, C_FG_B_WHITE} };
// Long variants | ----------------------------------------------------------------------------------------------------|
asciiL logo_amd_l = { ASCII_AMD_L, 62, 19, true, {C_BG_WHITE, C_BG_GREEN}, {C_FG_WHITE, C_FG_GREEN} };
asciiL logo_intel_l = { ASCII_INTEL_L, 62, 19, true, {C_BG_CYAN, C_BG_WHITE}, {C_FG_CYAN, C_FG_WHITE} };
asciiL logo_intel_l_new = { ASCII_INTEL_L_NEW, 57, 14, true, {C_BG_CYAN, C_BG_WHITE, C_BG_BLUE}, {C_FG_CYAN, C_FG_WHITE} };
asciiL logo_arm_l = { ASCII_ARM_L, 60, 8, true, {C_BG_CYAN}, {C_FG_WHITE, C_FG_CYAN} };
asciiL logo_ibm_l = { ASCII_IBM_L, 62, 13, true, {C_BG_CYAN, C_FG_WHITE}, {C_FG_CYAN, C_FG_WHITE} };
asciiL logo_unknown = { NULL, 0, 0, false, {C_NONE}, {C_NONE, C_NONE} };
#endif