diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-04-10 05:48:43 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-04-10 05:48:43 +0000 |
commit | 7194267b3bdf68ad75bd6bee8e7c6377f7b0ea2f (patch) | |
tree | 6dcd08ef584fc777cf34517136d5ce3948840e45 /ext | |
parent | be72d9a5da9be284d2bdb8047e50f14e014b7835 (diff) |
2000-04-10
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/dbm/dbm.c | 2 | ||||
-rw-r--r-- | ext/extmk.rb.in | 4 | ||||
-rw-r--r-- | ext/gdbm/gdbm.c | 2 | ||||
-rw-r--r-- | ext/tk/lib/tktext.rb | 182 |
4 files changed, 96 insertions, 94 deletions
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c index 5377b4b6e3..66b41d03c1 100644 --- a/ext/dbm/dbm.c +++ b/ext/dbm/dbm.c @@ -262,7 +262,7 @@ fdbm_invert(obj) valstr = rb_tainted_str_new(val.dptr, val.dsize); rb_hash_aset(hash, valstr, keystr); } - return obj; + return hash; } static VALUE diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index cae02d576f..4336fdb51f 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -329,8 +329,8 @@ def create_makefile(target) $DLDFLAGS = '@DLDFLAGS@' - if RUBY_PLATFORM =~ /beos/ - $libs = $libs + " -lruby" + if RUBY_PLATFORM =~ /beos/ and not $static + $libs = $libs + " @LIBRUBYARG@" $DLDFLAGS = $DLDFLAGS + " -L" + $topdir end diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c index 3bf9669543..3c1ef88adf 100644 --- a/ext/gdbm/gdbm.c +++ b/ext/gdbm/gdbm.c @@ -260,7 +260,7 @@ fgdbm_invert(obj) valstr = rb_tainted_str_new(val.dptr, val.dsize); rb_hash_aset(hash, valstr, keystr); } - return obj; + return hash; } static VALUE diff --git a/ext/tk/lib/tktext.rb b/ext/tk/lib/tktext.rb index 9e38db5032..2dea68980c 100644 --- a/ext/tk/lib/tktext.rb +++ b/ext/tk/lib/tktext.rb @@ -427,6 +427,98 @@ class TkText<TkTextWin def rsearch(pat,start,stop=None) rsearch_with_length(pat,start,stop)[0] end + + def _dump(type, *index) + str = tk_send('dump', type, *index) + result = [] + sel = nil + i = 0 + while i < str.size + # retrieve key + idx = str.index(/ /, i) + result.push str[i..(idx-1)] + i = idx + 1 + + # retrieve value + case result[-1] + when 'text' + if str[i] == ?{ + # text formed as {...} + val, i = _retrieve_braced_text(str, i) + result.push val + else + # text which may contain backslahes + val, i = _retrieve_backslashed_text(str, i) + result.push val + end + else + idx = str.index(/ /, i) + val = str[i..(idx-1)] + case result[-1] + when 'mark' + case val + when 'insert' + result.push TkTextMarkInsert.new(self) + when 'current' + result.push TkTextMarkCurrent.new(self) + when 'anchor' + result.push TkTextMarkAnchor.new(self) + else + result.push tk_tcl2rb(val) + end + when 'tagon' + if val == 'sel' + if sel + result.push sel + else + result.push TkTextTagSel.new(self) + end + else + result.push tk_tcl2rb val + end + when 'tagoff' + result.push tk_tcl2rb sel + when 'window' + result.push tk_tcl2rb val + end + i = idx + 1 + end + + # retrieve index + idx = str.index(/ /, i) + if idx + result.push str[i..(idx-1)] + i = idx + 1 + else + result.push str[i..-1] + break + end + end + + kvis = [] + until result.empty? + kvis.push [result.shift, result.shift, result.shift] + end + kvis # result is [[key1, value1, index1], [key2, value2, index2], ...] + end + private :_dump + + def dump_all(*index) + _dump('-all', *index) + end + def dump_mark(*index) + _dump('-mark', *index) + end + def dump_tag(*index) + _dump('-tag', *index) + end + def dump_text(*index) + _dump('-text', *index) + end + def dump_window(*index) + _dump('-window', *index) + end + end class TkTextTag<TkObject @@ -739,81 +831,6 @@ class TkTextWindow<TkObject end end - def _dump(type, *index) - str = tk_send('dump', type, *index) - result = [] - sel = nil - i = 0 - while i < str.size - # retrieve key - idx = str.index(/ /, i) - result.push str[i..(idx-1)] - i = idx + 1 - - # retrieve value - case result[-1] - when 'text' - if str[i] == ?{ - # text formed as {...} - val, i = _retrieve_braced_text(str, i) - result.push val - else - # text which may contain backslahes - val, i = _retrieve_backslashed_text(str, i) - result.push val - end - else - idx = str.index(/ /, i) - val = str[i..(idx-1)] - case result[-1] - when 'mark' - case val - when 'insert' - result.push TkTextMarkInsert.new(self) - when 'current' - result.push TkTextMarkCurrent.new(self) - when 'anchor' - result.push TkTextMarkAnchor.new(self) - else - result.push tk_tcl2rb(val) - end - when 'tagon' - if val == 'sel' - if sel - result.push sel - else - result.push TkTextTagSel.new(self) - end - else - result.push tk_tcl2rb val - end - when 'tagoff' - result.push tk_tcl2rb sel - when 'window' - result.push tk_tcl2rb val - end - i = idx + 1 - end - - # retrieve index - idx = str.index(/ /, i) - if idx - result.push str[i..(idx-1)] - i = idx + 1 - else - result.push str[i..-1] - break - end - end - - kvis = [] - until result.empty? - kvis.push [result.shift, result.shift, result.shift] - end - kvis # result is [[key1, value1, index1], [key2, value2, index2], ...] - end - private :_dump - def _retrieve_braced_text(str, i) cnt = 0 idx = i @@ -850,21 +867,6 @@ class TkTextWindow<TkObject end private :_retrieve_backslashed_text - def dump_all(*index) - _dump('-all', *index) - end - def dump_mark(*index) - _dump('-mark', *index) - end - def dump_tag(*index) - _dump('-tag', *index) - end - def dump_text(*index) - _dump('-text', *index) - end - def dump_window(*index) - _dump('-window', *index) - end end class TkTextImage<TkObject |