Permalink
Browse files

Applies the changes in GLName and HSName.

  • Loading branch information...
1 parent 4cba1d9 commit 91560f1d5cfaab040a763fe1df36a35bce981a49 @Laar committed Mar 30, 2013
Showing with 11 additions and 14 deletions.
  1. +3 −3 src/Code/ModuleCode.hs
  2. +6 −8 src/Interface/Module.hs
  3. +2 −3 src/Spec/RawSpec.hs
View
@@ -163,8 +163,8 @@ funcTemplate name ty glname category = flip fmap askExtensionModule $ \emod ->
-- Two extra names, the unname function is needed here to keep the
-- names every where else for type safety, consider this the safe usage of
-- an unsafe function.
- let dynEntry = Ident $ "dyn_" ++ unname name
- ptrEntry = Ident $ "ptr_" ++ unname name
+ let dynEntry = Ident $ "dyn_" ++ unHSName name
+ ptrEntry = Ident $ "ptr_" ++ unHSName name
-- The FFI import decl of the form
--
-- > foreign import stdcall unsafe "dynamic" dyn_funcName ::
@@ -189,7 +189,7 @@ funcTemplate name ty glname category = flip fmap askExtensionModule $ \emod ->
, oneLiner ptrEntry []
( var' "unsafePerformIO" .$. (Var . Qual emod $ Ident "getExtensionEntry")
@@ (Lit . String $ "GL_" ++ showCategory category)
- @@ (Lit . String $ "gl" ++ glname))
+ @@ (Lit . String $ "gl" ++ unGLName glname))
]
in fimport : function ++ funcPointer
View
@@ -64,18 +64,16 @@ moduleToInterface rm =
-- | Adds a `ModulePart` to the interface of a module.
addModulePart :: ModulePart -> ModuleI -> ModuleI
addModulePart p m = case p of
- DefineEnum n gln t _ -> addEnum $ EnumI gln (unName n) t
- ReDefineLEnum n gln t _ -> addEnum $ EnumI gln (unName n) t
- ReDefineIEnum n gln t _ -> addEnum $ EnumI gln (unName n) t
- ReExport (_,m') gln -> addReExport $ SingleExport m' gln
- DefineFunc n rt ats gln _ -> addFunc $ FuncI gln (unName n) rt ats
- ReExportModule m' -> addReExport $ ModuleExport m'
+ DefineEnum hsn gln t _ -> addEnum $ EnumI gln hsn t
+ ReDefineLEnum hsn gln t _ -> addEnum $ EnumI gln hsn t
+ ReDefineIEnum hsn gln t _ -> addEnum $ EnumI gln hsn t
+ ReExport (_,m') gln -> addReExport $ SingleExport m' gln
+ DefineFunc hsn rt ats gln _ -> addFunc $ FuncI gln hsn rt ats
+ ReExportModule m' -> addReExport $ ModuleExport m'
where
addEnum e = m{modEnums = S.insert e $ modEnums m}
addFunc f = m{modFuncs = S.insert f $ modFuncs m}
addReExport r = m{modReExports = S.insert r $ modReExports m}
- unName (Ident i) = i
- unName (Symbol s) = s
-----------------------------------------------------------------------------
View
@@ -59,7 +59,6 @@ import qualified Data.Map as M
import qualified Data.Set as S
import Data.Maybe
-import Language.Haskell.Exts.Syntax(Name(Ident))
import Language.OpenGLRaw.Base
import Main.Options
@@ -214,7 +213,7 @@ instance SpecValue EnumValue where
newtype ValueName EnumValue = EN{ unEN :: String }
deriving (Eq, Ord, Show)
wrapName = EN
- toGLName = unEN
+ toGLName = GLName . unEN
unwrapName n o =
let name = unEN n
name' = if stripNames o then removeEnumExtension name else name
@@ -232,7 +231,7 @@ instance SpecValue FuncValue where
newtype ValueName FuncValue = FN{ unFN :: String }
deriving (Eq, Ord, Show)
wrapName = FN
- toGLName = unFN
+ toGLName = GLName . unFN
unwrapName n o =
let name = unFN n
name' = if stripNames o then removeFuncExtension name else name

0 comments on commit 91560f1

Please sign in to comment.