Push to git

This commit is contained in:
2025-01-08 09:59:16 -06:00
parent 36d985cc57
commit dad571f169
28 changed files with 983 additions and 181 deletions

View File

@ -64,7 +64,7 @@ namespace Tesses::CrossLang
else{
uint8_t* buffer=new uint8_t[len];
Ensure(stream,buffer,len);
delete buffer;
delete[] buffer;
}
}
void TFile::Ensure(Tesses::Framework::Streams::Stream* stream, uint8_t* buffer,size_t len)
@ -196,4 +196,4 @@ namespace Tesses::CrossLang
}
}
}

View File

@ -4,9 +4,13 @@
#include <unistd.h>
#if defined(CROSSLANG_ENABLE_SQLITE)
extern "C" {
#include "../sqlite/sqlite3.h"
}
#if defined(GEKKO)
extern sqlite3_vfs *sqlite3_demovfs(void);
extern "C" {
sqlite3_vfs *sqlite3_demovfs();
}
#endif
#endif
using namespace Tesses::Framework::Threading;
@ -24,7 +28,7 @@ namespace Tesses::CrossLang
GC::GC()
{
#if defined(CROSSLANG_ENABLE_SQLITE)
sqlite3_initialize();
sqlite3_initialize();
#if defined(GEKKO)
sqlite3_vfs_register(sqlite3_demovfs(),1);
#endif
@ -104,15 +108,16 @@ namespace Tesses::CrossLang
this_frame = system_clock::now();
if((this_frame - last_frame) > 10s)
{
last_frame = this_frame;
this->Collect();
usleep(1000000);
}
usleep(10000);
}
GC::Collect();
});
@ -245,4 +250,4 @@ namespace Tesses::CrossLang
this->BarrierEnd();
}
};
};

View File

@ -2,6 +2,7 @@
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
namespace Tesses::CrossLang {
thread_local CallStackEntry* current_function=nullptr;
@ -156,7 +157,9 @@ namespace Tesses::CrossLang {
}
return true;
}
else {
this->call_stack_entries.back()->Push(ls.GetGC(),Undefined());
}
}
return false;
}
@ -1318,7 +1321,7 @@ namespace Tesses::CrossLang {
}
if(key == "ToLongBits")
{
cse.back()->Push(gc, std::bit_cast<int64_t>(number));
cse.back()->Push(gc, *(int64_t*)&number);
return false;
}
if(key == "Floor")
@ -1468,7 +1471,7 @@ namespace Tesses::CrossLang {
}
if(key == "ToDoubleBits")
{
cse.back()->Push(gc,std::bit_cast<double>(number));
cse.back()->Push(gc,*(double*)&number);
return false;
}
@ -1523,6 +1526,26 @@ namespace Tesses::CrossLang {
cse.back()->Push(gc, path.GetFileName());
return false;
}
if(key == "GetExtension")
{
cse.back()->Push(gc, path.GetExtension());
return false;
}
if(key == "ChangeExtension")
{
Tesses::Framework::Filesystem::VFSPath newPath = path;
std::string ext;
if(GetArgument(args,0, ext))
{
newPath.ChangeExtension(ext);
}
else
{
newPath.RemoveExtension();
}
cse.back()->Push(gc, newPath);
return false;
}
if(key == "CollapseRelativeParents")
{
cse.back()->Push(gc, path.CollapseRelativeParents());
@ -1655,21 +1678,21 @@ namespace Tesses::CrossLang {
std::string oldStr;
std::string newStr;
std::string str={};
std::string _str={};
if(GetArgument(args,0,oldStr) && GetArgument(args,1,newStr))
{
bool first=true;
for(auto txt : Tesses::Framework::Http::HttpUtils::SplitString(str,oldStr))
{
if(!first) str.append(newStr);
if(!first) _str.append(newStr);
first=false;
str.append(txt);
_str.append(txt);
}
}
cse.back()->Push(gc,str);
cse.back()->Push(gc,_str);
return false;
}
@ -1777,7 +1800,7 @@ namespace Tesses::CrossLang {
TStd::RegisterDictionary(gc, rootEnv);
if(myEnv->permissions.canRegisterEnv && !rootEnv->permissions.locked)
TStd::RegisterDictionary(gc, rootEnv);
TStd::RegisterEnv(gc, rootEnv);
if(myEnv->permissions.canRegisterIO && !rootEnv->permissions.locked)