From e50a23c1a09a22a5e3d8a40ea8d9fd3ac67caa80 Mon Sep 17 00:00:00 2001 From: YairBybabayov <92524899+YairBybabayov@users.noreply.github.com> Date: Sun, 11 Aug 2024 21:20:57 +0300 Subject: [PATCH] ELENAVM : display if VM is 32 or 64 bit on Windows? #680 (#681) * Update README.md * ELENAVM : display if VM is 32 or 64 bit on Windows? #680 * fixed string type * finall fixes (ocp for getArchitectureName()) --------- Co-authored-by: Aleksey Rakov --- README.md | 2 ++ elenasrc3/elenavm/elenavmmachine.cpp | 12 ++++++++++-- elenasrc3/elenavm/elenavmmachine.h | 1 + elenasrc3/elenavm/vmcommon.h | 2 +- elenasrc3/engine/elena.h | 1 + elenasrc3/engine/windows/presenter.cpp | 8 ++++++++ elenasrc3/engine/windows/presenter.h | 2 ++ 7 files changed, 25 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 701a26e2d..7e6aa69f2 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,8 @@ The ELENA source code is organized as follows: ## Community We want your contributions and suggestions! One of the easiest ways to contribute is to participate in Github discussions or on Discord. +Please take a look at our [contributor page](https://github.com/ELENA-LANG/elena-lang/wiki/Getting-Started-with-the-project) + ### 1. Bugs, questions, suggestions? If you've noticed a bug or have a question go ahead and [make one](https://github.com/ELENA-LANG/elena-lang/issues/new/choose)! diff --git a/elenasrc3/elenavm/elenavmmachine.cpp b/elenasrc3/elenavm/elenavmmachine.cpp index d23ae8b4a..9012c5fc4 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; } +ustr_t ELENAVMMachine::getArchitectureName() { +#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); + ustr_t architecture = getArchitectureName(); + _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..e4a6e9413 100644 --- a/elenasrc3/elenavm/elenavmmachine.h +++ b/elenasrc3/elenavm/elenavmmachine.h @@ -82,6 +82,7 @@ namespace elena_lang virtual void resumeVM(SystemEnv* env, void* criricalHandler); + ustr_t getArchitectureName(); void init(SystemEnv* env); AddressMap::Iterator externals() override; diff --git a/elenasrc3/elenavm/vmcommon.h b/elenasrc3/elenavm/vmcommon.h index 7a440a87e..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 (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..d545cbeb2 100644 --- a/elenasrc3/engine/elena.h +++ b/elenasrc3/engine/elena.h @@ -656,6 +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, 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 a8447e66f..553b5a690 100644 --- a/elenasrc3/engine/windows/presenter.cpp +++ b/elenasrc3/engine/windows/presenter.cpp @@ -155,6 +155,14 @@ 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, ustr_t arg4) //version support print +{ + WideMessage wstr(msg); + WideMessage warg4(arg4); + + ::printLine(wstr.str(), arg1, arg2, arg3, warg4.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..5bee7b267 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, 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; void printLine(ustr_t msg, int arg1, int arg2) override;