[][src]Module mruby_sys::specifiers

Format specifiers for mrb_get_args function

Must be a C string composed of the following format specifiers:

retrieve arguments from mrb_state.

mrb_get_args(mrb, format, ...)

returns number of arguments parsed.

format specifiers:

  string  mruby type     C type                 note
  ----------------------------------------------------------------------------------------------
  o:      Object         `mrb_value`
  C:      class/module   `mrb_value`
  S:      String         `mrb_value`            when ! follows, the value may be nil
  A:      Array          `mrb_value`            when ! follows, the value may be nil
  H:      Hash           `mrb_value`            when ! follows, the value may be nil
  s:      String         `char*`,`mrb_int`      Receive two arguments; s! gives (NULL,0) for nil
  z:      String         `char*`                NUL terminated string; z! gives NULL for nil
  a:      Array          `mrb_value*`,`mrb_int` Receive two arguments; a! gives (NULL,0) for nil
  f:      Float          `mrb_float`
  i:      Integer        `mrb_int`
  b:      Boolean        `mrb_bool`
  n:      Symbol         `mrb_sym`
  d:      Data           `void*`,`mrb_data_type`  2nd argument will be used to check data type so it won't be modified
  I:      Inline struct  `void*`
  &:      Block          `mrb_value`            &! raises exception if no block given
  *:      rest argument  `mrb_value*`,`mrb_int` The rest of the arguments as an array; *! avoid copy of the stack
  |:      optional                              Following arguments are optional
  ?:      optional given `mrb_bool`             true if preceding argument (optional) is given

Constants

ARRAY

Retrieve an Array argument

BLOCK

Retrieve a Block argument.

BLOCK_REQUIRED

Retrieve a Block argument and raise an exception if none is given.

BOOLEAN

Retrieve a Boolean argument.

CARRAY_AND_LEN

Receive two arguments, a C Array of mrb_values and len. Usable like:

CLASS

Retrieve a Class argument

CSTRING

Retrieve a NUL-terminated CString argument

CSTRING_AND_LEN

Retrieve a CString and its length. Usable like:

DATA

Receive two arguments, a void * pointer to data and an mrb_data_type.

FLOAT

Retrieve a Float argument.

FOLLOWING_ARGS_OPTIONAL

The following args specified are optional.

HASH

Retrieve a Hash argument

INLINE_STRUCT

Internal, retrieve a void *.

INTEGER

Retrieve an Integer argument.

MODULE

Retreive a Module argument

NILABLE_ARRAY

Retrieve an Array argument or nil

NILABLE_HASH

Retrieve a Hash argument or nil

NILABLE_STRING

Retrieve a String argument or nil

NULLABLE_CARRAY_AND_LEN

Receive two arguments, a C Array of mrb_values and len. Gives (NULL, 0) for nil. Usable like:

NULLABLE_CSTRING

Retrieve a NUL-terminated CString argument. Gives NULL for nil

NULLABLE_CSTRING_AND_LEN

Retrieve a CString and its length. Gives (NULL, 0) for nil. Usable like:

OBJECT

Could be used to retrieve any type of argument

PREVIOUS_OPTIONAL_ARG_GIVEN

Retrieve a boolean indicating whether the previous optional argument was given.

REST

Retrieve the rest of arguments as an array; Usable like:

REST_NO_COPY

Retrieve the rest of arguments as an array; avoid copy of the stack.

STRING

Retrieve a String argument

SYMBOL

Retrieve a Symbol argument.