src/vapiIOList.c

Ir para a documentação deste ficheiro.
00001 
00009 #include <stdio.h>
00010 #include <stdarg.h>
00011 #include "vapiTypes.h"
00012 #include "vapiAux.h"
00013 #include "vapiLists.h"
00014 #include "vapiGroups.h"
00015 #include "vapiIOList.h"
00016 #include "vapiIO.h"
00017 #include "vapiLists.h"
00018 
00022 vIOList *
00023 vapiIOListNew ()
00024 {
00025         return v_list_new ();
00026 }
00027 
00033 int
00034 vapiIOListAddIO (vIOList * IOList, const char *IOname, const char *GroupName,
00035                  const char *IOdescription, int IOtype, int InData,
00036                  int OutData, vIOFunction IOFunc)
00037 {
00038         vIO *IO =
00039                 vapiCreateIO (IOname, GroupName, IOdescription, IOtype,
00040                               InData,
00041                               OutData, IOFunc);
00042         int position;
00043         position = v_list_count_elements (IOList);
00044         v_list_append (IOList, IO);
00045         v_debug ("IO List last element %d.", position);
00046         return position;
00047 }
00048 
00049 void
00050 vapiIOListAddGroup (vIOList * IOList, vGroupList * GroupList)
00051 {
00052         int ListSize, i;
00053         vIO *IO;
00054 
00055         ListSize = v_list_count_elements (IOList);
00056 
00057         for (i = 0; i < ListSize; i++)
00058         {
00059                 IO = v_list_get (IOList, i);
00060 
00061                 vapiGroupListAddItem (GroupList, IO->Group);
00062 
00063         }
00064 
00065 }
00066 
00070 int
00071 vapiIOListCount (vIOList * IOList)
00072 {
00073         return v_list_count_elements ((vList *) IOList);
00074 }
00075 
00076 /* 
00077  * Seleccionar o elemnto nº X da Lista
00078  */
00079 vIO *
00080 vapiIOListSelect (vIOList * IOList, const char *IOname)
00081 {
00082         int i, ListSize;
00083         vIO *tempIO;
00084         ListSize = v_list_count_elements (IOList);
00085 
00086         if (ListSize == 0)
00087         {
00088                 return NULL;
00089         }
00090 
00091         for (i = 0; i < ListSize; i++)
00092         {
00093                 tempIO = v_list_get (IOList, i);
00094                 if (!strcmp (IOname, tempIO->IOname))
00095                 {
00096                         return (vIO *) tempIO;
00097                 }
00098         }
00099 
00100         return NULL;
00101 }
00102 
00103 /* 
00104  * Seleccionar o elemnto nº X da Lista
00105  */
00106 int
00107 vapiIOListSelectN (vIOList * IOList, const char *IOname)
00108 {
00109         int i, ListSize;
00110         vIO *tempIO;
00111         ListSize = v_list_count_elements (IOList);
00112 
00113         if (ListSize == 0)
00114         {
00115                 return -1;
00116         }
00117 
00118         for (i = 0; i < ListSize; i++)
00119         {
00120                 tempIO = v_list_get (IOList, i);
00121                 if (!strcmp (IOname, tempIO->IOname))
00122                 {
00123                         return i;
00124                 }
00125         }
00126 
00127         return -1;
00128 }
00129 
00130 /*************************************************************************
00131  *            LISTA DE IO'S CONFIGURADOS PELOS UTILIZADORES              *
00132  ************************************************************************/
00133 
00137 vIOListConfigured *
00138 vapiIOListConfiguredNew ()
00139 {
00140         return v_list_new ();
00141 }
00142 
00143 void
00144 vapiIOConfiguredDelete (int item)
00145 {
00146         v_list_delete_item (GlobalIOListConfigured,
00147                             (vpointer) & vapiIOListFreeConfigured, item);
00148 
00149 }
00150 
00151 void
00152 vapiIOListFreeConfigured (vIOConfigured * vFree)
00153 {
00154         vOptionsFree (vFree->Options, vFree->IO->OptionsSettings, NULL);
00155         free (vFree);
00156 }
00157 
00158 void
00159 vapiIOListConfiguredAdd (vIO * IO, vOptions * Options)
00160 {
00161         vIOConfigured *IOConfigured = malloc (sizeof (vIOConfigured));
00162 
00163         IOConfigured->IO = IO;
00164         IOConfigured->Options = Options;
00165         v_list_append (GlobalIOListConfigured, IOConfigured);
00166 
00167 }

Gerado em Tue Jul 24 10:34:59 2007 para Vapi por  doxygen 1.5.1