REQUEST?
I am using the Linked List in Emergence with my own databases and would find it very handy if two more functions were added to the Linked List module.
ListGetPrev or ListGetPrior
and also
ListGetLast
It would be useful for navigating with one to many table connections.
You might want to try my LList object which contains that functionality.
http://www.ionicwind.com/forums/index.php/topic,1632.msg15203.html#msg15203 (http://www.ionicwind.com/forums/index.php/topic,1632.msg15203.html#msg15203)
Larry
Larry, I have followed your posts on the LL and have downloaded and read up the Help file.
Really great work. Thank you.
Will it also work with EBasic Linux?
I requested the extra functions hoping for portability and compact code in EBasic.
The linked list in Emergence are doubly linked lists. It's a simple matter to get the previous node:
SUB ListGetPrev(pos as POINTER),POINTER
DEF pReturn as POINTER:pReturn = NULL
IF pos <> 0
RETURN #<LINKEDLIST>pos.pPrev
ENDIF
RETURN pReturn
ENDSUB
Lists don't have a definitive 'end' so a ListGetLast would have to iterate through the entire list to find the last node.
SUB ListGetLast(list as POINTER),POINTER
DEF pTemp as POINTER
IF list <> 0
pTemp = list
WHILE #<LINKEDLIST>pTemp.pNext <> 0
pTemp = #<LINKEDLIST>pTemp.pNext
ENDWHILE
ENDIF
RETURN pTemp
ENDSUB
The LINKEDLIST type is automatically defined for you.
Paul.
Thanks for the code Paul.
Allan,
My LList was an exercise I went through to really practice with pointers. "Pointers were not my friend".
It was also an exercise in writing a Class.
If I was going to have any success with my xml efforts I was going to need to be comfortable with all the code in my LList class.
I needed the "missing" functions that Paul provided below. And my little LList effort put it all together for me.
It was not intended to replace Paul's LinkList fuctions or to compete with them in any way.
Just like my XML class.
I figure some day that Paul (or Sapero) will be looking for something to do and will write a XML Class that blows my pitiful little efforts plum out of the water. Until then mine is there for anyone who is interested to use.
Will it also work with EBasic Linux?
It is my understanding that the source probably will but the current .lib file won't.
But that's a question for Paul to answer.
Larry
Larry, I followed your work on XML Posts also. Great.
Have not had need of XML in Windows as of yet though I have used it on PocketPC with the same prog that I am building with EBasic for Windows and....
If you are interested here is a link that has some info on XML CLASS stuff.
http://www.codeproject.com/cpp/FlexibleParser.asp (http://www.codeproject.com/cpp/FlexibleParser.asp)
Thanks for your advice and help.