Method object refactor
This commit is contained in:
parent
714bdaef12
commit
715175085e
25 changed files with 420 additions and 529 deletions
|
|
@ -32,8 +32,6 @@ namespace tp::obj {
|
|||
Map<std::string, const ObjectType*> types;
|
||||
TypeGroups type_groups;
|
||||
Interpreter* interp = nullptr;
|
||||
save_load_callbacks* sl_callbacks[SAVE_LOAD_MAX_CALLBACK_SLOTS]{};
|
||||
alni sl_callbacks_load_idx = 0;
|
||||
|
||||
struct NullObject* nullObject = nullptr;
|
||||
|
||||
|
|
@ -67,8 +65,6 @@ namespace tp::obj {
|
|||
|
||||
static inline void setReferenceCount(Object* in, halni count) { in->references = count; }
|
||||
|
||||
static void add_sl_callbacks(save_load_callbacks*);
|
||||
|
||||
static alni objsize_file(Object* self);
|
||||
static alni objsize_file_recursive(Object* self);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,20 +54,4 @@ namespace tp::obj {
|
|||
void save_string(ArchiverOut& file, const std::string& string);
|
||||
ualni save_string_size(const std::string& string);
|
||||
void load_string(ArchiverIn& file, std::string& out);
|
||||
|
||||
#define SAVE_LOAD_MAX_CALLBACK_SLOTS 100
|
||||
typedef void(pre_save_callback)(void* self, ArchiverOut&);
|
||||
typedef void(pre_load_callback)(void* self, ArchiverIn&);
|
||||
typedef void(post_save_callback)(void* self, ArchiverOut&);
|
||||
typedef void(post_load_callback)(void* self, ArchiverIn&);
|
||||
typedef alni(slcb_size_callback)(void* self, ArchiverOut&);
|
||||
|
||||
struct save_load_callbacks {
|
||||
void* self;
|
||||
pre_save_callback* pre_save;
|
||||
slcb_size_callback* size;
|
||||
pre_load_callback* pre_load;
|
||||
post_save_callback* post_save;
|
||||
post_load_callback* post_load;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "primitives/MethodObject.hpp"
|
||||
#include "List.hpp"
|
||||
|
||||
namespace tp::obj {
|
||||
|
||||
// global singleton API for method object to manage the script
|
||||
struct ScriptSection {
|
||||
|
||||
List<Script*> mScripts;
|
||||
|
||||
Script* createScript();
|
||||
void changeScript(Script** current_script, Script** new_script);
|
||||
void abandonScript(Script* script);
|
||||
|
||||
alni get_script_file_adress(Script* in);
|
||||
Script* get_scritp_from_file_adress(alni file_adress);
|
||||
|
||||
~ScriptSection();
|
||||
|
||||
static void initialize();
|
||||
static void uninitialize();
|
||||
static ScriptSection* globalHandle();
|
||||
|
||||
private:
|
||||
static obj::save_load_callbacks slcb_script_section;
|
||||
|
||||
void delete_script(Script* script);
|
||||
void reference_script(Script* script);
|
||||
|
||||
static void save_script_table_to_file(ScriptSection* self, ArchiverOut& file);
|
||||
static void load_script_table_from_file(ScriptSection* self, ArchiverIn& file);
|
||||
static alni save_script_table_to_file_size(ScriptSection* self, ArchiverOut& file);
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue