Groonga 3.0.9 Source Code Document
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
groonga
vendor
mruby-eeac4be
mrbgems
mruby-numeric-ext
src
numeric_ext.c
Go to the documentation of this file.
1
#include <limits.h>
2
#include "
mruby.h
"
3
#include "
mruby/numeric.h
"
4
5
static
mrb_value
6
mrb_int_chr(
mrb_state
*mrb,
mrb_value
x)
7
{
8
mrb_int
chr;
9
char
c;
10
11
chr =
mrb_fixnum
(x);
12
if
(chr >= (1 << CHAR_BIT)) {
13
mrb_raisef
(mrb,
E_RANGE_ERROR
,
"%S out of char range"
, x);
14
}
15
c = (char)chr;
16
17
return
mrb_str_new
(mrb, &c, 1);
18
}
19
20
void
21
mrb_mruby_numeric_ext_gem_init
(
mrb_state
* mrb)
22
{
23
struct
RClass
*
i
=
mrb_class_get
(mrb,
"Integer"
);
24
25
mrb_define_method
(mrb, i,
"chr"
, mrb_int_chr,
MRB_ARGS_NONE
());
26
}
27
28
void
29
mrb_mruby_numeric_ext_gem_final
(
mrb_state
* mrb)
30
{
31
}
Generated on Sun Nov 10 2013 09:49:05 for Groonga 3.0.9 Source Code Document by
1.8.1.2