mruby/c VM Source Code master (2026/08/06)
Loading...
Searching...
No Matches
error.h
Go to the documentation of this file.
1
14
15#ifndef MRBC_SRC_ERROR_H_
16#define MRBC_SRC_ERROR_H_
17
18/***** Feature test switches ************************************************/
19/***** System headers *******************************************************/
20//@cond
21#include <stdint.h>
22//@endcond
23
24/***** Local headers ********************************************************/
25#include "value.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/***** Constat values *******************************************************/
32#if !defined(MRBC_EXCEPTION_CALL_NEST_LEVEL)
33#define MRBC_EXCEPTION_CALL_NEST_LEVEL 8
34#endif
35
36
37/***** Macros ***************************************************************/
38#define mrbc_israised(vm) ((vm)->exception.tt == MRBC_TT_EXCEPTION)
39
40
41/***** Typedefs *************************************************************/
42//================================================================
58
59
60/***** Global variables *****************************************************/
61/***** Function prototypes **************************************************/
62//@cond
63mrbc_value mrbc_exception_new(struct VM *vm, struct RClass *exc_cls, const void *message, int len);
64mrbc_value mrbc_exception_new_alloc(struct VM *vm, struct RClass *exc_cls, const void *message, int len);
66void mrbc_raise(struct VM *vm, struct RClass *exc_cls, const char *msg);
67void mrbc_raisef(struct VM *vm, struct RClass *exc_cls, const char *fstr, ...);
68void mrbc_clear_exception(struct VM *vm);
69void mrbc_print_exception(const mrbc_value *v);
70void mrbc_print_vm_exception(const struct VM *vm);
71//@endcond
72
73
74/***** Inline functions *****************************************************/
75
76
77#ifdef __cplusplus
78}
79#endif
80#endif
struct RObject mrbc_value
Value object. Default version.
void mrbc_print_exception(const mrbc_value *v)
Definition error.c:214
void mrbc_raise(struct VM *vm, struct RClass *exc_cls, const char *msg)
Definition error.c:145
void mrbc_print_vm_exception(const struct VM *vm)
Definition error.c:231
void mrbc_exception_delete(mrbc_value *value)
Definition error.c:128
mrbc_value mrbc_exception_new_alloc(struct VM *vm, struct RClass *exc_cls, const void *message, int len)
Definition error.c:112
mrbc_value mrbc_exception_new(struct VM *vm, struct RClass *exc_cls, const void *message, int len)
Definition error.c:65
void mrbc_raisef(struct VM *vm, struct RClass *exc_cls, const char *fstr,...)
Definition error.c:168
void mrbc_clear_exception(struct VM *vm)
Definition error.c:201
#define MRBC_EXCEPTION_CALL_NEST_LEVEL
Definition error.h:33
struct RException mrbc_exception
Exception object.
Class object.
Definition class.h:87
Exception object.
Definition error.h:48
mrbc_sym call_nest[MRBC_EXCEPTION_CALL_NEST_LEVEL]
Definition error.h:55
struct RClass * cls
exception class.
Definition error.h:51
MRBC_OBJECT_HEADER
Definition error.h:49
const uint8_t * message
to heap or ROM.
Definition error.h:54
mrbc_sym method_id
raised method, if it is known.
Definition error.h:52
uint16_t message_size
message length.
Definition error.h:53
Virtual Machine.
Definition vm.h:150
mruby/c value definitions
int16_t mrbc_sym
mruby/c symbol ID
Definition value.h:62