Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
proc.h
Go to the documentation of this file.
1 /*
2 ** mruby/proc.h - Proc class
3 **
4 ** See Copyright Notice in mruby.h
5 */
6 
7 #ifndef MRUBY_PROC_H
8 #define MRUBY_PROC_H
9 
10 #include "mruby/irep.h"
11 
12 #if defined(__cplusplus)
13 extern "C" {
14 #endif
15 
16 struct REnv {
20  int cioff;
21 };
22 
23 struct RProc {
25  union {
28  } body;
30  struct REnv *env;
31 };
32 
33 /* aspec access */
34 #define MRB_ASPEC_REQ(a) (((a) >> 18) & 0x1f)
35 #define MRB_ASPEC_OPT(a) (((a) >> 13) & 0x1f)
36 #define MRB_ASPEC_REST(a) ((a) & (1<<12))
37 #define MRB_ASPEC_POST(a) (((a) >> 7) & 0x1f)
38 #define MRB_ASPEC_KEY(a) (((a) >> 2) & 0x1f)
39 #define MRB_ASPEC_KDICT(a) ((a) & (1<<1))
40 #define MRB_ASPEC_BLOCK(a) ((a) & 1)
41 
42 #define MRB_PROC_CFUNC 128
43 #define MRB_PROC_CFUNC_P(p) (((p)->flags & MRB_PROC_CFUNC) != 0)
44 #define MRB_PROC_STRICT 256
45 #define MRB_PROC_STRICT_P(p) (((p)->flags & MRB_PROC_STRICT) != 0)
46 
47 #define mrb_proc_ptr(v) ((struct RProc*)(mrb_ptr(v)))
48 
52 struct RProc *mrb_closure_new_cfunc(mrb_state *mrb, mrb_func_t func, int nlocals);
53 void mrb_proc_copy(struct RProc *a, struct RProc *b);
54 
55 #include "mruby/khash.h"
56 KHASH_DECLARE(mt, mrb_sym, struct RProc*, 1)
57 
58 #if defined(__cplusplus)
59 } /* extern "C" { */
60 #endif
61 
62 #endif /* MRUBY_PROC_H */