{-# OPTIONS -cpp #-} -- ---------------------------------------------------------------------------- -- | -- Module : Config -- Author : Simon Marlow -- Copyright : (c) Microsoft Corporation, All Rights Reserved -- -- Configuration settings for VS/Haskell -- -- ---------------------------------------------------------------------------- module VSConfig where import Distribution.Setup import Com import FilePath import Foreign import Foreign.C.String import System.Environment -- ----------------------------------------------------------------------------- -- Compiler settings -- this is the directory where Visual Haskell is installed. {-# NOINLINE vshaskellRoot #-} vshaskellRoot :: String vshaskellRoot = unsafePerformIO $ allocaArray path_max_len $ \buf -> withCString "vs_haskell.dll" $ \dll_name -> do hModule <- getModuleHandle dll_name getModuleFileName hModule buf path_max_len s <- peekCString buf return ((fst . splitFileName . fst . splitFileName) s) where path_max_len = (2048::Int) -- plenty, PATH_MAX is 512 under Win32. foreign import stdcall unsafe "GetModuleFileNameA" getModuleFileName :: Ptr () -> CString -> Int -> IO Int32 foreign import stdcall unsafe "GetModuleHandleA" getModuleHandle :: CString -> IO (Ptr ()) setupScriptName :: FilePath setupScriptName = "Setup.lhs" -- ----------------------------------------------------------------------------- -- Registry settings -- which VS version we're configuring for vs_version :: String vs_version = unsafePerformIO $ do args <- getArgs return $! case args of [] -> "7.1" (ver:_) -> ver -- The root of the VS registry hive (you probably don't want to change this) vs_root = "SOFTWARE\\Microsoft\\VisualStudio\\" ++ vs_version ++ "\\" -- The Babel package GUID: -- This is the vhsbabelpackage GUID: clsidBabelPackage = Com.mkCLSID "{06525805-CBF0-4726-9B50-184D2BBEA2C6}" -- This is the SmlBabelPackage GUID: -- clsidBabelPackage = Com.mkCLSID "{2F5B21F8-4AC2-41C0-BA47-76C4CC441517}" -- This is the standard VS 7.0 babelpackage GUID: -- clsidBabelPackage = Com.mkCLSID "{221F0EB7-30F7-45FF-AE73-5968B167CF09}" haskellProjExtension = ".cabal" -- File extensions we claim for Haskell haskellExtensions = [".hs", ".lhs"] packageName = "HaskellPackage" haskellServiceName = "Haskell" litHaskellServiceName = "Literate Haskell"