DEFINITIONS
This source file includes following functions.
- tk_eval_cmd
- tk_s_new
- Init_tkutil
1
2
3
4
5
6
7
8
9
10
11 #include "ruby.h"
12
13 static VALUE
14 tk_eval_cmd(argc, argv)
15 int argc;
16 VALUE argv[];
17 {
18 VALUE cmd, rest;
19
20 rb_scan_args(argc, argv, "1*", &cmd, &rest);
21 return rb_eval_cmd(cmd, rest, 0);
22 }
23
24 static VALUE
25 tk_s_new(argc, argv, klass)
26 int argc;
27 VALUE *argv;
28 VALUE klass;
29 {
30 VALUE obj = rb_class_new_instance(argc, argv, klass);
31
32 if (rb_block_given_p()) rb_obj_instance_eval(0, 0, obj);
33 return obj;
34 }
35
36 void
37 Init_tkutil()
38 {
39 VALUE mTK = rb_define_module("TkUtil");
40 VALUE cTK = rb_define_class("TkKernel", rb_cObject);
41
42 rb_define_singleton_method(mTK, "eval_cmd", tk_eval_cmd, -1);
43
44 rb_define_singleton_method(cTK, "new", tk_s_new, -1);
45 }