I wrote a procedure that sorts StructuredPointerLists() the same as the original SortStructuredList() procedure.
Code: Select all
Procedure SortStructuredPointerList(List *pointerlist(), options, offset, type)
Since I do not use the structure elements anyway this is not needed inside the procedure, but for most of my StructuredPointerLists I use the structure elements (outside of the sorting procedure) and I do not want to remove the structure from the list out of lazyness

TL;DR: How can I pass a PointerList with an arbitrary structure (.i, .s, .custom) to a procedure that only wants to work on the element pointers?
Everything is using pointers only anyway. Direct access using \ is just for simplicity but not required when working with pointers...
Example code:
Code: Select all
EnableExplicit
Structure myListStruct
int.i
str$
EndStructure
Procedure doStuff(List *pointerlist())
; here, some magic happens
EndProcedure
Define item1.myListStruct\int = Random(100)
Define item2.myListStruct\int = Random(100)
Define item3.myListStruct\int = Random(100)
Define NewList *pointerList.myListStruct()
AddElement(*pointerList())
*pointerList() = @item1
AddElement(*pointerList())
*pointerList() = @item2
AddElement(*pointerList())
*pointerList() = @item3
doStuff(*pointerList()) ; Throws: [COMPILER] The list doesn't match with the procedure parameter.