cosmetics.
[apps/madmutt.git] / lib-lua / luapkg2c.pl
index b7d1ba3..f1bab32 100755 (executable)
@@ -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";