## dcl - Double Linked Cell List

### Module Description

The dcl module implements a double linked list that can store cell wide data.

### Module Words

#### List structure

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

#### List creation, initialisation and destruction

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

#### Member words

dcl-empty? ( dcl -- flag )
  Check for empty list
dcl-length@ ( dcl -- u )
  Get the number of nodes in the list
dcl-compare! ( xt dcl -- )
  Set the compare execution token for sorting the list
dcl-compare@ ( dcl -- xt )
  Get the compare execution token for sorting the list

#### List words

dcl-clear ( dnl -- )
  Delete all nodes from the list
dcl-append ( x dcl -- )
  Append the cell data x in the list
dcl-prepend ( x dcl -- )
  Prepend the cell data x in the list

#### Index words

dcl-index? ( n dcl -- flag )
  Check if the index n is valid for the list
dcl-set ( x n dcl -- )
  Set the cell data x in the nth node in the list
dcl-get ( n dcl -- x )
  Get the cell data x from the nth node from the list
dcl-insert ( x n dcl -- )
  Insert cell data x at the nth node in the list
dcl-delete ( n dcl -- x )
  Delete the nth node from the list, return the cell data x

#### Special words

dcl-count ( x dcl -- u )
  Count the number of occurrences of the cell data x in the list
dcl-execute ( i*x xt dcl -- j*x )
  Execute xt for every cell data in list
dcl-reverse ( dcl -- )
  Reverse or mirror the list

#### Search words

dcl-find ( x dcl -- n )
  Find the first index for the cell data x in the list, -1 for not found
dcl-has? ( x dcl -- flag )
  Check if the cell data x is present in the list
dcl-remove ( x dcl -- flag )
  Remove the first occurrence of the cell data x from the list, return success

#### Sort words

dcl-insert-sorted ( x dcl -- )
  Insert the cell data x sorted in the list

#### Inspection

dcl-dump ( dcl -- )
  Dump the list

generated 03-Jun-2010 by ofcfrth-0.10.0