Got it working on Windows using Mingw
This commit is contained in:
parent
7e8ce5d58a
commit
7aae9fadba
|
@ -0,0 +1,2 @@
|
||||||
|
build
|
||||||
|
bin
|
|
@ -1,4 +1,5 @@
|
||||||
build
|
build
|
||||||
|
builds
|
||||||
bin
|
bin
|
||||||
*.db
|
*.db
|
||||||
*.crvm
|
*.crvm
|
||||||
|
|
|
@ -14,10 +14,9 @@ option(CROSSLANG_ENABLE_PROCESS "Enable process" ON)
|
||||||
option(CROSSLANG_ENABLE_SDL2 "Enable SDL2 (For Drawing)" ON)
|
option(CROSSLANG_ENABLE_SDL2 "Enable SDL2 (For Drawing)" ON)
|
||||||
option(CROSSLANG_ENABLE_TERMIOS "Enable termios (For changing terminal options)" ON)
|
option(CROSSLANG_ENABLE_TERMIOS "Enable termios (For changing terminal options)" ON)
|
||||||
|
|
||||||
option(CROSSLANG_ENABLE_64BIT_FILE "Allow files over 2GiB" ON)
|
|
||||||
|
|
||||||
|
|
||||||
set(JANSSON_DIR "Directory for Jansson" "")
|
set(JANSSON_DIR "Directory for Jansson" CACHE PATH "Jansson directory")
|
||||||
|
|
||||||
find_package(TessesFramework REQUIRED)
|
find_package(TessesFramework REQUIRED)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
FROM ubuntu:noble
|
||||||
|
RUN apt update -y && \
|
||||||
|
apt install -y --no-install-recommends \
|
||||||
|
libjansson-dev cmake git ca-certificates wget libmbedtls-dev g++ gcc libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev build-essential && \
|
||||||
|
apt clean -y && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN git clone https://gitea.site.tesses.net/tesses50/tesses-framework && cd tesses-framework && mkdir build && cd build && cmake -S .. -B . && make -j4 && make install && cd /tmp && rm -r /tmp/tesses-framework
|
||||||
|
COPY . /src
|
||||||
|
WORKDIR /src
|
||||||
|
RUN mkdir build && cd build && cmake -S .. -B . && make -j4 && make install && cd / && rm -r /src
|
||||||
|
WORKDIR /
|
|
@ -9,6 +9,13 @@ Tesses Cross Language
|
||||||
- CMake
|
- CMake
|
||||||
- SDL2 (but can be turned off)
|
- SDL2 (but can be turned off)
|
||||||
|
|
||||||
|
## Use in docker
|
||||||
|
```bash
|
||||||
|
git clone https://gitea.site.tesses.net/tesses50/crosslang
|
||||||
|
cd crosslang
|
||||||
|
sudo docker build -t crosslang:latest .
|
||||||
|
```
|
||||||
|
|
||||||
## To Install
|
## To Install
|
||||||
- [Follow TessesFramework setup](https://gitea.site.tesses.net/tesses50/tesses-framework)
|
- [Follow TessesFramework setup](https://gitea.site.tesses.net/tesses50/tesses-framework)
|
||||||
- Follow the commands bellow
|
- Follow the commands bellow
|
||||||
|
|
|
@ -670,7 +670,7 @@ namespace Tesses::CrossLang
|
||||||
{
|
{
|
||||||
expr = AdvancedSyntaxNode::Create(LessThanEqualsExpression, true, {expr,ParseShift()});
|
expr = AdvancedSyntaxNode::Create(LessThanEqualsExpression, true, {expr,ParseShift()});
|
||||||
}
|
}
|
||||||
else if(tkn.text == ">")
|
else if(tkn.text == ">=")
|
||||||
{
|
{
|
||||||
expr = AdvancedSyntaxNode::Create(GreaterThanEqualsExpression, true, {expr,ParseShift()});
|
expr = AdvancedSyntaxNode::Create(GreaterThanEqualsExpression, true, {expr,ParseShift()});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,22 @@
|
||||||
#include "CrossLang.hpp"
|
#include "CrossLang.hpp"
|
||||||
|
|
||||||
#include "../sago/platform_folders.h"
|
#include "../sago/platform_folders.h"
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Tesses::CrossLang
|
namespace Tesses::CrossLang
|
||||||
{
|
{
|
||||||
|
static std::string GetHomeFolder()
|
||||||
|
{
|
||||||
|
#if !defined(SAGO_DISABLE)
|
||||||
|
return sago::getHomeDir();
|
||||||
|
#elif defined(__EMSCRIPTEN__)
|
||||||
|
return "/home/web_user";
|
||||||
|
#else
|
||||||
|
return "/CrossLangProfile";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
static TObject Env_getPlatform(GCList& ls, std::vector<TObject> args)
|
static TObject Env_getPlatform(GCList& ls, std::vector<TObject> args)
|
||||||
{
|
{
|
||||||
#if defined(__SWITCH__)
|
#if defined(__SWITCH__)
|
||||||
|
@ -52,7 +65,7 @@ namespace Tesses::CrossLang
|
||||||
std::string key;
|
std::string key;
|
||||||
if(GetArgument(args,0,key))
|
if(GetArgument(args,0,key))
|
||||||
{
|
{
|
||||||
auto res = getenv(key.c_str());
|
auto res = std::getenv(key.c_str());
|
||||||
if(res == nullptr) return nullptr;
|
if(res == nullptr) return nullptr;
|
||||||
std::string value = res;
|
std::string value = res;
|
||||||
return value;
|
return value;
|
||||||
|
@ -66,57 +79,108 @@ namespace Tesses::CrossLang
|
||||||
if(GetArgument(args,0,key))
|
if(GetArgument(args,0,key))
|
||||||
{
|
{
|
||||||
if(GetArgument(args,1,value))
|
if(GetArgument(args,1,value))
|
||||||
setenv(key.c_str(), value.c_str(),1);
|
#if defined(_WIN32)
|
||||||
|
SetEnvironmentVariable(key.c_str(),value.c_str());
|
||||||
|
#else
|
||||||
|
setenv(key.c_str(), value.c_str(),1);
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
|
#if defined(_WIN32)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
#else
|
||||||
unsetenv(key.c_str());
|
unsetenv(key.c_str());
|
||||||
|
#endif
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
static TObject Env_getDownloads(GCList& ls, std::vector<TObject> args)
|
static TObject Env_getDownloads(GCList& ls, std::vector<TObject> args)
|
||||||
{
|
{
|
||||||
|
#if !defined(SAGO_DISABLE)
|
||||||
return sago::getDownloadFolder();
|
return sago::getDownloadFolder();
|
||||||
|
#else
|
||||||
|
return GetHomeFolder() + "/Downloads";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static TObject Env_getMusic(GCList& ls, std::vector<TObject> args)
|
static TObject Env_getMusic(GCList& ls, std::vector<TObject> args)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if !defined(SAGO_DISABLE)
|
||||||
return sago::getMusicFolder();
|
return sago::getMusicFolder();
|
||||||
|
#else
|
||||||
|
return GetHomeFolder() + "/Music";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static TObject Env_getPictures(GCList& ls, std::vector<TObject> args)
|
static TObject Env_getPictures(GCList& ls, std::vector<TObject> args)
|
||||||
{
|
{
|
||||||
return sago::getMusicFolder();
|
#if !defined(SAGO_DISABLE)
|
||||||
|
return sago::getPicturesFolder();
|
||||||
|
#else
|
||||||
|
return GetHomeFolder() + "/Pictures";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static TObject Env_getVideos(GCList& ls, std::vector<TObject> args)
|
static TObject Env_getVideos(GCList& ls, std::vector<TObject> args)
|
||||||
{
|
{
|
||||||
|
#if !defined(SAGO_DISABLE)
|
||||||
return sago::getVideoFolder();
|
return sago::getVideoFolder();
|
||||||
|
#else
|
||||||
|
return GetHomeFolder() + "/Videos";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static TObject Env_getDocuments(GCList& ls, std::vector<TObject> args)
|
static TObject Env_getDocuments(GCList& ls, std::vector<TObject> args)
|
||||||
{
|
{
|
||||||
|
#if !defined(SAGO_DISABLE)
|
||||||
return sago::getDocumentsFolder();
|
return sago::getDocumentsFolder();
|
||||||
|
#else
|
||||||
|
return GetHomeFolder() + "/Documents";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static TObject Env_getConfig(GCList& ls, std::vector<TObject> args)
|
static TObject Env_getConfig(GCList& ls, std::vector<TObject> args)
|
||||||
{
|
{
|
||||||
|
#if !defined(SAGO_DISABLE)
|
||||||
return sago::getConfigHome();
|
return sago::getConfigHome();
|
||||||
|
#else
|
||||||
|
return GetHomeFolder() + "/Config";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static TObject Env_getDesktop(GCList& ls, std::vector<TObject> args)
|
static TObject Env_getDesktop(GCList& ls, std::vector<TObject> args)
|
||||||
{
|
{
|
||||||
|
#if !defined(SAGO_DISABLE)
|
||||||
return sago::getDesktopFolder();
|
return sago::getDesktopFolder();
|
||||||
|
#else
|
||||||
|
return GetHomeFolder() + "/Desktop";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static TObject Env_getState(GCList& ls, std::vector<TObject> args)
|
static TObject Env_getState(GCList& ls, std::vector<TObject> args)
|
||||||
{
|
{
|
||||||
|
#if !defined(SAGO_DISABLE)
|
||||||
return sago::getStateDir();
|
return sago::getStateDir();
|
||||||
|
#else
|
||||||
|
return GetHomeFolder() + "/State";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static TObject Env_getCache(GCList& ls, std::vector<TObject> args)
|
static TObject Env_getCache(GCList& ls, std::vector<TObject> args)
|
||||||
{
|
{
|
||||||
|
#if !defined(SAGO_DISABLE)
|
||||||
return sago::getCacheDir();
|
return sago::getCacheDir();
|
||||||
|
#else
|
||||||
|
return GetHomeFolder() + "/Cache";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static TObject Env_getData(GCList& ls, std::vector<TObject> args)
|
static TObject Env_getData(GCList& ls, std::vector<TObject> args)
|
||||||
{
|
{
|
||||||
|
#if !defined(SAGA_DISABLE)
|
||||||
return sago::getDataHome();
|
return sago::getDataHome();
|
||||||
|
#else
|
||||||
|
return GetHomeFolder() + "/Data";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static TObject Env_getUser(GCList& ls, std::vector<TObject> args)
|
static TObject Env_getUser(GCList& ls, std::vector<TObject> args)
|
||||||
{
|
{
|
||||||
return sago::getHomeDir();
|
return GetHomeFolder();
|
||||||
}
|
}
|
||||||
void TStd::RegisterEnv(GC* gc, TRootEnvironment* env)
|
void TStd::RegisterEnv(GC* gc, TRootEnvironment* env)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
#include "CrossLang.hpp"
|
#include "CrossLang.hpp"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <netinet/tcp.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
using namespace Tesses::Framework::Streams;
|
using namespace Tesses::Framework::Streams;
|
||||||
|
|
|
@ -26,6 +26,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Modified by Mike Nolan for this project
|
||||||
|
I modified it to return home directory and conditionally compile for systems that are not GEKKO / NX etc
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(SAGO_DISABLE)
|
||||||
#include "platform_folders.h"
|
#include "platform_folders.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
@ -218,7 +224,12 @@ std::string getDataHome() {
|
||||||
}
|
}
|
||||||
std::string getHomeDir()
|
std::string getHomeDir()
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
|
||||||
|
return GetKnownWindowsFolder(FOLDERID_Profile, "Profile could not be found");
|
||||||
|
#else
|
||||||
return getHome();
|
return getHome();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
std::string getConfigHome() {
|
std::string getConfigHome() {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -458,3 +469,4 @@ std::string getSaveGamesFolder2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
} //namespace sago
|
} //namespace sago
|
||||||
|
#endif
|
||||||
|
|
|
@ -26,9 +26,25 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Modified by Mike Nolan for this project
|
||||||
|
I modified it to return home directory and conditionally compile for systems that are not GEKKO / NX etc
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef SAGO_PLATFORM_FOLDERS_H
|
#ifndef SAGO_PLATFORM_FOLDERS_H
|
||||||
#define SAGO_PLATFORM_FOLDERS_H
|
#define SAGO_PLATFORM_FOLDERS_H
|
||||||
|
|
||||||
|
#if defined(GEKKO) || defined(__SWITCH__) || defined(__EMSCRIPTEN__)
|
||||||
|
#define SAGO_DISABLE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(SAGO_DISABLE)
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -285,5 +301,5 @@ private:
|
||||||
|
|
||||||
|
|
||||||
} //namespace sago
|
} //namespace sago
|
||||||
|
#endif
|
||||||
#endif /* PLATFORM_FOLDERS_H */
|
#endif /* PLATFORM_FOLDERS_H */
|
||||||
|
|
|
@ -919,7 +919,7 @@ namespace Tesses::CrossLang {
|
||||||
|
|
||||||
if(std::holds_alternative<int64_t>(left) && std::holds_alternative<int64_t>(right))
|
if(std::holds_alternative<int64_t>(left) && std::holds_alternative<int64_t>(right))
|
||||||
{
|
{
|
||||||
cse.back()->Push(gc,std::get<int64_t>(left) || std::get<int64_t>(right));
|
cse.back()->Push(gc,std::get<int64_t>(left) | std::get<int64_t>(right));
|
||||||
}
|
}
|
||||||
else if(std::holds_alternative<THeapObjectHolder>(left))
|
else if(std::holds_alternative<THeapObjectHolder>(left))
|
||||||
{
|
{
|
||||||
|
@ -928,7 +928,7 @@ namespace Tesses::CrossLang {
|
||||||
if(dict != nullptr)
|
if(dict != nullptr)
|
||||||
{
|
{
|
||||||
gc->BarrierBegin();
|
gc->BarrierBegin();
|
||||||
TObject fn = dict->GetValue("operator||");
|
TObject fn = dict->GetValue("operator|");
|
||||||
gc->BarrierEnd();
|
gc->BarrierEnd();
|
||||||
return InvokeTwo(ls,fn,left,right);
|
return InvokeTwo(ls,fn,left,right);
|
||||||
}
|
}
|
||||||
|
@ -989,7 +989,7 @@ namespace Tesses::CrossLang {
|
||||||
|
|
||||||
if(std::holds_alternative<int64_t>(left) && std::holds_alternative<int64_t>(right))
|
if(std::holds_alternative<int64_t>(left) && std::holds_alternative<int64_t>(right))
|
||||||
{
|
{
|
||||||
cse.back()->Push(gc,std::get<int64_t>(left) && std::get<int64_t>(right));
|
cse.back()->Push(gc,std::get<int64_t>(left) & std::get<int64_t>(right));
|
||||||
}
|
}
|
||||||
else if(std::holds_alternative<THeapObjectHolder>(left))
|
else if(std::holds_alternative<THeapObjectHolder>(left))
|
||||||
{
|
{
|
||||||
|
@ -998,7 +998,7 @@ namespace Tesses::CrossLang {
|
||||||
if(dict != nullptr)
|
if(dict != nullptr)
|
||||||
{
|
{
|
||||||
gc->BarrierBegin();
|
gc->BarrierBegin();
|
||||||
TObject fn = dict->GetValue("operator&&");
|
TObject fn = dict->GetValue("operator&");
|
||||||
gc->BarrierEnd();
|
gc->BarrierEnd();
|
||||||
return InvokeTwo(ls,fn,left,right);
|
return InvokeTwo(ls,fn,left,right);
|
||||||
}
|
}
|
||||||
|
@ -3597,6 +3597,7 @@ namespace Tesses::CrossLang {
|
||||||
break;
|
break;
|
||||||
case RIGHTSHIFT:
|
case RIGHTSHIFT:
|
||||||
TVM_HANDLER(RShift);
|
TVM_HANDLER(RShift);
|
||||||
|
break;
|
||||||
case LESSTHAN:
|
case LESSTHAN:
|
||||||
TVM_HANDLER(Lt);
|
TVM_HANDLER(Lt);
|
||||||
break;
|
break;
|
||||||
|
@ -4179,19 +4180,9 @@ namespace Tesses::CrossLang {
|
||||||
auto dict = dynamic_cast<TDictionary*>(obj);
|
auto dict = dynamic_cast<TDictionary*>(obj);
|
||||||
if(dict != nullptr)
|
if(dict != nullptr)
|
||||||
{
|
{
|
||||||
gc->BarrierBegin();
|
GCList ls(gc);
|
||||||
auto v = dict->GetValue("ToString");
|
return ToString(gc,dict->CallMethod(ls,"ToString",{}));
|
||||||
gc->BarrierEnd();
|
|
||||||
if(std::holds_alternative<THeapObjectHolder>(v))
|
|
||||||
{
|
|
||||||
auto callable=dynamic_cast<TCallable*>(std::get<THeapObjectHolder>(v).obj);
|
|
||||||
if(callable != nullptr)
|
|
||||||
{
|
|
||||||
GCList ls(gc);
|
|
||||||
auto res = callable->Call(ls,{});
|
|
||||||
return ToString(gc,res);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue