cheax
Lisp dialect with C API
Type system

Functions and datastructures to create, examine and manipulate cheax expressions and their types. More...

Collaboration diagram for Type system:

Data Structures

struct  chx_value
 Represents a value in the cheax environment. More...
 
struct  chx_id
 Identifier type. More...
 
struct  chx_quote
 Quoted value type. More...
 
struct  chx_list
 List type. More...
 
struct  chx_func
 Function or macro type. More...
 
union  chx_eval_out
 
struct  chx_ext_func
 Cheax external/user function expression. More...
 
struct  chx_sym
 Custom symbol. More...
 

Macros

#define CHX_INT_MIN   INT_LEAST64_MIN
 Minimum value for chx_int. More...
 
#define CHX_INT_MAX   INT_LEAST64_MAX
 Maximum value for chx_int. More...
 
#define PRIdCHX   PRIdLEAST64
 Conversion specifier to print chx_int (decimal). More...
 
#define PRIiCHX   PRIiLEAST64
 Conversion specifier to print chx_int (decimal). More...
 
#define SCNdCHX   SCNdLEAST64
 Conversion specifier to scan chx_int (decimal). More...
 
#define SCNiCHX   SCNiLEAST64
 Conversion specifier to scan chx_int (decimal). More...
 
#define CHEAX_NIL   ((struct chx_value){ 0 })
 The nil value. More...
 
#define cheax_id_value(X)   ((struct chx_value){ .type = CHEAX_ID, .data.as_id = (X) })
 Turns chx_id into chx_value. More...
 
#define cheax_int(X)   ((struct chx_value){ .type = CHEAX_INT, .data.as_int = (X) })
 Creates a chx_value of type CHEAX_INT. More...
 
#define cheax_true()   ((struct chx_value){ .type = CHEAX_BOOL, .data.as_int = 1 })
 Creates chx_value true. More...
 
#define cheax_false()   ((struct chx_value){ .type = CHEAX_BOOL, .data.as_int = 0 })
 Creates chx_value false. More...
 
#define cheax_bool(X)   ((struct chx_value){ .type = CHEAX_BOOL, .data.as_int = (X) ? 1 : 0 })
 Creates chx_value of type CHEAX_BOOL. More...
 
#define cheax_double(X)   ((struct chx_value){ .type = CHEAX_DOUBLE, .data.as_double = (X) })
 Creates a chx_value of type CHEAX_DOUBLE. More...
 
#define cheax_list_value(X)   ((struct chx_value){ .type = CHEAX_LIST, .data.as_list = (X) })
 Turns chx_list into chx_value. More...
 
#define cheax_func_value(X)   ((struct chx_value){ .type = CHEAX_FUNC, .data.as_func = (X) })
 
#define cheax_ext_func_value(X)   ((struct chx_value){ .type = CHEAX_EXT_FUNC, .data.as_ext_func = (X) })
 
#define cheax_quote_value(X)   ((struct chx_value){ .type = CHEAX_QUOTE, .data.as_quote = (X) })
 
#define cheax_backquote_value(X)   ((struct chx_value){ .type = CHEAX_BACKQUOTE, .data.as_quote = (X) })
 
#define cheax_comma_value(X)   ((struct chx_value){ .type = CHEAX_COMMA, .data.as_quote = (X) })
 
#define cheax_splice_value(X)   ((struct chx_value){ .type = CHEAX_SPLICE, .data.as_quote = (X) })
 
#define cheax_string_value(X)   ((struct chx_value){ .type = CHEAX_STRING, .data.as_string = (X) })
 
#define cheax_env_value(X)   ((struct chx_value){ .type = CHEAX_ENV, .data.as_env = (X) })
 

Typedefs

typedef int_least64_t chx_int
 Integer type. More...
 
typedef double chx_double
 Floating point type. More...
 
typedef struct chx_value(* chx_func_ptr) (CHEAX *c, struct chx_list *args, void *info)
 Type for C functions to be invoked from cheax. More...
 
typedef int(* chx_tail_func_ptr) (CHEAX *c, struct chx_list *args, void *info, struct chx_env *pop_stop, union chx_eval_out *out)
 
typedef struct chx_value(* chx_getter) (CHEAX *c, struct chx_sym *sym)
 
typedef void(* chx_setter) (CHEAX *c, struct chx_sym *sym, struct chx_value value)
 
typedef void(* chx_finalizer) (CHEAX *c, struct chx_sym *sym)
 
typedef int chx_ref
 

Enumerations

enum  {
  CHEAX_LIST , CHEAX_INT , CHEAX_BOOL , CHEAX_DOUBLE ,
  CHEAX_USER_PTR , CHEAX_ID , CHEAX_FUNC , CHEAX_EXT_FUNC ,
  CHEAX_SPECIAL_OP , CHEAX_QUOTE , CHEAX_BACKQUOTE , CHEAX_COMMA ,
  CHEAX_SPLICE , CHEAX_STRING , CHEAX_ENV , CHEAX_LAST_BASIC_TYPE = CHEAX_ENV ,
  CHEAX_TYPESTORE_BIAS , CHEAX_TYPECODE = CHEAX_TYPESTORE_BIAS + 0 , CHEAX_ERRORCODE
}
 Types of expressions within cheax. More...
 
enum  { CHEAX_VALUE_OUT , CHEAX_TAIL_OUT }
 

Functions

struct chx_value cheax_nil (void) CHX_CONST
 Creates a nil value. More...
 
bool cheax_is_nil (struct chx_value v) CHX_CONST
 Tests whether given value is nil. More...
 
struct chx_value cheax_id (CHEAX *c, const char *id) CHX_PURE
 Creates a chx_value of type CHEAX_ID. More...
 
struct chx_value cheax_id_value_proc (struct chx_id *id) CHX_CONST
 Turns chx_id into chx_value. Like cheax_id_value(), but a function and not a macro. More...
 
struct chx_value cheax_int_proc (chx_int value) CHX_CONST
 Creates a chx_value of type CHEAX_INT. Like cheax_int(), but a function and not a macro. More...
 
struct chx_value cheax_bool_proc (bool value) CHX_CONST
 Creates a chx_value of type CHEAX_BOOL. Like cheax_bool(), but a function and not a macro. More...
 
struct chx_value cheax_double_proc (chx_double value) CHX_CONST
 Creates a chx_value of type CHEAX_DOUBLE. Like cheax_double(), but a function and not a macro. More...
 
struct chx_value cheax_list (CHEAX *c, struct chx_value car, struct chx_list *cdr)
 Creates a list. More...
 
struct chx_value cheax_list_value_proc (struct chx_list *list) CHX_CONST
 Turns chx_list into chx_value. Like cheax_list_value(), but a function and not a macro. More...
 
struct chx_value cheax_func_value_proc (struct chx_func *fn) CHX_CONST
 
struct chx_value cheax_ext_func (CHEAX *c, const char *name, chx_func_ptr perform, void *info)
 Creates a cheax external/user function expression. More...
 
struct chx_value cheax_ext_func_value_proc (struct chx_ext_func *sf) CHX_CONST
 
struct chx_value cheax_quote (CHEAX *c, struct chx_value value)
 Creates a quoted cheax expression. More...
 
struct chx_value cheax_quote_value_proc (struct chx_quote *quote) CHX_CONST
 
struct chx_value cheax_backquote (CHEAX *c, struct chx_value value)
 Creates a backquoted cheax expression. More...
 
struct chx_value cheax_backquote_value_proc (struct chx_quote *bkquote) CHX_CONST
 
struct chx_value cheax_comma (CHEAX *c, struct chx_value value)
 Creates a cheax comma expression. More...
 
struct chx_value cheax_comma_value_proc (struct chx_quote *comma) CHX_CONST
 
struct chx_value cheax_splice (CHEAX *c, struct chx_value value)
 Creates a cheax comma splice expression. More...
 
struct chx_value cheax_splice_value_proc (struct chx_quote *splice) CHX_CONST
 
size_t cheax_strlen (CHEAX *c, struct chx_string *str) CHX_PURE
 Size of string in number of bytes. More...
 
struct chx_value cheax_string (CHEAX *c, const char *value)
 Creates a cheax string expression. More...
 
struct chx_value cheax_nstring (CHEAX *c, const char *value, size_t len)
 Creates a cheax string expression of given length. More...
 
struct chx_value cheax_string_value_proc (struct chx_string *string) CHX_CONST
 
struct chx_value cheax_substr (CHEAX *c, struct chx_string *str, size_t pos, size_t len)
 Takes substring of given cheax string. More...
 
char * cheax_strdup (struct chx_string *str)
 Allocates a null-terminated copy of given chx_string. More...
 
struct chx_value cheax_user_ptr (CHEAX *c, void *value, int type)
 Creates a cheax user pointer expression. More...
 
struct chx_value cheax_env (CHEAX *c)
 Currently active chx_env. More...
 
struct chx_value cheax_env_value_proc (struct chx_env *env) CHX_CONST
 
chx_ref cheax_ref (CHEAX *c, struct chx_value value)
 Increase reference count on cheax value, preventing it from gc deletion when cheax_eval() is called. More...
 
chx_ref cheax_ref_ptr (CHEAX *c, void *obj)
 
void cheax_unref (CHEAX *c, struct chx_value value, chx_ref ref)
 Decrease reference count on cheax value, potentially allowing it to be deleted by gc when cheax_eval() is called. More...
 
void cheax_unref_ptr (CHEAX *c, void *obj, chx_ref ref)
 
int cheax_new_type (CHEAX *c, const char *name, int base_type)
 Creates a new type code as an alias for another. More...
 
int cheax_find_type (CHEAX *c, const char *name)
 Looks up the type code of a named type. More...
 
bool cheax_is_valid_type (CHEAX *c, int type) CHX_PURE
 Checks whether a given type code is valid. More...
 
bool cheax_is_basic_type (CHEAX *c, int type) CHX_PURE
 Checks whether a given type code is a basic type. More...
 
bool cheax_is_user_type (CHEAX *c, int type) CHX_PURE
 Checks whether a given type code is a user-defined type code. More...
 
int cheax_get_base_type (CHEAX *c, int type)
 Gets the base type for a given type. More...
 
int cheax_resolve_type (CHEAX *c, int type)
 Resolves the basic type to which a given type code refers. More...
 

Detailed Description

Functions and datastructures to create, examine and manipulate cheax expressions and their types.

Macro Definition Documentation

◆ CHX_INT_MIN

#define CHX_INT_MIN   INT_LEAST64_MIN

Minimum value for chx_int.

◆ CHX_INT_MAX

#define CHX_INT_MAX   INT_LEAST64_MAX

Maximum value for chx_int.

◆ PRIdCHX

#define PRIdCHX   PRIdLEAST64

Conversion specifier to print chx_int (decimal).

Note
Include inttypes.h to use this macro.

◆ PRIiCHX

#define PRIiCHX   PRIiLEAST64

Conversion specifier to print chx_int (decimal).

Note
Include inttypes.h to use this macro.

◆ SCNdCHX

#define SCNdCHX   SCNdLEAST64

Conversion specifier to scan chx_int (decimal).

Note
Include inttypes.h to use this macro.

◆ SCNiCHX

#define SCNiCHX   SCNiLEAST64

Conversion specifier to scan chx_int (decimal).

Note
Include inttypes.h to use this macro.

◆ CHEAX_NIL

#define CHEAX_NIL   ((struct chx_value){ 0 })

The nil value.

Note
Requires C99 to use.

◆ cheax_id_value

#define cheax_id_value (   X)    ((struct chx_value){ .type = CHEAX_ID, .data.as_id = (X) })

Turns chx_id into chx_value.

See also
cheax_id_value_proc()

◆ cheax_int

#define cheax_int (   X)    ((struct chx_value){ .type = CHEAX_INT, .data.as_int = (X) })

Creates a chx_value of type CHEAX_INT.

Parameters
valueIntegral value for the object.
See also
chx_int, CHEAX_INT, cheax_int_proc()

◆ cheax_true

#define cheax_true ( )    ((struct chx_value){ .type = CHEAX_BOOL, .data.as_int = 1 })

◆ cheax_false

#define cheax_false ( )    ((struct chx_value){ .type = CHEAX_BOOL, .data.as_int = 0 })

◆ cheax_bool

#define cheax_bool (   X)    ((struct chx_value){ .type = CHEAX_BOOL, .data.as_int = (X) ? 1 : 0 })

Creates chx_value of type CHEAX_BOOL.

Parameters
valueBoolean value for the object.
See also
cheax_true(), cheax_false(), chx_int, CHEAX_BOOL

◆ cheax_double

#define cheax_double (   X)    ((struct chx_value){ .type = CHEAX_DOUBLE, .data.as_double = (X) })

Creates a chx_value of type CHEAX_DOUBLE.

Parameters
valueFloating point value for the object.
See also
chx_double, CHEAX_DOUBLE

◆ cheax_list_value

#define cheax_list_value (   X)    ((struct chx_value){ .type = CHEAX_LIST, .data.as_list = (X) })

◆ cheax_func_value

#define cheax_func_value (   X)    ((struct chx_value){ .type = CHEAX_FUNC, .data.as_func = (X) })

◆ cheax_ext_func_value

#define cheax_ext_func_value (   X)    ((struct chx_value){ .type = CHEAX_EXT_FUNC, .data.as_ext_func = (X) })

◆ cheax_quote_value

#define cheax_quote_value (   X)    ((struct chx_value){ .type = CHEAX_QUOTE, .data.as_quote = (X) })

◆ cheax_backquote_value

#define cheax_backquote_value (   X)    ((struct chx_value){ .type = CHEAX_BACKQUOTE, .data.as_quote = (X) })

◆ cheax_comma_value

#define cheax_comma_value (   X)    ((struct chx_value){ .type = CHEAX_COMMA, .data.as_quote = (X) })

◆ cheax_splice_value

#define cheax_splice_value (   X)    ((struct chx_value){ .type = CHEAX_SPLICE, .data.as_quote = (X) })

◆ cheax_string_value

#define cheax_string_value (   X)    ((struct chx_value){ .type = CHEAX_STRING, .data.as_string = (X) })

◆ cheax_env_value

#define cheax_env_value (   X)    ((struct chx_value){ .type = CHEAX_ENV, .data.as_env = (X) })

Typedef Documentation

◆ chx_int

typedef int_least64_t chx_int

◆ chx_double

typedef double chx_double

Floating point type.

See also
CHEAX_DOUBLE, cheax_double()

◆ chx_func_ptr

typedef struct chx_value(* chx_func_ptr) (CHEAX *c, struct chx_list *args, void *info)

Type for C functions to be invoked from cheax.

Parameters
argsThe argument list as the function was invoked. The arguments are given as is, not pre-evaluated. E.g. if cheax passes an identifier to the function as an argument, it will apear as an identifier in the argument list, not as the value of the symbol it may represent.
infoUser-provided data.
Returns
The function's return value to be delivered back to cheax.
See also
chx_ext_form, cheax_defsyntax(), cheax_ext_func(), cheax_defun()

◆ chx_tail_func_ptr

typedef int(* chx_tail_func_ptr) (CHEAX *c, struct chx_list *args, void *info, struct chx_env *pop_stop, union chx_eval_out *out)

◆ chx_getter

typedef struct chx_value(* chx_getter) (CHEAX *c, struct chx_sym *sym)

◆ chx_setter

typedef void(* chx_setter) (CHEAX *c, struct chx_sym *sym, struct chx_value value)

◆ chx_finalizer

typedef void(* chx_finalizer) (CHEAX *c, struct chx_sym *sym)

◆ chx_ref

typedef int chx_ref

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Types of expressions within cheax.

See also
cheax_new_type(), chx_value::type
Enumerator
CHEAX_LIST 

List type code.

CHEAX_INT 

Integral type code.

CHEAX_BOOL 

Boolean type code.

CHEAX_DOUBLE 

Floating point type code.

CHEAX_USER_PTR 

Type of user pointers defined from outside the cheax environment.

Note
Objects of this basic type exist only through type aliases made with cheax_new_type(), and do not exist as 'bare' user pointers.
CHEAX_ID 

Identifier type code.

CHEAX_FUNC 

Function type code.

CHEAX_EXT_FUNC 

Type code for functions defined through the C API.

CHEAX_SPECIAL_OP 

Type code for special operations, defined through the C API.

CHEAX_QUOTE 

Type for quoted expressions.

CHEAX_BACKQUOTE 

Type for backquoted expressions.

CHEAX_COMMA 

Type for comma expressions.

CHEAX_SPLICE 

Type for comma splice (i.e. ,@) expressions.

CHEAX_STRING 

String type.

CHEAX_ENV 

Environment type.

CHEAX_LAST_BASIC_TYPE 
CHEAX_TYPESTORE_BIAS 
CHEAX_TYPECODE 

The type of type codes themselves. A type alias of CHEAX_INT.

CHEAX_ERRORCODE 

Error code type. A type alias of CHEAX_INT.

◆ anonymous enum

anonymous enum
Enumerator
CHEAX_VALUE_OUT 
CHEAX_TAIL_OUT 

Function Documentation

◆ cheax_nil()

struct chx_value cheax_nil ( void  )

Creates a nil value.

Deprecated:
In favor of CHEAX_NIL.

◆ cheax_is_nil()

bool cheax_is_nil ( struct chx_value  v)

Tests whether given value is nil.

Returns
Whether v.type is CHEAX_LIST and v.data.as_list is NULL.

◆ cheax_id()

struct chx_value cheax_id ( CHEAX c,
const char *  id 
)

Creates a chx_value of type CHEAX_ID.

Parameters
idIdentifier value for the expression.
See also
chx_id, CHEAX_ID, cheax_id_value_proc()

◆ cheax_id_value_proc()

struct chx_value cheax_id_value_proc ( struct chx_id id)

Turns chx_id into chx_value. Like cheax_id_value(), but a function and not a macro.

◆ cheax_int_proc()

struct chx_value cheax_int_proc ( chx_int  value)

Creates a chx_value of type CHEAX_INT. Like cheax_int(), but a function and not a macro.

◆ cheax_bool_proc()

struct chx_value cheax_bool_proc ( bool  value)

Creates a chx_value of type CHEAX_BOOL. Like cheax_bool(), but a function and not a macro.

◆ cheax_double_proc()

struct chx_value cheax_double_proc ( chx_double  value)

Creates a chx_value of type CHEAX_DOUBLE. Like cheax_double(), but a function and not a macro.

◆ cheax_list()

struct chx_value cheax_list ( CHEAX c,
struct chx_value  car,
struct chx_list cdr 
)

Creates a list.

Parameters
carNode value.
cdrNext node or NULL.
See also
chx_list, CHEAX_LIST

◆ cheax_list_value_proc()

struct chx_value cheax_list_value_proc ( struct chx_list list)

Turns chx_list into chx_value. Like cheax_list_value(), but a function and not a macro.

◆ cheax_func_value_proc()

struct chx_value cheax_func_value_proc ( struct chx_func fn)

◆ cheax_ext_func()

struct chx_value cheax_ext_func ( CHEAX c,
const char *  name,
chx_func_ptr  perform,
void *  info 
)

Creates a cheax external/user function expression.

External functions, unlike special operators, have their arguments pre-evaluated.

Parameters
performFunction pointer to be invoked.
nameFunction name as will be used by cheax_print().
infoCallback info to be passed upon invocation.

◆ cheax_ext_func_value_proc()

struct chx_value cheax_ext_func_value_proc ( struct chx_ext_func sf)

◆ cheax_quote()

struct chx_value cheax_quote ( CHEAX c,
struct chx_value  value 
)

Creates a quoted cheax expression.

Parameters
valueExpression to be quoted.
See also
chx_quote, CHEAX_QUOTE

◆ cheax_quote_value_proc()

struct chx_value cheax_quote_value_proc ( struct chx_quote quote)

◆ cheax_backquote()

struct chx_value cheax_backquote ( CHEAX c,
struct chx_value  value 
)

Creates a backquoted cheax expression.

Parameters
valueExpression to be backquoted.
See also
chx_quote, CHEAX_BACKQUOTE

◆ cheax_backquote_value_proc()

struct chx_value cheax_backquote_value_proc ( struct chx_quote bkquote)

◆ cheax_comma()

struct chx_value cheax_comma ( CHEAX c,
struct chx_value  value 
)

Creates a cheax comma expression.

Parameters
valueExpression following comma.
See also
chx_quote, CHEAX_COMMA

◆ cheax_comma_value_proc()

struct chx_value cheax_comma_value_proc ( struct chx_quote comma)

◆ cheax_splice()

struct chx_value cheax_splice ( CHEAX c,
struct chx_value  value 
)

Creates a cheax comma splice expression.

Parameters
valueExpression following comma splice.
See also
chx_quote, CHEAX_SPLICE

◆ cheax_splice_value_proc()

struct chx_value cheax_splice_value_proc ( struct chx_quote splice)

◆ cheax_strlen()

size_t cheax_strlen ( CHEAX c,
struct chx_string *  str 
)

Size of string in number of bytes.

Parameters
strString.
Returns
Size of given string, or zero if str is NULL.

◆ cheax_string()

struct chx_value cheax_string ( CHEAX c,
const char *  value 
)

Creates a cheax string expression.

Parameters
valueNull-terminated value for the string.
See also
chx_string, cheax_nstring(), CHEAX_STRING

◆ cheax_nstring()

struct chx_value cheax_nstring ( CHEAX c,
const char *  value,
size_t  len 
)

Creates a cheax string expression of given length.

Parameters
valueValue for the string.
lenLength of the string.
See also
chx_string, cheax_string(), CHEAX_STRING

◆ cheax_string_value_proc()

struct chx_value cheax_string_value_proc ( struct chx_string *  string)

◆ cheax_substr()

struct chx_value cheax_substr ( CHEAX c,
struct chx_string *  str,
size_t  pos,
size_t  len 
)

Takes substring of given cheax string.

Sets cheax_errno() to CHEAX_EINDEX if substring is out of bounds.

Parameters
strInitial string.
posSubstring starting offset in number of bytes.
lenSubstring length in number of bytes.

◆ cheax_strdup()

char* cheax_strdup ( struct chx_string *  str)

Allocates a null-terminated copy of given chx_string.

Make sure to free() result after use.

Parameters
strString.
Returns
Null terminated string or NULL if str is NULL.

◆ cheax_user_ptr()

struct chx_value cheax_user_ptr ( CHEAX c,
void *  value,
int  type 
)

Creates a cheax user pointer expression.

Parameters
valuePointer value for the expression.
typeType alias for the expression. Must not be a basic type, and must resolve to CHEAX_USER_PTR.
See also
chx_user_ptr, CHEAX_USER_PTR

◆ cheax_env()

struct chx_value cheax_env ( CHEAX c)

Currently active chx_env.

See also
cheax_push_env(), cheax_enter_env(), cheax_pop_env()
Returns
Currently active chx_env, or NULL if currently running in the global scope.

◆ cheax_env_value_proc()

struct chx_value cheax_env_value_proc ( struct chx_env *  env)

◆ cheax_ref()

chx_ref cheax_ref ( CHEAX c,
struct chx_value  value 
)

Increase reference count on cheax value, preventing it from gc deletion when cheax_eval() is called.

See also
cheax_unref()

◆ cheax_ref_ptr()

chx_ref cheax_ref_ptr ( CHEAX c,
void *  obj 
)

◆ cheax_unref()

void cheax_unref ( CHEAX c,
struct chx_value  value,
chx_ref  ref 
)

Decrease reference count on cheax value, potentially allowing it to be deleted by gc when cheax_eval() is called.

See also
cheax_ref()

◆ cheax_unref_ptr()

void cheax_unref_ptr ( CHEAX c,
void *  obj,
chx_ref  ref 
)

◆ cheax_new_type()

int cheax_new_type ( CHEAX c,
const char *  name,
int  base_type 
)

Creates a new type code as an alias for another.

Sets cheax_errno() to CHEAX_EAPI if

  • name is NULL;
  • base_type is not a valid type code; or
  • name already names a type.
Parameters
nameName for the new type code in the cheax environment.
base_typeBase type code to create an alias for.
Returns
The new type code. -1 if unsuccessful.

◆ cheax_find_type()

int cheax_find_type ( CHEAX c,
const char *  name 
)

Looks up the type code of a named type.

Sets cheax_errno() to CHEAX_EAPI if name is NULL.

Parameters
nameType name.
Returns
The type code of a type with the given name, or -1 if unsuccessful.

◆ cheax_is_valid_type()

bool cheax_is_valid_type ( CHEAX c,
int  type 
)

Checks whether a given type code is valid.

Parameters
typeCode to check.
Returns
Whether type is a valid type code.

◆ cheax_is_basic_type()

bool cheax_is_basic_type ( CHEAX c,
int  type 
)

Checks whether a given type code is a basic type.

Parameters
typeType code to check.
Returns
Whether type is a basic type.

◆ cheax_is_user_type()

bool cheax_is_user_type ( CHEAX c,
int  type 
)

Checks whether a given type code is a user-defined type code.

Parameters
typeType code to check.
Returns
Whether type is a user-defined type code.

◆ cheax_get_base_type()

int cheax_get_base_type ( CHEAX c,
int  type 
)

Gets the base type for a given type.

The base type of a given type is either the type itself for basic types, or the type for which a user-defined type is an alias. Note that this operation is only applied once, and hence the return value is not necessarily a basic type.

Sets cheax_errno() to CHEAX_EEVAL if type could not be resolved.

Parameters
typeType code to get the base type of.
Returns
The base type of type, or -1 if unsuccessful.
See also
cheax_resolve_type()

◆ cheax_resolve_type()

int cheax_resolve_type ( CHEAX c,
int  type 
)

Resolves the basic type to which a given type code refers.

Progressively applies cheax_get_base_type() until a basic type is reached.

Sets cheax_errno() to CHEAX_EEVAL if type could not be resolved.

Parameters
typeType code to resolve.
Returns
The basic type to which type refers, or -1 if unsuccessful.
See also
cheax_get_base_type()