📝 delete system call in test files

This commit is contained in:
ValKmjolnir 2024-05-22 23:41:14 +08:00
parent f9f2cf6d47
commit b02168fc55
10 changed files with 19 additions and 29 deletions

View File

@ -38,9 +38,6 @@ std::ostream& help(std::ostream& out) {
<< " ,--#-,\n" << " ,--#-,\n"
<< "<3 / \\____\\ <3\n" << "<3 / \\____\\ <3\n"
<< " |_|__A_|\n" << " |_|__A_|\n"
#ifdef _WIN32
<< "use command <chcp 65001> to use unicode.\n"
#endif
<< "\nnasal <option>\n" << "\nnasal <option>\n"
<< "option:\n" << "option:\n"
<< " -h, --help | get help.\n" << " -h, --help | get help.\n"

View File

@ -1,7 +1,7 @@
use std.padding; use std.padding;
use std.process_bar; use std.process_bar;
use std.os;
use std.unix; use std.unix;
use std.runtime;
var char_ttf=[ var char_ttf=[
[" "," "," "," "," "," "], [" "," "," "," "," "," "],
@ -196,9 +196,7 @@ var ansi_escape_sequence = func() {
} }
# enable unicode # enable unicode
if (os.platform()=="windows") { runtime.windows.set_utf8_output();
system("chcp 65001");
}
trans_ttf("just for test"); trans_ttf("just for test");
trans_ttf(" ValKmjolnir "); trans_ttf(" ValKmjolnir ");

View File

@ -4,9 +4,10 @@ use std.coroutine;
use std.process_bar; use std.process_bar;
use std.padding; use std.padding;
use std.os; use std.os;
use std.runtime;
if (os.platform()=="windows") { if (os.platform()=="windows") {
system("chcp 65001"); runtime.windows.set_utf8_output();
system("color"); system("color");
} }

View File

@ -1,4 +1,4 @@
use std.os; use std.runtime;
use std.io; use std.io;
use std.unix; use std.unix;
@ -35,7 +35,7 @@ var prt = func(s,path) {
} }
# enable unicode # enable unicode
if (os.platform()=="windows") runtime.windows.set_utf8_output();
system("chcp 65001");
println("\e[33m[",unix.getcwd(),"]\e[36m>\e[0m"); println("\e[33m[",unix.getcwd(),"]\e[36m>\e[0m");
prt([""],"."); prt([""],".");

View File

@ -1,7 +1,7 @@
use test.md5_self; use test.md5_self;
use std.process_bar; use std.process_bar;
use std.file; use std.file;
use std.os; use std.runtime;
use std.io; use std.io;
use std.math; use std.math;
@ -101,8 +101,6 @@ var randomchecksum = func() {
} }
} }
if (os.platform()=="windows") { runtime.windows.set_utf8_output();
system("chcp 65001");
}
filechecksum(); filechecksum();
randomchecksum(); randomchecksum();

View File

@ -11,7 +11,7 @@ var is_windows_platform=os.platform()=="windows";
var is_macos_platform=os.platform()=="macOS"; var is_macos_platform=os.platform()=="macOS";
if (is_windows_platform) { if (is_windows_platform) {
system("chcp 65001"); runtime.windows.set_utf8_output();
} }
var cpu_stat = func() { var cpu_stat = func() {

View File

@ -1,4 +1,5 @@
use std.os; use std.runtime;
var code=[ var code=[
[1,1,1,1,1,1,1,0,1,0,0,1,1,0,1,0,1,0,1,1,0,0,1,1,1,1,1,1,1], [1,1,1,1,1,1,1,0,1,0,0,1,1,0,1,0,1,0,1,1,0,0,1,1,1,1,1,1,1],
[1,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,1,1,1,0,1,0,0,0,0,0,1], [1,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,1,1,1,0,1,0,0,0,0,0,1],
@ -32,8 +33,7 @@ var code=[
]; ];
# enable unicode # enable unicode
if (os.platform()=="windows") runtime.windows.set_utf8_output();
system("chcp 65001");
var texture=[" ","██"]; var texture=[" ","██"];
for(var i=0;i<size(code);i+=1) { for(var i=0;i<size(code);i+=1) {
for(var j=0;j<size(code[i]);j+=1) for(var j=0;j<size(code[i]);j+=1)

View File

@ -2,7 +2,6 @@ use module.libkey;
use std.list; use std.list;
use std.runtime; use std.runtime;
use std.coroutine; use std.coroutine;
use std.os;
use std.unix; use std.unix;
var game = func(x,y) { var game = func(x,y) {
@ -130,8 +129,7 @@ var co=coroutine.create(func() {
var main = func(argv) { var main = func(argv) {
var should_skip=(size(argv)!=0 and argv[0]=="--skip"); var should_skip=(size(argv)!=0 and argv[0]=="--skip");
# enable unicode # enable unicode
if (os.platform()=="windows") runtime.windows.set_utf8_output();
system("chcp 65001");
print("\ec"); print("\ec");
var g=game(15,10); var g=game(15,10);

View File

@ -1,6 +1,5 @@
use module.libkey; use module.libkey;
use std.runtime; use std.runtime;
use std.os;
use std.unix; use std.unix;
var color=[ var color=[
@ -277,9 +276,9 @@ var mapgen = func(mapx,mapy) {
var main = func(argv) { var main = func(argv) {
var should_skip=(size(argv)!=0 and argv[0]=="--skip"); var should_skip=(size(argv)!=0 and argv[0]=="--skip");
var init_counter=should_skip?5:30; var init_counter=should_skip?5:30;
# windows use chcp 65001 to output unicode
if (os.platform()=="windows") # windows use 65001 to output unicode
system("chcp 65001"); runtime.windows.set_utf8_output();
print( print(
"\ec\e[1:1H", "\ec\e[1:1H",

View File

@ -1,6 +1,6 @@
# wave collapse function 2022/4/10 # wave collapse function 2022/4/10
# by ValKmjolnir # by ValKmjolnir
use std.os; use std.runtime;
srand(); srand();
var table=[ var table=[
@ -96,8 +96,7 @@ var map = func() {
}(); }();
# enable unicode # enable unicode
if (os.platform()=="windows") runtime.windows.set_utf8_output();
system("chcp 65001");
map.new(90); map.new(90);
for(var iter=0;iter<40;iter+=1) { for(var iter=0;iter<40;iter+=1) {