📝 add os and arch info in welcome info
This commit is contained in:
parent
7ce8d3af25
commit
d70864fb2e
10
src/main.cpp
10
src/main.cpp
|
@ -75,13 +75,18 @@ std::ostream& logo(std::ostream& out) {
|
||||||
<< " / \\/ / _` / __|/ _` | |\n"
|
<< " / \\/ / _` / __|/ _` | |\n"
|
||||||
<< " / /\\ / (_| \\__ \\ (_| | |\n"
|
<< " / /\\ / (_| \\__ \\ (_| | |\n"
|
||||||
<< " \\_\\ \\/ \\__,_|___/\\__,_|_|\n"
|
<< " \\_\\ \\/ \\__,_|___/\\__,_|_|\n"
|
||||||
<< "ver : " << __nasver << " (" << __DATE__ << " " << __TIME__ << ")\n"
|
<< "\n"
|
||||||
|
<< "ver : " << __nasver__
|
||||||
|
<< " " << nasal::get_platform() << " " << nasal::get_arch()
|
||||||
|
<< " (" << __DATE__ << " " << __TIME__ << ")\n"
|
||||||
<< "std : c++ " << __cplusplus << "\n"
|
<< "std : c++ " << __cplusplus << "\n"
|
||||||
<< "core : " << std::thread::hardware_concurrency() << " core(s)\n"
|
<< "core : " << std::thread::hardware_concurrency() << " core(s)\n"
|
||||||
<< "repo : https://github.com/ValKmjolnir/Nasal-Interpreter\n"
|
<< "repo : https://github.com/ValKmjolnir/Nasal-Interpreter\n"
|
||||||
<< "repo : https://gitee.com/valkmjolnir/Nasal-Interpreter\n"
|
<< "repo : https://gitee.com/valkmjolnir/Nasal-Interpreter\n"
|
||||||
<< "wiki : https://wiki.flightgear.org/Nasal_scripting_language\n"
|
<< "wiki : https://wiki.flightgear.org/Nasal_scripting_language\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
|
<< "presented by fgprc members - http://fgprc.org\n"
|
||||||
|
<< "\n"
|
||||||
<< "input <nasal -h> to get help .\n\n";
|
<< "input <nasal -h> to get help .\n\n";
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +100,8 @@ std::ostream& version(std::ostream& out) {
|
||||||
if (num<0.01) {
|
if (num<0.01) {
|
||||||
nasal::parse::easter_egg();
|
nasal::parse::easter_egg();
|
||||||
}
|
}
|
||||||
out << "nasal interpreter version " << __nasver;
|
out << "nasal interpreter version " << __nasver__;
|
||||||
|
out << " " << nasal::get_platform() << " " << nasal::get_arch();
|
||||||
out << " (" << __DATE__ << " " << __TIME__ << ")\n";
|
out << " (" << __DATE__ << " " << __TIME__ << ")\n";
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __nasver
|
#ifndef __nasver__
|
||||||
#define __nasver "11.1"
|
#define __nasver__ "11.1"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
@ -34,7 +34,8 @@ bool is_aarch64();
|
||||||
bool is_ia64();
|
bool is_ia64();
|
||||||
bool is_powerpc();
|
bool is_powerpc();
|
||||||
bool is_superh();
|
bool is_superh();
|
||||||
|
const char* get_platform();
|
||||||
|
const char* get_arch();
|
||||||
|
|
||||||
// virtual machine stack depth, both global depth and value stack depth
|
// virtual machine stack depth, both global depth and value stack depth
|
||||||
const u32 STACK_DEPTH = 4096;
|
const u32 STACK_DEPTH = 4096;
|
||||||
|
|
|
@ -447,35 +447,11 @@ var builtin_sleep(context* ctx, gc* ngc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var builtin_platform(context* ctx, gc* ngc) {
|
var builtin_platform(context* ctx, gc* ngc) {
|
||||||
if (is_windows()) {
|
return ngc->newstr(get_platform());
|
||||||
return ngc->newstr("windows");
|
|
||||||
} else if (is_linux()) {
|
|
||||||
return ngc->newstr("linux");
|
|
||||||
} else if (is_macos()) {
|
|
||||||
return ngc->newstr("macOS");
|
|
||||||
}
|
|
||||||
return ngc->newstr("unknown");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var builtin_arch(context* ctx, gc* ngc) {
|
var builtin_arch(context* ctx, gc* ngc) {
|
||||||
if (is_x86()) {
|
return ngc->newstr(get_arch());
|
||||||
return ngc->newstr("x86");
|
|
||||||
} else if (is_x86_64()) {
|
|
||||||
return ngc->newstr("x86-64");
|
|
||||||
} else if (is_amd64()) {
|
|
||||||
return ngc->newstr("amd64");
|
|
||||||
} else if (is_arm()) {
|
|
||||||
return ngc->newstr("arm");
|
|
||||||
} else if (is_aarch64()) {
|
|
||||||
return ngc->newstr("aarch64");
|
|
||||||
} else if (is_ia64()) {
|
|
||||||
return ngc->newstr("ia64");
|
|
||||||
} else if (is_powerpc()) {
|
|
||||||
return ngc->newstr("powerpc");
|
|
||||||
} else if (is_superh()) {
|
|
||||||
return ngc->newstr("superh");
|
|
||||||
}
|
|
||||||
return ngc->newstr("unknown");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// md5 related functions
|
// md5 related functions
|
||||||
|
|
|
@ -97,6 +97,38 @@ bool is_superh() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* get_platform() {
|
||||||
|
if (is_windows()) {
|
||||||
|
return "windows";
|
||||||
|
} else if (is_linux()) {
|
||||||
|
return "linux";
|
||||||
|
} else if (is_macos()) {
|
||||||
|
return "macOS";
|
||||||
|
}
|
||||||
|
return "unknown platform";
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* get_arch() {
|
||||||
|
if (is_x86()) {
|
||||||
|
return "x86";
|
||||||
|
} else if (is_x86_64()) {
|
||||||
|
return "x86-64";
|
||||||
|
} else if (is_amd64()) {
|
||||||
|
return "amd64";
|
||||||
|
} else if (is_arm()) {
|
||||||
|
return "arm";
|
||||||
|
} else if (is_aarch64()) {
|
||||||
|
return "aarch64";
|
||||||
|
} else if (is_ia64()) {
|
||||||
|
return "ia64";
|
||||||
|
} else if (is_powerpc()) {
|
||||||
|
return "powerpc";
|
||||||
|
} else if (is_superh()) {
|
||||||
|
return "superh";
|
||||||
|
}
|
||||||
|
return "unknown arch";
|
||||||
|
}
|
||||||
|
|
||||||
f64 hex_to_f64(const char* str) {
|
f64 hex_to_f64(const char* str) {
|
||||||
f64 ret = 0;
|
f64 ret = 0;
|
||||||
for(; *str; ++str) {
|
for(; *str; ++str) {
|
||||||
|
|
|
@ -120,7 +120,7 @@ void repl::execute() {
|
||||||
std::cout << "[nasal-repl] Initialization complete.\n\n";
|
std::cout << "[nasal-repl] Initialization complete.\n\n";
|
||||||
|
|
||||||
// finish initialization, output version info
|
// finish initialization, output version info
|
||||||
std::cout << "Nasal REPL interpreter version " << __nasver;
|
std::cout << "Nasal REPL interpreter version " << __nasver__;
|
||||||
std::cout << " (" << __DATE__ << " " << __TIME__ << ")\n";
|
std::cout << " (" << __DATE__ << " " << __TIME__ << ")\n";
|
||||||
help();
|
help();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue