Rework for git.tesses.org, GC* is std::shared_ptr maybe will fix crash during exit
This commit is contained in:
+2
-2
@@ -5,7 +5,7 @@ namespace Tesses::CrossLang {
|
||||
{
|
||||
TAny* anyObj = new TAny();
|
||||
|
||||
GC* gc = ls.GetGC();
|
||||
std::shared_ptr<GC> gc = ls.GetGC();
|
||||
ls.Add(anyObj);
|
||||
gc->Watch(anyObj);
|
||||
return anyObj;
|
||||
@@ -14,7 +14,7 @@ namespace Tesses::CrossLang {
|
||||
{
|
||||
TAny* anyObj = new TAny();
|
||||
|
||||
GC* gc = ls->GetGC();
|
||||
std::shared_ptr<GC> gc = ls->GetGC();
|
||||
ls->Add(anyObj);
|
||||
gc->Watch(anyObj);
|
||||
return anyObj;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Tesses::CrossLang
|
||||
TAssociativeArray* TAssociativeArray::Create(GCList& ls)
|
||||
{
|
||||
TAssociativeArray* list=new TAssociativeArray();
|
||||
GC* _gc = ls.GetGC();
|
||||
std::shared_ptr<GC> _gc = ls.GetGC();
|
||||
ls.Add(list);
|
||||
_gc->Watch(list);
|
||||
return list;
|
||||
@@ -14,12 +14,12 @@ namespace Tesses::CrossLang
|
||||
TAssociativeArray* TAssociativeArray::Create(GCList* ls)
|
||||
{
|
||||
TAssociativeArray* list=new TAssociativeArray();
|
||||
GC* _gc = ls->GetGC();
|
||||
std::shared_ptr<GC> _gc = ls->GetGC();
|
||||
ls->Add(list);
|
||||
_gc->Watch(list);
|
||||
return list;
|
||||
}
|
||||
void TAssociativeArray::Set(GC* gc, TObject key, TObject value)
|
||||
void TAssociativeArray::Set(std::shared_ptr<GC> gc, TObject key, TObject value)
|
||||
{
|
||||
if(std::holds_alternative<Undefined>(key)) return;
|
||||
gc->BarrierBegin();
|
||||
@@ -46,7 +46,7 @@ namespace Tesses::CrossLang
|
||||
this->items.push_back(std::pair<TObject,TObject>(key,value));
|
||||
gc->BarrierEnd();
|
||||
}
|
||||
TObject TAssociativeArray::Get(GC* gc, TObject key)
|
||||
TObject TAssociativeArray::Get(std::shared_ptr<GC> gc, TObject key)
|
||||
{
|
||||
if(std::holds_alternative<Undefined>(key)) return Undefined();
|
||||
gc->BarrierBegin();
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
#include "CrossLang.hpp"
|
||||
//THANKS TO https://www.youtube.com/watch?v=R-z2Hv-7nxk
|
||||
namespace Tesses::CrossLang {
|
||||
TTask::TTask(GC* gc)
|
||||
TTask::TTask(std::shared_ptr<GC> gc)
|
||||
{
|
||||
this->gc = gc;
|
||||
}
|
||||
@@ -172,10 +172,10 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
|
||||
class TTaskCseObj {
|
||||
GC* gc;
|
||||
std::shared_ptr<GC> gc;
|
||||
TTask* task;
|
||||
public:
|
||||
TTaskCseObj(GC* gc, TTask* task)
|
||||
TTaskCseObj(std::shared_ptr<GC> gc, TTask* task)
|
||||
{
|
||||
this->gc = gc;
|
||||
this->task = task;
|
||||
@@ -230,7 +230,7 @@ namespace Tesses::CrossLang {
|
||||
|
||||
//try {
|
||||
GCList ls2(ls.GetGC());
|
||||
GC* gc = ls.GetGC();
|
||||
std::shared_ptr<GC> gc = ls.GetGC();
|
||||
|
||||
std::shared_ptr<TTaskCseObj> obj = std::make_shared<TTaskCseObj>(gc,task);
|
||||
|
||||
|
||||
@@ -43,6 +43,9 @@ namespace Tesses::CrossLang
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
//DO NOTHING
|
||||
break;
|
||||
}
|
||||
return &item;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Tesses::CrossLang {
|
||||
|
||||
TClassEnvironment* env2=new TClassEnvironment(env,obj);
|
||||
|
||||
GC* _gc = gc->GetGC();
|
||||
std::shared_ptr<GC> _gc = gc->GetGC();
|
||||
gc->Add(env2);
|
||||
_gc->Watch(env2);
|
||||
return env2;
|
||||
@@ -23,7 +23,7 @@ namespace Tesses::CrossLang {
|
||||
|
||||
TClassEnvironment* env2=new TClassEnvironment(env,obj);
|
||||
|
||||
GC* _gc = gc.GetGC();
|
||||
std::shared_ptr<GC> _gc = gc.GetGC();
|
||||
gc.Add(env2);
|
||||
_gc->Watch(env2);
|
||||
return env2;
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Tesses::CrossLang {
|
||||
{
|
||||
TArgWrapper* argWrapper = new TArgWrapper();
|
||||
argWrapper->callable = callable;
|
||||
GC* gc = ls.GetGC();
|
||||
std::shared_ptr<GC> gc = ls.GetGC();
|
||||
ls.Add(argWrapper);
|
||||
gc->Watch(argWrapper);
|
||||
return argWrapper;
|
||||
@@ -13,7 +13,7 @@ namespace Tesses::CrossLang {
|
||||
{
|
||||
TArgWrapper* argWrapper = new TArgWrapper();
|
||||
argWrapper->callable = callable;
|
||||
GC* gc = ls->GetGC();
|
||||
std::shared_ptr<GC> gc = ls->GetGC();
|
||||
ls->Add(argWrapper);
|
||||
gc->Watch(argWrapper);
|
||||
return argWrapper;
|
||||
@@ -54,7 +54,7 @@ namespace Tesses::CrossLang {
|
||||
TClosure* closure = new TClosure();
|
||||
closure->className="";
|
||||
closure->ownScope=ownScope;
|
||||
GC* _gc = ls.GetGC();
|
||||
std::shared_ptr<GC> _gc = ls.GetGC();
|
||||
ls.Add(closure);
|
||||
_gc->Watch(closure);
|
||||
closure->chunkId = chunkId;
|
||||
@@ -71,7 +71,7 @@ namespace Tesses::CrossLang {
|
||||
TClosure* closure = new TClosure();
|
||||
closure->className="";
|
||||
closure->ownScope=ownScope;
|
||||
GC* _gc = ls->GetGC();
|
||||
std::shared_ptr<GC> _gc = ls->GetGC();
|
||||
ls->Add(closure);
|
||||
_gc->Watch(closure);
|
||||
closure->chunkId = chunkId;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Tesses::CrossLang {
|
||||
|
||||
TDynamicDictionary* dict=new TDynamicDictionary();
|
||||
dict->cb = callable;
|
||||
GC* _gc = ls.GetGC();
|
||||
std::shared_ptr<GC> _gc = ls.GetGC();
|
||||
ls.Add(dict);
|
||||
_gc->Watch(dict);
|
||||
return dict;
|
||||
@@ -15,7 +15,7 @@ namespace Tesses::CrossLang {
|
||||
{
|
||||
TDynamicDictionary* dict=new TDynamicDictionary();
|
||||
dict->cb = callable;
|
||||
GC* _gc = ls->GetGC();
|
||||
std::shared_ptr<GC> _gc = ls->GetGC();
|
||||
ls->Add(dict);
|
||||
_gc->Watch(dict);
|
||||
return dict;
|
||||
@@ -153,34 +153,22 @@ namespace Tesses::CrossLang {
|
||||
return Undefined();
|
||||
}
|
||||
|
||||
void TDictionary::DeclareFunction(GC* gc,std::string key,std::string documentation, std::vector<std::string> argNames, std::function<TObject(GCList& ls, std::vector<TObject> args)> cb)
|
||||
void TDictionary::DeclareFunction(std::shared_ptr<GC> gc,std::string key,std::string documentation, std::vector<std::string> argNames, std::function<TObject(GCList& ls, std::vector<TObject> args)> cb)
|
||||
{
|
||||
gc->BarrierBegin();
|
||||
GCList ls(gc);
|
||||
this->SetValue(key, TExternalMethod::Create(ls,documentation,argNames,cb));
|
||||
gc->BarrierEnd();
|
||||
}
|
||||
void TDictionary::DeclareFunction(GC& gc,std::string key,std::string documentation, std::vector<std::string> argNames, std::function<TObject(GCList& ls, std::vector<TObject> args)> cb)
|
||||
{
|
||||
gc.BarrierBegin();
|
||||
GCList ls(gc);
|
||||
this->SetValue(key, TExternalMethod::Create(ls,documentation,argNames,cb));
|
||||
gc.BarrierEnd();
|
||||
}
|
||||
void TDictionary::DeclareFunction(GC* gc,std::string key,std::string documentation, std::vector<std::string> argNames, std::function<TObject(GCList& ls, std::vector<TObject> args)> cb,std::function<void()> destroy)
|
||||
|
||||
void TDictionary::DeclareFunction(std::shared_ptr<GC> gc,std::string key,std::string documentation, std::vector<std::string> argNames, std::function<TObject(GCList& ls, std::vector<TObject> args)> cb,std::function<void()> destroy)
|
||||
{
|
||||
gc->BarrierBegin();
|
||||
GCList ls(gc);
|
||||
this->SetValue(key, TExternalMethod::Create(ls,documentation,argNames,cb,destroy));
|
||||
gc->BarrierEnd();
|
||||
}
|
||||
void TDictionary::DeclareFunction(GC& gc,std::string key,std::string documentation, std::vector<std::string> argNames, std::function<TObject(GCList& ls, std::vector<TObject> args)> cb,std::function<void()> destroy)
|
||||
{
|
||||
gc.BarrierBegin();
|
||||
GCList ls(gc);
|
||||
this->SetValue(key, TExternalMethod::Create(ls,documentation,argNames,cb,destroy));
|
||||
gc.BarrierEnd();
|
||||
}
|
||||
|
||||
TObject TDictionary::GetValue(std::string key)
|
||||
{
|
||||
if(this->items.empty()) return Undefined();
|
||||
@@ -216,7 +204,7 @@ namespace Tesses::CrossLang {
|
||||
TDictionary* TDictionary::Create(GCList* gc)
|
||||
{
|
||||
TDictionary* dict=new TDictionary();
|
||||
GC* _gc = gc->GetGC();
|
||||
std::shared_ptr<GC> _gc = gc->GetGC();
|
||||
gc->Add(dict);
|
||||
_gc->Watch(dict);
|
||||
return dict;
|
||||
@@ -224,7 +212,7 @@ namespace Tesses::CrossLang {
|
||||
TDictionary* TDictionary::Create(GCList& gc)
|
||||
{
|
||||
TDictionary* dict=new TDictionary();
|
||||
GC* _gc = gc.GetGC();
|
||||
std::shared_ptr<GC> _gc = gc.GetGC();
|
||||
gc.Add(dict);
|
||||
_gc->Watch(dict);
|
||||
return dict;
|
||||
|
||||
+53
-27
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Tesses::CrossLang {
|
||||
|
||||
EmbedStream::EmbedStream(GC* gc, TFile* file, uint32_t resource)
|
||||
EmbedStream::EmbedStream(std::shared_ptr<GC> gc, TFile* file, uint32_t resource)
|
||||
{
|
||||
this->offset = 0;
|
||||
this->resource = resource;
|
||||
@@ -124,17 +124,58 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
bool EmbedDirectory::RegularFileExists(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
auto ent = getEntry(path);
|
||||
TCallable* call;
|
||||
return GetObjectHeap(ent,call);
|
||||
}
|
||||
bool EmbedDirectory::DirectoryExists(Tesses::Framework::Filesystem::VFSPath path)
|
||||
|
||||
bool EmbedDirectory::Stat(Tesses::Framework::Filesystem::VFSPath path, Tesses::Framework::Filesystem::StatData& data)
|
||||
{
|
||||
auto ent = getEntry(path);
|
||||
|
||||
|
||||
TDictionary* dict;
|
||||
return GetObjectHeap(ent,dict);
|
||||
if(GetObjectHeap(ent,dict))
|
||||
{
|
||||
data.Size = 0;
|
||||
data.Mode = Tesses::Framework::Filesystem::MODE_DIRECTORY | 0755;
|
||||
data.BlockCount = 0;
|
||||
data.BlockSize = 0;
|
||||
data.Device = 0;
|
||||
data.DeviceId = 0;
|
||||
data.GroupId = 0;
|
||||
data.HardLinks = 1;
|
||||
data.Inode = 0;
|
||||
data.LastAccess = Tesses::Framework::Date::DateTime(0);
|
||||
data.LastModified = Tesses::Framework::Date::DateTime(0);
|
||||
data.LastStatus = Tesses::Framework::Date::DateTime(0);
|
||||
data.UserId = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
TCallable* cal;
|
||||
if(GetObjectHeap(ent, cal))
|
||||
{
|
||||
GCList ls(this->dir->GetGC());
|
||||
auto fileO= cal->Call(ls, {});
|
||||
std::shared_ptr<Tesses::Framework::Streams::Stream> strm;
|
||||
if(GetObject(fileO,strm)) {
|
||||
|
||||
data.Size = (uint64_t)strm->GetLength();
|
||||
data.Mode = Tesses::Framework::Filesystem::MODE_REGULAR | 0755;
|
||||
data.BlockSize = 512;
|
||||
data.BlockCount = data.Size / data.BlockSize;
|
||||
|
||||
data.Device = 0;
|
||||
data.DeviceId = 0;
|
||||
data.GroupId = 0;
|
||||
data.HardLinks = 1;
|
||||
data.Inode = 0;
|
||||
data.LastAccess = Tesses::Framework::Date::DateTime(0);
|
||||
data.LastModified = Tesses::Framework::Date::DateTime(0);
|
||||
data.LastStatus = Tesses::Framework::Date::DateTime(0);
|
||||
data.UserId = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
class DICT_DIRENUM
|
||||
@@ -148,7 +189,7 @@ namespace Tesses::CrossLang {
|
||||
{
|
||||
return this->current->first;
|
||||
}
|
||||
DICT_DIRENUM(GC* gc, TDictionary* dict) : ls(gc), dict(dict)
|
||||
DICT_DIRENUM(std::shared_ptr<GC> gc, TDictionary* dict) : ls(gc), dict(dict)
|
||||
{
|
||||
ls.Add(dict);
|
||||
}
|
||||
@@ -197,26 +238,11 @@ namespace Tesses::CrossLang {
|
||||
return Tesses::Framework::Filesystem::VFSPathEnumerator();
|
||||
}
|
||||
|
||||
EmbedDirectory::EmbedDirectory(GC* gc, TDictionary* dict)
|
||||
EmbedDirectory::EmbedDirectory(std::shared_ptr<GC> gc, TDictionary* dict)
|
||||
{
|
||||
this->dir = CreateMarkedTObject(gc, dict);
|
||||
}
|
||||
void EmbedDirectory::CreateDirectory(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
//DO NOTHING
|
||||
}
|
||||
void EmbedDirectory::DeleteDirectory(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
|
||||
}
|
||||
void EmbedDirectory::DeleteFile(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
|
||||
}
|
||||
void EmbedDirectory::MoveFile(Tesses::Framework::Filesystem::VFSPath src, Tesses::Framework::Filesystem::VFSPath dest)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string EmbedDirectory::VFSPathToSystem(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
return path.ToString();
|
||||
|
||||
+24
-24
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Tesses::CrossLang
|
||||
{
|
||||
bool TYieldEnumerator::MoveNext(GC* ls)
|
||||
bool TYieldEnumerator::MoveNext(std::shared_ptr<GC> ls)
|
||||
{
|
||||
CallStackEntry* ent;
|
||||
GCList ls2(ls);
|
||||
@@ -56,7 +56,7 @@ namespace Tesses::CrossLang
|
||||
yieldEnum->hasStarted=false;
|
||||
yieldEnum->enumerator = v;
|
||||
|
||||
GC* _gc = ls.GetGC();
|
||||
std::shared_ptr<GC> _gc = ls.GetGC();
|
||||
ls.Add(yieldEnum);
|
||||
_gc->Watch(yieldEnum);
|
||||
return yieldEnum;
|
||||
@@ -69,13 +69,13 @@ namespace Tesses::CrossLang
|
||||
yieldEnum->hasStarted=false;
|
||||
yieldEnum->enumerator = v;
|
||||
|
||||
GC* _gc = ls->GetGC();
|
||||
std::shared_ptr<GC> _gc = ls->GetGC();
|
||||
ls->Add(yieldEnum);
|
||||
_gc->Watch(yieldEnum);
|
||||
return yieldEnum;
|
||||
}
|
||||
|
||||
bool TCustomEnumerator::MoveNext(GC* ls)
|
||||
bool TCustomEnumerator::MoveNext(std::shared_ptr<GC> ls)
|
||||
{
|
||||
GCList ls2(ls);
|
||||
auto res = this->dict->CallMethod(ls2,"MoveNext",{});
|
||||
@@ -110,7 +110,7 @@ namespace Tesses::CrossLang
|
||||
{
|
||||
TCustomEnumerator* customEnum = new TCustomEnumerator();
|
||||
customEnum->dict = dict;
|
||||
GC* _gc = ls->GetGC();
|
||||
std::shared_ptr<GC> _gc = ls->GetGC();
|
||||
ls->Add(customEnum);
|
||||
_gc->Watch(customEnum);
|
||||
return customEnum;
|
||||
@@ -119,7 +119,7 @@ namespace Tesses::CrossLang
|
||||
{
|
||||
TCustomEnumerator* customEnum = new TCustomEnumerator();
|
||||
customEnum->dict = dict;
|
||||
GC* _gc = ls.GetGC();
|
||||
std::shared_ptr<GC> _gc = ls.GetGC();
|
||||
ls.Add(customEnum);
|
||||
_gc->Watch(customEnum);
|
||||
return customEnum;
|
||||
@@ -162,7 +162,7 @@ namespace Tesses::CrossLang
|
||||
{
|
||||
TVFSPathEnumerator* vfspathe = new TVFSPathEnumerator();
|
||||
vfspathe->enumerator = enumerator;
|
||||
GC* _gc = ls.GetGC();
|
||||
std::shared_ptr<GC> _gc = ls.GetGC();
|
||||
ls.Add(vfspathe);
|
||||
_gc->Watch(vfspathe);
|
||||
return vfspathe;
|
||||
@@ -171,12 +171,12 @@ namespace Tesses::CrossLang
|
||||
{
|
||||
TVFSPathEnumerator* vfspathe = new TVFSPathEnumerator();
|
||||
vfspathe->enumerator = enumerator;
|
||||
GC* _gc = ls->GetGC();
|
||||
std::shared_ptr<GC> _gc = ls->GetGC();
|
||||
ls->Add(vfspathe);
|
||||
_gc->Watch(vfspathe);
|
||||
return vfspathe;
|
||||
}
|
||||
bool TVFSPathEnumerator::MoveNext(GC* ls)
|
||||
bool TVFSPathEnumerator::MoveNext(std::shared_ptr<GC> ls)
|
||||
{
|
||||
return enumerator.MoveNext();
|
||||
}
|
||||
@@ -189,7 +189,7 @@ namespace Tesses::CrossLang
|
||||
TDictionaryEnumerator* dicte=new TDictionaryEnumerator();
|
||||
dicte->dict = dict;
|
||||
dicte->hasStarted=false;
|
||||
GC* _gc = ls.GetGC();
|
||||
std::shared_ptr<GC> _gc = ls.GetGC();
|
||||
ls.Add(dicte);
|
||||
_gc->Watch(dicte);
|
||||
return dicte;
|
||||
@@ -199,13 +199,13 @@ namespace Tesses::CrossLang
|
||||
TDictionaryEnumerator* dicte=new TDictionaryEnumerator();
|
||||
dicte->dict = dict;
|
||||
dicte->hasStarted=false;
|
||||
GC* _gc = ls->GetGC();
|
||||
std::shared_ptr<GC> _gc = ls->GetGC();
|
||||
ls->Add(dicte);
|
||||
_gc->Watch(dicte);
|
||||
return dicte;
|
||||
}
|
||||
|
||||
bool TDictionaryEnumerator::MoveNext(GC* ls)
|
||||
bool TDictionaryEnumerator::MoveNext(std::shared_ptr<GC> ls)
|
||||
{
|
||||
if(!this->hasStarted)
|
||||
{
|
||||
@@ -248,7 +248,7 @@ namespace Tesses::CrossLang
|
||||
TListEnumerator* liste=new TListEnumerator();
|
||||
liste->ls = list;
|
||||
liste->index = -1;
|
||||
GC* _gc = ls.GetGC();
|
||||
std::shared_ptr<GC> _gc = ls.GetGC();
|
||||
ls.Add(liste);
|
||||
_gc->Watch(liste);
|
||||
return liste;
|
||||
@@ -258,12 +258,12 @@ namespace Tesses::CrossLang
|
||||
TListEnumerator* liste=new TListEnumerator();
|
||||
liste->ls = list;
|
||||
liste->index = -1;
|
||||
GC* _gc = ls->GetGC();
|
||||
std::shared_ptr<GC> _gc = ls->GetGC();
|
||||
ls->Add(liste);
|
||||
_gc->Watch(liste);
|
||||
return liste;
|
||||
}
|
||||
bool TListEnumerator::MoveNext(GC* ls)
|
||||
bool TListEnumerator::MoveNext(std::shared_ptr<GC> ls)
|
||||
{
|
||||
this->index++;
|
||||
return this->index >= 0 && this->index < this->ls->Count();
|
||||
@@ -291,7 +291,7 @@ namespace Tesses::CrossLang
|
||||
TAssociativeArrayEnumerator* liste=new TAssociativeArrayEnumerator();
|
||||
liste->ls = list;
|
||||
liste->index = -1;
|
||||
GC* _gc = ls.GetGC();
|
||||
std::shared_ptr<GC> _gc = ls.GetGC();
|
||||
ls.Add(liste);
|
||||
_gc->Watch(liste);
|
||||
return liste;
|
||||
@@ -301,12 +301,12 @@ namespace Tesses::CrossLang
|
||||
TAssociativeArrayEnumerator* liste=new TAssociativeArrayEnumerator();
|
||||
liste->ls = list;
|
||||
liste->index = -1;
|
||||
GC* _gc = ls->GetGC();
|
||||
std::shared_ptr<GC> _gc = ls->GetGC();
|
||||
ls->Add(liste);
|
||||
_gc->Watch(liste);
|
||||
return liste;
|
||||
}
|
||||
bool TAssociativeArrayEnumerator::MoveNext(GC* ls)
|
||||
bool TAssociativeArrayEnumerator::MoveNext(std::shared_ptr<GC> ls)
|
||||
{
|
||||
this->index++;
|
||||
return this->index >= 0 && this->index < this->ls->Count();
|
||||
@@ -338,7 +338,7 @@ namespace Tesses::CrossLang
|
||||
TDynamicListEnumerator* liste=new TDynamicListEnumerator();
|
||||
liste->ls = list;
|
||||
liste->index = -1;
|
||||
GC* _gc = ls.GetGC();
|
||||
std::shared_ptr<GC> _gc = ls.GetGC();
|
||||
ls.Add(liste);
|
||||
_gc->Watch(liste);
|
||||
return liste;
|
||||
@@ -348,12 +348,12 @@ namespace Tesses::CrossLang
|
||||
TDynamicListEnumerator* liste=new TDynamicListEnumerator();
|
||||
liste->ls = list;
|
||||
liste->index = -1;
|
||||
GC* _gc = ls->GetGC();
|
||||
std::shared_ptr<GC> _gc = ls->GetGC();
|
||||
ls->Add(liste);
|
||||
_gc->Watch(liste);
|
||||
return liste;
|
||||
}
|
||||
bool TDynamicListEnumerator::MoveNext(GC* ls)
|
||||
bool TDynamicListEnumerator::MoveNext(std::shared_ptr<GC> ls)
|
||||
{
|
||||
this->index++;
|
||||
GCList ls2(ls);
|
||||
@@ -384,7 +384,7 @@ namespace Tesses::CrossLang
|
||||
TStringEnumerator* stre=new TStringEnumerator();
|
||||
stre->str = str;
|
||||
stre->hasStarted=false;
|
||||
GC* _gc = ls.GetGC();
|
||||
std::shared_ptr<GC> _gc = ls.GetGC();
|
||||
ls.Add(stre);
|
||||
_gc->Watch(stre);
|
||||
return stre;
|
||||
@@ -394,12 +394,12 @@ namespace Tesses::CrossLang
|
||||
TStringEnumerator* stre=new TStringEnumerator();
|
||||
stre->str = str;
|
||||
stre->hasStarted=false;
|
||||
GC* _gc = ls->GetGC();
|
||||
std::shared_ptr<GC> _gc = ls->GetGC();
|
||||
ls->Add(stre);
|
||||
_gc->Watch(stre);
|
||||
return stre;
|
||||
}
|
||||
bool TStringEnumerator::MoveNext(GC* ls)
|
||||
bool TStringEnumerator::MoveNext(std::shared_ptr<GC> ls)
|
||||
{
|
||||
if(!this->hasStarted)
|
||||
{
|
||||
|
||||
+6
-6
@@ -4,7 +4,7 @@ namespace Tesses::CrossLang {
|
||||
{
|
||||
TDynamicList* list=new TDynamicList();
|
||||
list->cb = callable;
|
||||
GC* _gc = ls.GetGC();
|
||||
std::shared_ptr<GC> _gc = ls.GetGC();
|
||||
ls.Add(list);
|
||||
_gc->Watch(list);
|
||||
return list;
|
||||
@@ -13,7 +13,7 @@ namespace Tesses::CrossLang {
|
||||
{
|
||||
TDynamicList* list=new TDynamicList();
|
||||
list->cb = callable;
|
||||
GC* _gc = ls->GetGC();
|
||||
std::shared_ptr<GC> _gc = ls->GetGC();
|
||||
ls->Add(list);
|
||||
_gc->Watch(list);
|
||||
return list;
|
||||
@@ -140,7 +140,7 @@ namespace Tesses::CrossLang {
|
||||
TByteArray* TByteArray::Create(GCList& ls)
|
||||
{
|
||||
TByteArray* arr=new TByteArray();
|
||||
GC* _gc = ls.GetGC();
|
||||
std::shared_ptr<GC> _gc = ls.GetGC();
|
||||
ls.Add(arr);
|
||||
_gc->Watch(arr);
|
||||
return arr;
|
||||
@@ -149,7 +149,7 @@ namespace Tesses::CrossLang {
|
||||
TByteArray* TByteArray::Create(GCList* ls)
|
||||
{
|
||||
TByteArray* arr=new TByteArray();
|
||||
GC* _gc = ls->GetGC();
|
||||
std::shared_ptr<GC> _gc = ls->GetGC();
|
||||
ls->Add(arr);
|
||||
_gc->Watch(arr);
|
||||
return arr;
|
||||
@@ -157,7 +157,7 @@ namespace Tesses::CrossLang {
|
||||
TList* TList::Create(GCList* gc)
|
||||
{
|
||||
TList* list=new TList();
|
||||
GC* _gc = gc->GetGC();
|
||||
std::shared_ptr<GC> _gc = gc->GetGC();
|
||||
gc->Add(list);
|
||||
_gc->Watch(list);
|
||||
return list;
|
||||
@@ -165,7 +165,7 @@ namespace Tesses::CrossLang {
|
||||
TList* TList::Create(GCList& gc)
|
||||
{
|
||||
TList* list=new TList();
|
||||
GC* _gc = gc.GetGC();
|
||||
std::shared_ptr<GC> _gc = gc.GetGC();
|
||||
gc.Add(list);
|
||||
_gc->Watch(list);
|
||||
return list;
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Tesses::CrossLang
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool TNativeObject::Equals(GC* gc, TObject right)
|
||||
bool TNativeObject::Equals(std::shared_ptr<GC> gc, TObject right)
|
||||
{
|
||||
if(std::holds_alternative<THeapObjectHolder>(right))
|
||||
{
|
||||
@@ -54,7 +54,7 @@ namespace Tesses::CrossLang
|
||||
TNative* TNative::Create(GCList& ls, void* ptr,std::function<void(void*)> destroy)
|
||||
{
|
||||
TNative* native = new TNative(ptr,destroy);
|
||||
GC* gc = ls.GetGC();
|
||||
std::shared_ptr<GC> gc = ls.GetGC();
|
||||
ls.Add(native);
|
||||
gc->Watch(native);
|
||||
return native;
|
||||
@@ -62,7 +62,7 @@ namespace Tesses::CrossLang
|
||||
TNative* TNative::Create(GCList* ls, void* ptr,std::function<void(void*)> destroy)
|
||||
{
|
||||
TNative* native = new TNative(ptr,destroy);
|
||||
GC* gc = ls->GetGC();
|
||||
std::shared_ptr<GC> gc = ls->GetGC();
|
||||
ls->Add(native);
|
||||
gc->Watch(native);
|
||||
return native;
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
#include "CrossLang.hpp"
|
||||
|
||||
namespace Tesses::CrossLang
|
||||
{
|
||||
RelativeFilesystem::RelativeFilesystem(std::shared_ptr<Tesses::Framework::Filesystem::VFS> vfs, Tesses::Framework::Filesystem::VFSPath working)
|
||||
{
|
||||
this->vfs = vfs;
|
||||
this->path = working;
|
||||
}
|
||||
std::shared_ptr<Tesses::Framework::Streams::Stream> RelativeFilesystem::OpenFile(Tesses::Framework::Filesystem::VFSPath path, std::string mode)
|
||||
{
|
||||
if(path.relative)
|
||||
{
|
||||
return this->vfs->OpenFile(path.MakeAbsolute(GetWorking()), mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
return this->vfs->OpenFile(path,mode);
|
||||
}
|
||||
}
|
||||
|
||||
void RelativeFilesystem::CreateDirectory(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
if(path.relative)
|
||||
{
|
||||
this->vfs->CreateDirectory(path.MakeAbsolute(GetWorking()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->vfs->CreateDirectory(path);
|
||||
}
|
||||
}
|
||||
void RelativeFilesystem::DeleteDirectory(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
if(path.relative)
|
||||
{
|
||||
this->vfs->DeleteDirectory(path.MakeAbsolute(GetWorking()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->vfs->DeleteDirectory(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RelativeFilesystem::DeleteFile(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
if(path.relative)
|
||||
{
|
||||
this->vfs->DeleteFile(path.MakeAbsolute(GetWorking()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->vfs->DeleteFile(path);
|
||||
}
|
||||
}
|
||||
void RelativeFilesystem::CreateSymlink(Tesses::Framework::Filesystem::VFSPath existingFile, Tesses::Framework::Filesystem::VFSPath symlinkFile)
|
||||
{
|
||||
if(symlinkFile.relative)
|
||||
{
|
||||
this->vfs->CreateSymlink(existingFile,symlinkFile.MakeAbsolute(GetWorking()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->vfs->CreateSymlink(existingFile, symlinkFile);
|
||||
}
|
||||
}
|
||||
Tesses::Framework::Filesystem::VFSPathEnumerator RelativeFilesystem::EnumeratePaths(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
if(path.relative)
|
||||
{
|
||||
return this->vfs->EnumeratePaths(path.MakeAbsolute(GetWorking()));
|
||||
}
|
||||
else
|
||||
{
|
||||
return this->vfs->EnumeratePaths(path);
|
||||
}
|
||||
}
|
||||
void RelativeFilesystem::CreateHardlink(Tesses::Framework::Filesystem::VFSPath existingFile, Tesses::Framework::Filesystem::VFSPath newName)
|
||||
{
|
||||
auto working = GetWorking();
|
||||
if(existingFile.relative)
|
||||
{
|
||||
existingFile = existingFile.MakeAbsolute(working);
|
||||
existingFile = existingFile.CollapseRelativeParents();
|
||||
}
|
||||
|
||||
if(newName.relative)
|
||||
{
|
||||
newName = newName.MakeAbsolute(working);
|
||||
newName = newName.CollapseRelativeParents();
|
||||
}
|
||||
|
||||
this->vfs->CreateHardlink(existingFile, newName);
|
||||
}
|
||||
|
||||
void RelativeFilesystem::MoveFile(Tesses::Framework::Filesystem::VFSPath src, Tesses::Framework::Filesystem::VFSPath dest)
|
||||
{
|
||||
auto working = GetWorking();
|
||||
if(src.relative)
|
||||
{
|
||||
src = src.MakeAbsolute(working);
|
||||
src = src.CollapseRelativeParents();
|
||||
}
|
||||
|
||||
if(dest.relative)
|
||||
{
|
||||
dest = dest.MakeAbsolute(working);
|
||||
dest = dest.CollapseRelativeParents();
|
||||
}
|
||||
|
||||
this->vfs->MoveFile(src, dest);
|
||||
}
|
||||
|
||||
void RelativeFilesystem::MoveDirectory(Tesses::Framework::Filesystem::VFSPath src, Tesses::Framework::Filesystem::VFSPath dest)
|
||||
{
|
||||
|
||||
auto working = GetWorking();
|
||||
if(src.relative)
|
||||
{
|
||||
src = src.MakeAbsolute(working);
|
||||
src = src.CollapseRelativeParents();
|
||||
}
|
||||
|
||||
if(dest.relative)
|
||||
{
|
||||
dest = dest.MakeAbsolute(working);
|
||||
dest = dest.CollapseRelativeParents();
|
||||
}
|
||||
|
||||
this->vfs->MoveFile(src, dest);
|
||||
}
|
||||
Tesses::Framework::Filesystem::VFSPath RelativeFilesystem::ReadLink(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
if(path.relative)
|
||||
{
|
||||
return this->vfs->ReadLink(path.MakeAbsolute(GetWorking()));
|
||||
}
|
||||
else
|
||||
{
|
||||
return this->vfs->ReadLink(path);
|
||||
}
|
||||
}
|
||||
std::string RelativeFilesystem::VFSPathToSystem(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
return this->vfs->VFSPathToSystem(path);
|
||||
}
|
||||
Tesses::Framework::Filesystem::VFSPath RelativeFilesystem::SystemToVFSPath(std::string path)
|
||||
{
|
||||
return this->vfs->SystemToVFSPath(path);
|
||||
}
|
||||
|
||||
void RelativeFilesystem::SetDate(Tesses::Framework::Filesystem::VFSPath path, Tesses::Framework::Date::DateTime lastWrite, Tesses::Framework::Date::DateTime lastAccess)
|
||||
{
|
||||
if(path.relative)
|
||||
{
|
||||
this->vfs->SetDate(path.MakeAbsolute(GetWorking()), lastWrite,lastAccess);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->vfs->SetDate(path,lastWrite,lastAccess);
|
||||
}
|
||||
}
|
||||
bool RelativeFilesystem::Stat(Tesses::Framework::Filesystem::VFSPath path, Tesses::Framework::Filesystem::StatData& stat)
|
||||
{
|
||||
if(path.relative)
|
||||
{
|
||||
return this->vfs->Stat(path.MakeAbsolute(GetWorking()), stat);
|
||||
}
|
||||
else
|
||||
{
|
||||
return this->vfs->Stat(path,stat);
|
||||
}
|
||||
}
|
||||
bool RelativeFilesystem::StatVFS(Tesses::Framework::Filesystem::VFSPath path, Tesses::Framework::Filesystem::StatVFSData& vfsData)
|
||||
{
|
||||
if(path.relative)
|
||||
{
|
||||
return this->vfs->StatVFS(path.MakeAbsolute(GetWorking()), vfsData);
|
||||
}
|
||||
else
|
||||
{
|
||||
return this->vfs->StatVFS(path,vfsData);
|
||||
}
|
||||
}
|
||||
|
||||
void RelativeFilesystem::Chmod(Tesses::Framework::Filesystem::VFSPath path, uint32_t mode)
|
||||
{
|
||||
if(path.relative)
|
||||
{
|
||||
this->vfs->Chmod(path.MakeAbsolute(GetWorking()), mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->vfs->Chmod(path,mode);
|
||||
}
|
||||
}
|
||||
void RelativeFilesystem::Chown(Tesses::Framework::Filesystem::VFSPath path, uint32_t uid, uint32_t gid)
|
||||
{
|
||||
if(path.relative)
|
||||
{
|
||||
this->vfs->Chown(path.MakeAbsolute(GetWorking()), uid, gid);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->vfs->Chown(path,uid,gid);
|
||||
}
|
||||
}
|
||||
|
||||
void RelativeFilesystem::Lock(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
if(path.relative)
|
||||
{
|
||||
this->vfs->Lock(path.MakeAbsolute(GetWorking()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->vfs->Lock(path);
|
||||
}
|
||||
}
|
||||
void RelativeFilesystem::Unlock(Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
if(path.relative)
|
||||
{
|
||||
this->vfs->Unlock(path.MakeAbsolute(GetWorking()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->vfs->Unlock(path);
|
||||
}
|
||||
}
|
||||
|
||||
Tesses::Framework::Filesystem::FIFOCreationResult RelativeFilesystem::CreateFIFO(Tesses::Framework::Filesystem::VFSPath path, uint32_t mod)
|
||||
{
|
||||
if(path.relative)
|
||||
{
|
||||
return this->vfs->CreateFIFO(path.MakeAbsolute(GetWorking()), mod);
|
||||
}
|
||||
else
|
||||
{
|
||||
return this->vfs->CreateFIFO(path, mod);
|
||||
}
|
||||
}
|
||||
Tesses::Framework::Filesystem::VFSPath RelativeFilesystem::GetWorking()
|
||||
{
|
||||
mtx.Lock();
|
||||
auto path = this->path;
|
||||
mtx.Unlock();
|
||||
return path;
|
||||
}
|
||||
void RelativeFilesystem::SetWorking(Tesses::Framework::Filesystem::VFSPath working)
|
||||
{
|
||||
mtx.Lock();
|
||||
this->path = working;
|
||||
mtx.Unlock();
|
||||
}
|
||||
std::shared_ptr<Tesses::Framework::Filesystem::VFS> RelativeFilesystem::GetVFS()
|
||||
{
|
||||
return this->vfs;
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<Tesses::Framework::Filesystem::FSWatcher> RelativeFilesystem::CreateWatcher(std::shared_ptr<Tesses::Framework::Filesystem::VFS> vfs, Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
if(path.relative)
|
||||
{
|
||||
return Tesses::Framework::Filesystem::FSWatcher::Create(vfs, path.MakeAbsolute(GetWorking()));
|
||||
}
|
||||
else
|
||||
{
|
||||
return Tesses::Framework::Filesystem::FSWatcher::Create(vfs,path);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -86,7 +86,7 @@ namespace Tesses::CrossLang {
|
||||
return value;
|
||||
}
|
||||
|
||||
void TRootEnvironment::LoadDependency(GC* gc,std::shared_ptr<Tesses::Framework::Filesystem::VFS> vfs, std::pair<std::string,TVMVersion> dep)
|
||||
void TRootEnvironment::LoadDependency(std::shared_ptr<GC> gc,std::shared_ptr<Tesses::Framework::Filesystem::VFS> vfs, std::pair<std::string,TVMVersion> dep)
|
||||
{
|
||||
for(auto item : this->dependencies)
|
||||
if(item.first == dep.first && item.second.CompareTo(dep.second) >= 0) return;
|
||||
@@ -129,7 +129,7 @@ namespace Tesses::CrossLang {
|
||||
f->Load(ls.GetGC(),ms);
|
||||
return this->LoadFile(ls.GetGC(), f);
|
||||
}
|
||||
TDictionary* TEnvironment::EnsureDictionary(GC* gc, std::string key)
|
||||
TDictionary* TEnvironment::EnsureDictionary(std::shared_ptr<GC> gc, std::string key)
|
||||
{
|
||||
TObject item = this->GetVariable(key);
|
||||
TDictionary* dict;
|
||||
@@ -139,7 +139,7 @@ namespace Tesses::CrossLang {
|
||||
this->DeclareVariable(key, dict);
|
||||
return dict;
|
||||
}
|
||||
void TEnvironment::DeclareVariable(GC* gc, std::vector<std::string> name, TObject o)
|
||||
void TEnvironment::DeclareVariable(std::shared_ptr<GC> gc, std::vector<std::string> name, TObject o)
|
||||
{
|
||||
if(name.size() == 0)
|
||||
throw VMException("name can't be empty.");
|
||||
@@ -209,7 +209,7 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
}
|
||||
|
||||
TObject TEnvironment::LoadFile(GC* gc, TFile* file)
|
||||
TObject TEnvironment::LoadFile(std::shared_ptr<GC> gc, TFile* file)
|
||||
{
|
||||
file->EnsureCanRunInCrossLang();
|
||||
for(size_t i = 0; i < file->classes.size(); i++)
|
||||
@@ -266,7 +266,7 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
void TRootEnvironment::LoadFileWithDependencies(GC* gc,std::shared_ptr<Tesses::Framework::Filesystem::VFS> vfs, TFile* file)
|
||||
void TRootEnvironment::LoadFileWithDependencies(std::shared_ptr<GC> gc,std::shared_ptr<Tesses::Framework::Filesystem::VFS> vfs, TFile* file)
|
||||
{
|
||||
this->dependencies.push_back(std::pair<std::string,TVMVersion>(file->name,file->version));
|
||||
for(auto item : file->dependencies)
|
||||
@@ -276,7 +276,7 @@ namespace Tesses::CrossLang {
|
||||
LoadFile(gc, file);
|
||||
|
||||
}
|
||||
void TRootEnvironment::LoadFileWithDependencies(GC* gc,std::shared_ptr<Tesses::Framework::Filesystem::VFS> vfs, Tesses::Framework::Filesystem::VFSPath path)
|
||||
void TRootEnvironment::LoadFileWithDependencies(std::shared_ptr<GC> gc,std::shared_ptr<Tesses::Framework::Filesystem::VFS> vfs, Tesses::Framework::Filesystem::VFSPath path)
|
||||
{
|
||||
|
||||
|
||||
@@ -344,7 +344,7 @@ namespace Tesses::CrossLang {
|
||||
TRootEnvironment* TRootEnvironment::Create(GCList* gc,TDictionary* dict)
|
||||
{
|
||||
TRootEnvironment* env=new TRootEnvironment(dict);
|
||||
GC* _gc = gc->GetGC();
|
||||
std::shared_ptr<GC> _gc = gc->GetGC();
|
||||
gc->Add(env);
|
||||
_gc->Watch(env);
|
||||
return env;
|
||||
@@ -352,13 +352,13 @@ namespace Tesses::CrossLang {
|
||||
TRootEnvironment* TRootEnvironment::Create(GCList& gc,TDictionary* dict)
|
||||
{
|
||||
TRootEnvironment* env=new TRootEnvironment(dict);
|
||||
GC* _gc = gc.GetGC();
|
||||
std::shared_ptr<GC> _gc = gc.GetGC();
|
||||
gc.Add(env);
|
||||
_gc->Watch(env);
|
||||
return env;
|
||||
}
|
||||
|
||||
bool TRootEnvironment::HandleException(GC* gc,TEnvironment* env, TObject err)
|
||||
bool TRootEnvironment::HandleException(std::shared_ptr<GC> gc,TEnvironment* env, TObject err)
|
||||
{
|
||||
if(error != nullptr)
|
||||
{
|
||||
@@ -373,7 +373,7 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool TRootEnvironment::HandleBreakpoint(GC* gc,TEnvironment* env, TObject err)
|
||||
bool TRootEnvironment::HandleBreakpoint(std::shared_ptr<GC> gc,TEnvironment* env, TObject err)
|
||||
{
|
||||
if(error != nullptr)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Tesses::CrossLang
|
||||
{
|
||||
return Tesses::Framework::Streams::Stream::GetLength();
|
||||
}
|
||||
TObjectStream::TObjectStream(GC* gc, TObject obj)
|
||||
TObjectStream::TObjectStream(std::shared_ptr<GC> gc, TObject obj)
|
||||
{
|
||||
this->ls = new GCList(gc);
|
||||
this->ls->Add(obj);
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace Tesses::CrossLang {
|
||||
{
|
||||
auto dict=TDictionary::Create(gc);
|
||||
TSubEnvironment* sEnv = this->GetSubEnvironment(dict);
|
||||
GC* _gc = gc->GetGC();
|
||||
std::shared_ptr<GC> _gc = gc->GetGC();
|
||||
gc->Add(sEnv);
|
||||
_gc->Watch(sEnv);
|
||||
return sEnv;
|
||||
@@ -189,7 +189,7 @@ namespace Tesses::CrossLang {
|
||||
{
|
||||
auto dict=TDictionary::Create(gc);
|
||||
TSubEnvironment* sEnv = this->GetSubEnvironment(dict);
|
||||
GC* _gc = gc.GetGC();
|
||||
std::shared_ptr<GC> _gc = gc.GetGC();
|
||||
gc.Add(sEnv);
|
||||
_gc->Watch(sEnv);
|
||||
return sEnv;
|
||||
@@ -197,7 +197,7 @@ namespace Tesses::CrossLang {
|
||||
TSubEnvironment* TSubEnvironment::Create(GCList* gc, TEnvironment* env, TDictionary* dict)
|
||||
{
|
||||
TSubEnvironment* senv = new TSubEnvironment(env,dict);
|
||||
GC* _gc = gc->GetGC();
|
||||
std::shared_ptr<GC> _gc = gc->GetGC();
|
||||
gc->Add(senv);
|
||||
_gc->Watch(senv);
|
||||
return senv;
|
||||
@@ -205,7 +205,7 @@ namespace Tesses::CrossLang {
|
||||
TSubEnvironment* TSubEnvironment::Create(GCList& gc, TEnvironment* env, TDictionary* dict)
|
||||
{
|
||||
TSubEnvironment* senv = new TSubEnvironment(env,dict);
|
||||
GC* _gc = gc.GetGC();
|
||||
std::shared_ptr<GC> _gc = gc.GetGC();
|
||||
gc.Add(senv);
|
||||
_gc->Watch(senv);
|
||||
return senv;
|
||||
@@ -227,32 +227,20 @@ namespace Tesses::CrossLang {
|
||||
this->env->Mark();
|
||||
for(auto defer : defers) defer->Mark();
|
||||
}
|
||||
void TEnvironment::DeclareFunction(GC* gc,std::string key,std::string documentation, std::vector<std::string> argNames, std::function<TObject(GCList& ls, std::vector<TObject> args)> cb)
|
||||
void TEnvironment::DeclareFunction(std::shared_ptr<GC> gc,std::string key,std::string documentation, std::vector<std::string> argNames, std::function<TObject(GCList& ls, std::vector<TObject> args)> cb)
|
||||
{
|
||||
gc->BarrierBegin();
|
||||
GCList ls(gc);
|
||||
this->DeclareVariable(key, TExternalMethod::Create(ls,documentation,argNames,cb));
|
||||
gc->BarrierEnd();
|
||||
}
|
||||
void TEnvironment::DeclareFunction(GC& gc,std::string key,std::string documentation, std::vector<std::string> argNames, std::function<TObject(GCList& ls, std::vector<TObject> args)> cb)
|
||||
{
|
||||
gc.BarrierBegin();
|
||||
GCList ls(gc);
|
||||
this->DeclareVariable(key, TExternalMethod::Create(ls,documentation,argNames,cb));
|
||||
gc.BarrierEnd();
|
||||
}
|
||||
void TEnvironment::DeclareFunction(GC* gc,std::string key,std::string documentation, std::vector<std::string> argNames, std::function<TObject(GCList& ls, std::vector<TObject> args)> cb,std::function<void()> destroy)
|
||||
|
||||
void TEnvironment::DeclareFunction(std::shared_ptr<GC> gc,std::string key,std::string documentation, std::vector<std::string> argNames, std::function<TObject(GCList& ls, std::vector<TObject> args)> cb,std::function<void()> destroy)
|
||||
{
|
||||
gc->BarrierBegin();
|
||||
GCList ls(gc);
|
||||
this->DeclareVariable(key, TExternalMethod::Create(ls,documentation,argNames,cb,destroy));
|
||||
gc->BarrierEnd();
|
||||
}
|
||||
void TEnvironment::DeclareFunction(GC& gc,std::string key,std::string documentation, std::vector<std::string> argNames, std::function<TObject(GCList& ls, std::vector<TObject> args)> cb,std::function<void()> destroy)
|
||||
{
|
||||
gc.BarrierBegin();
|
||||
GCList ls(gc);
|
||||
this->DeclareVariable(key, TExternalMethod::Create(ls,documentation,argNames,cb,destroy));
|
||||
gc.BarrierEnd();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Tesses::CrossLang {
|
||||
|
||||
TObjectVFS::TObjectVFS(GC* gc, TObject obj)
|
||||
TObjectVFS::TObjectVFS(std::shared_ptr<GC> gc, TObject obj)
|
||||
{
|
||||
this->ls = new GCList(gc);
|
||||
this->ls->Add(obj);
|
||||
|
||||
Reference in New Issue
Block a user