Skip to content

Commit

Permalink
Add 'clashi' program and 'clash-ghc' package
Browse files Browse the repository at this point in the history
Fixes clash-lang#208.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
  • Loading branch information
thoughtpolice committed Mar 25, 2017
1 parent bc04ffd commit d2ba08d
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 24 deletions.
File renamed without changes.
File renamed without changes.
29 changes: 20 additions & 9 deletions clash-ghc/clash-ghc.cabal
Expand Up @@ -43,18 +43,27 @@ Build-type: Simple
Extra-source-files: README.md,
CHANGELOG.md,
LICENSE_GHC,
src-bin/PosixSource.h,
src-bin/GHCi/HsVersions.h
cbits/PosixSource.h,
src-bin/CLaSH/GHCi/HsVersions.h

Cabal-version: >=1.10

source-repository head
type: git
location: https://github.com/clash-lang/clash-compiler.git

Executable clash
executable clash
Main-Is: src-ghc/Batch.hs
Build-Depends: base, clash-ghc
GHC-Options: -Wall

executable clashi
Main-Is: src-ghc/Interactive.hs
Build-Depends: base, clash-ghc
GHC-Options: -Wall

library
HS-Source-Dirs: src-ghc src-bin
Main-Is: Main.hs

default-language: Haskell2010
GHC-Options: -Wall -fno-warn-name-shadowing
Expand Down Expand Up @@ -112,12 +121,14 @@ Executable clash
else
Build-Depends: unix >= 2.7.1 && < 2.8

C-Sources: src-bin/hschooks.c
Include-dirs: cbits
C-Sources: cbits/hschooks.c

Other-Modules: GHCi.UI
GHCi.UI.Info
GHCi.UI.Monad
GHCi.UI.Tags
Exposed-Modules: CLaSH.Main
Other-Modules: CLaSH.GHCi.UI
CLaSH.GHCi.UI.Info
CLaSH.GHCi.UI.Monad
CLaSH.GHCi.UI.Tags

CLaSH.GHC.CLaSHFlags
CLaSH.GHC.Evaluator
Expand Down
File renamed without changes.
Expand Up @@ -20,7 +20,7 @@
--
-----------------------------------------------------------------------------

module GHCi.UI (
module CLaSH.GHCi.UI (
interactiveUI,
GhciSettings(..),
defaultGhciSettings,
Expand All @@ -32,10 +32,10 @@ module GHCi.UI (
#include "HsVersions.h"

-- GHCi
import qualified GHCi.UI.Monad as GhciMonad ( args, runStmt, runDecls )
import GHCi.UI.Monad hiding ( args, runStmt, runDecls )
import GHCi.UI.Tags
import GHCi.UI.Info
import qualified CLaSH.GHCi.UI.Monad as GhciMonad ( args, runStmt, runDecls )
import CLaSH.GHCi.UI.Monad hiding ( args, runStmt, runDecls )
import CLaSH.GHCi.UI.Tags
import CLaSH.GHCi.UI.Info
import Debugger

-- The GHC interface
Expand Down
Expand Up @@ -4,7 +4,7 @@
{-# LANGUAGE ScopedTypeVariables #-}

-- | Get information on modules, expreesions, and identifiers
module GHCi.UI.Info
module CLaSH.GHCi.UI.Info
( ModInfo(..)
, SpanInfo(..)
, spanInfoFromRealSrcSpan
Expand Down
Expand Up @@ -10,7 +10,7 @@
--
-----------------------------------------------------------------------------

module GHCi.UI.Monad (
module CLaSH.GHCi.UI.Monad (
GHCi(..), startGHCi,
GHCiState(..), setGHCiState, getGHCiState, modifyGHCiState,
GHCiOption(..), isOptionSet, setOption, unsetOption,
Expand All @@ -31,7 +31,7 @@ module GHCi.UI.Monad (

#include "../HsVersions.h"

import GHCi.UI.Info (ModInfo)
import CLaSH.GHCi.UI.Info (ModInfo)
import qualified GHC
import GhcMonad hiding (liftIO)
import Outputable hiding (printForUser, printForUserPartWay)
Expand Down
Expand Up @@ -7,15 +7,15 @@
-----------------------------------------------------------------------------

{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
module GHCi.UI.Tags (
module CLaSH.GHCi.UI.Tags (
createCTagsWithLineNumbersCmd,
createCTagsWithRegExesCmd,
createETagsFileCmd
) where

import Exception
import GHC
import GHCi.UI.Monad
import CLaSH.GHCi.UI.Monad
import Outputable

-- ToDo: figure out whether we need these, and put something appropriate
Expand Down
12 changes: 7 additions & 5 deletions clash-ghc/src-bin/Main.hs → clash-ghc/src-bin/CLaSH/Main.hs
Expand Up @@ -9,7 +9,7 @@
--
-----------------------------------------------------------------------------

module Main (main) where
module CLaSH.Main (defaultMain) where

#include "MachDeps.h"

Expand All @@ -27,7 +27,7 @@ import HscMain ( newHscEnv )
import DriverPipeline ( oneShot, compileFile )
import DriverMkDepend ( doMkDependHS )
#ifdef GHCI
import GHCi.UI ( interactiveUI, ghciWelcomeMsg, defaultGhciSettings )
import CLaSH.GHCi.UI ( interactiveUI, ghciWelcomeMsg, defaultGhciSettings )
#endif

-- Frontend plugins
Expand Down Expand Up @@ -75,7 +75,7 @@ import Data.Maybe

-- clash additions
import Paths_clash_ghc
import GHCi.UI (makeHDL)
import CLaSH.GHCi.UI (makeHDL)
import Exception (gcatch)
import Data.IORef (IORef, newIORef, readIORef)
import qualified Data.Version (showVersion)
Expand Down Expand Up @@ -106,8 +106,10 @@ import CLaSH.GHC.LoadModules (ghcLibDir)
-----------------------------------------------------------------------------
-- GHC's command-line interface

main :: IO ()
main = do
-- | Run the Clash compiler with a given set of arguments. This is equivalent to
-- simply invoking the main @clash@ binary with the same arguments.
defaultMain :: [String] -> IO ()
defaultMain = flip withArgs $ do
initGCStatistics -- See Note [-Bsymbolic and hooks]
hSetBuffering stdout LineBuffering
hSetBuffering stderr LineBuffering
Expand Down
16 changes: 16 additions & 0 deletions clash-ghc/src-ghc/Batch.hs
@@ -0,0 +1,16 @@
{-|
Copyright : (C) 2013-2017, University of Twente
License : BSD2 (see the file LICENSE)
Maintainer : Christiaan Baaij <christiaan.baaij@gmail.com>
Entry point for the @clash@ executable.
-}
module Main
( main -- :: IO ()
) where

import System.Environment ( getArgs )
import CLaSH.Main ( defaultMain )

main :: IO ()
main = getArgs >>= defaultMain
16 changes: 16 additions & 0 deletions clash-ghc/src-ghc/Interactive.hs
@@ -0,0 +1,16 @@
{-|
Copyright : (C) 2013-2017, University of Twente
License : BSD2 (see the file LICENSE)
Maintainer : Christiaan Baaij <christiaan.baaij@gmail.com>
Entry point for the @clashi@ executable.
-}
module Main
( main -- :: IO ()
) where

import System.Environment ( getArgs )
import CLaSH.Main ( defaultMain )

main :: IO ()
main = getArgs >>= defaultMain . ("--interactive":)

0 comments on commit d2ba08d

Please sign in to comment.