{-# LANGUAGE ViewPatterns #-}
module Data.GI.CodeGen.Overrides
( Overrides(pkgConfigMap, cabalPkgVersion, nsChooseVersion, girFixups,
onlineDocsMap)
, parseOverrides
, filterAPIsAndDeps
) where
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative ((<$>))
import Data.Traversable (traverse)
#endif
import Control.Monad.Except
import Control.Monad.State
import Control.Monad.Writer (WriterT, execWriterT, tell)
import Data.Maybe (isJust)
import qualified Data.Map as M
import Data.Semigroup as Sem
import qualified Data.Set as S
import qualified Data.Text as T
import Data.Text (Text)
import qualified Data.Version as V
import Text.ParserCombinators.ReadP (readP_to_S)
import qualified System.Info as SI
import Data.GI.CodeGen.API
import qualified Text.XML as XML
import Data.GI.CodeGen.PkgConfig (tryPkgConfig)
import Data.GI.CodeGen.Util (tshow, utf8ReadFile)
import Data.GI.GIR.XMLUtils (xmlLocalName, xmlNSName,
GIRXMLNamespace(CGIRNS, GLibGIRNS, CoreGIRNS))
data Overrides = Overrides {
Overrides -> Map Name (Set Text)
ignoredElems :: M.Map Name (S.Set Text),
Overrides -> Set Name
ignoredAPIs :: S.Set Name,
Overrides -> Set Name
sealedStructs :: S.Set Name,
Overrides -> Map Name AllocationInfo
allocInfo :: M.Map Name AllocationInfo,
Overrides -> Map Text Text
pkgConfigMap :: M.Map Text Text,
Overrides -> Maybe Text
cabalPkgVersion :: Maybe Text,
Overrides -> Map Text Text
nsChooseVersion :: M.Map Text Text,
Overrides -> [GIRRule]
girFixups :: [GIRRule],
Overrides -> Map Text Text
onlineDocsMap :: M.Map Text Text
} deriving (Int -> Overrides -> ShowS
[Overrides] -> ShowS
Overrides -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Overrides] -> ShowS
$cshowList :: [Overrides] -> ShowS
show :: Overrides -> String
$cshow :: Overrides -> String
showsPrec :: Int -> Overrides -> ShowS
$cshowsPrec :: Int -> Overrides -> ShowS
Show)
defaultOverrides :: Overrides
defaultOverrides :: Overrides
defaultOverrides = Overrides {
ignoredElems :: Map Name (Set Text)
ignoredElems = forall k a. Map k a
M.empty,
ignoredAPIs :: Set Name
ignoredAPIs = forall a. Set a
S.empty,
sealedStructs :: Set Name
sealedStructs = forall a. Set a
S.empty,
allocInfo :: Map Name AllocationInfo
allocInfo = forall k a. Map k a
M.empty,
pkgConfigMap :: Map Text Text
pkgConfigMap = forall k a. Map k a
M.empty,
cabalPkgVersion :: Maybe Text
cabalPkgVersion = forall a. Maybe a
Nothing,
nsChooseVersion :: Map Text Text
nsChooseVersion = forall k a. Map k a
M.empty,
girFixups :: [GIRRule]
girFixups = [],
onlineDocsMap :: Map Text Text
onlineDocsMap = forall k a. Map k a
M.empty
}
instance Monoid Overrides where
mempty :: Overrides
mempty = Overrides
defaultOverrides
#if !MIN_VERSION_base(4,11,0)
mappend = concatOverrides
#endif
instance Sem.Semigroup Overrides where
<> :: Overrides -> Overrides -> Overrides
(<>) = Overrides -> Overrides -> Overrides
concatOverrides
concatOverrides :: Overrides -> Overrides -> Overrides
concatOverrides :: Overrides -> Overrides -> Overrides
concatOverrides Overrides
a Overrides
b = Overrides {
ignoredAPIs :: Set Name
ignoredAPIs = Overrides -> Set Name
ignoredAPIs Overrides
a forall a. Semigroup a => a -> a -> a
<> Overrides -> Set Name
ignoredAPIs Overrides
b,
sealedStructs :: Set Name
sealedStructs = Overrides -> Set Name
sealedStructs Overrides
a forall a. Semigroup a => a -> a -> a
<> Overrides -> Set Name
sealedStructs Overrides
b,
allocInfo :: Map Name AllocationInfo
allocInfo = Overrides -> Map Name AllocationInfo
allocInfo Overrides
a forall a. Semigroup a => a -> a -> a
<> Overrides -> Map Name AllocationInfo
allocInfo Overrides
b,
ignoredElems :: Map Name (Set Text)
ignoredElems = forall k a. Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
M.unionWith forall a. Ord a => Set a -> Set a -> Set a
S.union (Overrides -> Map Name (Set Text)
ignoredElems Overrides
a) (Overrides -> Map Name (Set Text)
ignoredElems Overrides
b),
pkgConfigMap :: Map Text Text
pkgConfigMap = Overrides -> Map Text Text
pkgConfigMap Overrides
a forall a. Semigroup a => a -> a -> a
<> Overrides -> Map Text Text
pkgConfigMap Overrides
b,
cabalPkgVersion :: Maybe Text
cabalPkgVersion = if forall a. Maybe a -> Bool
isJust (Overrides -> Maybe Text
cabalPkgVersion Overrides
b)
then Overrides -> Maybe Text
cabalPkgVersion Overrides
b
else Overrides -> Maybe Text
cabalPkgVersion Overrides
a,
nsChooseVersion :: Map Text Text
nsChooseVersion = Overrides -> Map Text Text
nsChooseVersion Overrides
a forall a. Semigroup a => a -> a -> a
<> Overrides -> Map Text Text
nsChooseVersion Overrides
b,
girFixups :: [GIRRule]
girFixups = Overrides -> [GIRRule]
girFixups Overrides
a forall a. Semigroup a => a -> a -> a
<> Overrides -> [GIRRule]
girFixups Overrides
b,
onlineDocsMap :: Map Text Text
onlineDocsMap = Overrides -> Map Text Text
onlineDocsMap Overrides
a forall a. Semigroup a => a -> a -> a
<> Overrides -> Map Text Text
onlineDocsMap Overrides
b
}
data ParserState = ParserState {
ParserState -> Maybe Text
currentNS :: Maybe Text
, ParserState -> [Bool]
flags :: [Bool]
} deriving (Int -> ParserState -> ShowS
[ParserState] -> ShowS
ParserState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParserState] -> ShowS
$cshowList :: [ParserState] -> ShowS
show :: ParserState -> String
$cshow :: ParserState -> String
showsPrec :: Int -> ParserState -> ShowS
$cshowsPrec :: Int -> ParserState -> ShowS
Show)
emptyParserState :: ParserState
emptyParserState :: ParserState
emptyParserState = ParserState {
currentNS :: Maybe Text
currentNS = forall a. Maybe a
Nothing
, flags :: [Bool]
flags = []
}
getNS :: Parser (Maybe Text)
getNS :: Parser (Maybe Text)
getNS = ParserState -> Maybe Text
currentNS forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall s (m :: * -> *). MonadState s m => m s
get
withFlags :: Parser () -> Parser ()
withFlags :: Parser () -> Parser ()
withFlags Parser ()
p = do
[Bool]
fs <- ParserState -> [Bool]
flags forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall s (m :: * -> *). MonadState s m => m s
get
if forall (t :: * -> *). Foldable t => t Bool -> Bool
and [Bool]
fs
then Parser ()
p
else forall (m :: * -> *) a. Monad m => a -> m a
return ()
type Parser a = WriterT Overrides (StateT ParserState (ExceptT Text IO)) a
parseOverrides :: Text -> IO (Either Text Overrides)
parseOverrides :: Text -> IO (Either Text Overrides)
parseOverrides Text
overrides = do
forall e (m :: * -> *) a. ExceptT e m a -> m (Either e a)
runExceptT forall a b. (a -> b) -> a -> b
$ forall a b c. (a -> b -> c) -> b -> a -> c
flip forall (m :: * -> *) s a. Monad m => StateT s m a -> s -> m a
evalStateT ParserState
emptyParserState forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) w a. Monad m => WriterT w m a -> m w
execWriterT forall a b. (a -> b) -> a -> b
$
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (Text -> Parser ()
parseOneLine forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Text
T.strip) (Text -> [Text]
T.lines Text
overrides)
parseOneLine :: Text -> Parser ()
parseOneLine :: Text -> Parser ()
parseOneLine Text
line | Text -> Bool
T.null Text
line = forall (m :: * -> *) a. Monad m => a -> m a
return ()
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"#" -> Just Text
_) = forall (m :: * -> *) a. Monad m => a -> m a
return ()
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"namespace " -> Just Text
ns) =
Parser () -> Parser ()
withFlags forall a b. (a -> b) -> a -> b
$ forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify' (\ParserState
s -> ParserState
s {currentNS :: Maybe Text
currentNS = (forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Text
T.strip) Text
ns})
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"ignore " -> Just Text
ign) =
Parser () -> Parser ()
withFlags forall a b. (a -> b) -> a -> b
$ Parser (Maybe Text)
getNS forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Text -> Maybe Text -> Parser ()
parseIgnore Text
ign
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"seal " -> Just Text
s) =
Parser () -> Parser ()
withFlags forall a b. (a -> b) -> a -> b
$ Parser (Maybe Text)
getNS forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Text -> Maybe Text -> Parser ()
parseSeal Text
s
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"alloc-info " -> Just Text
s) =
Parser () -> Parser ()
withFlags forall a b. (a -> b) -> a -> b
$ Parser (Maybe Text)
getNS forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Text -> Maybe Text -> Parser ()
parseAllocInfo Text
s
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"pkg-config-name " -> Just Text
s) =
Parser () -> Parser ()
withFlags forall a b. (a -> b) -> a -> b
$ Text -> Parser ()
parsePkgConfigName Text
s
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"cabal-pkg-version " -> Just Text
s) =
Parser () -> Parser ()
withFlags forall a b. (a -> b) -> a -> b
$ Text -> Parser ()
parseCabalPkgVersion Text
s
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"namespace-version " -> Just Text
s) =
Parser () -> Parser ()
withFlags forall a b. (a -> b) -> a -> b
$ Text -> Parser ()
parseNsVersion Text
s
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"set-attr " -> Just Text
s) =
Parser () -> Parser ()
withFlags forall a b. (a -> b) -> a -> b
$ Text -> Parser ()
parseSetAttr Text
s
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"delete-attr " -> Just Text
s) =
Parser () -> Parser ()
withFlags forall a b. (a -> b) -> a -> b
$ Text -> Parser ()
parseDeleteAttr Text
s
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"add-node " -> Just Text
s) =
Parser () -> Parser ()
withFlags forall a b. (a -> b) -> a -> b
$ Text -> Parser ()
parseAdd Text
s
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"delete-node " -> Just Text
s) =
Parser () -> Parser ()
withFlags forall a b. (a -> b) -> a -> b
$ Text -> Parser ()
parseDelete Text
s
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"C-docs-url " -> Just Text
u) =
Parser () -> Parser ()
withFlags forall a b. (a -> b) -> a -> b
$ Text -> Parser ()
parseDocsUrl Text
u
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"if " -> Just Text
s) = Text -> Parser ()
parseIf Text
s
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"endif" -> Just Text
s) = Text -> Parser ()
parseEndif Text
s
parseOneLine (Text -> Text -> Maybe Text
T.stripPrefix Text
"include " -> Just Text
s) = Text -> Parser ()
parseInclude Text
s
parseOneLine Text
l = forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError forall a b. (a -> b) -> a -> b
$ Text
"Could not understand \"" forall a. Semigroup a => a -> a -> a
<> Text
l forall a. Semigroup a => a -> a -> a
<> Text
"\"."
parseIgnore :: Text -> Maybe Text -> Parser ()
parseIgnore :: Text -> Maybe Text -> Parser ()
parseIgnore Text
_ Maybe Text
Nothing =
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError Text
"'ignore' requires a namespace to be defined first."
parseIgnore (Text -> [Text]
T.words -> [Text -> Text -> [Text]
T.splitOn Text
"." -> [Text
api,Text
elem]]) (Just Text
ns) =
forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell forall a b. (a -> b) -> a -> b
$ Overrides
defaultOverrides {ignoredElems :: Map Name (Set Text)
ignoredElems = forall k a. k -> a -> Map k a
M.singleton (Text -> Text -> Name
Name Text
ns Text
api)
(forall a. a -> Set a
S.singleton Text
elem)}
parseIgnore (Text -> [Text]
T.words -> [Text -> Text -> [Text]
T.splitOn Text
"." -> [Text
api]]) (Just Text
ns) =
forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell forall a b. (a -> b) -> a -> b
$ Overrides
defaultOverrides {ignoredAPIs :: Set Name
ignoredAPIs = forall a. a -> Set a
S.singleton (Text -> Text -> Name
Name Text
ns Text
api)}
parseIgnore Text
ignore Maybe Text
_ =
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"Ignore syntax is of the form \"ignore API.elem\" with '.elem' optional.\nGot \"ignore " forall a. Semigroup a => a -> a -> a
<> Text
ignore forall a. Semigroup a => a -> a -> a
<> Text
"\" instead.")
parseSeal :: Text -> Maybe Text -> Parser ()
parseSeal :: Text -> Maybe Text -> Parser ()
parseSeal Text
_ Maybe Text
Nothing = forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError Text
"'seal' requires a namespace to be defined first."
parseSeal (Text -> [Text]
T.words -> [Text
s]) (Just Text
ns) = forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell forall a b. (a -> b) -> a -> b
$
Overrides
defaultOverrides {sealedStructs :: Set Name
sealedStructs = forall a. a -> Set a
S.singleton (Text -> Text -> Name
Name Text
ns Text
s)}
parseSeal Text
seal Maybe Text
_ =
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"seal syntax is of the form \"seal name\".\nGot \"seal "
forall a. Semigroup a => a -> a -> a
<> Text
seal forall a. Semigroup a => a -> a -> a
<> Text
"\" instead.")
parseAllocInfo :: Text -> Maybe Text -> Parser ()
parseAllocInfo :: Text -> Maybe Text -> Parser ()
parseAllocInfo Text
_ Maybe Text
Nothing = forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError Text
"'alloc-info' requires a namespace to be defined first."
parseAllocInfo (Text -> [Text]
T.words -> (Text
n:[Text]
ops)) (Just Text
ns) = do
[(Text, Text)]
parsedOps <- forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse Text -> Parser (Text, Text)
parseKeyValuePair [Text]
ops
AllocationInfo
info <- forall (t :: * -> *) (m :: * -> *) b a.
(Foldable t, Monad m) =>
(b -> a -> m b) -> b -> t a -> m b
foldM AllocationInfo -> (Text, Text) -> Parser AllocationInfo
applyOp AllocationInfo
unknownAllocationInfo [(Text, Text)]
parsedOps
forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell forall a b. (a -> b) -> a -> b
$ Overrides
defaultOverrides {allocInfo :: Map Name AllocationInfo
allocInfo = forall k a. k -> a -> Map k a
M.singleton (Text -> Text -> Name
Name Text
ns Text
n) AllocationInfo
info}
where applyOp :: AllocationInfo -> (Text, Text) -> Parser AllocationInfo
applyOp :: AllocationInfo -> (Text, Text) -> Parser AllocationInfo
applyOp AllocationInfo
a (Text
"calloc", Text
f) = forall (m :: * -> *) a. Monad m => a -> m a
return (AllocationInfo
a {allocCalloc :: AllocationOp
allocCalloc = Text -> AllocationOp
AllocationOp Text
f})
applyOp AllocationInfo
a (Text
"copy", Text
f) = forall (m :: * -> *) a. Monad m => a -> m a
return (AllocationInfo
a {allocCopy :: AllocationOp
allocCopy = Text -> AllocationOp
AllocationOp Text
f})
applyOp AllocationInfo
a (Text
"free", Text
f) = forall (m :: * -> *) a. Monad m => a -> m a
return (AllocationInfo
a {allocFree :: AllocationOp
allocFree = Text -> AllocationOp
AllocationOp Text
f})
applyOp AllocationInfo
_ (Text
op, Text
_) = forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"Unknown alloc op \"" forall a. Semigroup a => a -> a -> a
<> Text
op forall a. Semigroup a => a -> a -> a
<> Text
"\".")
parseAllocInfo Text
info Maybe Text
_ =
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"alloc-info syntax is of the form "
forall a. Semigroup a => a -> a -> a
<> Text
"\"alloc-info name calloc copy free\", with \"-\" meaning "
forall a. Semigroup a => a -> a -> a
<> Text
"a masked operation. Got \"alloc-info " forall a. Semigroup a => a -> a -> a
<> Text
info
forall a. Semigroup a => a -> a -> a
<> Text
"\" instead.")
parseKeyValuePair :: Text -> Parser (Text, Text)
parseKeyValuePair :: Text -> Parser (Text, Text)
parseKeyValuePair Text
p =
case Text -> Text -> [Text]
T.splitOn Text
"=" Text
p of
[Text
k,Text
v] -> forall (m :: * -> *) a. Monad m => a -> m a
return (Text
k, Text
v)
[Text]
_ -> forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"Could not parse \"" forall a. Semigroup a => a -> a -> a
<> Text
p forall a. Semigroup a => a -> a -> a
<> Text
"\"as a \"key=value\" pair.")
parsePkgConfigName :: Text -> Parser ()
parsePkgConfigName :: Text -> Parser ()
parsePkgConfigName (Text -> [Text]
T.words -> [Text
gi,Text
pc]) = forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell forall a b. (a -> b) -> a -> b
$
Overrides
defaultOverrides {pkgConfigMap :: Map Text Text
pkgConfigMap =
forall k a. k -> a -> Map k a
M.singleton (Text -> Text
T.toLower Text
gi) Text
pc}
parsePkgConfigName Text
t =
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"pkg-config-name syntax is of the form\n" forall a. Semigroup a => a -> a -> a
<>
Text
"\t\"pkg-config-name gi-namespace pk-name\"\n" forall a. Semigroup a => a -> a -> a
<>
Text
"Got \"pkg-config-name " forall a. Semigroup a => a -> a -> a
<> Text
t forall a. Semigroup a => a -> a -> a
<> Text
"\" instead.")
parseNsVersion :: Text -> Parser ()
parseNsVersion :: Text -> Parser ()
parseNsVersion (Text -> [Text]
T.words -> [Text
ns,Text
version]) = forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell forall a b. (a -> b) -> a -> b
$
Overrides
defaultOverrides {nsChooseVersion :: Map Text Text
nsChooseVersion =
forall k a. k -> a -> Map k a
M.singleton Text
ns Text
version}
parseNsVersion Text
t =
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"namespace-version syntax is of the form\n" forall a. Semigroup a => a -> a -> a
<>
Text
"\t\"namespace-version namespace version\"\n" forall a. Semigroup a => a -> a -> a
<>
Text
"Got \"namespace-version " forall a. Semigroup a => a -> a -> a
<> Text
t forall a. Semigroup a => a -> a -> a
<> Text
"\" instead.")
parseCabalPkgVersion :: Text -> Parser ()
parseCabalPkgVersion :: Text -> Parser ()
parseCabalPkgVersion (Text -> [Text]
T.words -> [Text
version]) = forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell forall a b. (a -> b) -> a -> b
$
Overrides
defaultOverrides {cabalPkgVersion :: Maybe Text
cabalPkgVersion = forall a. a -> Maybe a
Just Text
version}
parseCabalPkgVersion Text
t =
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"cabal-pkg-version syntax is of the form\n" forall a. Semigroup a => a -> a -> a
<>
Text
"\t\"cabal-pkg-version version\"\n" forall a. Semigroup a => a -> a -> a
<>
Text
"Got \"cabal-pkg-version " forall a. Semigroup a => a -> a -> a
<> Text
t forall a. Semigroup a => a -> a -> a
<> Text
"\" instead.")
parseSetAttr :: Text -> Parser ()
parseSetAttr :: Text -> Parser ()
parseSetAttr (Text -> [Text]
T.words -> [Text
path, Text
attr, Text
newVal]) = do
GIRPath
pathSpec <- Text -> Parser GIRPath
parsePathSpec Text
path
Name
parsedAttr <- Text -> Parser Name
parseXMLName Text
attr
forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell forall a b. (a -> b) -> a -> b
$ Overrides
defaultOverrides {girFixups :: [GIRRule]
girFixups =
[(GIRPath, Name) -> Text -> GIRRule
GIRSetAttr (GIRPath
pathSpec, Name
parsedAttr) Text
newVal]}
parseSetAttr Text
t =
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"set-attr syntax is of the form\n" forall a. Semigroup a => a -> a -> a
<>
Text
"\t\"set-attr nodePath attrName newValue\"\n" forall a. Semigroup a => a -> a -> a
<>
Text
"Got \"set-attr " forall a. Semigroup a => a -> a -> a
<> Text
t forall a. Semigroup a => a -> a -> a
<> Text
"\" instead.")
parseDeleteAttr :: Text -> Parser ()
parseDeleteAttr :: Text -> Parser ()
parseDeleteAttr (Text -> [Text]
T.words -> [Text
path, Text
attr]) = do
GIRPath
pathSpec <- Text -> Parser GIRPath
parsePathSpec Text
path
Name
parsedAttr <- Text -> Parser Name
parseXMLName Text
attr
forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell forall a b. (a -> b) -> a -> b
$ Overrides
defaultOverrides {girFixups :: [GIRRule]
girFixups = [GIRPath -> Name -> GIRRule
GIRDeleteAttr GIRPath
pathSpec Name
parsedAttr]}
parseDeleteAttr Text
t =
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"delete-attr syntax is of the form\n" forall a. Semigroup a => a -> a -> a
<>
Text
"\t\"delete-attr nodePath attrName\"\n" forall a. Semigroup a => a -> a -> a
<>
Text
"Got \"delete-attr " forall a. Semigroup a => a -> a -> a
<> Text
t forall a. Semigroup a => a -> a -> a
<> Text
"\" instead.")
parseAdd :: Text -> Parser ()
parseAdd :: Text -> Parser ()
parseAdd (Text -> [Text]
T.words -> [Text
path, Text
name]) = do
GIRPath
pathSpec <- Text -> Parser GIRPath
parsePathSpec Text
path
Name
parsedName <- Text -> Parser Name
parseXMLName Text
name
forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell forall a b. (a -> b) -> a -> b
$ Overrides
defaultOverrides {girFixups :: [GIRRule]
girFixups = [GIRPath -> Name -> GIRRule
GIRAddNode GIRPath
pathSpec Name
parsedName]}
parseAdd Text
t =
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"add-node syntax is of the form\n" forall a. Semigroup a => a -> a -> a
<>
Text
"\t\"add-node nodePath newName\"\n" forall a. Semigroup a => a -> a -> a
<>
Text
"Got \"add-node " forall a. Semigroup a => a -> a -> a
<> Text
t forall a. Semigroup a => a -> a -> a
<> Text
"\" instead.")
parseDelete :: Text -> Parser ()
parseDelete :: Text -> Parser ()
parseDelete (Text -> [Text]
T.words -> [Text
path]) = do
GIRPath
pathSpec <- Text -> Parser GIRPath
parsePathSpec Text
path
forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell forall a b. (a -> b) -> a -> b
$ Overrides
defaultOverrides {girFixups :: [GIRRule]
girFixups = [GIRPath -> GIRRule
GIRDeleteNode GIRPath
pathSpec]}
parseDelete Text
t =
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"delete-node syntax is of the form\n" forall a. Semigroup a => a -> a -> a
<>
Text
"\t\"delete-node nodePath\"\n" forall a. Semigroup a => a -> a -> a
<>
Text
"Got \"delete-node " forall a. Semigroup a => a -> a -> a
<> Text
t forall a. Semigroup a => a -> a -> a
<> Text
"\" instead.")
parseDocsUrl :: Text -> Parser ()
parseDocsUrl :: Text -> Parser ()
parseDocsUrl (Text -> [Text]
T.words -> [Text
ns, Text
url]) = do
forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell forall a b. (a -> b) -> a -> b
$ Overrides
defaultOverrides { onlineDocsMap :: Map Text Text
onlineDocsMap = forall k a. k -> a -> Map k a
M.singleton Text
ns Text
url }
parseDocsUrl Text
t =
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"C-docs-url syntax of of the form\n" forall a. Semigroup a => a -> a -> a
<>
Text
"\t\"C-docs-url namespace url\"\n" forall a. Semigroup a => a -> a -> a
<>
Text
"Got \"C-docs-url " forall a. Semigroup a => a -> a -> a
<> Text
t forall a. Semigroup a => a -> a -> a
<> Text
"\" instead.")
parsePathSpec :: Text -> Parser GIRPath
parsePathSpec :: Text -> Parser GIRPath
parsePathSpec Text
spec = forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Text -> Parser GIRNodeSpec
parseNodeSpec (Text -> Text -> [Text]
T.splitOn Text
"/" Text
spec)
parseGIRNameTag :: Text -> GIRNameTag
parseGIRNameTag :: Text -> GIRNameTag
parseGIRNameTag (Text -> Text -> Maybe Text
T.stripPrefix Text
"~" -> Just Text
regex) = Text -> GIRNameTag
GIRRegex Text
regex
parseGIRNameTag Text
t = Text -> GIRNameTag
GIRPlainName Text
t
parseNodeSpec :: Text -> Parser GIRNodeSpec
parseNodeSpec :: Text -> Parser GIRNodeSpec
parseNodeSpec Text
spec = case Text -> Text -> [Text]
T.splitOn Text
"@" Text
spec of
[Text
n] -> forall (m :: * -> *) a. Monad m => a -> m a
return (GIRNameTag -> GIRNodeSpec
GIRNamed (Text -> GIRNameTag
parseGIRNameTag Text
n))
[Text
"", Text
t] -> forall (m :: * -> *) a. Monad m => a -> m a
return (Text -> GIRNodeSpec
GIRType Text
t)
[Text
n, Text
t] -> forall (m :: * -> *) a. Monad m => a -> m a
return (Text -> GIRNameTag -> GIRNodeSpec
GIRTypedName Text
t (Text -> GIRNameTag
parseGIRNameTag Text
n))
[Text]
_ -> forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"Could not understand node spec \""
forall a. Semigroup a => a -> a -> a
<> Text
spec forall a. Semigroup a => a -> a -> a
<> Text
"\".")
parseXMLName :: Text -> Parser XML.Name
parseXMLName :: Text -> Parser Name
parseXMLName Text
a = case Text -> Text -> [Text]
T.splitOn Text
":" Text
a of
[Text
n] -> forall (m :: * -> *) a. Monad m => a -> m a
return (Text -> Name
xmlLocalName Text
n)
[Text
"c", Text
n] -> forall (m :: * -> *) a. Monad m => a -> m a
return (GIRXMLNamespace -> Text -> Name
xmlNSName GIRXMLNamespace
CGIRNS Text
n)
[Text
"glib", Text
n] -> forall (m :: * -> *) a. Monad m => a -> m a
return (GIRXMLNamespace -> Text -> Name
xmlNSName GIRXMLNamespace
GLibGIRNS Text
n)
[Text
"core", Text
n] -> forall (m :: * -> *) a. Monad m => a -> m a
return (GIRXMLNamespace -> Text -> Name
xmlNSName GIRXMLNamespace
CoreGIRNS Text
n)
[Text]
_ -> forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"Could not understand xml name \""
forall a. Semigroup a => a -> a -> a
<> Text
a forall a. Semigroup a => a -> a -> a
<> Text
"\".")
data OSType = Linux
| OSX
| Windows
deriving (Int -> OSType -> ShowS
[OSType] -> ShowS
OSType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OSType] -> ShowS
$cshowList :: [OSType] -> ShowS
show :: OSType -> String
$cshow :: OSType -> String
showsPrec :: Int -> OSType -> ShowS
$cshowsPrec :: Int -> OSType -> ShowS
Show)
checkOS :: String -> Parser Bool
checkOS :: String -> Parser Bool
checkOS String
os = forall (m :: * -> *) a. Monad m => a -> m a
return (String
SI.os forall a. Eq a => a -> a -> Bool
== String
os)
parseVersion :: Text -> Parser V.Version
parseVersion :: Text -> Parser Version
parseVersion Text
v = ([(Version, String)] -> Parser Version
chooseFullParse forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ReadP a -> ReadS a
readP_to_S ReadP Version
V.parseVersion forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> String
T.unpack) Text
v
where chooseFullParse :: [(V.Version, String)] -> Parser V.Version
chooseFullParse :: [(Version, String)] -> Parser Version
chooseFullParse [] = forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"Could not parse version \""
forall a. Semigroup a => a -> a -> a
<> Text
v forall a. Semigroup a => a -> a -> a
<> Text
"\".")
chooseFullParse [(Version
parsed, String
"")] = forall (m :: * -> *) a. Monad m => a -> m a
return Version
parsed
chooseFullParse ((Version, String)
_ : [(Version, String)]
rest) = [(Version, String)] -> Parser Version
chooseFullParse [(Version, String)]
rest
checkPkgConfigVersion :: Text -> Text -> Text -> Parser Bool
checkPkgConfigVersion :: Text -> Text -> Text -> Parser Bool
checkPkgConfigVersion Text
pkg Text
op Text
tVersion = do
Version
version <- Text -> Parser Version
parseVersion Text
tVersion
Version
pcVersion <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (Text -> IO (Maybe (Text, Text))
tryPkgConfig Text
pkg) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Maybe (Text, Text)
Nothing ->
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"Could not determine pkg-config version for \""
forall a. Semigroup a => a -> a -> a
<> Text
pkg forall a. Semigroup a => a -> a -> a
<> Text
"\".")
Just (Text
_, Text
tv) -> Text -> Parser Version
parseVersion Text
tv
case Text
op of
Text
"==" -> forall (m :: * -> *) a. Monad m => a -> m a
return (Version
pcVersion forall a. Eq a => a -> a -> Bool
== Version
version)
Text
"/=" -> forall (m :: * -> *) a. Monad m => a -> m a
return (Version
pcVersion forall a. Eq a => a -> a -> Bool
/= Version
version)
Text
">=" -> forall (m :: * -> *) a. Monad m => a -> m a
return (Version
pcVersion forall a. Ord a => a -> a -> Bool
>= Version
version)
Text
">" -> forall (m :: * -> *) a. Monad m => a -> m a
return (Version
pcVersion forall a. Ord a => a -> a -> Bool
> Version
version)
Text
"<=" -> forall (m :: * -> *) a. Monad m => a -> m a
return (Version
pcVersion forall a. Ord a => a -> a -> Bool
<= Version
version)
Text
"<" -> forall (m :: * -> *) a. Monad m => a -> m a
return (Version
pcVersion forall a. Ord a => a -> a -> Bool
< Version
version)
Text
_ -> forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"Unrecognized comparison operator \"" forall a. Semigroup a => a -> a -> a
<> Text
op forall a. Semigroup a => a -> a -> a
<> Text
"\".")
parseIf :: Text -> Parser ()
parseIf :: Text -> Parser ()
parseIf Text
cond = case Text -> [Text]
T.words Text
cond of
[] -> forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"Empty 'if' condition.")
[Text
"linux"] -> String -> Parser Bool
checkOS String
"linux" forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Bool -> Parser ()
setFlag
[Text
"osx"] -> String -> Parser Bool
checkOS String
"darwin" forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Bool -> Parser ()
setFlag
[Text
"windows"] -> String -> Parser Bool
checkOS String
"mingw32" forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Bool -> Parser ()
setFlag
(Text
"pkg-config-version" : [Text]
rest) ->
case [Text]
rest of
[Text
pkg, Text
op, Text
version] ->
Text -> Text -> Text -> Parser Bool
checkPkgConfigVersion Text
pkg Text
op Text
version forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Bool -> Parser ()
setFlag
[Text]
_ -> forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"Syntax for `pkg-config-version' is "
forall a. Semigroup a => a -> a -> a
<> Text
"\"pkg op version\", got \""
forall a. Semigroup a => a -> a -> a
<> forall a. Show a => a -> Text
tshow [Text]
rest forall a. Semigroup a => a -> a -> a
<> Text
"\".")
[Text]
_ -> forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"Unknown condition \"" forall a. Semigroup a => a -> a -> a
<> Text
cond forall a. Semigroup a => a -> a -> a
<> Text
"\".")
where setFlag :: Bool -> Parser ()
setFlag :: Bool -> Parser ()
setFlag Bool
flag = forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify' (\ParserState
s -> ParserState
s {flags :: [Bool]
flags = Bool
flag forall a. a -> [a] -> [a]
: ParserState -> [Bool]
flags ParserState
s})
parseEndif :: Text -> Parser ()
parseEndif :: Text -> Parser ()
parseEndif Text
rest = case Text -> [Text]
T.words Text
rest of
[] -> Parser ()
unsetFlag
[Text]
_ -> forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"Unexpected argument to 'endif': \""
forall a. Semigroup a => a -> a -> a
<> Text
rest forall a. Semigroup a => a -> a -> a
<> Text
"\".")
where unsetFlag :: Parser ()
unsetFlag :: Parser ()
unsetFlag = do
ParserState
s <- forall s (m :: * -> *). MonadState s m => m s
get
case ParserState -> [Bool]
flags ParserState
s of
Bool
_:[Bool]
rest -> forall s (m :: * -> *). MonadState s m => s -> m ()
put (ParserState
s {flags :: [Bool]
flags = [Bool]
rest})
[] -> forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"'endif' with no matching 'if'.")
parseInclude :: Text -> Parser ()
parseInclude :: Text -> Parser ()
parseInclude Text
fname = do
Text
includeText <- forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ String -> IO Text
utf8ReadFile (Text -> String
T.unpack Text
fname)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (Text -> IO (Either Text Overrides)
parseOverrides Text
includeText) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Left Text
err -> forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (Text
"Error when parsing included '"
forall a. Semigroup a => a -> a -> a
<> Text
fname forall a. Semigroup a => a -> a -> a
<> Text
"': " forall a. Semigroup a => a -> a -> a
<> Text
err)
Right Overrides
ovs -> forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell Overrides
ovs
filterMethods :: [Method] -> S.Set Text -> [Method]
filterMethods :: [Method] -> Set Text -> [Method]
filterMethods [Method]
set Set Text
ignores =
forall a. (a -> Bool) -> [a] -> [a]
filter ((forall a. Ord a => a -> Set a -> Bool
`S.notMember` Set Text
ignores) forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name -> Text
name forall b c a. (b -> c) -> (a -> b) -> a -> c
. Method -> Name
methodName) [Method]
set
filterAllocInfo :: AllocationInfo -> AllocationInfo -> AllocationInfo
filterAllocInfo :: AllocationInfo -> AllocationInfo -> AllocationInfo
filterAllocInfo AllocationInfo
old AllocationInfo
new =
AllocationInfo { allocCalloc :: AllocationOp
allocCalloc = AllocationOp -> AllocationOp -> AllocationOp
replace (AllocationInfo -> AllocationOp
allocCalloc AllocationInfo
old) (AllocationInfo -> AllocationOp
allocCalloc AllocationInfo
new)
, allocCopy :: AllocationOp
allocCopy = AllocationOp -> AllocationOp -> AllocationOp
replace (AllocationInfo -> AllocationOp
allocCopy AllocationInfo
old) (AllocationInfo -> AllocationOp
allocCopy AllocationInfo
new)
, allocFree :: AllocationOp
allocFree = AllocationOp -> AllocationOp -> AllocationOp
replace (AllocationInfo -> AllocationOp
allocFree AllocationInfo
old) (AllocationInfo -> AllocationOp
allocFree AllocationInfo
new) }
where replace :: AllocationOp -> AllocationOp -> AllocationOp
replace :: AllocationOp -> AllocationOp -> AllocationOp
replace AllocationOp
o AllocationOp
AllocationOpUnknown = AllocationOp
o
replace AllocationOp
_ AllocationOp
o = AllocationOp
o
filterOneAPI :: Overrides -> (Name, API, Maybe (S.Set Text)) -> (Name, API)
filterOneAPI :: Overrides -> (Name, API, Maybe (Set Text)) -> (Name, API)
filterOneAPI Overrides
ovs (Name
n, APIStruct Struct
s, Maybe (Set Text)
maybeIgnores) =
(Name
n, Struct -> API
APIStruct Struct
s { structMethods :: [Method]
structMethods = forall b a. b -> (a -> b) -> Maybe a -> b
maybe (Struct -> [Method]
structMethods Struct
s)
([Method] -> Set Text -> [Method]
filterMethods (Struct -> [Method]
structMethods Struct
s))
Maybe (Set Text)
maybeIgnores
, structFields :: [Field]
structFields = if Name
n forall a. Ord a => a -> Set a -> Bool
`S.member` Overrides -> Set Name
sealedStructs Overrides
ovs
then []
else Struct -> [Field]
structFields Struct
s
, structAllocationInfo :: AllocationInfo
structAllocationInfo =
let ai :: AllocationInfo
ai = Struct -> AllocationInfo
structAllocationInfo Struct
s
in case forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup Name
n (Overrides -> Map Name AllocationInfo
allocInfo Overrides
ovs) of
Just AllocationInfo
info -> AllocationInfo -> AllocationInfo -> AllocationInfo
filterAllocInfo AllocationInfo
ai AllocationInfo
info
Maybe AllocationInfo
Nothing -> AllocationInfo
ai
})
filterOneAPI Overrides
ovs (Name
n, APIUnion Union
u, Maybe (Set Text)
maybeIgnores) =
(Name
n, Union -> API
APIUnion Union
u {unionMethods :: [Method]
unionMethods = forall b a. b -> (a -> b) -> Maybe a -> b
maybe (Union -> [Method]
unionMethods Union
u)
([Method] -> Set Text -> [Method]
filterMethods (Union -> [Method]
unionMethods Union
u))
Maybe (Set Text)
maybeIgnores
, unionAllocationInfo :: AllocationInfo
unionAllocationInfo =
let ai :: AllocationInfo
ai = Union -> AllocationInfo
unionAllocationInfo Union
u
in case forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup Name
n (Overrides -> Map Name AllocationInfo
allocInfo Overrides
ovs) of
Just AllocationInfo
info -> AllocationInfo -> AllocationInfo -> AllocationInfo
filterAllocInfo AllocationInfo
ai AllocationInfo
info
Maybe AllocationInfo
Nothing -> AllocationInfo
ai
})
filterOneAPI Overrides
_ (Name
n, API
api, Maybe (Set Text)
Nothing) = (Name
n, API
api)
filterOneAPI Overrides
_ (Name
n, APIObject Object
o, Just Set Text
ignores) =
(Name
n, Object -> API
APIObject Object
o {objMethods :: [Method]
objMethods = [Method] -> Set Text -> [Method]
filterMethods (Object -> [Method]
objMethods Object
o) Set Text
ignores,
objSignals :: [Signal]
objSignals = forall a. (a -> Bool) -> [a] -> [a]
filter ((forall a. Ord a => a -> Set a -> Bool
`S.notMember` Set Text
ignores) forall b c a. (b -> c) -> (a -> b) -> a -> c
. Signal -> Text
sigName)
(Object -> [Signal]
objSignals Object
o)
})
filterOneAPI Overrides
ovs (Name
n, APIInterface Interface
i, Just Set Text
ignores) =
(Name
n, Interface -> API
APIInterface Interface
i {ifMethods :: [Method]
ifMethods = [Method] -> Set Text -> [Method]
filterMethods (Interface -> [Method]
ifMethods Interface
i) Set Text
ignores,
ifSignals :: [Signal]
ifSignals = forall a. (a -> Bool) -> [a] -> [a]
filter ((forall a. Ord a => a -> Set a -> Bool
`S.notMember` Set Text
ignores) forall b c a. (b -> c) -> (a -> b) -> a -> c
. Signal -> Text
sigName)
(Interface -> [Signal]
ifSignals Interface
i),
ifAllocationInfo :: AllocationInfo
ifAllocationInfo =
let ai :: AllocationInfo
ai = Interface -> AllocationInfo
ifAllocationInfo Interface
i
in case forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup Name
n (Overrides -> Map Name AllocationInfo
allocInfo Overrides
ovs) of
Just AllocationInfo
info -> AllocationInfo -> AllocationInfo -> AllocationInfo
filterAllocInfo AllocationInfo
ai AllocationInfo
info
Maybe AllocationInfo
Nothing -> AllocationInfo
ai
})
filterOneAPI Overrides
_ (Name
n, API
api, Maybe (Set Text)
_) = (Name
n, API
api)
filterAPIs :: Overrides -> [(Name, API)] -> [(Name, API)]
filterAPIs :: Overrides -> [(Name, API)] -> [(Name, API)]
filterAPIs Overrides
ovs [(Name, API)]
apis = forall a b. (a -> b) -> [a] -> [b]
map (Overrides -> (Name, API, Maybe (Set Text)) -> (Name, API)
filterOneAPI Overrides
ovs forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {b}. (Name, b) -> (Name, b, Maybe (Set Text))
fetchIgnores) [(Name, API)]
filtered
where filtered :: [(Name, API)]
filtered = forall a. (a -> Bool) -> [a] -> [a]
filter ((forall a. Ord a => a -> Set a -> Bool
`S.notMember` Overrides -> Set Name
ignoredAPIs Overrides
ovs) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> a
fst) [(Name, API)]
apis
fetchIgnores :: (Name, b) -> (Name, b, Maybe (Set Text))
fetchIgnores (Name
n, b
api) = (Name
n, b
api, forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup Name
n (Overrides -> Map Name (Set Text)
ignoredElems Overrides
ovs))
filterAPIsAndDeps :: Overrides -> GIRInfo -> [GIRInfo]
-> (M.Map Name API, M.Map Name API)
filterAPIsAndDeps :: Overrides -> GIRInfo -> [GIRInfo] -> (Map Name API, Map Name API)
filterAPIsAndDeps Overrides
ovs GIRInfo
doc [GIRInfo]
deps =
let toMap :: GIRInfo -> Map Name API
toMap = forall k a. Ord k => [(k, a)] -> Map k a
M.fromList forall b c a. (b -> c) -> (a -> b) -> a -> c
. Overrides -> [(Name, API)] -> [(Name, API)]
filterAPIs Overrides
ovs forall b c a. (b -> c) -> (a -> b) -> a -> c
. GIRInfo -> [(Name, API)]
girAPIs
in (GIRInfo -> Map Name API
toMap GIRInfo
doc, forall (f :: * -> *) k a.
(Foldable f, Ord k) =>
f (Map k a) -> Map k a
M.unions (forall a b. (a -> b) -> [a] -> [b]
map GIRInfo -> Map Name API
toMap [GIRInfo]
deps))