Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Bluetcl use of GHC macros, for older GHC #675

Merged
merged 1 commit into from
Feb 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/comp/bluetcl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,24 @@ versionGrammar = (tclcmd "version" namespace helpStr longHelpStr) .+.
versionNum :: [String] -> IO HTclObj
versionNum [] = versionNum ["bsc"]
versionNum ["bsc"] = return $ TLst [TStr versionname, TStr buildVersion]
versionNum ["ghc"] = return $ TStr __GLASGOW_HASKELL_FULL_VERSION__
versionNum ["ghc"] = return $ TStr ghcVersionStr
versionNum xs = internalError $ "versionNum: grammar mismatch: " ++ (show xs)

ghcVersionStr :: String
#if defined(__GLASGOW_HASKELL_FULL_VERSION__)
ghcVersionStr = __GLASGOW_HASKELL_FULL_VERSION__
#else
ghcVersionStr =
let version_raw :: Int = __GLASGOW_HASKELL__
(major, minor) :: (Int, Int) = version_raw `divMod` 100
#if defined(__GLASGOW_HASKELL_PATCHLEVEL1__)
patch1 :: Int = __GLASGOW_HASKELL_PATCHLEVEL1__
in show major ++ "." ++ show minor ++ "." ++ show patch1
#else
in show major ++ "." ++ show minor
#endif
#endif

--------------------------------------------------------------------------------
-- flags

Expand Down