From ca1ae75b078be7de5ca3f57dd864ae1ac86b5e98 Mon Sep 17 00:00:00 2001 From: IlyaShurupov Date: Mon, 25 Mar 2024 09:23:25 +0300 Subject: [PATCH] fix typos --- Objects/private/core/Object.cpp | 28 ++++++++++----------- Objects/private/core/TypeMethods.cpp | 4 +-- Objects/private/interpreter/Interpreter.cpp | 18 ++++++------- Objects/private/primitives/BoolObject.cpp | 2 +- Objects/private/primitives/ColorObject.cpp | 6 ++--- Objects/private/primitives/EnumObject.cpp | 6 +++-- Objects/private/primitives/FloatObject.cpp | 6 ++--- Objects/private/primitives/IntObject.cpp | 6 ++--- Objects/private/primitives/LinkObject.cpp | 2 +- Objects/private/primitives/ListObject.cpp | 4 +-- Objects/private/primitives/MethodObject.cpp | 10 +++++--- Objects/private/primitives/NullObject.cpp | 6 +++-- Objects/private/primitives/Stringobject.cpp | 2 +- Objects/private/primitives/TypeObject.cpp | 2 +- Objects/public/core/Object.hpp | 8 +++--- Objects/public/primitives/ColorObject.hpp | 2 +- Objects/public/primitives/FloatObject.hpp | 3 +-- Objects/public/primitives/IntObject.hpp | 2 +- 18 files changed, 62 insertions(+), 55 deletions(-) diff --git a/Objects/private/core/Object.cpp b/Objects/private/core/Object.cpp index f683f62..010d5ab 100644 --- a/Objects/private/core/Object.cpp +++ b/Objects/private/core/Object.cpp @@ -114,46 +114,46 @@ Object* objects_api::instantiate(Object* in) { } void objects_api::set(Object* self, alni val) { - if (self->type->convesions && self->type->convesions->from_int) { - self->type->convesions->from_int(self, val); + if (self->type->conversions && self->type->conversions->from_int) { + self->type->conversions->from_int(self, val); return; } } void objects_api::set(Object* self, alnf val) { - if (self->type->convesions && self->type->convesions->from_float) { - self->type->convesions->from_float(self, val); + if (self->type->conversions && self->type->conversions->from_float) { + self->type->conversions->from_float(self, val); return; } } void objects_api::set(Object* self, const std::string& val) { - if (self->type->convesions && self->type->convesions->from_string) { - self->type->convesions->from_string(self, val); + if (self->type->conversions && self->type->conversions->from_string) { + self->type->conversions->from_string(self, val); return; } } alni objects_api::toInt(Object* self) { - DEBUG_ASSERT(self->type->convesions && self->type->convesions->to_int) - return self->type->convesions->to_int(self); + DEBUG_ASSERT(self->type->conversions && self->type->conversions->to_int) + return self->type->conversions->to_int(self); } alnf objects_api::toFloat(Object* self) { - DEBUG_ASSERT(self->type->convesions && self->type->convesions->to_float) - return self->type->convesions->to_float(self); + DEBUG_ASSERT(self->type->conversions && self->type->conversions->to_float) + return self->type->conversions->to_float(self); } bool objects_api::toBool(Object* self) { - if (self->type->convesions && self->type->convesions->to_int) { - return (bool) self->type->convesions->to_int(self); + if (self->type->conversions && self->type->conversions->to_int) { + return (bool) self->type->conversions->to_int(self); } return true; } std::string objects_api::toString(Object* self) { - DEBUG_ASSERT(self->type->convesions && self->type->convesions->to_string) - return self->type->convesions->to_string(self); + DEBUG_ASSERT(self->type->conversions && self->type->conversions->to_string) + return self->type->conversions->to_string(self); } void objects_api::destroy(Object* in) const { diff --git a/Objects/private/core/TypeMethods.cpp b/Objects/private/core/TypeMethods.cpp index 66c38a2..fab757d 100644 --- a/Objects/private/core/TypeMethods.cpp +++ b/Objects/private/core/TypeMethods.cpp @@ -22,7 +22,7 @@ TypeMethod obj::gDefaultTypeMethods[] = { .descr = "converts to string", .exec = [](const TypeMethod* tm) { - if (tm->self->type->convesions && tm->self->type->convesions->to_string) { + if (tm->self->type->conversions && tm->self->type->conversions->to_string) { tm->ret.obj = StringObject::create(NDO->toString(tm->self)); } }, @@ -33,7 +33,7 @@ TypeMethod obj::gDefaultTypeMethods[] = { .descr = "converts to float", .exec = [](const TypeMethod* tm) { - if (tm->self->type->convesions && tm->self->type->convesions->to_float) { + if (tm->self->type->conversions && tm->self->type->conversions->to_float) { tm->ret.obj = FloatObject::create(NDO->toFloat(tm->self)); } }, diff --git a/Objects/private/interpreter/Interpreter.cpp b/Objects/private/interpreter/Interpreter.cpp index b901529..52b86f4 100644 --- a/Objects/private/interpreter/Interpreter.cpp +++ b/Objects/private/interpreter/Interpreter.cpp @@ -223,7 +223,7 @@ void Interpreter::stepBytecodeIn() { case OpCode::PRINT: { auto obj = mOperandsStack.getOperand(); - if (obj->type->convesions && obj->type->convesions->to_string) { + if (obj->type->conversions && obj->type->conversions->to_string) { auto str = NDO->toString(obj); printf("%s\n", str.c_str()); } else { @@ -390,10 +390,10 @@ void Interpreter::stepBytecodeIn() { auto right = mOperandsStack.getOperand(); ASSERT(left->type == right->type && "addition of different types is not implemented"); - ASSERT(left->type->ariphmetics && left->type->ariphmetics->add && "cannot add object of this type"); + ASSERT(left->type->arithmetics && left->type->arithmetics->add && "cannot add object of this type"); auto res = NDO->instantiate(left); - res->type->ariphmetics->add(res, right); + res->type->arithmetics->add(res, right); mScopeStack.addTemp(res); mOperandsStack.push(res); @@ -405,10 +405,10 @@ void Interpreter::stepBytecodeIn() { auto right = mOperandsStack.getOperand(); ASSERT(left->type == right->type && "addition of different types is not implemented"); - ASSERT(left->type->ariphmetics && left->type->ariphmetics->add && "cannot add object of this type"); + ASSERT(left->type->arithmetics && left->type->arithmetics->add && "cannot add object of this type"); auto res = NDO->instantiate(left); - res->type->ariphmetics->sub(res, right); + res->type->arithmetics->sub(res, right); mScopeStack.addTemp(res); mOperandsStack.push(res); @@ -420,10 +420,10 @@ void Interpreter::stepBytecodeIn() { auto right = mOperandsStack.getOperand(); ASSERT(left->type == right->type && "addition of different types is not implemented"); - ASSERT(left->type->ariphmetics && left->type->ariphmetics->add && "cannot add object of this type"); + ASSERT(left->type->arithmetics && left->type->arithmetics->add && "cannot add object of this type"); auto res = NDO->instantiate(left); - res->type->ariphmetics->mul(res, right); + res->type->arithmetics->mul(res, right); mScopeStack.addTemp(res); mOperandsStack.push(res); @@ -435,10 +435,10 @@ void Interpreter::stepBytecodeIn() { auto right = mOperandsStack.getOperand(); ASSERT(left->type == right->type && "addition of different types is not implemented"); - ASSERT(left->type->ariphmetics && left->type->ariphmetics->add && "cannot add object of this type"); + ASSERT(left->type->arithmetics && left->type->arithmetics->add && "cannot add object of this type"); auto res = NDO->instantiate(left); - res->type->ariphmetics->div(res, right); + res->type->arithmetics->div(res, right); mScopeStack.addTemp(res); mOperandsStack.push(res); diff --git a/Objects/private/primitives/BoolObject.cpp b/Objects/private/primitives/BoolObject.cpp index 29cc81a..482a1b6 100644 --- a/Objects/private/primitives/BoolObject.cpp +++ b/Objects/private/primitives/BoolObject.cpp @@ -49,7 +49,7 @@ struct obj::ObjectType obj::BoolObject::TypeData = { .copy = (object_copy) BoolObject::copy, .size = sizeof(BoolObject), .name = "bool", - .convesions = &BoolObjectTypeConversions, + .conversions = &BoolObjectTypeConversions, .save_size = (object_save_size) save_size, .save = (object_save) save, .load = (object_load) load, diff --git a/Objects/private/primitives/ColorObject.cpp b/Objects/private/primitives/ColorObject.cpp index c801a71..44c1abc 100644 --- a/Objects/private/primitives/ColorObject.cpp +++ b/Objects/private/primitives/ColorObject.cpp @@ -47,7 +47,7 @@ void sub(ColorObject* self, ColorObject* in) { self->mCol = in->mCol - self->mCo void add(ColorObject* self, ColorObject* in) { self->mCol = in->mCol + self->mCol; } -struct ObjectTypeAriphmetics ColorObject::TypeAriphm = { +struct ObjectTypeArithmetics ColorObject::TypeAriphm = { .add = (object_add) add, .sub = (object_sub) sub, .mul = (object_mul) nullptr, @@ -61,8 +61,8 @@ struct obj::ObjectType obj::ColorObject::TypeData = { .copy = (object_copy) ColorObject::copy, .size = sizeof(ColorObject), .name = "RGBA", - .convesions = &ColorObjectTypeConversions, - .ariphmetics = &ColorObject::TypeAriphm, + .conversions = &ColorObjectTypeConversions, + .arithmetics = &ColorObject::TypeAriphm, .save_size = (object_save_size) save_size, .save = (object_save) save, .load = (object_load) load, diff --git a/Objects/private/primitives/EnumObject.cpp b/Objects/private/primitives/EnumObject.cpp index 94c70a0..a11bf3a 100644 --- a/Objects/private/primitives/EnumObject.cpp +++ b/Objects/private/primitives/EnumObject.cpp @@ -134,7 +134,9 @@ static void load(ArchiverIn& file_self, EnumObject* self) { file_self.readBytes((tp::int1*) self->entries, self->nentries * ENV_ALNI_SIZE_B); } -bool obj::EnumObject::compare(EnumObject* first, EnumObject* second) { return first->entries != nullptr && second->entries != nullptr && first->active == second->active; } +bool obj::EnumObject::compare(EnumObject* first, EnumObject* second) { + return first->entries != nullptr && second->entries != nullptr && first->active == second->active; +} EnumObject* obj::EnumObject::create(tp::InitialierList list) { auto enum_object = (EnumObject*) obj::NDO->create("enum"); @@ -166,7 +168,7 @@ struct obj::ObjectType obj::EnumObject::TypeData = { .copy = (object_copy) EnumObject::copy, .size = sizeof(EnumObject), .name = "enum", - .convesions = &EnumObjectTypeConversions, + .conversions = &EnumObjectTypeConversions, .save_size = (object_save_size) save_size, .save = (object_save) save, .load = (object_load) load, diff --git a/Objects/private/primitives/FloatObject.cpp b/Objects/private/primitives/FloatObject.cpp index 483b03a..d14dce6 100644 --- a/Objects/private/primitives/FloatObject.cpp +++ b/Objects/private/primitives/FloatObject.cpp @@ -48,7 +48,7 @@ static void add(FloatObject* self, FloatObject* in) { self->val += in->val; } static void divide(FloatObject* self, FloatObject* in) { self->val /= in->val; } -struct ObjectTypeAriphmetics FloatObject::TypeAriphm = { +struct ObjectTypeArithmetics FloatObject::TypeAriphm = { .add = (object_add) add, .sub = (object_sub) sub, .mul = (object_mul) mul, @@ -62,8 +62,8 @@ struct obj::ObjectType obj::FloatObject::TypeData = { .copy = (object_copy) FloatObject::copy, .size = sizeof(FloatObject), .name = "float", - .convesions = &FloatObjectTypeConversions, - .ariphmetics = &FloatObject::TypeAriphm, + .conversions = &FloatObjectTypeConversions, + .arithmetics = &FloatObject::TypeAriphm, .save_size = (object_save_size) save_size, .save = (object_save) save, .load = (object_load) load, diff --git a/Objects/private/primitives/IntObject.cpp b/Objects/private/primitives/IntObject.cpp index 7493ff5..42c3c3c 100644 --- a/Objects/private/primitives/IntObject.cpp +++ b/Objects/private/primitives/IntObject.cpp @@ -49,7 +49,7 @@ void sub(IntObject* self, IntObject* in) { self->val -= in->val; } void add(IntObject* self, IntObject* in) { self->val += in->val; } -struct ObjectTypeAriphmetics IntObject::TypeAriphm = { +struct ObjectTypeArithmetics IntObject::TypeAriphm = { .add = (object_add) add, .sub = (object_sub) sub, .mul = (object_mul) mul, @@ -63,8 +63,8 @@ struct obj::ObjectType obj::IntObject::TypeData = { .copy = (object_copy) IntObject::copy, .size = sizeof(IntObject), .name = "int", - .convesions = &IntObjectTypeConversions, - .ariphmetics = &IntObject::TypeAriphm, + .conversions = &IntObjectTypeConversions, + .arithmetics = &IntObject::TypeAriphm, .save_size = (object_save_size) save_size, .save = (object_save) save, .load = (object_load) load, diff --git a/Objects/private/primitives/LinkObject.cpp b/Objects/private/primitives/LinkObject.cpp index c91815b..ac2739f 100644 --- a/Objects/private/primitives/LinkObject.cpp +++ b/Objects/private/primitives/LinkObject.cpp @@ -101,7 +101,7 @@ struct obj::ObjectType LinkObject::TypeData = { .size = sizeof(LinkObject), .name = "link", - .convesions = nullptr, + .conversions = nullptr, .save_size = (object_save_size) LinkObject::save_size, .save = (object_save) LinkObject::save, diff --git a/Objects/private/primitives/ListObject.cpp b/Objects/private/primitives/ListObject.cpp index a99b0c9..0defbbe 100644 --- a/Objects/private/primitives/ListObject.cpp +++ b/Objects/private/primitives/ListObject.cpp @@ -107,8 +107,8 @@ struct obj::ObjectType obj::ListObject::TypeData = { .copy = (object_copy) ListObject::copy, .size = sizeof(ListObject), .name = "list", - .convesions = nullptr, - + .conversions = nullptr, + .save_size = (object_save_size) save_size, .save = (object_save) save, .load = (object_load) load, diff --git a/Objects/private/primitives/MethodObject.cpp b/Objects/private/primitives/MethodObject.cpp index 5df8719..4f2f971 100644 --- a/Objects/private/primitives/MethodObject.cpp +++ b/Objects/private/primitives/MethodObject.cpp @@ -13,15 +13,19 @@ struct ObjectType MethodObject::TypeData = { .copy = (object_copy) MethodObject::copy, .size = sizeof(MethodObject), .name = "method", - .convesions = nullptr, + .conversions = nullptr, .save_size = (object_save_size) MethodObject::save_size, .save = (object_save) MethodObject::save, .load = (object_load) MethodObject::load, }; -void MethodObject::constructor(MethodObject* self) { self->mScript = obj::ScriptSection::globalHandle()->createScript(); } +void MethodObject::constructor(MethodObject* self) { + self->mScript = obj::ScriptSection::globalHandle()->createScript(); +} -void MethodObject::copy(MethodObject* self, MethodObject* in) { obj::ScriptSection::globalHandle()->changeScript(&self->mScript, &in->mScript); } +void MethodObject::copy(MethodObject* self, MethodObject* in) { + obj::ScriptSection::globalHandle()->changeScript(&self->mScript, &in->mScript); +} void MethodObject::destructor(MethodObject* self) { obj::ScriptSection::globalHandle()->abandonScript(self->mScript); } diff --git a/Objects/private/primitives/NullObject.cpp b/Objects/private/primitives/NullObject.cpp index e1a7360..be71074 100644 --- a/Objects/private/primitives/NullObject.cpp +++ b/Objects/private/primitives/NullObject.cpp @@ -14,7 +14,9 @@ void NullObject::uninit() { NdoNull_globalInstance = nullptr; } -void NullObject::destructor(Object* self) { DEBUG_ASSERT(uninit_flag && "Only one the instance of NullObject exists and thus it can't be destroyed"); } +void NullObject::destructor(Object* self) { + DEBUG_ASSERT(uninit_flag && "Only one the instance of NullObject exists and thus it can't be destroyed"); +} std::string to_string(NullObject* self) { return "nullptr"; } @@ -44,5 +46,5 @@ struct ObjectType NullObject::TypeData = { .copy = nullptr, .size = sizeof(NullObject), .name = "null", - .convesions = &NullObjectTypeConversions, + .conversions = &NullObjectTypeConversions, }; diff --git a/Objects/private/primitives/Stringobject.cpp b/Objects/private/primitives/Stringobject.cpp index 7ff100e..123d51b 100644 --- a/Objects/private/primitives/Stringobject.cpp +++ b/Objects/private/primitives/Stringobject.cpp @@ -67,7 +67,7 @@ struct obj::ObjectType StringObject::TypeData = { .copy = (object_copy) StringObject::copy, .size = sizeof(StringObject), .name = "str", - .convesions = &StringObjectTypeConversions, + .conversions = &StringObjectTypeConversions, .save_size = (object_save_size) save_size, .save = (object_save) save, .load = (object_load) load, diff --git a/Objects/private/primitives/TypeObject.cpp b/Objects/private/primitives/TypeObject.cpp index 77f5aaf..45b6482 100644 --- a/Objects/private/primitives/TypeObject.cpp +++ b/Objects/private/primitives/TypeObject.cpp @@ -54,7 +54,7 @@ struct obj::ObjectType TypeObject::TypeData = { //.constructor = (object_constructor) TypeObject::constructor, .size = sizeof(TypeObject), .name = "typeobject", - .convesions = &conversions, + .conversions = &conversions, .save_size = (object_save_size) save_size, .save = (object_save) save, .load = (object_load) load, diff --git a/Objects/public/core/Object.hpp b/Objects/public/core/Object.hpp index e18de0a..d6675ed 100644 --- a/Objects/public/core/Object.hpp +++ b/Objects/public/core/Object.hpp @@ -59,7 +59,7 @@ namespace tp::obj { typedef void (*object_mul)(Object* self, Object* operand); typedef void (*object_div)(Object* self, Object* operand); - struct ObjectTypeAriphmetics { + struct ObjectTypeArithmetics { object_add add; object_sub sub; object_mul mul; @@ -86,9 +86,9 @@ namespace tp::obj { object_destructor destructor = nullptr; object_copy copy = nullptr; alni size = 0; - const char* name; - const ObjectTypeConversions* convesions = nullptr; - const ObjectTypeAriphmetics* ariphmetics = nullptr; + const char* name = nullptr; + const ObjectTypeConversions* conversions = nullptr; + const ObjectTypeArithmetics* arithmetics = nullptr; object_save_size save_size = nullptr; object_save save = nullptr; object_load load = nullptr; diff --git a/Objects/public/primitives/ColorObject.hpp b/Objects/public/primitives/ColorObject.hpp index 6357416..8391031 100644 --- a/Objects/public/primitives/ColorObject.hpp +++ b/Objects/public/primitives/ColorObject.hpp @@ -10,7 +10,7 @@ namespace tp::obj { RGBA mCol; static ObjectType TypeData; - static ObjectTypeAriphmetics TypeAriphm; + static ObjectTypeArithmetics TypeAriphm; static void constructor(ColorObject* self); static void copy(ColorObject* self, const ColorObject* in); diff --git a/Objects/public/primitives/FloatObject.hpp b/Objects/public/primitives/FloatObject.hpp index c634206..a9fc5b3 100644 --- a/Objects/public/primitives/FloatObject.hpp +++ b/Objects/public/primitives/FloatObject.hpp @@ -9,8 +9,7 @@ namespace tp::obj { alnf val; static ObjectType TypeData; - static ObjectTypeAriphmetics TypeAriphm; - + static ObjectTypeArithmetics TypeAriphm; static void constructor(FloatObject* self); static void copy(FloatObject* self, const FloatObject* in); diff --git a/Objects/public/primitives/IntObject.hpp b/Objects/public/primitives/IntObject.hpp index e5c9b70..119ea91 100644 --- a/Objects/public/primitives/IntObject.hpp +++ b/Objects/public/primitives/IntObject.hpp @@ -9,7 +9,7 @@ namespace tp::obj { alni val; static ObjectType TypeData; - static ObjectTypeAriphmetics TypeAriphm; + static ObjectTypeArithmetics TypeAriphm; static void constructor(IntObject* self); static void copy(IntObject* self, const IntObject* in);