summaryrefslogtreecommitdiff
path: root/ext/dl/lib/dl/struct.rb
diff options
context:
space:
mode:
authorttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-09 04:08:22 +0000
committerttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-09 04:08:22 +0000
commitf51bd1d018f16c0da82f05973879e2080d9cc783 (patch)
tree01c0a0622d79e0c4d86cc4dbbaab748015ceea14 /ext/dl/lib/dl/struct.rb
parentf9e069336095b3dbcb6826177d3437f410c9a310 (diff)
Fix the conversion method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/lib/dl/struct.rb')
-rw-r--r--ext/dl/lib/dl/struct.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/dl/lib/dl/struct.rb b/ext/dl/lib/dl/struct.rb
index efa9118c11..2c52d5040d 100644
--- a/ext/dl/lib/dl/struct.rb
+++ b/ext/dl/lib/dl/struct.rb
@@ -32,11 +32,19 @@ module DL
instance_eval [
"def #{name}",
" v = @ptr[\"#{name}\"]",
- " v = @dec[\"#{name}\"].call(v,@len[\"#{name}\"]) if @dec[\"#{name}\"]",
+ " if( @len[\"#{name}\"] )",
+ " v = v.collect{|x| @dec[\"#{name}\"].call(x) if @dec[\"#{name}\"] }",
+ " else",
+ " v = @dec[\"#{name}\"].call(v) if @dec[\"#{name}\"]",
+ " end",
" return v",
"end",
"def #{name}=(v)",
- " v = @enc[\"#{name}\"].call(v,@len[\"#{name}\"]) if @enc[\"#{name}\"]",
+ " if( @len[\"#{name}\"] )",
+ " v = v.collect{|x| @enc[\"#{name}\"].call(x) if @enc[\"#{name}\"] }",
+ " else",
+ " v = @enc[\"#{name}\"].call(v) if @enc[\"#{name}\"]",
+ " end",
" @ptr[\"#{name}\"] = v",
" return v",
"end",