diff --git a/README.md b/README.md index 65b2581..860c8d9 100644 --- a/README.md +++ b/README.md @@ -91,11 +91,7 @@ If you think `-O3` isn't that safe and stable, you could choose: ![usage](./doc/gif/help.gif) -If your system is `Windows` and you want to output unicode,please use this command before running nasal: - -> chcp 65001 - -or you could write this in nasal code: +If your system is `Windows` and you want to output unicode, you could write this in nasal code: ```javascript if(os.platform()=="windows") diff --git a/doc/README_zh.md b/doc/README_zh.md index 570c846..86fc322 100644 --- a/doc/README_zh.md +++ b/doc/README_zh.md @@ -80,11 +80,7 @@ __注意__: 如果你想直接下载发行版提供的zip/tar.gz压缩包来构 ![usage](../doc/gif/help.gif) -如果你的操作系统是 `Windows` 且想输出unicode,请保证控制台代码页支持utf-8,使用下面这个命令启用代码页: - -> chcp 65001 - -或者直接在nasal代码里写这个来开启: +如果你是 `Windows` 用户且想正常输出unicode,在nasal代码里写这个来开启unicode代码页: ```javascript if(os.platform()=="windows") diff --git a/nasal_gc.h b/nasal_gc.h index 21f1d7a..52e05c5 100644 --- a/nasal_gc.h +++ b/nasal_gc.h @@ -276,8 +276,7 @@ std::ostream& operator<<(std::ostream& out,nas_vec& vec) return out; } vec.printed=true; - usize iter=0; - usize size=vec.elems.size(); + usize iter=0,size=vec.elems.size(); out<<'['; for(auto& i:vec.elems) out<1) + number=1; + if(number<0) + number=0; + var block_len=number*length; + var complete_block=int(block_len); + var decimal=block_len-complete_block; + var progress=complete_block+(decimal!=0); + var s="|"; + for(var i=0;i=1000?int(number/1000)~'k':str(number); + number=number>=1000?substr(str(number/1000),0,3)~'k':str(number); return rightpad(number,6); } diff --git a/test/coroutine.nas b/test/coroutine.nas index 0c4b07d..ccc0dcb 100644 --- a/test/coroutine.nas +++ b/test/coroutine.nas @@ -44,8 +44,10 @@ var total=1000; # ms var co=coroutine.create(productor); var tm=maketimestamp(); +if(os.platform()=="windows") + system("chcp 65001"); var counter=0; -var bar=process_bar.bar("block","point","line",40); +var bar=process_bar.high_resolution_bar(40); var consumer=func(){ counter+=1; for(var i=0;i<5;i+=1) diff --git a/test/md5compare.nas b/test/md5compare.nas index 33eaf37..54ce4c2 100644 --- a/test/md5compare.nas +++ b/test/md5compare.nas @@ -13,7 +13,7 @@ var compare=func(){ var total=end-begin; var timestamp=maketimestamp(); timestamp.stamp(); - var bar=process_bar.bar(front:os.platform()=="windows"?"sharp":"block",back:"point",sep:"line",length:50); + var bar=process_bar.high_resolution_bar(50); for(var i=begin;i