Skip to content

Commit f8c5257

Browse files
committed
Re-export FooFunc and makeFoo, too.
1 parent 1993a7a commit f8c5257

File tree

8 files changed

+38
-3
lines changed

8 files changed

+38
-3
lines changed

RegistryProcessor/src/Main.hs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,20 @@ fixedReplay api version profile registry
242242
| otherwise = (ts', es, cs)
243243
where (ts, es, cs) = replay api version profile registry
244244
(_, es11, _) = replay api (read "1.1") profile registry
245-
ts' = S.toList . S.unions $ S.fromList ts : map referencedTypes cs
245+
ts' = S.toList . addFuncsAndMakes . S.unions $ S.fromList ts : map referencedTypes cs
246+
247+
-- For debug callbacks, we want to export the Haskell types and their creators, too.
248+
addFuncsAndMakes :: S.Set TypeName -> S.Set TypeName
249+
addFuncsAndMakes =
250+
flip (foldr addFuncAndMake) [
251+
"GLDEBUGPROC",
252+
"GLDEBUGPROCAMD",
253+
"GLDEBUGPROCARB",
254+
"GLDEBUGPROCKHR" ]
255+
where addFuncAndMake t ts
256+
| TypeName t `S.member` ts =
257+
ts `S.union` S.fromList (map TypeName [ t ++ "Func", "make" ++ t ])
258+
| otherwise = ts
246259

247260
-- Here is the heart of the feature construction logic: Chronologically replay
248261
-- the whole version history for the given API/version/profile triple.

src/Graphics/Rendering/OpenGL/Raw/Compatibility43.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
module Graphics.Rendering.OpenGL.Raw.Compatibility43 (
1414
-- * Types
1515
GLDEBUGPROC,
16+
GLDEBUGPROCFunc,
1617
GLbitfield,
1718
GLboolean,
1819
GLbyte,
@@ -35,6 +36,7 @@ module Graphics.Rendering.OpenGL.Raw.Compatibility43 (
3536
GLuint64,
3637
GLushort,
3738
GLvoid,
39+
makeGLDEBUGPROC,
3840
-- * Enums
3941
gl_2D,
4042
gl_2_BYTES,

src/Graphics/Rendering/OpenGL/Raw/Compatibility44.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
module Graphics.Rendering.OpenGL.Raw.Compatibility44 (
1414
-- * Types
1515
GLDEBUGPROC,
16+
GLDEBUGPROCFunc,
1617
GLbitfield,
1718
GLboolean,
1819
GLbyte,
@@ -35,6 +36,7 @@ module Graphics.Rendering.OpenGL.Raw.Compatibility44 (
3536
GLuint64,
3637
GLushort,
3738
GLvoid,
39+
makeGLDEBUGPROC,
3840
-- * Enums
3941
gl_2D,
4042
gl_2_BYTES,

src/Graphics/Rendering/OpenGL/Raw/Compatibility45.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
module Graphics.Rendering.OpenGL.Raw.Compatibility45 (
1414
-- * Types
1515
GLDEBUGPROC,
16+
GLDEBUGPROCFunc,
1617
GLbitfield,
1718
GLboolean,
1819
GLbyte,
@@ -35,6 +36,7 @@ module Graphics.Rendering.OpenGL.Raw.Compatibility45 (
3536
GLuint64,
3637
GLushort,
3738
GLvoid,
39+
makeGLDEBUGPROC,
3840
-- * Enums
3941
gl_2D,
4042
gl_2_BYTES,

src/Graphics/Rendering/OpenGL/Raw/Core43.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
module Graphics.Rendering.OpenGL.Raw.Core43 (
1414
-- * Types
1515
GLDEBUGPROC,
16+
GLDEBUGPROCFunc,
1617
GLbitfield,
1718
GLboolean,
1819
GLbyte,
@@ -35,6 +36,7 @@ module Graphics.Rendering.OpenGL.Raw.Core43 (
3536
GLuint64,
3637
GLushort,
3738
GLvoid,
39+
makeGLDEBUGPROC,
3840
-- * Enums
3941
gl_ACTIVE_ATOMIC_COUNTER_BUFFERS,
4042
gl_ACTIVE_ATTRIBUTES,

src/Graphics/Rendering/OpenGL/Raw/Core44.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
module Graphics.Rendering.OpenGL.Raw.Core44 (
1414
-- * Types
1515
GLDEBUGPROC,
16+
GLDEBUGPROCFunc,
1617
GLbitfield,
1718
GLboolean,
1819
GLbyte,
@@ -35,6 +36,7 @@ module Graphics.Rendering.OpenGL.Raw.Core44 (
3536
GLuint64,
3637
GLushort,
3738
GLvoid,
39+
makeGLDEBUGPROC,
3840
-- * Enums
3941
gl_ACTIVE_ATOMIC_COUNTER_BUFFERS,
4042
gl_ACTIVE_ATTRIBUTES,

src/Graphics/Rendering/OpenGL/Raw/Core45.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
module Graphics.Rendering.OpenGL.Raw.Core45 (
1414
-- * Types
1515
GLDEBUGPROC,
16+
GLDEBUGPROCFunc,
1617
GLbitfield,
1718
GLboolean,
1819
GLbyte,
@@ -35,6 +36,7 @@ module Graphics.Rendering.OpenGL.Raw.Core45 (
3536
GLuint64,
3637
GLushort,
3738
GLvoid,
39+
makeGLDEBUGPROC,
3840
-- * Enums
3941
gl_ACTIVE_ATOMIC_COUNTER_BUFFERS,
4042
gl_ACTIVE_ATTRIBUTES,

src/Graphics/Rendering/OpenGL/Raw/Types.hs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ module Graphics.Rendering.OpenGL.Raw.Types (
4949
GLhalfARB,
5050
GLhalfNV,
5151
GLDEBUGPROCAMD, GLDEBUGPROCAMDFunc, makeGLDEBUGPROCAMD,
52-
GLDEBUGPROCARB,
53-
GLDEBUGPROCKHR,
52+
GLDEBUGPROCARB, GLDEBUGPROCARBFunc, makeGLDEBUGPROCARB,
53+
GLDEBUGPROCKHR, GLDEBUGPROCKHRFunc, makeGLDEBUGPROCKHR,
5454

5555
-- * Types from various extensions.
5656
GLclampx,
@@ -208,8 +208,18 @@ foreign import CALLCONV "wrapper"
208208

209209
type GLDEBUGPROCARB = GLDEBUGPROC
210210

211+
type GLDEBUGPROCARBFunc = GLDEBUGPROCFunc
212+
213+
makeGLDEBUGPROCARB :: GLDEBUGPROCARBFunc -> IO (FunPtr GLDEBUGPROCARBFunc)
214+
makeGLDEBUGPROCARB = makeGLDEBUGPROC
215+
211216
type GLDEBUGPROCKHR = GLDEBUGPROC
212217

218+
type GLDEBUGPROCKHRFunc = GLDEBUGPROCFunc
219+
220+
makeGLDEBUGPROCKHR :: GLDEBUGPROCKHRFunc -> IO (FunPtr GLDEBUGPROCKHRFunc)
221+
makeGLDEBUGPROCKHR = makeGLDEBUGPROC
222+
213223
type GLclampx = CInt
214224
-- NOTE: OpenGL ES uses khronos_int32_t for this.
215225

0 commit comments

Comments
 (0)