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



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

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



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

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

#_cancel_eval_unwindObject



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

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

#_conv_listelementObject



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

static VALUE
lib_conv_listelement(self, src)
VALUE self;

#_create_consoleObject



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

static VALUE
ip_create_console(self)
VALUE self;

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



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

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



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

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

#_get_global_varObject



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

static VALUE
ip_get_global_var(self, varname)
VALUE self;

#_get_global_var2Object



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

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

#_get_variableObject




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

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

#_get_variable2Object



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

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

#_immediate_invokeObject



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

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

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



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

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




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

static VALUE
ip_make_menu_embeddable(interp, menu_path)
VALUE interp;

#_merge_tklistObject



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

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

#_return_valueObject

get return code from Tcl_Eval()



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

static VALUE
ip_retval(self)
VALUE self;

#_set_global_varObject



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

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

#_set_global_var2Object



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

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

#_set_variableObject



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

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

#_set_variable2Object



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

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

#_split_tklistObject




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

static VALUE
ip_split_tklist(self, list_str)
VALUE self;

#_thread_tkwaitObject



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

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

#_thread_vwaitObject



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

static VALUE
ip_thread_vwait(self, var)
VALUE self;

#_toUTF8(str, encoding = nil) ⇒ Object



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

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

#_unset_global_varObject



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

static VALUE
ip_unset_global_var(self, varname)
VALUE self;

#_unset_global_var2Object



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

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

#_unset_variableObject



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

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

#_unset_variable2Object



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

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

#allow_ruby_exit=Object

allow_ruby_exit = mode



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

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

#allow_ruby_exit?Boolean

allow_ruby_exit?

Returns:

  • (Boolean)


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

static VALUE
ip_allow_ruby_exit_p(self)
VALUE self;

#create_dummy_encoding_for_tkObject




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

static VALUE
create_dummy_encoding_for_tk(interp, name)
VALUE interp;

#create_slaveObject



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

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



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

static VALUE
ip_delete(self)
VALUE self;

#deleted?Boolean

Returns:

  • (Boolean)


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

static VALUE
ip_is_deleted_p(self)
VALUE self;

#do_one_eventObject



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

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



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

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



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

static VALUE
ip_get_eventloop_tick(self)
VALUE self;

#get_eventloop_weightObject



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

static VALUE
ip_get_eventloop_weight(self)
VALUE self;

#get_no_event_waitObject



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

static VALUE
ip_get_no_event_wait(self)
VALUE self;

#has_mainwindow?Boolean

Returns:

  • (Boolean)


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

static VALUE
ip_has_mainwindow_p(self)
VALUE self;

#invalid_namespace?Boolean

is deleted?

Returns:

  • (Boolean)


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

static VALUE
ip_has_invalid_namespace_p(self)
VALUE self;

#mainloopObject




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

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

#mainloop_abort_on_exceptionObject



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

static VALUE
ip_evloop_abort_on_exc(self)
VALUE self;

#mainloop_abort_on_exception=Object



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

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

#mainloop_watchdogObject



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

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

#make_safeObject



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

static VALUE
ip_make_safe(self)
VALUE self;

#restartObject



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

static VALUE
ip_restart(self)
VALUE self;

#safe?Boolean

is safe?

Returns:

  • (Boolean)


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

static VALUE
ip_is_safe_p(self)
VALUE self;

#set_eventloop_tickObject



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

static VALUE
ip_set_eventloop_tick(self, tick)
VALUE self;

#set_eventloop_weightObject



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

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

#set_max_block_timeObject



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

static VALUE
set_max_block_time(self, time)
VALUE self;

#set_no_event_waitObject



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

static VALUE
ip_set_no_event_wait(self, wait)
VALUE self;

#slave_of?Boolean

self is slave of master?

Returns:

  • (Boolean)


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

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