Discussion:
"equivalence" statement
Daniel DRIJARD
2017-06-04 16:15:31 UTC
Permalink
Hello,

I have a simple routine Ucopy which copies words of an array into another array:
Ucopy ( ByRef VarInp(IoInp) as integer, Byref VarOut(IoOut) as integer,Nb as integer )
where I use:
For i=1 to Nb
VarOut(i)=VarInp(i)

I want to generalise it to 2-dimensional arrays (or more generally multi-dimensional). I tried:
Ucopy2 ( ByRef VarInp(,) as integer, Byref VarOut(,) as integer, Nb as integer )
but now I cannot execute the copy statement. I would need an “equivalence” statement (as is known in FORTRAN) to define 1-dimensional arrays
sharing the same successive words as VarInp/VarOut. For example (if “equivalence” existed):
dim VarInp(5,20),VarOut(5,20),VarInp2(100),VarOut2(100) ,IoInp,ioOut as integer
equivalence (VarInp2(1),VarInp(1,1)), (VarOut2(1),VarOut(1,1))
then the following would be correct
call Ucopy2(VarInp2(ioBoth,ioInp),VarOut2(ioBoth,ioOut),Nb)
Ucopy2 ( ByRef Var2() as integer, Byref Var2() as integer, Nb as integer )
For i=1 to Nb
Var2(i)=Var2(i)
This implies that VarInp and VarOut have the same first dimension

Is there a way to simulate the “equivalence” statement ?

Cordially,
Daniel


_______________________________________________

Xojo forum:

https:/

Loading...