X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-lua%2Fluapkg2c.pl;h=f1bab327825cb4a4961f773bd23251a65fe5df28;hp=b7d1ba3b0395bc1a97a0d7d48f3c2ecad99f060f;hb=05e61a9707a6da5c0bca77aa7c3c019a918494de;hpb=6b771604433435b4280a5fbae2612134fe4129dd diff --git a/lib-lua/luapkg2c.pl b/lib-lua/luapkg2c.pl index b7d1ba3..f1bab32 100755 --- a/lib-lua/luapkg2c.pl +++ b/lib-lua/luapkg2c.pl @@ -83,7 +83,7 @@ sub parse_type($$) { while (stream_getline($src)) { last if (/^\s*\}\s*;\s*/); - if (/^\s*\.(push|kind|ctype|dtor|ctor|check)\s*=\s*(.*?)\s*;\s*$/) { + if (/^\s*\.(kind|ctype|dtor|ctor|push|check)\s*=\s*(.*?)\s*;\s*$/) { $t{$1} = $2; if ($1 eq "kind") { if ($2 =~ /^'([bis])'$/) { @@ -220,9 +220,7 @@ sub dump_fun($$) { } } - if (defined $t{type}->{push}) { - $call =~ s/\$\$/$t{type}->{push}/; - } + die "UNIMPLEMENTED" if defined $t{type}->{push}; if ($t{type}->{kind} eq 'b') { put_line($f, 0); @@ -411,7 +409,10 @@ EOF foreach (@{$pkg->{props}}) { my $p = $pkg->{members}{$_}; my %t = find_type($p, $p->{type}); - my $call = $pkg->{cname}.".".$p->{name}; + my $call = $t{type}->{push} || '$$'; + + $call =~ s/\$L/L/; + $call =~ s/\$\$/$pkg->{cname}.$p->{name}/; my $tok = $p->{name}; $tok =~ tr/a-z/A-Z/; @@ -428,10 +429,6 @@ EOF $call = "lua_pushstring(L, $call)"; } - if (defined $t{type}->{push}) { - $call =~ s/\$\$/$t{type}->{push}/; - } - put_line($p, 0); print " case LTK_$tok:\n"; printf " $call;\n";