Class: TclTkIp

Inherits:
Object show all
Defined in:
sample/demos-en/tkencoding.rb,
lib/tk.rb,
tcltklib.c,
lib/tk.rb,
lib/tk.rb

Overview

-*- ruby -*-

tkencoding.rb written by [email protected]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Object

initialize interpreter


6168
6169
6170
6171
6172
6173
6174
# File 'tcltklib.c', line 6168

def initialize(*args)
  __initialize__(*args)

  @force_default_encoding ||= TkUtil.untrust([false])
  @encoding ||= TkUtil.untrust([nil])
  def @encoding.to_s; self.join(nil); end
end

Instance Attribute Details

#encoding=(value) ⇒ Object

from tkencoding.rb by [email protected] attr_accessor :encoding


2899
2900
2901
# File 'lib/tk.rb', line 2899

def encoding=(value)
  @encoding = value
end

Class Method Details

.__new__Object


24
# File 'lib/multi-tk.rb', line 24

alias __new__ new

.new(*args) ⇒ Object


27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/multi-tk.rb', line 27

def new(*args)
  if Thread.current.group != ThreadGroup::Default
    raise SecurityError, 'only ThreadGroup::Default can call TclTkIp.new'
  end
  obj = __new__(*args)
  obj.instance_eval{
    @force_default_encoding ||= TkUtil.untrust([false])
    @encoding ||= TkUtil.untrust([nil])
    def @encoding.to_s; self.join(nil); end
  }
  obj
end

.to_sObject


35
# File 'lib/tk.rb', line 35

def @encoding.to_s; self.join(nil); end

Instance Method Details

#__eval__Object


18
# File 'lib/tk.rb', line 18

alias __eval__ _eval

#__fromUTF8Object


2919
2920
2921
# File 'lib/tk.rb', line 2919

static VALUE
ip_fromUTF8(argc, argv, self)
int   argc;

#__invoke__Object


20
# File 'lib/tk.rb', line 20

alias __invoke__ _invoke

#__toUTF8Object


2918
2919
2920
# File 'lib/tk.rb', line 2918

static VALUE
ip_toUTF8(argc, argv, self)
int   argc;

#_cancel_evalObject


7810
7811
7812
# File 'tcltklib.c', line 7810

static VALUE
ip_cancel_eval(argc, argv, self)
int   argc;

#_cancel_eval_unwindObject


7831
7832
7833
# File 'tcltklib.c', line 7831

static VALUE
ip_cancel_eval_unwind(argc, argv, self)
int   argc;

#_conv_listelementObject


9979
9980
9981
# File 'tcltklib.c', line 9979

static VALUE
lib_conv_listelement(self, src)
VALUE self;

#_create_consoleObject


6647
6648
6649
# File 'tcltklib.c', line 6647

static VALUE
ip_create_console(self)
VALUE self;

#_eval(cmd) ⇒ Object Also known as: _eval_with_enc, __eval


7606
7607
7608
7609
7610
7611
7612
# File 'tcltklib.c', line 7606

def _eval(cmd)
  if( @encoding )
    _fromUTF8(__eval(_toUTF8(cmd,@encoding)),@encoding)
  else
    __eval(cmd)
  end
end

#_eval_without_encObject

backup original (without encoding) _eval and _invoke


17
# File 'lib/tk.rb', line 17

alias _eval_without_enc _eval

#_fromUTF8(str, encoding = nil) ⇒ Object


8329
8330
8331
# File 'tcltklib.c', line 8329

static VALUE
ip_fromUTF8(argc, argv, self)
int   argc;

#_get_global_varObject


9669
9670
9671
# File 'tcltklib.c', line 9669

static VALUE
ip_get_global_var(self, varname)
VALUE self;

#_get_global_var2Object


9678
9679
9680
# File 'tcltklib.c', line 9678

static VALUE
ip_get_global_var2(self, varname, index)
VALUE self;

#_get_variableObject



9446
9447
9448
# File 'tcltklib.c', line 9446

static VALUE
ip_get_variable(self, varname, flag)
VALUE self;

#_get_variable2Object


9420
9421
9422
# File 'tcltklib.c', line 9420

static VALUE
ip_get_variable2(self, varname, index, flag)
VALUE self;

#_immediate_invokeObject


9312
9313
9314
# File 'tcltklib.c', line 9312

static VALUE
ip_invoke_immediate(argc, argv, obj)
int argc;

#_invoke(*cmds) ⇒ Object Also known as: _invoke_with_enc, __invoke


9303
9304
9305
9306
9307
9308
9309
9310
# File 'tcltklib.c', line 9303

def _invoke(*cmds)
  if( @encoding )
    cmds = cmds.collect{|cmd| _toUTF8(cmd,@encoding)}
    _fromUTF8(__invoke(*cmds),@encoding)
  else
    __invoke(*cmds)
  end
end

#_invoke_without_encObject


19
# File 'lib/tk.rb', line 19

alias _invoke_without_enc _invoke

#_ip_id_Object


22
23
24
25
# File 'lib/tk.rb', line 22

def _ip_id_
  # for RemoteTkIp
  ''
end

#_make_menu_embeddableObject



10773
10774
10775
# File 'tcltklib.c', line 10773

static VALUE
ip_make_menu_embeddable(interp, menu_path)
VALUE interp;

#_merge_tklistObject


9881
9882
9883
# File 'tcltklib.c', line 9881

static VALUE
lib_merge_tklist(argc, argv, obj)
int argc;

#_return_valueObject

get return code from Tcl_Eval()


9286
9287
9288
# File 'tcltklib.c', line 9286

static VALUE
ip_retval(self)
VALUE self;

#_set_global_varObject


9688
9689
9690
# File 'tcltklib.c', line 9688

static VALUE
ip_set_global_var(self, varname, value)
VALUE self;

#_set_global_var2Object


9698
9699
9700
# File 'tcltklib.c', line 9698

static VALUE
ip_set_global_var2(self, varname, index, value)
VALUE self;

#_set_variableObject


9585
9586
9587
# File 'tcltklib.c', line 9585

static VALUE
ip_set_variable(self, varname, value, flag)
VALUE self;

#_set_variable2Object


9556
9557
9558
# File 'tcltklib.c', line 9556

static VALUE
ip_set_variable2(self, varname, index, value, flag)
VALUE self;

#_split_tklistObject



9873
9874
9875
# File 'tcltklib.c', line 9873

static VALUE
ip_split_tklist(self, list_str)
VALUE self;

#_thread_tkwaitObject


5515
5516
5517
# File 'tcltklib.c', line 5515

static VALUE
ip_thread_tkwait(self, mode, target)
VALUE self;

#_thread_vwaitObject


5501
5502
5503
# File 'tcltklib.c', line 5501

static VALUE
ip_thread_vwait(self, var)
VALUE self;

#_toUTF8(str, encoding = nil) ⇒ Object

without Encoding (Ruby 1.8)


8127
8128
8129
# File 'tcltklib.c', line 8127

static VALUE
ip_toUTF8(argc, argv, self)
int   argc;

#_unset_global_varObject


9709
9710
9711
# File 'tcltklib.c', line 9709

static VALUE
ip_unset_global_var(self, varname)
VALUE self;

#_unset_global_var2Object


9718
9719
9720
# File 'tcltklib.c', line 9718

static VALUE
ip_unset_global_var2(self, varname, index)
VALUE self;

#_unset_variableObject


9660
9661
9662
# File 'tcltklib.c', line 9660

static VALUE
ip_unset_variable(self, varname, flag)
VALUE self;

#_unset_variable2Object


9634
9635
9636
# File 'tcltklib.c', line 9634

static VALUE
ip_unset_variable2(self, varname, index, flag)
VALUE self;

#allow_ruby_exit=Object

allow_ruby_exit = mode


6753
6754
6755
# File 'tcltklib.c', line 6753

static VALUE
ip_allow_ruby_exit_set(self, val)
VALUE self, val;

#allow_ruby_exit?Boolean

allow_ruby_exit?

Returns:

  • (Boolean)

6734
6735
6736
# File 'tcltklib.c', line 6734

static VALUE
ip_allow_ruby_exit_p(self)
VALUE self;

#create_dummy_encoding_for_tkObject



10154
10155
10156
# File 'tcltklib.c', line 10154

static VALUE
create_dummy_encoding_for_tk(interp, name)
VALUE interp;

#create_slaveObject


6531
6532
6533
# File 'tcltklib.c', line 6531

static VALUE
ip_create_slave(argc, argv, self)
int   argc;

#default_encoding=(name) ⇒ Object


2892
2893
2894
2895
# File 'lib/tk.rb', line 2892

def default_encoding=(name)
  name = name.name if Tk::WITH_ENCODING && name.kind_of?(::Encoding)
  @encoding[0] = name.to_s.dup
end

#deleteObject

delete interpreter


6808
6809
6810
# File 'tcltklib.c', line 6808

static VALUE
ip_delete(self)
VALUE self;

#deleted?Boolean

Returns:

  • (Boolean)

6862
6863
6864
# File 'tcltklib.c', line 6862

static VALUE
ip_is_deleted_p(self)
VALUE self;

#do_one_eventObject


3084
3085
3086
# File 'tcltklib.c', line 3084

static VALUE
ip_do_one_event(argc, argv, self)
int   argc;

#encoding_nameObject Also known as: encoding, default_encoding


2904
2905
2906
# File 'lib/tk.rb', line 2904

def encoding_name
  (@encoding[0])? @encoding[0].dup: nil
end

#encoding_objObject


2910
2911
2912
2913
2914
2915
2916
# File 'lib/tk.rb', line 2910

def encoding_obj
  if Tk::WITH_ENCODING
    Tk::Encoding.tcl2rb_encoding(@encoding[0])
  else
    (@encoding[0])? @encoding[0].dup: nil
  end
end

#encoding_tableObject


10628
10629
10630
# File 'tcltklib.c', line 10628

static VALUE
ip_get_encoding_table(interp)
VALUE interp;

#force_default_encoding=(mode) ⇒ Object


2884
2885
2886
# File 'lib/tk.rb', line 2884

def force_default_encoding=(mode)
  @force_default_encoding[0] = (mode)? true: false
end

#force_default_encoding?Boolean

Returns:

  • (Boolean)

2888
2889
2890
# File 'lib/tk.rb', line 2888

def force_default_encoding?
  @force_default_encoding[0] ||= false
end

#get_eventloop_tickObject


1760
1761
1762
# File 'tcltklib.c', line 1760

static VALUE
ip_get_eventloop_tick(self)
VALUE self;

#get_eventloop_weightObject


1865
1866
1867
# File 'tcltklib.c', line 1865

static VALUE
ip_get_eventloop_weight(self)
VALUE self;

#get_no_event_waitObject


1811
1812
1813
# File 'tcltklib.c', line 1811

static VALUE
ip_get_no_event_wait(self)
VALUE self;

#has_mainwindow?Boolean

Returns:

  • (Boolean)

6892
6893
6894
# File 'tcltklib.c', line 6892

static VALUE
ip_has_mainwindow_p(self)
VALUE self;

#invalid_namespace?Boolean

is deleted?

Returns:

  • (Boolean)

6840
6841
6842
# File 'tcltklib.c', line 6840

static VALUE
ip_has_invalid_namespace_p(self)
VALUE self;

#mainloopObject



2759
2760
2761
# File 'tcltklib.c', line 2759

static VALUE
ip_mainloop(argc, argv, self)
int   argc;

#mainloop_abort_on_exceptionObject


1934
1935
1936
# File 'tcltklib.c', line 1934

static VALUE
ip_evloop_abort_on_exc(self)
VALUE self;

#mainloop_abort_on_exception=Object


1955
1956
1957
# File 'tcltklib.c', line 1955

static VALUE
ip_evloop_abort_on_exc_set(self, val)
VALUE self, val;

#mainloop_watchdogObject


2888
2889
2890
# File 'tcltklib.c', line 2888

static VALUE
ip_mainloop_watchdog(argc, argv, self)
int   argc;

#make_safeObject


6700
6701
6702
# File 'tcltklib.c', line 6700

static VALUE
ip_make_safe(self)
VALUE self;

#restartObject


7932
7933
7934
# File 'tcltklib.c', line 7932

static VALUE
ip_restart(self)
VALUE self;

#safe?Boolean

is safe?

Returns:

  • (Boolean)

6715
6716
6717
# File 'tcltklib.c', line 6715

static VALUE
ip_is_safe_p(self)
VALUE self;

#set_eventloop_tickObject


1741
1742
1743
# File 'tcltklib.c', line 1741

static VALUE
ip_set_eventloop_tick(self, tick)
VALUE self;

#set_eventloop_weightObject


1845
1846
1847
# File 'tcltklib.c', line 1845

static VALUE
ip_set_eventloop_weight(self, loop_max, no_event)
VALUE self;

#set_max_block_timeObject


1872
1873
1874
# File 'tcltklib.c', line 1872

static VALUE
set_max_block_time(self, time)
VALUE self;

#set_no_event_waitObject


1792
1793
1794
# File 'tcltklib.c', line 1792

static VALUE
ip_set_no_event_wait(self, wait)
VALUE self;

#slave_of?Boolean

self is slave of master?

Returns:

  • (Boolean)

6565
6566
6567
# File 'tcltklib.c', line 6565

static VALUE
ip_is_slave_of_p(self, master)
VALUE self, master;