First commit

This commit is contained in:
2024-12-28 14:38:00 -06:00
commit 9c27f339be
56 changed files with 289761 additions and 0 deletions

31
src/crosslangvm.cpp Normal file
View File

@ -0,0 +1,31 @@
#include "CrossLang.hpp"
#include <mbedtls/error.h>
using namespace Tesses::Framework;
using namespace Tesses::CrossLang;
int main(int argc, char** argv)
{
TF_Init();
if(argc < 2)
{
printf("USAGE: %s <filename.crvm> <args...>\n",argv[0]);
return 1;
}
GC gc;
gc.Start();
GCList ls(gc);
TRootEnvironment* env = TRootEnvironment::Create(ls, TDictionary::Create(ls));
Tesses::Framework::Filesystem::LocalFilesystem fs;
env->LoadFileWithDependencies(&gc, &fs, fs.SystemToVFSPath(argv[1]));
TStd::RegisterStd(&gc,env);
TList* args = TList::Create(ls);
for(int arg=1;arg<argc;arg++)
args->Add(std::string(argv[arg]));
auto res = env->CallFunction(ls,"main",{args});
int64_t iresult;
if(GetObject(res,iresult))
return (int)iresult;
return 0;
}