From: simonmar Date: Fri, 28 Jan 2005 14:27:00 +0000 (+0000) Subject: [project @ 2005-01-28 14:27:00 by simonmar] X-Git-Tag: Initial_conversion_from_CVS_complete~1159 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=b4b792b559f7be8dd794c9e9b6e5f32e8989115a;p=ghc-hetmet.git [project @ 2005-01-28 14:27:00 by simonmar] add an INCLUDE pragma, as a compiler-independent alternative to -#include. --- diff --git a/ghc/compiler/main/DriverUtil.hs b/ghc/compiler/main/DriverUtil.hs index dab7eb6..0941136 100644 --- a/ghc/compiler/main/DriverUtil.hs +++ b/ghc/compiler/main/DriverUtil.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverUtil.hs,v 1.50 2005/01/28 12:55:37 simonmar Exp $ +-- $Id: DriverUtil.hs,v 1.51 2005/01/28 14:27:00 simonmar Exp $ -- -- Utils for the driver -- @@ -60,7 +60,7 @@ getOptionsFromSource file | prefixMatch "{-# LINE" l -> look h -- -} | Just opts <- matchOptions l -> do rest <- look h - return (words opts ++ rest) + return (opts ++ rest) | otherwise -> return [] -- detect {-# OPTIONS_GHC ... #-}. For the time being, we accept OPTIONS @@ -80,9 +80,12 @@ matchOptions s -> matchOptions2 s2 | otherwise -> Just [] -- OPTIONS_anything is ignored, not treated as start of source + | Just s2 <- maybePrefixMatch "INCLUDE" s, not (is_ident (head s2)), + Just s3 <- maybePrefixMatch "}-#" (reverse s2) + = Just ["-#include", remove_spaces (reverse s3)] | otherwise = Nothing matchOptions2 s - | Just s3 <- maybePrefixMatch "}-#" (reverse s) = Just (reverse s3) + | Just s3 <- maybePrefixMatch "}-#" (reverse s) = Just (words (reverse s3)) | otherwise = Nothing -----------------------------------------------------------------------------