Reduct  v1.0.4-3-gdaf0d70
A functional and immutable language.
Loading...
Searching...
No Matches
error.h File Reference

Error handling and reporting. More...

#include "defs.h"
Include dependency graph for error.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  reduct_error_t
 Error structure. More...
 

Macros

#define REDUCT_ERROR_MAX_LEN   512
 Maximum length of an error string.
 
#define REDUCT_ERROR()   ((reduct_error_t){0})
 Create a Reduct error structure.
 
#define REDUCT_ERROR_CATCH(_error)   (REDUCT_SETJMP((_error)->jmp))
 Catch an error using the jump buffer in the error structure.
 
#define REDUCT_ERROR_THROW(_error, _item, _type, ...)
 Throw an error using the jump buffer in the error structure.
 
#define REDUCT_ERROR_SYNTAX(_error, _input, _ptr, ...)
 Throw a syntax error using the jump buffer in the error structure.
 
#define REDUCT_ERROR_COMPILE(_compiler, _item, ...)
 Throw a compile error using the jump buffer in the error structure.
 
#define REDUCT_ERROR_RUNTIME(_reduct, ...)   reduct_error_throw_runtime((_reduct), __VA_ARGS__)
 Throw a runtime error using the jump buffer in the error structure.
 
#define REDUCT_ERROR_INTERNAL(_reduct, ...)   REDUCT_ERROR_THROW((_reduct)->error, REDUCT_NULL, INTERNAL, __VA_ARGS__)
 Throw an internal error using the jump buffer in the error structure.
 
#define REDUCT_ERROR_CHECK_TYPE(_reduct, _name, _handle, _expected)
 Report a type error for a handle.
 
#define REDUCT_ERROR_CHECK_LIST(_reduct, _handle, _name)
 Assert that a handle is a list.
 
#define REDUCT_ERROR_CHECK_CALLABLE(_reduct, _handle, _name)
 Assert that a handle is a callable.
 
#define REDUCT_ERROR_CHECK_SEQUENCE(_reduct, _handle, _name)
 Assert that a handle is a sequence (list or atom).
 

Enumerations

enum  reduct_error_type_t {
  REDUCT_ERROR_TYPE_NONE , REDUCT_ERROR_TYPE_SYNTAX , REDUCT_ERROR_TYPE_COMPILE , REDUCT_ERROR_TYPE_RUNTIME ,
  REDUCT_ERROR_TYPE_INTERNAL
}
 Error type enumeration. More...
 

Functions

REDUCT_API void reduct_error_print (reduct_error_t *error, reduct_file_t file)
 Format and print the error to a file.
 
REDUCT_API void reduct_error_get_row_column (reduct_error_t *error, reduct_size_t *row, reduct_size_t *column)
 Get the row and column by traversing the input buffer.
 
REDUCT_API void reduct_error_set (reduct_error_t *error, const char *path, const char *input, reduct_size_t inputLength, reduct_size_t regionLength, reduct_size_t position, reduct_error_type_t type, const char *message,...)
 Set the error information in the error structure.
 
REDUCT_API void reduct_error_get_item_params (struct reduct_item *item, const char **path, const char **input, reduct_size_t *inputLength, reduct_size_t *regionLength, reduct_size_t *position)
 Get the error parameters from a Reduct item.
 
REDUCT_API REDUCT_NORETURN void reduct_error_throw_runtime (struct reduct *reduct, const char *message,...)
 Throw a runtime error utilizing the evaluation state to determine the context.
 
REDUCT_API void reduct_error_check_arity (struct reduct *reduct, reduct_size_t argc, reduct_size_t expected, const char *name)
 Check the arity of a native function call.
 
REDUCT_API void reduct_error_check_min_arity (struct reduct *reduct, reduct_size_t argc, reduct_size_t min, const char *name)
 
REDUCT_API void reduct_error_check_arity_range (struct reduct *reduct, reduct_size_t argc, reduct_size_t min, reduct_size_t max, const char *name)
 

Detailed Description

Error handling and reporting.

Definition in file error.h.