00001 00009 #include <stdio.h> 00010 #include <string.h> 00011 #include <stdarg.h> 00012 #include "vapi.h" 00013 #include "vapiLists.h" 00014 #include "vapiMacroList.h" 00015 #include "vapiMacro.h" 00016 #include "vapiGroups.h" 00017 #include "vapiOperationList.h" 00018 #include "vapiOperation.h" 00019 00020 static vOperationList *GlobalOperationList; 00021 static vGroupList *GlobalOperationGroupList; 00022 00023 vOperationList * 00024 vapiOperationListInit (vGroupList * GroupList) 00025 { 00026 GlobalOperationGroupList = GroupList; 00027 GlobalOperationList = vapiOperationListNew (); 00028 return GlobalOperationList; 00029 } 00030 00031 vOperationList * 00032 vapiOperationListNew () 00033 { 00034 vOperationList *OperationList = (vOperationList *) v_list_new (); 00035 return OperationList; 00036 } 00037 00038 static void 00039 vapiOperationListAddItem (vOperationList * OperationList, vEffect * Operation) 00040 { 00041 v_list_append ((vList *) OperationList, Operation); 00042 } 00043 00044 int 00045 vapiOperationListCountElements (vOperationList * OperationList) 00046 { 00047 return v_list_count_elements ((vList *) OperationList); 00048 } 00049 00050 vEffect * 00051 vapiOperationListSelectItem (vOperationList * OperationList, int Item) 00052 { 00053 return ((vEffect *) v_list_get ((vList *) OperationList, Item)); 00054 } 00055 00056 vEffect * 00057 vapiOperationListSelectOperation (vOperationList * OperationList, 00058 const char *name) 00059 { 00060 vEffect *item; 00061 int ListSize, i; 00062 ListSize = vapiOperationListCountElements (OperationList); 00063 00064 for (i = 0; i < ListSize; i++) 00065 { 00066 item = vapiOperationListSelectItem (OperationList, i); 00067 if (!strcmp (name, item->name)) 00068 { 00069 return ((vEffect *) 00070 v_list_get ((vList *) OperationList, i)); 00071 } 00072 } 00073 return NULL; 00074 } 00075 00076 void 00077 vapiOperationListAddOperationOne (vOperationList * OperationList, 00078 vGroupList * GroupList, vEffect * Operation) 00079 { 00080 vapiOperationListAddItem (OperationList, Operation); 00081 vapiGroupListAddItem (GroupList, Operation->Group); 00082 } 00083 00084 void 00085 vapiOperationListAddOperation (vEffect * Operation[], int OperationNumber) 00086 { 00087 int i; 00088 for (i = 0; i < OperationNumber; i++) 00089 { 00090 if (Operation[i] == NULL) 00091 { 00092 continue; 00093 } 00094 vapiOperationListAddOperationOne (GlobalOperationList, 00095 GlobalOperationGroupList, 00096 Operation[i]); 00097 } 00098 }