Browse Source

new ptrcall number sizes (int64_t and double)

Karroffel 8 years ago
parent
commit
606d2624af
1 changed files with 12 additions and 3 deletions
  1. 12 3
      binding_generator.py

+ 12 - 3
binding_generator.py

@@ -50,6 +50,10 @@ def make_gdnative_type(t):
         else:
         else:
             return strip_name(t) + " *"
             return strip_name(t) + " *"
     else:
     else:
+        if t == "int":
+            return "int64_t "
+        if t == "float" or t == "real":
+            return "double "
         return strip_name(t) + " "
         return strip_name(t) + " "
 
 
 def generate_class_header(used_classes, c):
 def generate_class_header(used_classes, c):
@@ -73,6 +77,7 @@ def generate_class_header(used_classes, c):
     source.append("")
     source.append("")
     
     
     source.append("#include <godot.h>")
     source.append("#include <godot.h>")
+    source.append("#include <stdint.h>")
     source.append("")
     source.append("")
     
     
     
     
@@ -427,7 +432,7 @@ def generate_icall_header(icalls):
     source.append("")
     source.append("")
     
     
     source.append("#include <godot.h>")
     source.append("#include <godot.h>")
-    source.append("")
+    source.append("#include <stdint.h>")
     source.append("")
     source.append("")
     
     
     source.append("#include <CoreTypes.hpp>")
     source.append("#include <CoreTypes.hpp>")
@@ -477,7 +482,7 @@ def generate_icall_implementation(icalls):
     source.append("")
     source.append("")
     
     
     source.append("#include <godot.h>")
     source.append("#include <godot.h>")
-    source.append("")
+    source.append("#include <stdint.h>")
     source.append("")
     source.append("")
     
     
     source.append("#include <CoreTypes.hpp>")
     source.append("#include <CoreTypes.hpp>")
@@ -513,7 +518,7 @@ def generate_icall_implementation(icalls):
         source.append(method_signature + " {")
         source.append(method_signature + " {")
         
         
         if ret_type != "void":
         if ret_type != "void":
-            source.append("\t" + strip_name(ret_type) + (" *" if is_class_type(ret_type) else " ") + "ret;")
+            source.append("\t" + return_type(ret_type) + "ret;")
             if is_class_type(ret_type):
             if is_class_type(ret_type):
                 source.append("\tret = nullptr;")
                 source.append("\tret = nullptr;")
         
         
@@ -567,6 +572,10 @@ def generate_icall_implementation(icalls):
 def return_type(t):
 def return_type(t):
     if is_class_type(t):
     if is_class_type(t):
         return "Object *"
         return "Object *"
+    if t == "int":
+        return "int64_t "
+    if t == "float" or t == "real":
+        return "double "
     return t + " "
     return t + " "