|
|
@ -261,8 +261,7 @@ sub render_struct_fields {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
push @lines_rb, "}";
|
|
|
|
push @lines_rb, "}";
|
|
|
|
|
|
|
|
|
|
|
|
my $reftg = $field->getAttribute('ref-target');
|
|
|
|
render_struct_field_refs($type, $field, $name);
|
|
|
|
render_field_reftarget($type, $field, $name, $reftg) if ($reftg);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -270,6 +269,24 @@ sub render_struct_fields {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# handle generating accessor for xml attributes ref-target, refers-to etc
|
|
|
|
|
|
|
|
sub render_struct_field_refs {
|
|
|
|
|
|
|
|
my ($parent, $field, $name) = @_;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $reftg = $field->getAttribute('ref-target');
|
|
|
|
|
|
|
|
render_field_reftarget($parent, $field, $name, $reftg) if ($reftg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $refto = $field->getAttribute('refers-to');
|
|
|
|
|
|
|
|
render_field_refto($parent, $name, $refto) if ($refto);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $meta = $field->getAttribute('ld:meta');
|
|
|
|
|
|
|
|
my $item = $field->findnodes('child::ld:item')->[0];
|
|
|
|
|
|
|
|
if ($meta and $meta eq 'container' and $item) {
|
|
|
|
|
|
|
|
my $itemreftg = $item->getAttribute('ref-target');
|
|
|
|
|
|
|
|
render_container_reftarget($parent, $item, $name, $itemreftg) if $itemreftg;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub render_field_reftarget {
|
|
|
|
sub render_field_reftarget {
|
|
|
|
my ($parent, $field, $name, $reftg) = @_;
|
|
|
|
my ($parent, $field, $name, $reftg) = @_;
|
|
|
|
|
|
|
|
|
|
|
@ -280,20 +297,52 @@ sub render_field_reftarget {
|
|
|
|
return if (!$tg);
|
|
|
|
return if (!$tg);
|
|
|
|
my $tgvec = $tg->getAttribute('instance-vector');
|
|
|
|
my $tgvec = $tg->getAttribute('instance-vector');
|
|
|
|
return if (!$tgvec);
|
|
|
|
return if (!$tgvec);
|
|
|
|
$tgvec =~ s/\$global/df/;
|
|
|
|
|
|
|
|
|
|
|
|
render_field_refto($parent, $name, $tgvec);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub render_field_refto {
|
|
|
|
|
|
|
|
my ($parent, $name, $tgvec) = @_;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tgvec =~ s/^\$global/df/;
|
|
|
|
|
|
|
|
$tgvec =~ s/\[\$\]$//;
|
|
|
|
return if $tgvec !~ /^[\w\.]+$/;
|
|
|
|
return if $tgvec !~ /^[\w\.]+$/;
|
|
|
|
|
|
|
|
|
|
|
|
my $tgname = "${name}_tg";
|
|
|
|
my $tgname = "${name}_tg";
|
|
|
|
$tgname =~ s/_id_tg//;
|
|
|
|
$tgname =~ s/_id(.?.?)_tg/_tg$1/;
|
|
|
|
|
|
|
|
|
|
|
|
for my $otherfield ($parent->findnodes('child::ld:field')) {
|
|
|
|
for my $othername (map { $_->getAttribute('name') } $parent->findnodes('child::ld:field')) {
|
|
|
|
my $othername = $otherfield->getAttribute('name');
|
|
|
|
|
|
|
|
$tgname .= '_' if ($othername and $tgname eq $othername);
|
|
|
|
$tgname .= '_' if ($othername and $tgname eq $othername);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
push @lines_rb, "def $tgname ; ${tgvec}[$name] ; end";
|
|
|
|
push @lines_rb, "def $tgname ; ${tgvec}[$name] ; end";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub render_container_reftarget {
|
|
|
|
|
|
|
|
my ($parent, $item, $name, $reftg) = @_;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $aux = $item->getAttribute('aux-value');
|
|
|
|
|
|
|
|
return if ($aux); # TODO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $tg = $global_types{$reftg};
|
|
|
|
|
|
|
|
return if (!$tg);
|
|
|
|
|
|
|
|
my $tgvec = $tg->getAttribute('instance-vector');
|
|
|
|
|
|
|
|
return if (!$tgvec);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tgvec =~ s/^\$global/df/;
|
|
|
|
|
|
|
|
$tgvec =~ s/\[\$\]$//;
|
|
|
|
|
|
|
|
return if $tgvec !~ /^[\w\.]+$/;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $tgname = "${name}_tg";
|
|
|
|
|
|
|
|
$tgname =~ s/_id(.?.?)_tg/_tg$1/;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for my $othername (map { $_->getAttribute('name') } $parent->findnodes('child::ld:field')) {
|
|
|
|
|
|
|
|
$tgname .= '_' if ($othername and $tgname eq $othername);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
push @lines_rb, "def $tgname ; $name.map { |i| ${tgvec}[i] } ; end";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub render_class_vmethods {
|
|
|
|
sub render_class_vmethods {
|
|
|
|
my ($vms) = @_;
|
|
|
|
my ($vms) = @_;
|
|
|
|
my $voff = 0;
|
|
|
|
my $voff = 0;
|
|
|
|