ruby: fix vectors of pointers, fix global enum fields

develop
jj 2012-04-13 17:19:53 +02:00
parent 3044da5887
commit bf4bd1f034
2 changed files with 8 additions and 2 deletions

@ -219,9 +219,14 @@ sub render_item_global {
my ($item, $cppvar) = @_; my ($item, $cppvar) = @_;
my $typename = $item->getAttribute('type-name'); my $typename = $item->getAttribute('type-name');
my $rbname = rb_ucase($typename); my $subtype = $item->getAttribute('ld:subtype');
push @lines_rb, "global :$rbname"; if ($subtype and $subtype eq 'enum') {
render_item_number($item, $cppvar);
} else {
my $rbname = rb_ucase($typename);
push @lines_rb, "global :$rbname";
}
} }
sub render_item_number { sub render_item_number {

@ -39,6 +39,7 @@ class Compound < MemStruct
def stl_vector(tglen=nil) def stl_vector(tglen=nil)
tg = yield if tglen tg = yield if tglen
tg = tg._tg if tg.kind_of?(Pointer) # Vector.at(4) already dereferences
case tglen case tglen
when 1; StlVector8.new(tg) when 1; StlVector8.new(tg)
when 2; StlVector16.new(tg) when 2; StlVector16.new(tg)