1 module godot.c.pluginscript; 2 3 import godot.c.core, godot.c.nativescript; 4 5 @nogc nothrow: 6 extern(C): 7 8 struct godot_pluginscript_instance_data {}; 9 struct godot_pluginscript_script_data {}; 10 struct godot_pluginscript_language_data {}; 11 12 struct godot_pluginscript_instance_desc 13 { 14 godot_pluginscript_instance_data *function(godot_pluginscript_script_data *p_data, godot_object p_owner) init; 15 void function(godot_pluginscript_instance_data *p_data) finish; 16 17 godot_bool function(godot_pluginscript_instance_data *p_data, const godot_string *p_name, const godot_variant *p_value) set_prop; 18 godot_bool function(godot_pluginscript_instance_data *p_data, const godot_string *p_name, godot_variant *r_ret) get_prop; 19 20 godot_variant function(godot_pluginscript_instance_data *p_data, 21 const godot_string_name *p_method, const godot_variant **p_args, 22 int p_argcount, godot_variant_call_error *r_error) call_method; 23 24 void function(godot_pluginscript_instance_data *p_data, int p_notification) notification; 25 // TODO: could this rpc mode stuff be moved to the godot_pluginscript_script_manifest ? 26 godot_method_rpc_mode function(godot_pluginscript_instance_data *p_data, const godot_string *p_method) get_rpc_mode; 27 godot_method_rpc_mode function(godot_pluginscript_instance_data *p_data, const godot_string *p_variable) get_rset_mode; 28 29 //this is used by script languages that keep a reference counter of their own 30 //you can make make Ref<> not die when it reaches zero, so deleting the reference 31 //depends entirely from the script. 32 // Note: You can set thoses function pointer to NULL if not needed. 33 void function(godot_pluginscript_instance_data *p_data) refcount_incremented; 34 bool function(godot_pluginscript_instance_data *p_data) refcount_decremented; // return true if it can die 35 } 36 37 struct godot_pluginscript_script_manifest 38 { 39 godot_pluginscript_script_data *data; 40 godot_string_name name; 41 godot_bool is_tool; 42 godot_string_name base; 43 44 // Member lines format: {<string>: <int>} 45 godot_dictionary member_lines; 46 // Method info dictionary format 47 // { 48 // name: <string> 49 // args: [<dict:property>] 50 // default_args: [<variant>] 51 // return: <dict:property> 52 // flags: <int> 53 // rpc_mode: <int:godot_method_rpc_mode> 54 // } 55 godot_array methods; 56 // Same format than for methods 57 godot_array signals; 58 // Property info dictionary format 59 // { 60 // name: <string> 61 // type: <int:godot_variant_type> 62 // hint: <int:godot_property_hint> 63 // hint_string: <string> 64 // usage: <int:godot_property_usage_flags> 65 // default_value: <variant> 66 // rset_mode: <int:godot_method_rpc_mode> 67 // } 68 godot_array properties; 69 } 70 71 struct godot_pluginscript_script_desc 72 { 73 godot_pluginscript_script_manifest function(godot_pluginscript_language_data *p_data, const godot_string *p_path, const godot_string *p_source, godot_error *r_error) initialize; 74 void function(godot_pluginscript_script_data *p_data) finish; 75 godot_pluginscript_instance_desc instance_desc; 76 } 77 78 // --- Language --- 79 80 struct godot_pluginscript_profiling_data 81 { 82 godot_string_name signature; 83 godot_int call_count; 84 godot_int total_time; // In microseconds 85 godot_int self_time; // In microseconds 86 } 87 88 struct godot_pluginscript_language_desc 89 { 90 const char *name; 91 const char *type; 92 const char *extension; 93 const char **recognized_extensions; // NULL terminated array 94 godot_pluginscript_language_data *function() initialize; 95 void function(godot_pluginscript_language_data *p_data) finish; 96 const char **reserved_words; // NULL terminated array 97 const char **comment_delimiters; // NULL terminated array 98 const char **string_delimiters; // NULL terminated array 99 godot_bool has_named_classes; 100 godot_bool supports_builtin_mode; 101 102 godot_string function(godot_pluginscript_language_data *p_data, const godot_string *p_class_name, const godot_string *p_base_class_name) get_template_source_code; 103 godot_bool function(godot_pluginscript_language_data *p_data, const godot_string *p_script, int *r_line_error, int *r_col_error, godot_string *r_test_error, const godot_string *p_path, godot_pool_string_array *r_functions) validate; 104 int function(godot_pluginscript_language_data *p_data, const godot_string *p_function, const godot_string *p_code) find_function; // Can be NULL 105 godot_string function(godot_pluginscript_language_data *p_data, const godot_string *p_class, const godot_string *p_name, const godot_pool_string_array *p_args) make_function; 106 godot_error function(godot_pluginscript_language_data *p_data, const godot_string *p_code, const godot_string *p_base_path, godot_object p_owner, godot_array *r_options, godot_bool *r_force, godot_string *r_call_hint) complete_code; 107 void function(godot_pluginscript_language_data *p_data, godot_string *p_code, int p_from_line, int p_to_line) auto_indent_code; 108 109 void function(godot_pluginscript_language_data *p_data, const godot_string *p_variable, const godot_variant *p_value) add_global_constant; 110 godot_string function(godot_pluginscript_language_data *p_data) debug_get_error; 111 int function(godot_pluginscript_language_data *p_data) debug_get_stack_level_count; 112 int function(godot_pluginscript_language_data *p_data, int p_level) debug_get_stack_level_line; 113 godot_string function(godot_pluginscript_language_data *p_data, int p_level) debug_get_stack_level_function; 114 godot_string function(godot_pluginscript_language_data *p_data, int p_level) debug_get_stack_level_source; 115 void function(godot_pluginscript_language_data *p_data, int p_level, godot_pool_string_array *p_locals, godot_array *p_values, int p_max_subitems, int p_max_depth) debug_get_stack_level_locals; 116 void function(godot_pluginscript_language_data *p_data, int p_level, godot_pool_string_array *p_members, godot_array *p_values, int p_max_subitems, int p_max_depth) debug_get_stack_level_members; 117 void function(godot_pluginscript_language_data *p_data, godot_pool_string_array *p_locals, godot_array *p_values, int p_max_subitems, int p_max_depth) debug_get_globals; 118 godot_string function(godot_pluginscript_language_data *p_data, int p_level, const godot_string *p_expression, int p_max_subitems, int p_max_depth) debug_parse_stack_level_expression; 119 120 // TODO: could this stuff be moved to the godot_pluginscript_language_desc ? 121 void function(godot_pluginscript_language_data *p_data, godot_array *r_functions) get_public_functions; 122 void function(godot_pluginscript_language_data *p_data, godot_dictionary *r_constants) get_public_constants; 123 124 void function(godot_pluginscript_language_data *p_data) profiling_start; 125 void function(godot_pluginscript_language_data *p_data) profiling_stop; 126 int function(godot_pluginscript_language_data *p_data, godot_pluginscript_profiling_data *r_info, int p_info_max) profiling_get_accumulated_data; 127 int function(godot_pluginscript_language_data *p_data, godot_pluginscript_profiling_data *r_info, int p_info_max) profiling_get_frame_data; 128 void function(godot_pluginscript_language_data *p_data) profiling_frame; 129 130 godot_pluginscript_script_desc script_desc; 131 } 132 133