Code archives/Miscellaneous/ListAppendList and InsertListBeforeLink
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
ListAppendList(dest, from) will append 'from' to 'dest' InsertListBeforeLink(list, destlink) will insert a whole list before a link. Example code in the comments! | |||||
Function ListAppendList:Int(dest:TList, from:TList) Local copy:TList If dest = Null Or from = Null Or from.Count() = 0 Then Return False copy = from.Copy() InsertListBeforeLink(copy, dest._head) Return True End Function Function InsertListBeforeLink(thislist:TList, beforethis:TLink) Local this:TLink = thislist.FirstLink(), last:TLink = thislist.LastLink() 'this._succ = beforethis this._pred = beforethis._pred this._pred._succ = this last._succ = beforethis beforethis._pred = last End Function |
Comments
| ||
Example code: |
| ||
Alternatively: |
Code Archives Forum