From c8a3ddcbd6624db585d6d4f9fe9d7e51527db2db Mon Sep 17 00:00:00 2001 From: sof Date: Mon, 9 Aug 1999 14:28:56 +0000 Subject: [PATCH] [project @ 1999-08-09 14:28:49 by sof] First step along the way of having GHC understand DOS-style paths (hot new feature!) - if ';' occurs in a -i list, ';' is used to separate entries on the import search path, otherwise its trusty old ':'. [This commit is made simply to unblock some Win32 users, but it shouldn't have any untoward effects on others. If it does, please back it out as I'm about to take off for a couple of weeks.] --- ghc/compiler/basicTypes/Module.lhs | 4 ++-- ghc/compiler/main/CmdLineOpts.lhs | 6 ++++++ ghc/driver/ghc.lprl | 22 +++++++++++++++++----- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/ghc/compiler/basicTypes/Module.lhs b/ghc/compiler/basicTypes/Module.lhs index 0846c99..cf86c1c 100644 --- a/ghc/compiler/basicTypes/Module.lhs +++ b/ghc/compiler/basicTypes/Module.lhs @@ -48,7 +48,7 @@ module Module import OccName import Outputable import FiniteMap -import CmdLineOpts ( opt_Static, opt_CompilingPrelude, opt_WarnHiShadows ) +import CmdLineOpts ( opt_Static, opt_CompilingPrelude, opt_WarnHiShadows, opt_HiMapSep ) import Constants ( interfaceFileFormatVersion ) import Maybes ( seqMaybe ) import Maybe ( fromMaybe ) @@ -384,7 +384,7 @@ mkSearchPath (Just s) = go s go s = case span (/= '%') s of (dir,'%':rs) -> - case span (/= ':') rs of + case span (/= opt_HiMapSep) rs of (hisuf,_:rest) -> (dir,hisuf):go rest (hisuf,[]) -> [(dir,hisuf)] \end{code} diff --git a/ghc/compiler/main/CmdLineOpts.lhs b/ghc/compiler/main/CmdLineOpts.lhs index 106d313..c359e1b 100644 --- a/ghc/compiler/main/CmdLineOpts.lhs +++ b/ghc/compiler/main/CmdLineOpts.lhs @@ -123,6 +123,7 @@ module CmdLineOpts ( opt_EnsureSplittableC, opt_GranMacros, opt_HiMap, + opt_HiMapSep, opt_HiVersion, opt_HistorySize, opt_IgnoreAsserts, @@ -260,6 +261,10 @@ lookup_def_int sw def = case (lookup_str sw) of Nothing -> def -- Use default Just xx -> read xx +lookup_def_char sw def = case (lookup_str sw) of + Just (xx:_) -> xx + _ -> def -- Use default + lookup_def_float sw def = case (lookup_str sw) of Nothing -> def -- Use default Just xx -> read xx @@ -392,6 +397,7 @@ opt_EmitCExternDecls = lookUp SLIT("-femit-extern-decls") opt_EnsureSplittableC = lookUp SLIT("-fglobalise-toplev-names") opt_GranMacros = lookUp SLIT("-fgransim") opt_HiMap = lookup_str "-himap=" -- file saying where to look for .hi files +opt_HiMapSep = lookup_def_char "-himap-sep=" ':' opt_HiVersion = lookup_def_int "-fhi-version=" 0 -- what version we're compiling. opt_HistorySize = lookup_def_int "-fhistory-size" 20 opt_IgnoreAsserts = lookUp SLIT("-fignore-asserts") diff --git a/ghc/driver/ghc.lprl b/ghc/driver/ghc.lprl index 9d25083..b9d4ef2 100644 --- a/ghc/driver/ghc.lprl +++ b/ghc/driver/ghc.lprl @@ -425,6 +425,9 @@ $CoreLint = ''; $USPLint = ''; $StgLint = ''; +# The SplitMarker is the string/character used to mark end of element +# in import lists. +$SplitMarker = ':'; @Import_dir = ('.'); #-i things @Include_dir = ('.'); #-I things; other default(s) stuck on AFTER option processing @@ -1704,7 +1707,8 @@ sub runHsc { local($ifile_root, $hsc_out, $hsc_hi, $hsc_out_c_stub, $hsc_out_h_stub, $going_interactive) = @_; &makeHiMap() unless $HiMapDone; - push(@HsC_flags, "-himap=$HiIncludeString"); + push(@HsC_flags, "\"-himap=$HiIncludeString\""); + push(@HsC_flags, "\"-himap-sep=${SplitMarker}\""); # here, we may produce .hc/.s and/or .hi files local($output) = ''; @@ -1789,7 +1793,7 @@ sub makeHiMap { foreach $d ( @Import_dir ) { if ($HiIncludeString) { - $HiIncludeString = "$HiIncludeString:${d}%.${HiSuffix}"; + $HiIncludeString = "$HiIncludeString${SplitMarker}${d}%.${HiSuffix}"; } else { $HiIncludeString = "$d%.${HiSuffix}"; } @@ -1798,7 +1802,7 @@ sub makeHiMap { foreach $d ( @SysImport_dir ) { if ($HiIncludeString) { - $HiIncludeString = "$HiIncludeString:${d}%.${HiSuffix_prelude}"; + $HiIncludeString = "$HiIncludeString${SplitMarker}${d}%.${HiSuffix_prelude}"; } else { $HiIncludeString = "${d}%.${HiSuffix_prelude}"; } @@ -2966,8 +2970,16 @@ arg: while($_ = $Args[0]) { print STDERR "WARNING: import paths cleared by `-i'\n"; next arg; }; - /^-i(.*)/ && do { local(@new_items) - = split( /:/, &grab_arg_arg(*Args,'-i', $1)); + /^-i(.*)/ && do { local(@new_items); + local($arg) = $1; + + # + if ( $arg =~ /;/ ) { + $SplitMarker=";"; + @new_items = split( /;/, &grab_arg_arg(*Args,'-i', $arg)); + } else { + @new_items = split( /:/, &grab_arg_arg(*Args,'-i', $arg)); + } unshift(@Import_dir, @new_items); next arg; }; -- 1.7.10.4