;------------------------------------------------------------------------------------------------------------------------------------------ #DefineSubRoutine udsSwapInt (intNumberA, intNumberB) intNumberA = intNumberA ^ intNumberB intNumberB = intNumberA ^ intNumberB intNumberA = intNumberA ^ intNumberB #EndSubRoutine ;------------------------------------------------------------------------------------------------------------------------------------------ ;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfSwapInt (ptrA, ptrB) *ptrA = *ptrA ^ *ptrB *ptrB = *ptrA ^ *ptrB *ptrA = *ptrA ^ *ptrB ;.......................................................................................................................................... ; Note: Pointers ptrA and ptrB must point to two different memory places resp. variables, ; otherwise the content of the one and only referenced variable is XOR'ed to 0! ;.......................................................................................................................................... #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ :Test1 intNumberA = 221 intNumberB = 1954 strOut = "" strOut = strOut : "Before Swap: A=" : intNumberA : " B=" : intNumberB : @LF udsSwapInt (intNumberA, intNumberB) strOut = strOut : "After Swap: A=" : intNumberA : " B=" : intNumberB : @LF Message ("Test1|udsSwapInt", strOut) :Test2 intNumberA = 221 intNumberB = 1954 PtrGlobalDefine (intNumberA) PtrGlobalDefine (intNumberB) strOut = "" strOut = strOut : "Before Swap: A=" : intNumberA : " B=" : intNumberB : @LF udfSwapInt (&intNumberA, &intNumberB) strOut = strOut : "After Swap: A=" : intNumberA : " B=" : intNumberB : @LF Message ("Test2|udfSwapInt", strOut) :Test3 intNumberA = 221 intNumberB = 1954 strOut = "" strOut = strOut : "Before Swap: A=" : intNumberA : " B=" : intNumberB : @LF udfSwapInt (PtrGlobalDefine (intNumberA), PtrGlobalDefine (intNumberB)) strOut = strOut : "After Swap: A=" : intNumberA : " B=" : intNumberB : @LF Message ("Test3|udfSwapInt", strOut) Exit