updated on Mon Jan 16 00:01:41 UTC 2012
[aur-mirror.git] / algoscore / algoscorec.patch
blob3c9146526f3089030f6d6dd1567db11ce8043e38
1 --- algoscore.c 2008-11-06 07:22:28.000000000 -0600
2 +++ algoscore.c.new 2010-08-25 16:59:35.010000562 -0500
3 @@ -26,6 +26,8 @@
4 #include <time.h>
5 #include <glib.h>
7 +#include <dlfcn.h>
9 #include "nasal.h"
10 #include "utils.h"
11 //#include "watchdog.h"
12 @@ -142,6 +144,18 @@
13 return naNil();
16 +static naRef f_printerr(naContext c, naRef me, int argc, naRef* args)
18 + int i;
19 + for(i=0; i<argc; i++) {
20 + naRef s = naStringValue(c, args[i]);
21 + if(naIsNil(s)) continue;
22 + g_printerr("%s",naStr_data(s));
23 +// fwrite(naStr_data(s), 1, naStr_len(s), stdout);
24 + }
25 + return naNil();
28 static naRef print_handler, printerr_handler;
30 void print_handler_wrapper(const gchar *s) {
31 @@ -196,6 +210,19 @@
32 return naNil();
35 +static naRef f_load_plugin(naContext c, naRef me, int argc, naRef* args) {
36 + naRef ns = naNil();
37 + void *handle = dlopen(naStr_data(args[0]),RTLD_LAZY);
38 + if(handle) {
39 + naRef (*init_func)(naContext);
40 + init_func = dlsym(handle, "init_nasal_namespace");
41 + if(init_func!=NULL) {
42 + ns = init_func(c);
43 + }
44 + }
45 + return ns;
49 gboolean algoscore_idle_proc(gpointer data) {
50 return TRUE;
51 @@ -269,6 +296,7 @@
53 #define F(x) naAddSym(ctx, namespace, #x, naNewFunc(ctx, naNewCCode(ctx, f_##x)))
54 F(print);
55 + F(printerr);
56 F(print_stderr);
57 F(set_print_handler);
58 F(set_printerr_handler);
59 @@ -280,6 +308,7 @@
60 // F(wd_init);
61 // F(wd_feed);
62 // F(wd_set_current);
63 + F(load_plugin);
64 #ifdef MAC_INTEGRATION
65 F(ige_mac_menu_set_menu_bar);
66 F(ige_mac_menu_set_quit_menu_item);