Adding support for windows and fixing some errors
This commit is contained in:
parent
7660d58f26
commit
420bb37039
84 changed files with 168 additions and 255 deletions
|
|
@ -1,5 +1,4 @@
|
|||
#include "compiler/constants.h"
|
||||
#include "NewPlacement.hpp"
|
||||
#include "primitives/methodobject.h"
|
||||
#include "primitives/primitives.h"
|
||||
|
||||
|
|
@ -142,4 +141,4 @@ void ConstObjectsPool::save(tp::Buffer<ConstData>& out) {
|
|||
mBoolTrue.mConstIdx = data_idx;
|
||||
}
|
||||
mDelete = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "compiler/expression.h"
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
using namespace obj;
|
||||
using namespace BCgen;
|
||||
|
|
@ -64,30 +63,30 @@ ExpressionFunc::ExpressionFunc(tp::String id) :
|
|||
Expression(Type::FUNC),
|
||||
mFuncId(id) {}
|
||||
ExpressionConst::ExpressionConst(tp::String val) :
|
||||
Expression(Type::CONST),
|
||||
Expression(Type::CONST_EXPR),
|
||||
mConstType(STR),
|
||||
str(val) {}
|
||||
ExpressionConst::ExpressionConst(const char* val) :
|
||||
Expression(Type::CONST),
|
||||
Expression(Type::CONST_EXPR),
|
||||
mConstType(STR),
|
||||
str(val) {}
|
||||
ExpressionConst::ExpressionConst(tp::int4 val) :
|
||||
Expression(Type::CONST),
|
||||
Expression(Type::CONST_EXPR),
|
||||
mConstType(INT),
|
||||
integer(val) {}
|
||||
ExpressionConst::ExpressionConst(tp::flt4 val) :
|
||||
Expression(Type::CONST),
|
||||
Expression(Type::CONST_EXPR),
|
||||
mConstType(FLT),
|
||||
floating(val) {}
|
||||
ExpressionConst::ExpressionConst(tp::alni val) :
|
||||
Expression(Type::CONST),
|
||||
Expression(Type::CONST_EXPR),
|
||||
mConstType(INT),
|
||||
integer(val) {}
|
||||
ExpressionConst::ExpressionConst(tp::alnf val) :
|
||||
Expression(Type::CONST),
|
||||
Expression(Type::CONST_EXPR),
|
||||
mConstType(FLT),
|
||||
floating(val) {}
|
||||
ExpressionConst::ExpressionConst(bool val) :
|
||||
Expression(Type::CONST),
|
||||
Expression(Type::CONST_EXPR),
|
||||
mConstType(BOOL),
|
||||
boolean(val) {}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "compiler/function.h"
|
||||
|
||||
#include "primitives/methodobject.h"
|
||||
|
|
@ -305,7 +303,7 @@ void FunctionDefinition::EvalExpr(Expression* expr) {
|
|||
inst(Instruction(OpCode::LOAD_LOCAL, mConstants.get(local->mLocalId)));
|
||||
break;
|
||||
}
|
||||
case Expression::Type::CONST:
|
||||
case Expression::Type::CONST_EXPR:
|
||||
{
|
||||
auto constobj = (ExpressionConst*) expr;
|
||||
switch (constobj->mConstType) {
|
||||
|
|
@ -384,7 +382,7 @@ tp::alni instSize(const Instruction& inst) {
|
|||
out += inst.mParamBytes;
|
||||
return out;
|
||||
}
|
||||
case Instruction::ArgType::CONST:
|
||||
case Instruction::ArgType::CONST_ARG:
|
||||
{
|
||||
out += 2;
|
||||
if (inst.mConstData2) {
|
||||
|
|
@ -516,7 +514,7 @@ void FunctionDefinition::generateByteCode(ByteCode& out) {
|
|||
writeParam(out, idx, (tp::int1*) &inst.mParam, inst.mParamBytes);
|
||||
break;
|
||||
}
|
||||
case Instruction::ArgType::CONST:
|
||||
case Instruction::ArgType::CONST_ARG:
|
||||
{
|
||||
writeConst(out, idx, (tp::uint2) inst.mConstData->mConstIdx);
|
||||
if (inst.mConstData2) {
|
||||
|
|
@ -594,4 +592,4 @@ bool obj::BCgen::Compile(obj::MethodObject* method) {
|
|||
delete res.scope;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
#include "compiler/instruction.h"
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
using namespace obj;
|
||||
using namespace tp;
|
||||
|
|
@ -21,14 +20,14 @@ Instruction::Instruction(ConstObject* constData) :
|
|||
Instruction::Instruction(OpCode op, ConstObject* constData) :
|
||||
mOp(op),
|
||||
mConstData(constData),
|
||||
mArgType(ArgType::CONST),
|
||||
mArgType(ArgType::CONST_ARG),
|
||||
mInstType(InstType::EXEC) {}
|
||||
|
||||
Instruction::Instruction(OpCode op, ConstObject* constData, ConstObject* constData2) :
|
||||
mOp(op),
|
||||
mConstData(constData),
|
||||
mConstData2(constData2),
|
||||
mArgType(ArgType::CONST),
|
||||
mArgType(ArgType::CONST_ARG),
|
||||
mInstType(InstType::EXEC) {}
|
||||
|
||||
Instruction::Instruction(OpCode op, tp::alni param, tp::alni nBytes) :
|
||||
|
|
@ -41,4 +40,4 @@ Instruction::Instruction(OpCode op, tp::alni param, tp::alni nBytes) :
|
|||
Instruction::Instruction(Instruction* inst, InstType jump_type) :
|
||||
mInstTarget(inst) {
|
||||
mInstType = jump_type;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "compiler/statement.h"
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
using namespace obj;
|
||||
using namespace BCgen;
|
||||
|
|
@ -76,7 +75,7 @@ StatementClassDef::StatementClassDef(tp::String class_id, StatementScope* scope)
|
|||
StatementFuncDef* obj::BCgen::StmDefFunc(tp::String id, tp::InitialierList<tp::String> args, tp::InitialierList<Statement*> stms) { return new StatementFuncDef(id, args, stms); }
|
||||
|
||||
StatementLocalDef* obj::BCgen::StmDefLocal(tp::String id, Expression* value) {
|
||||
if (value->mType == Expression::Type::CONST) {
|
||||
if (value->mType == Expression::Type::CONST_EXPR) {
|
||||
return new StatementLocalDef(id, (ExpressionConst*) value);
|
||||
}
|
||||
|
||||
|
|
@ -99,4 +98,4 @@ StatementWhile* obj::BCgen::StmWhile(Expression* condition, StatementScope* scop
|
|||
|
||||
StatementIgnore* obj::BCgen::StmIgnore(Expression* expr) { return new StatementIgnore(expr); }
|
||||
|
||||
StatementClassDef* obj::BCgen::StmClassDef(tp::String id, StatementScope* scope) { return new StatementClassDef(id, scope); }
|
||||
StatementClassDef* obj::BCgen::StmClassDef(tp::String id, StatementScope* scope) { return new StatementClassDef(id, scope); }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "Tokenizer.hpp"
|
||||
|
||||
#include "compiler/function.h"
|
||||
|
|
@ -88,4 +86,4 @@ static tp::ModuleManifest* sModuleDependencies[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
tp::ModuleManifest obj::gModuleObjects = tp::ModuleManifest("Objects", init, deinit, sModuleDependencies);
|
||||
tp::ModuleManifest obj::gModuleObjects = tp::ModuleManifest("Objects", init, deinit, sModuleDependencies);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "core/object.h"
|
||||
|
||||
#include "primitives/classobject.h"
|
||||
|
|
@ -224,4 +222,4 @@ namespace obj {
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
|
||||
#include "NewPlacement.hpp"
|
||||
#include "core/object.h"
|
||||
|
||||
#include "primitives/nullobject.h"
|
||||
|
|
@ -432,4 +431,4 @@ namespace obj {
|
|||
sl_callbacks[sl_callbacks_load_idx] = in;
|
||||
sl_callbacks_load_idx++;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
#include "HeapAllocatorGlobal.hpp"
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "core/scriptsection.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "core/typegroups.h"
|
||||
|
||||
#include "core/object.h"
|
||||
|
|
@ -80,4 +78,4 @@ obj::TypeGroups::~TypeGroups() {
|
|||
}
|
||||
childs.~Map();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "core/typemethods.h"
|
||||
|
||||
#include "primitives/floatobject.h"
|
||||
|
|
@ -131,4 +129,4 @@ void TypeMethod::init() {
|
|||
while (args[mNargs].descr) {
|
||||
mNargs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "interpreter/callstack.h"
|
||||
|
||||
#include "interpreter/bytecode.h"
|
||||
|
|
@ -33,4 +31,4 @@ void CallStack::leave() {
|
|||
|
||||
ByteCode* CallStack::getBytecode() { return &mStack.last().mMethod->mScript->mBytecode; }
|
||||
|
||||
tp::halni CallStack::len() const { return mStack.size(); }
|
||||
tp::halni CallStack::len() const { return mStack.size(); }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "interpreter/interpreter.h"
|
||||
|
||||
#include "primitives/primitives.h"
|
||||
|
|
@ -606,4 +604,4 @@ void Interpreter::execAll(obj::MethodObject* method, obj::ClassObject* self, obj
|
|||
while (!finished()) {
|
||||
stepBytecodeIn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "interpreter/operandsstack.h"
|
||||
|
||||
using namespace obj;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "interpreter/scopestack.h"
|
||||
|
||||
using namespace obj;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
|
||||
#include "primitives/boolobject.h"
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
using namespace obj;
|
||||
using namespace tp;
|
||||
|
|
@ -53,4 +52,4 @@ struct obj::ObjectType obj::BoolObject::TypeData = {
|
|||
.save_size = (object_save_size) save_size,
|
||||
.save = (object_save) save,
|
||||
.load = (object_load) load,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "primitives/classobject.h"
|
||||
#include "primitives/dictobject.h"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
#include "primitives/colorobject.h"
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
using namespace obj;
|
||||
using namespace tp;
|
||||
|
|
@ -63,4 +62,4 @@ struct obj::ObjectType obj::ColorObject::TypeData = {
|
|||
.save_size = (object_save_size) save_size,
|
||||
.save = (object_save) save,
|
||||
.load = (object_load) load,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "primitives/dictobject.h"
|
||||
#include "primitives/stringobject.h"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "primitives/enumobject.h"
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
|
|
@ -174,4 +171,4 @@ struct obj::ObjectType obj::EnumObject::TypeData = {
|
|||
.load = (object_load) load,
|
||||
.comparison = (object_compare) EnumObject::compare,
|
||||
.allocated_size = (object_allocated_size) allocated_size,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
#pragma once
|
||||
|
||||
#include "primitives/floatobject.h"
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
using namespace obj;
|
||||
using namespace tp;
|
||||
|
|
@ -69,4 +66,4 @@ struct obj::ObjectType obj::FloatObject::TypeData = {
|
|||
.save_size = (object_save_size) save_size,
|
||||
.save = (object_save) save,
|
||||
.load = (object_load) load,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "primitives/interpreterobject.h"
|
||||
#include "primitives/linkobject.h"
|
||||
#include "primitives/methodobject.h"
|
||||
|
|
@ -75,4 +73,4 @@ struct obj::ObjectType InterpreterObject::TypeData = {
|
|||
.size = sizeof(InterpreterObject),
|
||||
.name = "interpreter",
|
||||
.load = (object_load) InterpreterObject::load,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "primitives/intobject.h"
|
||||
|
||||
using namespace obj;
|
||||
|
|
@ -71,4 +67,4 @@ struct obj::ObjectType obj::IntObject::TypeData = {
|
|||
.save_size = (object_save_size) save_size,
|
||||
.save = (object_save) save,
|
||||
.load = (object_load) load,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "primitives/linkobject.h"
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
using namespace obj;
|
||||
using namespace tp;
|
||||
|
|
@ -106,4 +103,4 @@ struct obj::ObjectType LinkObject::TypeData = { .base = NULL,
|
|||
.type_methods = { .methods = {
|
||||
&tm_set,
|
||||
&tm_get,
|
||||
} } };
|
||||
} } };
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "primitives/intobject.h"
|
||||
#include "primitives/listobject.h"
|
||||
|
||||
|
|
@ -130,4 +126,4 @@ struct obj::ObjectType obj::ListObject::TypeData = { .base = NULL,
|
|||
.load = (object_load) load,
|
||||
.childs_retrival = (object_debug_all_childs_retrival) childs_retrival,
|
||||
.allocated_size = (object_allocated_size) allocated_size,
|
||||
.allocated_size_recursive = (object_allocated_size_recursive) allocated_size_recursive };
|
||||
.allocated_size_recursive = (object_allocated_size_recursive) allocated_size_recursive };
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "compiler/function.h"
|
||||
#include "core/scriptsection.h"
|
||||
|
|
@ -62,4 +59,4 @@ MethodObject* MethodObject::create(tp::String script) {
|
|||
out->mScript->mReadable->val = script;
|
||||
out->compile();
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "primitives/nullobject.h"
|
||||
|
||||
|
|
@ -47,4 +44,4 @@ struct ObjectType NullObject::TypeData = {
|
|||
.size = sizeof(NullObject),
|
||||
.name = "null",
|
||||
.convesions = &NullObjectTypeConversions,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
#include "primitives/stringobject.h"
|
||||
|
||||
|
|
@ -75,4 +72,4 @@ struct obj::ObjectType StringObject::TypeData = {
|
|||
.load = (object_load) load,
|
||||
.comparison = (object_compare) compare_strings,
|
||||
.allocated_size = (object_allocated_size) allocated_size,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "primitives/typeobject.h"
|
||||
#include "NewPlacement.hpp"
|
||||
#include "primitives/nullobject.h"
|
||||
|
||||
using namespace obj;
|
||||
|
|
@ -69,4 +66,4 @@ struct obj::ObjectType TypeObject::TypeData = {
|
|||
.load = (object_load) load,
|
||||
.comparison = (object_compare) comparator,
|
||||
.allocated_size = (object_allocated_size) allocated_size,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue