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



6120
6121
6122
6123
6124
6125
6126
# File 'tcltklib.c', line 6120

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

Sets the attribute encoding

Parameters:

  • value

    the value to set the attribute encoding to.



12
13
14
# File 'sample/demos-en/tkencoding.rb', line 12

def encoding=(value)
  @encoding = value
end

Class Method Details

.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



2907
2908
2909
# File 'lib/tk.rb', line 2907

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

#__invoke__Object



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

alias __invoke__ _invoke

#__toUTF8Object



2906
2907
2908
# File 'lib/tk.rb', line 2906

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

#_cancel_evalObject



7762
7763
7764
# File 'tcltklib.c', line 7762

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

#_cancel_eval_unwindObject



7783
7784
7785
# File 'tcltklib.c', line 7783

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

#_conv_listelementObject



9908
9909
9910
# File 'tcltklib.c', line 9908

static VALUE
lib_conv_listelement(self, src)
VALUE self;

#_create_consoleObject



6599
6600
6601
# File 'tcltklib.c', line 6599

static VALUE
ip_create_console(self)
VALUE self;

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



7558
7559
7560
7561
7562
7563
7564
# File 'tcltklib.c', line 7558

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



8281
8282
8283
# File 'tcltklib.c', line 8281

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

#_get_global_varObject



9598
9599
9600
# File 'tcltklib.c', line 9598

static VALUE
ip_get_global_var(self, varname)
VALUE self;

#_get_global_var2Object



9607
9608
9609
# File 'tcltklib.c', line 9607

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

#_get_variableObject




9375
9376
9377
# File 'tcltklib.c', line 9375

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

#_get_variable2Object



9349
9350
9351
# File 'tcltklib.c', line 9349

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

#_immediate_invokeObject



9241
9242
9243
# File 'tcltklib.c', line 9241

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

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



9232
9233
9234
9235
9236
9237
9238
9239
# File 'tcltklib.c', line 9232

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




10702
10703
10704
# File 'tcltklib.c', line 10702

static VALUE
ip_make_menu_embeddable(interp, menu_path)
VALUE interp;

#_merge_tklistObject



9810
9811
9812
# File 'tcltklib.c', line 9810

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

#_return_valueObject

get return code from Tcl_Eval()



9215
9216
9217
# File 'tcltklib.c', line 9215

static VALUE
ip_retval(self)
VALUE self;

#_set_global_varObject



9617
9618
9619
# File 'tcltklib.c', line 9617

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

#_set_global_var2Object



9627
9628
9629
# File 'tcltklib.c', line 9627

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

#_set_variableObject



9514
9515
9516
# File 'tcltklib.c', line 9514

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

#_set_variable2Object



9485
9486
9487
# File 'tcltklib.c', line 9485

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

#_split_tklistObject




9802
9803
9804
# File 'tcltklib.c', line 9802

static VALUE
ip_split_tklist(self, list_str)
VALUE self;

#_thread_tkwaitObject



5507
5508
5509
# File 'tcltklib.c', line 5507

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

#_thread_vwaitObject



5493
5494
5495
# File 'tcltklib.c', line 5493

static VALUE
ip_thread_vwait(self, var)
VALUE self;

#_toUTF8(str, encoding = nil) ⇒ Object



8079
8080
8081
# File 'tcltklib.c', line 8079

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

#_unset_global_varObject



9638
9639
9640
# File 'tcltklib.c', line 9638

static VALUE
ip_unset_global_var(self, varname)
VALUE self;

#_unset_global_var2Object



9647
9648
9649
# File 'tcltklib.c', line 9647

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

#_unset_variableObject



9589
9590
9591
# File 'tcltklib.c', line 9589

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

#_unset_variable2Object



9563
9564
9565
# File 'tcltklib.c', line 9563

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

#allow_ruby_exit=Object

allow_ruby_exit = mode



6705
6706
6707
# File 'tcltklib.c', line 6705

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

#allow_ruby_exit?Boolean

allow_ruby_exit?

Returns:

  • (Boolean)


6686
6687
6688
# File 'tcltklib.c', line 6686

static VALUE
ip_allow_ruby_exit_p(self)
VALUE self;

#create_dummy_encoding_for_tkObject




10083
10084
10085
# File 'tcltklib.c', line 10083

static VALUE
create_dummy_encoding_for_tk(interp, name)
VALUE interp;

#create_slaveObject



6483
6484
6485
# File 'tcltklib.c', line 6483

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

#default_encoding=(name) ⇒ Object



2880
2881
2882
2883
# File 'lib/tk.rb', line 2880

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



6760
6761
6762
# File 'tcltklib.c', line 6760

static VALUE
ip_delete(self)
VALUE self;

#deleted?Boolean

Returns:

  • (Boolean)


6814
6815
6816
# File 'tcltklib.c', line 6814

static VALUE
ip_is_deleted_p(self)
VALUE self;

#do_one_eventObject



3076
3077
3078
# File 'tcltklib.c', line 3076

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

#encoding_nameObject Also known as: encoding, default_encoding



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

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

#encoding_objObject



2898
2899
2900
2901
2902
2903
2904
# File 'lib/tk.rb', line 2898

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

#encoding_tableObject



10557
10558
10559
# File 'tcltklib.c', line 10557

static VALUE
ip_get_encoding_table(interp)
VALUE interp;

#force_default_encoding=(mode) ⇒ Object



2872
2873
2874
# File 'lib/tk.rb', line 2872

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

#force_default_encoding?Boolean

Returns:

  • (Boolean)


2876
2877
2878
# File 'lib/tk.rb', line 2876

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

#get_eventloop_tickObject



1752
1753
1754
# File 'tcltklib.c', line 1752

static VALUE
ip_get_eventloop_tick(self)
VALUE self;

#get_eventloop_weightObject



1857
1858
1859
# File 'tcltklib.c', line 1857

static VALUE
ip_get_eventloop_weight(self)
VALUE self;

#get_no_event_waitObject



1803
1804
1805
# File 'tcltklib.c', line 1803

static VALUE
ip_get_no_event_wait(self)
VALUE self;

#has_mainwindow?Boolean

Returns:

  • (Boolean)


6844
6845
6846
# File 'tcltklib.c', line 6844

static VALUE
ip_has_mainwindow_p(self)
VALUE self;

#invalid_namespace?Boolean

is deleted?

Returns:

  • (Boolean)


6792
6793
6794
# File 'tcltklib.c', line 6792

static VALUE
ip_has_invalid_namespace_p(self)
VALUE self;

#mainloopObject




2751
2752
2753
# File 'tcltklib.c', line 2751

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

#mainloop_abort_on_exceptionObject



1926
1927
1928
# File 'tcltklib.c', line 1926

static VALUE
ip_evloop_abort_on_exc(self)
VALUE self;

#mainloop_abort_on_exception=Object



1947
1948
1949
# File 'tcltklib.c', line 1947

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

#mainloop_watchdogObject



2880
2881
2882
# File 'tcltklib.c', line 2880

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

#make_safeObject



6652
6653
6654
# File 'tcltklib.c', line 6652

static VALUE
ip_make_safe(self)
VALUE self;

#restartObject



7884
7885
7886
# File 'tcltklib.c', line 7884

static VALUE
ip_restart(self)
VALUE self;

#safe?Boolean

is safe?

Returns:

  • (Boolean)


6667
6668
6669
# File 'tcltklib.c', line 6667

static VALUE
ip_is_safe_p(self)
VALUE self;

#set_eventloop_tickObject



1733
1734
1735
# File 'tcltklib.c', line 1733

static VALUE
ip_set_eventloop_tick(self, tick)
VALUE self;

#set_eventloop_weightObject



1837
1838
1839
# File 'tcltklib.c', line 1837

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

#set_max_block_timeObject



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

static VALUE
set_max_block_time(self, time)
VALUE self;

#set_no_event_waitObject



1784
1785
1786
# File 'tcltklib.c', line 1784

static VALUE
ip_set_no_event_wait(self, wait)
VALUE self;

#slave_of?Boolean

self is slave of master?

Returns:

  • (Boolean)


6517
6518
6519
# File 'tcltklib.c', line 6517

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