Element Math Vars if Self#.Result.use eq 1 if Self#.prop.ResultType eq 0 Self#.result dd ? else Self#.result dq ? end if end if Create if Self#.Result.use match =0,Self#.prop.ResultType \{ mov [Self#.result],Self#.prop.Default.AsInt \} match =1,Self#.prop.ResultType \{ fmov_ex Self#.result,Self#.prop.Default \} end if PointWork doOperation \local err,ok,res.t match =0,Self#.prop.OpType \\{himath1 Self,data,data.type,res.t,fadd\\} match =1,Self#.prop.OpType \\{himath1 Self,data,data.type,res.t,fsub\\} match =2,Self#.prop.OpType \\{himath1 Self,data,data.type,res.t,fmul\\} match =3,Self#.prop.OpType \\{himath1 Self,data,data.type,res.t,fdiv\\} match =4,Self#.prop.OpType \\{himath2 Self,data,data.type,res.t,add\\} match =5,Self#.prop.OpType \\{himath2 Self,data,data.type,res.t,sub\\} match =6,Self#.prop.OpType \\{himathmul Self,data,data.type,res.t\\} match =7,Self#.prop.OpType \\{himathdiv Self,data,data.type,res.t,eax,err\\} match =8,Self#.prop.OpType \\{himathdiv Self,data,data.type,res.t,edx,err\\} match =9,Self#.prop.OpType \\{himath2 Self,data,data.type,res.t,and\\} match =10,Self#.prop.OpType \\{himath2 Self,data,data.type,res.t,or\\} match =11,Self#.prop.OpType \\{himath2 Self,data,data.type,res.t,xor\\} match =12,Self#.prop.OpType \\{himathshift Self,data,data.type,res.t,shl\\} match =13,Self#.prop.OpType \\{himathshift Self,data,data.type,res.t,shr\\} if Self#.onError.use eq 1 jmp ok err: Self#.onError 0,data_null,exit jmp exit ok: else err = exit end if match =0 =7,Self#.prop.ResultType res.t \\{ fistp [_data] \\} match =0 =1,Self#.prop.ResultType Self#.Result.use \\{ pushd [_data] pop [Self#.result] \\} match =0,Self#.prop.ResultType \\{ Self#.onResult [_data],data_int,exit \\} match =1 =1,Self#.prop.ResultType res.t \\{ fild [_data] \\} match =1 =1,Self#.prop.ResultType Self#.Result.use \\{ fst [Self#.result] \\} match =1,Self#.prop.ResultType \\{ Self#.onResult 1,data_real_st0,exit \\} EndPoint PointWork doClear match =0,Self#.prop.ResultType \\{ mov [Self#.result],Self#.prop.Default.AsInt \\} match =1,Self#.prop.ResultType \\{ fmov_ex Self#.result,Self#.prop.Default \\} EndPoint PointVar Result match =0,Self#.prop.ResultType \\{ result equ [Self#.result] result.type equ data_int \\} match =1,Self#.prop.ResultType \\{ result equ Self#.result result.type equ data_real \\} EndPoint EndElement macro himath1 Self,data,data.type,res.t,op { ;+ - * / local op1,op2 ReadReal op1,data,data.type,Self#.Op1,Self#.prop.Op1 if ~ op1 eq 1 if op1 eqtype 0 | op1 eqtype eax fld qword [op1] else fld qword op1 end if end if ReadReal op2,data,data.type,Self#.Op2,Self#.prop.Op2 if op2 eq 1 op#p st1,st0 else if op2 eqtype 0 | op2 eqtype eax op qword [op2] else op qword op2 end if end if res.t equ data_real } macro himath2 Self,data,data.type,res.t,op { ;add sub and or xor local op1,op2 ReadInt op1,data,data.type,Self#.Op1,Self#.prop.Op1.AsInt push op1 ReadInt op2,data,data.type,Self#.Op2,Self#.prop.Op2.AsInt if op2 eq [_data] pop eax op eax,[_data] mov [_data],eax else pop [_data] if op2 eqtype 0 | op2 eqtype eax op [_data],op2 else mov eax,op2 op [_data],eax end if end if res.t equ data_int } macro himathmul Self,data,data.type,res.t { local op1,op2 ReadInt op1,data,data.type,Self#.Op1,Self#.prop.Op1.AsInt push op1 ReadInt op2,data,data.type,Self#.Op2,Self#.prop.Op2.AsInt if op2 eq eax pop ecx imul ecx,eax mov [_data],ecx else pop eax imul eax,op2 mov [_data],eax end if res.t equ data_int } macro himathdiv Self,data,data.type,res.t,reg,err { local op1,op2 ReadInt op1,data,data.type,Self#.Op1,Self#.prop.Op1.AsInt push op1 ReadInt op2,data,data.type,Self#.Op2,Self#.prop.Op2.AsInt mov_ex ecx,op2 pop eax test ecx,ecx jz err cdq idiv ecx mov [_data],reg res.t equ data_int } macro himathshift Self,data,data.type,res.t,op { local op1,op2 ReadInt op1,data,data.type,Self#.Op1,Self#.prop.Op1.AsInt push op1 ReadInt op2,data,data.type,Self#.Op2,Self#.prop.Op2.AsInt mov_ex ecx,op2 pop eax op eax,cl mov [_data],eax res.t equ data_int }