summaryrefslogtreecommitdiff
path: root/modules/gdnative/pluginscript
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdnative/pluginscript')
-rw-r--r--modules/gdnative/pluginscript/SCsub6
-rw-r--r--modules/gdnative/pluginscript/pluginscript_instance.cpp2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_instance.h2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_language.h2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_loader.cpp4
-rw-r--r--modules/gdnative/pluginscript/pluginscript_loader.h2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_script.cpp39
-rw-r--r--modules/gdnative/pluginscript/pluginscript_script.h2
-rw-r--r--modules/gdnative/pluginscript/register_types.h5
9 files changed, 39 insertions, 25 deletions
diff --git a/modules/gdnative/pluginscript/SCsub b/modules/gdnative/pluginscript/SCsub
index 20eaa99592..0b2db3b504 100644
--- a/modules/gdnative/pluginscript/SCsub
+++ b/modules/gdnative/pluginscript/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
-Import('env_gdnative')
+Import("env")
+Import("env_gdnative")
-env_gdnative.add_source_files(env.modules_sources, '*.cpp')
+env_gdnative.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/gdnative/pluginscript/pluginscript_instance.cpp b/modules/gdnative/pluginscript/pluginscript_instance.cpp
index 22e8372130..7d17a7d5ab 100644
--- a/modules/gdnative/pluginscript/pluginscript_instance.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_instance.cpp
@@ -156,7 +156,7 @@ bool PluginScriptInstance::init(PluginScript *p_script, Object *p_owner) {
_script = Ref<PluginScript>(p_script);
_desc = &p_script->_desc->instance_desc;
_data = _desc->init(p_script->_data, (godot_object *)p_owner);
- ERR_FAIL_COND_V(_data == NULL, false);
+ ERR_FAIL_COND_V(_data == nullptr, false);
p_owner->set_script_instance(this);
return true;
}
diff --git a/modules/gdnative/pluginscript/pluginscript_instance.h b/modules/gdnative/pluginscript/pluginscript_instance.h
index c91ad643a7..6309b6fde3 100644
--- a/modules/gdnative/pluginscript/pluginscript_instance.h
+++ b/modules/gdnative/pluginscript/pluginscript_instance.h
@@ -55,7 +55,7 @@ public:
virtual bool set(const StringName &p_name, const Variant &p_value);
virtual bool get(const StringName &p_name, Variant &r_ret) const;
virtual void get_property_list(List<PropertyInfo> *p_properties) const;
- virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = NULL) const;
+ virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = nullptr) const;
virtual void get_method_list(List<MethodInfo> *p_list) const;
virtual bool has_method(const StringName &p_method) const;
diff --git a/modules/gdnative/pluginscript/pluginscript_language.h b/modules/gdnative/pluginscript/pluginscript_language.h
index 809034744a..dd6758713f 100644
--- a/modules/gdnative/pluginscript/pluginscript_language.h
+++ b/modules/gdnative/pluginscript/pluginscript_language.h
@@ -74,7 +74,7 @@ public:
virtual void get_comment_delimiters(List<String> *p_delimiters) const;
virtual void get_string_delimiters(List<String> *p_delimiters) const;
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
- virtual bool 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 = NULL, List<ScriptLanguage::Warning> *r_warnings = NULL, Set<int> *r_safe_lines = NULL) const;
+ virtual bool 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 = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
virtual bool supports_builtin_mode() const;
diff --git a/modules/gdnative/pluginscript/pluginscript_loader.cpp b/modules/gdnative/pluginscript/pluginscript_loader.cpp
index 46db20b6c2..64582cc517 100644
--- a/modules/gdnative/pluginscript/pluginscript_loader.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_loader.cpp
@@ -39,7 +39,7 @@ ResourceFormatLoaderPluginScript::ResourceFormatLoaderPluginScript(PluginScriptL
_language = language;
}
-RES ResourceFormatLoaderPluginScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress) {
+RES ResourceFormatLoaderPluginScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
if (r_error)
*r_error = ERR_FILE_CANT_OPEN;
@@ -109,5 +109,5 @@ void ResourceFormatSaverPluginScript::get_recognized_extensions(const RES &p_res
bool ResourceFormatSaverPluginScript::recognize(const RES &p_resource) const {
- return Object::cast_to<PluginScript>(*p_resource) != NULL;
+ return Object::cast_to<PluginScript>(*p_resource) != nullptr;
}
diff --git a/modules/gdnative/pluginscript/pluginscript_loader.h b/modules/gdnative/pluginscript/pluginscript_loader.h
index a039072fdc..e47754490a 100644
--- a/modules/gdnative/pluginscript/pluginscript_loader.h
+++ b/modules/gdnative/pluginscript/pluginscript_loader.h
@@ -44,7 +44,7 @@ class ResourceFormatLoaderPluginScript : public ResourceFormatLoader {
public:
ResourceFormatLoaderPluginScript(PluginScriptLanguage *language);
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, bool p_no_cache = false);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;
diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp
index b7cbedc51a..6b303c8716 100644
--- a/modules/gdnative/pluginscript/pluginscript_script.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_script.cpp
@@ -69,7 +69,7 @@ PluginScriptInstance *PluginScript::_create_instance(const Variant **p_args, int
} else {
r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
memdelete(instance);
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
// Construct
@@ -93,7 +93,7 @@ Variant PluginScript::_new(const Variant **p_args, int p_argcount, Callable::Cal
}
REF ref;
- Object *owner = NULL;
+ Object *owner = nullptr;
if (get_instance_base_type() == "") {
owner = memnew(Reference);
@@ -140,6 +140,13 @@ bool PluginScript::can_instance() const {
return can;
}
+bool PluginScript::inherits_script(const Ref<Script> &p_script) const {
+#ifndef _MSC_VER
+#warning inheritance needs to be implemented in PluginScript
+#endif
+ return false;
+}
+
Ref<Script> PluginScript::get_base_script() const {
if (_ref_base_parent.is_valid()) {
return Ref<PluginScript>(_ref_base_parent);
@@ -175,7 +182,7 @@ void PluginScript::update_exports() {
// TODO: rename p_this "p_owner" ?
ScriptInstance *PluginScript::instance_create(Object *p_this) {
- ASSERT_SCRIPT_VALID_V(NULL);
+ ASSERT_SCRIPT_VALID_V(nullptr);
// TODO check script validity ?
if (!_tool && !ScriptServer::is_scripting_enabled()) {
#ifdef TOOLS_ENABLED
@@ -185,7 +192,7 @@ ScriptInstance *PluginScript::instance_create(Object *p_this) {
update_exports();
return si;
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -197,12 +204,12 @@ ScriptInstance *PluginScript::instance_create(Object *p_this) {
// if (EngineDebugger::is_active()) {
// _language->debug_break_parse(get_path(), 0, msg);
// }
- ERR_FAIL_V_MSG(NULL, msg);
+ ERR_FAIL_V_MSG(nullptr, msg);
}
}
Callable::CallError unchecked_error;
- return _create_instance(NULL, 0, p_this, unchecked_error);
+ return _create_instance(nullptr, 0, p_this, unchecked_error);
}
bool PluginScript::instance_has(const Object *p_this) const {
@@ -296,7 +303,7 @@ Error PluginScript::reload(bool p_keep_state) {
_tool = manifest.is_tool;
Dictionary *members = (Dictionary *)&manifest.member_lines;
- for (const Variant *key = members->next(); key != NULL; key = members->next(key)) {
+ for (const Variant *key = members->next(); key != nullptr; key = members->next(key)) {
_member_lines[*key] = (*members)[*key];
}
Array *methods = (Array *)&manifest.methods;
@@ -366,14 +373,14 @@ Error PluginScript::reload(bool p_keep_state) {
void PluginScript::get_script_method_list(List<MethodInfo> *r_methods) const {
ASSERT_SCRIPT_VALID();
- for (Map<StringName, MethodInfo>::Element *e = _methods_info.front(); e != NULL; e = e->next()) {
+ for (Map<StringName, MethodInfo>::Element *e = _methods_info.front(); e != nullptr; e = e->next()) {
r_methods->push_back(e->get());
}
}
void PluginScript::get_script_property_list(List<PropertyInfo> *r_properties) const {
ASSERT_SCRIPT_VALID();
- for (Map<StringName, PropertyInfo>::Element *e = _properties_info.front(); e != NULL; e = e->next()) {
+ for (Map<StringName, PropertyInfo>::Element *e = _properties_info.front(); e != nullptr; e = e->next()) {
r_properties->push_back(e->get());
}
}
@@ -386,7 +393,7 @@ bool PluginScript::has_method(const StringName &p_method) const {
MethodInfo PluginScript::get_method_info(const StringName &p_method) const {
ASSERT_SCRIPT_VALID_V(MethodInfo());
const Map<StringName, MethodInfo>::Element *e = _methods_info.find(p_method);
- if (e != NULL) {
+ if (e != nullptr) {
return e->get();
} else {
return MethodInfo();
@@ -401,7 +408,7 @@ bool PluginScript::has_property(const StringName &p_method) const {
PropertyInfo PluginScript::get_property_info(const StringName &p_property) const {
ASSERT_SCRIPT_VALID_V(PropertyInfo());
const Map<StringName, PropertyInfo>::Element *e = _properties_info.find(p_property);
- if (e != NULL) {
+ if (e != nullptr) {
return e->get();
} else {
return PropertyInfo();
@@ -412,7 +419,7 @@ bool PluginScript::get_property_default_value(const StringName &p_property, Vari
ASSERT_SCRIPT_VALID_V(false);
#ifdef TOOLS_ENABLED
const Map<StringName, Variant>::Element *e = _properties_default_values.find(p_property);
- if (e != NULL) {
+ if (e != nullptr) {
r_value = e->get();
return true;
} else {
@@ -462,7 +469,7 @@ bool PluginScript::has_script_signal(const StringName &p_signal) const {
void PluginScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
ASSERT_SCRIPT_VALID();
- for (Map<StringName, MethodInfo>::Element *e = _signals_info.front(); e != NULL; e = e->next()) {
+ for (Map<StringName, MethodInfo>::Element *e = _signals_info.front(); e != nullptr; e = e->next()) {
r_signals->push_back(e->get());
}
}
@@ -543,9 +550,9 @@ MultiplayerAPI::RPCMode PluginScript::get_rset_mode(const StringName &p_variable
}
PluginScript::PluginScript() :
- _data(NULL),
- _desc(NULL),
- _language(NULL),
+ _data(nullptr),
+ _desc(nullptr),
+ _language(nullptr),
_tool(false),
_valid(false),
_script_list(this) {
diff --git a/modules/gdnative/pluginscript/pluginscript_script.h b/modules/gdnative/pluginscript/pluginscript_script.h
index 5c93ae38f5..70b9ca980b 100644
--- a/modules/gdnative/pluginscript/pluginscript_script.h
+++ b/modules/gdnative/pluginscript/pluginscript_script.h
@@ -72,6 +72,8 @@ private:
protected:
static void _bind_methods();
+ bool inherits_script(const Ref<Script> &p_script) const;
+
PluginScriptInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, Callable::CallError &r_error);
Variant _new(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
diff --git a/modules/gdnative/pluginscript/register_types.h b/modules/gdnative/pluginscript/register_types.h
index a4f7284b54..c6a64b4f40 100644
--- a/modules/gdnative/pluginscript/register_types.h
+++ b/modules/gdnative/pluginscript/register_types.h
@@ -28,5 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef PLUGINSCRIPT_REGISTER_TYPES_H
+#define PLUGINSCRIPT_REGISTER_TYPES_H
+
void register_pluginscript_types();
void unregister_pluginscript_types();
+
+#endif // PLUGINSCRIPT_REGISTER_TYPES_H