From e715be0f0a307e36cd34dbee6ba3dfe83b72fead Mon Sep 17 00:00:00 2001 From: Emmanuel Leblond Date: Sun, 8 Oct 2017 23:47:38 +0200 Subject: [GDnative] add pluginscript \o/ --- modules/gdnative/pluginscript/SCsub | 9 + .../pluginscript/pluginscript_instance.cpp | 181 ++++++++ .../gdnative/pluginscript/pluginscript_instance.h | 90 ++++ .../pluginscript/pluginscript_language.cpp | 432 ++++++++++++++++++++ .../gdnative/pluginscript/pluginscript_language.h | 131 ++++++ .../gdnative/pluginscript/pluginscript_loader.cpp | 113 +++++ .../gdnative/pluginscript/pluginscript_loader.h | 62 +++ .../gdnative/pluginscript/pluginscript_script.cpp | 454 +++++++++++++++++++++ .../gdnative/pluginscript/pluginscript_script.h | 130 ++++++ modules/gdnative/pluginscript/register_types.cpp | 118 ++++++ modules/gdnative/pluginscript/register_types.h | 31 ++ 11 files changed, 1751 insertions(+) create mode 100644 modules/gdnative/pluginscript/SCsub create mode 100644 modules/gdnative/pluginscript/pluginscript_instance.cpp create mode 100644 modules/gdnative/pluginscript/pluginscript_instance.h create mode 100644 modules/gdnative/pluginscript/pluginscript_language.cpp create mode 100644 modules/gdnative/pluginscript/pluginscript_language.h create mode 100644 modules/gdnative/pluginscript/pluginscript_loader.cpp create mode 100644 modules/gdnative/pluginscript/pluginscript_loader.h create mode 100644 modules/gdnative/pluginscript/pluginscript_script.cpp create mode 100644 modules/gdnative/pluginscript/pluginscript_script.h create mode 100644 modules/gdnative/pluginscript/register_types.cpp create mode 100644 modules/gdnative/pluginscript/register_types.h (limited to 'modules/gdnative/pluginscript') diff --git a/modules/gdnative/pluginscript/SCsub b/modules/gdnative/pluginscript/SCsub new file mode 100644 index 0000000000..2031a4236b --- /dev/null +++ b/modules/gdnative/pluginscript/SCsub @@ -0,0 +1,9 @@ +#!/usr/bin/env python + +Import('env') +Import('env_modules') + +env_pluginscript = env_modules.Clone() + +env_pluginscript.Append(CPPPATH=['#modules/gdnative/include/']) +env_pluginscript.add_source_files(env.modules_sources, '*.cpp') diff --git a/modules/gdnative/pluginscript/pluginscript_instance.cpp b/modules/gdnative/pluginscript/pluginscript_instance.cpp new file mode 100644 index 0000000000..8f01350826 --- /dev/null +++ b/modules/gdnative/pluginscript/pluginscript_instance.cpp @@ -0,0 +1,181 @@ +/*************************************************************************/ +/* pluginscript_instance.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* 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. */ +/*************************************************************************/ + +// Godot imports +#include "core/os/os.h" +#include "core/variant.h" +// PluginScript imports +#include "pluginscript_instance.h" +#include "pluginscript_language.h" +#include "pluginscript_script.h" + +bool PluginScriptInstance::set(const StringName &p_name, const Variant &p_value) { + String name = String(p_name); + return _desc->set_prop(_data, (const godot_string *)&name, (const godot_variant *)&p_value); +} + +bool PluginScriptInstance::get(const StringName &p_name, Variant &r_ret) const { + String name = String(p_name); + return _desc->get_prop(_data, (const godot_string *)&name, (godot_variant *)&r_ret); +} + +Ref