summaryrefslogtreecommitdiff
path: root/src/base/exportFunction.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-07-28 16:33:48 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-07-28 16:33:48 +0000
commit554234f4f238305ee82504bdbb51096efaea74f0 (patch)
treed3ca5826ff970de0abbcb96a370a8adcac80744d /src/base/exportFunction.c
parentf1fca3a63e37866dbcc84ffbf5927697fc60c263 (diff)
- moduly si medzi sebou mozu exportovat a imporotvat funkcie
- na premiestnovanie striel a tuxov v moduloch modPipe a modTetelport sa pouzivaju funkcie z modulu modMove - uhladeny kod v module.c ;) git-svn-id: http://opensvn.csie.org/tuxanci_ng@176 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/base/exportFunction.c')
-rw-r--r--src/base/exportFunction.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/base/exportFunction.c b/src/base/exportFunction.c
new file mode 100644
index 0000000..955c0e1
--- /dev/null
+++ b/src/base/exportFunction.c
@@ -0,0 +1,73 @@
+
+#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);
+}
+
+
+