Skip to content

Commit 6df1de3

Browse files
committed
Added documentation for vecEquiv and alias.
1 parent b5b03c9 commit 6df1de3

File tree

4 files changed

+1674
-999
lines changed

4 files changed

+1674
-999
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2.5.5.0
2+
-------
3+
* Added retrieval of version info and extensions.
4+
* Added extension predicates.
5+
* Added documentation for vector equivalents and aliases.
6+
* Consistently use UTF-8 as the encoding.
7+
18
2.5.4.0
29
-------
310
* Added documentation for enumerant groups.

RegistryProcessor/src/Main.hs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ showCommand :: API -> Registry -> M.Map String String -> Command -> String
552552
showCommand api registry sigMap c =
553553
showString (take 80 ("-- " ++ name ++ " " ++ repeat '-') ++ "\n\n") .
554554

555-
showString man .
555+
showString comment .
556556

557557
showString (name ++ "\n") .
558558
showString (" :: MonadIO m\n") .
@@ -572,11 +572,16 @@ showCommand api registry sigMap c =
572572
compactSignature = signature False
573573
signature withComment = showSignatureFromCommand registry c withComment
574574
urls = M.findWithDefault [] (api, CommandName name) manPageURLs
575-
links = L.intercalate " or " (map renderURL urls) ++ "\n"
575+
links = L.intercalate " or " (map renderURL urls)
576+
comment = case concat (man ++ ve ++ al) of
577+
"" -> ""
578+
cs -> "-- |" ++ cs ++ "\n"
576579
man = case urls of
577-
[] -> ""
578-
[_] -> "-- | Manual page for " ++ links
579-
_ -> "-- | Manual pages for " ++ links
580+
[] -> []
581+
[_] -> [" Manual page for " ++ links ++ "."]
582+
_ -> [" Manual pages for " ++ links ++ "."]
583+
ve = [ " The vector equivalent of this command is '" ++ unCommandName v ++ "'." | Just v <- [vecEquiv c] ]
584+
al = [ " This command is an alias for '" ++ unCommandName a ++ "'." | Just a <- [alias c] ]
580585
renderURL (u, l) = "<" ++ u ++ " " ++ l ++ ">"
581586
args = [1 .. length (paramTypes c)] >>= \i -> " v" ++ show i
582587

RegistryProcessor/src/MangledRegistry.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ joinWords = L.intercalate [splitChar]
149149
data Command = Command {
150150
resultType :: SignatureElement,
151151
paramTypes :: [SignatureElement],
152-
referencedTypes :: S.Set R.TypeName
152+
referencedTypes :: S.Set R.TypeName,
153+
vecEquiv :: Maybe CommandName,
154+
alias :: Maybe CommandName
153155
} deriving (Eq, Ord, Show)
154156

155157
toCommand :: R.Command -> Command
@@ -163,7 +165,9 @@ toCommand c = Command {
163165
filter (not . ("struct " `L.isPrefixOf`) . R.unTypeName) $
164166
DM.catMaybes $
165167
map (R.protoPtype . R.paramProto) $
166-
(pr : ps) }
168+
(pr : ps),
169+
vecEquiv = (CommandName . R.unName) `fmap` R.commandVecEquiv c,
170+
alias = (CommandName . R.unName) `fmap` R.commandAlias c }
167171
where pr = R.Param { R.paramLen = Nothing, R.paramProto = R.commandProto c }
168172
ps = R.commandParams c
169173
varSupply = map (R.TypeName . showIntUsingDigits ['a' .. 'z']) [0 ..]

0 commit comments

Comments
 (0)