Selaa lähdekoodia

[GDNative] removed anchors

Karroffel 8 vuotta sitten
vanhempi
commit
d82942e1c5

+ 1 - 13
modules/gdnative/gdnative.cpp

@@ -87,12 +87,6 @@ GDNative::GDNative() {
 GDNative::~GDNative() {
 }
 
-extern "C" void _api_anchor();
-
-void GDNative::_compile_dummy_for_api() {
-	_api_anchor();
-}
-
 void GDNative::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("set_library", "library"), &GDNative::set_library);
 	ClassDB::bind_method(D_METHOD("get_library"), &GDNative::get_library);
@@ -224,8 +218,6 @@ bool GDNative::terminate() {
 	godot_gdnative_terminate_fn library_terminate_pointer;
 	library_terminate_pointer = (godot_gdnative_terminate_fn)library_terminate;
 
-	// TODO(karroffel): remove this? Should be part of NativeScript, not
-	// GDNative IMO
 	godot_gdnative_terminate_options options;
 	options.in_editor = Engine::get_singleton()->is_editor_hint();
 
@@ -412,10 +404,6 @@ RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_or
 	lib->current_dependencies = dependency_paths;
 	lib->current_library_statically_linked = is_statically_linked;
 
-	print_line(String("lib path: ") + entry_lib_path);
-	print_line(String("dependencies: ") + Variant(dependency_paths));
-	print_line(String("static: ") + (is_statically_linked ? "true" : "false"));
-
 	return lib;
 }
 
@@ -424,7 +412,7 @@ void GDNativeLibraryResourceLoader::get_recognized_extensions(List<String> *p_ex
 }
 
 bool GDNativeLibraryResourceLoader::handles_type(const String &p_type) const {
-	return p_type == "Resource" || p_type == "GDNativeLibrary";
+	return p_type == "GDNativeLibrary";
 }
 
 String GDNativeLibraryResourceLoader::get_resource_type(const String &p_path) const {

+ 0 - 2
modules/gdnative/gdnative.h

@@ -131,8 +131,6 @@ class GDNative : public Reference {
 
 	bool initialized;
 
-	void _compile_dummy_for_api();
-
 public:
 	GDNative();
 	~GDNative();

+ 0 - 3
modules/gdnative/gdnative/array.cpp

@@ -41,9 +41,6 @@
 extern "C" {
 #endif
 
-void _array_api_anchor() {
-}
-
 void GDAPI godot_array_new(godot_array *r_dest) {
 	Array *dest = (Array *)r_dest;
 	memnew_placement(dest, Array);

+ 0 - 2
modules/gdnative/gdnative/basis.cpp

@@ -36,8 +36,6 @@
 extern "C" {
 #endif
 
-void _basis_api_anchor() {}
-
 void GDAPI godot_basis_new_with_rows(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis) {
 	const Vector3 *x_axis = (const Vector3 *)p_x_axis;
 	const Vector3 *y_axis = (const Vector3 *)p_y_axis;

+ 0 - 2
modules/gdnative/gdnative/color.cpp

@@ -36,8 +36,6 @@
 extern "C" {
 #endif
 
-void _color_api_anchor() {}
-
 void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a) {
 
 	Color *dest = (Color *)r_dest;

+ 0 - 2
modules/gdnative/gdnative/dictionary.cpp

@@ -38,8 +38,6 @@
 extern "C" {
 #endif
 
-void _dictionary_api_anchor() {}
-
 void GDAPI godot_dictionary_new(godot_dictionary *r_dest) {
 	Dictionary *dest = (Dictionary *)r_dest;
 	memnew_placement(dest, Dictionary);

+ 0 - 49
modules/gdnative/gdnative/gdnative.cpp

@@ -40,47 +40,6 @@
 extern "C" {
 #endif
 
-extern "C" void _string_api_anchor();
-extern "C" void _string_name_api_anchor();
-extern "C" void _vector2_api_anchor();
-extern "C" void _rect2_api_anchor();
-extern "C" void _vector3_api_anchor();
-extern "C" void _transform2d_api_anchor();
-extern "C" void _plane_api_anchor();
-extern "C" void _quat_api_anchor();
-extern "C" void _basis_api_anchor();
-extern "C" void _rect3_api_anchor();
-extern "C" void _transform_api_anchor();
-extern "C" void _color_api_anchor();
-extern "C" void _node_path_api_anchor();
-extern "C" void _rid_api_anchor();
-extern "C" void _dictionary_api_anchor();
-extern "C" void _array_api_anchor();
-extern "C" void _pool_arrays_api_anchor();
-extern "C" void _variant_api_anchor();
-
-void _api_anchor() {
-
-	_string_api_anchor();
-	_string_name_api_anchor();
-	_vector2_api_anchor();
-	_rect2_api_anchor();
-	_vector3_api_anchor();
-	_transform2d_api_anchor();
-	_plane_api_anchor();
-	_quat_api_anchor();
-	_rect3_api_anchor();
-	_basis_api_anchor();
-	_transform_api_anchor();
-	_color_api_anchor();
-	_node_path_api_anchor();
-	_rid_api_anchor();
-	_dictionary_api_anchor();
-	_array_api_anchor();
-	_pool_arrays_api_anchor();
-	_variant_api_anchor();
-}
-
 void GDAPI godot_object_destroy(godot_object *p_o) {
 	memdelete((Object *)p_o);
 }
@@ -133,14 +92,6 @@ godot_variant GDAPI godot_method_bind_call(godot_method_bind *p_method_bind, god
 	return ret;
 }
 
-// @Todo
-/*
-void GDAPI godot_method_bind_varcall(godot_method_bind *p_method_bind)
-{
-
-}
-*/
-
 godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classname) {
 	ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(StringName(p_classname));
 	if (class_info)

+ 0 - 2
modules/gdnative/gdnative/node_path.cpp

@@ -36,8 +36,6 @@
 extern "C" {
 #endif
 
-void _node_path_api_anchor() {}
-
 void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from) {
 	NodePath *dest = (NodePath *)r_dest;
 	const String *from = (const String *)p_from;

+ 0 - 2
modules/gdnative/gdnative/plane.cpp

@@ -36,8 +36,6 @@
 extern "C" {
 #endif
 
-void _plane_api_anchor() {}
-
 void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d) {
 
 	Plane *dest = (Plane *)r_dest;

+ 0 - 3
modules/gdnative/gdnative/pool_arrays.cpp

@@ -41,9 +41,6 @@
 extern "C" {
 #endif
 
-void _pool_arrays_api_anchor() {
-}
-
 #define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
 
 // byte

+ 0 - 2
modules/gdnative/gdnative/quat.cpp

@@ -36,8 +36,6 @@
 extern "C" {
 #endif
 
-void _quat_api_anchor() {}
-
 void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w) {
 
 	Quat *dest = (Quat *)r_dest;

+ 0 - 2
modules/gdnative/gdnative/rect2.cpp

@@ -36,8 +36,6 @@
 extern "C" {
 #endif
 
-void _rect2_api_anchor() {}
-
 void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size) {
 	const Vector2 *position = (const Vector2 *)p_pos;
 	const Vector2 *size = (const Vector2 *)p_size;

+ 0 - 2
modules/gdnative/gdnative/rect3.cpp

@@ -36,8 +36,6 @@
 extern "C" {
 #endif
 
-void _rect3_api_anchor() {}
-
 void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
 	const Vector3 *pos = (const Vector3 *)p_pos;
 	const Vector3 *size = (const Vector3 *)p_size;

+ 0 - 2
modules/gdnative/gdnative/rid.cpp

@@ -37,8 +37,6 @@
 extern "C" {
 #endif
 
-void _rid_api_anchor() {}
-
 void GDAPI godot_rid_new(godot_rid *r_dest) {
 	RID *dest = (RID *)r_dest;
 	memnew_placement(dest, RID);

+ 0 - 3
modules/gdnative/gdnative/string.cpp

@@ -39,9 +39,6 @@
 extern "C" {
 #endif
 
-void _string_api_anchor() {
-}
-
 void GDAPI godot_string_new(godot_string *r_dest) {
 	String *dest = (String *)r_dest;
 	memnew_placement(dest, String);

+ 0 - 3
modules/gdnative/gdnative/string_name.cpp

@@ -38,9 +38,6 @@
 extern "C" {
 #endif
 
-void _string_name_api_anchor() {
-}
-
 void GDAPI godot_string_name_new(godot_string_name *r_dest, const godot_string *p_name) {
 	StringName *dest = (StringName *)r_dest;
 	const String *name = (const String *)p_name;

+ 0 - 2
modules/gdnative/gdnative/transform.cpp

@@ -36,8 +36,6 @@
 extern "C" {
 #endif
 
-void _transform_api_anchor() {}
-
 void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin) {
 	const Vector3 *x_axis = (const Vector3 *)p_x_axis;
 	const Vector3 *y_axis = (const Vector3 *)p_y_axis;

+ 0 - 2
modules/gdnative/gdnative/transform2d.cpp

@@ -36,8 +36,6 @@
 extern "C" {
 #endif
 
-void _transform2d_api_anchor() {}
-
 void GDAPI godot_transform2d_new(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos) {
 	const Vector2 *pos = (const Vector2 *)p_pos;
 	Transform2D *dest = (Transform2D *)r_dest;

+ 0 - 2
modules/gdnative/gdnative/variant.cpp

@@ -36,8 +36,6 @@
 extern "C" {
 #endif
 
-void _variant_api_anchor() {}
-
 #define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
 
 // Constructors

+ 0 - 2
modules/gdnative/gdnative/vector2.cpp

@@ -36,8 +36,6 @@
 extern "C" {
 #endif
 
-void _vector2_api_anchor() {}
-
 void GDAPI godot_vector2_new(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y) {
 
 	Vector2 *dest = (Vector2 *)r_dest;

+ 0 - 2
modules/gdnative/gdnative/vector3.cpp

@@ -36,8 +36,6 @@
 extern "C" {
 #endif
 
-void _vector3_api_anchor() {}
-
 void GDAPI godot_vector3_new(godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z) {
 
 	Vector3 *dest = (Vector3 *)r_dest;

+ 1 - 1
modules/gdnative/include/gdnative/gdnative.h

@@ -53,7 +53,7 @@ extern "C" {
 
 // This is for libraries *using* the header, NOT GODOT EXPOSING STUFF!!
 #ifdef _WIN32
-#define GDN_EXPORT __declspec(dllexport)
+#define GDN_EXPORT
 #else
 #define GDN_EXPORT
 #endif

+ 19 - 17
modules/gdnative/nativescript/nativescript.cpp

@@ -40,6 +40,8 @@
 #include "scene/main/scene_tree.h"
 #include "scene/resources/scene_format_text.h"
 
+#include <stdlib.h>
+
 #ifndef NO_THREADS
 #include "os/thread.h"
 #endif
@@ -52,7 +54,11 @@
 #include "editor/editor_node.h"
 #endif
 
-////// Script stuff
+//
+//
+// Script stuff
+//
+//
 
 void NativeScript::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("set_class_name", "class_name"), &NativeScript::set_class_name);
@@ -414,7 +420,6 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Variant::Call
 	}
 }
 
-// TODO(karroffel): implement this
 NativeScript::NativeScript() {
 	library = Ref<GDNative>();
 	lib_path = "";
@@ -424,7 +429,6 @@ NativeScript::NativeScript() {
 #endif
 }
 
-// TODO(karroffel): implement this
 NativeScript::~NativeScript() {
 	NSL->unregister_script(this);
 
@@ -433,7 +437,11 @@ NativeScript::~NativeScript() {
 #endif
 }
 
-	////// ScriptInstance stuff
+//
+//
+// ScriptInstance stuff
+//
+//
 
 #define GET_SCRIPT_DESC() script->get_script_desc()
 
@@ -691,7 +699,6 @@ NativeScriptInstance::RPCMode NativeScriptInstance::get_rpc_mode(const StringNam
 	return RPC_MODE_DISABLED;
 }
 
-// TODO(karroffel): implement this
 NativeScriptInstance::RPCMode NativeScriptInstance::get_rset_mode(const StringName &p_variable) const {
 
 	NativeScriptDesc *script_data = GET_SCRIPT_DESC();
@@ -774,15 +781,14 @@ NativeScriptInstance::~NativeScriptInstance() {
 	}
 }
 
-////// ScriptingLanguage stuff
+//
+//
+// ScriptingLanguage stuff
+//
+//
 
 NativeScriptLanguage *NativeScriptLanguage::singleton;
 
-extern "C" void _native_script_hook();
-void NativeScriptLanguage::_hacky_api_anchor() {
-	_native_script_hook();
-}
-
 void NativeScriptLanguage::_unload_stuff() {
 	for (Map<String, Map<StringName, NativeScriptDesc> >::Element *L = library_classes.front(); L; L = L->next()) {
 		for (Map<StringName, NativeScriptDesc>::Element *C = L->get().front(); C; C = C->next()) {
@@ -819,9 +825,7 @@ NativeScriptLanguage::NativeScriptLanguage() {
 #endif
 }
 
-// TODO(karroffel): implement this
 NativeScriptLanguage::~NativeScriptLanguage() {
-	// _unload_stuff(); // NOTE(karroffel): This gets called in ::finish()
 
 	for (Map<String, Ref<GDNative> >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) {
 
@@ -847,7 +851,6 @@ void _add_reload_node() {
 #endif
 }
 
-// TODO(karroffel): implement this
 void NativeScriptLanguage::init() {
 
 #if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED)
@@ -860,6 +863,7 @@ void NativeScriptLanguage::init() {
 		if (generate_c_api(E->next()->get()) != OK) {
 			ERR_PRINT("Failed to generate C API\n");
 		}
+		exit(0);
 	}
 #endif
 
@@ -886,11 +890,9 @@ void NativeScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) co
 void NativeScriptLanguage::get_string_delimiters(List<String> *p_delimiters) const {
 }
 
-// TODO(karroffel): implement this
 Ref<Script> NativeScriptLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const {
 	NativeScript *s = memnew(NativeScript);
 	s->set_class_name(p_class_name);
-	// TODO(karroffel): use p_base_class_name
 	return Ref<NativeScript>(s);
 }
 bool NativeScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const {
@@ -998,7 +1000,7 @@ void NativeScriptLanguage::init_library(const Ref<GDNativeLibrary> &lib) {
 		gdn.instance();
 		gdn->set_library(lib);
 
-		// TODO(karroffel): check the return value?
+		// TODO check the return value?
 		gdn->initialize();
 
 		library_gdnatives.insert(lib_path, gdn);

+ 4 - 4
modules/gdnative/nativescript/nativescript.h

@@ -229,15 +229,15 @@ public:
 	Map<String, Set<NativeScript *> > library_script_users;
 
 	const StringName _init_call_type = "nativescript_init";
-	const StringName _init_call_name = "godot_nativescript_init";
+	const StringName _init_call_name = "nativescript_init";
 
 	const StringName _noarg_call_type = "nativescript_no_arg";
 
-	const StringName _frame_call_name = "godot_nativescript_frame";
+	const StringName _frame_call_name = "nativescript_frame";
 
 #ifndef NO_THREADS
-	const StringName _thread_enter_call_name = "godot_nativescript_thread_enter";
-	const StringName _thread_exit_call_name = "godot_nativescript_thread_exit";
+	const StringName _thread_enter_call_name = "nativescript_thread_enter";
+	const StringName _thread_exit_call_name = "nativescript_thread_exit";
 #endif
 
 	NativeScriptLanguage();