[project @ 1999-06-01 16:40:41 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / CmdLineOpts.lhs
index 06b9cf7..2f75b20 100644 (file)
@@ -14,6 +14,8 @@ module CmdLineOpts (
        intSwitchSet,
        switchIsOn,
 
+       src_filename,
+
        -- debugging opts
        opt_D_dump_absC,
        opt_D_dump_asm,
@@ -155,6 +157,7 @@ import GlaExts
 import Argv
 import Constants       -- Default values for some flags
 
+import FastString      ( headFS )
 import Maybes          ( assocMaybe, firstJust, maybeToBool )
 import Panic           ( panic, panic# )
 
@@ -283,6 +286,13 @@ unpacked_opts =
 \end{code}
 
 \begin{code}
+src_filename :: FAST_STRING
+src_filename = case argv of
+                 filename : rest | headFS filename /= '-' -> filename
+                 otherwise -> panic "no filename"
+\end{code}
+
+\begin{code}
 -- debugging opts
 opt_D_dump_absC                        = lookUp  SLIT("-ddump-absC")
 opt_D_dump_asm                 = lookUp  SLIT("-ddump-asm")