+sub dump_struct_static($) {
+ my ($pkg) = @_;
+
+ print "static struct {\n";
+ foreach (@{$pkg->{props}}) {
+ my $p = $pkg->{members}{$_};
+ my %t = find_type($p, $p->{type});
+ if ($t{const}) {
+ printf " const $t{type}->{ctypefmt};\n", $p->{name};
+ } else {
+ printf " $t{type}->{ctypefmt};\n", $p->{name};
+ }
+ }
+ put_line($pkg, 0);
+ print "} $pkg->{cname} = {\n";
+
+ foreach (@{$pkg->{props}}) {
+ my $p = $pkg->{members}{$_};
+ my %t = find_type($p, $p->{type});
+
+ if ($t{const}) {
+ put_line($p, 0);
+ print " $p->{init},\n";
+ } else {
+ print " 0,\n" if ($t{type}->{kind} eq 'b');
+ print " 0,\n" if ($t{type}->{kind} eq 'i');
+ print " NULL,\n" if ($t{type}->{kind} eq 's');
+ }
+ }
+
+ print <<EOF;
+};
+
+static void $pkg->{cname}_init(void)
+{
+EOF
+
+ foreach (@{$pkg->{props}}) {
+ my $p = $pkg->{members}{$_};
+ my %t = find_type($p, $p->{type});
+ my $var = $pkg->{cname}.".".$p->{name};
+
+ next if $t{const};
+
+ put_line($p, 0);
+ if ($t{type}->{dtor}) {
+ my $dtor = $t{type}->{dtor};
+ $dtor =~ s/\$L/L/;
+ $dtor =~ s/\$\$/\&$var/;
+ print " $dtor;\n";
+ }
+ print " $var = $p->{init};\n"
+ }
+ print "};\n";
+};
+