summaryrefslogtreecommitdiff
path: root/src/library/gm
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2010-04-07 11:37:21 +0200
committerAlexis211 <alexis211@gmail.com>2010-04-07 11:37:21 +0200
commitee348973b0cb0f6481e4fd6e7494c63167c9759c (patch)
treea9f1cd82703aaeeefbf4cf449203881cfcafc0a5 /src/library/gm
parentca4f5906f284e60a7a59ca7450e3e09c4f9356e5 (diff)
downloadTCE-ee348973b0cb0f6481e4fd6e7494c63167c9759c.tar.gz
TCE-ee348973b0cb0f6481e4fd6e7494c63167c9759c.zip
More work on manager
Diffstat (limited to 'src/library/gm')
-rw-r--r--src/library/gm/call.c34
-rw-r--r--src/library/gm/call/manager.c44
2 files changed, 78 insertions, 0 deletions
diff --git a/src/library/gm/call.c b/src/library/gm/call.c
new file mode 100644
index 0000000..553fbaf
--- /dev/null
+++ b/src/library/gm/call.c
@@ -0,0 +1,34 @@
+#include <syscall.h>
+#include <gm/call.h>
+#include <gm/method.h>
+#include <gc/shm.h>
+#include <string.h>
+
+int c_handleCheck(_CHP, int method) {
+ struct user_sendrequest sr;
+ sr.func = M_HANDLECHECK_BIVV;
+ sr.a = method;
+ _CHC;
+ if (sr.errcode) return 0;
+ return sr.answeri;
+}
+
+int c_handleCheckA(_CHP, int* methods, int number) {
+ struct user_sendrequest sr;
+ sr.func = M_HANDLECHECK_BMIV;
+ void* ptr = shm_allocNew(sizeof(int) * number);
+ memcpy(ptr, methods, sizeof(int) * number);
+ sr.a = (uint32_t)methods;
+ sr.b = number;
+ _CHC;
+ shm_freeDel(ptr);
+ if (sr.errcode) return 0;
+ return sr.answeri;
+}
+
+int c_nothing(_CHP) {
+ struct user_sendrequest sr;
+ sr.func = M_NOTHING_VVVV;
+ _CHC;
+ return sr.errcode;
+}
diff --git a/src/library/gm/call/manager.c b/src/library/gm/call/manager.c
new file mode 100644
index 0000000..4b296f7
--- /dev/null
+++ b/src/library/gm/call/manager.c
@@ -0,0 +1,44 @@
+#include <syscall.h>
+#include <gm/call/manager.h>
+#include <gm/method.h>
+#include <gc/shm.h>
+#include <string.h>
+
+Object c_open(_CHP, char *c) {
+ struct user_sendrequest sr;
+ sr.func = M_OPEN_OMVV;
+ void* ptr = shm_allocNew(strlen(c) + 1);
+ strcpy(ptr, c);
+ sr.a = (uint32_t)ptr;
+ _CHC;
+ shm_freeDel(ptr);
+ if (sr.errcode) return -1;
+ return sr.answeri;
+}
+
+Object open(char *c) {
+ return c_open(1, 1, c);
+}
+
+void c_registerSvc(char *name) {
+ struct user_sendrequest sr;
+ sr.func = M_REGISTERSVC_VMOV;
+ void* ptr = shm_allocNew(strlen(name) + 1);
+ strcpy(ptr, name);
+ sr.a = (uint32_t)ptr;
+ sr.b = 0;
+ send_msg(1, &sr);
+ shm_freeDel(ptr);
+}
+
+void c_logSvc(char *log, int level) {
+ struct user_sendrequest sr;
+ sr.func = M_LOGSVC_VMIV;
+ void* ptr = shm_allocNew(strlen(log) + 1);
+ if (ptr == 0) return;
+ strcpy(ptr, log);
+ sr.a = (uint32_t)ptr;
+ sr.b = level;
+ request(1, &sr);
+ shm_freeDel(ptr);
+}