Commit ef73ec56 authored by Seba Gamboa's avatar Seba Gamboa

array header cleanup

parent 11fb10a2
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "mruby/common.h" #include "mruby/common.h"
/** /*
* Array class * Array class
*/ */
MRB_BEGIN_DECL MRB_BEGIN_DECL
...@@ -46,89 +46,74 @@ void mrb_ary_decref(mrb_state*, mrb_shared_array*); ...@@ -46,89 +46,74 @@ void mrb_ary_decref(mrb_state*, mrb_shared_array*);
MRB_API void mrb_ary_modify(mrb_state*, struct RArray*); MRB_API void mrb_ary_modify(mrb_state*, struct RArray*);
MRB_API mrb_value mrb_ary_new_capa(mrb_state*, mrb_int); MRB_API mrb_value mrb_ary_new_capa(mrb_state*, mrb_int);
/** /*
* Initializes a new array. * Initializes a new array.
* *
* Equivalent to: * Equivalent to:
* *
* Array.new * Array.new
* *
* @param mrb * @param mrb The mruby state reference.
* The MRuby state reference. * @return The initialized array
* @return
* The initialized array
*/ */
MRB_API mrb_value mrb_ary_new(mrb_state *mrb); MRB_API mrb_value mrb_ary_new(mrb_state *mrb);
MRB_API mrb_value mrb_ary_new_from_values(mrb_state *mrb, mrb_int size, const mrb_value *vals); MRB_API mrb_value mrb_ary_new_from_values(mrb_state *mrb, mrb_int size, const mrb_value *vals);
MRB_API mrb_value mrb_assoc_new(mrb_state *mrb, mrb_value car, mrb_value cdr); MRB_API mrb_value mrb_assoc_new(mrb_state *mrb, mrb_value car, mrb_value cdr);
MRB_API void mrb_ary_concat(mrb_state*, mrb_value, mrb_value); MRB_API void mrb_ary_concat(mrb_state*, mrb_value, mrb_value);
MRB_API mrb_value mrb_ary_splat(mrb_state*, mrb_value); MRB_API mrb_value mrb_ary_splat(mrb_state*, mrb_value);
/** /*
* Pushes value into array. * Pushes value into array.
* *
* Equivalent to: * Equivalent to:
* *
* ary << value * ary << value
* *
* @param mrb * @param mrb The mruby state reference.
* The MRuby state reference. * @param ary The array in which the value will be pushed
* @param ary * @param value The value to be pushed into array
* The array in which the value will be pushed
* @param value
* The value to be pushed into array
*/ */
MRB_API void mrb_ary_push(mrb_state *mrb, mrb_value array, mrb_value value); MRB_API void mrb_ary_push(mrb_state *mrb, mrb_value array, mrb_value value);
/** /*
* Pops the last element from the array. * Pops the last element from the array.
* *
* Equivalent to: * Equivalent to:
* *
* ary.pop * ary.pop
* *
* @param mrb * @param mrb The mruby state reference.
* The MRuby state reference. * @param ary The array from which the value will be poped.
* @param ary * @return The poped value.
* The array from which the value will be poped.
* @return
* The poped value.
*/ */
MRB_API mrb_value mrb_ary_pop(mrb_state *mrb, mrb_value ary); MRB_API mrb_value mrb_ary_pop(mrb_state *mrb, mrb_value ary);
/** /*
* Returns a reference to an element of the array on the given index. * Returns a reference to an element of the array on the given index.
* *
* Equivalent to: * Equivalent to:
* *
* ary[n] * ary[n]
* *
* @param mrb * @param mrb The mruby state reference.
* The MRuby state reference. * @param ary The target array.
* @param ary * @param n The array index being referenced
* The target array. * @return The referenced value.
* @param n
* The array index being referenced
* @return
* The referenced value.
*/ */
MRB_API mrb_value mrb_ary_ref(mrb_state *mrb, mrb_value ary, mrb_int n); MRB_API mrb_value mrb_ary_ref(mrb_state *mrb, mrb_value ary, mrb_int n);
/** /*
* Sets a value on an array at the given index * Sets a value on an array at the given index
* *
* Equivalent to: * Equivalent to:
* *
* ary[n] = val * ary[n] = val
* *
* @param mrb * @param mrb The mruby state reference.
* The MRuby state reference. * @param ary The target array.
* @param ary * @param n The array index being referenced.
* The target array. * @param val The value being setted.
* @param n
* The array index being referenced.
* @param val
* The value being setted.
*/ */
MRB_API void mrb_ary_set(mrb_state *mrb, mrb_value ary, mrb_int n, mrb_value val); MRB_API void mrb_ary_set(mrb_state *mrb, mrb_value ary, mrb_int n, mrb_value val);
...@@ -149,7 +134,6 @@ mrb_ary_len(mrb_state *mrb, mrb_value ary) ...@@ -149,7 +134,6 @@ mrb_ary_len(mrb_state *mrb, mrb_value ary)
return RARRAY_LEN(ary); return RARRAY_LEN(ary);
} }
/** @} */
MRB_END_DECL MRB_END_DECL
#endif /* MRUBY_ARRAY_H */ #endif /* MRUBY_ARRAY_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment