-#include "tree.h"
+#include "tree.hpp"
#include <iostream>
#include <sstream>
#include <stdexcept>
-#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"
// 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 <config.h>\n"
+ << "\n"
<< "#include <new>\n"
<< "#include <assert.h>\n"
<< "#include <string>\n"
<< "#include <squirrel.h>\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";
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);
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";