>>> Continued from previous message
IF ArrayInfo(4, BYVAL Var1) = 12 THEN ' user defined TYPE
IF ArrayInfo(2, BYVAL Var1) ArrayInfo(2, BYVAL Var2) THEN
ERROR 10
END IF
END IF
END IF
! Lds SI,Var1 ;get the segmented address of the first variable
! Les DI,Var2 ;and for the second variable too
! Mov CX,NumBytes ;get the number of bytes to exchange
! Jcxz ExitLabel ;we can't swap zero bytes!
! Cld ;ensure Lodsb works forward
DoSwap:
! Mov AL,ES:[DI] ;get a byte from the second variable
! Xchg AL,[SI] ;swap it with the first variable
! Stosb ;complete the swap and also increment DI
! Inc SI ;point to the next byte in the first variable
! Loop DoSwap ;continue until done
ExitLabel:
END SUB
FUNCTION ARRAYDESC32 (ANY) AS DWORD
DIM Desc AS DWORD
! mov ax, [bp+6]
! mov bx, [bp+8]
! mov Desc[0], ax
! mov Desc[2], bx
FUNCTION = Desc
END FUNCTION
DEFINT A-Z
%TRUE = -1
%FALSE = NOT %TRUE
SUB REDIM.PRESERVE (InArray() AS STRING, NewMax AS INTEGER)
ArrayStart = LBOUND (InArray)
ArrayEnd = UBOUND(InArray)
' We'd better make it HUGE, just in case the original array was
' huge....
DIM HUGE OutArray(ArrayStart:NewMax) AS STRING
SELECT CASE NewMax > ArrayEnd
CASE %TRUE
FOR i = ArrayStart TO ArrayEnd
OutArray(i) = InArray(i)
NEXT i
CASE %FALSE
FOR i = ArrayStart TO NewMax
OutArray(i) = InArray(i)
NEXT i
END SELECT
SwapArray ARRAYDESC32(InArray()),_
ARRAYDESC32(OutArray()),_
%ARRAY.DESC.SIZE
END SUB
SUB REDIM.PRESERVE.OLD (InArray() AS STRING, NewMax AS INTEGER)
ArrayStart = LBOUND (InArray)
ArrayEnd = UBOUND(InArray)
' We'd better make it HUGE, just in case the original array was
' huge....
DIM HUGE OutArray(ArrayStart:NewMax) AS STRING
SELECT CASE NewMax > ArrayEnd
CASE %TRUE
FOR i = ArrayStart TO ArrayEnd
OutArray(i) = InArray(i)
NEXT i
REDIM InArray(ArrayStart:NewMax) AS STRING
FOR i = ArrayStart TO ArrayEnd
InArray(i) = OutArray(i)
NEXT i
CASE FALSE
FOR i = ArrayStart TO NewMax
OutArray(i) = InArray(i)
NEXT i
REDIM InArray(ArrayStart:NewMax) AS STRING
FOR i = ArrayStart TO NewMax
InArray(i) = OutArray(i)
NEXT i
END SELECT
END SUB
--- Maximus/2 2.01wb
---------------
* Origin: Sound Stage BBS - Live Via Satellite - (604)944-6476 (1:153/7070)
|