w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

enum.c
Go to the documentation of this file.
1 /*
2 ** enum.c - Enumerable module
3 **
4 ** See Copyright Notice in mruby.h
5 */
6 
7 #include <mruby.h>
8 #include <mruby/proc.h>
9 
10 /* internal method `__update_hash(oldhash, index, itemhash)` */
11 static mrb_value
13 {
14  mrb_int hash;
15  mrb_int index;
16  mrb_int hv;
17 
18  mrb_get_args(mrb, "iii", &hash, &index, &hv);
19  hash ^= ((uint32_t)hv << (index % 16));
20 
21  return mrb_int_value(mrb, hash);
22 }
23 
24 void
26 {
27  struct RClass *enumerable;
28  enumerable = mrb_define_module(mrb, "Enumerable"); /* 15.3.2 */
29  mrb_define_module_function(mrb, enumerable, "__update_hash", enum_update_hash, MRB_ARGS_REQ(3));
30 }
#define hash
Definition: aptex.h:388
static mrb_value enum_update_hash(mrb_state *mrb, mrb_value self)
Definition: enum.c:12
void mrb_init_enumerable(mrb_state *mrb)
Definition: enum.c:25
mrb_int mrb_get_args(mrb_state *mrb, mrb_args_format format,...)
Definition: class.c:891
#define MRB_ARGS_REQ(n)
Definition: mruby.h:837
#define index(s, c)
Definition: plain2.h:351
#define mrb_define_module(mrb, name)
Definition: scanning.h:20
#define mrb_define_module_function(mrb, c, name, f, s)
Definition: scanning.h:22
#define uint32_t
Definition: stdint.in.h:168
Definition: class.h:17
Definition: mendex.h:20
int32_t mrb_int
Definition: value.h:35
static mrb_value mrb_int_value(struct mrb_state *mrb, mrb_int i)
Definition: value.h:294