"equivalence" statement

Daniel DRIJARD <[email protected]>
Newsgroups gmane.comp.lang.realbasic.user
Message-ID <[email protected]>
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://forum.xojo.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.