2017-10-08 23:47:38 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* pluginscript_language.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2018-01-05 00:50:27 +01:00
|
|
|
/* https://godotengine.org */
|
2017-10-08 23:47:38 +02:00
|
|
|
/*************************************************************************/
|
2021-01-01 20:13:46 +01:00
|
|
|
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
2017-10-08 23:47:38 +02:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef PLUGINSCRIPT_LANGUAGE_H
|
|
|
|
#define PLUGINSCRIPT_LANGUAGE_H
|
|
|
|
|
|
|
|
// Godot imports
|
|
|
|
#include "core/io/resource_loader.h"
|
|
|
|
#include "core/io/resource_saver.h"
|
|
|
|
#include "core/map.h"
|
|
|
|
#include "core/script_language.h"
|
|
|
|
#include "core/self_list.h"
|
|
|
|
// PluginScript imports
|
|
|
|
#include "pluginscript_loader.h"
|
|
|
|
#include <pluginscript/godot_pluginscript.h>
|
|
|
|
|
|
|
|
class PluginScript;
|
|
|
|
class PluginScriptInstance;
|
|
|
|
|
|
|
|
class PluginScriptLanguage : public ScriptLanguage {
|
|
|
|
friend class PluginScript;
|
|
|
|
friend class PluginScriptInstance;
|
|
|
|
|
2018-06-11 02:59:53 +02:00
|
|
|
Ref<ResourceFormatLoaderPluginScript> _resource_loader;
|
|
|
|
Ref<ResourceFormatSaverPluginScript> _resource_saver;
|
2017-10-08 23:47:38 +02:00
|
|
|
const godot_pluginscript_language_desc _desc;
|
|
|
|
godot_pluginscript_language_data *_data;
|
|
|
|
|
2021-01-27 10:43:02 +01:00
|
|
|
Mutex _lock;
|
2017-10-08 23:47:38 +02:00
|
|
|
SelfList<PluginScript>::List _script_list;
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual String get_name() const;
|
|
|
|
|
2018-06-11 02:59:53 +02:00
|
|
|
_FORCE_INLINE_ Ref<ResourceFormatLoaderPluginScript> get_resource_loader() { return _resource_loader; }
|
|
|
|
_FORCE_INLINE_ Ref<ResourceFormatSaverPluginScript> get_resource_saver() { return _resource_saver; }
|
2017-10-08 23:47:38 +02:00
|
|
|
|
|
|
|
/* LANGUAGE FUNCTIONS */
|
|
|
|
virtual void init();
|
|
|
|
virtual String get_type() const;
|
|
|
|
virtual String get_extension() const;
|
|
|
|
virtual Error execute_file(const String &p_path);
|
|
|
|
virtual void finish();
|
|
|
|
|
|
|
|
/* EDITOR FUNCTIONS */
|
|
|
|
virtual void get_reserved_words(List<String> *p_words) const;
|
2019-11-12 17:08:07 +01:00
|
|
|
virtual bool is_control_flow_keyword(String p_keyword) const;
|
2017-10-08 23:47:38 +02:00
|
|
|
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;
|
2021-05-04 16:00:45 +02:00
|
|
|
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;
|
2017-10-08 23:47:38 +02:00
|
|
|
virtual Script *create_script() const;
|
|
|
|
virtual bool has_named_classes() const;
|
2017-10-24 01:54:47 +02:00
|
|
|
virtual bool supports_builtin_mode() const;
|
2017-10-08 23:47:38 +02:00
|
|
|
virtual bool can_inherit_from_file() { return true; }
|
|
|
|
virtual int find_function(const String &p_function, const String &p_code) const;
|
|
|
|
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
|
2019-06-13 11:17:20 +02:00
|
|
|
virtual Error complete_code(const String &p_code, const String &p_path, Object *p_owner, List<ScriptCodeCompletionOption> *r_options, bool &r_force, String &r_call_hint);
|
2017-10-08 23:47:38 +02:00
|
|
|
virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const;
|
|
|
|
virtual void add_global_constant(const StringName &p_variable, const Variant &p_value);
|
|
|
|
|
|
|
|
/* MULTITHREAD FUNCTIONS */
|
|
|
|
|
|
|
|
//some VMs need to be notified of thread creation/exiting to allocate a stack
|
|
|
|
// void thread_enter() {}
|
|
|
|
// void thread_exit() {}
|
|
|
|
|
|
|
|
/* DEBUGGER FUNCTIONS */
|
|
|
|
|
|
|
|
virtual String debug_get_error() const;
|
|
|
|
virtual int debug_get_stack_level_count() const;
|
|
|
|
virtual int debug_get_stack_level_line(int p_level) const;
|
|
|
|
virtual String debug_get_stack_level_function(int p_level) const;
|
|
|
|
virtual String debug_get_stack_level_source(int p_level) const;
|
|
|
|
virtual void debug_get_stack_level_locals(int p_level, List<String> *p_locals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1);
|
|
|
|
virtual void debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1);
|
|
|
|
virtual void debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1);
|
|
|
|
virtual String debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems = -1, int p_max_depth = -1);
|
|
|
|
|
|
|
|
// virtual Vector<StackInfo> debug_get_current_stack_info() { return Vector<StackInfo>(); }
|
|
|
|
|
|
|
|
virtual void reload_all_scripts();
|
|
|
|
virtual void reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload);
|
|
|
|
|
|
|
|
/* LOADER FUNCTIONS */
|
|
|
|
|
|
|
|
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
|
|
|
virtual void get_public_functions(List<MethodInfo> *p_functions) const;
|
2021-05-04 14:20:36 +02:00
|
|
|
virtual void get_public_constants(List<Pair<String, Variant>> *p_constants) const;
|
2017-10-08 23:47:38 +02:00
|
|
|
|
|
|
|
virtual void profiling_start();
|
|
|
|
virtual void profiling_stop();
|
|
|
|
|
|
|
|
virtual int profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max);
|
|
|
|
virtual int profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max);
|
|
|
|
|
|
|
|
virtual void frame();
|
|
|
|
|
|
|
|
void lock();
|
|
|
|
void unlock();
|
|
|
|
|
|
|
|
PluginScriptLanguage(const godot_pluginscript_language_desc *desc);
|
2021-01-27 10:43:02 +01:00
|
|
|
virtual ~PluginScriptLanguage() {}
|
2017-10-08 23:47:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PLUGINSCRIPT_LANGUAGE_H
|