From 3b4e398466c0a8b037e112d40bb20b77a9b42bf0 Mon Sep 17 00:00:00 2001 From: qrczak Date: Thu, 29 Mar 2001 17:56:18 +0000 Subject: [PATCH] [project @ 2001-03-29 17:56:18 by qrczak] Generated C files are named *_hsc.h and *_hsc.c (again). --- ghc/docs/users_guide/utils.sgml | 18 ++++-------------- ghc/lib/std/Makefile | 6 +++--- ghc/utils/hsc2hs/Main.hs | 37 +++++++++++++++---------------------- mk/suffix.mk | 2 +- 4 files changed, 23 insertions(+), 40 deletions(-) diff --git a/ghc/docs/users_guide/utils.sgml b/ghc/docs/users_guide/utils.sgml index 8b97c19..633a779 100644 --- a/ghc/docs/users_guide/utils.sgml +++ b/ghc/docs/users_guide/utils.sgml @@ -215,16 +215,6 @@ tags: - -s FILE or - --support=FILE - - Basename of the C file and C header - (with .c, .h - suffixes removed). - - - - --help Display a summary of the available flags. @@ -240,22 +230,22 @@ tags: The input file should end with .hsc. Output files by - default get names with the *.hsc pattern + default get names with the .hsc suffix replaced: - *.hs + .hs Haskell file - Hs*.h + _hsc.h C header - Hs*.c + _hsc.c C file diff --git a/ghc/lib/std/Makefile b/ghc/lib/std/Makefile index a34ea3c..ccb63f6 100644 --- a/ghc/lib/std/Makefile +++ b/ghc/lib/std/Makefile @@ -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 diff --git a/ghc/utils/hsc2hs/Main.hs b/ghc/utils/hsc2hs/Main.hs index 6c04630..b888f33 100644 --- a/ghc/utils/hsc2hs/Main.hs +++ b/ghc/utils/hsc2hs/Main.hs @@ -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] diff --git a/mk/suffix.mk b/mk/suffix.mk index 94b0456..1cff9c8 100644 --- a/mk/suffix.mk +++ b/mk/suffix.mk @@ -112,7 +112,7 @@ endif # BootingViaC #----------------------------------------------------------------------------- # hsc2hs Suffix Rules # -Hs%.c Hs%.h %.hs : %.hsc +%_hsc.c %_hsc.h %.hs : %.hsc $(HSC2HS) $< #----------------------------------------------------------------------------- -- 1.7.10.4