From 5d463a7f4c721629a1996be6d19634338290a539 Mon Sep 17 00:00:00 2001 From: Mosder Date: Wed, 22 Jul 2026 01:16:45 +0200 Subject: refactor: generalized parser structs with offsetof and put them into separate files --- analyzer/utils/roman.h | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'analyzer/utils/roman.h') diff --git a/analyzer/utils/roman.h b/analyzer/utils/roman.h index b4f5d3f..cebd16e 100644 --- a/analyzer/utils/roman.h +++ b/analyzer/utils/roman.h @@ -1,9 +1,26 @@ // utils/roman.h // functions for roman numbers -#define ROMAN_CHAR_COUNT 13 -#define ROMAN_NUMS {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1} -#define ROMAN_CHARS {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"} +typedef struct { + int num; + char *symbol; +} RomanSymbol; + +static const RomanSymbol roman_symbols[] = { + {1000, "M"}, + {900, "CM"}, + {500, "D"}, + {400, "CD"}, + {100, "C"}, + {90, "XC"}, + {50, "L"}, + {40, "XL"}, + {10, "X"}, + {9, "IX"}, + {5, "V"}, + {4, "IV"}, + {1, "I"}, +}; // convert a arabic number to roman number // params: -- cgit v1.2.3