📝 delete unnecessary code & change test file.

This commit is contained in:
ValKmjolnir
2022-07-31 19:26:13 +08:00
parent 4ab8a730a6
commit 13ddfa5050
6 changed files with 216 additions and 256 deletions
+80 -81
View File
@@ -1,85 +1,85 @@
var source=[
"main.cpp ",
"nasal_ast.h ",
"nasal_builtin.h ",
"nasal_codegen.h ",
"nasal_dbg.h ",
"nasal_err.h ",
"nasal_gc.h ",
"nasal_import.h ",
"nasal_lexer.h ",
"nasal_opt.h ",
"nasal_parse.h ",
"nasal_vm.h ",
"nasal.h "
"main.cpp ",
"nasal_ast.h ",
"nasal_builtin.h ",
"nasal_codegen.h ",
"nasal_dbg.h ",
"nasal_err.h ",
"nasal_gc.h ",
"nasal_import.h ",
"nasal_lexer.h ",
"nasal_opt.h ",
"nasal_parse.h ",
"nasal_vm.h ",
"nasal.h "
];
var lib=[
"stl/fg_env.nas ",
"stl/file.nas ",
"stl/lib.nas ",
"stl/list.nas ",
"stl/log.nas ",
"stl/module.nas ",
"stl/process_bar.nas ",
"stl/queue.nas ",
"stl/result.nas ",
"stl/sort.nas ",
"stl/stack.nas "
"fg_env.nas ",
"file.nas ",
"lib.nas ",
"list.nas ",
"log.nas ",
"module.nas ",
"process_bar.nas ",
"queue.nas ",
"result.nas ",
"sort.nas ",
"stack.nas "
];
var testfile=[
"test/ascii-art.nas ",
"test/auto_crash.nas ",
"test/bf.nas ",
"test/bfcolored.nas ",
"test/bfconvertor.nas ",
"test/bfs.nas ",
"test/bigloop.nas ",
"test/bp.nas ",
"test/calc.nas ",
"test/choice.nas ",
"test/class.nas ",
"test/coroutine.nas ",
"test/diff.nas ",
"test/exception.nas ",
"test/fib.nas ",
"test/filesystem.nas ",
"test/hexdump.nas ",
"test/httptest.nas ",
"test/json.nas ",
"test/leetcode1319.nas ",
"test/lexer.nas ",
"test/life.nas ",
"test/loop.nas ",
"test/mandel.nas ",
"test/mandelbrot.nas ",
"test/md5.nas ",
"test/md5compare.nas ",
"test/module_test.nas ",
"test/nasal_test.nas ",
"test/occupation.nas ",
"test/pi.nas ",
"test/prime.nas ",
"test/qrcode.nas ",
"test/quick_sort.nas ",
"test/scalar.nas ",
"test/snake.nas ",
"test/tetris.nas ",
"test/trait.nas ",
"test/turingmachine.nas",
"test/utf8chk.nas ",
"test/wavecollapse.nas ",
"test/ycombinator.nas "
"ascii-art.nas ",
"auto_crash.nas ",
"bf.nas ",
"bfcolored.nas ",
"bfconvertor.nas ",
"bfs.nas ",
"bigloop.nas ",
"bp.nas ",
"calc.nas ",
"choice.nas ",
"class.nas ",
"coroutine.nas ",
"diff.nas ",
"exception.nas ",
"fib.nas ",
"filesystem.nas ",
"hexdump.nas ",
"httptest.nas ",
"json.nas ",
"leetcode1319.nas ",
"lexer.nas ",
"life.nas ",
"loop.nas ",
"mandel.nas ",
"mandelbrot.nas ",
"md5.nas ",
"md5compare.nas ",
"module_test.nas ",
"nasal_test.nas ",
"occupation.nas ",
"pi.nas ",
"prime.nas ",
"qrcode.nas ",
"quick_sort.nas ",
"scalar.nas ",
"snake.nas ",
"tetris.nas ",
"trait.nas ",
"turingmachine.nas",
"utf8chk.nas ",
"wavecollapse.nas ",
"ycombinator.nas "
];
var module=[
"module/fib.cpp ",
"module/keyboard.cpp ",
"module/nasocket.cpp ",
"module/libfib.nas ",
"module/libkey.nas ",
"module/libsock.nas "
"fib.cpp ",
"keyboard.cpp ",
"nasocket.cpp ",
"libfib.nas ",
"libkey.nas ",
"libsock.nas "
];
var getname=func(s){
@@ -95,22 +95,21 @@ var count=func(s,c){
return cnt;
}
var calc=func(codetype,files){
var calc=func(codetype,files,path=""){
println(codetype);
var (bytes,line,semi,line_cnt,semi_cnt)=(0,0,0,0,0);
forindex(var i;files){
var s=io.fin(getname(files[i]));
var s=io.fin(getname(path~files[i]));
(line_cnt,semi_cnt)=(count(s,'\n'),count(s,';'));
println(files[i],'| ',line_cnt,' \tline | ',semi_cnt,' \tsemi');
println(files[i],'| ',line_cnt,'\tline | ',semi_cnt,' \tsemi');
bytes+=size(s);
line+=line_cnt;
semi+=semi_cnt;
}
println('total: | ',line,' \tline | ',semi,' \tsemi');
println(' | ',bytes,'\tbytes| ',int(bytes/1024),' \tkb');
println('total: | ',line,'\tline | ',semi,' \tsemi');
println(' | ',int(bytes/1024),'\tkb');
return int(bytes/1024);
}
calc("source code:",source);
calc("lib:",lib);
calc("test file:",testfile);
calc("module:",module);
var all=calc("source code:",source)+calc("lib:",lib,"stl/")+calc("test file:",testfile,"test/")+calc("module:",module,"module/");
println('\ntotal: | ',all,'\tkb');