changeset 228:55260ff44c8c

generate stub
author mir3636
date Sat, 21 Jan 2017 19:42:39 +0900
parents 991f3d1ce072
children a10ea0cfc929
files src/parallel_execution/generate_stub.pl
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/generate_stub.pl	Fri Jan 20 19:12:29 2017 +0900
+++ b/src/parallel_execution/generate_stub.pl	Sat Jan 21 19:42:39 2017 +0900
@@ -32,10 +32,11 @@
             }
             if (/^\_\_code (\w+)/) {
                 $codeGearName = $1;
-                print STDOUT $1 . "\n";
                 while (/struct (\w+)/g) {
-                    print STDOUT "\t" . $1 . "\n";
+                    $dataGearName{$codeGearName} .= "\t\tGearef(context, " . $1 . ")." . lc $1;
+                    $dataGearName{$codeGearName} .= ",\n";
                 }
+                next;
             }
             next;
         }
@@ -64,13 +65,22 @@
     }
     print $fd "\n";
 
-    open my $fd,">","d/stub.h" or die("can't open d/stub.h $!");
+    open my $fd,">","d/type.h" or die("can't open d/stub.h $!");
     for my $name ( sort keys %dataGear ) {
         print $fd $var{$name},"\n";
     }
     for my $name ( sort keys %dataGear ) {
         print $fd $type{$name},"\n";
     }
+    
+    open my $fd,">","d/stub.h" or die("can't open d/stub.h $!");
+    for my $codeGearName ( sort keys %dataGearName ) {
+        print $fd "__code ", $codeGearName ,"_stub (struct Context* context) {\n";
+	print $fd "\tgoto meta(context, \n";
+        chomp($dataGearName{$codeGearName});
+        chop($dataGearName{$codeGearName});
+        print $fd $dataGearName{$codeGearName},") \n} \n\n";
+    }
     print $fd "\n";
 }