From: Duncan C. <dun...@us...> - 2005-01-09 23:45:20
|
Update of /cvsroot/gtk2hs/gtk2hs/tools/apiGen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15817/tools/apiGen Modified Files: format-docs.xsl ApiGen.hs Log Message: Fix generation of function version numbers when they have no version given. Fix for when no functions are defined in the documentation file. Also, take the c2hs context prefix and lib values from the api file be default. Index: format-docs.xsl =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/apiGen/format-docs.xsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- format-docs.xsl 8 Jan 2005 07:37:11 -0000 1.2 +++ format-docs.xsl 9 Jan 2005 23:45:11 -0000 1.3 @@ -59,7 +59,7 @@ <function> <name><xsl:value-of select="indexterm/primary"/></name> <since> - <xsl:value-of select="number(substring-after(para[starts-with(text(),'Since')], 'Since '))"/> + <xsl:value-of select="normalize-space(substring-after(para[starts-with(text(),'Since')], 'Since'))"/> </since> <doc> <xsl:for-each select="para[not(starts-with(text(),'Since')) and normalize-space(text())!='']"> Index: ApiGen.hs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/tools/apiGen/ApiGen.hs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ApiGen.hs 7 Jan 2005 17:45:40 -0000 1.2 +++ ApiGen.hs 9 Jan 2005 23:45:11 -0000 1.3 @@ -312,8 +312,10 @@ -- figure out if the whole module appeared in some version of gtk later -- than the original version moduleVersion :: Maybe String - moduleVersion = minimum [ funcdoc_since funcdoc - | funcdoc <- apidoc_functions apiDoc ] + moduleVersion = case [ funcdoc_since funcdoc + | funcdoc <- apidoc_functions apiDoc ] of + [] -> Nothing + versions -> minimum versions haddocFormatSections :: [DocSection] -> ShowS haddocFormatSections = @@ -634,10 +636,10 @@ [] -> "" (docFile:_) -> docFile let lib = case map (drop 6) (filter ("--lib=" `isPrefixOf`) rem) of - [] -> "gtk" + [] -> "" (lib:_) -> lib let prefix = case map (drop 9) (filter ("--prefix=" `isPrefixOf`) rem) of - [] -> "gtk" + [] -> "" (prefix:_) -> prefix let modPrefix = case map (drop 12) (filter ("--modprefix=" `isPrefixOf`) rem) of [] -> "" @@ -696,8 +698,8 @@ "MODULE_NAME" -> ss (modPrefix ++ object_name object) "EXPORTS" -> genExports object (apidoc_functions apiDoc') "IMPORTS" -> ss "-- CHECKME: extra imports may be required\n" - "CONTEXT_LIB" -> ss lib - "CONTEXT_PREFIX" -> ss prefix + "CONTEXT_LIB" -> ss (if null lib then namespace_library namespace else lib) + "CONTEXT_PREFIX" -> ss (if null prefix then namespace_library namespace else prefix) "MODULE_BODY" -> doVersionIfDefs (genConstructors object (apidoc_functions apiDoc') ++ genMethods object (apidoc_functions apiDoc')) _ -> ss "" @@ -718,9 +720,9 @@ \ <outDir> is the name and path of the output file\n\ \ <docFile> api doc file output from format-doc.xsl\n\ \ <lib> set the lib to use in the c2hs {#context #}\n\ - \ declaration (the default is \"gtk\")\n\ + \ declaration (the default is taken from the api file)\n\ \ <prefix> set the prefix to use in the c2hs {#context #}\n\ - \ declaration (the default is \"gtk\")\n\ + \ declaration (the default is taken from the api file)\n\ \ <modPrefix> specify module name prefix, eg if using\n\ \ hierarchical module names\n" exitWith $ ExitFailure 1 |