Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals

lstbasic.c File Reference

#include <stdlib.h>
#include "idliste.h"
#include "idprint.h"
#include "iderr.h"

Go to the source code of this file.

Functions

int IdLstAddElement (PLIST list, void *obj, int mode, PLIST_ELEMENT elem)
 Manipulation of bidirect lists or binary trees (creation, registering...).

int IdLstRemoveFirst (PLIST l)
 Suppression of the first element of a bidirectional list.

int IdLstRemoveLast (PLIST l)
 Suppression of the last element of a bidirectional list.

int IdLstRemoveElem (PLIST l, PLIST_ELEMENT e)
 Suppression of an element of a bidirectional list.

int LstAddAfter (PLIST l, void *pobj, PLIST_ELEMENT e)
 Creation of an element and insertion-AFTER a given element-inside a bidirectional * list.

int LstAddBefore (PLIST l, void *pobj, PLIST_ELEMENT e)
 Creation of an element and insertion-BEFORE a given element-inside a bidirectional * list.


Function Documentation

int IdLstAddElement PLIST  list,
void *  obj,
int  mode,
PLIST_ELEMENT  elem
 

Manipulation of bidirect lists or binary trees (creation, registering...).

Creation of a liste and registering of an element. A list can be unary (mono ou bidirectional) or represent binary tree (correponding modes are LST_NEXT et LST_PRED);

Parameters:
list List to add an new element to.
obj Object to add to the list (in the 'Object' field of the list)
mode Modality of registering to the list : LST_BEG | LST_NEXT : liste ou arbre binaire element rajoute en tete de liste par le lien Next. Ajout a la racine, 'ancien arbre' chaine a droite LST_BEG | LST_PRED : liste ou arbre binaire element rajoute en tete de liste par le lien Pred. Ajout a la racine, 'ancien arbre' chaine a gauche LST_END | LST_NEXT : liste ou arbre binaire element rajoute en queue de liste par le lien Next. Ajout a droite sur une feuille LST_END | LST_PRED : liste ou arbre binaire element rajoute en tete de liste par le lien Pred. Ajout a gauche sur une feuille LST_BEG | LST_BIDIR : liste bidirectionnelle element rajoute en tete de liste LST_END | LST_BIDIR : liste bidirectionnelle element rajoute en queue de liste LST_ELEM | LST_PRED : liste ou arbre binaire element rajoute par le champ Pred avant l'element el (param.) de la liste Insertion d'un noeud a gauche LST_ELEM | LST_NEXT : liste ou arbre binaire element rajoute par le champ Next apres l'element el (param.) de la liste Insertion d'un noeud a droite LST_ELEM | LST_BIDIR : liste bidirectionnelle element rajoute apres l'element el (param.) de la liste
elem Element of the list after which we register.
Returns:
1 on success, 0 on failure.

Definition at line 94 of file lstbasic.c.

References _IdLstPrivate, IDERR_ALLOC_ELEM, IDERR_POINTER_IS_NULL, IdErrno, IdLstFirst, IdLstLast, IdLstNbElems, LST_BEG, LST_BIDIR, LST_ELEM, LST_ELEM_AV, LST_END, LST_NEXT, LST_PRED, _elem::Next, _elem::Numero, _elem::Object, and _elem::Pred.

int IdLstRemoveElem PLIST  l,
PLIST_ELEMENT  e
 

Suppression of an element of a bidirectional list.

Parameters:
l List from which we suppress the element.
e Element to suppress.
Returns:
1 on success, 0 on failure.

Definition at line 289 of file lstbasic.c.

References _IdLstPrivate, IDERR_EMPTY_LIST, IdErrno, IdLstNbElems, IdLstNext, IdLstPrevious, IdLstRemoveFirst(), and IdLstRemoveLast().

Referenced by IdLstClear(), and IdLstDestroyElemNoControl().

int IdLstRemoveFirst PLIST  l  ) 
 

Suppression of the first element of a bidirectional list.

Parameters:
l List from which we suppress
Returns:
1 on success, 0 on failure.

Definition at line 214 of file lstbasic.c.

References _IdLstPrivate, IDERR_EMPTY_LIST, IdErrno, IdLstFirst, IdLstLast, IdLstNbElems, IdLstNext, and IdLstPrevious.

Referenced by IdLstRemoveElem().

int IdLstRemoveLast PLIST  l  ) 
 

Suppression of the last element of a bidirectional list.

Parameters:
l List from which we suppress
Returns:
1 on success, 0 on failure.

Definition at line 251 of file lstbasic.c.

References _IdLstPrivate, IDERR_EMPTY_LIST, IdErrno, IdLstFirst, IdLstLast, IdLstNbElems, IdLstNext, and IdLstPrevious.

Referenced by IdLstRemoveElem().

int LstAddAfter PLIST  l,
void *  pobj,
PLIST_ELEMENT  e
 

Creation of an element and insertion-AFTER a given element-inside a bidirectional * list.

Parameters:
l List inside which we insert the new element.
pobj Pointer to object that shall be linked we new element.
e Element AFTER which insertion should occur.
Returns:
1 on success, 0 on failure.

Definition at line 340 of file lstbasic.c.

References _IdLstPrivate, IDERR_ALLOC_ELEM, IdErrno, IdErrPrintf(), IdLstAddLast, IdLstLast, IdLstNbElems, IdLstNext, IdLstPrevious, _elem::Numero, and _elem::Object.

int LstAddBefore PLIST  l,
void *  pobj,
PLIST_ELEMENT  e
 

Creation of an element and insertion-BEFORE a given element-inside a bidirectional * list.

Parameters:
l List inside which we insert the new element.
pobj Pointer to object that shall be linked we new element.
e Element BEFORE which insertion should occur.
Returns:
1 on success, 0 on failure.

Definition at line 378 of file lstbasic.c.

References _IdLstPrivate, IDERR_ALLOC_ELEM, IdErrno, IdErrPrintf(), IdLstAddFirst, IdLstFirst, IdLstNbElems, IdLstNext, IdLstPrevious, _elem::Numero, and _elem::Object.


Generated on Wed Oct 19 09:28:36 2005 for SIMRI3D by doxygen 1.3.7