diff options
Diffstat (limited to 'src/base')
| -rw-r--r-- | src/base/exportFunction.c | 72 | ||||
| -rw-r--r-- | src/base/exportFunction.h | 13 | ||||
| -rwxr-xr-x | src/base/modules.c | 10 | ||||
| -rw-r--r-- | src/base/modules.h | 4 | ||||
| -rw-r--r-- | src/base/shareFunction.c | 72 | ||||
| -rw-r--r-- | src/base/shareFunction.h | 13 |
6 files changed, 92 insertions, 92 deletions
diff --git a/src/base/exportFunction.c b/src/base/exportFunction.c deleted file mode 100644 index 550e4ec..0000000 --- a/src/base/exportFunction.c +++ /dev/null @@ -1,72 +0,0 @@ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> - -#include "main.h" -#include "list.h" -#include "exportFunction.h" - -typedef struct export_fce_item_struct -{ - char *name; - void *function; -} export_fce_item_t; - -static list_t *listExportFce; - -static export_fce_item_t* newExportFceItem(char *name, void *function) -{ - export_fce_item_t *new; - - new = malloc( sizeof(export_fce_item_t) ); - new->name = strdup(name); - new->function = function; - - return new; -} - -static void destroyExportFce(export_fce_item_t *p) -{ - free(p->name); - free(p); -} - -void initExortFunction() -{ - listExportFce = newList(); -} -void addToExportFce(char *name, void *function) -{ - printf("add to export function %s\n", name); - - addList(listExportFce, newExportFceItem(name, function) ); -} - -void* getExportFce(char *name) -{ - int i; - - for( i = 0 ; i < listExportFce->count ; i++ ) - { - export_fce_item_t *this; - - this = (export_fce_item_t *)listExportFce->list[i]; - - if( strcmp(this->name, name) == 0 ) - { - return this->function; - } - } - - return NULL; -} - -void quitExportFunction() -{ - destroyListItem(listExportFce, destroyExportFce); -} - - - diff --git a/src/base/exportFunction.h b/src/base/exportFunction.h deleted file mode 100644 index 8e01fc9..0000000 --- a/src/base/exportFunction.h +++ /dev/null @@ -1,13 +0,0 @@ - -#ifndef EXPORT_FUNCTION_H - -#define EXPORT_FUNCTION_H - -extern void initExortFunction(); -extern void addToExportFce(char *name, void *function); - -extern void* getExportFce(char *name); -extern void quitExportFunction(); - -#endif - diff --git a/src/base/modules.c b/src/base/modules.c index 13b0ff2..1443f21 100755 --- a/src/base/modules.c +++ b/src/base/modules.c @@ -15,7 +15,7 @@ #include "arena.h" #include "arenaFile.h" #include "proto.h" -#include "exportFunction.h" +#include "shareFunction.h" #ifndef PUBLIC_SERVER #include "interface.h" @@ -31,8 +31,8 @@ static export_fce_t export_fce = .fce_getImage = getImage, #endif .fce_loadDepModule = loadDepModule, - .fce_addToExportFce = addToExportFce, - .fce_getExportFce = getExportFce, + .fce_addToShareFce = addToShareFce, + .fce_getShareFce = getShareFce, .fce_getValue = getArenaValue, .fce_getNetTypeGame = getNetTypeGame, @@ -210,7 +210,7 @@ static int destroyModule(module_t *p) void initModule() { listModule = newList(); - initExortFunction(); + initShareFunction(); } int isModuleLoaded(char *name) @@ -341,5 +341,5 @@ int recvMsgModule(char *msg) void quitModule() { destroyListItem(listModule, destroyModule); - quitExportFunction(); + quitShareFunction(); } diff --git a/src/base/modules.h b/src/base/modules.h index 9329dbd..e5a15f1 100644 --- a/src/base/modules.h +++ b/src/base/modules.h @@ -31,8 +31,8 @@ typedef struct export_fce_s int (*fce_getNetTypeGame)(); int (*fce_loadDepModule)(char *name); - void (*fce_addToExportFce)(char *name, void *function); - void* (*fce_getExportFce)(char *name); + void (*fce_addToShareFce)(char *name, void *function); + void* (*fce_getShareFce)(char *name); void (*fce_getTuxProportion)(tux_t *tux, int *x,int *y, int *w, int *h); void (*fce_setTuxProportion)(tux_t *tux, int x, int y); diff --git a/src/base/shareFunction.c b/src/base/shareFunction.c new file mode 100644 index 0000000..6250519 --- /dev/null +++ b/src/base/shareFunction.c @@ -0,0 +1,72 @@ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#include "main.h" +#include "list.h" +#include "shareFunction.h" + +typedef struct share_fce_item_struct +{ + char *name; + void *function; +} share_fce_item_t; + +static list_t *listShareFce; + +static share_fce_item_t* newShareFceItem(char *name, void *function) +{ + share_fce_item_t *new; + + new = malloc( sizeof(share_fce_item_t) ); + new->name = strdup(name); + new->function = function; + + return new; +} + +static void destroyShareFce(share_fce_item_t *p) +{ + free(p->name); + free(p); +} + +void initShareFunction() +{ + listShareFce = newList(); +} +void addToShareFce(char *name, void *function) +{ + printf("add to share function %s\n", name); + + addList(listShareFce, newShareFceItem(name, function) ); +} + +void* getShareFce(char *name) +{ + int i; + + for( i = 0 ; i < listShareFce->count ; i++ ) + { + share_fce_item_t *this; + + this = (share_fce_item_t *)listShareFce->list[i]; + + if( strcmp(this->name, name) == 0 ) + { + return this->function; + } + } + + return NULL; +} + +void quitShareFunction() +{ + destroyListItem(listShareFce, destroyShareFce); +} + + + diff --git a/src/base/shareFunction.h b/src/base/shareFunction.h new file mode 100644 index 0000000..fe1907a --- /dev/null +++ b/src/base/shareFunction.h @@ -0,0 +1,13 @@ + +#ifndef SHARE_FUNCTION_H + +#define SHARE_FUNCTION_H + +extern void initShareFunction(); +extern void addToShareFce(char *name, void *function); + +extern void* getShareFce(char *name); +extern void quitShareFunction(); + +#endif + |