Commit 30252ed0 authored by John Spikowski's avatar John Spikowski

OXSC190122

parent 58627558
del c.exe
del t.exe
del co2???.exe
del oxygen32.dll
del oxygen64.dll
......@@ -8,7 +8,7 @@
'Charles E V Pegge
$filename "finded.exe"
'uses rtl64
uses rtl64
uses searchutil
'string cfgs="tools\FindEd.cfg"
string cfgs="FindEd.cfg"
......
......@@ -22,6 +22,12 @@ rollbacks:
'11:16 24/12/2018 Support pre and post '++' '--' macro operators (++/--)
'11:10 18/12/2018 Prepare ert (o2_errno) for renumbering
11:10 22/01/2019 Windows Defender false positive oxygen.dll Win32/Fuery.B!ml Unwaders.C!ml
10:51 22/01/2019 Internal unaryh subroutine for 'not' and 'neg" etc
13:34 20/01/2019 Interal array expression flag irx (expr.inc irx)
13:31 20/01/2019 Perform "conv" before main calc (converterh hiex+=)
13:08 20/01/2019 Support "save" operation switch accum-based (expr.inc tran.inc)
13:38 16/01/2019 Fix 64bit extern variadics (expl.inc block if n)
15:48 14/01/2019 Fix qword literals: imul qword [rbx+4096] (assm.inc qword operand)
08:39 08/01/2019 Support macro ops: 'not' 'neg'
22:13 07/01/2019 Support Macromember functions (himac wt)
......
......@@ -486,7 +486,7 @@ end sub
sub newcleanvar(string *wn,*wr,int p)
=====================================
wn=newtmpvar(typename(p))
wr=mrcso(me-1,1) 'vector
if @wr then wr=mrcso(me-1,1) 'vector
end sub
......@@ -557,12 +557,14 @@ function buildparamblock(int pb, cc) as string
else 'm=2 'DIRECT LOAD TO REGISTER
if p<q then p=q 'highest unused reg
n=len(w3)
'EXTRACT OPERAND
a=instrevn(-1,w3,cm)
w4=mid(w3,a+1)
'PASS OPERAND DIRECTLY TO REGISTER
n=instrevn(a,w3,"mov ")
w2+=left(w3,n-1)+rgp(q)+w4
if n
'EXTRACT OPERAND
a=instrevn(-1,w3,cm)
w4=mid(w3,a+1)
'PASS OPERAND DIRECTLY TO REGISTER
n=instrevn(a,w3,"mov ")
w2+=left(w3,n-1)+rgp(q)+w4
endif
endif
pav(d)=""
if r11
......@@ -1042,7 +1044,7 @@ function compatsig(string*p1,*p2, int pb) as int
if findop(n,"conv",w1)
'deferred object creation
paj(pa)=n
mpfx+=w1+"(#obj#,("+pex(pa)+cm+pat(pa)+")"+cr
mpfx+=w1+"(#obj#,"+pex(pa)+cm+pat(pa)+")"+cr
pas(pa)="lea "+qeax+cm+"#obj#"+cr
pav(pa)=callcnvi(c,qeax,e)
k=2
......
......@@ -75,12 +75,12 @@
function express(string*s, int *i,*typx) as string
==================================================
'
int a,b,c,d,e,f,m,r,n,v,typa,typc,typi,opo,cp,tp,clbr,cbj,qp,pid,ctop
int nsl,ofpu,noto,noth,negh,fxsq,ocp,omp,ojn,uex,usx,ixnd,ixnt,pargl
int a,b,c,d,e,f,m,r,n,v,irx,typa,typc,typi,opo,cp,tp,clbr,cbj,qp,pid,ctop
int nsl,ofpu,noto,noth,savh,fxsq,ocp,omp,ojn,uex,usx,ixnd,ixnt,pargl
int xmode,xoffs,opcn,lazn,tya1
string w1,w2,w3,w4,w5,w6,wr,wrp,wt,wp,laz,lazt
string ixns,wpfxa,wpfxi,wra,wri,memba,xcalc
string opsh,cpsh,wacc,waco,waccp,wacop,hlex
string opsh,cpsh,wacc,waccp,hlex
static int po[8]
static double dw=0x7fffffff
......@@ -136,45 +136,38 @@
ret
'
'
opcall: 'subroutine
===================
'MACRO OP
hlex+=w2+"("+wacc+cm+owa+")"+cr
rps=1
skiplspace(s,i)
ret
opocall: 'subroutine
====================
'MACRO OP
newcleanvar(w5,waco,m)
hlex+=w2+"("+w5+cm+wacc+cm+owa+")"+cr
wacc=w5
rps=1
skiplspace(s,i)
ret
operationsh: 'subroutine
========================
'
'wr could be [...] or rax
a=0
m=typ
int opk=0
if op<2
opsh="move"
endif
m=typ
if findop(typ,opsh,w2)
'if op<2
' newcleanvar(wacc,waco,m)
'endif
'gosub opcall
if op<2
wacc=owa
if findop(typ,"save",w3)
savh=1
opk=1
else
wacc=owa
end if
else
gosub opocall
opk=1
end if
if opk
if savh
hlex+=w2+"("+owa+")"+cr
else
newcleanvar(w5,null,m)
hlex+=w2+"("+w5+cm+wacc+cm+owa+")"+cr
wacc=w5
endif
rps=1
skiplspace(s,i)
endif
typ=m
typa=m
typc=m
......@@ -188,10 +181,25 @@
converterh: 'subroutine
=======================
m=typc
if findop(m,"conv",w2)
w4=owa
newcleanvar(owa,wr,m) 'new owa and wr
hiex+=w2+"("+owa+cm+w4+cm+str(typ)+")"+cr
w1=""
rps=1
endif
typ=typc
typa=typc
ret
'
unaryh: 'subroutine
=======================
m=typc
if findop(m,w1,w2)
w4=owa
newcleanvar(owa,wr,m) 'new owa and wr
hlex+=w2+"("+owa+cm+w4+cm+str(typ)+")"+cr
hiex+=w2+"("+owa+cm+w4+")"+cr
w1=""
rps=1
endif
......@@ -212,7 +220,6 @@
if cpa>2
opsh=identops(op)
wacc=osg
waco=wsg
endif
endif
if op=-1
......@@ -285,7 +292,8 @@
'
select op
case -1
typc=typx : op=0 : goto nestpush 'ARRAY INDEX EVALUATION
typc=typx : op=0 : irx=1
goto nestpush 'ARRAY INDEX EVALUATION
case -2
typc=typx : goto nextops 'OPERATOR OR TERMINATOR EXPECTED
case 47 '/
......@@ -333,17 +341,19 @@
'
'CAPTURE FOR ARRAY TERMS
'
a=0
if varf>=8
a=1
elseif mc>=0
a=1
endif
if (a<>0)and(op<2)and(ctop=0)
typi=typ
if varf>=8 then typi=4
wpfxi=wpfx : wri=wr
endif
if irx
a=0
if varf>=8
a=1
elseif mc>=0
a=1
endif
if (a<>0)and(op<2)and(ctop=0)
typi=typ
if varf>=8 then typi=4
wpfxi=wpfx : wri=wr
endif
end if
'
typa=typ
'
......@@ -352,6 +362,17 @@
endif
'
'HIGHER TYPES
if typc>=typh
'UNARY
if ascw=0x6e 'n
if wr="not"
noth=1
goto oploop
endif
endif
endif
'
'HIGHER TYPES
if typ>=typh
'
if asgm
......@@ -374,28 +395,21 @@
endif
'
'
'
'HIGHER ACCUM
if (typc>=typh)and(typi=0)
'
'UNARY
if ascw=45
negh=1
goto oploop
endif
if wr="not"
noth=1
goto oploop
endif
'
'NESTED EXPRESSION
if ascw=lbr
a=i
w4=captsx(s,i)
i=a
opo=op
op=0
nst++
w4=captsx(s,i)
i=a
w1=express(s,i,typx) 'RECURSE
i++
skiplspace(s,i)
nst--
op=opo
'accum operand wg
......@@ -403,21 +417,19 @@
typa=typg
owa=accg
wr=wg
else
w4=owa
endif
'
'TYPE CONVERSION REQUIRED
if typa<>typc
typ=typa : w1="conv" : gosub converterh
typ=typa : gosub converterh
endif
if noth
w1="not" : gosub converterh
w1="not" : gosub unaryh
noth=0
endif
if negh
w1="neg" : gosub converterh
negh=0
if wordahead(s,i)="_neg"
i=nwd : skiplspace(s,i)
w1="neg" : gosub unaryh
endif
endif
'
......@@ -498,6 +510,7 @@
wpfx+=operi(a,typ,wr) 'USES LENT TO STEP
if ert then goto exitexpr
endif
'
if (ascw=45)and(mc<>-31)
op=1
if ascn=lbr
......@@ -650,13 +663,13 @@
'
'PARAMS WILL BE RESOLVED RECURSIVELY (procedures calls express)
'
if op<=1
if ascn=95
if wordahead(s,i)="_neg"
op=7 'neg load
endif
endif
endif
'if op<=1
' if ascn=95
' if wordahead(s,i)="_neg"
' op=7 'neg load
' endif
' endif
'endif
'
'
ojn=jn
......@@ -707,12 +720,16 @@
if (typc>=typh)and(typ>=typh)and(indt=0)
'
wr=wg
hiex+=storecode(wp) 'preprocess
'
'TYPE CONVERSION REQUIRED
if typ<>typc
w1="conv" : gosub converterh
gosub converterh
endif
if wordahead(s,i)="_neg"
i=nwd : skiplspace(s,i)
w1="neg" : gosub unaryh
endif
hiex+=storecode(wp) 'preprocess
gosub operationsh
if ert
jmp fwd exitexpr
......@@ -2262,8 +2279,13 @@
'HIGHER TYPE COMPARE
'
if typc>=typh
waccp=wacc
wacop=waco
'STORE LEFT SIDE
if findop(typc,"save",w2)
newcleanvar(waccp,null,typc)
hlex+=w2+"("+waccp+")"+cr
else
waccp=wacc
endif
op=0
goto oploop
endif
......@@ -2498,11 +2520,15 @@
'HIGHER TYPE COMPARE
if typc>=typh
if findop(typc,cpsh,w2)
wr=wacop
owa=wacc
wacc=waccp
opsh=cpsh
gosub opcall
newcleanvar(w5,null,4)
if savh
hlex+=w2+"("+w5+cm+waccp+")"+cr
else
hlex+=w2+"("+w5+cm+waccp+cm+wacc+")"+cr
endif
wacc=w5
rps=1
skiplspace(s,i)
typc=4
typa=4
goto endexpr
......@@ -2584,6 +2610,7 @@
if hlex
if nst
if findop(typc,"save",w2)
newcleanvar(wacc,null,typc)
hlex+=w2+"("+wacc+")"+cr
end if
endif
......@@ -2593,11 +2620,11 @@
'RETURNING HIGHER ACCUM ADDRESS
if uex>=4096
accg=wacc
wg=waco
else
wg=wr
wr=pword(wacc,1)
endif
'
wg=wr
'
ascw=asc(wg)
skiplspace(s,i)
opg=op or uex : op=0
......@@ -3114,7 +3141,7 @@ function subsas(string*s, int*i, string*ur,*v, int igb) as int
if opg>=4096
epfx+=wd
'itr wd not used?
wd="lea "+qeax+cm+wg+cr 'accg waco
wd="lea "+qeax+cm+wg+cr 'accg
opg=1
elseif opg>=1024
b=typg
......
No preview for this file type
......@@ -18,7 +18,7 @@
uses TimeUtil
'
$ datetimestamp "2019-01-15T06:08:44"
$ datetimestamp "2019-01-22T10:56:30"
$ o2version chr(34)+"0.1.0 "+datetimestamp+chr(34)
'
'DEFINITIONS GROUP
......
'/*
'12:48 15/01/2019
'oleaut
'https://docs.microsoft.com/en-us/windows/desktop/api/oleauto/nf-oleauto-variantinit
uses corewin
uses variantutil
def sh print "%1 %2,%3"
macro variant_op
================
'
macro .init(a,b)
'sh init a b
VariantInit(a)
end macro
'
macro .free(a,b)
'sh free a b
VariantClear(a)
end macro
'
macro .move(a,b)
sh move a b
VariantCopy(a,b)
end macro
'
macro .+ (a,b,c)
sh + b c
VariantClear(a)
VarAdd(b,c,a)
end macro
'
macro .conv(a,b,t)
sh conv a b
VariantClear(a)
a.vt=VT_R8
a.dblval=b
end macro
'
macro .neg(a,b)
sh conv a b
VariantClear(a)
VarNeg(b,a)
end macro
'
macro .not(a,b)
sh conv a b
VariantClear(a)
VarNot(b,a)
end macro
'
end macro
'#RECORDOF VARIANT
variant x,y,z
'x.vt=VT_R8 : x.dblval=2.5
'x=y
'x=y+z
x=2.5
y=x+x
'variantcopy y,x
print y.vt " " y.dblval
'print "ok"
'*/
/*
void VariantInit(
VARIANTARG *pvarg
);
HRESULT VarR8FromI4(
LONG lIn,
DOUBLE *pdblOut
);
HRESULT VariantChangeType(
VARIANTARG *pvargDest,
const VARIANTARG *pvarSrc,
USHORT wFlags,
VARTYPE vt
);
HRESULT VarMul(
LPVARIANT pvarLeft,
LPVARIANT pvarRight,
LPVARIANT pvarResult
);
HRESULT VarSub(
LPVARIANT pvarLeft,
LPVARIANT pvarRight,
LPVARIANT pvarResult
);
HRESULT VarNeg(
LPVARIANT pvarIn,
LPVARIANT pvarResult
);
HRESULT VarUI8FromR4(
FLOAT fltIn,
ULONG64 *pi64Out
);
HRESULT VariantClear(
VARIANTARG *pvarg
);
HRESULT VariantCopy(
VARIANTARG *pvargDest,
const VARIANTARG *pvargSrc
);
HRESULT VarNeg(
LPVARIANT pvarIn,
LPVARIANT pvarResult
);
HRESULT VarNot(
LPVARIANT pvarIn,
LPVARIANT pvarResult
);
HRESULT VariantChangeType(
VARIANTARG *pvargDest,
const VARIANTARG *pvarSrc,
USHORT wFlags,
VARTYPE vt
);
HRESULT VarR4FromStr(
LPCOLESTR strIn,
LCID lcid,
ULONG dwFlags,
FLOAT *pfltOut
);
HRESULT VarCat(
LPVARIANT pvarLeft,
LPVARIANT pvarRight,
LPVARIANT pvarResult
);
*/
/*
type xquad
dword lo
int hi
=
quad qu
'11:52 20/01/2019
'default copying
type asmint
int i
end type
asmint a,b,c,d
#show a=b
*/
/*
'06:02 20/01/2019
' operations
type asmint
int i
end type
macro asmint_op()
macro .move (a,b)
a.i=b.i
end macro
macro .+ (a,b,c)
a.i=b.i+c.i
end macro
macro .* (a,b,c)
a.i=b.i*c.i
end macro
end macro
asmint a,b,c,d
'#show a=b
'#show a=b+c
'#show a=b+c+d
'#show a=(b+c)*d
'#show a=b+(c*d)
'#show a=b+(c*d)+(c*d)
#show a=b+c*d+c*d
*/
'/*
'05:36 20/01/2019
'save' accumulator-based operations
type asmint
int i
end type
macro asmint_op()
macro .save (a)
mov a.i,eax
end macro
macro .move (a)
mov eax,a.i
end macro
macro .+ (a)
add eax,a.i
end macro
macro .* (a)
mul a.i
end macro
macro .conv (a,b,t)
mov ecx,b
mov a,ecx
end macro
macro .neg (a,b)
mov ecx,b
neg ecx
mov a,ecx
end macro
macro .not (a,b)
mov ecx,b
not ecx
mov a,ecx
end macro
macro .>= (a,b)
cmp b.i,eax
mov eax,0
setg al
mov a,eax
end macro
end macro
asmint a,b,c,d
int i,j
'#show {
'if i+0>=j+0
'if a>=b
'if (a>=b)+(c>=d)
'endif
'while a>=b
' exit while
'wend
'}
'#show a=b
'#show a=b+c
'#show a=b+c+d
'#show a=b+(c*d)
'#show a=b+(c*d)+(c*d)
'#show a=42
'#show a=b+42
function f(asmint*a) as asmint
return.i=a.i
end function
'#show a=f(b)
'#show a=b+f(c)
'#show a=f(42)
'#show a=-b
'#show a=b+-c
'#show a=-f(b)
'#show a=b+ -f(c)
'#show a=not(b)
'#show a=b+ not(f(c))
'int i,j
'#show i=i+-j
'*/
/*
'18:10 18/01/2019
'NULL VARIADICS / FIXED
$filename "t.exe"
uses rtl64
typedef void*msys
extern
function f(msys a,...) as msys
end function
#show f null
*/
/*
'12:45 15/01/2019
uses corewin
'extern
quad gtc64() at @GetTickCount64
......@@ -45,7 +307,7 @@ quad q=0x1000
print hex rax
*/
'/*
/*
'QUAD INPUT
$filename "t.exe"
uses rtl64
......@@ -55,7 +317,7 @@ quad qs=0x10000 : qs*=0x10000
#show quad a= 0x12345678*qs+0x9abcdef0
'quad b=qs*0x1D4A9EB+0xC4E94E60
print hex a
'*/
*/
/*
$filename "t.exe"
......@@ -82,8 +344,8 @@ print a
'
'ARRAY SYSTEM
class ArrayObj '1D 2D 3D
========================
class ArrayObj 'supporting 1D 2D 3D
===================================
sys bu 'member buffer
sys pd 'member destructor
int sn,sx,sy,sz 'sizes
......@@ -100,7 +362,7 @@ print a
sys p=bu
sys n=sn
for i=1 to sx*sy*sz
call d(p) 'destructor for each
call d(p) 'destructor for each member
p+=n
next
endif
......@@ -123,13 +385,13 @@ print a
end class
'
'
def CreateArray '1D 2D 3D
=========================
def CreateArray
===============
'%1 type
'%2 var name
'%3 array dimensions
'
ArrayObj %2_obj
ArrayObj %2_obj 'supporting 1D 2D 3D arrays
sys %2_dstr
#ifdef %1.destructor
%2_dstr=@%1.destructor()
......@@ -150,146 +412,13 @@ print a
CreateArray vector v(2,4,6)
v(1,2,3).y=2.5
v(1,2,3).z=4.5
v(1,2,3)={10,20,30}
'v(1,2,3)={10,20,30}
print v(1,2,3).y
v(2,3,4)=v(1,2,3)
print v(2,3,4).y
*/
/*
'oleaut
'https://docs.microsoft.com/en-us/windows/desktop/api/oleauto/nf-oleauto-variantinit
uses corewin
uses variantutil
def sh print "%1 %2,%3"
macro variant_op
================
'
macro .init(a,b)
'sh init a b
VariantInit(a)
end macro
'
macro .free(a,b)
'sh free a b
VariantClear(a)
end macro
'
macro .move(a,b)
sh move a b
VariantCopy(a,b)
end macro
'
macro .+ (a,b,c)
sh + b c
VariantClear(a)
VarAdd(b,c,a)
end macro
'
macro .conv(a,b,t)
sh conv a b
VariantClear(a)
a.vt=VT_R8
a.dblval=b
end macro
'
macro .neg(a,b)
sh conv a b
VariantClear(a)
VarNeg(b,a)