Commit c8a3ddcb authored by sof's avatar sof
Browse files

[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<dirs> 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.]
parent 737070c5
......@@ -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}
......
......@@ -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")
......
......@@ -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; };
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment