diff options
author | Gilles Roudière <gilles.roudiere@gmail.com> | 2022-12-07 14:11:44 +0100 |
---|---|---|
committer | Gilles Roudière <gilles.roudiere@gmail.com> | 2022-12-12 11:06:38 +0100 |
commit | c02e644679655e842dcff543f0defef973cf946c (patch) | |
tree | 67875626a128c08eca565bc3693e2dfbe36fce75 /src/core | |
parent | f74c47220382a8e1a347c8dda942a95caea13a0e (diff) | |
download | redot-cpp-c02e644679655e842dcff543f0defef973cf946c.tar.gz |
Rename GDNative to GDExtension
Non-exhaustive list of case-sensitive renames:
GDExtension -> GDNative
GDNATIVE -> GDEXTENSION
gdextension -> gdnative
ExtensionExtension -> Extension (for where there was GDNativeExtension)
EXTENSION_EXTENSION -> EXTENSION (for where there was GDNATIVE_EXTENSION)
gdnlib -> gdextension
gdn_interface -> gde_interface
gdni -> gde_interface
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/class_db.cpp | 102 | ||||
-rw-r--r-- | src/core/error_macros.cpp | 16 | ||||
-rw-r--r-- | src/core/memory.cpp | 6 | ||||
-rw-r--r-- | src/core/method_bind.cpp | 10 | ||||
-rw-r--r-- | src/core/object.cpp | 10 |
5 files changed, 72 insertions, 72 deletions
diff --git a/src/core/class_db.cpp b/src/core/class_db.cpp index 1e2c6e0..54dbda7 100644 --- a/src/core/class_db.cpp +++ b/src/core/class_db.cpp @@ -40,7 +40,7 @@ namespace godot { std::unordered_map<StringName, ClassDB::ClassInfo> ClassDB::classes; -GDNativeInitializationLevel ClassDB::current_level = GDNATIVE_INITIALIZATION_CORE; +GDExtensionInitializationLevel ClassDB::current_level = GDEXTENSION_INITIALIZATION_CORE; MethodDefinition D_METHOD(StringName p_name) { return MethodDefinition(p_name); @@ -55,13 +55,13 @@ MethodDefinition D_METHOD(StringName p_name, StringName p_arg1) { void ClassDB::add_property_group(const StringName &p_class, const String &p_name, const String &p_prefix) { ERR_FAIL_COND_MSG(classes.find(p_class) == classes.end(), String("Trying to add property '{0}{1}' to non-existing class '{2}'.").format(Array::make(p_prefix, p_name, p_class))); - internal::gdn_interface->classdb_register_extension_class_property_group(internal::library, p_class._native_ptr(), p_name._native_ptr(), p_prefix._native_ptr()); + internal::gde_interface->classdb_register_extension_class_property_group(internal::library, p_class._native_ptr(), p_name._native_ptr(), p_prefix._native_ptr()); } void ClassDB::add_property_subgroup(const StringName &p_class, const String &p_name, const String &p_prefix) { ERR_FAIL_COND_MSG(classes.find(p_class) == classes.end(), String("Trying to add property '{0}{1}' to non-existing class '{2}'.").format(Array::make(p_prefix, p_name, p_class))); - internal::gdn_interface->classdb_register_extension_class_property_subgroup(internal::library, p_class._native_ptr(), p_name._native_ptr(), p_prefix._native_ptr()); + internal::gde_interface->classdb_register_extension_class_property_subgroup(internal::library, p_class._native_ptr(), p_name._native_ptr(), p_prefix._native_ptr()); } void ClassDB::add_property(const StringName &p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index) { @@ -94,12 +94,12 @@ void ClassDB::add_property(const StringName &p_class, const PropertyInfo &p_pinf info.property_names.insert(p_pinfo.name); // register with Godot - GDNativePropertyInfo prop_info = { - static_cast<GDNativeVariantType>(p_pinfo.type), // GDNativeVariantType type; - p_pinfo.name._native_ptr(), // GDNativeStringNamePtr name; - p_pinfo.class_name._native_ptr(), // GDNativeStringNamePtr class_name; + GDExtensionPropertyInfo prop_info = { + static_cast<GDExtensionVariantType>(p_pinfo.type), // GDExtensionVariantType type; + p_pinfo.name._native_ptr(), // GDExtensionStringNamePtr name; + p_pinfo.class_name._native_ptr(), // GDExtensionStringNamePtr class_name; p_pinfo.hint, // NONE //uint32_t hint; - p_pinfo.hint_string._native_ptr(), // GDNativeStringPtr hint_string; + p_pinfo.hint_string._native_ptr(), // GDExtensionStringPtr hint_string; p_pinfo.usage, // DEFAULT //uint32_t usage; }; @@ -111,7 +111,7 @@ void ClassDB::add_property(const StringName &p_class, const PropertyInfo &p_pinf setget.index = p_index; setget.type = p_pinfo.type; - internal::gdn_interface->classdb_register_extension_class_property(internal::library, info.name._native_ptr(), &prop_info, setget.setter._native_ptr(), setget.getter._native_ptr()); + internal::gde_interface->classdb_register_extension_class_property(internal::library, info.name._native_ptr(), &prop_info, setget.setter._native_ptr(), setget.getter._native_ptr()); } MethodBind *ClassDB::get_method(const StringName &p_class, const StringName &p_method) { @@ -189,52 +189,52 @@ MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, const M } void ClassDB::bind_method_godot(const StringName &p_class_name, MethodBind *p_method) { - std::vector<GDNativeVariantPtr> def_args; + std::vector<GDExtensionVariantPtr> def_args; const std::vector<Variant> &def_args_val = p_method->get_default_arguments(); def_args.resize(def_args_val.size()); for (int i = 0; i < def_args_val.size(); i++) { - def_args[i] = (GDNativeVariantPtr)&def_args_val[i]; + def_args[i] = (GDExtensionVariantPtr)&def_args_val[i]; } std::vector<PropertyInfo> return_value_and_arguments_info = p_method->get_arguments_info_list(); - std::vector<GDNativeExtensionClassMethodArgumentMetadata> return_value_and_arguments_metadata = p_method->get_arguments_metadata_list(); + std::vector<GDExtensionClassMethodArgumentMetadata> return_value_and_arguments_metadata = p_method->get_arguments_metadata_list(); - std::vector<GDNativePropertyInfo> return_value_and_arguments_gdnative_info; - return_value_and_arguments_gdnative_info.reserve(return_value_and_arguments_info.size()); + std::vector<GDExtensionPropertyInfo> return_value_and_arguments_gdextension_info; + return_value_and_arguments_gdextension_info.reserve(return_value_and_arguments_info.size()); for (std::vector<PropertyInfo>::iterator it = return_value_and_arguments_info.begin(); it != return_value_and_arguments_info.end(); it++) { - return_value_and_arguments_gdnative_info.push_back( - GDNativePropertyInfo{ - static_cast<GDNativeVariantType>(it->type), // GDNativeVariantType type; - it->name._native_ptr(), // GDNativeStringNamePtr name; - it->class_name._native_ptr(), // GDNativeStringNamePtr class_name; + return_value_and_arguments_gdextension_info.push_back( + GDExtensionPropertyInfo{ + static_cast<GDExtensionVariantType>(it->type), // GDExtensionVariantType type; + it->name._native_ptr(), // GDExtensionStringNamePtr name; + it->class_name._native_ptr(), // GDExtensionStringNamePtr class_name; it->hint, // uint32_t hint; - it->hint_string._native_ptr(), // GDNativeStringPtr hint_string; + it->hint_string._native_ptr(), // GDExtensionStringPtr hint_string; it->usage, // uint32_t usage; }); } - GDNativePropertyInfo *return_value_info = return_value_and_arguments_gdnative_info.data(); - GDNativeExtensionClassMethodArgumentMetadata *return_value_metadata = return_value_and_arguments_metadata.data(); - GDNativePropertyInfo *arguments_info = return_value_and_arguments_gdnative_info.data() + 1; - GDNativeExtensionClassMethodArgumentMetadata *arguments_metadata = return_value_and_arguments_metadata.data() + 1; + GDExtensionPropertyInfo *return_value_info = return_value_and_arguments_gdextension_info.data(); + GDExtensionClassMethodArgumentMetadata *return_value_metadata = return_value_and_arguments_metadata.data(); + GDExtensionPropertyInfo *arguments_info = return_value_and_arguments_gdextension_info.data() + 1; + GDExtensionClassMethodArgumentMetadata *arguments_metadata = return_value_and_arguments_metadata.data() + 1; StringName name = p_method->get_name(); - GDNativeExtensionClassMethodInfo method_info = { - name._native_ptr(), // GDNativeStringNamePtr; + GDExtensionClassMethodInfo method_info = { + name._native_ptr(), // GDExtensionStringNamePtr; p_method, // void *method_userdata; - MethodBind::bind_call, // GDNativeExtensionClassMethodCall call_func; - MethodBind::bind_ptrcall, // GDNativeExtensionClassMethodPtrCall ptrcall_func; - p_method->get_hint_flags(), // uint32_t method_flags; /* GDNativeExtensionClassMethodFlags */ - (GDNativeBool)p_method->has_return(), // GDNativeBool has_return_value; - return_value_info, // GDNativePropertyInfo * - *return_value_metadata, // GDNativeExtensionClassMethodArgumentMetadata * + MethodBind::bind_call, // GDExtensionClassMethodCall call_func; + MethodBind::bind_ptrcall, // GDExtensionClassMethodPtrCall ptrcall_func; + p_method->get_hint_flags(), // uint32_t method_flags; /* GDExtensionClassMethodFlags */ + (GDExtensionBool)p_method->has_return(), // GDExtensionBool has_return_value; + return_value_info, // GDExtensionPropertyInfo * + *return_value_metadata, // GDExtensionClassMethodArgumentMetadata * (uint32_t)p_method->get_argument_count(), // uint32_t argument_count; - arguments_info, // GDNativePropertyInfo * - arguments_metadata, // GDNativeExtensionClassMethodArgumentMetadata * + arguments_info, // GDExtensionPropertyInfo * + arguments_metadata, // GDExtensionClassMethodArgumentMetadata * (uint32_t)p_method->get_default_argument_count(), // uint32_t default_argument_count; - def_args.data(), // GDNativeVariantPtr *default_arguments; + def_args.data(), // GDExtensionVariantPtr *default_arguments; }; - internal::gdn_interface->classdb_register_extension_class_method(internal::library, p_class_name._native_ptr(), &method_info); + internal::gde_interface->classdb_register_extension_class_method(internal::library, p_class_name._native_ptr(), &method_info); } void ClassDB::add_signal(const StringName &p_class, const MethodInfo &p_signal) { @@ -255,24 +255,24 @@ void ClassDB::add_signal(const StringName &p_class, const MethodInfo &p_signal) cl.signal_names.insert(p_signal.name); // register our signal in godot - std::vector<GDNativePropertyInfo> parameters; + std::vector<GDExtensionPropertyInfo> parameters; parameters.reserve(p_signal.arguments.size()); for (const PropertyInfo &par : p_signal.arguments) { - parameters.push_back(GDNativePropertyInfo{ - static_cast<GDNativeVariantType>(par.type), // GDNativeVariantType type; - par.name._native_ptr(), // GDNativeStringNamePtr name; - par.class_name._native_ptr(), // GDNativeStringNamePtr class_name; + parameters.push_back(GDExtensionPropertyInfo{ + static_cast<GDExtensionVariantType>(par.type), // GDExtensionVariantType type; + par.name._native_ptr(), // GDExtensionStringNamePtr name; + par.class_name._native_ptr(), // GDExtensionStringNamePtr class_name; par.hint, // NONE //uint32_t hint; - par.hint_string._native_ptr(), // GDNativeStringPtr hint_string; + par.hint_string._native_ptr(), // GDExtensionStringPtr hint_string; par.usage, // DEFAULT //uint32_t usage; }); } - internal::gdn_interface->classdb_register_extension_class_signal(internal::library, cl.name._native_ptr(), p_signal.name._native_ptr(), parameters.data(), parameters.size()); + internal::gde_interface->classdb_register_extension_class_signal(internal::library, cl.name._native_ptr(), p_signal.name._native_ptr(), parameters.data(), parameters.size()); } -void ClassDB::bind_integer_constant(const StringName &p_class_name, const StringName &p_enum_name, const StringName &p_constant_name, GDNativeInt p_constant_value, bool p_is_bitfield) { +void ClassDB::bind_integer_constant(const StringName &p_class_name, const StringName &p_enum_name, const StringName &p_constant_name, GDExtensionInt p_constant_value, bool p_is_bitfield) { std::unordered_map<StringName, ClassInfo>::iterator type_it = classes.find(p_class_name); ERR_FAIL_COND_MSG(type_it == classes.end(), String("Class '{0}' doesn't exist.").format(Array::make(p_class_name))); @@ -286,9 +286,9 @@ void ClassDB::bind_integer_constant(const StringName &p_class_name, const String type.constant_names.insert(p_constant_name); // Register it with Godot - internal::gdn_interface->classdb_register_extension_class_integer_constant(internal::library, p_class_name._native_ptr(), p_enum_name._native_ptr(), p_constant_name._native_ptr(), p_constant_value, p_is_bitfield); + internal::gde_interface->classdb_register_extension_class_integer_constant(internal::library, p_class_name._native_ptr(), p_enum_name._native_ptr(), p_constant_name._native_ptr(), p_constant_value, p_is_bitfield); } -GDNativeExtensionClassCallVirtual ClassDB::get_virtual_func(void *p_userdata, GDNativeConstStringNamePtr p_name) { +GDExtensionClassCallVirtual ClassDB::get_virtual_func(void *p_userdata, GDExtensionConstStringNamePtr p_name) { // This is called by Godot the first time it calls a virtual function, and it caches the result, per object instance. // Because of this, it can happen from different threads at once. // It should be ok not using any mutex as long as we only READ data. @@ -302,7 +302,7 @@ GDNativeExtensionClassCallVirtual ClassDB::get_virtual_func(void *p_userdata, GD // Find method in current class, or any of its parent classes (Godot classes not included) while (type != nullptr) { - std::unordered_map<StringName, GDNativeExtensionClassCallVirtual>::const_iterator method_it = type->virtual_methods.find(*name); + std::unordered_map<StringName, GDExtensionClassCallVirtual>::const_iterator method_it = type->virtual_methods.find(*name); if (method_it != type->virtual_methods.end()) { return method_it->second; @@ -314,7 +314,7 @@ GDNativeExtensionClassCallVirtual ClassDB::get_virtual_func(void *p_userdata, GD return nullptr; } -void ClassDB::bind_virtual_method(const StringName &p_class, const StringName &p_method, GDNativeExtensionClassCallVirtual p_call) { +void ClassDB::bind_virtual_method(const StringName &p_class, const StringName &p_method, GDExtensionClassCallVirtual p_call) { std::unordered_map<StringName, ClassInfo>::iterator type_it = classes.find(p_class); ERR_FAIL_COND_MSG(type_it == classes.end(), String("Class '{0}' doesn't exist.").format(Array::make(p_class))); @@ -329,7 +329,7 @@ void ClassDB::bind_virtual_method(const StringName &p_class, const StringName &p void ClassDB::initialize_class(const ClassInfo &p_cl) { } -void ClassDB::initialize(GDNativeInitializationLevel p_level) { +void ClassDB::initialize(GDExtensionInitializationLevel p_level) { for (const std::pair<StringName, ClassInfo> pair : classes) { const ClassInfo &cl = pair.second; if (cl.level != p_level) { @@ -340,14 +340,14 @@ void ClassDB::initialize(GDNativeInitializationLevel p_level) { } } -void ClassDB::deinitialize(GDNativeInitializationLevel p_level) { +void ClassDB::deinitialize(GDExtensionInitializationLevel p_level) { for (const std::pair<StringName, ClassInfo> pair : classes) { const ClassInfo &cl = pair.second; if (cl.level != p_level) { continue; } - internal::gdn_interface->classdb_unregister_extension_class(internal::library, cl.name._native_ptr()); + internal::gde_interface->classdb_unregister_extension_class(internal::library, cl.name._native_ptr()); for (auto method : cl.method_map) { memdelete(method.second); diff --git a/src/core/error_macros.cpp b/src/core/error_macros.cpp index b17b8de..007e63f 100644 --- a/src/core/error_macros.cpp +++ b/src/core/error_macros.cpp @@ -38,33 +38,33 @@ namespace godot { void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const char *p_message, bool p_is_warning) { if (p_is_warning) { - internal::gdn_interface->print_warning(p_message, p_function, p_file, p_line); + internal::gde_interface->print_warning(p_message, p_function, p_file, p_line); } else { - internal::gdn_interface->print_error(p_message, p_function, p_file, p_line); + internal::gde_interface->print_error(p_message, p_function, p_file, p_line); } } void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, const char *p_message, bool p_is_warning) { if (p_is_warning) { - internal::gdn_interface->print_warning(p_message, p_function, p_file, p_line); + internal::gde_interface->print_warning(p_message, p_function, p_file, p_line); } else { - internal::gdn_interface->print_error(p_message, p_function, p_file, p_line); + internal::gde_interface->print_error(p_message, p_function, p_file, p_line); } } void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const String &p_message, bool p_is_warning) { if (p_is_warning) { - internal::gdn_interface->print_warning(p_message.utf8().get_data(), p_function, p_file, p_line); + internal::gde_interface->print_warning(p_message.utf8().get_data(), p_function, p_file, p_line); } else { - internal::gdn_interface->print_error(p_message.utf8().get_data(), p_function, p_file, p_line); + internal::gde_interface->print_error(p_message.utf8().get_data(), p_function, p_file, p_line); } } void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, const String &p_message, bool p_is_warning) { if (p_is_warning) { - internal::gdn_interface->print_warning(p_message.utf8().get_data(), p_function, p_file, p_line); + internal::gde_interface->print_warning(p_message.utf8().get_data(), p_function, p_file, p_line); } else { - internal::gdn_interface->print_error(p_message.utf8().get_data(), p_function, p_file, p_line); + internal::gde_interface->print_error(p_message.utf8().get_data(), p_function, p_file, p_line); } } diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 022e58e..68ed6b3 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -35,15 +35,15 @@ namespace godot { void *Memory::alloc_static(size_t p_bytes) { - return internal::gdn_interface->mem_alloc(p_bytes); + return internal::gde_interface->mem_alloc(p_bytes); } void *Memory::realloc_static(void *p_memory, size_t p_bytes) { - return internal::gdn_interface->mem_realloc(p_memory, p_bytes); + return internal::gde_interface->mem_realloc(p_memory, p_bytes); } void Memory::free_static(void *p_ptr) { - internal::gdn_interface->mem_free(p_ptr); + internal::gde_interface->mem_free(p_ptr); } _GlobalNil::_GlobalNil() { diff --git a/src/core/method_bind.cpp b/src/core/method_bind.cpp index 4987179..49ff759 100644 --- a/src/core/method_bind.cpp +++ b/src/core/method_bind.cpp @@ -75,7 +75,7 @@ void MethodBind::generate_argument_types(int p_count) { memdelete_arr(argument_types); } - argument_types = memnew_arr(GDNativeVariantType, p_count + 1); + argument_types = memnew_arr(GDExtensionVariantType, p_count + 1); // -1 means return type. for (int i = -1; i < p_count; i++) { @@ -91,15 +91,15 @@ PropertyInfo MethodBind::get_argument_info(int p_argument) const { return info; } -void MethodBind::bind_call(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error) { +void MethodBind::bind_call(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error) { const MethodBind *bind = reinterpret_cast<const MethodBind *>(p_method_userdata); Variant ret = bind->call(p_instance, p_args, p_argument_count, *r_error); // This assumes the return value is an empty Variant, so it doesn't need to call the destructor first. - // Since only NativeExtensionMethodBind calls this from the Godot side, it should always be the case. - internal::gdn_interface->variant_new_copy(r_return, ret._native_ptr()); + // Since only GDExtensionMethodBind calls this from the Godot side, it should always be the case. + internal::gde_interface->variant_new_copy(r_return, ret._native_ptr()); } -void MethodBind::bind_ptrcall(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_return) { +void MethodBind::bind_ptrcall(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_return) { const MethodBind *bind = reinterpret_cast<const MethodBind *>(p_method_userdata); bind->ptrcall(p_instance, p_args, r_return); } diff --git a/src/core/object.cpp b/src/core/object.cpp index b0025ea..092195f 100644 --- a/src/core/object.cpp +++ b/src/core/object.cpp @@ -33,22 +33,22 @@ namespace godot { MethodInfo::MethodInfo() : - flags(GDNATIVE_EXTENSION_METHOD_FLAG_NORMAL) {} + flags(GDEXTENSION_METHOD_FLAG_NORMAL) {} MethodInfo::MethodInfo(StringName p_name) : - name(p_name), flags(GDNATIVE_EXTENSION_METHOD_FLAG_NORMAL) {} + name(p_name), flags(GDEXTENSION_METHOD_FLAG_NORMAL) {} MethodInfo::MethodInfo(Variant::Type ret) : - flags(GDNATIVE_EXTENSION_METHOD_FLAG_NORMAL) { + flags(GDEXTENSION_METHOD_FLAG_NORMAL) { return_val.type = ret; } MethodInfo::MethodInfo(Variant::Type ret, StringName p_name) : - name(p_name), flags(GDNATIVE_EXTENSION_METHOD_FLAG_NORMAL) { + name(p_name), flags(GDEXTENSION_METHOD_FLAG_NORMAL) { return_val.type = ret; } MethodInfo::MethodInfo(const PropertyInfo &p_ret, StringName p_name) : - name(p_name), return_val(p_ret), flags(GDNATIVE_EXTENSION_METHOD_FLAG_NORMAL) {} + name(p_name), return_val(p_ret), flags(GDEXTENSION_METHOD_FLAG_NORMAL) {} } // namespace godot |