🚀 update test file

This commit is contained in:
ValKmjolnir 2022-09-20 21:51:52 +08:00
parent 791de656c3
commit dc3770094a
2 changed files with 61 additions and 55 deletions

View File

@ -2,32 +2,32 @@ import.stl.padding;
var char_ttf=[ var char_ttf=[
[" "," "," "," "," "," "], [" "," "," "," "," "," "],
[" ████╗"," ██╔██║"," ██╔╝██║"," ███████║","██╔═══██║","╚═╝ ╚═╝"], [" █████╗ ","██╔══██╗","███████║","██╔══██║","██║ ██║","╚═╝ ╚═╝"],
["██████╗ ","██╔══██╗","██████╔╝","██╔══██╗","██████╔╝","╚═════╝ "], ["██████╗ ","██╔══██╗","██████╔╝","██╔══██╗","██████╔╝","╚═════╝ "],
[" ██████╗","██╔════╝","██║ ","██║ ","╚██████╗"," ╚═════╝"], [" ██████╗","██╔════╝","██║ ","██║ ","╚██████╗"," ╚═════╝"],
["██████╗ ","██╔══██╗","██║ ██║","██║ ██║","██████╔╝","╚═════╝ "], ["██████╗ ","██╔══██╗","██║ ██║","██║ ██║","██████╔╝","╚═════╝ "],
["███████╗","██╔════╝","█████╗ ","██╔══╝ ","███████╗","╚══════╝"], ["███████╗","██╔════╝","█████╗ ","██╔══╝ ","███████╗","╚══════╝"],
["███████╗","██╔════╝","█████╗ ","██╔══╝ ","██║ ","╚═╝ "], ["███████╗","██╔════╝","█████╗ ","██╔══╝ ","██║ ","╚═╝ "],
[" █████╗ ","██╔═══╝ ","██║ ██╗ ","██║ ╚██╗","╚█████╔╝"," ╚════╝ "], [" ██████╗ ","██╔════╝ ","██║ ███╗","██║ ██║","╚██████╔╝"," ╚═════╝ "],
["██╗ ██╗","██║ ██║","███████║","██╔══██║","██║ ██║","╚═╝ ╚═╝"], ["██╗ ██╗","██║ ██║","███████║","██╔══██║","██║ ██║","╚═╝ ╚═╝"],
[" ██████╗"," ██╔═╝"," ██║ "," ██║ "," ██████╗"," ╚═════╝"], ["██╗","██║","██║","██║","██║","╚═╝"],
[" ██╗"," ██║"," ██║","██ ██║","╚█████╔╝"," ╚════╝ "], [" ██╗"," ██║"," ██║","██ ██║","╚█████╔╝"," ╚════╝ "],
["██╗ ██╗","██║ ██╔╝","█████╔╝ ","██╔═██╗ ","██║ ██╗","╚═╝ ╚═╝"], ["██╗ ██╗","██║ ██╔╝","█████╔╝ ","██╔═██╗ ","██║ ██╗","╚═╝ ╚═╝"],
["██╗ ","██║ ","██║ ","██║ ","███████╗","╚══════╝"], ["██╗ ","██║ ","██║ ","██║ ","███████╗","╚══════╝"],
["██╗ ██╗","███╗ ███║","████████║","██╔██╔██║","██║╚═╝██║","╚═╝ ╚═╝"], ["███╗ ███╗","████╗ ████║","██╔████╔██║","██║╚██╔╝██║","██║ ╚═╝ ██║","╚═╝ ╚═╝"],
["██╗ ██╗","███╗ ██║","█████╗██║","██╔█████║","██║ ╚███║","╚═╝ ╚══╝"], ["███╗ ██╗","████╗ ██║","██╔██╗ ██║","██║╚██╗██║","██║ ╚████║","╚═╝ ╚═══╝"],
[" ██████╗ ","██╔═══██╗","██║ ██║","██║ ██║","╚██████╔╝"," ╚═════╝ "], [" ██████╗ ","██╔═══██╗","██║ ██║","██║ ██║","╚██████╔╝"," ╚═════╝ "],
["██████╗ ","██╔══██╗","██████╔╝","██╔═══╝ ","██║ ","╚═╝ "], ["██████╗ ","██╔══██╗","██████╔╝","██╔═══╝ ","██║ ","╚═╝ "],
[" ██████╗ ","██╔═══██╗","██║ ██║","██║ ██╔╝","╚████╔██╗"," ╚═══╝╚═╝"], [" ██████╗ ","██╔═══██╗","██║ ██║","██║▄▄ ██║","╚██████╔╝"," ╚══▀▀═╝ "],
["██████╗ ","██╔══██╗","██████╔╝","██╔══██╗","██║ ██║","╚═╝ ╚═╝"], ["██████╗ ","██╔══██╗","██████╔╝","██╔══██╗","██║ ██║","╚═╝ ╚═╝"],
["███████╗","██╔════╝","███████╗","╚════██║","███████║","╚══════╝"], ["███████╗","██╔════╝","███████╗","╚════██║","███████║","╚══════╝"],
["████████╗","╚══██╔══╝"," ██║ "," ██║ "," ██║ "," ╚═╝ "], ["████████╗","╚══██╔══╝"," ██║ "," ██║ "," ██║ "," ╚═╝ "],
["██╗ ██╗","██║ ██║","██║ ██║","██║ ██║","╚██████╔╝"," ╚═════╝ "], ["██╗ ██╗","██║ ██║","██║ ██║","██║ ██║","╚██████╔╝"," ╚═════╝ "],
["██╗ ██╗","██║ ██║","██║ ██║","╚██╗ ██╔╝"," ╚████╔╝ "," ╚═══╝ "], ["██╗ ██╗","██║ ██║","██║ ██║","╚██╗ ██╔╝"," ╚████╔╝ "," ╚═══╝ "],
["██╗ ██╗","██║██╗██║","████████║","███╔═███║","██╔╝ ╚██║","╚═╝ ╚═╝"], ["██╗ ██╗","██║ ██║","██║ █╗ ██║","██║███╗██║","╚███╔███╔╝"," ╚══╝╚══╝ "],
["██╗ ██╗","╚██╗██╔╝"," ╚███╔╝ "," ██╔██╗ ","██╔╝╚██╗","╚═╝ ╚═╝"], ["██╗ ██╗","╚██╗██╔╝"," ╚███╔╝ "," ██╔██╗ ","██╔╝╚██╗","╚═╝ ╚═╝"],
["██╗ ██╗","╚██╗ ██╔╝"," ╚████╔╝ "," ╚██╔╝ "," ██║ "," ╚═╝ "], ["██╗ ██╗","╚██╗ ██╔╝"," ╚████╔╝ "," ╚██╔╝ "," ██║ "," ╚═╝ "],
["████████╗","╚════██╔╝"," ██╔═╝ "," ██╔═╝ ","████████╗","╚═══════╝"], ["███████╗","╚══███╔╝"," ███╔╝ "," ███╔╝ ","███████╗","╚══════╝"],
]; ];
var trans_ttf=func(string){ var trans_ttf=func(string){
var str=["","","","","",""]; var str=["","","","","",""];
@ -47,7 +47,7 @@ var trans_ttf=func(string){
println(i); println(i);
return; return;
} }
var curve1=func(line=6){ var curve1=func(line=4){
var table=["╚","═","╝","╔","║","╗"]; var table=["╚","═","╝","╔","║","╗"];
rand(100); rand(100);
var s=""; var s="";
@ -58,7 +58,7 @@ var curve1=func(line=6){
} }
print(s); print(s);
} }
var curve2=func(line=3){ var curve2=func(line=2){
var shadow=["░","▒","▓","█","▀","▄","▐","▌"]; var shadow=["░","▒","▓","█","▀","▄","▐","▌"];
rand(100); rand(100);
var s=""; var s="";
@ -69,7 +69,7 @@ var curve2=func(line=3){
} }
print(s); print(s);
} }
var curve3=func(line=3){ var curve3=func(line=2){
var arr=[ var arr=[
0,1,2,3,4,5,6,7,8, 0,1,2,3,4,5,6,7,8,
0,1,2,3,4,5,6,7,8, 0,1,2,3,4,5,6,7,8,
@ -91,7 +91,7 @@ var curve3=func(line=3){
} }
return; return;
} }
var curve4=func(line=6){ var curve4=func(line=4){
var shadow=["m░\e[0m","m▒\e[0m","m▓\e[0m","m█\e[0m","m▀\e[0m","m▄\e[0m","m▐\e[0m","m▌\e[0m"]; var shadow=["m░\e[0m","m▒\e[0m","m▓\e[0m","m█\e[0m","m▀\e[0m","m▄\e[0m","m▐\e[0m","m▌\e[0m"];
var front=[ var front=[
"30","31","32","33","34","35","36","37", "30","31","32","33","34","35","36","37",
@ -108,7 +108,7 @@ var curve4=func(line=6){
print('\n'); print('\n');
} }
} }
var curve5=func(line=6){ var curve5=func(line=4){
var vec=["▀▄─","▄▀─","▀─▄","▄─▀"]; var vec=["▀▄─","▄▀─","▀─▄","▄─▀"];
for(var (y,p)=(0,0);y!=line;y+=1){ for(var (y,p)=(0,0);y!=line;y+=1){
for(var x=0;x!=15;x+=1) for(var x=0;x!=15;x+=1)
@ -139,7 +139,6 @@ var ansi_escape_sequence=func(){
# enable unicode # enable unicode
if(os.platform()=="windows") if(os.platform()=="windows")
system("chcp 65001"); system("chcp 65001");
trans_ttf("just for test");
trans_ttf(" ValKmjolnir "); trans_ttf(" ValKmjolnir ");
curve1(); curve1();
curve2(); curve2();

View File

@ -1,49 +1,56 @@
import.stl.sort; import.stl.sort;
var argv=runtime.argv();
if(size(argv)<1){ var to_lower=func(s){
println("no input files."); var tmp="";
exit(-1); for(var i=0;i<size(s);i+=1){
} var c=s[i];
if('a'[0]<=c and c<='z'[0])
var all_exists=1; tmp~=chr(c);
foreach(var f;argv){ elsif('A'[0]<=c and c<='Z'[0])
if(!io.exists(f)){ tmp~=chr(c-'A'[0]+'a'[0]);
println("cannot open file <",f,">"); else
all_exists=0; tmp~=chr(c);
} }
return tmp;
} }
if(!all_exists){ var spliter=func(content){
exit(-1); var token={};
} var len=size(content);
var s="";
var to_lower=func(c){ for(var i=0;i<len;i+=1){
if('a'[0]<=c[0] and c[0]<='z'[0]) var n=content[i];
return c; var c=chr(n);
elsif('A'[0]<=c[0] and c[0]<='Z'[0]) if(('a'[0]<=n and n<='z'[0]) or ('A'[0]<=n and n<='Z'[0]) or n=='\''[0] or n=='-'[0]){
return chr(c[0]-'A'[0]+'a'[0]); s~=c;
return c; }elsif(size(s)){
} if(s[0]!="-"[0] and s[0]!="'"[0] and s[-1]!="-"[0] and s[-1]!="'"[0])
token[to_lower(s)]+=1;
var file_content=""; s="";
foreach(var f;argv) }
file_content~=io.fin(f)~" ";
var token={};
var len=size(file_content);
var s="";
for(var i=0;i<len;i+=1){
var n=file_content[i];
var c=chr(n);
if(('a'[0]<=n and n<='z'[0]) or ('A'[0]<=n and n<='Z'[0]) or n=='\''[0] or n=='-'[0]){
s~=to_lower(c);
}elsif(size(s)){
if(s[0]!="-"[0] and s[0]!="'"[0] and s[-1]!="-"[0] and s[-1]!="'"[0])
token[s]+=1;
s="";
} }
return token;
} }
var vec=keys(token); func(argv){
sort(vec,func(a,b){return cmp(a,b)<=0;}); if(size(argv)<1){
println(vec); println("no input files.");
exit(-1);
}
var all_exists=1;
foreach(var f;argv){
if(!io.exists(f)){
println("cannot open file <",f,">");
all_exists=0;
}
}
if(!all_exists){
exit(-1);
}
var file_content="";
foreach(var f;argv)
file_content~=io.fin(f)~" ";
var vec=keys(spliter(file_content));
sort(vec,func(a,b){return cmp(a,b)<=0;});
println(vec);
}(runtime.argv());