[project @ 1997-09-24 09:08:21 by simonm]
[ghc-hetmet.git] / ghc / driver / ghc-iface.lprl
index 8144c8a..ebd4778 100644 (file)
@@ -187,13 +187,15 @@ sub readHiFile {
        } elsif ( /^_([a-z_]+)_$/ ) {
            $now_in = $1;
 
-       } elsif ( $now_in eq 'usages' && /^(\S+)\s+(\d+)\s+:: (.*)/ ) {
+       } elsif ( $now_in eq 'usages' && /^(\S+)\s+(!\s+)?(\d+)\s+::(.*)/ ) {
            $Stuff{"$mod:usages"} .= $_; # save the whole thing
 
 
        } elsif ( $now_in =~ /^(exports|instance_modules|instances|fixities)$/ ) {
            $Stuff{"$mod:$1"} .= $_; # just save it up
 
+       } elsif ( /^--.*/ ) { # silently ignore comment lines.
+           ;
        } elsif ( $now_in eq 'declarations' ) { # relatively special treatment needed...
        # We're in a declaration
 
@@ -235,8 +237,6 @@ sub readHiFile {
                $Decl{"$mod:$current_name"} .= $_
            }
 
-       } elsif ( /^--.*/ ) { # silently ignore comment lines.
-           ;
        } else {
            print STDERR "$Pgm:junk old iface line?:section:$now_in:$_";
        }
@@ -290,22 +290,25 @@ sub mv_change {
 sub printNewItemVersion {
     local($hifile, $item, $mod_version, $show_hi_diffs) = @_;
     local($idecl) = $Decl{"new:$item"};
+    
 
     if (! defined($Decl{"old:$item"})) {       # Old decl doesn't exist
        if ($show_hi_diffs) {print STDERR "new: $item\n";}
        print $hifile  "$mod_version ";         # Use module version
 
-    } elsif ($idecl ne $Decl{"old:$item"})  {  # Old decl differs from new decl
-       local($odecl) = $Decl{"old:$item"};
-       if ($show_hi_diffs) {print STDERR "changed: $item\nOld: $odeclNew: $idecl";}
-       print $hifile  "$mod_version ";         # Use module version
-
     } elsif (! defined($OldVersion{"$item"}) ) {
        if ($show_hi_diffs) {print STDERR "$item: no old version?!\n";}
        print $hifile  "$mod_version ";                 # Use module version
 
+    } elsif ($idecl ne $Decl{"old:$item"})  {  # Old decl differs from new decl
+       local($odecl) = $Decl{"old:$item"};
+       if ($show_hi_diffs) {print STDERR "changed: $item\nOld: $odecl", "New: $idecl";}
+       print $hifile  "--old: ", $OldVersion{"$item"}, " $odecl" 
+                       if $Keep_HiDiffs;         # show old in interface file
+       print $hifile  "$mod_version ";           # Use module version
+
     } else {                                   # Identical decls, so use old version number
-       if ($show_hi_diffs) {print STDERR "$item: unchanged\n";}
+       #if ($show_hi_diffs) {print STDERR "$item: unchanged\n";}
        print $hifile  $OldVersion{"$item"}, " ";
     }
     return;