00001 #include <stdlib.h> 00002 #include "vapiIOList.h" 00003 #include "vapiLists.h" 00004 #include "vapiAux.h" 00005 #include "vapiOptions.h" 00006 #include "vapiOptionsSet.h" 00007 00008 static char *IOTypeNameArray[6] = 00009 { "Input", "Inputs Vários", "Output", "Outputs Vários", 00010 "Input e Output", "Inputs e Outputs Vários" 00011 }; 00012 00013 vIO * 00014 vapiCreateIO (const char *IOname, const char *GroupName, 00015 const char *IOdescription, int IOtype, int InData, int OutData, 00016 vIOFunction IOFunc) 00017 { 00018 vIO *IO = malloc (sizeof (vIO)); 00019 00020 IO->IOname = vapiReturnStringPointer (IOname); 00021 IO->Group = vapiReturnStringPointer (GroupName); 00022 IO->IOdescription = vapiReturnStringPointer (IOdescription); 00023 IO->IOtype = IOtype; 00024 IO->IOFunc = IOFunc; 00025 IO->InData = InData; 00026 IO->OutData = OutData; 00027 IO->OptionsSettings = vapiOptionsSettingsInit (); 00028 return IO; 00029 } 00030 00031 00032 void 00033 vapiFreeIO (vIO * vFree) 00034 { 00035 vOptionsSettingsFree (vFree->OptionsSettings, NULL); 00036 free (vFree->IOname); 00037 free (vFree->IOdescription); 00038 free (vFree); 00039 } 00040 00041 void 00042 vapiIOPropertySetChar (int IOPosition, const char *name, 00043 const char *description) 00044 { 00045 vIO *IO; 00046 00047 IO = (vIO *) v_list_get (GlobalIOList, IOPosition); 00048 vapiOptionsSetChar (IO->OptionsSettings, name, description); 00049 00050 } 00051 00052 void 00053 vapiIOPropertySetInt (int IOPosition, const char *name, 00054 const char *description, int min, int max, 00055 int default_value, int scale) 00056 { 00057 vIO *IO; 00058 00059 IO = (vIO *) v_list_get (GlobalIOList, IOPosition); 00060 vapiOptionsSetInt (IO->OptionsSettings, name, description, min, max, 00061 default_value, scale, vSpin); 00062 00063 } 00064 00065 char * 00066 vapiIOTypeToString (int IOType) 00067 { 00068 static char *name = " "; 00069 if (IOType < 12 && IOType >= 0) 00070 { 00071 return IOTypeNameArray[IOType]; 00072 } 00073 else 00074 { 00075 return name; 00076 } 00077 } 00078 00079 vBoolean 00080 vapiIOCheckIO (vIO * IO, int InData, int OutData) 00081 { 00082 00083 if (IO->InData == InData && IO->OutData == OutData) 00084 { 00085 return vFALSE; 00086 00087 } 00088 return vTRUE; 00089 }