Referência ao ficheiro src/vapiLists.c

#include <stdio.h>
#include "vapiLists.h"
#include "vapiMacro.h"

Diagrama de dependências de inclusão para vapiLists.c:

Ir para o código fonte deste ficheiro.

Funções

void v_list_append (vList *List, vpointer data)
 adds an item to the end of the list.
int v_list_count_elements (vList *List)
 count how many elements the list has.
int v_list_count_elements_aux (vList *List, int start)
void v_list_delete_item (vList *List, vFreeFunction FreeFunction, int Delete)
 deletes the item
static void v_list_delete_item_aux (vList *List, vList *Previous, vFreeFunction FreeFunction, int Delete, int Start)
void v_list_free (vList *List, vFreeFunction FreeFunction)
 Frees the entire list. This is called when we want a list to fre totally freed.
vpointer v_list_get (vList *List, int Item)
 gets the data for the item in that position in the list.
static vpointer v_list_get_aux (vList *List, int Item, int Start)
void v_list_insert (vList *List, vpointer data, int position)
 Insert an element on the list, in the desired position.
static void v_list_insert_aux (vList *List, vList *Previous, vpointer data, int position, int Start)
void v_list_move (vList *List, int source, int destination)
 moves an item from one source to a destination
vListv_list_new ()
 creates an empty list


Documentação das funções

void v_list_append ( vList List,
vpointer  Data 
)

adds an item to the end of the list.

Parâmetros:
List The list to append the item
Data The data to store in the item.

Definido na linha 14 do ficheiro vapiLists.c.

Referências List e v_list_append().

Referenciado por v_bypass_append(), v_list_append(), vapiGroupListAddItem(), vapiGtkMacroItemMoveDown(), vapiGtkMacroItemMoveToBottom(), vapiIOListAddIO(), vapiIOListConfiguredAdd(), vapiMacroAddItem(), vapiMacroListAddItem() e vapiOperationListAddItem().

00015 {
00016 
00017         if (*List == NULL)
00018         {
00019                 *List = malloc (sizeof (vListItem));
00020                 (*List)->data = data;
00021                 (**List).Next = NULL;
00022         }
00023         else
00024         {
00025 
00026                 v_list_append ((vList *) & (**List).Next, data);
00027         }
00028 
00029 }

Grafo de chamadas desta função:

Here is the caller graph for this function:

int v_list_count_elements ( vList List  ) 

count how many elements the list has.

Retorna:
the number of elements of the list.

Definido na linha 46 do ficheiro vapiLists.c.

Referências List e v_list_count_elements_aux().

Referenciado por v_bypass_reload(), v_bypass_search(), v_list_free(), v_list_insert(), v_stopby_set(), vapiGroupListCountElements(), vapiGtkMacroTable(), vapiGtkMacroTableAux(), vapiGtkWindowIOAddInitIOList(), vapiGtkWindowIOAddPopulateGroup(), vapiGtkWindowIOConfiguredList(), vapiIOConfiguredToXML(), vapiIOListAddGroup(), vapiIOListAddIO(), vapiIOListCount(), vapiIOListSelect(), vapiIOListSelectN(), vapiMacroCountElements(), vapiMacroGetMacroIndex(), vapiMacroListCountElements(), vapiOperationListCountElements() e vIOCheckList().

00047 {
00048         if ((*List) == NULL)
00049         {
00050                 return 0;
00051         }
00052         return v_list_count_elements_aux (List, 0);
00053 }

Grafo de chamadas desta função:

Here is the caller graph for this function:

int v_list_count_elements_aux ( vList List,
int  start 
)

Definido na linha 32 do ficheiro vapiLists.c.

Referenciado por v_list_count_elements().

00033 {
00034         start = start + 1;
00035 
00036         if ((**List).Next != NULL)
00037         {
00038                 start = v_list_count_elements_aux ((vList *) & (**List).
00039                                                    Next, start);
00040         }
00041 
00042         return start;
00043 }

Here is the caller graph for this function:

void v_list_delete_item ( vList List,
vFreeFunction  FreeFunction,
int  Delete 
)

deletes the item

Parâmetros:
Delete the number of the item to delete in the list.
FreeFunction the functions that frees the data. If NULL is passed, the data is not freed.

Definido na linha 120 do ficheiro vapiLists.c.

Referências List e v_list_delete_item_aux().

Referenciado por v_list_free(), v_list_move(), vapiGtkMacroItemMoveDown(), vapiGtkMacroItemMoveToBottom(), vapiGtkMacroItemMoveToTop(), vapiGtkMacroItemMoveUp(), vapiIOConfiguredDelete(), vapiMacroDeleteItem() e vapiMacroListDeleteItem().

00121 {
00122         v_list_delete_item_aux (List, NULL, FreeFunction, Delete, 0);
00123 }

Grafo de chamadas desta função:

Here is the caller graph for this function:

static void v_list_delete_item_aux ( vList List,
vList Previous,
vFreeFunction  FreeFunction,
int  Delete,
int  Start 
) [static]

Definido na linha 56 do ficheiro vapiLists.c.

Referências List e _vListItem::Next.

Referenciado por v_list_delete_item().

00058 {
00059         vList *Temp;
00060         if (*List == NULL)
00061         {
00062                 return;
00063         }
00064 
00065         if (Start == Delete)
00066 
00067         {
00068 
00069 
00070                 if ((**List).Next != NULL)
00071                 {
00072                         if (Previous == NULL)
00073                         {
00074                                 Temp = (vList *) & (**List).Next;
00075                                 if (FreeFunction != NULL)
00076                                 {
00077                                         FreeFunction ((*List)->data);
00078                                 }
00079                                 (*List)->data = (*Temp)->data;
00080                                 (*List)->Next =
00081                                         (struct vListItem *) (*Temp)->Next;
00082                                 //free(Temp);
00083 
00084                         }
00085                         else
00086                         {
00087 
00088                                 (*Previous)->Next = (*List)->Next;
00089                                 //FreeFunction ((*List)->data);
00090                                 //free ((*List));
00091 
00092 
00093                         }
00094                 }
00095 
00096                 else
00097                 {
00098                         if (FreeFunction != NULL)
00099                         {
00100                                 FreeFunction ((*List)->data);
00101                         }
00102                         free (*List);
00103                         *List = NULL;
00104                 }
00105 
00106                 return;
00107         }
00108         if ((**List).Next != NULL)
00109         {
00110                 Start++;
00111                 v_list_delete_item_aux ((vList *) & (*List)->Next,
00112                                         (vList *) List, FreeFunction, Delete,
00113                                         Start);
00114         }
00115 
00116 
00117 }

Here is the caller graph for this function:

void v_list_free ( vList List,
vFreeFunction  FreeFunction 
)

Frees the entire list. This is called when we want a list to fre totally freed.

Parâmetros:
FreeFunction the functions that frees the data. If NULL is passed, the data is not freed.

Definido na linha 212 do ficheiro vapiLists.c.

Referências List, v_list_count_elements() e v_list_delete_item().

Referenciado por v_bypass_clean() e vapiMacroDelete().

00213 {
00214         int Count, i;
00215 
00216         Count = v_list_count_elements (List);
00217 
00218         /*
00219          * Caso existam items, eliminá-los.
00220          */
00221         if (Count > 0)
00222         {
00223                 for (i = Count; i > 0; i--)
00224                 {
00225 
00226                         v_list_delete_item (List, FreeFunction, (i - 1));
00227 
00228                 }
00229         }
00230         free(List);
00231 }

Grafo de chamadas desta função:

Here is the caller graph for this function:

vpointer v_list_get ( vList List,
int  Item 
)

gets the data for the item in that position in the list.

Parâmetros:
Item the number of the item
Retorna:
The pointer for the data
Aviso:
The returned pointer should not be freed.

Definido na linha 152 do ficheiro vapiLists.c.

Referências List e v_list_get_aux().

Referenciado por v_bypass_search(), v_input_NULL_boolean(), v_input_str_int(), v_list_move(), v_stopby_set(), vapiGroupListSelectGroup(), vapiGroupListSelectItem(), vapiGtkMacroItemMoveDown(), vapiGtkMacroItemMoveToBottom(), vapiGtkMacroItemMoveToTop(), vapiGtkMacroItemMoveUp(), vapiGtkWindowIOAdd_Add(), vapiGtkWindowIOAddInitIOList(), vapiGtkWindowIOAddPopulateGroup(), vapiGtkWindowIOAddSelectIO(), vapiGtkWindowIOAddShowDescription(), vapiGtkWindowIOConfiguredList(), vapiGtkWindowIOConfiguredSaveChanges(), vapiGtkWindowIOConfiguredSelect(), vapiIOConfiguredToXML(), vapiIOListAddGroup(), vapiIOListSelect(), vapiIOListSelectN(), vapiIOPropertySetChar(), vapiIOPropertySetInt(), vapiMacroGetMacroIndex(), vapiMacroListSelectItem(), vapiMacroSelectItem(), vapiOperationListSelectItem() e vapiOperationListSelectOperation().

00153 {
00154         return (v_list_get_aux (List, Item, 0));
00155 }

Grafo de chamadas desta função:

Here is the caller graph for this function:

static vpointer v_list_get_aux ( vList List,
int  Item,
int  Start 
) [static]

Definido na linha 126 do ficheiro vapiLists.c.

Referências List.

Referenciado por v_list_get().

00127 {
00128 
00129         if (*List == NULL)
00130         {
00131                 return NULL;
00132         }
00133 
00134         if (Start == Item)
00135         {
00136                 return (*List)->data;
00137 
00138         }
00139         if (&(**List).Next != NULL)
00140         {
00141                 Start++;
00142                 return (v_list_get_aux
00143                         ((vList *) & (**List).Next, Item, Start));
00144         }
00145         else
00146         {
00147                 return NULL;
00148         }
00149 }

Here is the caller graph for this function:

void v_list_insert ( vList List,
vpointer  data,
int  position 
)

Insert an element on the list, in the desired position.

Parâmetros:
position the item will be add in the position

Definido na linha 192 do ficheiro vapiLists.c.

Referências List, v_list_count_elements() e v_list_insert_aux().

Referenciado por v_list_move(), vapiGtkMacroItemMoveDown(), vapiGtkMacroItemMoveToTop(), vapiGtkMacroItemMoveUp() e vapiMacroAddItemPositioned().

00193 {
00194         int ListSize;
00195         
00196         ListSize = v_list_count_elements(List);
00197         /*
00198          * Verificação da posição dentros dos limites da lista.
00199          */
00200         if (position <0 || position >=ListSize)
00201         {
00202                 return;
00203         }
00204         /*
00205          * O que se pretende é ir à posição anterior e 
00206          *  adicionar o Operation seguinte. 
00207          */
00208         v_list_insert_aux ((vList *) & (**List).Next, List, data, position, 0);
00209 }

Grafo de chamadas desta função:

Here is the caller graph for this function:

static void v_list_insert_aux ( vList List,
vList Previous,
vpointer  data,
int  position,
int  Start 
) [static]

Definido na linha 160 do ficheiro vapiLists.c.

Referências _vListItem::data, List e _vListItem::Next.

Referenciado por v_list_insert().

00162 {
00163         vListItem *NewItem;
00164 
00165 
00166         if (Start == position)
00167         {
00168 
00169                 NewItem = malloc (sizeof (vListItem));
00170                 NewItem->data = data;
00171                 NewItem->Next = (struct vListItem *) (*Previous);
00172                 (*Previous) = NewItem;
00173 
00174                 return;
00175 
00176         }
00177         if (*List == NULL)
00178         {
00179                 return;
00180         }
00181         else
00182         {
00183                 Start++;
00184                 v_list_insert_aux ((vList *) & (**List).Next,
00185                                 List, data, position, Start);
00186         }
00187 
00188 
00189 
00190 }

Here is the caller graph for this function:

void v_list_move ( vList List,
int  source,
int  destination 
)

moves an item from one source to a destination

Parâmetros:
source the source position
destination the destination position

Definido na linha 233 do ficheiro vapiLists.c.

Referências List, v_list_delete_item(), v_list_get() e v_list_insert().

00235 {
00236         vpointer * Item;
00237         Item = v_list_get(List, source);
00238         
00239         v_list_delete_item (List, NULL, source);
00240         
00241         if (source < destination)
00242         {
00243                 destination--;
00244         }
00245         
00246         v_list_insert(List, Item, destination);
00247         
00248 }

Grafo de chamadas desta função:

vList * v_list_new (  ) 

creates an empty list

Definido na linha 6 do ficheiro vapiLists.c.

Referências List.

Referenciado por v_bypass_init(), vapiGroupListNew(), vapiIOListConfiguredNew(), vapiIOListNew(), vapiMacroListNew() e vapiOperationListNew().

00007 {
00008         vList *List = malloc (sizeof (vList));
00009         *List = NULL;
00010         return List;
00011 }

Here is the caller graph for this function:


Gerado em Tue Jul 24 10:38:16 2007 para Vapi por  doxygen 1.5.1