mruby/c VM Source Code release 4.0.0
Loading...
Searching...
No Matches
c_range.h
Go to the documentation of this file.
1
14
15#ifndef MRBC_SRC_C_RANGE_H_
16#define MRBC_SRC_C_RANGE_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#include "vm.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32/***** Constat values *******************************************************/
33/***** Macros ***************************************************************/
34/***** Typedefs *************************************************************/
35
36//================================================================
42typedef struct RRange {
44
45 uint8_t flag_exclude; // true: exclude the end object, otherwise include.
48
50
51
52/***** Global variables *****************************************************/
53/***** Function prototypes **************************************************/
54//@cond
55mrbc_value mrbc_range_new(mrbc_vm *vm, mrbc_value *first, mrbc_value *last, int flag_exclude);
57void mrbc_range_clear_vm_id(mrbc_value *v);
58int mrbc_range_compare(const mrbc_value *v1, const mrbc_value *v2);
59//@endcond
60
61
62/***** Inline functions *****************************************************/
63//================================================================
66static inline mrbc_value mrbc_range_first(const mrbc_value *v)
67{
68 return v->range->first;
69}
70
71//================================================================
75{
76 return &v->range->first;
77}
78
79//================================================================
82static inline mrbc_value mrbc_range_last(const mrbc_value *v)
83{
84 return v->range->last;
85}
86
87//================================================================
90static inline mrbc_value *mrbc_range_last_p(const mrbc_value *v)
91{
92 return &v->range->last;
93}
94
95//================================================================
98static inline int mrbc_range_exclude_end(const mrbc_value *v)
99{
100 return v->range->flag_exclude;
101}
102
103
104#ifdef __cplusplus
105}
106#endif
107#endif
struct RObject mrbc_value
Value object. Default version.
void mrbc_range_delete(mrbc_value *v)
Definition c_range.c:63
mrbc_value mrbc_range_new(mrbc_vm *vm, mrbc_value *first, mrbc_value *last, int flag_exclude)
Definition c_range.c:43
int mrbc_range_compare(const mrbc_value *v1, const mrbc_value *v2)
Definition c_range.c:96
static mrbc_value * mrbc_range_last_p(const mrbc_value *v)
Definition c_range.h:90
static mrbc_value mrbc_range_last(const mrbc_value *v)
Definition c_range.h:82
static int mrbc_range_exclude_end(const mrbc_value *v)
Definition c_range.h:98
struct RRange mrbc_range
Range object.
static mrbc_value * mrbc_range_first_p(const mrbc_value *v)
Definition c_range.h:74
static mrbc_value mrbc_range_first(const mrbc_value *v)
Definition c_range.h:66
struct RRange * range
Definition boxing_no.h:33
Range object.
Definition c_range.h:42
mrbc_value last
Definition c_range.h:47
mrbc_value first
Definition c_range.h:46
MRBC_OBJECT_HEADER
Definition c_range.h:43
uint8_t flag_exclude
Definition c_range.h:45
mruby/c value definitions
mruby bytecode executor.
struct VM mrbc_vm
Virtual Machine.