change visual settings in -c/-dbg

This commit is contained in:
ValKmjolnir 2022-04-23 01:51:49 +08:00
parent 2dc8459cbf
commit 785572634b
12 changed files with 32 additions and 31 deletions

View File

@ -205,7 +205,6 @@ private:
std::stack<uint32_t> fbstk;
std::stack<uint32_t> festk;
void die(std::string,const uint32_t);
void regist_number(const double);
void regist_string(const std::string&);
@ -1265,7 +1264,8 @@ void nasal_codegen::print_op(uint32_t index)
// print detail info
switch(c.op)
{
case op_addeq: case op_subeq: case op_muleq: case op_diveq: case op_lnkeq:
case op_addeq: case op_subeq: case op_muleq: case op_diveq:
case op_lnkeq: case op_meq:
printf("0x%x sp-%u\n",c.num,c.num);break;
case op_addeqc:case op_subeqc: case op_muleqc:case op_diveqc:
printf("0x%x (",c.num&0x7fffffff);
@ -1280,12 +1280,11 @@ void nasal_codegen::print_op(uint32_t index)
case op_callvi:case op_newv: case op_callfv:
case op_intg: case op_intl:
case op_newf: case op_jmp: case op_jt: case op_jf:
printf("0x%x\n",c.num);break;
case op_callb:
printf("0x%x <%s@0x%lx>\n",c.num,builtin[c.num].name,(uint64_t)builtin[c.num].func);break;
case op_callg: case op_mcallg: case op_loadg:
case op_calll: case op_mcalll: case op_loadl:
printf("0x%x\n",c.num);break;
case op_callb:
printf("0x%x <%s@0x%lx>\n",c.num,builtin[c.num].name,(uint64_t)builtin[c.num].func);break;
case op_upval:case op_mupval: case op_loadu:
printf("0x%x[0x%x]\n",(c.num>>16)&0xffff,c.num&0xffff);break;
case op_happ: case op_pstr:
@ -1293,8 +1292,6 @@ void nasal_codegen::print_op(uint32_t index)
case op_callh: case op_mcallh:
case op_para: case op_defpara:case op_dynpara:
printf("0x%x (\"%s\")\n",c.num,rawstr(str_res[c.num]).c_str());break;
case op_meq:
printf("0x%x sp-%u\n",c.num,c.num);break;
default:printf("\n");break;
}
}

View File

@ -163,29 +163,47 @@ void nasal_vm::valinfo(nasal_ref& val)
void nasal_vm::bytecodeinfo(const char* header,const uint32_t p)
{
const opcode& c=bytecode[p];
printf("%s0x%.8x: %s 0x%x",header,p,code_table[c.op].name,c.num);
printf("%s0x%.8x: %.2x %.2x %.2x %.2x %.2x %s ",
header,
p,
c.op,
uint8_t((c.num>>24)&0xff),
uint8_t((c.num>>16)&0xff),
uint8_t((c.num>>8)&0xff),
uint8_t(c.num&0xff),
code_table[c.op].name
);
switch(c.op)
{
case op_addeq: case op_subeq: case op_muleq: case op_diveq: case op_lnkeq:
printf(" sp-%u",c.num);break;
case op_addeq: case op_subeq: case op_muleq: case op_diveq:
case op_lnkeq: case op_meq:
printf("0x%x sp-%u",c.num,c.num);break;
case op_addeqc:case op_subeqc: case op_muleqc:case op_diveqc:
std::cout<<" ("<<num_table[c.num&0x7fffffff]<<") sp-"<<(c.num>>31);break;
printf("0x%x (",c.num&0x7fffffff);
std::cout<<num_table[c.num&0x7fffffff]<<") sp-"<<(c.num>>31);
break;
case op_lnkeqc:
printf(" (\"%s\") sp-%u",rawstr(str_table[c.num&0x7fffffff]).c_str(),c.num>>31);break;
printf("0x%x (\"%s\") sp-%u",c.num&0x7fffffff,rawstr(str_table[c.num&0x7fffffff]).c_str(),c.num>>31);break;
case op_addc: case op_subc: case op_mulc: case op_divc:
case op_lessc: case op_leqc: case op_grtc: case op_geqc:
case op_pnum:
std::cout<<" ("<<num_table[c.num]<<")";break;
printf("0x%x (",c.num);std::cout<<num_table[c.num]<<")";break;
case op_callvi:case op_newv: case op_callfv:
case op_intg: case op_intl:
case op_newf: case op_jmp: case op_jt: case op_jf:
case op_callg: case op_mcallg: case op_loadg:
case op_calll: case op_mcalll: case op_loadl:
printf("0x%x",c.num);break;
case op_callb:
printf(" <%s@0x%lx>",builtin[c.num].name,(uint64_t)builtin[c.num].func);break;
printf("0x%x <%s@0x%lx>",c.num,builtin[c.num].name,(uint64_t)builtin[c.num].func);break;
case op_happ: case op_pstr:
case op_lnkc:
case op_callh: case op_mcallh:
case op_para: case op_defpara:case op_dynpara:
printf(" (\"%s\")",rawstr(str_table[c.num]).c_str());break;
printf("0x%x (\"%s\")",c.num,rawstr(str_table[c.num]).c_str());break;
case op_upval: case op_mupval: case op_loadu:
printf(" (0x%x[0x%x])",(c.num>>16)&0xffff,c.num&0xffff);break;
default:break;
default:printf("0x%x",c.num);break;
}
printf(" (%s:%d)\n",files[c.fidx].c_str(),c.line);
}

View File

@ -1,4 +1,3 @@
import("lib.nas");
import("test/md5.nas");
rand(time(0));

View File

@ -1,5 +1,3 @@
import("lib.nas");
var (t,res)=(1,0);
for(var m=1;m<4e6;m+=2)
{

View File

@ -1,5 +1,3 @@
import("lib.nas");
var code=[
[1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1],
[1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1],

View File

@ -1,4 +1,3 @@
import("lib.nas");
var sort=func(vec,left,right)
{
if(left>=right) return;

View File

@ -1,5 +1,4 @@
# basic type
import("lib.nas");
nil;
2147483647;
0x7fffffff;

View File

@ -1,4 +1,3 @@
import("lib.nas");
var trait={
get:func{return me.val;},

View File

@ -1,4 +1,3 @@
import("lib.nas");
var table=[
['q0','0','1','R','q1'],

View File

@ -1,7 +1,5 @@
# wave collapse function 2022/4/10
# by ValKmjolnir
import("lib.nas");
srand();
var interval=1/60;
var table=[

View File

@ -1,7 +1,4 @@
# Y combinator by ValKmjolnir
import("lib.nas");
var fib=func(f){
return f(f);
}(