X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=inline;f=System%2FInfo.hs;h=92da1a64b7b43a364232f29a0f6e9cf894164cd3;hb=1258ad2dd3a9dc063c2276ca3bca3271ef7b1bf1;hp=b588aafb56bbff739e736b2c2301f29ac3006469;hpb=7f1f4e7a695c402ddd3a1dc2cc7114e649a78ebc;p=ghc-base.git diff --git a/System/Info.hs b/System/Info.hs index b588aaf..92da1a6 100644 --- a/System/Info.hs +++ b/System/Info.hs @@ -1,32 +1,68 @@ +{-# LANGUAGE CPP #-} + ----------------------------------------------------------------------------- --- +-- | -- Module : System.Info -- Copyright : (c) The University of Glasgow 2001 --- License : BSD-style (see the file libraries/core/LICENSE) +-- License : BSD-style (see the file libraries/base/LICENSE) -- -- Maintainer : libraries@haskell.org --- Stability : provisional +-- Stability : experimental -- Portability : portable -- --- $Id: Info.hs,v 1.1 2001/06/28 14:15:04 simonmar Exp $ --- --- Misc information about the characteristics of the host --- architecture/machine lucky enough to run your program. +-- Information about the characteristics of the host +-- system lucky enough to run your program. -- ----------------------------------------------------------------------------- -#include "MachDeps.h" - module System.Info ( os, -- :: String - arch -- :: String + arch, -- :: String + compilerName, -- :: String + compilerVersion -- :: Version ) where import Prelude +import Data.Version +-- | The version of 'compilerName' with which the program was compiled +-- or is being interpreted. +compilerVersion :: Version +compilerVersion = Version {versionBranch=[major, minor], versionTags=[]} + where (major, minor) = compilerVersionRaw `divMod` 100 + +-- | The operating system on which the program is running. +os :: String + +-- | The machine architecture on which the program is running. arch :: String + +-- | The Haskell implementation with which the program was compiled +-- or is being interpreted. +compilerName :: String + +compilerVersionRaw :: Int + +#if defined(__NHC__) +#include "OSInfo.hs" +compilerName = "nhc98" +compilerVersionRaw = __NHC__ + +#elif defined(__GLASGOW_HASKELL__) +#include "ghcplatform.h" +os = HOST_OS arch = HOST_ARCH +compilerName = "ghc" +compilerVersionRaw = __GLASGOW_HASKELL__ -os :: String +#elif defined(__HUGS__) +#include "platform.h" os = HOST_OS +arch = HOST_ARCH +compilerName = "hugs" +compilerVersionRaw = 0 -- ToDo + +#else +#error Unknown compiler name +#endif