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

frozen_string_literal: false -*- 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


6128
6129
6130
6131
6132
6133
6134
# File 'tcltklib.c', line 6128

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


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

def encoding=(value)
  @encoding = value
end

Class Method Details

.__new__Object


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

alias __new__ new

.new(*args) ⇒ Object


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

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


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

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

Instance Method Details

#__eval__Object


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

alias __eval__ _eval

#__fromUTF8Object


2909
2910
2911
# File 'lib/tk.rb', line 2909

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

#__invoke__Object


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

alias __invoke__ _invoke

#__toUTF8Object


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

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

#_cancel_evalObject


7770
7771
7772
# File 'tcltklib.c', line 7770

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

#_cancel_eval_unwindObject


7791
7792
7793
# File 'tcltklib.c', line 7791

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

#_conv_listelementObject


9936
9937
9938
# File 'tcltklib.c', line 9936

static VALUE
lib_conv_listelement(self, src)
VALUE self;

#_create_consoleObject


6606
6607
6608
# File 'tcltklib.c', line 6606

static VALUE
ip_create_console(self)
VALUE self;

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


7565
7566
7567
7568
7569
7570
7571
# File 'tcltklib.c', line 7565

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


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

alias _eval_without_enc _eval

#_fromUTF8(str, encoding = nil) ⇒ Object


8289
8290
8291
# File 'tcltklib.c', line 8289

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

#_get_global_varObject


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

static VALUE
ip_get_global_var(self, varname)
VALUE self;

#_get_global_var2Object


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

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

#_get_variableObject



9403
9404
9405
# File 'tcltklib.c', line 9403

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

#_get_variable2Object


9377
9378
9379
# File 'tcltklib.c', line 9377

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

#_immediate_invokeObject


9269
9270
9271
# File 'tcltklib.c', line 9269

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

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


9260
9261
9262
9263
9264
9265
9266
9267
# File 'tcltklib.c', line 9260

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

#_invoke_without_encObject


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

alias _invoke_without_enc _invoke

#_ip_id_Object


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

def _ip_id_
  # for RemoteTkIp
  ''
end

#_make_menu_embeddableObject



10730
10731
10732
# File 'tcltklib.c', line 10730

static VALUE
ip_make_menu_embeddable(interp, menu_path)
VALUE interp;

#_merge_tklistObject


9838
9839
9840
# File 'tcltklib.c', line 9838

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

#_return_valueObject

get return code from Tcl_Eval()


9243
9244
9245
# File 'tcltklib.c', line 9243

static VALUE
ip_retval(self)
VALUE self;

#_set_global_varObject


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

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

#_set_global_var2Object


9655
9656
9657
# File 'tcltklib.c', line 9655

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

#_set_variableObject


9542
9543
9544
# File 'tcltklib.c', line 9542

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

#_set_variable2Object


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

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

#_split_tklistObject



9830
9831
9832
# File 'tcltklib.c', line 9830

static VALUE
ip_split_tklist(self, list_str)
VALUE self;

#_thread_tkwaitObject


5475
5476
5477
# File 'tcltklib.c', line 5475

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

#_thread_vwaitObject


5461
5462
5463
# File 'tcltklib.c', line 5461

static VALUE
ip_thread_vwait(self, var)
VALUE self;

#_toUTF8(str, encoding = nil) ⇒ Object

without Encoding (Ruby 1.8)


8087
8088
8089
# File 'tcltklib.c', line 8087

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

#_unset_global_varObject


9666
9667
9668
# File 'tcltklib.c', line 9666

static VALUE
ip_unset_global_var(self, varname)
VALUE self;

#_unset_global_var2Object


9675
9676
9677
# File 'tcltklib.c', line 9675

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

#_unset_variableObject


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

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

#_unset_variable2Object


9591
9592
9593
# File 'tcltklib.c', line 9591

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

#allow_ruby_exit=Object

allow_ruby_exit = mode


6712
6713
6714
# File 'tcltklib.c', line 6712

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

#allow_ruby_exit?Boolean

allow_ruby_exit?

Returns:

  • (Boolean)

6693
6694
6695
# File 'tcltklib.c', line 6693

static VALUE
ip_allow_ruby_exit_p(self)
VALUE self;

#create_dummy_encoding_for_tkObject



10111
10112
10113
# File 'tcltklib.c', line 10111

static VALUE
create_dummy_encoding_for_tk(interp, name)
VALUE interp;

#create_slaveObject


6490
6491
6492
# File 'tcltklib.c', line 6490

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

#default_encoding=(name) ⇒ Object


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

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


6767
6768
6769
# File 'tcltklib.c', line 6767

static VALUE
ip_delete(self)
VALUE self;

#deleted?Boolean

Returns:

  • (Boolean)

6821
6822
6823
# File 'tcltklib.c', line 6821

static VALUE
ip_is_deleted_p(self)
VALUE self;

#do_one_eventObject


3097
3098
3099
# File 'tcltklib.c', line 3097

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

#encoding_nameObject Also known as: encoding, default_encoding


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

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

#encoding_objObject


2900
2901
2902
2903
2904
2905
2906
# File 'lib/tk.rb', line 2900

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

#encoding_tableObject


10585
10586
10587
# File 'tcltklib.c', line 10585

static VALUE
ip_get_encoding_table(interp)
VALUE interp;

#force_default_encoding=(mode) ⇒ Object


2874
2875
2876
# File 'lib/tk.rb', line 2874

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

#force_default_encoding?Boolean

Returns:

  • (Boolean)

2878
2879
2880
# File 'lib/tk.rb', line 2878

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

#get_eventloop_tickObject


1773
1774
1775
# File 'tcltklib.c', line 1773

static VALUE
ip_get_eventloop_tick(self)
VALUE self;

#get_eventloop_weightObject


1878
1879
1880
# File 'tcltklib.c', line 1878

static VALUE
ip_get_eventloop_weight(self)
VALUE self;

#get_no_event_waitObject


1824
1825
1826
# File 'tcltklib.c', line 1824

static VALUE
ip_get_no_event_wait(self)
VALUE self;

#has_mainwindow?Boolean

Returns:

  • (Boolean)

6851
6852
6853
# File 'tcltklib.c', line 6851

static VALUE
ip_has_mainwindow_p(self)
VALUE self;

#invalid_namespace?Boolean

is deleted?

Returns:

  • (Boolean)

6799
6800
6801
# File 'tcltklib.c', line 6799

static VALUE
ip_has_invalid_namespace_p(self)
VALUE self;

#mainloopObject



2772
2773
2774
# File 'tcltklib.c', line 2772

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

#mainloop_abort_on_exceptionObject


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

static VALUE
ip_evloop_abort_on_exc(self)
VALUE self;

#mainloop_abort_on_exception=Object


1968
1969
1970
# File 'tcltklib.c', line 1968

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

#mainloop_watchdogObject


2901
2902
2903
# File 'tcltklib.c', line 2901

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

#make_safeObject


6659
6660
6661
# File 'tcltklib.c', line 6659

static VALUE
ip_make_safe(self)
VALUE self;

#restartObject


7892
7893
7894
# File 'tcltklib.c', line 7892

static VALUE
ip_restart(self)
VALUE self;

#safe?Boolean

is safe?

Returns:

  • (Boolean)

6674
6675
6676
# File 'tcltklib.c', line 6674

static VALUE
ip_is_safe_p(self)
VALUE self;

#set_eventloop_tickObject


1754
1755
1756
# File 'tcltklib.c', line 1754

static VALUE
ip_set_eventloop_tick(self, tick)
VALUE self;

#set_eventloop_weightObject


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

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

#set_max_block_timeObject


1885
1886
1887
# File 'tcltklib.c', line 1885

static VALUE
set_max_block_time(self, time)
VALUE self;

#set_no_event_waitObject


1805
1806
1807
# File 'tcltklib.c', line 1805

static VALUE
ip_set_no_event_wait(self, wait)
VALUE self;

#slave_of?Boolean

self is slave of master?

Returns:

  • (Boolean)

6524
6525
6526
# File 'tcltklib.c', line 6524

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