source: EcnlProtoTool/trunk/mruby-1.2.0/include/mruby/range.h@ 270

Last change on this file since 270 was 270, checked in by coas-nagasima, 7 years ago

mruby版ECNLプロトタイピング・ツールを追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 1.2 KB
Line 
1/*
2** mruby/range.h - Range class
3**
4** See Copyright Notice in mruby.h
5*/
6
7#ifndef MRUBY_RANGE_H
8#define MRUBY_RANGE_H
9
10#include "mruby/common.h"
11
12/**
13 * Range class
14 */
15MRB_BEGIN_DECL
16
17typedef struct mrb_range_edges {
18 mrb_value beg;
19 mrb_value end;
20} mrb_range_edges;
21
22struct RRange {
23 MRB_OBJECT_HEADER;
24 mrb_range_edges *edges;
25 mrb_bool excl : 1;
26};
27
28#define mrb_range_ptr(v) ((struct RRange*)(mrb_ptr(v)))
29#define mrb_range_value(p) mrb_obj_value((void*)(p))
30
31/*
32 * Initializes a Range.
33 *
34 * If the third parameter is FALSE then it includes the last value in the range.
35 * If the third parameter is TRUE then it excludes the last value in the range.
36 *
37 * @param start the beginning value.
38 * @param end the ending value.
39 * @param exclude represents the inclusion or exclusion of the last value.
40 */
41MRB_API mrb_value mrb_range_new(mrb_state *mrb, mrb_value start, mrb_value end, mrb_bool exclude);
42
43MRB_API mrb_bool mrb_range_beg_len(mrb_state *mrb, mrb_value range, mrb_int *begp, mrb_int *lenp, mrb_int len);
44mrb_value mrb_get_values_at(mrb_state *mrb, mrb_value obj, mrb_int olen, mrb_int argc, const mrb_value *argv, mrb_value (*func)(mrb_state*, mrb_value, mrb_int));
45
46MRB_END_DECL
47
48#endif /* MRUBY_RANGE_H */
Note: See TracBrowser for help on using the repository browser.