From b1b3cf16084f29f67e6bf278e12fccfb41c206d4 Mon Sep 17 00:00:00 2001 From: Allanis Date: Thu, 1 May 2014 19:48:59 +0100 Subject: [PATCH] [Add] Added a nice little luadoc generation script. --- .gitignore | 2 ++ bin/Makefile | 2 +- docs/Makefile | 12 +++++++++++ docs/doxygen/Doxyfile | 2 +- docs/doxygen/luadoc.sh | 45 ++++++++++++++++++++++++++++++++++++++++++ src/llua_faction.c | 17 ++++++---------- 6 files changed, 67 insertions(+), 13 deletions(-) create mode 100644 docs/Makefile create mode 100755 docs/doxygen/luadoc.sh diff --git a/.gitignore b/.gitignore index 64f0f78..cc0b6a3 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,8 @@ screenshots/*.png *VERSION utils/resedit/*.xml docs/doxygen/docs/* +docs/doxygen/lua/* + # Windows Crap win32/Lephisto/* diff --git a/bin/Makefile b/bin/Makefile index edaac30..89c196a 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -164,7 +164,7 @@ ldata: pack $(DATAFILES) utils: pack mksprite docs: - @(cd docs/doxygen; doxygen) + +@$(MAKE) -C ../docs/ clean: @echo " Removing ldata" diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..cd5b715 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,12 @@ +.PHONY: all lua doxy + +all: doxy lua + +doxy: + @echo " DOC docs/doxygen" + @(cd doxygen; doxygen) + +lua: + @echo " DOC docs/lua" + @(cd doxygen; sh luadoc.sh) + diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index 134f1b7..3d4f789 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -612,7 +612,7 @@ CITE_BIB_FILES = # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. -QUIET = NO +QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank diff --git a/docs/doxygen/luadoc.sh b/docs/doxygen/luadoc.sh new file mode 100755 index 0000000..4d46543 --- /dev/null +++ b/docs/doxygen/luadoc.sh @@ -0,0 +1,45 @@ +# Run this from docs directory. +# Create docs/lua directory. +if [ ! -d lua ]; then mkdir lua; fi +# Convert doxygen comments to luadoc comments. +for F in ../../src/llua_*.c +do +sed -n ' + 1 i -- This is file was generated automatically from C sources to feed luadoc +#converts doxygens /** to luadocs --- + s|^ */\*\*|---|p +#convert special tags to lua expressions. +#notice lines after @luafunc & @luamod will be ignored by luadoc +#also doxygen comments that do not contain a any of this tags have no +#influence on luadoc output + s|^ *\* *@luafunc|function|p + s|^ *\* *@luamod *\(.*\)|module "\1"|p +#rename some tags: + s|^ *\* *@brief|-- @description|p +#keep tags luadoc understands: + s|^ *\* *@param|-- @param|p + s|^ *\* *@see|-- @see|p + s|^ *\* *@return|-- @return|p + s|^ *\* *@usage|-- @usage|p + s|^ *\* *@description|-- @description|p + s|^ *\* *@name|-- @name|p + s|^ *\* *@class|-- @class|p + s|^ *\* *@field|-- @field|p + s|^ *\* *@release|-- @release|p +#remove other tags: + \|^ *\* *@.*|d +#insert newline between comments, replace */ by \n + \|^ *\*/|c +#keep other comments, replace * by -- + s|^ *\*|--|p +#delete everything else, just in case + d +' $F > lua/`basename $F`.luadoc +done +# Run luadoc, put html files into lua dir. +( + cd lua + luadoc --nofiles *.luadoc + rm *.luadoc +) + diff --git a/src/llua_faction.c b/src/llua_faction.c index ba4fe4c..5bfb611 100644 --- a/src/llua_faction.c +++ b/src/llua_faction.c @@ -99,6 +99,7 @@ static int factionL_createmetatable(lua_State* L, int readonly) { * * @brief Lua bindings to deal with factions. * + * @luamod faction * Use with: * @code * faction.func(params) @@ -255,13 +256,10 @@ static int factionL_longname(lua_State* L) { } /** - * @fn static int factionL_areenemeies(lua_State* L) - * - * @brief bool areenemies(faction f) - * - * Check to see if f is an enemy. + * @brief Check to see if f is an enemy. * @param f Faction to check if is an enemy. - * @return true if they are enemeies, false if they aren't. + * @return true if they are enemies, false if they aren't. + * @luafunc areEnemies(f) */ static int factionL_areenemies(lua_State* L) { LuaFaction* f, *ff; @@ -274,13 +272,10 @@ static int factionL_areenemies(lua_State* L) { } /** - * @fn static int factionL_areallies(lua_State* L) - * - * @brief bool areEnemies(faction f) - * - * Check to see if f is an enemy. + * @brief Check to see if f is an enemy. * @param f Faction to check if is an enemy. * @return true if they are enemies, false if they aren't. + * @luafunc areAllies(f) */ static int factionL_areallies(lua_State* L) { LuaFaction* f, *ff;