<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to ilists</title><link>https://sourceforge.net/p/theengine/wiki/ilists/</link><description>Recent changes to ilists</description><atom:link href="https://sourceforge.net/p/theengine/wiki/ilists/feed" rel="self"/><language>en</language><lastBuildDate>Sun, 09 Sep 2012 11:44:47 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/theengine/wiki/ilists/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage ilists modified by Ekkehard Morgenstern</title><link>https://sourceforge.net/p/theengine/wiki/ilists/</link><description>&lt;pre&gt;--- v3
+++ v4
@@ -5,6 +5,7 @@
 ---------------
 
 ~~~~~~
+:::C
 typedef struct _node_t { 
     struct _node_t* next;
     struct _node_t* prev;
@@ -15,6 +16,7 @@
 
 
 ~~~~~~
+:::C
 typedef struct _list_t { node_t head, tail; } list_t;
 ~~~~~~
 
@@ -27,78 +29,91 @@
 ---------
 
 ~~~~~~
+:::C
 void initNode( node_t* n );
 ~~~~~~
 
 Initializes a node to (0,0), i.e. the fields are cleared. This makes it easier to detect whether a node is installed into a list.
 
 ~~~~~~
+:::C
 void linkNode( node_t* p, node_t* c, node_t* n ); 
 ~~~~~~
 
 Internal function that shouldn't be used directly. It directly chains three nodes together, by modifying their pointers. *p* specifies the previous node, *c* specifies the current or middle node, and *n* specifies the next node.
 
 ~~~~~~
+:::C
 void unlinkNode( node_t* n );
 ~~~~~~
 
 Function to remove a node if it was in a list. It first checks if both *next* and *prev* fields are set, and if so, unlinks the node from the list and clears the *next* and *prev* fields.
 
 ~~~~~~
+:::C
 void initList( list_t* l );
 ~~~~~~
 
 Initialize a list so that *head* and *tail* point to each other.
 
 ~~~~~~
+:::C
 void addHead( list_t* l, node_t* n ); 
 ~~~~~~
 
 Insert a node at the beginning of a list (after the *head* node).
 
 ~~~~~~
+:::C
 void addTail( list_t* l, node_t* n ); 
 ~~~~~~
 
 Insert a node at the end of a list (after the *tail* node).
 
 ~~~~~~
+:::C
 bool listEmpty( list_t* l ); 
 ~~~~~~
 
 Test if a list is empty.
 
 ~~~~~~
+:::C
 node_t* firstNode( list_t* l );
 ~~~~~~
 
 Returns the first node of a list, or 0. The first node is the node following the *head* node, unless the *head* node points to the *tail* node.
 
 ~~~~~~
+:::C
 node_t* lastNode( list_t* l ); 
 ~~~~~~
 
 Returns the last node of a list, or 0. The last node is the node preceding the *tail* node, unless the *tail* node points to the *head* node.
 
 ~~~~~~
+:::C
 node_t* nextNode( node_t* n );
 ~~~~~~
 
 Returns the next node following the specified node, or 0, if *n* was the last node of the list.
 
 ~~~~~~
+:::C
 node_t* prevNode( node_t* n );
 ~~~~~~
 
 Returns the previous node preceding the specified node, or 0, if *p* was the first node of the list.
 
 ~~~~~~
+:::C
 node_t* remHead( list_t* l ); 
 ~~~~~~
 
 Obtains the first node of a list, removes it and returns it, unless the list was empty. Returns 0 in that case.
 
 ~~~~~~
+:::C
 node_t* remTail( list_t* l ); 
 ~~~~~~
 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ekkehard Morgenstern</dc:creator><pubDate>Sun, 09 Sep 2012 11:44:47 -0000</pubDate><guid>https://sourceforge.net386bd20abd5cf57d598fa5485d93e1bc3e1d3557</guid></item><item><title>WikiPage ilists modified by Ekkehard Morgenstern</title><link>https://sourceforge.net/p/theengine/wiki/ilists/</link><description>&lt;pre&gt;--- v2
+++ v3
@@ -104,6 +104,7 @@
 
 Obtains the last node of a list, removes it and returns it, unless the list was empty. Returns 0 in that case.
 
+------------------
 
 [[project_admins]]
 [[download_button]]
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ekkehard Morgenstern</dc:creator><pubDate>Sun, 09 Sep 2012 11:31:02 -0000</pubDate><guid>https://sourceforge.net2154aafe16926a7c3d0300d7445b3829c0aa1c2b</guid></item><item><title>WikiPage ilists modified by Ekkehard Morgenstern</title><link>https://sourceforge.net/p/theengine/wiki/ilists/</link><description>&lt;pre&gt;--- v1
+++ v2
@@ -1,4 +1,3 @@
-
 The Engine Internals: Lists
 ===========================
 
@@ -106,3 +105,5 @@
 Obtains the last node of a list, removes it and returns it, unless the list was empty. Returns 0 in that case.
 
 
+[[project_admins]]
+[[download_button]]
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ekkehard Morgenstern</dc:creator><pubDate>Sun, 09 Sep 2012 11:27:05 -0000</pubDate><guid>https://sourceforge.net12a97126d10329865283c9f03f56e72807447365</guid></item><item><title>WikiPage ilists modified by Ekkehard Morgenstern</title><link>https://sourceforge.net/p/theengine/wiki/ilists/</link><description>
The Engine Internals: Lists
===========================

Data Structures
---------------

~~~~~~
typedef struct _node_t { 
    struct _node_t* next;
    struct _node_t* prev;
} node_t;
~~~~~~

This data structure is used for chaining nodes in a doubly-linked list. Use it as an aggregate at the beginning of your own structure to chain nodes together.


~~~~~~
typedef struct _list_t { node_t head, tail; } list_t;
~~~~~~

This data structure is used as a list data structure. It contains two nodes, a head node and a tail node, which are meant only for bookkeeping purposes. Hence, the user-supplied nodes are always between the head node and the tail node.

When a list is empty, head and tail node point to each other.


Functions
---------

~~~~~~
void initNode( node_t* n );
~~~~~~

Initializes a node to (0,0), i.e. the fields are cleared. This makes it easier to detect whether a node is installed into a list.

~~~~~~
void linkNode( node_t* p, node_t* c, node_t* n ); 
~~~~~~

Internal function that shouldn't be used directly. It directly chains three nodes together, by modifying their pointers. *p* specifies the previous node, *c* specifies the current or middle node, and *n* specifies the next node.

~~~~~~
void unlinkNode( node_t* n );
~~~~~~

Function to remove a node if it was in a list. It first checks if both *next* and *prev* fields are set, and if so, unlinks the node from the list and clears the *next* and *prev* fields.

~~~~~~
void initList( list_t* l );
~~~~~~

Initialize a list so that *head* and *tail* point to each other.

~~~~~~
void addHead( list_t* l, node_t* n ); 
~~~~~~

Insert a node at the beginning of a list (after the *head* node).

~~~~~~
void addTail( list_t* l, node_t* n ); 
~~~~~~

Insert a node at the end of a list (after the *tail* node).

~~~~~~
bool listEmpty( list_t* l ); 
~~~~~~

Test if a list is empty.

~~~~~~
node_t* firstNode( list_t* l );
~~~~~~

Returns the first node of a list, or 0. The first node is the node following the *head* node, unless the *head* node points to the *tail* node.

~~~~~~
node_t* lastNode( list_t* l ); 
~~~~~~

Returns the last node of a list, or 0. The last node is the node preceding the *tail* node, unless the *tail* node points to the *head* node.

~~~~~~
node_t* nextNode( node_t* n );
~~~~~~

Returns the next node following the specified node, or 0, if *n* was the last node of the list.

~~~~~~
node_t* prevNode( node_t* n );
~~~~~~

Returns the previous node preceding the specified node, or 0, if *p* was the first node of the list.

~~~~~~
node_t* remHead( list_t* l ); 
~~~~~~

Obtains the first node of a list, removes it and returns it, unless the list was empty. Returns 0 in that case.

~~~~~~
node_t* remTail( list_t* l ); 
~~~~~~

Obtains the last node of a list, removes it and returns it, unless the list was empty. Returns 0 in that case.


</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ekkehard Morgenstern</dc:creator><pubDate>Sun, 09 Sep 2012 11:23:56 -0000</pubDate><guid>https://sourceforge.neted602b08f5e7a3680516360947eb5e6d8c5f445a</guid></item></channel></rss>