mruby/c Array class
More...
#include "mrubyc.h"
#include "_autogen_class_array.h"
Go to the source code of this file.
|
| mrbc_value | mrbc_array_new (struct VM *vm, int size) |
| void | mrbc_array_delete (mrbc_value *ary) |
| int | mrbc_array_resize (mrbc_value *ary, int size) |
| int | mrbc_array_set (mrbc_value *ary, int idx, mrbc_value *set_val) |
| mrbc_value | mrbc_array_get (const mrbc_value *ary, int idx) |
| mrbc_value * | mrbc_array_get_p (const mrbc_value *ary, int idx) |
| int | mrbc_array_push (mrbc_value *ary, mrbc_value *set_val) |
| int | mrbc_array_push_m (mrbc_value *ary, mrbc_value *set_val) |
| mrbc_value | mrbc_array_pop (mrbc_value *ary) |
| int | mrbc_array_unshift (mrbc_value *ary, mrbc_value *set_val) |
| mrbc_value | mrbc_array_shift (mrbc_value *ary) |
| int | mrbc_array_insert (mrbc_value *ary, int idx, mrbc_value *set_val) |
| mrbc_value | mrbc_array_remove (mrbc_value *ary, int idx) |
| void | mrbc_array_clear (mrbc_value *ary) |
| int | mrbc_array_compare (const mrbc_value *v1, const mrbc_value *v2) |
| void | mrbc_array_minmax (mrbc_value *ary, mrbc_value **pp_min_value, mrbc_value **pp_max_value) |
| mrbc_value | mrbc_array_dup (struct VM *vm, const mrbc_value *ary) |
| mrbc_value | mrbc_array_divide (struct VM *vm, mrbc_value *src, int pos) |
| int | mrbc_array_index (const mrbc_value *ary, const mrbc_value *val) |
| mrbc_value | mrbc_array_uniq (struct VM *vm, const mrbc_value *ary) |
| int | mrbc_array_uniq_self (mrbc_value *ary) |
mruby/c Array class
Copyright (C) 2015- Kyushu Institute of Technology.
Copyright (C) 2015- Shimane IT Open-Innovation Center.
This file is distributed under BSD 3-Clause License.
Function summary
(constructor)
mrbc_array_new()
(destructor)
mrbc_array_delete()
(setter)
--[name]-------------[arg]---[ret]-------------------------------------------
mrbc_array_set() *V int
mrbc_array_push() *V int
mrbc_array_push_m() *V int
mrbc_array_unshift() *V int
mrbc_array_insert() *V int
(getter)
--[name]-------------[arg]---[ret]---[note]----------------------------------
mrbc_array_get() idx V Data remains in the container
mrbc_array_get_p() idx *V Data remains in the container
mrbc_array_pop() V Data does not remain in the container
mrbc_array_shift() V Data does not remain in the container
mrbc_array_remove() idx V Data does not remain in the container
(finder)
mrbc_array_index()
mrbc_array_include()
(others)
mrbc_array_size()
mrbc_array_resize()
mrbc_array_clear()
mrbc_array_compare()
mrbc_array_minmax()
mrbc_array_dup()
mrbc_array_divide()
mrbc_array_uniq()
mrbc_array_uniq_self()
Definition in file c_array.c.
◆ mrbc_array_clear()
clear all
- Parameters
-
| ary | pointer to target value |
Definition at line 420 of file c_array.c.
◆ mrbc_array_compare()
compare
- Parameters
-
- Return values
-
| 0 | v1 == v2 |
| plus | v1 > v2 |
| minus | v1 < v2 |
Definition at line 443 of file c_array.c.
◆ mrbc_array_delete()
destructor
- Parameters
-
| ary | pointer to target value |
Definition at line 113 of file c_array.c.
◆ mrbc_array_divide()
divide into two parts
- Parameters
-
| vm | pointer to VM. |
| src | source |
| pos | divide position |
- Returns
- divided array
- Note
- src = [0,1,2,3] ret = divide(src, 2) src = [0,1], ret = [2,3]
Definition at line 529 of file c_array.c.
◆ mrbc_array_dup()
duplicate (shallow copy)
- Parameters
-
| vm | pointer to VM. |
| ary | source |
- Returns
- result
Definition at line 497 of file c_array.c.
◆ mrbc_array_get()
getter
- Parameters
-
| ary | pointer to target value |
| idx | index |
- Returns
- mrbc_value data at index position or Nil.
Definition at line 216 of file c_array.c.
◆ mrbc_array_get_p()
getter
- Parameters
-
| ary | pointer to target value |
| idx | index |
- Returns
- pointer to mrbc_value or NULL.
Definition at line 234 of file c_array.c.
◆ mrbc_array_index()
index
- Parameters
-
| ary | target array. |
| val | search object. |
- Returns
- index value or -1 if not found.
Definition at line 556 of file c_array.c.
◆ mrbc_array_insert()
insert a data
- Parameters
-
| ary | pointer to target value |
| idx | index |
| set_val | set value |
- Returns
- mrbc_error_code
Definition at line 348 of file c_array.c.
◆ mrbc_array_minmax()
get min, max value
- Parameters
-
| ary | pointer to target value |
| pp_min_value | returns minimum mrbc_value |
| pp_max_value | returns maxmum mrbc_value |
Definition at line 463 of file c_array.c.
◆ mrbc_array_new()
constructor
- Parameters
-
| vm | pointer to VM. |
| size | initial size |
- Returns
- array object
Definition at line 82 of file c_array.c.
◆ mrbc_array_pop()
pop a data from tail.
- Parameters
-
| ary | pointer to target value |
- Returns
- tail data or Nil
Definition at line 299 of file c_array.c.
◆ mrbc_array_push()
push a data to tail
- Parameters
-
| ary | pointer to target value |
| set_val | set value |
- Returns
- mrbc_error_code
Definition at line 252 of file c_array.c.
◆ mrbc_array_push_m()
push multiple data to tail
- Parameters
-
| ary | pointer to target value |
| set_val | set value (array) |
- Returns
- mrbc_error_code
Definition at line 274 of file c_array.c.
◆ mrbc_array_remove()
remove a data
- Parameters
-
| ary | pointer to target value |
| idx | index |
- Returns
- mrbc_value data at index position or Nil.
Definition at line 397 of file c_array.c.
◆ mrbc_array_resize()
| int mrbc_array_resize |
( |
mrbc_value * | ary, |
|
|
int | size ) |
◆ mrbc_array_set()
setter
- Parameters
-
| ary | pointer to target value |
| idx | index |
| set_val | set value |
- Returns
- mrbc_error_code
Definition at line 178 of file c_array.c.
◆ mrbc_array_shift()
removes the first data and returns it.
- Parameters
-
| ary | pointer to target value |
- Returns
- first data or Nil
Definition at line 327 of file c_array.c.
◆ mrbc_array_uniq()
removes duplicate elements and return allocated new mrbc_value
- Parameters
-
| vm | pointer to VM. |
| ary | source |
- Returns
- result
Definition at line 573 of file c_array.c.
◆ mrbc_array_uniq_self()
removes duplicate elements
- Parameters
-
- Returns
- num of deleted
Definition at line 588 of file c_array.c.
◆ mrbc_array_unshift()
insert a data to the first.
- Parameters
-
| ary | pointer to target value |
| set_val | set value |
- Returns
- mrbc_error_code
Definition at line 315 of file c_array.c.