Differences From
Artifact [c0eeb85e80]:
172 172 };
173 173 impl _set_path(string path, bool takeOver) {
174 174 if (takeOver) {
175 175 _t(string).dtor(&me -> path);
176 176 me -> path = path;
177 177 } else {
178 178 _t(string).dtor(&me -> path);
179 - _t(string).copy(&me -> path, (void const*[]) {&path});
179 + /* _t(string).copy(&me -> path, (void const*[]) {&path}); */
180 + me -> path = gdu_string_dup(&path);
180 181 }
181 182 };
182 183 impl _get_base_script() -> ref Script {
183 184 return nullptr;
184 185 };
185 186 impl _has_static_method(string-name method) -> bool {
186 187 return false;
187 188 };
188 189 impl _is_tool() -> bool { return false; }; (* FIXME *)
190 + impl _get_global_name(string-name id) -> string-name {
191 + return gdu_sym_null();
192 + };
193 + impl _is_abstract() -> bool {
194 + return false; (* TODO abuse for non-class scripts? *)
195 + };
196 + impl _get_instance_base_type() -> string-name {
197 + return _gdu_intern("Object");
198 + };
199 + impl _is_valid() -> bool {
200 + return true;
201 + };
202 + impl _get_documentation() -> array[dictionary] {
203 + gd_array dox;
204 + _t(array).empty(&dox, nullptr);
205 + auto empty = gdu_sym_null();
206 + _t(array).setTyped(&dox,
207 + GDEXTENSION_VARIANT_TYPE_DICTIONARY, &empty, &empty);
208 + _t(stringName).dtor(&empty);
209 + return dox;
210 + };
189 211 };
190 212
191 213 class JanetScriptText extends JanetScript {
192 214 var as string: src;
193 215 new {
194 216 _t(string).empty(&me -> src, nullptr);
195 217 };
196 218 del {
197 219 _t(string).dtor(&me -> src);
198 220 };
199 221
200 - impl _get_instance_base_type() -> string-name {
201 - return _gdu_intern("ScriptExtension");
202 - };
203 222 impl _has_source_code() -> bool { return true; };
204 223 impl _get_source_code() -> string {
205 224 auto d = gdu_string_dup(&me -> src);
206 225 return d;
207 226 };
208 227 impl _set_source_code(string s) {
209 228 _t(string).dtor(&me -> src);
210 229 _t(string).copy(&me -> src, (void const*[]) {&s});
211 230 };
231 + impl _reload(bool keepState) -> int (* Error *) {
232 + (* TODO *)
233 + return gd_Error_ok;
234 + };
235 +};
236 +
237 +import {
238 + typedef struct gdjn_janet_image {
239 + size_t sz;
240 + uint8_t* buf;
241 + } gdjn_janet_image;
212 242 };
213 243
214 244 class JanetScriptImage extends JanetScript {
215 245 impl _has_source_code() -> bool { return false; };
216 - var struct gdjn_class_JanetScript_image {
217 - size_t sz;
218 - uint8_t* buf;
219 - }: image;
220 - impl _get_instance_base_type() -> string-name {
221 - return _gdu_intern("ScriptExtension");
246 + var gdjn_janet_image: image;
247 + new {
248 + me -> image = (gdjn_janet_image) {};
249 + };
250 + del {
251 + if (me -> image.buf != nullptr) _free(me -> image.buf);
252 + };
253 + impl _reload(bool keepState) -> int (* Error *) {
254 + (* TODO *)
255 + return gd_Error_ok;
222 256 };
223 257 };