Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adds the option for the output directory and corrects some options.

  • Loading branch information...
commit 3630b6e3a7066a8f6d4b8d2d5a6ef29baa35b0f6 1 parent dfd8097
@Laar authored
View
2  OpenGLRawgen.lkshf
@@ -2,7 +2,7 @@ Config flags: ""
Build flags: ""
Haddock flags: ""
Executable flags:
- "--no-vendorf=novendor"
+ "--no-vendorf=novendor -o output -c"
Install flags: ""
Register flags:
""
View
2  README.md
@@ -48,7 +48,7 @@ probably not complete, but these are the major points.)
### Core modules
The major change is probably that the core modules have been rearranged
-. With the -o flag given to the generator there will also be some
+. With the -c flag given to the generator there will also be some
compatibility modules to make the transition easier. In addition all
the types that are generated are exported from all modules. `Raw.hs`
now exports the latest OpenGL specification in stead of all values.
View
10 src/Main.hs
@@ -19,6 +19,7 @@ module Main (
-----------------------------------------------------------------------------
import System.Directory
+import System.FilePath((</>))
import Language.Haskell.Exts.Pretty
import Code.Generating.Utils
@@ -46,17 +47,18 @@ procNew = do
Left e -> print e
Right rawSpec -> do
rawSpec' <- processReuses opts rawSpec
- let modules = makeRaw opts . cleanupSpec opts $ rawSpec'
+ let oDir = outputDir opts
+ modules = makeRaw opts . cleanupSpec opts $ rawSpec'
-- | Post processes a module and writes it to file
pmodule mn m =
let msc = replaceCallConv "CALLCONV" $ prettyPrint m
- in safeWriteFile ("output/" ++ moduleNameToPath mn ++ ".hs") msc
+ in safeWriteFile (oDir </> moduleNameToPath mn ++ ".hs") msc
-- write out the modules
processModules' pmodule modules
-- and a list of exposed and internal modules.
- >> safeWriteFile "output/modulesE.txt" (unlines .
+ >> safeWriteFile (oDir </> "modulesE.txt") (unlines .
map (\n -> " " ++ moduleNameToName n ++ ",") . fst $ listModules modules)
- >> safeWriteFile "output/modulesI.txt" (unlines .
+ >> safeWriteFile (oDir </> "modulesI.txt") (unlines .
map (\n -> " " ++ moduleNameToName n ++ ",") . snd $ listModules modules)
-- | Parse and process the reuse files. It generates no warning if there is
View
12 src/Main/Options.hs
@@ -24,6 +24,7 @@ module Main.Options (
enumextFile, glFile, tmFile,
freuseFile, ereuseFile,
stripNames, mkExtensionGroups,
+ outputDir,
-- * Retrieving the options
getOptions,
) where
@@ -52,7 +53,7 @@ getOptions = do
options :: [OptDescr (RawGenOptions -> IO RawGenOptions)]
options =
- [ Option ['o'] ["old-comp"]
+ [ Option ['c'] ["old-comp"]
(flag RawCompatibility) "Create backward compatiblity modules"
, Option [] ["no-vendor"]
(ReqArg ((\v r -> return r{rgNoExtension = v : rgNoExtension r}) . read) "VENDOR") "No modules for the specified vendor"
@@ -75,9 +76,11 @@ options =
, Option ['S'] ["no-strip"]
(NoArg $ \r -> return r{rgStripName = False}) "Disables striping of the extension suffixes from names"
, Option ['g'] ["groups"]
- (NoArg $ \r -> return r{rgEGrouping = True}) "Disables the generation of Extension group modules"
+ (NoArg $ \r -> return r{rgEGrouping = True}) "Enables the generation of Extension group modules"
, Option ['G'] ["no-groups"]
(NoArg $ \r -> return r{rgEGrouping = False}) "Disables the generation of Extension group modules"
+ , Option ['o'] ["output"]
+ (ReqArg (\d r -> return r{rgOutputDir = d}) "DIR") "The output directory"
]
where
flag :: RawGenFlag -> ArgDescr (RawGenOptions -> IO RawGenOptions)
@@ -110,6 +113,7 @@ data RawGenOptions
, rgFilesDir :: Maybe FilePath -- ^ The location to search for files
, rgStripName :: Bool -- ^ Strip the names of extensions
, rgEGrouping :: Bool -- ^ Adds all the grouping modules for extensions
+ , rgOutputDir :: FilePath
}
defaultOptions :: RawGenOptions
@@ -125,6 +129,7 @@ defaultOptions
, rgFilesDir = Nothing
, rgStripName = False
, rgEGrouping = True
+ , rgOutputDir = ""
}
-----------------------------------------------------------------------------
@@ -155,4 +160,7 @@ stripNames = rgStripName
mkExtensionGroups :: RawGenOptions -> Bool
mkExtensionGroups = rgEGrouping
+outputDir :: RawGenOptions -> FilePath
+outputDir = rgOutputDir
+
-----------------------------------------------------------------------------
Please sign in to comment.
Something went wrong with that request. Please try again.