00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef INCLUDE_RSRC_MODULE_MODULE
00012 #define INCLUDE_RSRC_MODULE_MODULE
00013
00014 #include "../Portage/Surcouche.h"
00015 #include "../Portage/Tools.h"
00016 #include "../Portage/Error.h"
00017
00018 #define MODULE_FILE 256
00019 #define MODULE_NAME 128
00020 #define MODULE_VERSION 16
00021 #define MODULE_AUTOR 128
00022 #define MODULE_DESC 256
00023
00024
00025
00026
00027 typedef struct _ModuleOption
00028 {
00029 int Reload;
00030 int Ignore;
00031 int Force;
00032 int Unload;
00033 } ModuleOption;
00034
00035
00036
00037
00038 typedef struct _ModuleFonction
00039 {
00040 char Name[MODULE_NAME];
00041 ROUTINE Fonction;
00042 } ModuleFonction;
00043
00044
00045
00046
00047 class ModuleModule
00048 {
00049 private :
00050 char File[MODULE_FILE];
00051 char Name[MODULE_NAME];
00052 char Realname[MODULE_NAME];
00053 char Version[MODULE_VERSION];
00054 char Autor[MODULE_AUTOR];
00055 char Desc[MODULE_DESC];
00056 ROUTINE Fonction;
00057 MODULE ModuleAdr;
00058 int NbFonction;
00059 ModuleFonction **Fonctions;
00060 int Loaded;
00061
00062 public :
00063
00064
00065 ModuleModule();
00066
00067
00068
00069 ~ModuleModule();
00070
00071
00072
00073
00074
00075
00076
00077
00078 int Load(char *pName, char *pFile);
00079
00080
00081
00082
00083
00084
00085 int UnLoad();
00086
00087
00088
00089
00090
00091
00092
00093 int AddFonction(char *pName);
00094
00095
00096
00097
00098
00099
00100
00101 int DelFonction(int iPos);
00102
00103
00104
00105
00106
00107
00108
00109 inline int DelFonction(char *pName)
00110 {
00111 for(int i = 0; i < NbFonction; i++)
00112 {
00113 if(!strcmp(Fonctions[i]->Name, pName))
00114 return DelFonction(i);
00115 }
00116 };
00117
00118
00119
00120
00121
00122
00123
00124 inline ROUTINE GetFonction(int iPos)
00125 {
00126 if(iPos < NbFonction)
00127 return Fonctions[iPos]->Fonction;
00128
00129 return NULL;
00130 };
00131
00132
00133
00134
00135
00136
00137
00138 inline ROUTINE GetFonction(char *pName)
00139 {
00140 for(int i = 0; i < NbFonction; i++)
00141 {
00142 if(!strcmp(Fonctions[i]->Name, pName))
00143 return Fonctions[i]->Fonction;
00144 }
00145
00146 return NULL;
00147 };
00148
00149
00150
00151
00152
00153
00154 inline int GetNbFonction()
00155 {
00156 return NbFonction;
00157 };
00158
00159
00160
00161
00162
00163 inline char *GetFile()
00164 {
00165 return File;
00166 };
00167
00168
00169
00170
00171
00172 inline char *GetName()
00173 {
00174 return Name;
00175 };
00176
00177
00178
00179
00180
00181 inline char *GetRealname()
00182 {
00183 return Realname;
00184 };
00185
00186
00187
00188
00189
00190 inline char *GetVersion()
00191 {
00192 return Version;
00193 };
00194
00195
00196
00197
00198
00199 inline char *GetAutor()
00200 {
00201 return Autor;
00202 };
00203
00204
00205
00206
00207
00208 inline char *GetDesc()
00209 {
00210 return Desc;
00211 };
00212 };
00213
00214 #endif
00215