|
dnl
Generic Double Linked List
Module DescriptionThe dnl module implements a double linked list that can handle variable size nodes. It is the base module for more specialised modules, for example the double linked cell list dcl module. Module WordsList structurednl% ( -- n ) Get the required space for a dnl variable List creation, initialisation and destructiondnl-init ( dnl -- ) Initialise the listdnl-(free) ( xt dnl -- ) Free the nodes in the list from the heap using xtdnl-create ( "<spaces>name" -- ; -- dnl ) Create a named dnl list in the dictionarydnl-new ( -- dnl ) Create a new dnl list on the heapdnl-free ( dnl -- ) Free the list from the heap Member wordsdnl-length@ ( dnl -- u ) Get the number of nodes in the listdnl-empty? ( dnl -- flag ) Check for empty listdnl-first@ ( dnl -- dnn | nil ) Get the first node in the listdnl-last@ ( dnl -- dnn | nil ) Get the last node in the list List wordsdnl-append ( dnn dnl -- ) Append the node dnn in the listdnl-prepend ( dnn dnl -- ) Prepend the node dnn in the listdnl-insert-before ( dnn1 dnn2 dnl -- ) Insert the new node dnn1 before the reference node dnn2 in the listdnl-insert-after ( dnn1 dnn2 dnl -- ) Insert the new node dnn1 after the reference node dnn2 in the listdnl-remove ( dnn dnl -- ) Remove the node dnn from the list Index wordsdnl-index? ( n dnl -- flag ) Check if the index n is valid in the listdnl-get ( n dnl -- dnn ) Get the nth node from the listdnl-insert ( dnn n dnl -- ) Insert the node dnn before the nth node in the listdnl-delete ( n dnl -- dnn ) Delete the nth node from the list, return the deleted node LIFO wordsdnl-push ( dnn dnl -- ) Push the node dnn at the end of the listdnl-pop ( dnl -- dnn | nil ) Pop the node dnn from the end of the listdnl-tos ( dnl -- dnn | nil ) Get the node dnn from the end of the list FIFO wordsdnl-enqueue ( dnn dnl -- ) Enqueue the node dnn at the start of the listdnl-dequeue ( dnl -- dnn | nil ) Dequeue the node dnn from the end of the list Special wordsdnl-execute ( i*x xt dnl -- j*x ) Execute xt for every node in listdnl-reverse ( dnl -- ) Reverse or mirror the list Inspectiondnl-dump ( dnl -- ) Dump the list Generated by ofcfrth-0.10.0 |