mruby/c VM Source Code release 3.4
Loading...
Searching...
No Matches
c_range.h
Go to the documentation of this file.
1
13
14#ifndef MRBC_SRC_C_RANGE_H_
15#define MRBC_SRC_C_RANGE_H_
16
17/***** Feature test switches ************************************************/
18/***** System headers *******************************************************/
19//@cond
20#include <stdint.h>
21//@endcond
22
23/***** Local headers ********************************************************/
24#include "value.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/***** Constat values *******************************************************/
31/***** Macros ***************************************************************/
32/***** Typedefs *************************************************************/
33
34//================================================================
40typedef struct RRange {
42
43 uint8_t flag_exclude; // true: exclude the end object, otherwise include.
46
48
49
50/***** Global variables *****************************************************/
51/***** Function prototypes **************************************************/
52//@cond
53mrbc_value mrbc_range_new(struct VM *vm, mrbc_value *first, mrbc_value *last, int flag_exclude);
55void mrbc_range_clear_vm_id(mrbc_value *v);
56int mrbc_range_compare(const mrbc_value *v1, const mrbc_value *v2);
57//@endcond
58
59
60/***** Inline functions *****************************************************/
61//================================================================
64static inline mrbc_value mrbc_range_first(const mrbc_value *v)
65{
66 return v->range->first;
67}
68
69//================================================================
72static inline mrbc_value mrbc_range_last(const mrbc_value *v)
73{
74 return v->range->last;
75}
76
77//================================================================
80static inline int mrbc_range_exclude_end(const mrbc_value *v)
81{
82 return v->range->flag_exclude;
83}
84
85
86
87#ifdef __cplusplus
88}
89#endif
90#endif
void mrbc_range_delete(mrbc_value *v)
Definition c_range.c:64
mrbc_value mrbc_range_new(struct 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:97
static mrbc_value mrbc_range_last(const mrbc_value *v)
Definition c_range.h:72
static int mrbc_range_exclude_end(const mrbc_value *v)
Definition c_range.h:80
struct RRange mrbc_range
Range object.
static mrbc_value mrbc_range_first(const mrbc_value *v)
Definition c_range.h:64
struct RRange * range
Definition value.h:165
Range object.
Definition c_range.h:40
mrbc_value last
Definition c_range.h:45
mrbc_value first
Definition c_range.h:44
MRBC_OBJECT_HEADER
Definition c_range.h:41
uint8_t flag_exclude
Definition c_range.h:43
Virtual Machine.
Definition vm.h:140
mruby/c value definitions
struct RObject mrbc_value
Definition value.h:174