A SwapLists() function would be nice, since lists cannot be swaped like (e.g.) arrays, using the Swap keyword (this would just swap the two active elements).
At the moment swapping lists with a good performance is only possible by using either this combo...
Code: Select all
FirstElement(ListA())
MergeLists(ListB(), ListA(), #PB_List_Before)
SplitList(ListA(), ListB(), #False)
Code: Select all
Structure StrucList
List s.s()
EndStructure
Define *ListA.StrucList = AllocateMemory(SizeOf(StrucList))
Define *ListB.StrucList = AllocateMemory(SizeOf(StrucList))
InitializeStructure(*ListA, StrucList)
InitializeStructure(*ListB, StrucList)
AddElement(*ListA\s()) : *ListA\s() = "a1"
AddElement(*ListA\s()) : *ListA\s() = "a2"
AddElement(*ListB\s()) : *ListB\s() = "b1"
AddElement(*ListB\s()) : *ListB\s() = "b2"
Swap *ListA, *ListB
Debug "=== ListA ==="
ForEach *ListA\s()
Debug *ListA\s()
Next
Debug ""
Debug "=== ListB ==="
ForEach *ListB\s()
Debug *ListB\s()
Next