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