Skip to content

Commit

Permalink
Rename to hs-bindgen-runtime
Browse files Browse the repository at this point in the history
All modules now have prefix `HsBindgen.Runtime`.  Module
`HsBindgen.Runtime.Patterns` continues to re-export internal submodules.
  • Loading branch information
TravisCardwell committed Jan 9, 2025
1 parent 1611562 commit 292ced9
Show file tree
Hide file tree
Showing 42 changed files with 65 additions and 70 deletions.
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
packages: hs-bindgen-patterns
packages: hs-bindgen-runtime
packages: hs-bindgen
packages: hs-bindgen-libclang
packages: hs-bindgen-bootstrap
Expand All @@ -12,6 +12,6 @@ package hs-bindgen

package hs-bindgen-libclang

package hs-bindgen-patterns
package hs-bindgen-runtime

package hs-bindgen-testlib
4 changes: 2 additions & 2 deletions cabal.project.ci
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
packages: hs-bindgen-patterns
packages: hs-bindgen-runtime
packages: hs-bindgen
packages: hs-bindgen-libclang
packages: ansi-diff
Expand All @@ -9,7 +9,7 @@ package hs-bindgen
package hs-bindgen-libclang
ghc-options: -Werror

package hs-bindgen-patterns
package hs-bindgen-runtime
ghc-options: -Werror

package ansi-diff
Expand Down
2 changes: 1 addition & 1 deletion hs-bindgen-libclang/clang-ast-dump/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import HsBindgen.Clang.HighLevel qualified as HighLevel
import HsBindgen.Clang.HighLevel.Types
import HsBindgen.Clang.LowLevel.Core
import HsBindgen.Clang.LowLevel.Doxygen
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns

{-------------------------------------------------------------------------------
Options
Expand Down
2 changes: 1 addition & 1 deletion hs-bindgen-libclang/clang-tutorial/clang-tutorial.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import System.Environment

import HsBindgen.Clang.Args
import HsBindgen.Clang.LowLevel.Core
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns

{-------------------------------------------------------------------------------
Reproduce the clang tutorial in Haskell
Expand Down
6 changes: 3 additions & 3 deletions hs-bindgen-libclang/hs-bindgen-libclang.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ library
HsBindgen.Clang.HighLevel.UserProvided
build-depends:
-- Internal dependencies
, hs-bindgen-patterns
, hs-bindgen-runtime
build-depends:
-- External dependencies
, filepath >= 1.4.2.2 && < 1.6
Expand All @@ -110,7 +110,7 @@ executable clang-ast-dump
build-depends:
-- Internal dependencies
, hs-bindgen-libclang
, hs-bindgen-patterns
, hs-bindgen-runtime
build-depends:
-- Inherited dependencies
, text
Expand All @@ -127,4 +127,4 @@ test-suite clang-tutorial
build-depends:
-- Internal dependencies
, hs-bindgen-libclang
, hs-bindgen-patterns
, hs-bindgen-runtime
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Foreign.C
import HsBindgen.Clang.LowLevel.Core
import HsBindgen.Clang.HighLevel.SourceLoc (MultiLoc, Range)
import HsBindgen.Clang.HighLevel.SourceLoc qualified as SourceLoc
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns

{-------------------------------------------------------------------------------
Definition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import GHC.Stack

import HsBindgen.Clang.LowLevel.Core
import HsBindgen.Clang.LowLevel.Doxygen
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns

{-------------------------------------------------------------------------------
Definition
Expand Down
2 changes: 1 addition & 1 deletion hs-bindgen-libclang/src/HsBindgen/Clang/HighLevel/Fold.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Data.IORef (IORef, writeIORef, readIORef, modifyIORef, newIORef)

import HsBindgen.Clang.LowLevel.Core hiding (clang_visitChildren)
import HsBindgen.Clang.LowLevel.Core qualified as Core
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns

{-------------------------------------------------------------------------------
Definition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Text.Show.Pretty (PrettyVal(..))

import HsBindgen.Clang.HighLevel.SourceLoc (Range, MultiLoc, SingleLoc)
import HsBindgen.Clang.HighLevel.SourceLoc qualified as SourceLoc
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns

import HsBindgen.Clang.LowLevel.Core qualified as Core
import HsBindgen.Clang.LowLevel.Core hiding (clang_tokenize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foreign
import GHC.Stack

import HsBindgen.Clang.LowLevel.Core.Instances ()
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns

{-------------------------------------------------------------------------------
Failed calls
Expand Down
2 changes: 1 addition & 1 deletion hs-bindgen-libclang/src/HsBindgen/Clang/LowLevel/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ import HsBindgen.Clang.Internal.CXString ()
import HsBindgen.Clang.Internal.FFI
import HsBindgen.Clang.Internal.Results
import HsBindgen.Clang.Version
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns

{-------------------------------------------------------------------------------
Top-level
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module HsBindgen.Clang.LowLevel.Core.Instances () where
import HsBindgen.Clang.LowLevel.Core.Enums
import HsBindgen.Clang.LowLevel.Core.Structs
import HsBindgen.Clang.Internal.ByValue
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns

#include <clang-c/Index.h>
#include "clang_wrappers.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ import HsBindgen.Clang.LowLevel.Doxygen.Structs
import HsBindgen.Clang.Internal.ByValue
import HsBindgen.Clang.Internal.CXString ()
import HsBindgen.Clang.Internal.Results
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns

{-------------------------------------------------------------------------------
Top-level
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module HsBindgen.Clang.LowLevel.Doxygen.Instances () where
import HsBindgen.Clang.LowLevel.Doxygen.Enums
import HsBindgen.Clang.LowLevel.Doxygen.Structs
import HsBindgen.Clang.Internal.ByValue
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns

#include <clang-c/Documentation.h>

Expand Down
2 changes: 1 addition & 1 deletion hs-bindgen-libclang/src/HsBindgen/Clang/LowLevel/FFI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Foreign.C.Types
import HsBindgen.Clang.Internal.ByValue
import HsBindgen.Clang.LowLevel.Core.Enums
import HsBindgen.Clang.LowLevel.Core.Structs
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns
-- Type information for CXCursors https://clang.llvm.org/doxygen/group__CINDEX__TYPES.html

foreign import capi unsafe "clang_wrappers.h"
Expand Down
2 changes: 1 addition & 1 deletion hs-bindgen-libclang/src/HsBindgen/Clang/Version.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Text.Show.Pretty (PrettyVal)
import System.IO.Unsafe (unsafePerformIO)

import HsBindgen.Clang.Internal.Results (callFailed)
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns

#include "clang_wrappers.h"

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Revision history for hs-bindgen-patterns
# Revision history for hs-bindgen-runtime

## 0.1.0 -- YYYY-mm-dd

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cabal-version: 3.0
name: hs-bindgen-patterns
name: hs-bindgen-runtime
version: 0.1.0
synopsis: Design patterns for writing high-level FFI bindings
license: BSD-3-Clause
Expand Down Expand Up @@ -36,16 +36,16 @@ library
import:
lang
exposed-modules:
HsBindgen.ConstantArray
HsBindgen.Patterns
HsBindgen.Patterns.FlexibleArrayMember
HsBindgen.Patterns.LibC
HsBindgen.Runtime.ConstantArray
HsBindgen.Runtime.FlexibleArrayMember
HsBindgen.Runtime.LibC
HsBindgen.Runtime.Patterns
other-modules:
HsBindgen.Patterns.Arithmetic
HsBindgen.Patterns.Backtrace
HsBindgen.Patterns.Enum.Bitfield
HsBindgen.Patterns.Enum.Simple
HsBindgen.Patterns.LibC.Arch
HsBindgen.Runtime.LibC.Arch
HsBindgen.Runtime.Patterns.Arithmetic
HsBindgen.Runtime.Patterns.Backtrace
HsBindgen.Runtime.Patterns.Enum.Bitfield
HsBindgen.Runtime.Patterns.Enum.Simple
hs-source-dirs:
src
if arch(x86_64)
Expand Down
2 changes: 2 additions & 0 deletions hs-bindgen-runtime/src-aarch64/HsBindgen/Runtime/LibC/Arch.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module HsBindgen.Runtime.LibC.Arch (
) where
2 changes: 2 additions & 0 deletions hs-bindgen-runtime/src-x86_64/HsBindgen/Runtime/LibC/Arch.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module HsBindgen.Runtime.LibC.Arch (
) where
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module HsBindgen.ConstantArray (
module HsBindgen.Runtime.ConstantArray (
ConstantArray,
) where

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE MagicHash #-}
module HsBindgen.Patterns.FlexibleArrayMember (
module HsBindgen.Runtime.FlexibleArrayMember (
HasFlexibleArrayMember (..),
HasFlexibleArrayLength (..),
WithFlexbileArrayMember (..),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module HsBindgen.Patterns.LibC (
module HsBindgen.Runtime.LibC (
-- * Primitive Types
-- $PrimitiveTypes
-- * Boolean Types
Expand Down Expand Up @@ -39,7 +39,7 @@ import Foreign.Storable (Storable)
-- Architecture-dependent definitions are defined in the following /internal/
-- module. Cabal conditionals are used to select the source corresponding to
-- the host architecture.
import HsBindgen.Patterns.LibC.Arch ()
import HsBindgen.Runtime.LibC.Arch ()

{-------------------------------------------------------------------------------
Primitive Types
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
-- | Design patterns for writing high-level FFI bindings
--
-- This is the only exported module in this library. It is intended to be
-- imported unqualified.
--
-- __NOTE__: This library is little more than an experiment in its current form,
-- with some patterns to support the FFI bindings that @hs-bindgen@ itself needs
-- (for the @libclang@ bindings).
module HsBindgen.Patterns (
-- This module is intended to be imported unqualified.
module HsBindgen.Runtime.Patterns (
-- * Enums
-- ** Simple
SimpleEnum(..)
Expand All @@ -33,7 +28,7 @@ module HsBindgen.Patterns (
, Div(..)
) where

import HsBindgen.Patterns.Arithmetic
import HsBindgen.Patterns.Backtrace
import HsBindgen.Patterns.Enum.Bitfield
import HsBindgen.Patterns.Enum.Simple
import HsBindgen.Runtime.Patterns.Arithmetic
import HsBindgen.Runtime.Patterns.Backtrace
import HsBindgen.Runtime.Patterns.Enum.Bitfield
import HsBindgen.Runtime.Patterns.Enum.Simple
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE DerivingVia #-}

module HsBindgen.Patterns.Arithmetic
module HsBindgen.Runtime.Patterns.Arithmetic
( Div(..) ) where

import Data.Kind
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# LANGUAGE CPP #-}

-- | Shim to provide backtrace support
module HsBindgen.Patterns.Backtrace (
module HsBindgen.Runtime.Patterns.Backtrace (
Backtrace
, prettyBacktrace
, collectBacktrace
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module HsBindgen.Patterns.Enum.Bitfield (
module HsBindgen.Runtime.Patterns.Enum.Bitfield (
BitfieldEnum(..)
, IsSingleFlag(..)
-- * API
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE CPP #-}

module HsBindgen.Patterns.Enum.Simple (
module HsBindgen.Runtime.Patterns.Enum.Simple (
SimpleEnum(..)
, IsSimpleEnum(..)
, SimpleEnumOutOfRange(..)
Expand Down
4 changes: 2 additions & 2 deletions hs-bindgen/hs-bindgen.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ library
build-depends:
-- Internal dependencies
, hs-bindgen-libclang
, hs-bindgen-patterns
, hs-bindgen-runtime
build-depends:
-- External dependencies
, containers >= 0.6.5.1 && < 0.8
Expand Down Expand Up @@ -176,7 +176,7 @@ test-suite golden
build-depends:
-- Internal dependencies
, hs-bindgen
, hs-bindgen-patterns
, hs-bindgen-runtime
build-depends:
-- Inherited dependencies
, bytestring
Expand Down
10 changes: 5 additions & 5 deletions hs-bindgen/src/HsBindgen/Backend/TH.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import GHC.Float
, castWord32ToFloat , castFloatToWord32 )

import HsBindgen.C.AST.Literal (canBeRepresentedAsRational)
import HsBindgen.ConstantArray qualified
import HsBindgen.Hs.AST.Name
import HsBindgen.Hs.AST.Type
import HsBindgen.Imports
import HsBindgen.NameHint
import HsBindgen.Patterns qualified (Div(..))
import HsBindgen.Runtime.ConstantArray qualified
import HsBindgen.Runtime.Patterns qualified (Div(..))
import HsBindgen.SHs.AST

import DeBruijn
Expand All @@ -50,15 +50,15 @@ mkGlobal = \case
Storable_poke -> 'Foreign.Storable.poke
Foreign_Ptr -> ''Foreign.Ptr.Ptr
Foreign_FunPtr -> ''Foreign.Ptr.FunPtr
ConstantArray -> ''HsBindgen.ConstantArray.ConstantArray
ConstantArray -> ''HsBindgen.Runtime.ConstantArray.ConstantArray
IO_type -> ''IO

Eq_class -> ''Eq
Ord_class -> ''Ord
Num_class -> ''Num
Integral_class -> ''Integral
Fractional_class -> ''Fractional
Div_class -> ''HsBindgen.Patterns.Div
Div_class -> ''HsBindgen.Runtime.Patterns.Div
Bits_class -> ''Data.Bits.Bits

Eq_eq -> '(==)
Expand All @@ -81,7 +81,7 @@ mkGlobal = \case
Num_add -> '(+)
Num_minus -> '(-)
Num_times -> '(*)
Div_div -> '(HsBindgen.Patterns./)
Div_div -> '(HsBindgen.Runtime.Patterns./)
Integral_rem -> 'rem
GHC_Float_castWord32ToFloat -> 'GHC.Float.castWord32ToFloat
GHC_Float_castWord64ToDouble -> 'GHC.Float.castWord64ToDouble
Expand Down
2 changes: 1 addition & 1 deletion hs-bindgen/src/HsBindgen/C/Fold/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import HsBindgen.C.Predicate qualified as Predicate
import HsBindgen.Clang.HighLevel qualified as HighLevel
import HsBindgen.Clang.HighLevel.Types
import HsBindgen.Clang.LowLevel.Core
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns
import HsBindgen.Util.Tracer

{-------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion hs-bindgen/src/HsBindgen/C/Fold/Decl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import HsBindgen.C.Reparse
import HsBindgen.Clang.HighLevel qualified as HighLevel
import HsBindgen.Clang.HighLevel.Types
import HsBindgen.Clang.LowLevel.Core
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns
import HsBindgen.Util.Tracer
import HsBindgen.C.Tc.Macro (tcMacro)

Expand Down
2 changes: 1 addition & 1 deletion hs-bindgen/src/HsBindgen/C/Fold/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import HsBindgen.C.Reparse
import HsBindgen.Clang.HighLevel qualified as HighLevel
import HsBindgen.Clang.HighLevel.Types
import HsBindgen.Clang.LowLevel.Core
import HsBindgen.Patterns
import HsBindgen.Runtime.Patterns
import HsBindgen.Util.Tracer

{-------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 292ced9

Please sign in to comment.