[Add] Added a nice little luadoc generation script.

This commit is contained in:
Allanis 2014-05-01 19:48:59 +01:00
parent 0811f18dd7
commit b1b3cf1608
6 changed files with 67 additions and 13 deletions

2
.gitignore vendored
View File

@ -34,6 +34,8 @@ screenshots/*.png
*VERSION
utils/resedit/*.xml
docs/doxygen/docs/*
docs/doxygen/lua/*
# Windows Crap
win32/Lephisto/*

View File

@ -164,7 +164,7 @@ ldata: pack $(DATAFILES)
utils: pack mksprite
docs:
@(cd docs/doxygen; doxygen)
+@$(MAKE) -C ../docs/
clean:
@echo " Removing ldata"

12
docs/Makefile Normal file
View File

@ -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)

View File

@ -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

45
docs/doxygen/luadoc.sh Executable file
View File

@ -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
)

View File

@ -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;