ext/tk/tkutil.c


DEFINITIONS

This source file includes following functions.
  1. tk_eval_cmd
  2. tk_s_new
  3. Init_tkutil


   1  /************************************************
   2  
   3    tk.c -
   4  
   5    $Author: matz $
   6    $Date: 2001/11/13 08:53:15 $
   7    created at: Fri Nov  3 00:47:54 JST 1995
   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  }