Linked lists
From: The /\\\\o//\\annabee (Faq(Sqeeeek!)_at_.@szmyggenpv.com)
Date: 12/31/04
- Next message: KiLVaiDeN: "Re: Linked lists"
- Previous message: Annie: "Re: [OT] Christmas Spot the Difference Competition!"
- Next in thread: KiLVaiDeN: "Re: Linked lists"
- Reply: KiLVaiDeN: "Re: Linked lists"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 31 Dec 2004 13:21:03 +0100
Seriously.
Can someone help me verify the logic of this
code ? the more I look at it, the more I am convinced it should work,
but some bugs arises when I enable it....and the bug is an endless loop.
So, that is probably because some wrong relinking of the linked list.
Can you spot the error? I must have become blind from looking at it....
SkinWindow.AddSectionToHiddenList:
push D$esi + SkinWindow.HiddenSections ;pushes the first
section in list or NULL
mov D$esi + SkinWindow.HiddenSections edi ;Moves a section to
the front of the list
pop D$edi + SkinSection.HiddenNext ;pops the back of the
previous list
ret
For the above we should have either :
ListHeader --> Section1 --> NULL
ListHeader --> Section2 --> Section1 --> NULL
etc.
------------------------
then, here is the code that maybe introduses the bug. It would be good if
a couple of experienced eyes could look at it and verify the logic is
correct.
What we do here is search the list, and when we find the item to be
removed from the list,
by comparing it (EDI) to each item
SkinWindow.RemoveSectionFromHiddenList:
ifAssigned D$esi + SkinWindow.HiddenSections
mov eax D$esi + SkinWindow.HiddenSections
mov ecx 0
___________________________;search
While eax <> edi
mov ecx eax
mov eax D$eax + SkinSection.HiddenNext
cmp eax 0 | je L7>
End_While
;now eax = edi
____________________________;needs verified :
push D$eax + SkinSection.HiddenNext ;push next or NULL
if ecx <> 0
pop D$ecx + SkinSection.HiddenNext ;link previous to
after or NULL
else
pop D$esi + SkinWindow.HiddenSections ;terminate or
shorten list
end_if
mov D$edi + SkinSection.HiddenNext 0 ;delete from list
L7:
EndIfAssigned
ret
Thanks.
--
- Next message: KiLVaiDeN: "Re: Linked lists"
- Previous message: Annie: "Re: [OT] Christmas Spot the Difference Competition!"
- Next in thread: KiLVaiDeN: "Re: Linked lists"
- Reply: KiLVaiDeN: "Re: Linked lists"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|