Zen-C
Loading...
Searching...
No Matches
constants.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#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 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)
 Checks if type is "usize" or "size_t"./*#end#*‍/.
 
#define IS_STRING_TYPE(t)
 Checks if type is a string type ("string", "char*", "const char*").
 
#define IS_BASIC_TYPE(t)
 Checks if type is a basic primitive type.
 
#define IS_NUMERIC_TYPE(t)    ((t) && (IS_INT_TYPE(t) || IS_FLOAT_TYPE(t) || IS_DOUBLE_TYPE(t) || IS_USIZE_TYPE(t)))
 Checks if type is numeric (int, float, double, usize).
 
#define IS_PTR_TYPE(t)   ((t) && strchr((t), '*') != NULL)
 Checks if type string contains '*'.
 
#define IS_STRUCT_PREFIX(t)    ((t) && strncmp((t), "struct ", 7) == 0)
 Checks if type starts with "struct "./*#end#*‍/.
 
#define STRIP_STRUCT_PREFIX(t)    (IS_STRUCT_PREFIX(t) ? ((t) + 7) : (t))
 Returns ptr to name after "struct " prefix./*#end#*‍/.
 
#define IS_OPTION_TYPE(t)   ((t) && strncmp((t), "Option_", 7) == 0)
 Checks if type is Option<T>.
 
#define IS_RESULT_TYPE(t)   ((t) && strncmp((t), "Result_", 7) == 0)
 Checks if type is Result<T>.
 
#define IS_VEC_TYPE(t)   ((t) && strncmp((t), "Vec_", 4) == 0)
 Checks if type is Vec<T>.
 
#define IS_SLICE_TYPE(t)   ((t) && strncmp((t), "Slice_", 6) == 0)
 Checks if type is Slice<T>.
 

Macro Definition Documentation

◆ IS_BASIC_TYPE

#define IS_BASIC_TYPE (   t)
Value:
((t) && (IS_INT_TYPE(t) || IS_BOOL_TYPE(t) || IS_CHAR_TYPE(t) || IS_VOID_TYPE(t) || \
IS_FLOAT_TYPE(t) || IS_DOUBLE_TYPE(t) || IS_USIZE_TYPE(t) || \
strcmp((t), "ssize_t") == 0 || strcmp((t), "__auto_type") == 0))
#define IS_BOOL_TYPE(t)
Checks if type is "bool".
Definition constants.h:14
#define IS_VOID_TYPE(t)
Checks if type is "void".
Definition constants.h:16
#define IS_DOUBLE_TYPE(t)
Checks if type is "double".
Definition constants.h:18
#define IS_INT_TYPE(t)
Checks if type is "int".
Definition constants.h:13
#define IS_CHAR_TYPE(t)
Checks if type is "char".
Definition constants.h:15
#define IS_USIZE_TYPE(t)
Checks if type is "usize" or "size_t"./*#end#*‍/.
Definition constants.h:19

Checks if type is a basic primitive type.

◆ IS_BOOL_TYPE

#define IS_BOOL_TYPE (   t)    ((t) && strcmp((t), "bool") == 0)

Checks if type is "bool".

◆ IS_CHAR_TYPE

#define IS_CHAR_TYPE (   t)    ((t) && strcmp((t), "char") == 0)

Checks if type is "char".

◆ IS_DOUBLE_TYPE

#define IS_DOUBLE_TYPE (   t)    ((t) && strcmp((t), "double") == 0)

Checks if type is "double".

◆ IS_FLOAT_TYPE

#define IS_FLOAT_TYPE (   t)    ((t) && strcmp((t), "float") == 0)

Checks if type is "float".

◆ IS_INT_TYPE

#define IS_INT_TYPE (   t)    ((t) && strcmp((t), "int") == 0)

Checks if type is "int".

◆ IS_NUMERIC_TYPE

#define IS_NUMERIC_TYPE (   t)     ((t) && (IS_INT_TYPE(t) || IS_FLOAT_TYPE(t) || IS_DOUBLE_TYPE(t) || IS_USIZE_TYPE(t)))

Checks if type is numeric (int, float, double, usize).

◆ IS_OPTION_TYPE

#define IS_OPTION_TYPE (   t)    ((t) && strncmp((t), "Option_", 7) == 0)

Checks if type is Option<T>.

◆ IS_PTR_TYPE

#define IS_PTR_TYPE (   t)    ((t) && strchr((t), '*') != NULL)

Checks if type string contains '*'.

◆ IS_RESULT_TYPE

#define IS_RESULT_TYPE (   t)    ((t) && strncmp((t), "Result_", 7) == 0)

Checks if type is Result<T>.

◆ IS_SLICE_TYPE

#define IS_SLICE_TYPE (   t)    ((t) && strncmp((t), "Slice_", 6) == 0)

Checks if type is Slice<T>.

◆ IS_STRING_TYPE

#define IS_STRING_TYPE (   t)
Value:
((t) && \
(strcmp((t), "string") == 0 || strcmp((t), "char*") == 0 || strcmp((t), "const char*") == 0))

Checks if type is a string type ("string", "char*", "const char*").

◆ IS_STRUCT_PREFIX

#define IS_STRUCT_PREFIX (   t)     ((t) && strncmp((t), "struct ", 7) == 0)

Checks if type starts with "struct "./*#end#*‍/.

◆ IS_USIZE_TYPE

#define IS_USIZE_TYPE (   t)
Value:
((t) && (strcmp((t), "usize") == 0 || \
strcmp((t), "size_t") == 0))

Checks if type is "usize" or "size_t"./*#end#*‍/.

◆ IS_VEC_TYPE

#define IS_VEC_TYPE (   t)    ((t) && strncmp((t), "Vec_", 4) == 0)

Checks if type is Vec<T>.

◆ IS_VOID_TYPE

#define IS_VOID_TYPE (   t)    ((t) && strcmp((t), "void") == 0)

Checks if type is "void".

◆ MAX_ERROR_MSG_LEN

#define MAX_ERROR_MSG_LEN   1024

Max length for error messages.

◆ MAX_FUNC_NAME_LEN

#define MAX_FUNC_NAME_LEN   512

Max length for function names.

◆ MAX_MANGLED_NAME_LEN

#define MAX_MANGLED_NAME_LEN   512

Max length for mangled names (generics).

◆ MAX_PATH_LEN

#define MAX_PATH_LEN   4096

Max length for file paths.

◆ MAX_TYPE_NAME_LEN

#define MAX_TYPE_NAME_LEN   256

Max length for type name strings.

◆ STRIP_STRUCT_PREFIX

#define STRIP_STRUCT_PREFIX (   t)     (IS_STRUCT_PREFIX(t) ? ((t) + 7) : (t))

Returns ptr to name after "struct " prefix./*#end#*‍/.