There was some work about this at the forum but i founded a little confusing so i did these functions.
They are done to have linked lists inside linked lists. Basically i coded a double linked list with the same commands as the PB lists and *almost* the same behaviour. The difference is that this lists are handled through its pointer, so you can create lists dinamically and have nested lists because you can store the pointer to a list inside an element of a list.
The idea is to use a PB list for the main list and use the functions for the nested list.
I spent some time writing examples and explaining the functions, it's here, you need to paste the link into a d/L manager os use save target as on the link:
http://www.angelfire.lycos.com/alt2/jus ... ist1.0.zip
The code is very portable, it does not use structures, all the memory is handled by peek/poke and using globalalloc , only for windows.
It's not extensively tested but i think it works well, commands are:
NewListX()
NextElementX()
PreviousElementX()
AddElementX()
InsertElementX()
SelectElementX()
ChangeListPointerX()
ListPointerX()
ListIndexX()
CountListX()
ResetListX()
LastElementX()
FirstElementX()
DeleteElementX()
ClearListX()
FreeListX()
SwitchElementX()
Nested Linked Lists
- tinman
- PureBasic Expert
- Posts: 1102
- Joined: Sat Apr 26, 2003 4:56 pm
- Location: Level 5 of Robot Hell
- Contact:
Re: Nested Linked Lists
You realise you could have saved yourself some time by just looking at the resources site and modifying my code? That's why the source is included...Justin wrote:The code is very portable, it does not use structures, all the memory is handled by peek/poke and using globalalloc , only for windows.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
(WinXPhSP3 PB5.20b14)