I found that there are procedures available, also with syntax hints, but with no documentation.
CompareArray()
CompareList()
CompareMap()
Are they deprecated? for future version? or simply forgotten to add in the documentation?
@Fred
Can we use them

Code: Select all
Structure udtData
iVal.i
sVal.s
EndStructure
Global ds1.udtData
Global ds2.udtData
ds1\iVal = 100
ds1\sVal = "Hello World"
CopyStructure(ds1, ds2, udtData)
r1 = CompareStructure(ds1, ds2, udtData)
Debug r1
ds2\sVal = "hello world"
r1 = CompareStructure(ds1, ds2, udtData)
Debug r1
r1 = CompareStructure(ds1, ds2, udtData, #PB_String_NoCase)
Debug r1
Code: Select all
Structure TestStruct
value.l
List sublist.l()
EndStructure
Define a.TestStruct
AddElement(a\sublist()): a\sublist() = 1
AddElement(a\sublist()): a\sublist() = 2
; same
Define b.TestStruct
AddElement(b\sublist()): b\sublist() = 1
AddElement(b\sublist()): b\sublist() = 2
Debug CompareStructure(a, b, TestStruct)
; differnt
Define c.TestStruct
AddElement(c\sublist()): c\sublist() = 1
AddElement(c\sublist()): c\sublist() = 2
AddElement(c\sublist()): c\sublist() = 3
Debug CompareStructure(a, c, TestStruct)
Code: Select all
#PB_Memory_FollowPointers = (1 << 8)
Structure StructWithPtr
*Ptr.Long
EndStructure
Define v1.l = 123
Define v2.l = 123 ; same value as v1 but at a different address
Define a.StructWithPtr
a\Ptr = @v1
Define b.StructWithPtr
b\Ptr = @v2
; Not equal because the numeric pointer value "Ptr" is not the same
Debug CompareStructure(a, b, StructWithPtr)
; Equal because both pointers point to content that compares as equal
Debug CompareStructure(a, b, StructWithPtr, #PB_Memory_FollowPointers)
; A null pointer is not followed and considered equal only to another null pointer
Define c.StructWithPtr
c\Ptr = 0
Debug CompareStructure(a, c, StructWithPtr, #PB_Memory_FollowPointers)
; Pointers with invalid values are not allowed with #PB_Memory_FollowPointers for obvious reasons
; (same for recursive structures that point to themselves -> endless loop)
Define d.StructWithPtr
d\Ptr = 9999999999999
; This will crash!
; Debug CompareStructure(a, d, StructWithPtr, #PB_Memory_FollowPointers)
; This is safe however because without #PB_Memory_FollowPointers the pointer is just compared as a number
Debug CompareStructure(a, d, StructWithPtr)