RIP tp::Strings
This commit is contained in:
parent
aa53a4addb
commit
893a07e924
90 changed files with 419 additions and 1475 deletions
|
|
@ -9,7 +9,7 @@ namespace obj {
|
|||
|
||||
class ConstObject {
|
||||
public:
|
||||
obj::Object* mObj = NULL;
|
||||
obj::Object* mObj = nullptr;
|
||||
tp::alni mConstIdx = 0;
|
||||
|
||||
ConstObject();
|
||||
|
|
@ -19,8 +19,8 @@ namespace obj {
|
|||
|
||||
class ConstObjectsPool {
|
||||
public:
|
||||
tp::Map<tp::String, ConstObject*> mMethods;
|
||||
tp::Map<tp::String, ConstObject*> mStrings;
|
||||
tp::Map<std::string, ConstObject*> mMethods;
|
||||
tp::Map<std::string, ConstObject*> mStrings;
|
||||
tp::Map<tp::alni, ConstObject*> mIntegers;
|
||||
tp::Map<tp::alnf, ConstObject*> mFloats;
|
||||
ConstObject mBoolTrue;
|
||||
|
|
@ -30,11 +30,11 @@ namespace obj {
|
|||
tp::alni mTotalObjects = 0;
|
||||
|
||||
ConstObject* get(tp::alni val);
|
||||
ConstObject* get(tp::String val);
|
||||
ConstObject* get(const std::string& val);
|
||||
ConstObject* get(tp::alnf val);
|
||||
ConstObject* get(bool val);
|
||||
|
||||
ConstObject* addMethod(tp::String method_id, obj::Object* method);
|
||||
ConstObject* addMethod(const std::string& method_id, obj::Object* method);
|
||||
ConstObject* registerObject(obj::Object* obj);
|
||||
void save(tp::Buffer<ConstData>& out);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Strings.hpp"
|
||||
#include <string>
|
||||
#include "Buffer.hpp"
|
||||
|
||||
#include "interpreter/opcodes.h"
|
||||
|
|
@ -28,7 +28,7 @@ namespace obj::BCgen {
|
|||
explicit Expression(Type type);
|
||||
virtual ~Expression() = default;
|
||||
|
||||
struct ExpressionChild* ExprChild(const tp::String& id);
|
||||
struct ExpressionChild* ExprChild(const std::string& id);
|
||||
struct ExpressionCall* ExprCall(class ExpressionList* args);
|
||||
};
|
||||
|
||||
|
|
@ -39,28 +39,28 @@ namespace obj::BCgen {
|
|||
};
|
||||
|
||||
struct ExpressionNew : public Expression {
|
||||
tp::String mNewType;
|
||||
explicit ExpressionNew(const tp::String& type);
|
||||
std::string mNewType;
|
||||
explicit ExpressionNew(const std::string& type);
|
||||
~ExpressionNew() override;
|
||||
};
|
||||
|
||||
struct ExpressionLocal : public Expression {
|
||||
tp::String mLocalId;
|
||||
explicit ExpressionLocal(const tp::String& id);
|
||||
std::string mLocalId;
|
||||
explicit ExpressionLocal(const std::string& id);
|
||||
~ExpressionLocal() override;
|
||||
};
|
||||
|
||||
struct ExpressionFunc : public Expression {
|
||||
tp::String mFuncId;
|
||||
explicit ExpressionFunc(const tp::String& id);
|
||||
std::string mFuncId;
|
||||
explicit ExpressionFunc(const std::string& id);
|
||||
~ExpressionFunc() override;
|
||||
};
|
||||
|
||||
struct ExpressionChild : public Expression {
|
||||
Expression* mParent = nullptr;
|
||||
tp::String mLocalId;
|
||||
std::string mLocalId;
|
||||
bool mMethod = false;
|
||||
ExpressionChild(Expression* mParent, const tp::String& id);
|
||||
ExpressionChild(Expression* mParent, const std::string& id);
|
||||
~ExpressionChild() override;
|
||||
};
|
||||
|
||||
|
|
@ -102,12 +102,12 @@ namespace obj::BCgen {
|
|||
|
||||
struct ExpressionConst : public Expression {
|
||||
enum ConstType { STR, INT, BOOL, FLT } mConstType;
|
||||
tp::String str;
|
||||
std::string str;
|
||||
tp::alni integer = 0;
|
||||
tp::alnf floating = 0;
|
||||
bool boolean = false;
|
||||
|
||||
explicit ExpressionConst(const tp::String& val);
|
||||
explicit ExpressionConst(const std::string& val);
|
||||
explicit ExpressionConst(const char* val);
|
||||
explicit ExpressionConst(tp::alni val);
|
||||
explicit ExpressionConst(tp::int4 val);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Strings.hpp"
|
||||
#include <string>
|
||||
#include "List.hpp"
|
||||
#include "Map.hpp"
|
||||
|
||||
|
|
@ -16,17 +16,17 @@ namespace obj {
|
|||
|
||||
struct FunctionDefinition {
|
||||
|
||||
FunctionDefinition* mPrnt = NULL;
|
||||
FunctionDefinition* mPrnt = nullptr;
|
||||
|
||||
// signature
|
||||
tp::String mFunctionId;
|
||||
std::string mFunctionId;
|
||||
tp::List<ConstObject*> mArgsOrder;
|
||||
|
||||
ConstObjectsPool mConstants;
|
||||
tp::Map<tp::String, ConstObject*> mLocals;
|
||||
tp::Map<std::string, ConstObject*> mLocals;
|
||||
tp::List<Instruction> mInstructions;
|
||||
|
||||
FunctionDefinition(tp::String function_id, tp::Buffer<tp::String> args, FunctionDefinition* prnt);
|
||||
FunctionDefinition(const std::string& function_id, tp::Buffer<std::string> args, FunctionDefinition* prnt);
|
||||
FunctionDefinition() {}
|
||||
|
||||
void generateByteCode(ByteCode& out);
|
||||
|
|
@ -36,7 +36,7 @@ namespace obj {
|
|||
void EvalExpr(Expression* expr);
|
||||
void EvalStatement(Statement* expr);
|
||||
|
||||
ConstObject* defineLocal(tp::String id);
|
||||
ConstObject* defineLocal(const std::string& id);
|
||||
};
|
||||
|
||||
void init();
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ namespace obj {
|
|||
tp::alni mParam = 0;
|
||||
tp::alni mParamBytes = 1;
|
||||
|
||||
ConstObject* mConstData = NULL;
|
||||
ConstObject* mConstData2 = NULL;
|
||||
ConstObject* mConstData = nullptr;
|
||||
ConstObject* mConstData2 = nullptr;
|
||||
|
||||
tp::alni mInstIdx = 0;
|
||||
Instruction* mInstTarget = NULL;
|
||||
Instruction* mInstTarget = nullptr;
|
||||
|
||||
Instruction();
|
||||
Instruction(ConstObject* constData);
|
||||
|
|
|
|||
|
|
@ -36,21 +36,21 @@ namespace obj::BCgen {
|
|||
};
|
||||
|
||||
struct StatementFuncDef : public Statement {
|
||||
tp::Buffer<tp::String> mArgs;
|
||||
tp::String mFunctionId;
|
||||
tp::Buffer<std::string> mArgs;
|
||||
std::string mFunctionId;
|
||||
StatementScope* mStatements = nullptr;
|
||||
|
||||
explicit StatementFuncDef(const tp::String& function_id);
|
||||
explicit StatementFuncDef(const std::string& function_id);
|
||||
~StatementFuncDef() override;
|
||||
};
|
||||
|
||||
struct StatementLocalDef : public Statement {
|
||||
tp::String mLocalId;
|
||||
std::string mLocalId;
|
||||
Expression* mNewExpr = nullptr;
|
||||
ExpressionConst* mConstExpr = nullptr;
|
||||
bool mIsConstExpr = false;
|
||||
|
||||
StatementLocalDef(const tp::String& id, Expression* value);
|
||||
StatementLocalDef(const std::string& id, Expression* value);
|
||||
~StatementLocalDef() override;
|
||||
};
|
||||
|
||||
|
|
@ -102,10 +102,10 @@ namespace obj::BCgen {
|
|||
};
|
||||
|
||||
struct StatementClassDef : public Statement {
|
||||
tp::String mClassId;
|
||||
std::string mClassId;
|
||||
StatementScope* mScope = nullptr;
|
||||
|
||||
StatementClassDef(const tp::String& class_id, StatementScope* scope);
|
||||
StatementClassDef(const std::string& class_id, StatementScope* scope);
|
||||
~StatementClassDef() override;
|
||||
};
|
||||
}
|
||||
|
|
@ -5,7 +5,6 @@
|
|||
#include "Map.hpp"
|
||||
#include "List.hpp"
|
||||
#include "Buffer.hpp"
|
||||
#include "Strings.hpp"
|
||||
#include "LocalConnection.hpp"
|
||||
|
||||
#include "core/typegroups.h"
|
||||
|
|
@ -14,6 +13,8 @@
|
|||
#include "Archiver.hpp"
|
||||
#include "SizeCounter.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
//#include "interpreter/interpreter.h"
|
||||
|
||||
/* Steps to create custom Object:
|
||||
|
|
@ -38,6 +39,7 @@ implement construct, destruct and copy methods */
|
|||
|
||||
namespace obj {
|
||||
|
||||
|
||||
template<bool tRead>
|
||||
class Archiver : public tp::ArchiverTemplate<tRead> {
|
||||
tp::LocalConnection mConnection;
|
||||
|
|
@ -84,6 +86,10 @@ namespace obj {
|
|||
using ArchiverIn = Archiver<true>;
|
||||
using ArchiverOut = Archiver<false>;
|
||||
|
||||
void save_string(ArchiverOut& file, const std::string& string);
|
||||
tp::ualni save_string_size(const std::string& string);
|
||||
void load_string(ArchiverIn& file, std::string& out);
|
||||
|
||||
extern tp::ModuleManifest gModuleObjects;
|
||||
|
||||
extern struct objects_api* NDO;
|
||||
|
|
@ -101,8 +107,8 @@ namespace obj {
|
|||
|
||||
typedef void (*object_from_int)(Object* self, tp::alni in);
|
||||
typedef void (*object_from_float)(Object* self, tp::alnf in);
|
||||
typedef void (*object_from_string)(Object* self, tp::String in);
|
||||
typedef tp::String(*object_to_string)(Object* self);
|
||||
typedef void (*object_from_string)(Object* self, const std::string& in);
|
||||
typedef std::string(*object_to_string)(Object* self);
|
||||
typedef tp::alni(*object_to_int)(Object* self);
|
||||
typedef tp::alnf(*object_to_float)(Object* self);
|
||||
|
||||
|
|
@ -142,23 +148,23 @@ namespace obj {
|
|||
typedef tp::alni (*object_allocated_size_recursive)(Object*); // default value = object_allocated_size
|
||||
|
||||
struct ObjectType {
|
||||
const ObjectType* base = NULL;
|
||||
object_constructor constructor = NULL;
|
||||
object_destructor destructor = NULL;
|
||||
object_copy copy = NULL;
|
||||
const ObjectType* base = nullptr;
|
||||
object_constructor constructor = nullptr;
|
||||
object_destructor destructor = nullptr;
|
||||
object_copy copy = nullptr;
|
||||
tp::alni size = 0;
|
||||
const char* name;
|
||||
const ObjectTypeConversions* convesions = NULL;
|
||||
const ObjectTypeAriphmetics* ariphmetics = NULL;
|
||||
object_save_size save_size = NULL;
|
||||
object_save save = NULL;
|
||||
object_load load = NULL;
|
||||
object_compare comparison = NULL;
|
||||
void* vtable = NULL;
|
||||
const char* description = NULL;
|
||||
object_debug_all_childs_retrival childs_retrival = NULL;
|
||||
object_allocated_size allocated_size = NULL;
|
||||
object_allocated_size_recursive allocated_size_recursive = NULL;
|
||||
const ObjectTypeConversions* convesions = nullptr;
|
||||
const ObjectTypeAriphmetics* ariphmetics = nullptr;
|
||||
object_save_size save_size = nullptr;
|
||||
object_save save = nullptr;
|
||||
object_load load = nullptr;
|
||||
object_compare comparison = nullptr;
|
||||
void* vtable = nullptr;
|
||||
const char* description = nullptr;
|
||||
object_debug_all_childs_retrival childs_retrival = nullptr;
|
||||
object_allocated_size allocated_size = nullptr;
|
||||
object_allocated_size_recursive allocated_size_recursive = nullptr;
|
||||
TypeMethods type_methods;
|
||||
};
|
||||
|
||||
|
|
@ -182,26 +188,26 @@ namespace obj {
|
|||
|
||||
struct objects_api {
|
||||
|
||||
tp::Map<tp::String, const ObjectType*> types;
|
||||
tp::Map<std::string, const ObjectType*> types;
|
||||
obj::TypeGroups type_groups;
|
||||
Interpreter* interp = NULL;
|
||||
Interpreter* interp = nullptr;
|
||||
|
||||
objects_api();
|
||||
~objects_api();
|
||||
|
||||
void define(ObjectType* type);
|
||||
Object* create(const tp::String& name);
|
||||
Object* create(const std::string& name);
|
||||
Object* copy(Object* self, const Object* in);
|
||||
bool compare(Object* first, Object* second);
|
||||
Object* instatiate(Object*);
|
||||
void set(Object* self, tp::alni val);
|
||||
void set(Object* self, tp::alnf val);
|
||||
void set(Object* self, tp::String val);
|
||||
void set(Object* self, const std::string& val);
|
||||
|
||||
tp::alni toInt(Object* self);
|
||||
tp::alnf toFloat(Object* self);
|
||||
bool toBool(Object* self);
|
||||
tp::String toString(Object* self);
|
||||
std::string toString(Object* self);
|
||||
|
||||
void clear_object_flags();
|
||||
|
||||
|
|
@ -225,8 +231,8 @@ namespace obj {
|
|||
tp::alni objsize_ram_recursive_util(Object* self, const ObjectType* type, bool different_object = true);
|
||||
tp::alni objsize_ram_recursive(Object* self);
|
||||
|
||||
bool save(Object*, tp::String path, bool compressed = true);
|
||||
Object* load(tp::String path);
|
||||
bool save(Object*, const std::string& path, bool compressed = true);
|
||||
Object* load(const std::string& path);
|
||||
tp::alni save(ArchiverOut&, Object*);
|
||||
Object* load(ArchiverIn&, tp::alni file_adress);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "Map.hpp"
|
||||
#include "Strings.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace obj {
|
||||
|
||||
|
|
@ -13,13 +13,13 @@ namespace obj {
|
|||
|
||||
public:
|
||||
|
||||
typedef tp::Map<tp::String, obj::TypeGroups*> Dict;
|
||||
typedef tp::Map<std::string, obj::TypeGroups*> Dict;
|
||||
|
||||
TypeGroups();
|
||||
|
||||
friend struct obj::objects_api;
|
||||
|
||||
TypeGroups(bool is_group);
|
||||
explicit TypeGroups(bool is_group);
|
||||
|
||||
void addType(ObjectType* type, tp::InitialierList<const char*> path, tp::alni cur_arg = 0);
|
||||
void setType(ObjectType* type);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "Buffer.hpp"
|
||||
#include "Strings.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace obj {
|
||||
|
||||
|
|
@ -13,19 +13,19 @@ namespace obj {
|
|||
struct TypeMethod {
|
||||
enum { MAX_ARGS = 8 };
|
||||
struct Arg {
|
||||
const char* descr = NULL;
|
||||
mutable Object* obj = NULL;
|
||||
const char* descr = nullptr;
|
||||
mutable Object* obj = nullptr;
|
||||
};
|
||||
|
||||
const char* nameid = NULL;
|
||||
const char* descr = NULL;
|
||||
const char* nameid = nullptr;
|
||||
const char* descr = nullptr;
|
||||
|
||||
mutable Object* self = NULL;
|
||||
mutable Object* self = nullptr;
|
||||
Arg args[MAX_ARGS];
|
||||
|
||||
tp::int1 mNargs = 0;
|
||||
|
||||
void (*exec)(const TypeMethod* tm) = NULL;
|
||||
void (*exec)(const TypeMethod* tm) = nullptr;
|
||||
|
||||
mutable Arg ret;
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ namespace obj {
|
|||
operator bool() { return key != -1; }
|
||||
};
|
||||
|
||||
static LookupKey presents(const ObjectType*, tp::String);
|
||||
static LookupKey presents(const ObjectType*, const std::string&);
|
||||
static const TypeMethod* getMethod(const ObjectType*, LookupKey);
|
||||
|
||||
void init();
|
||||
|
|
@ -56,7 +56,7 @@ namespace obj {
|
|||
tp::halni nMethods() const;
|
||||
|
||||
private:
|
||||
tp::int2 presents(tp::String) const;
|
||||
tp::int2 presents(const std::string&) const;
|
||||
const TypeMethod* getMethod(tp::int2) const;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include "primitives/stringobject.h"
|
||||
|
||||
#include "Buffer.hpp"
|
||||
#include "Strings.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace obj {
|
||||
|
||||
|
|
|
|||
|
|
@ -17,15 +17,15 @@ namespace obj {
|
|||
|
||||
struct CallFrame {
|
||||
enum { CALL_DEPTH = 1024 };
|
||||
obj::Object* mSelf = NULL;
|
||||
obj::MethodObject* mMethod = NULL;
|
||||
obj::Object* mSelf = nullptr;
|
||||
obj::MethodObject* mMethod = nullptr;
|
||||
tp::ualni mIp = 0;
|
||||
};
|
||||
|
||||
void enter(const CallFrame& frame);
|
||||
void leave();
|
||||
ByteCode* getBytecode();
|
||||
tp::halni len() const;
|
||||
[[nodiscard]] tp::halni len() const;
|
||||
|
||||
tp::ConstSizeBuffer<CallFrame, CallFrame::CALL_DEPTH> mStack;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@ namespace obj {
|
|||
ScopeStack mScopeStack;
|
||||
CallStack mCallStack;
|
||||
|
||||
obj::Object* mLastParent = NULL;
|
||||
obj::Object* mLastParent = nullptr;
|
||||
bool mIsTypeMethod = false;
|
||||
const TypeMethod* mTypeMethod = NULL;
|
||||
const TypeMethod* mTypeMethod = nullptr;
|
||||
|
||||
typedef struct { obj::Object* obj; tp::String id; } GlobalDef;
|
||||
typedef struct { obj::Object* obj; std::string id; } GlobalDef;
|
||||
|
||||
void exec(obj::MethodObject* method, obj::ClassObject* self = NULL, obj::DictObject* globals = NULL, tp::InitialierList<GlobalDef> globals2 = {});
|
||||
void exec(obj::MethodObject* method, obj::ClassObject* self = nullptr, obj::DictObject* globals = nullptr, tp::InitialierList<GlobalDef> globals2 = {});
|
||||
|
||||
void stepBytecode();
|
||||
void stepBytecodeIn();
|
||||
|
|
@ -24,6 +24,6 @@ namespace obj {
|
|||
|
||||
bool finished();
|
||||
|
||||
void execAll(obj::MethodObject* method, obj::ClassObject* self = NULL, obj::DictObject* globals = NULL, tp::InitialierList<GlobalDef> globals2 = {});
|
||||
void execAll(obj::MethodObject* method, obj::ClassObject* self = nullptr, obj::DictObject* globals = nullptr, tp::InitialierList<GlobalDef> globals2 = {});
|
||||
};
|
||||
};
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
namespace obj {
|
||||
|
||||
struct Scope {
|
||||
typedef tp::Map<tp::String, obj::Object*> ObjDict;
|
||||
typedef tp::Map<std::string, obj::Object*> ObjDict;
|
||||
typedef tp::List<obj::Object*> ObjList;
|
||||
|
||||
ObjDict mLocals;
|
||||
|
|
@ -31,16 +31,16 @@ namespace obj {
|
|||
ScopeStack();
|
||||
void enterScope(bool aChildReachable);
|
||||
void leaveScope();
|
||||
void addLocal(obj::Object* local, tp::String id);
|
||||
void addLocal(obj::Object* local, const std::string& id);
|
||||
void addTemp(obj::Object* tmp);
|
||||
void popTemp();
|
||||
void addTempReturn(obj::Object* ret);
|
||||
obj::Object* getLocal(tp::String& str);
|
||||
obj::Object* getLocal(const std::string& str);
|
||||
Scope* getCurrentScope();
|
||||
~ScopeStack();
|
||||
|
||||
private:
|
||||
obj::Object* getLocalUtil(Scope& scope, tp::String* id);
|
||||
obj::Object* getLocalUtil(Scope& scope, const std::string& id);
|
||||
};
|
||||
|
||||
};
|
||||
|
|
@ -12,11 +12,11 @@ namespace obj {
|
|||
struct Result {
|
||||
obj::BCgen::StatementScope* scope = nullptr;
|
||||
bool isError = false;
|
||||
tp::String description;
|
||||
std::string description;
|
||||
tp::halni line = 0;
|
||||
tp::halni column = 0;
|
||||
};
|
||||
|
||||
Result parse(const tp::String& stream);
|
||||
Result parse(const std::string& stream);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ namespace obj {
|
|||
|
||||
static void from_int(BoolObject* self, tp::alni in);
|
||||
static void from_float(BoolObject* self, tp::alnf in);
|
||||
static void from_string(BoolObject* self, tp::String in);
|
||||
static tp::String to_string(BoolObject* self);
|
||||
static void from_string(BoolObject* self, const std::string& in);
|
||||
static std::string to_string(BoolObject* self);
|
||||
static tp::alni to_int(BoolObject* self);
|
||||
static tp::alnf to_float(BoolObject* self);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ namespace obj {
|
|||
|
||||
DictObject* members;
|
||||
|
||||
void addMember(Object* obj, tp::String id);
|
||||
void createMember(tp::String type, tp::String id);
|
||||
void addMember(Object* obj, const std::string& id);
|
||||
void createMember(const std::string& type, const std::string& id);
|
||||
|
||||
template<typename Type>
|
||||
Type* createMember(tp::String id) {
|
||||
Type* createMember(const std::string& id) {
|
||||
auto out = NDO->create(Type::TypeData.name);
|
||||
addMember(out, id);
|
||||
NDO->destroy(out);
|
||||
|
|
@ -28,7 +28,7 @@ namespace obj {
|
|||
}
|
||||
|
||||
template<typename Type>
|
||||
Type* getMember(const tp::String& id) {
|
||||
Type* getMember(const std::string& id) {
|
||||
auto idx = members->presents(id);
|
||||
if (bool(idx)) {
|
||||
return ((Type*)obj::ndo_cast(members->getSlotVal(idx), &Type::TypeData));
|
||||
|
|
@ -37,7 +37,7 @@ namespace obj {
|
|||
}
|
||||
|
||||
template<typename Type>
|
||||
Type* getMemberAssert(const tp::String& id) {
|
||||
Type* getMemberAssert(const std::string& id) {
|
||||
auto out = getMember<Type>(id);
|
||||
assert(out && "invalid member access");
|
||||
return out;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace obj {
|
|||
|
||||
static void from_int(ColorObject* self, tp::alni in);
|
||||
static void from_float(ColorObject* self, tp::alnf in);
|
||||
static tp::String to_string(ColorObject* self);
|
||||
static std::string to_string(ColorObject* self);
|
||||
|
||||
static ColorObject* create(tp::RGBA in);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,15 +17,15 @@ namespace obj {
|
|||
static tp::alni allocated_size(DictObject* self);
|
||||
static tp::alni allocated_size_recursive(DictObject* self);
|
||||
|
||||
void put(tp::String, Object*);
|
||||
void remove(tp::String);
|
||||
Object* get(tp::String);
|
||||
tp::Map<tp::String, Object*>::Idx presents(tp::String);
|
||||
Object* getSlotVal(tp::Map<tp::String, Object*>::Idx);
|
||||
void put(const std::string&, Object*);
|
||||
void remove(const std::string&);
|
||||
Object* get(const std::string&);
|
||||
tp::Map<std::string, Object*>::Idx presents(const std::string&);
|
||||
Object* getSlotVal(tp::Map<std::string, Object*>::Idx);
|
||||
|
||||
const tp::Map<tp::String, Object*>& getItems() const;
|
||||
[[nodiscard]] const tp::Map<std::string, Object*>& getItems() const;
|
||||
|
||||
private:
|
||||
tp::Map<tp::String, Object*> items;
|
||||
tp::Map<std::string, Object*> items;
|
||||
};
|
||||
};
|
||||
|
|
@ -23,8 +23,8 @@ namespace obj {
|
|||
|
||||
static void from_int(EnumObject* self, tp::alni in);
|
||||
static void from_float(EnumObject* self, tp::alnf in);
|
||||
static void from_string(EnumObject* self, tp::String in);
|
||||
static tp::String to_string(EnumObject* self);
|
||||
static void from_string(EnumObject* self, const std::string& in);
|
||||
static std::string to_string(EnumObject* self);
|
||||
static tp::alni to_int(EnumObject* self);
|
||||
static tp::alnf to_float(EnumObject* self);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ namespace obj {
|
|||
|
||||
static void from_int(FloatObject* self, tp::alni in);
|
||||
static void from_float(FloatObject* self, tp::alnf in);
|
||||
static void from_string(FloatObject* self, tp::String in);
|
||||
static tp::String to_string(FloatObject* self);
|
||||
static void from_string(FloatObject* self, const std::string& in);
|
||||
static std::string to_string(FloatObject* self);
|
||||
static tp::alni to_int(FloatObject* self);
|
||||
static tp::alnf to_float(FloatObject* self);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace obj {
|
|||
static void constructor(InterpreterObject* self);
|
||||
static void load(ArchiverIn& file_self, InterpreterObject* self);
|
||||
|
||||
void exec(obj::ClassObject* self = NULL, tp::InitialierList<Interpreter::GlobalDef> globals = {});
|
||||
void exec(obj::ClassObject* self = nullptr, tp::InitialierList<Interpreter::GlobalDef> globals = {});
|
||||
void debug();
|
||||
bool running();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ namespace obj {
|
|||
|
||||
static void from_int(Object* self, tp::alni in);
|
||||
static void from_float(Object* self, tp::alnf in);
|
||||
static void from_string(Object* self, tp::String in);
|
||||
static tp::String to_string(Object* self);
|
||||
static void from_string(Object* self, const std::string& in);
|
||||
static std::string to_string(Object* self);
|
||||
static tp::alni to_int(Object* self);
|
||||
static tp::alnf to_float(Object* self);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace obj {
|
|||
static void save(ListObject* self, ArchiverOut& file_self);
|
||||
static tp::alni save_size(ListObject* self);
|
||||
|
||||
const tp::List<Object*>& getItems() const;
|
||||
[[nodiscard]] const tp::List<Object*>& getItems() const;
|
||||
|
||||
void pushBack(Object* obj);
|
||||
void pushFront(Object* obj);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,6 @@ namespace obj {
|
|||
|
||||
void compile();
|
||||
|
||||
static MethodObject* create(tp::String script);
|
||||
static MethodObject* create(const std::string& script);
|
||||
};
|
||||
};
|
||||
|
|
@ -6,18 +6,18 @@
|
|||
namespace obj {
|
||||
|
||||
struct StringObject : Object {
|
||||
tp::String val;
|
||||
std::string val;
|
||||
|
||||
static ObjectType TypeData;
|
||||
static void constructor(Object* self);
|
||||
static void destructor(StringObject* self);
|
||||
static void copy(Object* self, const Object* in);
|
||||
static StringObject* create(tp::String in);
|
||||
static StringObject* create(const std::string& in);
|
||||
|
||||
static void from_int(StringObject* self, tp::alni in);
|
||||
static void from_float(StringObject* self, tp::alnf in);
|
||||
static void from_string(StringObject* self, tp::String in);
|
||||
static tp::String to_string(StringObject* self);
|
||||
static void from_string(StringObject* self, const std::string& in);
|
||||
static std::string to_string(StringObject* self);
|
||||
static tp::alni to_int(StringObject* self);
|
||||
static tp::alnf to_float(StringObject* self);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue