diff --git a/test/hexdump.nas b/test/hexdump.nas index fb62c54..8ed5aa0 100644 --- a/test/hexdump.nas +++ b/test/hexdump.nas @@ -1,5 +1,9 @@ +# hexdump.nas by ValKmjolnir +# 2021/8/13 + import("lib.nas"); +# init var hex_num=[ '0','1','2','3', '4','5','6','7', @@ -9,17 +13,79 @@ var hex_num=[ var hex=[]; foreach(var i;hex_num) foreach(var j;hex_num) - append(hex,'0x'~i~j); -var s=io.fin("lib.nas"); + append(hex,i~j); +# read file +var s=func() +{ + var filename=[ + "nasal.h", + "main.cpp", + "nasal_ast.h", + "nasal_builtin.h", + "nasal_codegen.h", + "nasal_gc.h", + "nasal_import.h", + "nasal_lexer.h", + "nasal_parse.h", + "nasal_vm.h", + ]; + var ret=""; + foreach(var elem;filename) + ret~=io.fin(elem); + return ret; +}(); + +# used to change line and control the spaces var cnt=0; -print(0,'\t'); -for(var i=0;i=0;i-=1) + print(hex[hex_index[i]]); + print(' '); + return; +} + +# main +func() +{ + indexprint(0); + for(var i=0;i