diff options
Diffstat (limited to 'ext')
64 files changed, 122 insertions, 33 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index aee4b21567..514ba3fd59 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -6,7 +6,7 @@ $Date$ created at: Thu Mar 31 12:21:29 JST 1994 - Copyright (C) 1993-2001 Yukihiro Matsumoto + Copyright (C) 1993-2007 Yukihiro Matsumoto ************************************************/ diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 480c9ed378..08a6341b70 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -13,7 +13,7 @@ **********************************************************************/ #include "ruby.h" -#include "rubyio.h" +#include "ruby/io.h" #if defined(HAVE_FCNTL_H) || defined(_WIN32) #include <fcntl.h> #elif defined(HAVE_SYS_FCNTL_H) @@ -84,6 +84,18 @@ get_strio(VALUE self) return ptr; } +static VALUE +strio_substr(struct StringIO *ptr, int pos, int len) +{ + VALUE str = ptr->string; + rb_encoding *enc = rb_enc_get(str); + int rlen = RSTRING_LEN(str) - pos; + + if (len > rlen) len = rlen; + if (len < 0) len = 0; + return rb_enc_str_new(RSTRING_PTR(str)+pos, len, enc); +} + #define StringIO(obj) get_strio(obj) #define CLOSED(ptr) (!((ptr)->flags & FMODE_READWRITE)) @@ -603,7 +615,7 @@ strio_each_byte(VALUE self) /* * call-seq: - * strio.getc -> fixnum or nil + * strio.getc -> string or nil * * See IO#getc. */ @@ -611,15 +623,17 @@ static VALUE strio_getc(VALUE self) { struct StringIO *ptr = readable(StringIO(self)); - int c; - char ch; + rb_encoding *enc = rb_enc_get(ptr->string); + int len; + char *p; if (ptr->pos >= RSTRING_LEN(ptr->string)) { return Qnil; } - c = RSTRING_PTR(ptr->string)[ptr->pos++]; - ch = c & 0xff; - return rb_str_new(&ch, 1); + p = RSTRING_PTR(ptr->string)+ptr->pos; + len = rb_enc_mbclen(p, enc); + ptr->pos += len; + return rb_enc_str_new(p, len, rb_enc_get(ptr->string)); } /* @@ -671,30 +685,34 @@ static VALUE strio_ungetc(VALUE self, VALUE c) { struct StringIO *ptr = readable(StringIO(self)); - int cc; - long len, pos = ptr->pos; + long lpos, clen; + char *p, *pend; + rb_encoding *enc; if (NIL_P(c)) return Qnil; if (FIXNUM_P(c)) { - cc = FIX2INT(c); + int cc = FIX2INT(c); + char buf[16]; + + enc = rb_enc_get(ptr->string); + rb_enc_mbcput(cc, buf, enc); + c = rb_enc_str_new(buf, rb_enc_codelen(cc, enc), enc); } else { SafeStringValue(c); - if (RSTRING_LEN(c) > 1) { - rb_warn("IO#ungetc pushes back only one byte"); - } - cc = (unsigned char)RSTRING_PTR(c)[0]; + enc = rb_enc_check(ptr->string, c); } - if (cc != EOF && pos > 0) { - if ((len = RSTRING_LEN(ptr->string)) < pos-- || - (unsigned char)RSTRING_PTR(ptr->string)[pos] != - (unsigned char)cc) { - strio_extend(ptr, pos, 1); - RSTRING_PTR(ptr->string)[pos] = cc; - OBJ_INFECT(ptr->string, self); - } - --ptr->pos; + /* get logical position */ + lpos = 0; p = RSTRING_PTR(ptr->string); pend = p + ptr->pos - 1; + for (;;) { + clen = rb_enc_mbclen(p, enc); + if (p+clen >= pend) break; + p += clen; + lpos++; } + rb_str_update(ptr->string, lpos, ptr->pos ? 1 : 0, c); + ptr->pos = p - RSTRING_PTR(ptr->string); + return Qnil; } @@ -800,7 +818,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr) e = s + limit; } if (NIL_P(str)) { - str = rb_str_substr(ptr->string, ptr->pos, e - s); + str = strio_substr(ptr, ptr->pos, e - s); } else if ((n = RSTRING_LEN(str)) == 0) { p = s; @@ -816,13 +834,13 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr) break; } } - str = rb_str_substr(ptr->string, s - RSTRING_PTR(ptr->string), e - s); + str = strio_substr(ptr, s - RSTRING_PTR(ptr->string), e - s); } else if (n == 1) { if ((p = memchr(s, RSTRING_PTR(str)[0], e - s)) != 0) { e = p + 1; } - str = rb_str_substr(ptr->string, ptr->pos, e - s); + str = strio_substr(ptr, ptr->pos, e - s); } else { if (n < e - s) { @@ -843,7 +861,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr) } } } - str = rb_str_substr(ptr->string, ptr->pos, e - s); + str = strio_substr(ptr, ptr->pos, e - s); } ptr->pos = e - RSTRING_PTR(ptr->string); ptr->lineno++; @@ -944,7 +962,7 @@ strio_write(VALUE self, VALUE str) if (TYPE(str) != T_STRING) str = rb_obj_as_string(str); len = RSTRING_LEN(str); - if (!len) return INT2FIX(0); + if (len == 0) return INT2FIX(0); check_modifiable(ptr); olen = RSTRING_LEN(ptr->string); if (ptr->flags & FMODE_APPEND) { @@ -955,7 +973,8 @@ strio_write(VALUE self, VALUE str) } else { strio_extend(ptr, ptr->pos, len); - rb_str_update(ptr->string, ptr->pos, len, str); + memmove(RSTRING_PTR(ptr->string)+ptr->pos, RSTRING_PTR(str), len); + OBJ_INFECT(ptr->string, str); } OBJ_INFECT(ptr->string, self); ptr->pos += len; @@ -1070,7 +1089,7 @@ strio_read(int argc, VALUE *argv, VALUE self) rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc); } if (NIL_P(str)) { - str = rb_str_substr(ptr->string, ptr->pos, len); + str = strio_substr(ptr, ptr->pos, len); } else { long rest = RSTRING_LEN(ptr->string) - ptr->pos; diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index 63a0f1185e..44cd0f4131 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -10,6 +10,7 @@ #include "ruby/ruby.h" #include "ruby/re.h" +#include "ruby/encoding.h" #define STRSCAN_VERSION "0.7.0" @@ -189,6 +190,7 @@ strscan_initialize(int argc, VALUE *argv, VALUE self) rb_scan_args(argc, argv, "11", &str, &need_dup); StringValue(str); p->str = str; + rb_enc_associate(self, rb_enc_get(str)); return self; } @@ -652,13 +654,14 @@ strscan_getch(VALUE self) { struct strscanner *p; long len; + rb_encoding *enc = rb_enc_get(self); GET_SCANNER(self, p); CLEAR_MATCH_STATUS(p); if (EOS_P(p)) return Qnil; - len = mbclen(*CURPTR(p)); + len = rb_enc_mbclen(CURPTR(p), enc); if (p->curr + len > S_LEN(p)) { len = S_LEN(p) - p->curr; } diff --git a/ext/syck/emitter.c b/ext/syck/emitter.c index 03bdaa2dd7..cadee64789 100644 --- a/ext/syck/emitter.c +++ b/ext/syck/emitter.c @@ -7,7 +7,7 @@ * Copyright (C) 2003 why the lucky stiff * * All Base64 code from Ruby's pack.c. - * Ruby is Copyright (C) 1993-2003 Yukihiro Matsumoto + * Ruby is Copyright (C) 1993-2007 Yukihiro Matsumoto */ #include "ruby/ruby.h" diff --git a/ext/tk/sample/demos-jp/anilabel.rb b/ext/tk/sample/demos-jp/anilabel.rb index 97781fbe77..c6e5c7385b 100644 --- a/ext/tk/sample/demos-jp/anilabel.rb +++ b/ext/tk/sample/demos-jp/anilabel.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # animated label widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/aniwave.rb b/ext/tk/sample/demos-jp/aniwave.rb index 81e2d76b30..5f94add111 100644 --- a/ext/tk/sample/demos-jp/aniwave.rb +++ b/ext/tk/sample/demos-jp/aniwave.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # animated wave demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/arrow.rb b/ext/tk/sample/demos-jp/arrow.rb index 477a0abf6f..43c6eef4eb 100644 --- a/ext/tk/sample/demos-jp/arrow.rb +++ b/ext/tk/sample/demos-jp/arrow.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # arrowhead widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/bind.rb b/ext/tk/sample/demos-jp/bind.rb index e1e23b9893..779e395826 100644 --- a/ext/tk/sample/demos-jp/bind.rb +++ b/ext/tk/sample/demos-jp/bind.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # text (tag bindings) widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/bitmap.rb b/ext/tk/sample/demos-jp/bitmap.rb index b71c67d3fd..4594892c81 100644 --- a/ext/tk/sample/demos-jp/bitmap.rb +++ b/ext/tk/sample/demos-jp/bitmap.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # bitmap widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/button.rb b/ext/tk/sample/demos-jp/button.rb index 20f8cae299..7e9457f5b4 100644 --- a/ext/tk/sample/demos-jp/button.rb +++ b/ext/tk/sample/demos-jp/button.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # button widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/check.rb b/ext/tk/sample/demos-jp/check.rb index be675b9042..7545df80fa 100644 --- a/ext/tk/sample/demos-jp/check.rb +++ b/ext/tk/sample/demos-jp/check.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # checkbutton widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/check2.rb b/ext/tk/sample/demos-jp/check2.rb index f681a4d684..90c6dd736f 100644 --- a/ext/tk/sample/demos-jp/check2.rb +++ b/ext/tk/sample/demos-jp/check2.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # checkbutton widget demo2 (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/clrpick.rb b/ext/tk/sample/demos-jp/clrpick.rb index de8cd80fcd..d81ecebc83 100644 --- a/ext/tk/sample/demos-jp/clrpick.rb +++ b/ext/tk/sample/demos-jp/clrpick.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # widget demo prompts the user to select a color (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/colors.rb b/ext/tk/sample/demos-jp/colors.rb index c6128f9c00..68b40e69f0 100644 --- a/ext/tk/sample/demos-jp/colors.rb +++ b/ext/tk/sample/demos-jp/colors.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # listbox widget demo 'colors' (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/cscroll.rb b/ext/tk/sample/demos-jp/cscroll.rb index 0d6db69af6..0be26133c5 100644 --- a/ext/tk/sample/demos-jp/cscroll.rb +++ b/ext/tk/sample/demos-jp/cscroll.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # simple scrollable canvas widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/ctext.rb b/ext/tk/sample/demos-jp/ctext.rb index 66e1fe8107..35d43febbc 100644 --- a/ext/tk/sample/demos-jp/ctext.rb +++ b/ext/tk/sample/demos-jp/ctext.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # Canvas Text widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/dialog1.rb b/ext/tk/sample/demos-jp/dialog1.rb index 0d6181bfc6..07e50306ab 100644 --- a/ext/tk/sample/demos-jp/dialog1.rb +++ b/ext/tk/sample/demos-jp/dialog1.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # a dialog box with a local grab (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/dialog2.rb b/ext/tk/sample/demos-jp/dialog2.rb index a934378dda..f747f8d6a8 100644 --- a/ext/tk/sample/demos-jp/dialog2.rb +++ b/ext/tk/sample/demos-jp/dialog2.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # a dialog box with a global grab (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/entry1.rb b/ext/tk/sample/demos-jp/entry1.rb index edf3b5f71d..d794282284 100644 --- a/ext/tk/sample/demos-jp/entry1.rb +++ b/ext/tk/sample/demos-jp/entry1.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # entry (no scrollbars) widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/entry2.rb b/ext/tk/sample/demos-jp/entry2.rb index 7d5740e663..528ad6dec4 100644 --- a/ext/tk/sample/demos-jp/entry2.rb +++ b/ext/tk/sample/demos-jp/entry2.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # entry (with scrollbars) widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/entry3.rb b/ext/tk/sample/demos-jp/entry3.rb index f57dc13553..46426af6ae 100644 --- a/ext/tk/sample/demos-jp/entry3.rb +++ b/ext/tk/sample/demos-jp/entry3.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # entry3.rb -- # # This demonstration script creates several entry widgets whose diff --git a/ext/tk/sample/demos-jp/filebox.rb b/ext/tk/sample/demos-jp/filebox.rb index f3608ab70f..04b4810b3b 100644 --- a/ext/tk/sample/demos-jp/filebox.rb +++ b/ext/tk/sample/demos-jp/filebox.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # widget demo prompts the user to select a file (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/floor.rb b/ext/tk/sample/demos-jp/floor.rb index b029580bd6..b7d07bdafa 100644 --- a/ext/tk/sample/demos-jp/floor.rb +++ b/ext/tk/sample/demos-jp/floor.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # floorDisplay widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/floor2.rb b/ext/tk/sample/demos-jp/floor2.rb index a20b31d45c..b7571a592f 100644 --- a/ext/tk/sample/demos-jp/floor2.rb +++ b/ext/tk/sample/demos-jp/floor2.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # floorDisplay widget demo 2 (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/form.rb b/ext/tk/sample/demos-jp/form.rb index fe456d3943..637dd9a8ea 100644 --- a/ext/tk/sample/demos-jp/form.rb +++ b/ext/tk/sample/demos-jp/form.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # form widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/goldberg.rb b/ext/tk/sample/demos-jp/goldberg.rb index 592b69f775..8bf0104c16 100644 --- a/ext/tk/sample/demos-jp/goldberg.rb +++ b/ext/tk/sample/demos-jp/goldberg.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # Ruby/Tk Goldverg demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/hello b/ext/tk/sample/demos-jp/hello index 859ebd950e..08f154d499 100644 --- a/ext/tk/sample/demos-jp/hello +++ b/ext/tk/sample/demos-jp/hello @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# -*- coding: euc-jp -*- require 'tk' TkButton.new(nil, diff --git a/ext/tk/sample/demos-jp/hscale.rb b/ext/tk/sample/demos-jp/hscale.rb index 37d215435c..690479d6d1 100644 --- a/ext/tk/sample/demos-jp/hscale.rb +++ b/ext/tk/sample/demos-jp/hscale.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- require "tkcanvas" if defined?($hscale_demo) && $hscale_deom diff --git a/ext/tk/sample/demos-jp/icon.rb b/ext/tk/sample/demos-jp/icon.rb index e4fef5cae7..26382a57a7 100644 --- a/ext/tk/sample/demos-jp/icon.rb +++ b/ext/tk/sample/demos-jp/icon.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # iconic button widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/image1.rb b/ext/tk/sample/demos-jp/image1.rb index 3d47f844e5..3b56d240dc 100644 --- a/ext/tk/sample/demos-jp/image1.rb +++ b/ext/tk/sample/demos-jp/image1.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # two image widgets demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/image2.rb b/ext/tk/sample/demos-jp/image2.rb index e2e2a2b036..de627448c1 100644 --- a/ext/tk/sample/demos-jp/image2.rb +++ b/ext/tk/sample/demos-jp/image2.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # widget demo 'load image' (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/image3.rb b/ext/tk/sample/demos-jp/image3.rb index d9f378c116..36c1823745 100644 --- a/ext/tk/sample/demos-jp/image3.rb +++ b/ext/tk/sample/demos-jp/image3.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # image3.rb # # This demonstration script creates a simple collection of widgets diff --git a/ext/tk/sample/demos-jp/items.rb b/ext/tk/sample/demos-jp/items.rb index 38774d10d2..d538fac75f 100644 --- a/ext/tk/sample/demos-jp/items.rb +++ b/ext/tk/sample/demos-jp/items.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # canvas item types widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/ixset2 b/ext/tk/sample/demos-jp/ixset2 index 8947daa4b4..5b816e40b1 100644 --- a/ext/tk/sample/demos-jp/ixset2 +++ b/ext/tk/sample/demos-jp/ixset2 @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# -*- coding: euc-jp -*- # # ixset -- # A nice interface to "xset" to change X server settings diff --git a/ext/tk/sample/demos-jp/label.rb b/ext/tk/sample/demos-jp/label.rb index 59626289fc..a1ecc2ec80 100644 --- a/ext/tk/sample/demos-jp/label.rb +++ b/ext/tk/sample/demos-jp/label.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # label widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/labelframe.rb b/ext/tk/sample/demos-jp/labelframe.rb index 23c974dcc2..f16b601ffd 100644 --- a/ext/tk/sample/demos-jp/labelframe.rb +++ b/ext/tk/sample/demos-jp/labelframe.rb @@ -1,3 +1,5 @@ +# -*- coding: euc-jp -*- +# # labelframe.rb # # This demonstration script creates a toplevel window containing diff --git a/ext/tk/sample/demos-jp/menu.rb b/ext/tk/sample/demos-jp/menu.rb index add85f7f7b..6b9e5c9e5e 100644 --- a/ext/tk/sample/demos-jp/menu.rb +++ b/ext/tk/sample/demos-jp/menu.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # menus widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/menu84.rb b/ext/tk/sample/demos-jp/menu84.rb index 8c2a815d78..762cfa53b8 100644 --- a/ext/tk/sample/demos-jp/menu84.rb +++ b/ext/tk/sample/demos-jp/menu84.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # menus widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/menu8x.rb b/ext/tk/sample/demos-jp/menu8x.rb index 050f0decb4..23efa7e790 100644 --- a/ext/tk/sample/demos-jp/menu8x.rb +++ b/ext/tk/sample/demos-jp/menu8x.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # menus widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/menubu.rb b/ext/tk/sample/demos-jp/menubu.rb index aa90a3087f..e73c393aa5 100644 --- a/ext/tk/sample/demos-jp/menubu.rb +++ b/ext/tk/sample/demos-jp/menubu.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- require "tkcanvas" def optionMenu(menubutton, varName, firstValue, *rest) diff --git a/ext/tk/sample/demos-jp/msgbox.rb b/ext/tk/sample/demos-jp/msgbox.rb index 983e6b6589..0fe5db7dd6 100644 --- a/ext/tk/sample/demos-jp/msgbox.rb +++ b/ext/tk/sample/demos-jp/msgbox.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # message boxes widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/paned1.rb b/ext/tk/sample/demos-jp/paned1.rb index 8d16d03c08..137e187417 100644 --- a/ext/tk/sample/demos-jp/paned1.rb +++ b/ext/tk/sample/demos-jp/paned1.rb @@ -1,3 +1,5 @@ +# -*- coding: euc-jp -*- +# # paned1.rb # # This demonstration script creates a toplevel window containing diff --git a/ext/tk/sample/demos-jp/paned2.rb b/ext/tk/sample/demos-jp/paned2.rb index 1e82eddda4..b394432b1c 100644 --- a/ext/tk/sample/demos-jp/paned2.rb +++ b/ext/tk/sample/demos-jp/paned2.rb @@ -1,3 +1,5 @@ +# -*- coding: euc-jp -*- +# # paned2.rb -- # # This demonstration script creates a toplevel window containing diff --git a/ext/tk/sample/demos-jp/pendulum.rb b/ext/tk/sample/demos-jp/pendulum.rb index d703c74d5a..c245136d5c 100644 --- a/ext/tk/sample/demos-jp/pendulum.rb +++ b/ext/tk/sample/demos-jp/pendulum.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # This demonstration illustrates how Tcl/Tk can be used to construct # simulations of physical systems. diff --git a/ext/tk/sample/demos-jp/plot.rb b/ext/tk/sample/demos-jp/plot.rb index 902b144f72..09a3446836 100644 --- a/ext/tk/sample/demos-jp/plot.rb +++ b/ext/tk/sample/demos-jp/plot.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # 2-D plot widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/puzzle.rb b/ext/tk/sample/demos-jp/puzzle.rb index ad69775aab..6a3c8c8ef6 100644 --- a/ext/tk/sample/demos-jp/puzzle.rb +++ b/ext/tk/sample/demos-jp/puzzle.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # widet demo 'puzzle' (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/radio.rb b/ext/tk/sample/demos-jp/radio.rb index 5858b4222a..3a11c394a3 100644 --- a/ext/tk/sample/demos-jp/radio.rb +++ b/ext/tk/sample/demos-jp/radio.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # radiobutton widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/radio2.rb b/ext/tk/sample/demos-jp/radio2.rb index 5ac877d99a..b89520cdc5 100644 --- a/ext/tk/sample/demos-jp/radio2.rb +++ b/ext/tk/sample/demos-jp/radio2.rb @@ -1,3 +1,5 @@ +# -*- coding: euc-jp -*- +# # radio2.rb # # This demonstration script creates a toplevel window containing diff --git a/ext/tk/sample/demos-jp/radio3.rb b/ext/tk/sample/demos-jp/radio3.rb index 6e9a0f750b..a223a19bc2 100644 --- a/ext/tk/sample/demos-jp/radio3.rb +++ b/ext/tk/sample/demos-jp/radio3.rb @@ -1,3 +1,5 @@ +# -*- coding: euc-jp -*- +# # radio3.rb # # This demonstration script creates a toplevel window containing diff --git a/ext/tk/sample/demos-jp/rolodex-j b/ext/tk/sample/demos-jp/rolodex-j index dcc18cfa51..6c3ea7a484 100644 --- a/ext/tk/sample/demos-jp/rolodex-j +++ b/ext/tk/sample/demos-jp/rolodex-j @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# -*- coding: euc-jp -*- # # rolodex -- # このスクリプトは Tom LaStrange の rolodex の一部です。 diff --git a/ext/tk/sample/demos-jp/ruler.rb b/ext/tk/sample/demos-jp/ruler.rb index 94b4c921d3..c913e247d1 100644 --- a/ext/tk/sample/demos-jp/ruler.rb +++ b/ext/tk/sample/demos-jp/ruler.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # ruler widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/sayings.rb b/ext/tk/sample/demos-jp/sayings.rb index ce195a0e53..24b011f5ab 100644 --- a/ext/tk/sample/demos-jp/sayings.rb +++ b/ext/tk/sample/demos-jp/sayings.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # listbox widget demo 'sayings' (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/search.rb b/ext/tk/sample/demos-jp/search.rb index f5268f987f..adb72fd809 100644 --- a/ext/tk/sample/demos-jp/search.rb +++ b/ext/tk/sample/demos-jp/search.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # Text Search widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/spin.rb b/ext/tk/sample/demos-jp/spin.rb index c7b8096723..b8eb99c4ed 100644 --- a/ext/tk/sample/demos-jp/spin.rb +++ b/ext/tk/sample/demos-jp/spin.rb @@ -1,3 +1,5 @@ +# -*- coding: euc-jp -*- +# # spin.rb -- # # This demonstration script creates several spinbox widgets. diff --git a/ext/tk/sample/demos-jp/states.rb b/ext/tk/sample/demos-jp/states.rb index dfae821261..3c58711bd1 100644 --- a/ext/tk/sample/demos-jp/states.rb +++ b/ext/tk/sample/demos-jp/states.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # listbox widget demo 'states' (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/style.rb b/ext/tk/sample/demos-jp/style.rb index 59e406bc80..50855a549a 100644 --- a/ext/tk/sample/demos-jp/style.rb +++ b/ext/tk/sample/demos-jp/style.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # text (display styles) widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/tcolor b/ext/tk/sample/demos-jp/tcolor index c7f7ec7289..17f7e1347e 100644 --- a/ext/tk/sample/demos-jp/tcolor +++ b/ext/tk/sample/demos-jp/tcolor @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# -*- coding: euc-jp -*- # # tcolor -- # このスクリプトはRGB,HSB,CYM形式をサポートする diff --git a/ext/tk/sample/demos-jp/text.rb b/ext/tk/sample/demos-jp/text.rb index 0057d5dbdc..25e0e64e9a 100644 --- a/ext/tk/sample/demos-jp/text.rb +++ b/ext/tk/sample/demos-jp/text.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # text (basic facilities) widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/twind.rb b/ext/tk/sample/demos-jp/twind.rb index 2b228e4acd..166a44cdb2 100644 --- a/ext/tk/sample/demos-jp/twind.rb +++ b/ext/tk/sample/demos-jp/twind.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # text (embedded windows) widget demo (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/twind2.rb b/ext/tk/sample/demos-jp/twind2.rb index b634f07b4b..e8009cef19 100644 --- a/ext/tk/sample/demos-jp/twind2.rb +++ b/ext/tk/sample/demos-jp/twind2.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- # # text (embedded windows) widget demo 2 (called by 'widget') # diff --git a/ext/tk/sample/demos-jp/unicodeout.rb b/ext/tk/sample/demos-jp/unicodeout.rb index 090cdf3059..7ab415fe57 100644 --- a/ext/tk/sample/demos-jp/unicodeout.rb +++ b/ext/tk/sample/demos-jp/unicodeout.rb @@ -1,3 +1,5 @@ +# -*- coding: euc-jp -*- +# # unicodeout.rb -- # # This demonstration script shows how you can produce output (in label diff --git a/ext/tk/sample/demos-jp/vscale.rb b/ext/tk/sample/demos-jp/vscale.rb index 86f6f7cdee..eb0cea250d 100644 --- a/ext/tk/sample/demos-jp/vscale.rb +++ b/ext/tk/sample/demos-jp/vscale.rb @@ -1,3 +1,4 @@ +# -*- coding: euc-jp -*- require "tkcanvas" if defined?($vscale_demo) && $vscale_demo diff --git a/ext/tk/sample/demos-jp/widget b/ext/tk/sample/demos-jp/widget index 11495dda54..b369bfba96 100644 --- a/ext/tk/sample/demos-jp/widget +++ b/ext/tk/sample/demos-jp/widget @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# -*- coding: euc-jp -*- # 漢字コード設定 ( tk.rb のロード時の encoding 推定/設定に使われる ) $KCODE = 'euc' diff --git a/ext/tk/sample/tkextlib/vu/canvSticker2.rb b/ext/tk/sample/tkextlib/vu/canvSticker2.rb index f54e748660..21f098a196 100644 --- a/ext/tk/sample/tkextlib/vu/canvSticker2.rb +++ b/ext/tk/sample/tkextlib/vu/canvSticker2.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# -*- coding: utf-8 -*- require 'tk' require 'tkextlib/vu/charts' |