Skip to content

Commit 471dcde

Browse files
committed
Fixed URL in extension comments.
1 parent eeb74b6 commit 471dcde

13 files changed

+33
-39
lines changed

RegistryProcessor/src/Main.hs

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ printFeature :: API -> Version -> ProfileName -> Registry -> IO ()
3636
printFeature api version profile registry = do
3737
let relName = capitalize (unProfileName profile) ++
3838
show (major version) ++ show (minor version)
39-
printExtension Nothing [relName] $ fixedReplay api version profile registry
39+
printExtension Nothing relName [] $ fixedReplay api version profile registry
4040

4141
printTokens :: API -> Registry -> IO ()
4242
printTokens api registry = do
4343
let comment =
4444
["All enumeration tokens from the",
4545
"<http://www.opengl.org/registry/ OpenGL registry>."]
46-
startModule Nothing ["Tokens"] Nothing comment $ \moduleName h -> do
46+
startModule Nothing "Tokens" Nothing comment $ \moduleName h -> do
4747
SI.hPutStrLn h $ "module " ++ moduleName ++ " where"
4848
SI.hPutStrLn h ""
4949
SI.hPutStrLn h "import Graphics.Rendering.OpenGL.Raw.Types"
@@ -67,7 +67,7 @@ signatureMap registry = fst $ M.foldl' step (M.empty, 0) (commands registry)
6767
printForeign :: M.Map String String -> IO ()
6868
printForeign sigMap = do
6969
let comment = ["All foreign imports."]
70-
startModule Nothing ["Foreign"] (Just "{-# LANGUAGE CPP #-}") comment $ \moduleName h -> do
70+
startModule Nothing "Foreign" (Just "{-# LANGUAGE CPP #-}") comment $ \moduleName h -> do
7171
SI.hPutStrLn h $ "module " ++ moduleName ++ " where"
7272
SI.hPutStrLn h ""
7373
SI.hPutStrLn h "import Foreign.C.Types"
@@ -81,7 +81,7 @@ printFunctions api registry sigMap = do
8181
let comment =
8282
["All raw functions from the",
8383
"<http://www.opengl.org/registry/ OpenGL registry>."]
84-
startModule Nothing ["Functions"] Nothing comment $ \moduleName h -> do
84+
startModule Nothing "Functions" Nothing comment $ \moduleName h -> do
8585
SI.hPutStrLn h $ "module " ++ moduleName ++ " ("
8686
SI.hPutStrLn h . separate unCommandName . M.keys . commands $ registry
8787
SI.hPutStrLn h ") where"
@@ -113,29 +113,30 @@ printExtensions api registry = do
113113
, api `supports` extensionSupported ext
114114
, nameAndMods@(_,(_:_)) <- [nameAndModifications api ext] ]
115115
CM.forM_ supportedExtensions $ \(n,mods) -> do
116-
let profileAndModName =
116+
let ("GL":vendor:extWords) = splitBy (== '_') (unExtensionName n)
117+
modSuff = concat (zipWith fixExtensionWord extWords [0 ..])
118+
profileAndModuleNameSuffix =
117119
if any isProfileDependent mods
118-
then [(ProfileName p, extendExtensionName n p)
120+
then [(ProfileName p, modSuff ++ capitalize p)
119121
| p <- ["core", "compatibility"] ]
120-
else [(ProfileName "core", n)] -- the actual profile doesn't matter
121-
CM.forM_ profileAndModName $ \(prof, modName) -> do
122-
let ("GL":vendor:extWords) = splitBy (== '_') (unExtensionName modName)
123-
printExtension (Just vendor) extWords $
122+
else [(ProfileName "core", modSuff)] -- the actual profile doesn't matter
123+
ext = L.intercalate "_" extWords
124+
comment = ["The <https://www.opengl.org/registry/specs/" ++
125+
vendor ++ "/" ++ ext ++ ".txt " ++
126+
vendor ++ "_" ++ ext ++ "> extension."]
127+
CM.forM_ profileAndModuleNameSuffix $ \(prof, moduleNameSuffix) ->
128+
printExtension (Just vendor) moduleNameSuffix comment $
124129
executeModifications api prof registry mods
125130

126131
isProfileDependent :: Modification -> Bool
127132
isProfileDependent = DM.isJust . modificationProfile
128133

129-
extendExtensionName :: ExtensionName -> String -> ExtensionName
130-
extendExtensionName n profile =
131-
ExtensionName . (++ ("_" ++ profile)). unExtensionName $ n
132-
133-
startModule :: Maybe String -> [String] -> Maybe String -> [String] -> (String -> SI.Handle -> IO ()) -> IO ()
134-
startModule mbVendor extWords mbPragma comments action = do
134+
startModule :: Maybe String -> String -> Maybe String -> [String] -> (String -> SI.Handle -> IO ()) -> IO ()
135+
startModule mbVendor moduleNameSuffix mbPragma comments action = do
135136
let moduleNameParts =
136137
["Graphics", "Rendering", "OpenGL", "Raw"] ++
137138
maybe [] (\vendor -> [fixVendor vendor]) mbVendor ++
138-
[concat (zipWith fixExtensionWord extWords [0 ..])]
139+
[moduleNameSuffix]
139140
path = F.joinPath moduleNameParts `F.addExtension` "hs"
140141
moduleName = L.intercalate "." moduleNameParts
141142
D.createDirectoryIfMissing True $ F.takeDirectory path
@@ -208,10 +209,9 @@ separate :: (a -> String) -> [a] -> String
208209
separate f = L.intercalate ",\n" . map (" " ++) . map f
209210

210211
-- Note that we handle features just like extensions.
211-
printExtension :: Maybe String -> [String] -> ([TypeName], [Enum'], [Command]) -> IO ()
212-
printExtension mbVendor extWords (ts, es, cs) = do
213-
let comment = maybe [] (makeExtensionURL extWords) mbVendor
214-
startModule mbVendor extWords Nothing comment $ \moduleName h -> do
212+
printExtension :: Maybe String -> String -> [String] -> ([TypeName], [Enum'], [Command]) -> IO ()
213+
printExtension mbVendor moduleNameSuffix comment (ts, es, cs) =
214+
startModule mbVendor moduleNameSuffix Nothing comment $ \moduleName h -> do
215215
SI.hPutStrLn h $ "module "++ moduleName ++ " ("
216216
CM.unless (null ts) $ do
217217
SI.hPutStrLn h " -- * Types"
@@ -234,12 +234,6 @@ printExtension mbVendor extWords (ts, es, cs) = do
234234
CM.unless (null cs) $
235235
SI.hPutStrLn h "import Graphics.Rendering.OpenGL.Raw.Functions"
236236

237-
makeExtensionURL :: [String] -> String -> [String]
238-
makeExtensionURL extWords vendor =
239-
["The <https://www.opengl.org/registry/specs/" ++
240-
vendor ++ "/" ++ L.intercalate "_" extWords ++ ".txt " ++
241-
L.intercalate "_" (vendor : extWords) ++ "> extension."]
242-
243237
printModuleHeader :: SI.Handle -> Maybe String -> String -> [String] -> IO ()
244238
printModuleHeader h mbPragma moduleName comments = do
245239
maybe (return ()) (SI.hPutStrLn h) mbPragma

src/Graphics/Rendering/OpenGL/Raw/ARB/FramebufferObjectCompatibility.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
-- Stability : stable
99
-- Portability : portable
1010
--
11-
-- The <https://www.opengl.org/registry/specs/ARB/framebuffer_object_compatibility.txt ARB_framebuffer_object_compatibility> extension.
11+
-- The <https://www.opengl.org/registry/specs/ARB/framebuffer_object.txt ARB_framebuffer_object> extension.
1212
--
1313
--------------------------------------------------------------------------------
1414

src/Graphics/Rendering/OpenGL/Raw/ARB/FramebufferObjectCore.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
-- Stability : stable
99
-- Portability : portable
1010
--
11-
-- The <https://www.opengl.org/registry/specs/ARB/framebuffer_object_core.txt ARB_framebuffer_object_core> extension.
11+
-- The <https://www.opengl.org/registry/specs/ARB/framebuffer_object.txt ARB_framebuffer_object> extension.
1212
--
1313
--------------------------------------------------------------------------------
1414

src/Graphics/Rendering/OpenGL/Raw/ARB/ImagingCompatibility.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
-- Stability : stable
99
-- Portability : portable
1010
--
11-
-- The <https://www.opengl.org/registry/specs/ARB/imaging_compatibility.txt ARB_imaging_compatibility> extension.
11+
-- The <https://www.opengl.org/registry/specs/ARB/imaging.txt ARB_imaging> extension.
1212
--
1313
--------------------------------------------------------------------------------
1414

src/Graphics/Rendering/OpenGL/Raw/ARB/ImagingCore.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
-- Stability : stable
99
-- Portability : portable
1010
--
11-
-- The <https://www.opengl.org/registry/specs/ARB/imaging_core.txt ARB_imaging_core> extension.
11+
-- The <https://www.opengl.org/registry/specs/ARB/imaging.txt ARB_imaging> extension.
1212
--
1313
--------------------------------------------------------------------------------
1414

src/Graphics/Rendering/OpenGL/Raw/ARB/RobustnessCompatibility.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
-- Stability : stable
99
-- Portability : portable
1010
--
11-
-- The <https://www.opengl.org/registry/specs/ARB/robustness_compatibility.txt ARB_robustness_compatibility> extension.
11+
-- The <https://www.opengl.org/registry/specs/ARB/robustness.txt ARB_robustness> extension.
1212
--
1313
--------------------------------------------------------------------------------
1414

src/Graphics/Rendering/OpenGL/Raw/ARB/RobustnessCore.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
-- Stability : stable
99
-- Portability : portable
1010
--
11-
-- The <https://www.opengl.org/registry/specs/ARB/robustness_core.txt ARB_robustness_core> extension.
11+
-- The <https://www.opengl.org/registry/specs/ARB/robustness.txt ARB_robustness> extension.
1212
--
1313
--------------------------------------------------------------------------------
1414

src/Graphics/Rendering/OpenGL/Raw/ARB/VertexType2101010RevCompatibility.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
-- Stability : stable
99
-- Portability : portable
1010
--
11-
-- The <https://www.opengl.org/registry/specs/ARB/vertex_type_2_10_10_10_rev_compatibility.txt ARB_vertex_type_2_10_10_10_rev_compatibility> extension.
11+
-- The <https://www.opengl.org/registry/specs/ARB/vertex_type_2_10_10_10_rev.txt ARB_vertex_type_2_10_10_10_rev> extension.
1212
--
1313
--------------------------------------------------------------------------------
1414

src/Graphics/Rendering/OpenGL/Raw/ARB/VertexType2101010RevCore.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
-- Stability : stable
99
-- Portability : portable
1010
--
11-
-- The <https://www.opengl.org/registry/specs/ARB/vertex_type_2_10_10_10_rev_core.txt ARB_vertex_type_2_10_10_10_rev_core> extension.
11+
-- The <https://www.opengl.org/registry/specs/ARB/vertex_type_2_10_10_10_rev.txt ARB_vertex_type_2_10_10_10_rev> extension.
1212
--
1313
--------------------------------------------------------------------------------
1414

src/Graphics/Rendering/OpenGL/Raw/KHR/DebugCompatibility.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
-- Stability : stable
99
-- Portability : portable
1010
--
11-
-- The <https://www.opengl.org/registry/specs/KHR/debug_compatibility.txt KHR_debug_compatibility> extension.
11+
-- The <https://www.opengl.org/registry/specs/KHR/debug.txt KHR_debug> extension.
1212
--
1313
--------------------------------------------------------------------------------
1414

0 commit comments

Comments
 (0)