[project @ 2001-03-29 17:56:18 by qrczak]
authorqrczak <unknown>
Thu, 29 Mar 2001 17:56:18 +0000 (17:56 +0000)
committerqrczak <unknown>
Thu, 29 Mar 2001 17:56:18 +0000 (17:56 +0000)
Generated C files are named *_hsc.h and *_hsc.c (again).

ghc/docs/users_guide/utils.sgml
ghc/lib/std/Makefile
ghc/utils/hsc2hs/Main.hs
mk/suffix.mk

index 8b97c19..633a779 100644 (file)
@@ -215,16 +215,6 @@ tags:
        </varlistentry>
 
        <varlistentry>
-         <term><literal>-s FILE</literal> or
-         <literal>--support=FILE</literal></term>
-         <listitem>
-           <para>Basename of the C file and C header
-           (with <literal>.c</literal>, <literal>.h</literal>
-           suffixes removed).</para>
-         </listitem>
-       </varlistentry>
-
-       <varlistentry>
          <term><literal>--help</literal></term>
          <listitem>
            <para>Display a summary of the available flags.</para>
@@ -240,22 +230,22 @@ tags:
       </variablelist>
 
       <para>The input file should end with .hsc. Output files by
-      default get names with the <literal>*.hsc</literal> pattern
+      default get names with the <literal>.hsc</literal> suffix
       replaced:</para>
 
       <informaltable>
        <tgroup cols=2>
          <tbody>
            <row>
-             <entry><literal>*.hs</literal></entry>
+             <entry><literal>.hs</literal></entry>
              <entry>Haskell file</entry>
            </row>
            <row>
-             <entry><literal>Hs*.h</literal></entry>
+             <entry><literal>_hsc.h</literal></entry>
              <entry>C header</entry>
            </row>
            <row>
-             <entry><literal>Hs*.c</literal></entry>
+             <entry><literal>_hsc.c</literal></entry>
              <entry>C file</entry>
            </row>
          </tbody>
index a34ea3c..ccb63f6 100644 (file)
@@ -92,9 +92,9 @@ endif
 CLEAN_FILES += PrelGHC.hi $(foreach way, $(WAYS), PrelGHC.$(way)_hi)
 
 CLEAN_FILES +=  \
-       $(patsubst %.hsc, %.hs, $(HSC_SRCS)) \
-       $(patsubst %.hsc, Hs%.c, $(HSC_SRCS)) \
-       $(patsubst %.hsc, Hs%.h, $(HSC_SRCS))
+       $(patsubst %.hsc, %.hs,    $(HSC_SRCS)) \
+       $(patsubst %.hsc, %_hsc.c, $(HSC_SRCS)) \
+       $(patsubst %.hsc, %_hsc.h, $(HSC_SRCS))
 
 #-----------------------------------------------------------------------------
 #      Installation; need to install .hi files as well as libraries
index 6c04630..b888f33 100644 (file)
@@ -1,5 +1,5 @@
 ------------------------------------------------------------------------
--- $Id: Main.hs,v 1.28 2001/03/29 08:03:21 qrczak Exp $
+-- $Id: Main.hs,v 1.29 2001/03/29 17:56:18 qrczak Exp $
 --
 -- Program for converting .hsc files to .hs files, by converting the
 -- file into a C program which is run to generate the Haskell source.
@@ -32,7 +32,6 @@ data Flag
     | Include   String
     | Define    String (Maybe String)
     | Output    String
-    | Support   String
 
 include :: String -> Flag
 include s@('\"':_) = Include s
@@ -53,11 +52,10 @@ options = [
     Option "I" []             (ReqArg (CompFlag . ("-I"++))
                                                  "DIR")  "passed to the C compiler",
     Option "L" ["lflag"]      (ReqArg LinkFlag   "FLAG") "flag to pass to the linker",
-    Option ""  ["no-compile"] (NoArg  NoCompile)         "stop after writing *_make.c",
+    Option ""  ["no-compile"] (NoArg  NoCompile)         "stop after writing *_hsc_make.c",
     Option "i" ["include"]    (ReqArg include    "FILE") "as if placed in the source",
     Option "D" ["define"]     (ReqArg define "NAME[=VALUE]") "as if placed in the source",
     Option "o" ["output"]     (ReqArg Output     "FILE") "name of main output file",
-    Option "s" ["support"]    (ReqArg Support    "FILE") "basename of support output files (with .h, .c removed)",
     Option ""  ["help"]       (NoArg  Help)              "display this help and exit",
     Option ""  ["version"]    (NoArg  Version)           "output version information and exit"]
 
@@ -415,35 +413,30 @@ splitExt name =
 output :: [Flag] -> String -> [Token] -> IO ()
 output flags name toks = do
     
-    let (dir,  file) = splitName name
-        (base, ext)  = splitExt  file
-    
     (outName, outDir, outBase) <- case [f | Output f <- flags] of
         []
             | not (null ext) &&
               last ext == 'c'   -> return (dir++base++init ext,  dir, base)
             | ext == ".hs"      -> return (dir++base++"_out.hs", dir, base)
             | otherwise         -> return (dir++base++".hs",     dir, base)
+            where
+            (dir,  file) = splitName name
+            (base, ext)  = splitExt  file
         [f] -> let
-            (dir',  file') = splitName f
-            (base', _)     = splitExt file'
-            in return (f, dir', base')
+            (dir,  file) = splitName f
+            (base, _)    = splitExt file
+            in return (f, dir, base)
         _ -> onlyOne "output file"
     
-    supportDirBase <- case [f | Support f <- flags] of
-        []  -> return (outDir++"Hs"++outBase)
-        [f] -> return f
-        _   -> onlyOne "support file"
-    
-    let cProgName    = outDir++outBase++"_make.c"
-        oProgName    = outDir++outBase++"_make.o"
-        progName     = outDir++outBase++"_make"
-        outHName     = supportDirBase++".h"
-        outCName     = supportDirBase++".c"
+    let cProgName    = outDir++outBase++"_hsc_make.c"
+        oProgName    = outDir++outBase++"_hsc_make.o"
+        progName     = outDir++outBase++"_hsc_make"
+        outHName     = outDir++outBase++"_hsc.h"
+        outCName     = outDir++outBase++"_hsc.c"
     
     let execProgName
-            | null dir  = "./"++progName
-            | otherwise = progName
+            | null outDir = "./"++progName
+            | otherwise   = progName
     
     let specials = [(pos, key, arg) | Special pos key arg <- toks]
     
index 94b0456..1cff9c8 100644 (file)
@@ -112,7 +112,7 @@ endif # BootingViaC
 #-----------------------------------------------------------------------------
 # hsc2hs Suffix Rules
 #
-Hs%.c Hs%.h %.hs : %.hsc
+%_hsc.c %_hsc.h %.hs : %.hsc
        $(HSC2HS) $<
 
 #-----------------------------------------------------------------------------