changeset 820:e8172cfeae20

...
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 17 Jan 2021 23:15:19 +0900
parents 27ea7f1f5452
children 50b667d388b0
files src/parallel_execution/generate_context.pl src/parallel_execution/lib/Gears/Interface.pm
diffstat 2 files changed, 44 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/generate_context.pl	Sun Jan 17 22:47:15 2021 +0900
+++ b/src/parallel_execution/generate_context.pl	Sun Jan 17 23:15:19 2021 +0900
@@ -360,7 +360,7 @@
       $generics->{$name} = $entry;
     }
     if (defined $entry->{typed_variable}) {
-      my $entry  = { name => $name, typed_variable => $entry->{typed_variable}};
+      my $entry  = { name => $name, typed_variable => $entry->{typed_variable}, typed_variable_types => $entry->{typed_variable_types}};
       if ($interface_name) {
         $entry->{interface} = $interface_name;
       }
@@ -387,16 +387,55 @@
     }
 
 
+    #p %generics;
+    #p %typed_variables;
+
     my %generics_info = ();
 
     for my $typeName (keys %typed_variables) {
       my $item = $typed_variables{$typeName};
-      my $caller = $item->{name};
-      #p $item;
       if (defined $item->{interface}) { #impl case
+        my $interface = $typed_variables{$item->{interface}};
+        if  (scalar(@{$interface->{typed_variable}}) != scalar(@{$item->{typed_variable}})){ # typed variable check
+            print STDERR "[ERROR] not mouch typed_variable number  $typeName w $interface->{name}\n";
+        }
       }
     }
 
+    for my $typeName (keys %generics) {
+      my $item = $generics{$typeName};
+      unless (defined $typed_variables{$typeName}) {
+        #not enough  check
+        # TODO: we should be check headerfile
+        print STDERR "mismatch!\n";
+      }
+
+      my $typed_variable = $typed_variables{$typeName};
+
+      if (scalar(@{$typed_variable->{typed_variable}}) == scalar(@{$item->{generics}})) {
+        print STDERR "OK!!!!!!!!!\n";
+      }
+    }
+
+
+    #PhilsImpl   {
+    #    generics    [
+    #        [0] {
+    #            generics   "int",
+    #            type       "AtomicT",
+    #            vname      "Leftfork"
+    #        },
+    #        [1] {
+    #            generics   "int",
+    #            type       "AtomicT",
+    #            vname      "Rightfork"
+    #        }
+    #    ],
+    #    interface   "Phils",
+    #    name        "PhilsImpl"
+    #}
+
+
     return \%generics_info;
 }
 
--- a/src/parallel_execution/lib/Gears/Interface.pm	Sun Jan 17 22:47:15 2021 +0900
+++ b/src/parallel_execution/lib/Gears/Interface.pm	Sun Jan 17 23:15:19 2021 +0900
@@ -111,6 +111,7 @@
           if (defined $generics_info->{type}){
              unless (grep {$_->{vname} eq $generics_info->{vname} } @{$ir->{typed_variable}}) {
               push(@{$ir->{typed_variable}},$generics_info);
+              push(@{$ir->{typed_variable_types}->{$generics_info->{type}}}, $generics_info->{vname});
             }
           }
         }
@@ -138,6 +139,7 @@
       if (defined $generics_info->{type}){
         unless (grep {$_->{vname} eq $generics_info->{vname} } @{$ir->{typed_variable}}) {
           push(@{$ir->{typed_variable}},$generics_info);
+          push(@{$ir->{typed_variable_types}->{$generics_info->{type}}}, $generics_info->{vname});
         }
       }
     }