From 938773d9cc062fd028f6560b1127a2ecd23f61c3 Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Tue, 27 Jan 2026 01:22:42 +0000 Subject: Fixed constant hex/oct bug + Fixed some of the examples (work in progress) + added bootloader example (I will add some docs) --- src/constants.h | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/constants.h') diff --git a/src/constants.h b/src/constants.h index a867bf3..5162f9f 100644 --- a/src/constants.h +++ b/src/constants.h @@ -3,21 +3,22 @@ #define ZEN_CONSTANTS_H // Buffer sizes -// Buffer sizes -#define MAX_TYPE_NAME_LEN 256 ///< Max length for type name strings. -#define MAX_FUNC_NAME_LEN 512 ///< Max length for function names. -#define MAX_ERROR_MSG_LEN 1024 ///< Max length for error messages. -#define MAX_MANGLED_NAME_LEN 512 ///< Max length for mangled names (generics). -#define MAX_PATH_LEN 4096 ///< Max length for file paths. +#define MAX_TYPE_NAME_LEN 256 ///< Max length for type name strings. +#define MAX_FUNC_NAME_LEN 512 ///< Max length for function names. +#define MAX_ERROR_MSG_LEN 1024 ///< Max length for error messages. +#define MAX_MANGLED_NAME_LEN 512 ///< Max length for mangled names (generics). +#define MAX_PATH_LEN 4096 ///< Max length for file paths. // Type checking helpers -#define IS_INT_TYPE(t) ((t) && strcmp((t), "int") == 0) ///< Checks if type is "int". -#define IS_BOOL_TYPE(t) ((t) && strcmp((t), "bool") == 0) ///< Checks if type is "bool". -#define IS_CHAR_TYPE(t) ((t) && strcmp((t), "char") == 0) ///< Checks if type is "char". -#define IS_VOID_TYPE(t) ((t) && strcmp((t), "void") == 0) ///< Checks if type is "void". -#define IS_FLOAT_TYPE(t) ((t) && strcmp((t), "float") == 0) ///< Checks if type is "float". -#define IS_DOUBLE_TYPE(t) ((t) && strcmp((t), "double") == 0)///< Checks if type is "double". -#define IS_USIZE_TYPE(t) ((t) && (strcmp((t), "usize") == 0 || strcmp((t), "size_t") == 0)) ///< Checks if type is "usize" or "size_t". +#define IS_INT_TYPE(t) ((t) && strcmp((t), "int") == 0) ///< Checks if type is "int". +#define IS_BOOL_TYPE(t) ((t) && strcmp((t), "bool") == 0) ///< Checks if type is "bool". +#define IS_CHAR_TYPE(t) ((t) && strcmp((t), "char") == 0) ///< Checks if type is "char". +#define IS_VOID_TYPE(t) ((t) && strcmp((t), "void") == 0) ///< Checks if type is "void". +#define IS_FLOAT_TYPE(t) ((t) && strcmp((t), "float") == 0) ///< Checks if type is "float". +#define IS_DOUBLE_TYPE(t) ((t) && strcmp((t), "double") == 0) ///< Checks if type is "double". +#define IS_USIZE_TYPE(t) \ + ((t) && (strcmp((t), "usize") == 0 || \ + strcmp((t), "size_t") == 0)) ///< Checks if type is "usize" or "size_t". /** * @brief Checks if type is a string type ("string", "char*", "const char*"). */ @@ -44,8 +45,10 @@ #define IS_PTR_TYPE(t) ((t) && strchr((t), '*') != NULL) ///< Checks if type string contains '*'. // Struct prefix check -#define IS_STRUCT_PREFIX(t) ((t) && strncmp((t), "struct ", 7) == 0) ///< Checks if type starts with "struct ". -#define STRIP_STRUCT_PREFIX(t) (IS_STRUCT_PREFIX(t) ? ((t) + 7) : (t)) ///< Returns ptr to name after "struct " prefix. +#define IS_STRUCT_PREFIX(t) \ + ((t) && strncmp((t), "struct ", 7) == 0) ///< Checks if type starts with "struct ". +#define STRIP_STRUCT_PREFIX(t) \ + (IS_STRUCT_PREFIX(t) ? ((t) + 7) : (t)) ///< Returns ptr to name after "struct " prefix. // Generic type checks #define IS_OPTION_TYPE(t) ((t) && strncmp((t), "Option_", 7) == 0) ///< Checks if type is Option. -- cgit v1.2.3