[project @ 1997-10-05 20:42:48 by sof]
[ghc-hetmet.git] / ghc / utils / hscpp / hscpp.prl
index f46b374..c08080d 100644 (file)
@@ -1,12 +1,12 @@
-eval "exec perl -S $0 $*"
-     if $running_under_some_random_shell;
+#
+#eval "exec perl -S $0 $*"
+#     if $running_under_some_random_shell;
 #
 # reads CPP output and turns #line things into appropriate Haskell
 # pragmas
 #
 # considered to be GHC-project specific
 #
-#
 # OPTIONALLY processes GENERATE_SPECS pragmas
 # when give flag -genSPECS
 #
@@ -45,6 +45,13 @@ eval "exec perl -S $0 $*"
 #
 # Note: There must be no white space between { }s
 #       Use ( )s around type names when separation is required
+#
+#
+# NOTE: this script needs RAWCPP set in order to do something
+# useful:
+#
+#$RAWCPP='';
+#
 
 $Verbose = 0;
 
@@ -69,7 +76,7 @@ while ($#ARGV >= 0 && $ARGV[0] eq '-v' || $ARGV[0] =~ /^-genSPECS/) {
 }
 #ToDo: print a version number ?
 
-$OrigCpp = '$(RAWCPP)';
+$OrigCpp = ${RAWCPP};
 
 if ( $OrigCpp =~ /(\S+)\s+(.*)/ ) {
     $cmd  = $1;
@@ -175,14 +182,14 @@ while (<INPIPE>) {
 
             if ($#tospec >= 0) {
                $specty = shift(@tospec);
-               print ($data_or_inst ? "{-# SPECIALIZE $data_inst_str $specty #-}" : "$space{-# SPECIALIZE $fun :: $specty");
+               print ($data_or_inst ? "\{-# SPECIALIZE $data_inst_str $specty #-\}" : "$space\{-# SPECIALIZE $fun :: $specty");
                while ($#tospec >= 0) {
                    $specty = shift(@tospec);
-                   print ($data_or_inst ? "; {-# SPECIALIZE $data_inst_str $specty #-}" : ", $specty");
+                   print ($data_or_inst ? "; \{-# SPECIALIZE $data_inst_str $specty #-\}" : ", $specty");
                }
                print ($data_or_inst ? "\n" : " #-}\n");
            } else {
-               print "{- NO_SPECS_GENERATED ", $data_or_inst ? $specty : $fun, " -}\n";
+               print "\{- NO_SPECS_GENERATED ", $data_or_inst ? $specty : $fun, " -\}\n";
                print STDERR "Warning: No specs for GENERATE_SPECS pre-processing pragma:\n  $_";
            }
            print $tysig if ! $data_or_inst;