Skip to content

Commit 69d1a02

Browse files
authored
Merge pull request #355 from well-typed/rename-runtime
Rename to `hs-bindgen-runtime`
2 parents 043f1a2 + cb54298 commit 69d1a02

File tree

44 files changed

+77
-110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+77
-110
lines changed

.github/workflows/haskell-ci.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ jobs:
150150
- name: initial cabal.project for sdist
151151
run: |
152152
touch cabal.project
153-
echo "packages: $GITHUB_WORKSPACE/source/hs-bindgen-patterns" >> cabal.project
153+
echo "packages: $GITHUB_WORKSPACE/source/hs-bindgen-runtime" >> cabal.project
154154
echo "packages: $GITHUB_WORKSPACE/source/hs-bindgen" >> cabal.project
155155
echo "packages: $GITHUB_WORKSPACE/source/hs-bindgen-libclang" >> cabal.project
156156
echo "packages: $GITHUB_WORKSPACE/source/ansi-diff" >> cabal.project
@@ -165,8 +165,8 @@ jobs:
165165
find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
166166
- name: generate cabal.project
167167
run: |
168-
PKGDIR_hs_bindgen_patterns="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/hs-bindgen-patterns-[0-9.]*')"
169-
echo "PKGDIR_hs_bindgen_patterns=${PKGDIR_hs_bindgen_patterns}" >> "$GITHUB_ENV"
168+
PKGDIR_hs_bindgen_runtime="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/hs-bindgen-runtime-[0-9.]*')"
169+
echo "PKGDIR_hs_bindgen_runtime=${PKGDIR_hs_bindgen_runtime}" >> "$GITHUB_ENV"
170170
PKGDIR_hs_bindgen="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/hs-bindgen-[0-9.]*')"
171171
echo "PKGDIR_hs_bindgen=${PKGDIR_hs_bindgen}" >> "$GITHUB_ENV"
172172
PKGDIR_hs_bindgen_libclang="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/hs-bindgen-libclang-[0-9.]*')"
@@ -176,11 +176,11 @@ jobs:
176176
rm -f cabal.project cabal.project.local
177177
touch cabal.project
178178
touch cabal.project.local
179-
echo "packages: ${PKGDIR_hs_bindgen_patterns}" >> cabal.project
179+
echo "packages: ${PKGDIR_hs_bindgen_runtime}" >> cabal.project
180180
echo "packages: ${PKGDIR_hs_bindgen}" >> cabal.project
181181
echo "packages: ${PKGDIR_hs_bindgen_libclang}" >> cabal.project
182182
echo "packages: ${PKGDIR_ansi_diff}" >> cabal.project
183-
echo "package hs-bindgen-patterns" >> cabal.project
183+
echo "package hs-bindgen-runtime" >> cabal.project
184184
echo " ghc-options: -Werror=missing-methods" >> cabal.project
185185
echo "package hs-bindgen" >> cabal.project
186186
echo " ghc-options: -Werror=missing-methods" >> cabal.project
@@ -195,13 +195,13 @@ jobs:
195195
package hs-bindgen-libclang
196196
ghc-options: -Werror
197197
198-
package hs-bindgen-patterns
198+
package hs-bindgen-runtime
199199
ghc-options: -Werror
200200
201201
package ansi-diff
202202
ghc-options: -Werror
203203
EOF
204-
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(ansi-diff|hs-bindgen|hs-bindgen-libclang|hs-bindgen-patterns)$/; }' >> cabal.project.local
204+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(ansi-diff|hs-bindgen|hs-bindgen-libclang|hs-bindgen-runtime)$/; }' >> cabal.project.local
205205
cat cabal.project
206206
cat cabal.project.local
207207
- name: dump install plan
@@ -229,7 +229,7 @@ jobs:
229229
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct
230230
- name: cabal check
231231
run: |
232-
cd ${PKGDIR_hs_bindgen_patterns} || false
232+
cd ${PKGDIR_hs_bindgen_runtime} || false
233233
${CABAL} -vnormal check
234234
cd ${PKGDIR_hs_bindgen} || false
235235
${CABAL} -vnormal check

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ When hand-writing high-level bindings, there are undoubtedly a lot of patterns
137137
that emerge. We should [capture these as Haskell functions or type
138138
classes](https://github.com/well-typed/hs-bindgen/issues/27) and [release this
139139
as a separate library
140-
`hs-bindgen-patterns`](https://github.com/well-typed/hs-bindgen/issues/28).
140+
`hs-bindgen-runtime`](https://github.com/well-typed/hs-bindgen/issues/28).
141141

142142
### [Milestone 3: High-level API](https://github.com/well-typed/hs-bindgen/milestone/4)
143143

144144
Even in the ideal case that _all_ patterns that are used in the construction
145145
of the high-level bindings can be expressed using the patterns provided by the
146-
`hs-bindgen-patterns` library from milestone 2.5, it might still be cumbersome
146+
`hs-bindgen-runtime` library from milestone 2.5, it might still be cumbersome
147147
to have to write them all out, and so some generation might still be useful.
148148

149149
This is all the more important for data type declarations (as opposed to
@@ -161,7 +161,7 @@ files themselves, or through using `hs-bindgen` as a library with customizations
161161
as regular Haskell code. It is conceivable that in cases that would require
162162
extensive customization, perhaps the most direct way to do that customization is
163163
not to use generation at all, but simply write bindings manually, provided that
164-
the `hs-bindgen-patterns` library provides sufficient support.
164+
the `hs-bindgen-runtime` library provides sufficient support.
165165

166166
Nonetheless, there will probably be scenarios where a [set of defaults and
167167
heuristics](https://github.com/well-typed/hs-bindgen/issues/32) can do a good

cabal.project

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
packages: hs-bindgen-patterns
1+
packages: hs-bindgen-runtime
22
packages: hs-bindgen
33
packages: hs-bindgen-libclang
44
packages: hs-bindgen-bootstrap
@@ -12,6 +12,6 @@ package hs-bindgen
1212

1313
package hs-bindgen-libclang
1414

15-
package hs-bindgen-patterns
15+
package hs-bindgen-runtime
1616

1717
package hs-bindgen-testlib

cabal.project.ci

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
packages: hs-bindgen-patterns
1+
packages: hs-bindgen-runtime
22
packages: hs-bindgen
33
packages: hs-bindgen-libclang
44
packages: ansi-diff
@@ -9,7 +9,7 @@ package hs-bindgen
99
package hs-bindgen-libclang
1010
ghc-options: -Werror
1111

12-
package hs-bindgen-patterns
12+
package hs-bindgen-runtime
1313
ghc-options: -Werror
1414

1515
package ansi-diff

hs-bindgen-libclang/clang-ast-dump/Main.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import HsBindgen.Clang.HighLevel qualified as HighLevel
1717
import HsBindgen.Clang.HighLevel.Types
1818
import HsBindgen.Clang.LowLevel.Core
1919
import HsBindgen.Clang.LowLevel.Doxygen
20-
import HsBindgen.Patterns
20+
import HsBindgen.Runtime.Enum.Bitfield
21+
import HsBindgen.Runtime.Enum.Simple
2122

2223
{-------------------------------------------------------------------------------
2324
Options

hs-bindgen-libclang/clang-tutorial/clang-tutorial.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import System.Environment
88

99
import HsBindgen.Clang.Args
1010
import HsBindgen.Clang.LowLevel.Core
11-
import HsBindgen.Patterns
11+
import HsBindgen.Runtime.Enum.Bitfield
12+
import HsBindgen.Runtime.Enum.Simple
1213

1314
{-------------------------------------------------------------------------------
1415
Reproduce the clang tutorial in Haskell

hs-bindgen-libclang/hs-bindgen-libclang.cabal

+3-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ library
8383
HsBindgen.Clang.HighLevel.UserProvided
8484
build-depends:
8585
-- Internal dependencies
86-
, hs-bindgen-patterns
86+
, hs-bindgen-runtime
8787
build-depends:
8888
-- External dependencies
8989
, filepath >= 1.4.2.2 && < 1.6
@@ -110,7 +110,7 @@ executable clang-ast-dump
110110
build-depends:
111111
-- Internal dependencies
112112
, hs-bindgen-libclang
113-
, hs-bindgen-patterns
113+
, hs-bindgen-runtime
114114
build-depends:
115115
-- Inherited dependencies
116116
, text
@@ -127,4 +127,4 @@ test-suite clang-tutorial
127127
build-depends:
128128
-- Internal dependencies
129129
, hs-bindgen-libclang
130-
, hs-bindgen-patterns
130+
, hs-bindgen-runtime

hs-bindgen-libclang/src/HsBindgen/Clang/HighLevel/Diagnostics.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import Foreign.C
1313
import HsBindgen.Clang.LowLevel.Core
1414
import HsBindgen.Clang.HighLevel.SourceLoc (MultiLoc, Range)
1515
import HsBindgen.Clang.HighLevel.SourceLoc qualified as SourceLoc
16-
import HsBindgen.Patterns
16+
import HsBindgen.Runtime.Enum.Bitfield
17+
import HsBindgen.Runtime.Enum.Simple
1718

1819
{-------------------------------------------------------------------------------
1920
Definition

hs-bindgen-libclang/src/HsBindgen/Clang/HighLevel/Documentation.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import GHC.Stack
1919

2020
import HsBindgen.Clang.LowLevel.Core
2121
import HsBindgen.Clang.LowLevel.Doxygen
22-
import HsBindgen.Patterns
22+
import HsBindgen.Runtime.Enum.Simple
2323

2424
{-------------------------------------------------------------------------------
2525
Definition

hs-bindgen-libclang/src/HsBindgen/Clang/HighLevel/Fold.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import Data.IORef (IORef, writeIORef, readIORef, modifyIORef, newIORef)
1515

1616
import HsBindgen.Clang.LowLevel.Core hiding (clang_visitChildren)
1717
import HsBindgen.Clang.LowLevel.Core qualified as Core
18-
import HsBindgen.Patterns
18+
import HsBindgen.Runtime.Enum.Simple
1919

2020
{-------------------------------------------------------------------------------
2121
Definition

hs-bindgen-libclang/src/HsBindgen/Clang/HighLevel/Tokens.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Text.Show.Pretty (PrettyVal(..))
1212

1313
import HsBindgen.Clang.HighLevel.SourceLoc (Range, MultiLoc, SingleLoc)
1414
import HsBindgen.Clang.HighLevel.SourceLoc qualified as SourceLoc
15-
import HsBindgen.Patterns
15+
import HsBindgen.Runtime.Enum.Simple
1616

1717
import HsBindgen.Clang.LowLevel.Core qualified as Core
1818
import HsBindgen.Clang.LowLevel.Core hiding (clang_tokenize)

hs-bindgen-libclang/src/HsBindgen/Clang/Internal/Results.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import Foreign
2020
import GHC.Stack
2121

2222
import HsBindgen.Clang.LowLevel.Core.Instances ()
23-
import HsBindgen.Patterns
23+
import HsBindgen.Runtime.Backtrace
24+
import HsBindgen.Runtime.Enum.Simple
2425

2526
{-------------------------------------------------------------------------------
2627
Failed calls

hs-bindgen-libclang/src/HsBindgen/Clang/LowLevel/Core.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ import HsBindgen.Clang.Internal.CXString ()
206206
import HsBindgen.Clang.Internal.FFI
207207
import HsBindgen.Clang.Internal.Results
208208
import HsBindgen.Clang.Version
209-
import HsBindgen.Patterns
209+
import HsBindgen.Runtime.Enum.Bitfield
210+
import HsBindgen.Runtime.Enum.Simple
210211

211212
{-------------------------------------------------------------------------------
212213
Top-level

hs-bindgen-libclang/src/HsBindgen/Clang/LowLevel/Core/Instances.hsc

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ module HsBindgen.Clang.LowLevel.Core.Instances () where
1515
import HsBindgen.Clang.LowLevel.Core.Enums
1616
import HsBindgen.Clang.LowLevel.Core.Structs
1717
import HsBindgen.Clang.Internal.ByValue
18-
import HsBindgen.Patterns
18+
import HsBindgen.Runtime.Enum.Bitfield
19+
import HsBindgen.Runtime.Enum.Simple
1920

2021
#include <clang-c/Index.h>
2122
#include "clang_wrappers.h"

hs-bindgen-libclang/src/HsBindgen/Clang/LowLevel/Doxygen.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ import HsBindgen.Clang.LowLevel.Doxygen.Structs
6969
import HsBindgen.Clang.Internal.ByValue
7070
import HsBindgen.Clang.Internal.CXString ()
7171
import HsBindgen.Clang.Internal.Results
72-
import HsBindgen.Patterns
72+
import HsBindgen.Runtime.Enum.Simple
7373

7474
{-------------------------------------------------------------------------------
7575
Top-level

hs-bindgen-libclang/src/HsBindgen/Clang/LowLevel/Doxygen/Instances.hsc

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module HsBindgen.Clang.LowLevel.Doxygen.Instances () where
55
import HsBindgen.Clang.LowLevel.Doxygen.Enums
66
import HsBindgen.Clang.LowLevel.Doxygen.Structs
77
import HsBindgen.Clang.Internal.ByValue
8-
import HsBindgen.Patterns
8+
import HsBindgen.Runtime.Enum.Simple
99

1010
#include <clang-c/Documentation.h>
1111

hs-bindgen-libclang/src/HsBindgen/Clang/LowLevel/FFI.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Foreign.C.Types
44
import HsBindgen.Clang.Internal.ByValue
55
import HsBindgen.Clang.LowLevel.Core.Enums
66
import HsBindgen.Clang.LowLevel.Core.Structs
7-
import HsBindgen.Patterns
7+
import HsBindgen.Runtime.Enum.Simple
88
-- Type information for CXCursors https://clang.llvm.org/doxygen/group__CINDEX__TYPES.html
99

1010
foreign import capi unsafe "clang_wrappers.h"

hs-bindgen-libclang/src/HsBindgen/Clang/Version.hsc

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Text.Show.Pretty (PrettyVal)
1616
import System.IO.Unsafe (unsafePerformIO)
1717

1818
import HsBindgen.Clang.Internal.Results (callFailed)
19-
import HsBindgen.Patterns
19+
import HsBindgen.Runtime.Enum.Simple
2020

2121
#include "clang_wrappers.h"
2222

hs-bindgen-patterns/src-aarch64/HsBindgen/Patterns/LibC/Arch.hs

-2
This file was deleted.

hs-bindgen-patterns/src-x86_64/HsBindgen/Patterns/LibC/Arch.hs

-2
This file was deleted.

hs-bindgen-patterns/src/HsBindgen/Patterns.hs

-39
This file was deleted.

hs-bindgen-patterns/CHANGELOG.md renamed to hs-bindgen-runtime/CHANGELOG.md

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

33
## 0.1.0 -- YYYY-mm-dd
44

File renamed without changes.

hs-bindgen-patterns/hs-bindgen-patterns.cabal renamed to hs-bindgen-runtime/hs-bindgen-runtime.cabal

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cabal-version: 3.0
2-
name: hs-bindgen-patterns
2+
name: hs-bindgen-runtime
33
version: 0.1.0
44
synopsis: Design patterns for writing high-level FFI bindings
55
license: BSD-3-Clause
@@ -36,16 +36,15 @@ library
3636
import:
3737
lang
3838
exposed-modules:
39-
HsBindgen.ConstantArray
40-
HsBindgen.Patterns
41-
HsBindgen.Patterns.FlexibleArrayMember
42-
HsBindgen.Patterns.LibC
39+
HsBindgen.Runtime.Arithmetic
40+
HsBindgen.Runtime.Backtrace
41+
HsBindgen.Runtime.ConstantArray
42+
HsBindgen.Runtime.Enum.Bitfield
43+
HsBindgen.Runtime.Enum.Simple
44+
HsBindgen.Runtime.FlexibleArrayMember
45+
HsBindgen.Runtime.LibC
4346
other-modules:
44-
HsBindgen.Patterns.Arithmetic
45-
HsBindgen.Patterns.Backtrace
46-
HsBindgen.Patterns.Enum.Bitfield
47-
HsBindgen.Patterns.Enum.Simple
48-
HsBindgen.Patterns.LibC.Arch
47+
HsBindgen.Runtime.LibC.Arch
4948
hs-source-dirs:
5049
src
5150
if arch(x86_64)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module HsBindgen.Runtime.LibC.Arch (
2+
) where
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module HsBindgen.Runtime.LibC.Arch (
2+
) where

hs-bindgen-patterns/src/HsBindgen/Patterns/Arithmetic.hs renamed to hs-bindgen-runtime/src/HsBindgen/Runtime/Arithmetic.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{-# LANGUAGE DerivingVia #-}
22

3-
module HsBindgen.Patterns.Arithmetic
3+
module HsBindgen.Runtime.Arithmetic
44
( Div(..) ) where
55

66
import Data.Kind

hs-bindgen-patterns/src/HsBindgen/Patterns/Backtrace.hs renamed to hs-bindgen-runtime/src/HsBindgen/Runtime/Backtrace.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{-# LANGUAGE CPP #-}
22

33
-- | Shim to provide backtrace support
4-
module HsBindgen.Patterns.Backtrace (
4+
module HsBindgen.Runtime.Backtrace (
55
Backtrace
66
, prettyBacktrace
77
, collectBacktrace

hs-bindgen-patterns/src/HsBindgen/ConstantArray.hs renamed to hs-bindgen-runtime/src/HsBindgen/Runtime/ConstantArray.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module HsBindgen.ConstantArray (
1+
module HsBindgen.Runtime.ConstantArray (
22
ConstantArray,
33
) where
44

hs-bindgen-patterns/src/HsBindgen/Patterns/Enum/Bitfield.hs renamed to hs-bindgen-runtime/src/HsBindgen/Runtime/Enum/Bitfield.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module HsBindgen.Patterns.Enum.Bitfield (
1+
module HsBindgen.Runtime.Enum.Bitfield (
22
BitfieldEnum(..)
33
, IsSingleFlag(..)
44
-- * API

hs-bindgen-patterns/src/HsBindgen/Patterns/Enum/Simple.hs renamed to hs-bindgen-runtime/src/HsBindgen/Runtime/Enum/Simple.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{-# LANGUAGE CPP #-}
22

3-
module HsBindgen.Patterns.Enum.Simple (
3+
module HsBindgen.Runtime.Enum.Simple (
44
SimpleEnum(..)
55
, IsSimpleEnum(..)
66
, SimpleEnumOutOfRange(..)

hs-bindgen-patterns/src/HsBindgen/Patterns/FlexibleArrayMember.hs renamed to hs-bindgen-runtime/src/HsBindgen/Runtime/FlexibleArrayMember.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{-# LANGUAGE MagicHash #-}
2-
module HsBindgen.Patterns.FlexibleArrayMember (
2+
module HsBindgen.Runtime.FlexibleArrayMember (
33
HasFlexibleArrayMember (..),
44
HasFlexibleArrayLength (..),
55
WithFlexbileArrayMember (..),

0 commit comments

Comments
 (0)