🐛 fix bug in test/calc.nas
This commit is contained in:
parent
84f9280cb4
commit
79c1e27027
1
makefile
1
makefile
|
@ -67,6 +67,7 @@ test:nasal
|
|||
@ ./nasal -t -d test/pi.nas
|
||||
@ ./nasal -c test/ppmgen.nas
|
||||
@ ./nasal -t -d test/prime.nas
|
||||
@ ./nasal -c test/push.nas
|
||||
@ ./nasal -e test/qrcode.nas
|
||||
@ ./nasal -t -d test/quick_sort.nas
|
||||
@ ./nasal -e test/scalar.nas hello world
|
||||
|
|
|
@ -115,13 +115,7 @@ struct opcode {
|
|||
u32 line;// line of source code
|
||||
opcode(u8 o=op_exit,u16 f=0,u32 n=0,u32 l=0):
|
||||
op(o),fidx(f),num(n),line(l) {}
|
||||
opcode& operator=(const opcode& tmp) {
|
||||
op=tmp.op;
|
||||
fidx=tmp.fidx;
|
||||
num=tmp.num;
|
||||
line=tmp.line;
|
||||
return *this;
|
||||
}
|
||||
opcode& operator=(const opcode& tmp) = default;
|
||||
};
|
||||
|
||||
class codestream {
|
||||
|
|
|
@ -35,7 +35,7 @@ var blank=func(s){
|
|||
flag=1;
|
||||
}
|
||||
}
|
||||
if(flag){
|
||||
if(!flag){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ var calc=func(codetype,files,path=""){
|
|||
println(rightpad(files[i],padding_length),'|',
|
||||
column(line_cnt),' line |',
|
||||
column(semi_cnt),' semi |',
|
||||
leftpad(str(int(size(s)/1024)),3),' kb | ',
|
||||
leftpad(str(int(size(s)/1024)),4),' kb | ',
|
||||
md5(s),' |');
|
||||
bytes+=size(s);
|
||||
ctx~=s;
|
||||
|
@ -73,7 +73,7 @@ var calc=func(codetype,files,path=""){
|
|||
println(rightpad("total:",padding_length),'|',
|
||||
column(line),' line |',
|
||||
column(semi),' semi |',
|
||||
leftpad(str(int(bytes/1024)),3),' kb | ',
|
||||
leftpad(str(int(bytes/1024)),4),' kb | ',
|
||||
md5(ctx),' |\n');
|
||||
return int(bytes/1024);
|
||||
}
|
||||
|
@ -82,4 +82,4 @@ var all=calc("source code:",source)
|
|||
+calc("lib:",lib,"stl/")
|
||||
+calc("test file:",testfile,"test/")
|
||||
+calc("module:",module,"module/");
|
||||
println(rightpad("total:",padding_length),'| ',rightpad(str(all),6),'kb');
|
||||
println(rightpad("total:",padding_length),'|',leftpad(str(all),6),' kb |');
|
|
@ -1,6 +1,7 @@
|
|||
# coroutine.nas by ValKmjolnir
|
||||
# 2022/5/19
|
||||
import.stl.process_bar;
|
||||
import.stl.padding;
|
||||
|
||||
if(os.platform()=="windows"){
|
||||
system("chcp 65001");
|
||||
|
@ -105,7 +106,7 @@ for(var t=0;t<10;t+=1){
|
|||
coroutine.resume(co);
|
||||
if(counter-int(counter/1000)*1000==0){
|
||||
var rate=counter/4e5;
|
||||
print(" ",bar.bar(rate)," ",int(rate*100),"% | ",str(1e3*int(counter/tm.elapsedMSec()))," tasks/s \r");
|
||||
print(" ",bar.bar(rate)," ",leftpad(str(int(rate*100)),3),"% | ",str(1e3*int(counter/tm.elapsedMSec()))," tasks/s \r");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,10 +27,10 @@ var project=func(n) {
|
|||
# generate process bar, every 0.2%
|
||||
if((i-last_step)/n>1/500) {
|
||||
last_step=i;
|
||||
print(" ",bar.bar((i+1)/n)~" \r");
|
||||
print(" ",bar.bar((i+1)/n)," ",leftpad(str(int((i+1)/n*100)),3),"% | \r");
|
||||
}
|
||||
}
|
||||
print(" ",bar.bar(1)~" ",rightpad(str(ts.elapsedMSec()/1000),5)," s | ");
|
||||
print(" ",bar.bar(1)~" 100% | ",rightpad(str(ts.elapsedMSec()/1000),5)," s | ");
|
||||
|
||||
mess(color);
|
||||
|
||||
|
@ -63,10 +63,10 @@ var select=func(n) {
|
|||
# generate process bar, every 0.2%
|
||||
if((i-last_step)/n>1/500) {
|
||||
last_step=i;
|
||||
print(" ",bar.bar((i+1)/n)~" \r");
|
||||
print(" ",bar.bar((i+1)/n)," ",leftpad(str(int((i+1)/n*100)),3),"% | \r");
|
||||
}
|
||||
}
|
||||
print(" ",bar.bar(1)~" ",rightpad(str(ts.elapsedMSec()/1000),5)," s | ");
|
||||
print(" ",bar.bar(1)~" 100% | ",rightpad(str(ts.elapsedMSec()/1000),5)," s | ");
|
||||
|
||||
mess(color);
|
||||
mess(message);
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
|
||||
println("[",os.time(),"] auto push, please wait...");
|
||||
|
||||
while(system("git push")!=0) {
|
||||
println("[",os.time(),"] failed to push, retrying...");
|
||||
unix.sleep(0.5);
|
Loading…
Reference in New Issue