diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-08-03 18:46:22 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-08-03 18:46:22 +0000 |
| commit | b5723cbd822b2359850c121ca69e682a607d91bd (patch) | |
| tree | c731a5c07d6188b1bdce6e90b5ac02e35800716d /src/base/shareFunction.c | |
| parent | 00c9cebac684c42741e924d11038d5591e87dacd (diff) | |
- pridany kapov patch na klavesy
- widget na nastavovanie klaves sa rozsvieti, ked je aktivny
git-svn-id: http://opensvn.csie.org/tuxanci_ng@189 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/base/shareFunction.c')
| -rw-r--r-- | src/base/shareFunction.c | 72 |
1 files changed, 72 insertions, 0 deletions
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); +} + + + |