X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=tools%2Fminiswig%2Fcreate_wrapper.cpp;h=7adce5d7cf795c68a038c469d2b889d30c1c3f62;hb=e9df473163280a253ce0773282101079944c367b;hp=2233f8334308e12d2c0020d898fa979fd435ea63;hpb=f1e15f44f709d6b4fa45e858dc12d7d701ae8ddc;p=supertux.git diff --git a/tools/miniswig/create_wrapper.cpp b/tools/miniswig/create_wrapper.cpp index 2233f8334..7adce5d7c 100644 --- a/tools/miniswig/create_wrapper.cpp +++ b/tools/miniswig/create_wrapper.cpp @@ -1,23 +1,26 @@ -#include "tree.h" +#include "tree.hpp" #include #include #include -#include "create_wrapper.h" -#include "globals.h" +#include "create_wrapper.hpp" +#include "globals.hpp" void WrapperCreator::create_wrapper(Namespace* ns) { + std::string fromfile = original_file != "" ? original_file : inputfile; + // hpp file hppout << "/**\n" - << " * WARNING: This file is automatically generated from '" - << inputfile << "' - do not change\n" + << " * WARNING: This file is automatically generated from:\n" + << " * '" << fromfile << "'\n" + << " * DO NOT CHANGE\n" << " */\n" << "#ifndef __" << modulename << "_WRAPPER_H__\n" << "#define __" << modulename << "_WRAPPER_H__\n" << "\n" - << "#include \"wrapper_util.h\"\n" + << "#include \"wrapper_util.hpp\"\n" << "\n" << "extern WrappedFunction " << modulename << "_global_functions[];\n" << "extern WrappedClass " << modulename << "_classes[];\n" @@ -27,17 +30,18 @@ WrapperCreator::create_wrapper(Namespace* ns) // cpp header out << "/**\n" - << " * WARNING: This file is automatically generated from '" - << inputfile << "' - do not change\n" + << " * WARNING: This file is automatically generated from:\n" + << " * '" << fromfile << "'\n" + << " * DO NOT CHANGE\n" << " */\n" - << "\n" << "#include \n" + << "\n" << "#include \n" << "#include \n" << "#include \n" << "#include \n" - << "#include \"wrapper_util.h\"\n" - << "#include \"wrapper.interface.h\"\n" + << "#include \"wrapper_util.hpp\"\n" + << "#include \"wrapper.interface.hpp\"\n" << "\n"; if(selected_namespace != "") { out << "using namespace " << selected_namespace << ";\n"; @@ -144,7 +148,7 @@ WrapperCreator::create_function_wrapper(Class* _class, Function* function) p != function->parameters.end(); ++p) { if(i == 0 && p->type.atomic_type == HSQUIRRELVMType::instance()) { out << ind << "HSQUIRRELVM arg0 = v;\n"; - arg_offset++; + arg_offset--; } else { char argname[64]; snprintf(argname, sizeof(argname), "arg%d", i); @@ -188,7 +192,11 @@ WrapperCreator::create_function_wrapper(Class* _class, Function* function) out << ind << "\n"; // push return value back on stack and return if(function->return_type.is_void()) { - out << ind << "return 0;\n"; + if(function->docu_comment.find("@SUSPEND@") != std::string::npos) { + out << ind << "sq_suspendvm(v);\n"; + } else { + out << ind << "return 0;\n"; + } } else { push_to_stack(function->return_type, "return_value"); out << ind << "return 1;\n";