mirror of
https://onedev.site.tesses.net/crosslang
synced 2026-02-08 17:15:45 +00:00
Add custom console and allow runtimes to set the config dir
This commit is contained in:
@@ -266,7 +266,8 @@ namespace Tesses::CrossLang
|
||||
TClassObject* co;
|
||||
if(GetArgumentHeap(args, 0, co))
|
||||
{
|
||||
return TDictionary::Create(ls,
|
||||
ls.GetGC()->BarrierBegin();
|
||||
auto res= TDictionary::Create(ls,
|
||||
{
|
||||
TDItem("Name", co->name),
|
||||
TDItem("File", co->file),
|
||||
@@ -275,6 +276,8 @@ namespace Tesses::CrossLang
|
||||
TDItem("Entries", ClassInstanceToList(ls,co))
|
||||
}
|
||||
);
|
||||
ls.GetGC()->BarrierEnd();
|
||||
return res;
|
||||
}
|
||||
return nullptr;
|
||||
});
|
||||
|
||||
@@ -195,7 +195,15 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
void TStd::RegisterConsole(GC* gc,TRootEnvironment* env)
|
||||
{
|
||||
env->permissions.canRegisterConsole=true;
|
||||
env->permissions.canRegisterConsole=true;
|
||||
if(env->permissions.customConsole != nullptr)
|
||||
{
|
||||
gc->BarrierBegin();
|
||||
env->DeclareVariable("Console", env->permissions.customConsole );
|
||||
gc->BarrierEnd();
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CROSSLANG_ENABLE_TERMIOS
|
||||
tcgetattr(0, &orig_termios);
|
||||
atexit(disableRawMode);
|
||||
|
||||
@@ -13,9 +13,13 @@ namespace Tesses::CrossLang
|
||||
static char EnvPathSeperator=':';
|
||||
#endif
|
||||
|
||||
Tesses::Framework::Filesystem::VFSPath CrossLangConfigPath("");
|
||||
|
||||
|
||||
Tesses::Framework::Filesystem::VFSPath GetCrossLangConfigDir()
|
||||
{
|
||||
if(!CrossLangConfigPath.path.empty())
|
||||
return CrossLangConfigPath;
|
||||
|
||||
return SpecialFolders::GetConfig() / "Tesses" / "CrossLang";
|
||||
}
|
||||
|
||||
@@ -480,7 +480,9 @@ namespace Tesses::CrossLang
|
||||
GCList ls2(this->ls->GetGC());
|
||||
auto res = CreateDictionaryFromServerContext(ls2,&ctx);
|
||||
bool result;
|
||||
this->ls->GetGC()->BarrierBegin();
|
||||
auto callableO = clsObj->GetValue("","Handle");
|
||||
this->ls->GetGC()->BarrierEnd();
|
||||
TCallable* callable;
|
||||
if(GetObjectHeap(callableO, callable))
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Tesses::CrossLang
|
||||
if(value == "true") {
|
||||
items.push_back(std::pair<std::string,TObject>(key,true));
|
||||
} else if(value == "false") {
|
||||
items.push_back(std::pair<std::string,TObject>(key,true));
|
||||
items.push_back(std::pair<std::string,TObject>(key,false));
|
||||
} else if(value == "null") {
|
||||
items.push_back(std::pair<std::string,TObject>(key,nullptr));
|
||||
} else {
|
||||
|
||||
@@ -387,15 +387,19 @@ namespace Tesses::CrossLang
|
||||
});
|
||||
dict->DeclareFunction(gc, "getRootEnvironment","Get root environment, for reflection purposes",{},[env](GCList& ls2,std::vector<TObject> args)->TObject {return env;});
|
||||
dict->DeclareFunction(gc, "getCurrentEnvironment","Get current environment, for reflection purposes",{},VM_getCurrentEnvironment);
|
||||
dict->DeclareFunction(gc, "CreateEnvironment","Create root environment",{"$dict"},[](GCList& ls,std::vector<TObject> args)->TObject{
|
||||
dict->DeclareFunction(gc, "CreateEnvironment","Create root environment",{"$dict"},[env](GCList& ls,std::vector<TObject> args)->TObject{
|
||||
TDictionary* dict;
|
||||
if(GetArgumentHeap(args,0,dict))
|
||||
{
|
||||
return TRootEnvironment::Create(ls,dict);
|
||||
auto renv = TRootEnvironment::Create(ls,dict);
|
||||
renv->permissions.customConsole = env->permissions.customConsole;
|
||||
return renv;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRootEnvironment::Create(ls,TDictionary::Create(ls));
|
||||
auto renv = TRootEnvironment::Create(ls,TDictionary::Create(ls));
|
||||
renv->permissions.customConsole = env->permissions.customConsole;
|
||||
return renv;
|
||||
}
|
||||
});
|
||||
dict->DeclareFunction(gc, "LoadExecutable", "Load a crossvm executable",{"stream"},[](GCList& ls,std::vector<TObject> args)->TObject{
|
||||
|
||||
Reference in New Issue
Block a user