diff options
author | truebrain <truebrain@openttd.org> | 2011-12-19 20:44:31 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2011-12-19 20:44:31 +0000 |
commit | e75153d8ac12b07f9a47fc08b55a1c6ddb1c4162 (patch) | |
tree | 4c148e9783be47a02ad046d5617f9c00a3bcb235 /src/script | |
parent | fceed4758ccc9d78984297811855f0b59af828da (diff) | |
download | openttd-e75153d8ac12b07f9a47fc08b55a1c6ddb1c4162.tar.xz |
(svn r23597) -Codechange: fix up squirrel export script a bit
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/squirrel_export.awk | 12 | ||||
-rw-r--r-- | src/script/api/template/template_log.hpp.sq | 4 | ||||
-rw-r--r-- | src/script/squirrel_helper.hpp | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/script/api/squirrel_export.awk b/src/script/api/squirrel_export.awk index 4d044b0e0..8e4bc3546 100644 --- a/src/script/api/squirrel_export.awk +++ b/src/script/api/squirrel_export.awk @@ -117,17 +117,18 @@ BEGIN { { if (doxygen_skip == "true") next } /^([ ]*)\* @api/ { - if (api == "Template") { - api_selected = "true" - next - } - # By default, classes are not selected if (cls_level == 0) api_selected = "false" gsub("^([ ]*)", "", $0) gsub("* @api ", "", $0) + if (api == "Template") { + api_selected = "true" + if ($0 == "none" || $0 == "-all") api_selected = "false" + next + } + if ($0 == "none") { api_selected = "false" } else if ($0 == "-all") { @@ -501,6 +502,7 @@ BEGIN { sub("^[ ]*", "", params[len]) if (match(params[len], "\\*") || match(params[len], "&")) { if (match(params[len], "^char")) { + # Many types can be converted to string, so use '.', not 's'. (handled by our glue code) types = types "." } else if (match(params[len], "^void")) { types = types "p" diff --git a/src/script/api/template/template_log.hpp.sq b/src/script/api/template/template_log.hpp.sq index 4f3c9e7f1..91c0511d0 100644 --- a/src/script/api/template/template_log.hpp.sq +++ b/src/script/api/template/template_log.hpp.sq @@ -12,10 +12,6 @@ #include "../script_log.hpp" namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptLog::ScriptLogType GetParam(ForceType<ScriptLog::ScriptLogType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptLog::ScriptLogType)tmp; } - template <> inline int Return<ScriptLog::ScriptLogType>(HSQUIRRELVM vm, ScriptLog::ScriptLogType res) { sq_pushinteger(vm, (int32)res); return 1; } - /* Allow ScriptLog to be used as Squirrel parameter */ template <> inline ScriptLog *GetParam(ForceType<ScriptLog *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptLog *)instance; } template <> inline ScriptLog &GetParam(ForceType<ScriptLog &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptLog *)instance; } diff --git a/src/script/squirrel_helper.hpp b/src/script/squirrel_helper.hpp index 03f1315fa..cdc4b8b8f 100644 --- a/src/script/squirrel_helper.hpp +++ b/src/script/squirrel_helper.hpp @@ -109,7 +109,9 @@ namespace SQConvert { template <> inline void *GetParam(ForceType<void *> , HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer tmp; sq_getuserpointer(vm, index, &tmp); return tmp; } template <> inline const char *GetParam(ForceType<const char *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { + /* Convert what-ever there is as parameter to a string */ sq_tostring(vm, index); + const SQChar *tmp; sq_getstring(vm, -1, &tmp); char *tmp_str = strdup(SQ2OTTD(tmp)); |