mbed I/F binding for mruby
Dependents: mruby_mbed_web mirb_mbed
mbed-mruby
How to use
Class
include/mruby/range.h@1:8ccd1d494a4b, 2015-04-13 (annotated)
- Committer:
- mzta
- Date:
- Mon Apr 13 05:20:15 2015 +0000
- Revision:
- 1:8ccd1d494a4b
- Parent:
- 0:158c61bb030f
- code refactoring.; - add SPI, SPISlave, I2C class to mruby-mbed (Incomplete).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mzta | 0:158c61bb030f | 1 | /* |
mzta | 0:158c61bb030f | 2 | ** mruby/range.h - Range class |
mzta | 0:158c61bb030f | 3 | ** |
mzta | 0:158c61bb030f | 4 | ** See Copyright Notice in mruby.h |
mzta | 0:158c61bb030f | 5 | */ |
mzta | 0:158c61bb030f | 6 | |
mzta | 0:158c61bb030f | 7 | #ifndef MRUBY_RANGE_H |
mzta | 0:158c61bb030f | 8 | #define MRUBY_RANGE_H |
mzta | 0:158c61bb030f | 9 | |
mzta | 0:158c61bb030f | 10 | #if defined(__cplusplus) |
mzta | 0:158c61bb030f | 11 | extern "C" { |
mzta | 0:158c61bb030f | 12 | #endif |
mzta | 0:158c61bb030f | 13 | |
mzta | 0:158c61bb030f | 14 | typedef struct mrb_range_edges { |
mzta | 0:158c61bb030f | 15 | mrb_value beg; |
mzta | 0:158c61bb030f | 16 | mrb_value end; |
mzta | 0:158c61bb030f | 17 | } mrb_range_edges; |
mzta | 0:158c61bb030f | 18 | |
mzta | 0:158c61bb030f | 19 | struct RRange { |
mzta | 0:158c61bb030f | 20 | MRB_OBJECT_HEADER; |
mzta | 0:158c61bb030f | 21 | mrb_range_edges *edges; |
mzta | 0:158c61bb030f | 22 | mrb_bool excl : 1; |
mzta | 0:158c61bb030f | 23 | }; |
mzta | 0:158c61bb030f | 24 | |
mzta | 0:158c61bb030f | 25 | #define mrb_range_ptr(v) ((struct RRange*)(mrb_ptr(v))) |
mzta | 0:158c61bb030f | 26 | #define mrb_range_value(p) mrb_obj_value((void*)(p)) |
mzta | 0:158c61bb030f | 27 | |
mzta | 0:158c61bb030f | 28 | MRB_API mrb_value mrb_range_new(mrb_state*, mrb_value, mrb_value, mrb_bool); |
mzta | 0:158c61bb030f | 29 | MRB_API mrb_bool mrb_range_beg_len(mrb_state *mrb, mrb_value range, mrb_int *begp, mrb_int *lenp, mrb_int len); |
mzta | 0:158c61bb030f | 30 | mrb_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)); |
mzta | 0:158c61bb030f | 31 | |
mzta | 0:158c61bb030f | 32 | #if defined(__cplusplus) |
mzta | 0:158c61bb030f | 33 | } /* extern "C" { */ |
mzta | 0:158c61bb030f | 34 | #endif |
mzta | 0:158c61bb030f | 35 | |
mzta | 0:158c61bb030f | 36 | #endif /* MRUBY_RANGE_H */ |
mzta | 0:158c61bb030f | 37 |