## dnl - Generic Double Linked List

### Module Description

The dnl module implements a double linked list that can handle variable size nodes. It is the base module for more specialized modules, for example the double linked cell list [dcl] module.

### Module Words

#### List structure

dnl% ( -- n )
  Get the required space for a dnl variable

#### List creation, initialisation and destruction

dnl-init ( dnl -- )
  Initialise the list
dnl-(free) ( xt dnl -- )
  Free the nodes in the list from the heap using xt
dnl-create ( "<spaces>name" -- ; -- dnl )
  Create a named dnl list in the dictionary
dnl-new ( -- dnl )
  Create a new dnl list on the heap
dnl-free ( dnl -- )
  Free the list from the heap

#### Member words

dnl-length@ ( dnl -- u )
  Get the number of nodes in the list
dnl-empty? ( dnl -- flag )
  Check for empty list
dnl-first@ ( dnl -- dnn | nil )
  Get the first node in the list
dnl-last@ ( dnl -- dnn | nil )
  Get the last node in the list

#### List words

dnl-append ( dnn dnl -- )
  Append the node dnn in the list
dnl-prepend ( dnn dnl -- )
  Prepend the node dnn in the list
dnl-insert-before ( dnn1 dnn2 dnl -- )
  Insert the new node dnn1 before the reference node dnn2 in the list
dnl-insert-after ( dnn1 dnn2 dnl -- )
  Insert the new node dnn1 after the reference node dnn2 in the list
dnl-remove ( dnn dnl -- )
  Remove the node dnn from the list

#### Index words

dnl-index? ( n dnl -- flag )
  Check if the index n is valid in the list
dnl-get ( n dnl -- dnn )
  Get the nth node from the list
dnl-insert ( dnn n dnl -- )
  Insert the node dnn before the nth node in the list
dnl-delete ( n dnl -- dnn )
  Delete the nth node from the list, return the deleted node

#### LIFO words

dnl-push ( dnn dnl -- )
  Push the node dnn at the end of the list
dnl-pop ( dnl -- dnn | nil )
  Pop the node dnn from the end of the list
dnl-tos ( dnl -- dnn | nil )
  Get the node dnn from the end of the list

#### FIFO words

dnl-enqueue ( dnn dnl -- )
  Enqueue the node dnn at the start of the list
dnl-dequeue ( dnl -- dnn | nil )
  Dequeue the node dnn from the end of the list

#### Special words

dnl-execute ( i*x xt dnl -- j*x )
  Execute xt for every node in list
dnl-reverse ( dnl -- )
  Reverse or mirror the list

#### Inspection

dnl-dump ( dnl -- )
  Dump the list

generated 03-Jun-2010 by ofcfrth-0.10.0