From 50dbb12a304d9ed4db7912169a2788505c4de157 Mon Sep 17 00:00:00 2001 From: YairBybabayov Date: Sun, 11 Aug 2024 11:35:00 +0300 Subject: [PATCH 1/3] ELENAVM : display if VM is 32 or 64 bit on Windows? #680 --- elenasrc3/elenavm/elenavmmachine.cpp | 12 ++++++++++-- elenasrc3/elenavm/elenavmmachine.h | 2 ++ elenasrc3/elenavm/vmcommon.h | 2 +- elenasrc3/engine/elena.h | 2 ++ elenasrc3/engine/windows/presenter.cpp | 7 +++++++ elenasrc3/engine/windows/presenter.h | 2 ++ 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/elenasrc3/elenavm/elenavmmachine.cpp b/elenasrc3/elenavm/elenavmmachine.cpp index d23ae8b4a..0dc6a44d7 100644 --- a/elenasrc3/elenavm/elenavmmachine.cpp +++ b/elenasrc3/elenavm/elenavmmachine.cpp @@ -111,11 +111,19 @@ ELENAVMMachine :: ELENAVMMachine(path_t configPath, PresenterBase* presenter, Pl _jitLinker = nullptr; } +std::string ELENAVMMachine::getArchitecture() { +#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) + return "(64-bit)"; +#else + return "(32-bit)"; +#endif +} + void ELENAVMMachine :: init(SystemEnv* exeEnv) { assert(_initialized == false); - - _presenter->printLine(ELENAVM_GREETING, ENGINE_MAJOR_VERSION, ENGINE_MINOR_VERSION, ELENAVM_REVISION_NUMBER); + std::string architecture = getArchitecture(); + _presenter->printLine(ELENAVM_GREETING, ENGINE_MAJOR_VERSION, ENGINE_MINOR_VERSION, ELENAVM_REVISION_NUMBER, architecture); _presenter->printLine(ELENAVM_INITIALIZING); _configuration->initLoader(_libraryProvider); diff --git a/elenasrc3/elenavm/elenavmmachine.h b/elenasrc3/elenavm/elenavmmachine.h index 879d3eabe..e99149af3 100644 --- a/elenasrc3/elenavm/elenavmmachine.h +++ b/elenasrc3/elenavm/elenavmmachine.h @@ -13,6 +13,7 @@ #include "codescope.h" #include "projectbase.h" #include "xmlprojectbase.h" +#include namespace elena_lang { @@ -82,6 +83,7 @@ namespace elena_lang virtual void resumeVM(SystemEnv* env, void* criricalHandler); + std::string getArchitecture(); void init(SystemEnv* env); AddressMap::Iterator externals() override; diff --git a/elenasrc3/elenavm/vmcommon.h b/elenasrc3/elenavm/vmcommon.h index 7a440a87e..a483d256d 100644 --- a/elenasrc3/elenavm/vmcommon.h +++ b/elenasrc3/elenavm/vmcommon.h @@ -13,7 +13,7 @@ namespace elena_lang { - constexpr auto ELENAVM_GREETING = "ELENA VM %d.%d.%d (C)2022-2024 by Aleksey Rakov"; + constexpr auto ELENAVM_GREETING = "ELENA VM %d.%d.%d %s (C)2022-2024 by Aleksey Rakov"; constexpr auto ELENAVM_INITIALIZING = "Initializing..."; } diff --git a/elenasrc3/engine/elena.h b/elenasrc3/engine/elena.h index f00cc013e..68360cbc0 100644 --- a/elenasrc3/engine/elena.h +++ b/elenasrc3/engine/elena.h @@ -12,6 +12,7 @@ #include "common.h" #include "elenaconst.h" #include "section.h" +#include namespace elena_lang { @@ -656,6 +657,7 @@ namespace elena_lang virtual void printLine(ustr_t msg, int arg1) = 0; virtual void printLine(ustr_t msg, int arg1, int arg2) = 0; virtual void printLine(ustr_t msg, int arg1, int arg2, int arg3) = 0; + virtual void printLine(ustr_t msg, int arg1, int arg2, int arg3, std::string arg4) = 0; //version support print virtual void printLine(ustr_t msg, ustr_t arg1, int arg2, int arg3, ustr_t arg4) = 0; virtual void printPathLine(ustr_t msg, path_t arg) = 0; virtual void printPathLine(ustr_t msg, path_t arg1, int arg2, int arg3, ustr_t arg4) = 0; diff --git a/elenasrc3/engine/windows/presenter.cpp b/elenasrc3/engine/windows/presenter.cpp index a8447e66f..7c063a888 100644 --- a/elenasrc3/engine/windows/presenter.cpp +++ b/elenasrc3/engine/windows/presenter.cpp @@ -155,6 +155,13 @@ void WinConsolePresenter :: printLine(ustr_t msg, int arg1, int arg2, int arg3) ::printLine(wstr.str(), arg1, arg2, arg3); } +void WinConsolePresenter::printLine(ustr_t msg, int arg1, int arg2, int arg3,std::string arg4) //version support print +{ + WideMessage wstr(msg); + + ::printLine(wstr.str(), arg1, arg2, arg3, arg4.c_str()); +} + void WinConsolePresenter :: printPathLine(ustr_t msg, path_t arg1, int arg2, int arg3, ustr_t arg4) { WideMessage wstr(msg); diff --git a/elenasrc3/engine/windows/presenter.h b/elenasrc3/engine/windows/presenter.h index a10a8e57c..117cfe07d 100644 --- a/elenasrc3/engine/windows/presenter.h +++ b/elenasrc3/engine/windows/presenter.h @@ -33,6 +33,8 @@ namespace elena_lang void printLine(ustr_t msg, ustr_t arg1, ustr_t arg2) override; void printLine(ustr_t msg, ustr_t arg1, ustr_t arg2, ustr_t arg3) override; void printLine(ustr_t msg, int arg1, int arg2, int arg3) override; + void printLine(ustr_t msg, int arg1, int arg2, int arg3, std::string arg4) override; //version support print + void printPathLine(ustr_t msg, path_t arg1, int arg2, int arg3, ustr_t arg4) override; void printLine(ustr_t msg, int arg1) override; void printLine(ustr_t msg, int arg1, int arg2) override; From dc917a498e6466b97cbf2303bf79d850b61f85ef Mon Sep 17 00:00:00 2001 From: YairBybabayov Date: Sun, 11 Aug 2024 18:50:53 +0300 Subject: [PATCH 2/3] ELENAVM : display if VM is 32 or 64 bit on Windows? #680 fixed string type --- elenasrc3/elenavm/elenavmmachine.cpp | 4 ++-- elenasrc3/elenavm/elenavmmachine.h | 3 +-- elenasrc3/engine/elena.h | 3 +-- elenasrc3/engine/windows/presenter.cpp | 4 ++-- elenasrc3/engine/windows/presenter.h | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/elenasrc3/elenavm/elenavmmachine.cpp b/elenasrc3/elenavm/elenavmmachine.cpp index 0dc6a44d7..3f8cea098 100644 --- a/elenasrc3/elenavm/elenavmmachine.cpp +++ b/elenasrc3/elenavm/elenavmmachine.cpp @@ -111,7 +111,7 @@ ELENAVMMachine :: ELENAVMMachine(path_t configPath, PresenterBase* presenter, Pl _jitLinker = nullptr; } -std::string ELENAVMMachine::getArchitecture() { +ustr_t ELENAVMMachine::getArchitecture() { #if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) return "(64-bit)"; #else @@ -122,7 +122,7 @@ std::string ELENAVMMachine::getArchitecture() { void ELENAVMMachine :: init(SystemEnv* exeEnv) { assert(_initialized == false); - std::string architecture = getArchitecture(); + ustr_t architecture = getArchitecture(); _presenter->printLine(ELENAVM_GREETING, ENGINE_MAJOR_VERSION, ENGINE_MINOR_VERSION, ELENAVM_REVISION_NUMBER, architecture); _presenter->printLine(ELENAVM_INITIALIZING); diff --git a/elenasrc3/elenavm/elenavmmachine.h b/elenasrc3/elenavm/elenavmmachine.h index e99149af3..9f91ba7df 100644 --- a/elenasrc3/elenavm/elenavmmachine.h +++ b/elenasrc3/elenavm/elenavmmachine.h @@ -13,7 +13,6 @@ #include "codescope.h" #include "projectbase.h" #include "xmlprojectbase.h" -#include namespace elena_lang { @@ -83,7 +82,7 @@ namespace elena_lang virtual void resumeVM(SystemEnv* env, void* criricalHandler); - std::string getArchitecture(); + ustr_t getArchitecture(); void init(SystemEnv* env); AddressMap::Iterator externals() override; diff --git a/elenasrc3/engine/elena.h b/elenasrc3/engine/elena.h index 68360cbc0..d545cbeb2 100644 --- a/elenasrc3/engine/elena.h +++ b/elenasrc3/engine/elena.h @@ -12,7 +12,6 @@ #include "common.h" #include "elenaconst.h" #include "section.h" -#include namespace elena_lang { @@ -657,7 +656,7 @@ namespace elena_lang virtual void printLine(ustr_t msg, int arg1) = 0; virtual void printLine(ustr_t msg, int arg1, int arg2) = 0; virtual void printLine(ustr_t msg, int arg1, int arg2, int arg3) = 0; - virtual void printLine(ustr_t msg, int arg1, int arg2, int arg3, std::string arg4) = 0; //version support print + virtual void printLine(ustr_t msg, int arg1, int arg2, int arg3, ustr_t arg4) = 0; //version support print virtual void printLine(ustr_t msg, ustr_t arg1, int arg2, int arg3, ustr_t arg4) = 0; virtual void printPathLine(ustr_t msg, path_t arg) = 0; virtual void printPathLine(ustr_t msg, path_t arg1, int arg2, int arg3, ustr_t arg4) = 0; diff --git a/elenasrc3/engine/windows/presenter.cpp b/elenasrc3/engine/windows/presenter.cpp index 7c063a888..9811a3a6a 100644 --- a/elenasrc3/engine/windows/presenter.cpp +++ b/elenasrc3/engine/windows/presenter.cpp @@ -155,11 +155,11 @@ void WinConsolePresenter :: printLine(ustr_t msg, int arg1, int arg2, int arg3) ::printLine(wstr.str(), arg1, arg2, arg3); } -void WinConsolePresenter::printLine(ustr_t msg, int arg1, int arg2, int arg3,std::string arg4) //version support print +void WinConsolePresenter::printLine(ustr_t msg, int arg1, int arg2, int arg3, ustr_t arg4) //version support print { WideMessage wstr(msg); - ::printLine(wstr.str(), arg1, arg2, arg3, arg4.c_str()); + ::printLine(wstr.str(), arg1, arg2, arg3, arg4.str()); } void WinConsolePresenter :: printPathLine(ustr_t msg, path_t arg1, int arg2, int arg3, ustr_t arg4) diff --git a/elenasrc3/engine/windows/presenter.h b/elenasrc3/engine/windows/presenter.h index 117cfe07d..5bee7b267 100644 --- a/elenasrc3/engine/windows/presenter.h +++ b/elenasrc3/engine/windows/presenter.h @@ -33,7 +33,7 @@ namespace elena_lang void printLine(ustr_t msg, ustr_t arg1, ustr_t arg2) override; void printLine(ustr_t msg, ustr_t arg1, ustr_t arg2, ustr_t arg3) override; void printLine(ustr_t msg, int arg1, int arg2, int arg3) override; - void printLine(ustr_t msg, int arg1, int arg2, int arg3, std::string arg4) override; //version support print + void printLine(ustr_t msg, int arg1, int arg2, int arg3, ustr_t arg4) override; //version support print void printPathLine(ustr_t msg, path_t arg1, int arg2, int arg3, ustr_t arg4) override; void printLine(ustr_t msg, int arg1) override; From 0be38c1d68488676ea6c0afcea84de5be89f7366 Mon Sep 17 00:00:00 2001 From: YairBybabayov Date: Sun, 11 Aug 2024 20:55:28 +0300 Subject: [PATCH 3/3] finall fixes (ocp for getArchitectureName()) --- elenasrc3/elenavm/elenavmmachine.cpp | 8 ++++---- elenasrc3/elenavm/elenavmmachine.h | 2 +- elenasrc3/elenavm/vmcommon.h | 2 +- elenasrc3/engine/windows/presenter.cpp | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/elenasrc3/elenavm/elenavmmachine.cpp b/elenasrc3/elenavm/elenavmmachine.cpp index 3f8cea098..9012c5fc4 100644 --- a/elenasrc3/elenavm/elenavmmachine.cpp +++ b/elenasrc3/elenavm/elenavmmachine.cpp @@ -111,18 +111,18 @@ ELENAVMMachine :: ELENAVMMachine(path_t configPath, PresenterBase* presenter, Pl _jitLinker = nullptr; } -ustr_t ELENAVMMachine::getArchitecture() { +ustr_t ELENAVMMachine::getArchitectureName() { #if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) - return "(64-bit)"; + return "64-bit"; #else - return "(32-bit)"; + return "32-bit"; #endif } void ELENAVMMachine :: init(SystemEnv* exeEnv) { assert(_initialized == false); - ustr_t architecture = getArchitecture(); + ustr_t architecture = getArchitectureName(); _presenter->printLine(ELENAVM_GREETING, ENGINE_MAJOR_VERSION, ENGINE_MINOR_VERSION, ELENAVM_REVISION_NUMBER, architecture); _presenter->printLine(ELENAVM_INITIALIZING); diff --git a/elenasrc3/elenavm/elenavmmachine.h b/elenasrc3/elenavm/elenavmmachine.h index 9f91ba7df..e4a6e9413 100644 --- a/elenasrc3/elenavm/elenavmmachine.h +++ b/elenasrc3/elenavm/elenavmmachine.h @@ -82,7 +82,7 @@ namespace elena_lang virtual void resumeVM(SystemEnv* env, void* criricalHandler); - ustr_t getArchitecture(); + ustr_t getArchitectureName(); void init(SystemEnv* env); AddressMap::Iterator externals() override; diff --git a/elenasrc3/elenavm/vmcommon.h b/elenasrc3/elenavm/vmcommon.h index a483d256d..124e36dfe 100644 --- a/elenasrc3/elenavm/vmcommon.h +++ b/elenasrc3/elenavm/vmcommon.h @@ -13,7 +13,7 @@ namespace elena_lang { - constexpr auto ELENAVM_GREETING = "ELENA VM %d.%d.%d %s (C)2022-2024 by Aleksey Rakov"; + constexpr auto ELENAVM_GREETING = "ELENA VM %d.%d.%d (%s) (C)2022-2024 by Aleksey Rakov"; constexpr auto ELENAVM_INITIALIZING = "Initializing..."; } diff --git a/elenasrc3/engine/windows/presenter.cpp b/elenasrc3/engine/windows/presenter.cpp index 9811a3a6a..553b5a690 100644 --- a/elenasrc3/engine/windows/presenter.cpp +++ b/elenasrc3/engine/windows/presenter.cpp @@ -158,8 +158,9 @@ void WinConsolePresenter :: printLine(ustr_t msg, int arg1, int arg2, int arg3) void WinConsolePresenter::printLine(ustr_t msg, int arg1, int arg2, int arg3, ustr_t arg4) //version support print { WideMessage wstr(msg); + WideMessage warg4(arg4); - ::printLine(wstr.str(), arg1, arg2, arg3, arg4.str()); + ::printLine(wstr.str(), arg1, arg2, arg3, warg4.str()); } void WinConsolePresenter :: printPathLine(ustr_t msg, path_t arg1, int arg2, int arg3, ustr_t arg4)